1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Use new presence types.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1794 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-01-16 15:41:57 +00:00 committed by mtucker
parent e83cc69730
commit 642396a100
3 changed files with 11 additions and 12 deletions

View file

@ -440,16 +440,15 @@ public class PacketReader {
* @throws Exception if an exception occurs while parsing the packet.
*/
private static Packet parsePresence(XmlPullParser parser) throws Exception {
String type = parser.getAttributeValue("", "type");
// If the type value isn't set, it should default to available.
if (type == null) {
type = "available";
}
Presence.Type type = Presence.Type.fromString(parser.getAttributeValue("", "type"));
// We only handle "available" or "unavailable" packets for now.
if (!(type.equals("available") || type.equals("unavailable"))) {
if (!(type == Presence.Type.AVAILABLE || type == Presence.Type.UNAVAILABLE)) {
System.out.println("FOUND OTHER PRESENCE TYPE: " + type);
}
Presence presence = new Presence("available".equals(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"));
presence.setFrom(parser.getAttributeValue("", "from"));
presence.setPacketID(parser.getAttributeValue("", "id"));