diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-02 01:04:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-02 01:04:53 +0200 |
commit | 65c247399d4b5d8d78953e72cab89b7cf6b890fa (patch) | |
tree | fc5ac20a4e167b1cc40f189ec01d46658c348276 /src | |
parent | b042a07c6970e404b97c4b476a98a3b5411ec1d8 (diff) | |
download | poezio-65c247399d4b5d8d78953e72cab89b7cf6b890fa.tar.gz poezio-65c247399d4b5d8d78953e72cab89b7cf6b890fa.tar.bz2 poezio-65c247399d4b5d8d78953e72cab89b7cf6b890fa.tar.xz poezio-65c247399d4b5d8d78953e72cab89b7cf6b890fa.zip |
Fix #2323 (implement XEP-0012 last activity)
TODO: check if this method of setting activity isn’t a bit heavy.
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core.py b/src/core.py index caa3ae19..1ae34d3d 100644 --- a/src/core.py +++ b/src/core.py @@ -505,6 +505,7 @@ class Core(object): return res while self.running: + self.xmpp.plugin['xep_0012'].begin_idle(jid=self.xmpp.boundjid) big_char_list = [replace_key_with_bound(key)\ for key in self.read_keyboard()] # whether to refresh after ALL keys have been handled @@ -2297,7 +2298,7 @@ class Core(object): def command_last_activity(self, arg): """ - /activity <jid> + /last_activity <jid> """ def callback(iq): if iq['type'] != 'result': @@ -2325,7 +2326,14 @@ class Core(object): self.xmpp.plugin['xep_0012'].get_last_activity(jid, block=False, callback=callback) def completion_last_activity(self, the_input): - return the_input.new_completion([jid for jid in roster.jids()], 1, quotify=False) + """ + Completion for /last_activity <jid> + """ + n = the_input.get_argument_position(quoted=False) + if n >= 2: + return + comp = reduce(lambda x, y: x + [i.jid for i in y], (roster[jid].resources for jid in roster.jids() if len(roster[jid])), []) + return the_input.new_completion(sorted(comp), 1, '', quotify=False) def command_mood(self, arg): """ |