Show
Ignore:
Timestamp:
04/21/08 00:58:47 (7 months ago)
Author:
asterix
Message:

new XEP-0115 implementation (version 1.5)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/connection_handlers.py

    r9494 r9508  
    668668                iq.setAttr('id', id) 
    669669                query = iq.setTag('query') 
    670                 query.setAttr('node','http://gajim.org/caps#' + gajim.version.split('-', 
     670                query.setAttr('node','http://gajim.org#' + gajim.version.split('-', 
    671671                        1)[0]) 
    672672                for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI, 
     
    745745                        if node: 
    746746                                q.setAttr('node', node) 
    747                         q.addChild('identity', attrs = {'type': 'pc', 'category': 'client', 
    748                                 'name': 'Gajim'}) 
     747                        q.addChild('identity', attrs = gajim.gajim_identity) 
    749748                        extension = None 
    750749                        if node and node.find('#') != -1: 
    751750                                extension = node[node.index('#') + 1:] 
    752                         client_version = 'http://gajim.org/caps#' + gajim.version.split('-', 
    753                                 1)[0] 
     751                        client_version = 'http://gajim.org#' + gajim.caps_hash 
    754752 
    755753                        if node in (None, client_version): 
    756                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_BYTESTREAM}) 
    757                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_SI}) 
    758                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_FILE}) 
    759                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC}) 
    760                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC_USER}) 
    761                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC_ADMIN}) 
    762                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC_OWNER}) 
    763                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC_CONFIG}) 
    764                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_COMMANDS}) 
    765                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_DISCO_INFO}) 
    766                                 q.addChild('feature', attrs = {'var': 'ipv6'}) 
    767                                 q.addChild('feature', attrs = {'var': 'jabber:iq:gateway'}) 
    768                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_LAST}) 
    769                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_PRIVACY}) 
    770                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_PRIVATE}) 
    771                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_REGISTER}) 
    772                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_VERSION}) 
    773                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_DATA}) 
    774                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_ENCRYPTED}) 
    775                                 q.addChild('feature', attrs = {'var': 'msglog'}) 
    776                                 q.addChild('feature', attrs = {'var': 'sslc2s'}) 
    777                                 q.addChild('feature', attrs = {'var': 'stringprep'}) 
    778                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_PING}) 
    779                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY}) 
    780                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY + '+notify'}) 
    781                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE}) 
    782                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE + '+notify'}) 
    783                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MOOD}) 
    784                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_MOOD + '+notify'}) 
    785                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_ESESSION_INIT}) 
    786  
    787                         if (node is None or extension == 'cstates') and gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': 
    788                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_CHATSTATES}) 
    789  
    790                         if (node is None or extension == 'xhtml') and not gajim.config.get('ignore_incoming_xhtml'): 
    791                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_XHTML_IM}) 
    792  
    793                         if node is None: 
    794                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_PING}) 
    795                                 q.addChild('feature', attrs = {'var': common.xmpp.NS_TIME_REVISED}) 
     754                                for f in gajim.gajim_common_features: 
     755                                        q.addChild('feature', attrs = {'var': f}) 
     756                                for f in gajim.gajim_optional_features: 
     757                                        q.addChild('feature', attrs = {'var': f}) 
    796758 
    797759                        if q.getChildren(): 
     
    893855                ''' advertise our capabilities in presence stanza (xep-0115)''' 
    894856                c = p.setTag('c', namespace = common.xmpp.NS_CAPS) 
    895                 c.setAttr('node', 'http://gajim.org/caps') 
    896                 ext = [] 
    897                 if not gajim.config.get('ignore_incoming_xhtml'): 
    898                         ext.append('xhtml') 
    899                 if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': 
    900                         ext.append('cstates') 
    901  
    902                 if len(ext): 
    903                         c.setAttr('ext', ' '.join(ext)) 
    904                 c.setAttr('ver', gajim.version.split('-', 1)[0]) 
     857                c.setAttr('hash', 'sha-1') 
     858                c.setAttr('node', 'http://gajim.org') 
     859                c.setAttr('ver', gajim.caps_hash) 
    905860                return p 
    906861