From 75309387abad04208bdeea317174d16ed13cba14 Mon Sep 17 00:00:00 2001 From: diSabler Date: Mon, 23 Sep 2013 23:16:27 +0400 Subject: fix: hashes in feature command --- plugins/disco.py | 9 +++++---- 1 file 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','') -- cgit v1.2.3