Implement section 9.4 of RFC 3921, subscription ack'ing. Closes #1327
This commit is contained in:
parent
931ee24389
commit
9e8163774d
2 changed files with 17 additions and 0 deletions
|
@ -2001,6 +2001,20 @@ class Connection:
|
|||
return
|
||||
self.to_be_sent.append(stanza)
|
||||
|
||||
def ack_subscribed(self, jid):
|
||||
if not self.connection:
|
||||
return
|
||||
gajim.log.debug('ack\'ing subscription complete for %s' % jid)
|
||||
p = common.xmpp.Presence(jid, 'subscribe')
|
||||
self.to_be_sent.append(p)
|
||||
|
||||
def ack_unsubscribed(self, jid):
|
||||
if not self.connection:
|
||||
return
|
||||
gajim.log.debug('ack\'ing unsubscription complete for %s' % jid)
|
||||
p = common.xmpp.Presence(jid, 'unsubscribe')
|
||||
self.to_be_sent.append(p)
|
||||
|
||||
def request_subscription(self, jid, msg):
|
||||
if not self.connection:
|
||||
return
|
||||
|
|
|
@ -585,12 +585,15 @@ class Interface:
|
|||
dialogs.InformationDialog(_('Authorization accepted'),
|
||||
_('The contact "%s" has authorized you to see his or her status.')
|
||||
% jid)
|
||||
gajim.connections[account].ack_subscribed(jid)
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('Subscribed', (account, array))
|
||||
|
||||
def handle_event_unsubscribed(self, account, jid):
|
||||
dialogs.InformationDialog(_('Contact "%s" removed subscription from you') % jid,
|
||||
_('You will always see him or her as offline.'))
|
||||
# FIXME: Per RFC 3921, we can "deny" ack as well, but the GUI does not show deny
|
||||
gajim.connections[account].ack_unsubscribed(jid)
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('Unsubscribed', (account, jid))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue