Fix the nick conflict code
also yapf -rip
This commit is contained in:
parent
957ee8084d
commit
87ed4aff12
2 changed files with 9 additions and 4 deletions
|
@ -2114,8 +2114,9 @@ class Core(object):
|
||||||
tab.add_message(msg, typ=2)
|
tab.add_message(msg, typ=2)
|
||||||
if code == '409':
|
if code == '409':
|
||||||
if config.get('alternative_nickname') != '':
|
if config.get('alternative_nickname') != '':
|
||||||
tab.own_nick += config.get('alternative_nickname')
|
if not tab.joined:
|
||||||
tab.join()
|
tab.own_nick += config.get('alternative_nickname')
|
||||||
|
tab.join()
|
||||||
else:
|
else:
|
||||||
if not tab.joined:
|
if not tab.joined:
|
||||||
tab.add_message(
|
tab.add_message(
|
||||||
|
|
|
@ -415,7 +415,8 @@ class HandlerCore:
|
||||||
result = yield from self.core.xmpp[
|
result = yield from self.core.xmpp[
|
||||||
'xep_0084'].retrieve_avatar(
|
'xep_0084'].retrieve_avatar(
|
||||||
jid, avatar_hash, timeout=60)
|
jid, avatar_hash, timeout=60)
|
||||||
avatar = result['pubsub']['items']['item']['avatar_data']['value']
|
avatar = result['pubsub']['items']['item']['avatar_data'][
|
||||||
|
'value']
|
||||||
if sha1(avatar).hexdigest().lower() != avatar_hash.lower():
|
if sha1(avatar).hexdigest().lower() != avatar_hash.lower():
|
||||||
raise Exception('Avatar sha1 doesn’t match 0084 hash.')
|
raise Exception('Avatar sha1 doesn’t match 0084 hash.')
|
||||||
contact.avatar = avatar
|
contact.avatar = avatar
|
||||||
|
@ -433,7 +434,10 @@ class HandlerCore:
|
||||||
with open(cached_path, 'wb') as avatar_file:
|
with open(cached_path, 'wb') as avatar_file:
|
||||||
avatar_file.write(contact.avatar)
|
avatar_file.write(contact.avatar)
|
||||||
except OSError:
|
except OSError:
|
||||||
log.debug('Failed writing %s avatar to cache:', jid, exc_info=True)
|
log.debug(
|
||||||
|
'Failed writing %s avatar to cache:',
|
||||||
|
jid,
|
||||||
|
exc_info=True)
|
||||||
pass
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue