1 import org.jivesoftware.smack.packet.*; 2 3 6 public final class ContactListItem{ 7 8 public static final int USER=0; 9 public static final int GROUP=1; 10 public static final int SERVICE=99; private String protocol="jabber"; 12 private RosterPacket.ItemType subscription=null; private Presence presence=null; 14 private int type; 15 private String label; private String id; 18 19 20 public ContactListItem(){ 21 this.type=-1; 22 this.label=Lang.gs("contacts"); 23 } 24 25 26 public ContactListItem (String groupname){ 27 this.label=groupname; 28 this.id=groupname; 29 this.type=GROUP; 30 } 31 32 33 public ContactListItem(String name, String id, int type){ 34 this.label=name; 35 this.id=id; 36 this.type=type; 37 } 38 39 40 public ContactListItem(String nick,String id, Presence presence,RosterPacket.ItemType subscription){ 41 this.type=ContactListItem.USER; 42 this.label=nick; 43 this.id=id; 44 this.presence=presence; 45 this.subscription=subscription; 46 } 47 48 49 public ContactListItem(String nick,String id, Presence presence,RosterPacket.ItemType subscription, String protocol){ 50 this.type=ContactListItem.USER; 51 this.label=nick; 52 this.id=id; 53 this.presence=presence; 54 this.subscription=subscription; 55 this.protocol=protocol; 56 } 57 58 59 public String toString(){ 60 return label; 61 } 62 63 public String getID(){ 64 return id; 65 } 66 67 68 public void setLabel(String label){ 69 this.label=label; 70 } 71 72 73 public String getProtocol(){ 74 return protocol; 75 } 76 77 78 public void setProtocol(String protocol){ 79 this.protocol=protocol; 80 } 81 82 85 public Presence getPresence(){ 86 return presence; 87 } 88 89 public void setPresence(Presence presence){ 90 this.presence=presence; 91 } 92 93 94 public RosterPacket.ItemType getSubscription(){ 95 return subscription; 96 } 97 98 public void setSubscription(RosterPacket.ItemType subscription){ 99 this.subscription=subscription; 100 } 101 102 104 public int getType(){ 105 return type; 106 } 107 } | Popular Tags |