IqPacket.java

 1package de.gultsch.chat.xmpp;
 2
 3import de.gultsch.chat.xml.Element;
 4
 5public class IqPacket extends Element {
 6	
 7	public static final int TYPE_SET = 0;
 8	public static final int TYPE_RESULT = 1;
 9	public static final int TYPE_GET = 2;
10
11	private IqPacket(String name) {
12		super(name);
13	}
14
15	public IqPacket(String id, int type) {
16		super("iq");
17		this.setAttribute("id",id);
18		switch (type) {
19		case TYPE_SET:
20			this.setAttribute("type", "set");
21			break;
22		case TYPE_GET:
23			this.setAttribute("type", "get");
24			break;
25		case TYPE_RESULT:
26			this.setAttribute("type", "result");
27			break;
28		default:
29			break;
30		}
31	}
32	
33	public IqPacket() {
34		super("iq");
35	}
36
37}