summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/core/core.py5
-rw-r--r--poezio/core/handlers.py8
2 files changed, 9 insertions, 4 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index fc76be9b..8089408c 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -2114,8 +2114,9 @@ class Core(object):
tab.add_message(msg, typ=2)
if code == '409':
if config.get('alternative_nickname') != '':
- tab.own_nick += config.get('alternative_nickname')
- tab.join()
+ if not tab.joined:
+ tab.own_nick += config.get('alternative_nickname')
+ tab.join()
else:
if not tab.joined:
tab.add_message(
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index 626f2093..60cf405d 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -415,7 +415,8 @@ class HandlerCore:
result = yield from self.core.xmpp[
'xep_0084'].retrieve_avatar(
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():
raise Exception('Avatar sha1 doesn’t match 0084 hash.')
contact.avatar = avatar
@@ -433,7 +434,10 @@ class HandlerCore:
with open(cached_path, 'wb') as avatar_file:
avatar_file.write(contact.avatar)
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
return