diff options
author | Florent Le Coz <louiz@louiz.org> | 2012-01-27 19:13:04 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2012-01-27 19:13:04 +0100 |
commit | c9c066ae336fd315d87de39894f06ce3aca3a2fc (patch) | |
tree | 949ca12a883285e6664faacbd6f9c9d5cdf8e32b /src/core.py | |
parent | dde7875d2cb62500144b5322e7eac216de0b81c6 (diff) | |
download | poezio-c9c066ae336fd315d87de39894f06ce3aca3a2fc.tar.gz poezio-c9c066ae336fd315d87de39894f06ce3aca3a2fc.tar.bz2 poezio-c9c066ae336fd315d87de39894f06ce3aca3a2fc.tar.xz poezio-c9c066ae336fd315d87de39894f06ce3aca3a2fc.zip |
[Link Mauve] Add the ability to send and receive Attention (XEP-0224).
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py index 9b74c1a5..4364734e 100644 --- a/src/core.py +++ b/src/core.py @@ -194,6 +194,7 @@ class Core(object): self.xmpp.add_event_handler("chatstate_paused", self.on_chatstate_paused) self.xmpp.add_event_handler("chatstate_gone", self.on_chatstate_gone) self.xmpp.add_event_handler("chatstate_inactive", self.on_chatstate_inactive) + self.xmpp.add_event_handler("attention", self.on_attention) self.xmpp.register_handler(Callback('ALL THE STANZAS', connection.MatchAll(None), self.incoming_stanza)) self.timed_events = set() @@ -503,6 +504,21 @@ class Core(object): tab.input.refresh() self.doupdate() + def on_attention(self, message): + jid_from = message['from'] + self.information('%s requests your attention!' % jid_from, 'Info') + for tab in self.tabs: + if tab.get_name() == jid_from: + tab.state = 'attention' + self.refresh_tab_win() + return + for tab in self.tabs: + if tab.get_name() == jid_from.bare: + tab.state = 'attention' + self.refresh_tab_win() + return + self.information('%s tab not found.' % jid_from, 'Error') + def open_new_form(self, form, on_cancel, on_send, **kwargs): """ Open a new tab containing the form @@ -1076,6 +1092,10 @@ class Core(object): - A Muc with any new message """ for tab in self.tabs: + if tab.state == 'attention': + self.command_win('%s' % tab.nb) + return + for tab in self.tabs: if tab.state == 'private': self.command_win('%s' % tab.nb) return |