summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2020-12-27 01:50:12 +0100
committerLink Mauve <linkmauve@linkmauve.fr>2020-12-28 19:10:53 +0100
commit0474d0f4b2d36bd188bd08b6ee5a378792de9f15 (patch)
tree1acc0ccfea2ed54c077eb019c2b81ad9e68d992e
parent85b122222253361a933d5d45e92fa14afc90a93c (diff)
downloadpoezio-0474d0f4b2d36bd188bd08b6ee5a378792de9f15.tar.gz
poezio-0474d0f4b2d36bd188bd08b6ee5a378792de9f15.tar.bz2
poezio-0474d0f4b2d36bd188bd08b6ee5a378792de9f15.tar.xz
poezio-0474d0f4b2d36bd188bd08b6ee5a378792de9f15.zip
Prevent a traceback when the jid option isn’t a valid JID.
It was crashing deep in XEP-0048 plugin init, this removes a safeJID() as well as print an error message if the JID is invalid.
-rw-r--r--poezio/connection.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/poezio/connection.py b/poezio/connection.py
index b04bf9fd..bbaf2e69 100644
--- a/poezio/connection.py
+++ b/poezio/connection.py
@@ -18,6 +18,7 @@ import base64
import random
import slixmpp
+from slixmpp import JID, InvalidJID
from slixmpp.xmlstream import ET
from slixmpp.plugins.xep_0184 import XEP_0184
from slixmpp.plugins.xep_0030 import DiscoInfo
@@ -26,7 +27,6 @@ from slixmpp.util import FileSystemCache
from poezio import common
from poezio import fixes
from poezio import xdg
-from poezio.common import safeJID
from poezio.config import config, options
@@ -81,7 +81,11 @@ class Connection(slixmpp.ClientXMPP):
self.anon = True
jid = config.get('server')
password = None
- jid = safeJID(jid)
+ try:
+ jid = JID(jid)
+ except InvalidJID:
+ sys.stderr.write('Invalid jid option: "%s" is not a valid JID\n' % jid)
+ sys.exit(1)
jid.resource = '%s-%s' % (
jid.resource,
device_id) if jid.resource else 'poezio-%s' % device_id