mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-15 20:12:04 +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")) {
|
if (parser.getName().equals("item")) {
|
||||||
String jid = parser.getAttributeValue("", "jid");
|
String jid = parser.getAttributeValue("", "jid");
|
||||||
String name = parser.getAttributeValue("", "name");
|
String name = parser.getAttributeValue("", "name");
|
||||||
String subscription = parser.getAttributeValue("", "subscription");
|
// Create packet.
|
||||||
String ask = parser.getAttributeValue("", "ask");
|
|
||||||
item = new RosterPacket.Item(jid, name);
|
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);
|
RosterPacket.ItemType type = RosterPacket.ItemType.fromString(subscription);
|
||||||
if (type == RosterPacket.ItemType.NONE && "subscribe".equals(ask)) {
|
|
||||||
item.setItemType(RosterPacket.ItemType.PENDING);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
item.setItemType(type);
|
item.setItemType(type);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (parser.getName().equals("group")) {
|
if (parser.getName().equals("group")) {
|
||||||
String groupName = parser.nextText();
|
String groupName = parser.nextText();
|
||||||
item.addGroupName(groupName);
|
item.addGroupName(groupName);
|
||||||
|
|
|
@ -364,11 +364,6 @@ public class Roster {
|
||||||
RosterPacket rosterPacket = (RosterPacket)packet;
|
RosterPacket rosterPacket = (RosterPacket)packet;
|
||||||
for (Iterator i=rosterPacket.getRosterItems(); i.hasNext(); ) {
|
for (Iterator i=rosterPacket.getRosterItems(); i.hasNext(); ) {
|
||||||
RosterPacket.Item item = (RosterPacket.Item)i.next();
|
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(),
|
RosterEntry entry = new RosterEntry(item.getUser(), item.getName(),
|
||||||
item.getItemType(), connection);
|
item.getItemType(), connection);
|
||||||
// If the roster entry has any groups, remove it from the list of unfiled
|
// 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;
|
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
|
* Returns an Iterator for the group names (as Strings) that the roster item
|
||||||
* belongs to.
|
* belongs to.
|
||||||
|
@ -295,11 +313,6 @@ public class RosterPacket extends IQ {
|
||||||
*/
|
*/
|
||||||
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");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user is interested in receiving presence updates from the subscriber.
|
* The user is interested in receiving presence updates from the subscriber.
|
||||||
*/
|
*/
|
||||||
|
@ -319,9 +332,6 @@ public class RosterPacket extends IQ {
|
||||||
if ("none".equals(value)) {
|
if ("none".equals(value)) {
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
if ("pending".equals(value)) {
|
|
||||||
return PENDING;
|
|
||||||
}
|
|
||||||
else if ("to".equals(value)) {
|
else if ("to".equals(value)) {
|
||||||
return TO;
|
return TO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue