changeset 5812cedb80f0 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=5812cedb80f0
description: update xep-300 to the lastest version
diffstat:
nbxmpp/protocol.py | 43 +++++++++++++++++++------------------------
1 files changed, 19 insertions(+), 24 deletions(-)
diffs (100 lines):
diff -r 7a4fd6fbf98c -r 5812cedb80f0 nbxmpp/protocol.py
--- a/nbxmpp/protocol.py Sun Dec 23 17:47:21 2012 +0100
+++ b/nbxmpp/protocol.py Mon Dec 24 14:55:21 2012 -0400
@@ -162,12 +162,12 @@
NS_PUBKEY_REVOKE = 'urn:xmpp:revoke:2'
NS_PUBKEY_ATTEST = 'urn:xmpp:attest:2'
NS_STREAM_MGMT = 'urn:xmpp:sm:2' # XEP-198
-NS_HASHES = 'urn:xmpp:hashes:0' # XEP-300
+NS_HASHES = 'urn:xmpp:hashes:1' # XEP-300
NS_HASHES_MD5 = 'urn:xmpp:hash-function-textual-names:md5'
NS_HASHES_SHA1 = 'urn:xmpp:hash-function-textual-names:sha-1'
NS_HASHES_SHA256 = 'urn:xmpp:hash-function-textual-names:sha-256'
NS_HASHES_SHA512 = 'urn:xmpp:hash-function-textual-names:sha-512'
-
+
xmpp_stream_error_conditions = '''
bad-format -- -- -- The entity has sent XML that cannot be processed.
bad-namespace-prefix -- -- -- The entity has sent a namespace prefix that is unsupported, or has sent no namespace prefix on an element that requires such a prefix.
@@ -1037,12 +1037,12 @@
attrs={'id': self.getID()})
iq.setQuery(self.getQuery().getName()).setNamespace(self.getQueryNS())
return iq
-
-class Hashes(Node):
+
+class Hashes(Node):
"""
Hash elements for various XEPs as defined in XEP-300
"""
-
+
"""
RECOMENDED HASH USE:
Algorithm Support
@@ -1053,14 +1053,14 @@
SHA-256 MUST
SHA-512 SHOULD
"""
-
+
supported = ('md5', 'sha-1', 'sha-256', 'sha-512')
-
+
def __init__(self, nsp=NS_HASHES):
- Node.__init__(self, None, {}, [], None, None,False, None)
+ Node.__init__(self, None, {}, [], None, None, False, None)
self.setNamespace(nsp)
- self.setName('hashes')
-
+ self.setName('hash')
+
def calculateHash(self, algo, file_string):
"""
Calculate the hash and add it. It is preferable doing it here
@@ -1078,12 +1078,12 @@
hl = hashlib.sha256()
elif algo == 'sha-512':
hl = hashlib.sha512()
-
+
if hl:
hl.update(file_string)
hash_ = hl.hexdigest()
else: # if it is a file
-
+
if algo == 'md5':
hl = hashlib.md5()
elif algo == 'sha-1':
@@ -1092,23 +1092,18 @@
hl = hashlib.sha256()
elif algo == 'sha-512':
hl = hashlib.sha512()
-
+
if hl:
for line in file_string:
hl.update(line)
hash_ = hl.hexdigest()
-
- return hash_
-
+
+ return hash_
+
def addHash(self, hash_, algo):
- """
- More than one hash can be added. Although it is permitted, it should
- not be done for big files because it could slow down Gajim.
- """
- attrs = {}
- attrs['algo'] = algo
- self.addChild('hash', attrs, [hash_])
-
+ self.setAttr('algo', algo)
+ self.setData(hash_)
+
class Acks(Node):
"""
Acknowledgement elements for Stream Management
changeset 49e37bbba42d in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=49e37bbba42d
description: fix module name
diffstat:
src/common/stanza_session.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r 17cbc1fb12da -r 49e37bbba42d src/common/stanza_session.py
--- a/src/common/stanza_session.py Sun Dec 16 18:29:49 2012 +0100
+++ b/src/common/stanza_session.py Sun Dec 16 18:29:59 2012 +0100
@@ -813,7 +813,7 @@
# the offset of the group we chose (need it to match up with the dhhash)
group_order = 0
self.modp = int(form.getField('modp').getOptions()[group_order][1])
- x.addChild(node=xmpp.DataField(name='modp', value=self.modp))
+ x.addChild(node=nbxmpp.DataField(name='modp', value=self.modp))
g = dh.generators[self.modp]
p = dh.primes[self.modp]