diff options
author | diSabler <dissy@ya.ru> | 2013-09-23 23:16:27 +0400 |
---|---|---|
committer | diSabler <dissy@ya.ru> | 2013-09-23 23:16:27 +0400 |
commit | 75309387abad04208bdeea317174d16ed13cba14 (patch) | |
tree | e73aba73ec775caec990d96c3c2b20dfa7c72a24 | |
parent | 275faf7551dfba48c28d768d164416585cc5d6b3 (diff) |
fix: hashes in feature command
-rw-r--r-- | plugins/disco.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/disco.py b/plugins/disco.py index 6bfd2a2..e7edc05 100644 --- a/plugins/disco.py +++ b/plugins/disco.py @@ -817,10 +817,11 @@ def features_async(type, jid, nick, what, where, is_answ): _hash = '%s<' % '/'.join([t.replace('/','//') for t in [id_category,id_type,id_lang,id_name]]) client_features.sort() _hash += ''.join(['%s<' % t for t in client_features]) - _hash += '%s<' % xmpp.NS_SOFTWAREINFO - tmp = ['%s<%s' % (t,client_softwareinfo[t]) for t in client_softwareinfo.keys()] - tmp.sort() - _hash += ''.join(['%s<' % t for t in tmp]) + if client_softwareinfo: + _hash += '%s<' % xmpp.NS_SOFTWAREINFO + tmp = ['%s<%s' % (t,client_softwareinfo[t]) for t in client_softwareinfo.keys()] + tmp.sort() + _hash += ''.join(['%s<' % t for t in tmp]) _hash = _hash.encode('utf-8') _hash_sha1 = 'SHA1: %s' % hashlib.sha1(_hash).digest().encode('base64').replace('\n','') _hash_md5 = 'MD5: %s' % hashlib.md5(_hash).digest().encode('base64').replace('\n','') |