summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-13 21:26:30 +0100
committermathieui <mathieui@mathieui.net>2021-03-13 22:15:42 +0100
commitb8729095790e85383e946ba085bef1086306b229 (patch)
tree4970941fe33f8fef1f5f824d5d5bde34e86de918
parent45440074efddc7d3b0427ad00b53dc58b86fb888 (diff)
downloadpoezio-b8729095790e85383e946ba085bef1086306b229.tar.gz
poezio-b8729095790e85383e946ba085bef1086306b229.tar.bz2
poezio-b8729095790e85383e946ba085bef1086306b229.tar.xz
poezio-b8729095790e85383e946ba085bef1086306b229.zip
fix: do not crash on /invitations
(but only if an invalid JID is in there, I guess)
-rw-r--r--poezio/core/commands.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 46a95d33..d07c2e1e 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -1112,12 +1112,15 @@ class CommandCore:
def invitations(self):
"""/invitations"""
build = []
- for invite in self.core.pending_invites:
+ for room, inviter in self.core.pending_invites.items():
try:
- bare = JID(self.core.pending_invites[invite]).bare
+ bare = JID(inviter).bare
except InvalidJID:
- self.core.information('Invalid JID found in /invitations: %s' % args[0], 'Error')
- build.append('%s by %s' % (invite, bare))
+ self.core.information(
+ f'Invalid JID found in /invitations: {inviter}',
+ 'Error'
+ )
+ build.append(f'{room} by {bare}')
if build:
message = 'You are invited to the following rooms:\n' + ','.join(build)
else: