aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2016-01-17 16:46:32 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2016-01-24 17:46:08 -0500
commit000f59d614d07ac573c1159ea964ebfee6ecbef5 (patch)
tree8357d260780d9ccc8a4bef7b37ebc72681d51d8b /src/main/java
parentbf5b2f73f5a61f0a0179c9d4431579f87eecb001 (diff)
Fetch cached caps result on new presence
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Presence.java5
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java12
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) {