IqPacket.java

 1package eu.siacs.conversations.xmpp;
 2
 3import eu.siacs.conversations.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(int type) {
16		super("iq");
17		switch (type) {
18		case TYPE_SET:
19			this.setAttribute("type", "set");
20			break;
21		case TYPE_GET:
22			this.setAttribute("type", "get");
23			break;
24		case TYPE_RESULT:
25			this.setAttribute("type", "result");
26			break;
27		default:
28			break;
29		}
30	}
31	
32	public IqPacket() {
33		super("iq");
34	}
35
36	public String getId() {
37		return this.getAttribute("id");
38	}
39
40}