[Zash] support latest version of XEP-0258. Fixes #7010

This commit is contained in:
Yann Leboulanger 2011-10-07 17:57:24 +02:00
parent ac1111c305
commit 1c20f5c5f4
3 changed files with 6 additions and 9 deletions

View File

@ -2052,7 +2052,8 @@ class Connection(CommonConnection, ConnectionHandlers):
if not gajim.account_is_connected(self.name):
return
self.seclabel_catalogue_request(to, callback)
iq = common.xmpp.Iq(typ='get')
server = gajim.get_jid_from_account(self.name).split("@")[1] # Really, no better way?
iq = common.xmpp.Iq(typ='get', to=server)
iq2 = iq.addChild(name='catalog', namespace=common.xmpp.NS_SECLABEL_CATALOG)
iq2.setAttr('to', to)
self.connection.send(iq)

View File

@ -1413,16 +1413,12 @@ ConnectionJingle, ConnectionIBBytestream):
log.debug('SecLabelCB')
query = iq_obj.getTag('catalog')
to = query.getAttr('to')
items = query.getTags('securitylabel')
items = query.getTags('item')
labels = {}
ll = []
for item in items:
display_tag = item.getTag('displaymarking')
if display_tag:
label = display_tag.getData()
else:
label = ''
labels[label] = item
label = item.getAttr('selector')
labels[label] = item.getTag('securitylabel')
ll.append(label)
if to not in self.seclabel_catalogues:
self.seclabel_catalogues[to] = [[], None, None]

View File

@ -119,7 +119,7 @@ NS_RPC = 'jabber:iq:rpc' # XEP-0009
NS_RSM = 'http://jabber.org/protocol/rsm'
NS_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl'
NS_SECLABEL = 'urn:xmpp:sec-label:0'
NS_SECLABEL_CATALOG = 'urn:xmpp:sec-label:catalog:0'
NS_SECLABEL_CATALOG = 'urn:xmpp:sec-label:catalog:2'
NS_SEARCH = 'jabber:iq:search'
NS_SERVER = 'jabber:server'
NS_SESSION = 'urn:ietf:params:xml:ns:xmpp-session'