1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-15 20:12:04 +01:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1958 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-06-17 17:19:44 +00:00 committed by mtucker
parent 1be8dd417b
commit e65006c770

View file

@ -119,6 +119,7 @@ public class RosterPacket extends IQ {
private String user; private String user;
private String name; private String name;
private ItemType itemType; private ItemType itemType;
private ItemStatus itemStatus;
private List groupNames; private List groupNames;
/** /**
@ -131,6 +132,7 @@ public class RosterPacket extends IQ {
this.user = user; this.user = user;
this.name = name; this.name = name;
itemType = null; itemType = null;
itemStatus = null;
groupNames = new ArrayList(); groupNames = new ArrayList();
} }
@ -224,6 +226,9 @@ public class RosterPacket extends IQ {
if (itemType != null) { if (itemType != null) {
buf.append(" subscription=\"").append(itemType).append("\""); buf.append(" subscription=\"").append(itemType).append("\"");
} }
if (itemStatus != null) {
buf.append(" ask=\"").append(itemStatus).append("\"");
}
buf.append(">"); buf.append(">");
synchronized (groupNames) { synchronized (groupNames) {
for (int i=0; i<groupNames.size(); i++) { for (int i=0; i<groupNames.size(); i++) {
@ -237,23 +242,30 @@ public class RosterPacket extends IQ {
} }
/** /**
* The subscription status of a roster item. * The subscription status of a roster item. An optional element that indicates
* the subscription status if a change request is pending.
*/ */
public static class ItemStatus { public static class ItemStatus {
public static final ItemStatus SUBSCRIBED = new ItemStatus("subscribed"); /**
* Request to subcribe.
*/
public static final ItemStatus SUBSCRIPTION_PENDING = new ItemStatus("subscribe"); public static final ItemStatus SUBSCRIPTION_PENDING = new ItemStatus("subscribe");
/**
* Request to unsubscribe.
*/
public static final ItemStatus UNSUBCRIPTION_PENDING = new ItemStatus("unsubscribe"); public static final ItemStatus UNSUBCRIPTION_PENDING = new ItemStatus("unsubscribe");
public static ItemStatus fromString(String value) { public static ItemStatus fromString(String value) {
if ("subscribed".equals(value)) { if ("unsubscribe".equals(value)) {
return SUBSCRIBED; return SUBSCRIPTION_PENDING;
} }
else if ("subscribe".equals(value)) { else if ("subscribe".equals(value)) {
return SUBSCRIPTION_PENDING; return SUBSCRIPTION_PENDING;
} }
else { else {
return SUBSCRIBED; return null;
} }
} }
@ -271,7 +283,6 @@ public class RosterPacket extends IQ {
public String toString() { public String toString() {
return value; return value;
} }
} }
/** /**
@ -279,10 +290,29 @@ public class RosterPacket extends IQ {
*/ */
public static class ItemType { public static class ItemType {
/**
* The user and subscriber have no interest in each other's presence.
*/
public static final ItemType NONE = new ItemType("none"); public static final ItemType NONE = new ItemType("none");
/**
* The subscription request is pending.
*/
public static final ItemType PENDING = new ItemType("pending"); public static final ItemType PENDING = new ItemType("pending");
/**
* The user is interested in receiving presence updates from the subscriber.
*/
public static final ItemType TO = new ItemType("to"); public static final ItemType TO = new ItemType("to");
/**
* The subscriber is interested in receiving presence updates from the user.
*/
public static final ItemType FROM = new ItemType("from"); public static final ItemType FROM = new ItemType("from");
/**
* The user and subscriber have a mutual interest in each other's presence.
*/
public static final ItemType BOTH = new ItemType("both"); public static final ItemType BOTH = new ItemType("both");
public static ItemType fromString(String value) { public static ItemType fromString(String value) {
@ -321,4 +351,4 @@ public class RosterPacket extends IQ {
return value; return value;
} }
} }
} }