From 6cea9b8bd3e615b0932be4db42e004e613a30f89 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 25 Apr 2003 20:18:49 +0000 Subject: [PATCH] Roster and presence packet reading fixes. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1899 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/PacketReader.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketReader.java b/source/org/jivesoftware/smack/PacketReader.java index 6446cefd1..5d5593b0e 100644 --- a/source/org/jivesoftware/smack/PacketReader.java +++ b/source/org/jivesoftware/smack/PacketReader.java @@ -436,8 +436,15 @@ class PacketReader { String jid = parser.getAttributeValue("", "jid"); String name = parser.getAttributeValue("", "name"); String subscription = parser.getAttributeValue("", "subscription"); + String ask = parser.getAttributeValue("", "ask"); item = new RosterPacket.Item(jid, name); - item.setItemType(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); + } } if (parser.getName().equals("group")) { String groupName = parser.nextText(); @@ -590,12 +597,6 @@ class PacketReader { */ private static Packet parsePresence(XmlPullParser parser) throws Exception { Presence.Type type = Presence.Type.fromString(parser.getAttributeValue("", "type")); - // We only handle "available" or "unavailable" packets for now. - if (!(type == Presence.Type.AVAILABLE || type == Presence.Type.UNAVAILABLE)) { - System.out.println("FOUND OTHER PRESENCE TYPE: " + type); - } - - // Otherwise, it's a presence packet that has nothing to do with roster items. Presence presence = new Presence(type); presence.setTo(parser.getAttributeValue("", "to"));