Commit 0474d0f4 authored by Link Mauve's avatar Link Mauve Committed by Link Mauve

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.
parent 85b12222
...@@ -18,6 +18,7 @@ import base64 ...@@ -18,6 +18,7 @@ import base64
import random import random
import slixmpp import slixmpp
from slixmpp import JID, InvalidJID
from slixmpp.xmlstream import ET from slixmpp.xmlstream import ET
from slixmpp.plugins.xep_0184 import XEP_0184 from slixmpp.plugins.xep_0184 import XEP_0184
from slixmpp.plugins.xep_0030 import DiscoInfo from slixmpp.plugins.xep_0030 import DiscoInfo
...@@ -26,7 +27,6 @@ from slixmpp.util import FileSystemCache ...@@ -26,7 +27,6 @@ from slixmpp.util import FileSystemCache
from poezio import common from poezio import common
from poezio import fixes from poezio import fixes
from poezio import xdg from poezio import xdg
from poezio.common import safeJID
from poezio.config import config, options from poezio.config import config, options
...@@ -81,7 +81,11 @@ class Connection(slixmpp.ClientXMPP): ...@@ -81,7 +81,11 @@ class Connection(slixmpp.ClientXMPP):
self.anon = True self.anon = True
jid = config.get('server') jid = config.get('server')
password = None 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 = '%s-%s' % (
jid.resource, jid.resource,
device_id) if jid.resource else 'poezio-%s' % device_id device_id) if jid.resource else 'poezio-%s' % device_id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment