diff options
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Presence.java | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Presence.java b/src/main/java/eu/siacs/conversations/entities/Presence.java index adba74d1..d31bb69d 100644 --- a/src/main/java/eu/siacs/conversations/entities/Presence.java +++ b/src/main/java/eu/siacs/conversations/entities/Presence.java @@ -22,8 +22,11 @@ public class Presence implements Comparable { } protected final Status status; + protected final ServiceDiscoveryResult disco; + + public Presence(Element show, ServiceDiscoveryResult disco) { + this.disco = disco; - public Presence(Element show) { if ((show == null) || (show.getContent() == null)) { this.status = Status.ONLINE; } else if (show.getContent().equals("away")) { diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 46c8a35d..88631a91 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -9,8 +9,8 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.MucOptions; -import eu.siacs.conversations.entities.Presences; import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.entities.ServiceDiscoveryResult; import eu.siacs.conversations.generator.PresenceGenerator; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; @@ -177,7 +177,15 @@ public class PresenceParser extends AbstractParser implements } } int sizeBefore = contact.getPresences().size(); - contact.updatePresence(presence, new Presence(packet.findChild("show"))); + + ServiceDiscoveryResult disco = null; + Element caps = packet.findChild("c", "http://jabber.org/protocol/caps"); + if (caps != null) { + disco = mXmppConnectionService.databaseBackend. + findDiscoveryResult(caps.getAttribute("hash"), caps.getAttribute("ver")); + } + contact.updatePresence(presence, new Presence(packet.findChild("show"), disco)); + PgpEngine pgp = mXmppConnectionService.getPgpEngine(); Element x = packet.findChild("x", "jabber:x:signed"); if (pgp != null && x != null) { |