diff options
author | Lance Stout <lancestout@gmail.com> | 2013-07-05 14:04:48 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-07-05 14:04:48 -0700 |
commit | c49017c6f168f8026815ba8ab14a81cb59c73591 (patch) | |
tree | f98e9825519cfd93c4988afa95828ba3e5ef6264 | |
parent | cedc9dd175afba02e7beba21dc9eb4de1e63623d (diff) | |
download | slixmpp-c49017c6f168f8026815ba8ab14a81cb59c73591.tar.gz slixmpp-c49017c6f168f8026815ba8ab14a81cb59c73591.tar.bz2 slixmpp-c49017c6f168f8026815ba8ab14a81cb59c73591.tar.xz slixmpp-c49017c6f168f8026815ba8ab14a81cb59c73591.zip |
Update 319 plugin to update XEP-0012/256 last activity too.
-rw-r--r-- | sleekxmpp/plugins/xep_0319/idle.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0319/idle.py b/sleekxmpp/plugins/xep_0319/idle.py index 8f3d104b..e541e0ad 100644 --- a/sleekxmpp/plugins/xep_0319/idle.py +++ b/sleekxmpp/plugins/xep_0319/idle.py @@ -19,7 +19,7 @@ from sleekxmpp.plugins.xep_0319 import stanza class XEP_0319(BasePlugin): name = 'xep_0319' description = 'XEP-0319: Last User Interaction in Presence' - dependencies = set() + dependencies = set(['xep_0012']) stanza = stanza def plugin_init(self): @@ -46,12 +46,17 @@ class XEP_0319(BasePlugin): self.xmpp.remove_handler('Idle Presence') def idle(self, jid=None, since=None): + seconds = None if since is None: since = datetime.now() + else: + seconds = datetime.now() - since self.api['set_idle'](jid, None, None, since) + self.xmpp['xep_0012'].set_last_activity(jid=jid, seconds=seconds) def active(self, jid=None): self.api['set_idle'](jid, None, None, None) + self.xmpp['xep_0012'].del_last_activity(jid) def _set_idle(self, jid, node, ifrom, data): self._idle_stamps[jid] = data |