diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-01-11 06:43:31 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-01-11 06:43:31 +0100 |
commit | 749933fc16005d8e81d54830f532dd1cb9f85773 (patch) | |
tree | bd34b228e49f83c225afdd8ea9fa661b5ec36504 /src/core.py | |
parent | 6bb94cdf0b88671b2ac12eb67f70555da565f238 (diff) | |
download | poezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.gz poezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.bz2 poezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.xz poezio-749933fc16005d8e81d54830f532dd1cb9f85773.zip |
/accept and /deny commands
User can now decide to accept or deny a subscription, in
the roster
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index 6fdb883c..c3b3510d 100644 --- a/src/core.py +++ b/src/core.py @@ -159,7 +159,7 @@ class Core(object): self.xmpp.add_event_handler("got_offline" , self.on_got_offline) self.xmpp.add_event_handler("roster_update", self.on_roster_update) self.xmpp.add_event_handler("changed_status", self.on_presence) - + self.xmpp.add_event_handler("changed_subscription", self.on_changed_subscription) self.information(_('Welcome to poezio!')) self.refresh_window() @@ -594,6 +594,22 @@ class Core(object): if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() + def on_changed_subscription(self, presence): + """ + Triggered whenever a presence stanza with a type of subscribe, subscribed, unsubscribe, or unsubscribed is received. + """ + if presence['type'] == 'subscribe': + jid = presence['from'].bare + contact = roster.get_contact_by_jid(jid) + if not contact: + contact = Contact(jid) + roster.add_contact(contact, jid) + roster.edit_groups_of_contact(contact, []) + contact.set_ask('asked') + if isinstance(self.current_tab(), tabs.RosterInfoTab): + self.refresh_window() + + def full_screen_redraw(self): """ Completely erase and redraw the screen |