mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Code cleanup.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1965 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
34acbe9cee
commit
302f9a4778
3 changed files with 26 additions and 21 deletions
|
@ -433,17 +433,17 @@ class PacketReader {
|
|||
if (parser.getName().equals("item")) {
|
||||
String jid = parser.getAttributeValue("", "jid");
|
||||
String name = parser.getAttributeValue("", "name");
|
||||
String subscription = parser.getAttributeValue("", "subscription");
|
||||
String ask = parser.getAttributeValue("", "ask");
|
||||
// Create packet.
|
||||
item = new RosterPacket.Item(jid, name);
|
||||
// Set status.
|
||||
String ask = parser.getAttributeValue("", "ask");
|
||||
RosterPacket.ItemStatus status = RosterPacket.ItemStatus.fromString(ask);
|
||||
item.setItemStatus(status);
|
||||
// Set type.
|
||||
String subscription = parser.getAttributeValue("", "subscription");
|
||||
RosterPacket.ItemType type = RosterPacket.ItemType.fromString(subscription);
|
||||
if (type == RosterPacket.ItemType.NONE && "subscribe".equals(ask)) {
|
||||
item.setItemType(RosterPacket.ItemType.PENDING);
|
||||
}
|
||||
else {
|
||||
item.setItemType(type);
|
||||
}
|
||||
}
|
||||
if (parser.getName().equals("group")) {
|
||||
String groupName = parser.nextText();
|
||||
item.addGroupName(groupName);
|
||||
|
|
|
@ -364,11 +364,6 @@ public class Roster {
|
|||
RosterPacket rosterPacket = (RosterPacket)packet;
|
||||
for (Iterator i=rosterPacket.getRosterItems(); i.hasNext(); ) {
|
||||
RosterPacket.Item item = (RosterPacket.Item)i.next();
|
||||
if (item.getItemType() == RosterPacket.ItemType.TO ||
|
||||
item.getItemType() == RosterPacket.ItemType.BOTH)
|
||||
{
|
||||
|
||||
}
|
||||
RosterEntry entry = new RosterEntry(item.getUser(), item.getName(),
|
||||
item.getItemType(), connection);
|
||||
// If the roster entry has any groups, remove it from the list of unfiled
|
||||
|
|
|
@ -181,6 +181,24 @@ public class RosterPacket extends IQ {
|
|||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the roster item status.
|
||||
*
|
||||
* @return the roster item status.
|
||||
*/
|
||||
public ItemStatus getItemStatus() {
|
||||
return itemStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the roster item status.
|
||||
*
|
||||
* @param itemStatus the roster item status.
|
||||
*/
|
||||
public void setItemStatus(ItemStatus itemStatus) {
|
||||
this.itemStatus = itemStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator for the group names (as Strings) that the roster item
|
||||
* belongs to.
|
||||
|
@ -295,11 +313,6 @@ public class RosterPacket extends IQ {
|
|||
*/
|
||||
public static final ItemType NONE = new ItemType("none");
|
||||
|
||||
/**
|
||||
* The subscription request is pending.
|
||||
*/
|
||||
public static final ItemType PENDING = new ItemType("pending");
|
||||
|
||||
/**
|
||||
* The user is interested in receiving presence updates from the subscriber.
|
||||
*/
|
||||
|
@ -319,9 +332,6 @@ public class RosterPacket extends IQ {
|
|||
if ("none".equals(value)) {
|
||||
return NONE;
|
||||
}
|
||||
if ("pending".equals(value)) {
|
||||
return PENDING;
|
||||
}
|
||||
else if ("to".equals(value)) {
|
||||
return TO;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue