diff options
Diffstat (limited to 'src/eu/siacs')
-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()); |