From 9c67eb961c9c1741f1483fe27db8d2a5c9b7e46c Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 30 Apr 2007 20:27:11 +0000 Subject: [PATCH] [Peritus] handle confirmation requests sent via messages for XEP-0070. fixes #2995 --- src/common/connection_handlers.py | 8 +++++++- src/gajim.py | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index ea2ef6694..504e81e0b 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1180,7 +1180,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, id = iq_obj.getTagAttr('confirm', 'id') method = iq_obj.getTagAttr('confirm', 'method') url = iq_obj.getTagAttr('confirm', 'url') - self.dispatch('HTTP_AUTH', (method, url, id, iq_obj)); + msg = iq_obj.getTagData('body') # In case it's a message with a body + self.dispatch('HTTP_AUTH', (method, url, id, iq_obj, msg)); raise common.xmpp.NodeProcessed def _ErrorCB(self, con, iq_obj): @@ -1384,6 +1385,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, if msg.getTag('event') is not None: self._pubsubEventCB(con, msg) return + # check if the message is a xep70-confirmation-request + if msg.getTag('confirm') and msg.getTag('confirm').namespace == \ + common.xmpp.NS_HTTP_AUTH: + self._HttpAuthCB(con, msg) + return msgtxt = msg.getBody() msghtml = msg.getXHTML() mtype = msg.getType() diff --git a/src/gajim.py b/src/gajim.py index cdc8d55bd..3faf6102b 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -400,13 +400,16 @@ class Interface: gc_control.show_change_nick_input_dialog(title, prompt, proposed_nick) def handle_event_http_auth(self, account, data): - #('HTTP_AUTH', account, (method, url, transaction_id, iq_obj)) + #('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg)) def response(widget, account, iq_obj, answer): self.dialog.destroy() gajim.connections[account].build_http_auth_answer(iq_obj, answer) + sec_msg = _('Do you accept this request?') + if data[4]: + sec_msg = data[4] + '\n' + sec_msg self.dialog = dialogs.YesNoDialog(_('HTTP (%s) Authorization for %s (id: %s)') \ - % (data[0], data[1], data[2]), _('Do you accept this request?'), + % (data[0], data[1], data[2]), sec_msg, on_response_yes = (response, account, data[3], 'yes'), on_response_no = (response, account, data[3], 'no'))