Update to XEP-0300 version 0.5 (:2 namespace).

This commit is contained in:
Emmanuel Gil Peyrot 2017-06-14 20:29:52 +01:00
parent 71f0e40c94
commit 785a0b61e0
6 changed files with 8 additions and 8 deletions

View File

@ -253,7 +253,7 @@ gajim_common_features = [nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE,
nbxmpp.NS_REGISTER, nbxmpp.NS_VERSION, nbxmpp.NS_DATA, nbxmpp.NS_ENCRYPTED, nbxmpp.NS_REGISTER, nbxmpp.NS_VERSION, nbxmpp.NS_DATA, nbxmpp.NS_ENCRYPTED,
'msglog', 'sslc2s', 'stringprep', nbxmpp.NS_PING, nbxmpp.NS_TIME_REVISED, 'msglog', 'sslc2s', 'stringprep', nbxmpp.NS_PING, nbxmpp.NS_TIME_REVISED,
nbxmpp.NS_SSN, nbxmpp.NS_MOOD, nbxmpp.NS_ACTIVITY, nbxmpp.NS_NICK, nbxmpp.NS_SSN, nbxmpp.NS_MOOD, nbxmpp.NS_ACTIVITY, nbxmpp.NS_NICK,
nbxmpp.NS_ROSTERX, nbxmpp.NS_SECLABEL, nbxmpp.NS_HASHES, nbxmpp.NS_ROSTERX, nbxmpp.NS_SECLABEL, nbxmpp.NS_HASHES_2,
nbxmpp.NS_HASHES_MD5, nbxmpp.NS_HASHES_SHA1, nbxmpp.NS_HASHES_SHA256, nbxmpp.NS_HASHES_MD5, nbxmpp.NS_HASHES_SHA1, nbxmpp.NS_HASHES_SHA256,
nbxmpp.NS_HASHES_SHA512, nbxmpp.NS_CONFERENCE] nbxmpp.NS_HASHES_SHA512, nbxmpp.NS_CONFERENCE]

View File

@ -172,7 +172,7 @@ class ConnectionJingle(object):
return c.transport.sid return c.transport.sid
def __hash_support(self, contact): def __hash_support(self, contact):
if contact.supports(nbxmpp.NS_HASHES): if contact.supports(nbxmpp.NS_HASHES_2):
if contact.supports(nbxmpp.NS_HASHES_BLAKE2B_512): if contact.supports(nbxmpp.NS_HASHES_BLAKE2B_512):
return 'blake2b-512' return 'blake2b-512'
elif contact.supports(nbxmpp.NS_HASHES_BLAKE2B_256): elif contact.supports(nbxmpp.NS_HASHES_BLAKE2B_256):

View File

@ -192,7 +192,7 @@ class JingleContent:
if self.file_props.type_ == 'r': if self.file_props.type_ == 'r':
if self.file_props.hash_: if self.file_props.hash_:
file_tag.addChild('hash', attrs={'algo': self.file_props.algo}, file_tag.addChild('hash', attrs={'algo': self.file_props.algo},
namespace=nbxmpp.NS_HASHES, namespace=nbxmpp.NS_HASHES_2,
payload=self.file_props.hash_) payload=self.file_props.hash_)
else: else:
# if the file is less than 10 mb, then it is small # if the file is less than 10 mb, then it is small

View File

@ -176,7 +176,7 @@ class JingleFileTransfer(JingleContent):
except IOError: except IOError:
# can't open file # can't open file
return return
h = nbxmpp.Hashes() h = nbxmpp.Hashes2()
hash_ = h.calculateHash(self.file_props.algo, file_) hash_ = h.calculateHash(self.file_props.algo, file_)
file_.close() file_.close()
# DEBUG # DEBUG

View File

@ -444,9 +444,9 @@ class JingleSession:
for child in payload: for child in payload:
if child.getName() == 'checksum': if child.getName() == 'checksum':
hash_ = child.getTag('file').getTag(name='hash', hash_ = child.getTag('file').getTag(name='hash',
namespace=nbxmpp.NS_HASHES) namespace=nbxmpp.NS_HASHES_2)
algo = hash_.getAttr('algo') algo = hash_.getAttr('algo')
if algo in nbxmpp.Hashes.supported: if algo in nbxmpp.Hashes2.supported:
file_props = FilesProp.getFileProp(self.connection.name, file_props = FilesProp.getFileProp(self.connection.name,
self.sid) self.sid)
file_props.algo = algo file_props.algo = algo

View File

@ -73,7 +73,7 @@ from session import ChatControlSession
from common import sleepy from common import sleepy
from nbxmpp import idlequeue from nbxmpp import idlequeue
from nbxmpp import Hashes from nbxmpp import Hashes2
from common.zeroconf import connection_zeroconf from common.zeroconf import connection_zeroconf
from common import resolver from common import resolver
from common import caps_cache from common import caps_cache
@ -988,7 +988,7 @@ class Interface:
session = gajim.connections[account].get_jingle_session(jid=None, session = gajim.connections[account].get_jingle_session(jid=None,
sid=file_props.sid) sid=file_props.sid)
ft_win = self.instances['file_transfers'] ft_win = self.instances['file_transfers']
h = Hashes() h = Hashes2()
try: try:
file_ = open(file_props.file_name, 'rb') file_ = open(file_props.file_name, 'rb')
except: except: