Show
Ignore:
Timestamp:
08/30/07 22:28:21 (15 months ago)
Author:
roidelapluie
Message:

0.11.2: [misc] fix entity caps behaviour. fixes #3001

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/common/connection_handlers.py

    r8620 r8629  
    654654                iq.setAttr('id', id) 
    655655                query = iq.setTag('query') 
    656                 # bytestream transfers 
    657                 feature = common.xmpp.Node('feature') 
    658                 feature.setAttr('var', common.xmpp.NS_BYTESTREAM) 
    659                 query.addChild(node=feature) 
    660                 # si methods 
    661                 feature = common.xmpp.Node('feature') 
    662                 feature.setAttr('var', common.xmpp.NS_SI) 
    663                 query.addChild(node=feature) 
    664                 # filetransfers transfers 
    665                 feature = common.xmpp.Node('feature') 
    666                 feature.setAttr('var', common.xmpp.NS_FILE) 
    667                 query.addChild(node=feature) 
    668                 # exposing adhoc commands 
    669                 feature = common.xmpp.Node('feature') 
    670                 feature.setAttr('var', common.xmpp.NS_COMMANDS) 
    671                 query.addChild(node=feature) 
     656                query.setAttr('node','http://gajim.org/caps#' + gajim.version) 
     657                for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI, \ 
     658                                                common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS): 
     659                        feature = common.xmpp.Node('feature') 
     660                        feature.setAttr('var', f) 
     661                        query.addChild(node=feature) 
    672662                 
    673663                self.connection.send(iq) 
     
    732722                        iq = iq_obj.buildReply('result') 
    733723                        q = iq.getTag('query') 
     724                        if node: 
     725                                q.setAttr('node', node) 
    734726                        q.addChild('identity', attrs = {'type': 'pc', 'category': 'client', 
    735727                                'name': 'Gajim'}) 
     
    739731                        client_version = 'http://gajim.org/caps#' + gajim.version 
    740732 
    741                         if node in (None, client_version) or extension == 'ftrans': 
     733                        if node in (None, client_version): 
    742734                                q.addChild('feature', attrs = {'var': common.xmpp.NS_BYTESTREAM}) 
    743735                                q.addChild('feature', attrs = {'var': common.xmpp.NS_SI}) 
    744736                                q.addChild('feature', attrs = {'var': common.xmpp.NS_FILE}) 
    745                         if node in (None, client_version) or extension == 'xhtml': 
    746                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_XHTML_IM}) 
    747                         if node in (None, client_version): 
    748737                                q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC}) 
    749                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_CHATSTATES}) 
    750738                                q.addChild('feature', attrs = {'var': common.xmpp.NS_COMMANDS}) 
    751739                                q.addChild('feature', attrs = {'var': common.xmpp.NS_DISCO_INFO}) 
     740 
     741                        if (node is None or extension == 'cstates') and gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': 
     742                                q.addChild('feature', attrs = {'var': common.xmpp.NS_CHATSTATES}) 
     743 
     744                        if (node is None or extension == 'xhtml') and not gajim.config.get('ignore_incoming_xhtml'): 
     745                                q.addChild('feature', attrs = {'var': common.xmpp.NS_XHTML_IM}) 
    752746 
    753747                        if q.getChildren(): 
     
    831825                c = p.setTag('c', namespace = common.xmpp.NS_CAPS) 
    832826                c.setAttr('node', 'http://gajim.org/caps') 
    833                 c.setAttr('ext', 'ftrans xhtml') 
     827                ext = [] 
     828                if not gajim.config.get('ignore_incoming_xhtml'): 
     829                        ext.append('xhtml') 
     830                if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': 
     831                        ext.append('cstates') 
     832  
     833                if len(ext): 
     834                        c.setAttr('ext', ' '.join(ext)) 
    834835                c.setAttr('ver', gajim.version) 
    835836                return p