diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-04 16:16:14 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-06-04 16:16:14 +0200 |
commit | 71e911717697078141c3669134ad9268e9753ea0 (patch) | |
tree | 93c9833d28048c15aefe4109105523a4a0e002d9 /src/main/java/eu/siacs/conversations/parser/PresenceParser.java | |
parent | 6639d0f23bb983cae7234d6b15f9875464c67093 (diff) |
opt-in to send last userinteraction in presence
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 15 |
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) { |