aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-04 16:16:14 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-06-04 16:16:14 +0200
commit71e911717697078141c3669134ad9268e9753ea0 (patch)
tree93c9833d28048c15aefe4109105523a4a0e002d9 /src/main/java/eu/siacs/conversations/parser/PresenceParser.java
parent6639d0f23bb983cae7234d6b15f9875464c67093 (diff)
opt-in to send last userinteraction in presence
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
index b5718b612..b11a6effd 100644
--- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.parser;
import android.util.Log;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@@ -206,6 +207,20 @@ public class PresenceParser extends AbstractParser implements
mXmppConnectionService.fetchCaps(account, from, presence);
}
+ final Element idle = packet.findChild("idle","urn:xmpp:idle:1");
+ if (idle != null) {
+ contact.flagInactive();
+ String since = idle.getAttribute("since");
+ try {
+ contact.setLastseen(AbstractParser.parseTimestamp(since));
+ } catch (NullPointerException | ParseException e) {
+ contact.setLastseen(System.currentTimeMillis());
+ }
+ } else {
+ contact.flagActive();
+ contact.setLastseen(AbstractParser.parseTimestamp(packet));
+ }
+
PgpEngine pgp = mXmppConnectionService.getPgpEngine();
Element x = packet.findChild("x", "jabber:x:signed");
if (pgp != null && x != null) {