add disco info
This commit is contained in:
parent
9d1a64fa50
commit
151844315a
|
@ -420,14 +420,32 @@ class Connection:
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
raise common.xmpp.NodeProcessed
|
raise common.xmpp.NodeProcessed
|
||||||
|
|
||||||
|
def _discoGetCB(self, con, iq_obj):
|
||||||
|
''' get disco info '''
|
||||||
|
frm = str(iq_obj.getFrom())
|
||||||
|
to = str(iq_obj.getAttr('to'))
|
||||||
|
id = str(iq_obj.getAttr('id'))
|
||||||
|
iq = common.xmpp.Iq(to = frm, typ = 'result', queryNS =\
|
||||||
|
common.xmpp.NS_DISCO, frm = to)
|
||||||
|
iq.setAttr('id', id)
|
||||||
|
# bytestream transfers
|
||||||
|
feature = common.xmpp.Node('feature')
|
||||||
|
feature.setNamespace(common.xmpp.NS_SI)
|
||||||
|
iq.addChild(node=feature)
|
||||||
|
# filetransfers transfers
|
||||||
|
_feature = common.xmpp.Node('feature')
|
||||||
|
_feature.setNamespace(common.xmpp.NS_FILE)
|
||||||
|
iq.addChild(node=_feature)
|
||||||
|
self.to_be_sent.append(iq)
|
||||||
|
raise common.xmpp.NodeProcessed
|
||||||
|
|
||||||
def _siSetCB(self, con, iq_obj):
|
def _siSetCB(self, con, iq_obj):
|
||||||
gajim.log.debug('_siSetCB')
|
gajim.log.debug('_siSetCB')
|
||||||
jid = iq_obj.getFrom().getStripped().encode('utf8')
|
jid = iq_obj.getFrom().getStripped().encode('utf8')
|
||||||
si = iq_obj.getTag('si')
|
si = iq_obj.getTag('si')
|
||||||
|
|
||||||
profile = si.getAttr('profile')
|
profile = si.getAttr('profile')
|
||||||
mime_type = si.getAttr('mime-type')
|
mime_type = si.getAttr('mime-type')
|
||||||
if profile != 'http://jabber.org/protocol/si/profile/file-transfer':
|
if profile != NS_FILE:
|
||||||
return
|
return
|
||||||
feature = si.getTag('feature')
|
feature = si.getTag('feature')
|
||||||
file_tag = si.getTag('file')
|
file_tag = si.getTag('file')
|
||||||
|
@ -832,6 +850,8 @@ class Connection:
|
||||||
common.xmpp.NS_ROSTER)
|
common.xmpp.NS_ROSTER)
|
||||||
con.RegisterHandler('iq', self._siSetCB, 'set',
|
con.RegisterHandler('iq', self._siSetCB, 'set',
|
||||||
common.xmpp.NS_SI)
|
common.xmpp.NS_SI)
|
||||||
|
con.RegisterHandler('iq', self._discoGetCB, 'get',
|
||||||
|
common.xmpp.NS_DISCO)
|
||||||
con.RegisterHandler('iq', self._bytestreamSetCB, 'set',
|
con.RegisterHandler('iq', self._bytestreamSetCB, 'set',
|
||||||
common.xmpp.NS_BYTESTREAM)
|
common.xmpp.NS_BYTESTREAM)
|
||||||
con.RegisterHandler('iq', self._BrowseResultCB, 'result',
|
con.RegisterHandler('iq', self._BrowseResultCB, 'result',
|
||||||
|
|
|
@ -70,6 +70,7 @@ NS_SI ='http://jabber.org/protocol/si' # JEP-0096
|
||||||
NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # JEP-0096
|
NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # JEP-0096
|
||||||
NS_FEATURE ='http://jabber.org/protocol/feature-neg'
|
NS_FEATURE ='http://jabber.org/protocol/feature-neg'
|
||||||
NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # JEP-0065
|
NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # JEP-0065
|
||||||
|
NS_DISCO ='http://jabber.org/protocol/disco#info' # JEP-0095
|
||||||
|
|
||||||
xmpp_stream_error_conditions="""
|
xmpp_stream_error_conditions="""
|
||||||
bad-format -- -- -- The entity has sent XML that cannot be processed.
|
bad-format -- -- -- The entity has sent XML that cannot be processed.
|
||||||
|
|
Loading…
Reference in New Issue