Author: bct Date: 2007-06-01 19:09:56 +0200 (Fri, 01 Jun 2007) New Revision: 8186
Modified: branches/e2e_encryption/src/common/connection_handlers.py branches/e2e_encryption/src/gajim.py Log: pop up a (useless) DataFormWidget when someone initiates a session negotiation
Modified: branches/e2e_encryption/src/common/connection_handlers.py =================================================================== --- branches/e2e_encryption/src/common/connection_handlers.py 2007-05-31 21:49:49 UTC (rev 8185) +++ branches/e2e_encryption/src/common/connection_handlers.py 2007-06-01 17:09:56 UTC (rev 8186) @@ -1197,6 +1197,22 @@ self.dispatch('HTTP_AUTH', (method, url, id, iq_obj, msg)); raise common.xmpp.NodeProcessed
+ def _FeatureNegCB(self, con, stanza): + gajim.log.debug('FeatureNegCB') + feature = stanza.getTag('feature') + form = common.xmpp.DataForm(node=feature.getTag('x')) + + if form['FORM_TYPE'] == 'urn:xmpp:ssn': + self.dispatch('SESSION_NEG', (stanza.getFrom(), stanza.getThread(), form)) + else: + reply = stanza.buildReply() + reply.setType('error') + + reply.addChild(feature) + reply.addChild(node=xmpp.ErrorNode('service-unavailable', typ='cancel')) + + con.send(reply) + def _ErrorCB(self, con, iq_obj): gajim.log.debug('ErrorCB') if iq_obj.getQueryNS() == common.xmpp.NS_VERSION: @@ -1403,6 +1419,11 @@ common.xmpp.NS_HTTP_AUTH: self._HttpAuthCB(con, msg) return + if msg.getTag('feature') and msg.getTag('feature').namespace == \ + common.xmpp.NS_FEATURE: + self._FeatureNegCB(con, msg) + return + msgtxt = msg.getBody() msghtml = msg.getXHTML() mtype = msg.getType()
Modified: branches/e2e_encryption/src/gajim.py =================================================================== --- branches/e2e_encryption/src/gajim.py 2007-05-31 21:49:49 UTC (rev 8185) +++ branches/e2e_encryption/src/gajim.py 2007-06-01 17:09:56 UTC (rev 8186) @@ -103,6 +103,8 @@ from chat_control import ChatControlBase from atom_window import AtomWindow
+import negotiation + from common import exceptions from common.zeroconf import connection_zeroconf from common import dbus_support @@ -1653,6 +1655,11 @@ atom_entry, = data AtomWindow.newAtomEntry(atom_entry)
+ def handle_session_negotiation(self, account, data): + jid, thread_id, form = data + # XXX check negotiation state, etc. + negotiation.FeatureNegotiationWindow(account, jid, thread_id, form) + def handle_event_privacy_lists_received(self, account, data): # ('PRIVACY_LISTS_RECEIVED', account, list) if not self.instances.has_key(account): @@ -2090,6 +2097,7 @@ 'SEARCH_FORM': self.handle_event_search_form, 'SEARCH_RESULT': self.handle_event_search_result, 'RESOURCE_CONFLICT': self.handle_event_resource_conflict, + 'SESSION_NEG': self.handle_session_negotiation, } gajim.handlers = self.handlers