diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-18 14:35:19 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-18 14:35:19 +0100 |
commit | 3a98a695d4c77cf879a76262b2d370d79e8b4fdb (patch) | |
tree | 02eaf1334e374f9f1e3cadc25347bf7516f81a76 /src | |
parent | dd71e252ae07c6e9d53e8af0192a96837eddea2b (diff) |
fix bug with presences with no resource attached
Diffstat (limited to 'src')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 0e4852af..c1136f5e 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -241,34 +241,38 @@ public class XmppConnectionService extends Service { } String type = packet.getAttribute("type"); if (type == null) { - Element show = packet.findChild("show"); - if (show == null) { - contact.updatePresence(fromParts[1], Presences.ONLINE); - } else if (show.getContent().equals("away")) { - contact.updatePresence(fromParts[1], Presences.AWAY); - } else if (show.getContent().equals("xa")) { - contact.updatePresence(fromParts[1], Presences.XA); - } else if (show.getContent().equals("chat")) { - contact.updatePresence(fromParts[1], Presences.CHAT); - } else if (show.getContent().equals("dnd")) { - contact.updatePresence(fromParts[1], Presences.DND); - } - PgpEngine pgp = getPgpEngine(); - if (pgp != null) { - Element x = packet.findChild("x"); - if ((x != null) - && (x.getAttribute("xmlns") - .equals("jabber:x:signed"))) { - try { - contact.setPgpKeyId(pgp.fetchKeyId(packet - .findChild("status").getContent(), x - .getContent())); - } catch (OpenPgpException e) { - Log.d(LOGTAG, "faulty pgp. just ignore"); + if (fromParts.length == 2) { + Element show = packet.findChild("show"); + if (show == null) { + contact.updatePresence(fromParts[1], Presences.ONLINE); + } else if (show.getContent().equals("away")) { + contact.updatePresence(fromParts[1], Presences.AWAY); + } else if (show.getContent().equals("xa")) { + contact.updatePresence(fromParts[1], Presences.XA); + } else if (show.getContent().equals("chat")) { + contact.updatePresence(fromParts[1], Presences.CHAT); + } else if (show.getContent().equals("dnd")) { + contact.updatePresence(fromParts[1], Presences.DND); + } + PgpEngine pgp = getPgpEngine(); + if (pgp != null) { + Element x = packet.findChild("x"); + if ((x != null) + && (x.getAttribute("xmlns") + .equals("jabber:x:signed"))) { + try { + contact.setPgpKeyId(pgp.fetchKeyId(packet + .findChild("status").getContent(), x + .getContent())); + } catch (OpenPgpException e) { + Log.d(LOGTAG, "faulty pgp. just ignore"); + } } } + databaseBackend.updateContact(contact); + } else { + //Log.d(LOGTAG,"presence without resource "+packet.toString()); } - databaseBackend.updateContact(contact); } else if (type.equals("unavailable")) { if (fromParts.length != 2) { // Log.d(LOGTAG,"received presence with no resource "+packet.toString()); |