Show subscription changes in the info buffer - Fixes #2234

This commit is contained in:
mathieui 2012-05-17 16:45:40 +02:00
parent 65062754e1
commit 64defba0ae

View file

@ -991,6 +991,8 @@ class Core(object):
"""subscribed received""" """subscribed received"""
jid = presence['from'].bare jid = presence['from'].bare
contact = roster[jid] contact = roster[jid]
if contact.subscription not in ('both', 'from'):
self.information('%s accepted your contact proposal' % jid, 'Roster')
if contact.pending_out: if contact.pending_out:
contact.pending_out = False contact.pending_out = False
if isinstance(self.current_tab(), tabs.RosterInfoTab): if isinstance(self.current_tab(), tabs.RosterInfoTab):
@ -1000,7 +1002,8 @@ class Core(object):
"""unsubscribe received""" """unsubscribe received"""
jid = presence['from'].bare jid = presence['from'].bare
contact = roster[jid] contact = roster[jid]
if contact.subscription in ('to', 'both'): if not contact:
return
self.information('%s does not want to receive your status anymore.' % jid, 'Roster') self.information('%s does not want to receive your status anymore.' % jid, 'Roster')
self.get_tab_by_number(0).state = 'highlight' self.get_tab_by_number(0).state = 'highlight'
if isinstance(self.current_tab(), tabs.RosterInfoTab): if isinstance(self.current_tab(), tabs.RosterInfoTab):
@ -1010,13 +1013,14 @@ class Core(object):
"""unsubscribed received""" """unsubscribed received"""
jid = presence['from'].bare jid = presence['from'].bare
contact = roster[jid] contact = roster[jid]
if contact.subscription in ('both', 'from'): if not contact:
self.information('%s does not want you to receive his status anymore.'%jid, 'Roster') return
self.get_tab_by_number(0).state = 'highlight' if contact.pending_out:
elif contact.pending_out: self.information('%s rejected your contact proposal' % jid, 'Roster')
self.information('%s rejected your contact proposal.' % jid, 'Roster')
self.get_tab_by_number(0).state = 'highlight'
contact.pending_out = False 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): if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window() self.refresh_window()