From 9e8163774d2072813e4dcb96ecb4c47b4249f04d Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Fri, 13 Jan 2006 05:07:09 +0000 Subject: [PATCH] Implement section 9.4 of RFC 3921, subscription ack'ing. Closes #1327 --- src/common/connection.py | 14 ++++++++++++++ src/gajim.py | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/common/connection.py b/src/common/connection.py index 61092bd71..58168f7ca 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -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 diff --git a/src/gajim.py b/src/gajim.py index 60e1c5421..27d1a42ea 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -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))