summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-17 16:45:40 +0200
committermathieui <mathieui@mathieui.net>2012-05-17 16:45:40 +0200
commit64defba0ae18812196caadab26cdea0d24849be5 (patch)
treedaf6863c7cb41e616111c96281d15199240eb898
parent65062754e194e2c1fadf4a30677444730e73ec71 (diff)
downloadpoezio-64defba0ae18812196caadab26cdea0d24849be5.tar.gz
poezio-64defba0ae18812196caadab26cdea0d24849be5.tar.bz2
poezio-64defba0ae18812196caadab26cdea0d24849be5.tar.xz
poezio-64defba0ae18812196caadab26cdea0d24849be5.zip
Show subscription changes in the info buffer - Fixes #2234
-rw-r--r--src/core.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/core.py b/src/core.py
index ee7fcf2f..3ac0a0b5 100644
--- a/src/core.py
+++ b/src/core.py
@@ -991,6 +991,8 @@ class Core(object):
"""subscribed received"""
jid = presence['from'].bare
contact = roster[jid]
+ if contact.subscription not in ('both', 'from'):
+ self.information('%s accepted your contact proposal' % jid, 'Roster')
if contact.pending_out:
contact.pending_out = False
if isinstance(self.current_tab(), tabs.RosterInfoTab):
@@ -1000,9 +1002,10 @@ class Core(object):
"""unsubscribe received"""
jid = presence['from'].bare
contact = roster[jid]
- if contact.subscription in ('to', 'both'):
- self.information('%s does not want to receive your status anymore.' % jid, 'Roster')
- self.get_tab_by_number(0).state = 'highlight'
+ if not contact:
+ return
+ self.information('%s does not want to receive your status anymore.' % jid, 'Roster')
+ self.get_tab_by_number(0).state = 'highlight'
if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window()
@@ -1010,13 +1013,14 @@ class Core(object):
"""unsubscribed received"""
jid = presence['from'].bare
contact = roster[jid]
- if contact.subscription in ('both', 'from'):
- self.information('%s does not want you to receive his status anymore.'%jid, 'Roster')
- self.get_tab_by_number(0).state = 'highlight'
- elif contact.pending_out:
- self.information('%s rejected your contact proposal.' % jid, 'Roster')
- self.get_tab_by_number(0).state = 'highlight'
+ if not contact:
+ return
+ if contact.pending_out:
+ self.information('%s rejected your contact proposal' % jid, 'Roster')
contact.pending_out = False
+ else:
+ self.information('%s does not want you to receive his/her/its status anymore.'%jid, 'Roster')
+ self.get_tab_by_number(0).state = 'highlight'
if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window()