From e5fac7315e3968d2e0567bee7824d7db5bb66b9e Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sun, 18 May 2008 17:35:00 +0000 Subject: [PATCH] don't create sessions for pubsub and xep-0070 messages --- src/common/connection_handlers.py | 68 +++++++++++++++---------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 06b2d037b..8a8f925b8 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1599,6 +1599,40 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, gajim.log.debug('MessageCB') frm = helpers.get_full_jid_from_iq(msg) + + # check if the message is pubsub#event + if msg.getTag('event') is not None: + self._pubsubEventCB(con, msg) + return + + # check if the message is a XEP-0070 confirmation request + if msg.getTag('confirm', namespace=common.xmpp.NS_HTTP_AUTH): + self._HttpAuthCB(con, msg) + return + + # invitations + invite = None + encTag = msg.getTag('x', namespace=common.xmpp.NS_ENCRYPTED) + + if not encTag: + invite = msg.getTag('x', namespace = common.xmpp.NS_MUC_USER) + if invite and not invite.getTag('invite'): + invite = None + + # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED + # invitation + # stanza (MUC XEP) remove in 2007, as we do not do NOT RECOMMENDED + xtags = msg.getTags('x') + for xtag in xtags: + if xtag.getNamespace() == common.xmpp.NS_CONFERENCE and not invite: + room_jid = xtag.getAttr('jid') + is_continued = False + if xtag.getTag('continue'): + is_continued = True + self.dispatch('GC_INVITATION', (room_jid, frm, '', None, + is_continued)) + return + mtype = msg.getType() thread_id = msg.getThread() @@ -1626,16 +1660,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, if thread_id and not session.received_thread_id: session.received_thread_id = True - # check if the message is pubsub#event - if msg.getTag('event') is not None: - self._pubsubEventCB(con, msg) - return - - # check if the message is a XEP-0070 confirmation request - if msg.getTag('confirm', namespace=common.xmpp.NS_HTTP_AUTH): - self._HttpAuthCB(con, msg) - return - # check if the message is a XEP-0020 feature negotiation request if msg.getTag('feature', namespace=common.xmpp.NS_FEATURE): if gajim.HAVE_PYCRYPTO: @@ -1660,7 +1684,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, msgtxt = msg.getBody() subject = msg.getSubject() # if not there, it's None - frm = helpers.get_full_jid_from_iq(msg) jid = helpers.get_jid_from_iq(msg) addressTag = msg.getTag('addresses', namespace = common.xmpp.NS_ADDRESS) @@ -1672,29 +1695,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, frm = address.getAttr('jid') jid = gajim.get_jid_without_resource(frm) - # invitations - invite = None - encTag = msg.getTag('x', namespace=common.xmpp.NS_ENCRYPTED) - - if not encTag: - invite = msg.getTag('x', namespace = common.xmpp.NS_MUC_USER) - if invite and not invite.getTag('invite'): - invite = None - - # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED - # invitation - # stanza (MUC XEP) remove in 2007, as we do not do NOT RECOMMENDED - xtags = msg.getTags('x') - for xtag in xtags: - if xtag.getNamespace() == common.xmpp.NS_CONFERENCE and not invite: - room_jid = xtag.getAttr('jid') - is_continued = False - if xtag.getTag('continue'): - is_continued = True - self.dispatch('GC_INVITATION', (room_jid, frm, '', None, - is_continued)) - return - if encTag and self.USE_GPG: encmsg = encTag.getData()