summaryrefslogtreecommitdiff
path: root/src/connection.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-08-08 23:59:00 +0200
committermathieui <mathieui@mathieui.net>2012-08-08 23:59:00 +0200
commit9fec12425073b80a4b9fd9c6164ddb4f5375e6d3 (patch)
tree064579343360819fa4087776c68097368f552945 /src/connection.py
parente8dce570eac86cb9b888a61776ca5c858c03a1aa (diff)
downloadpoezio-9fec12425073b80a4b9fd9c6164ddb4f5375e6d3.tar.gz
poezio-9fec12425073b80a4b9fd9c6164ddb4f5375e6d3.tar.bz2
poezio-9fec12425073b80a4b9fd9c6164ddb4f5375e6d3.tar.xz
poezio-9fec12425073b80a4b9fd9c6164ddb4f5375e6d3.zip
Fix yet another bunch of potential tracebacks
(notably, the /message one) All JID calls in poezio’s code were already covered, but sleekxmpp does that, too, so each jid given to sleek must be validated, otherwise an unwanted exception may occur.
Diffstat (limited to 'src/connection.py')
-rw-r--r--src/connection.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/connection.py b/src/connection.py
index 30e0b552..b712004b 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -21,6 +21,7 @@ import sleekxmpp
from config import config, options
from logger import logger
import common
+from common import safeJID
class Connection(sleekxmpp.ClientXMPP):
"""
@@ -40,8 +41,11 @@ class Connection(sleekxmpp.ClientXMPP):
password = config.get('password', '') or getpass.getpass()
else: # anonymous auth
self.anon = True
- jid = '%s/%s' % (config.get('server', 'anon.louiz.org'), resource)
+ jid = config.get('server', 'anon.louiz.org')
+ if resource:
+ jid = '%s/%s' % (jid, resource)
password = None
+ jid = safeJID(jid)
sleekxmpp.ClientXMPP.__init__(self, jid, password)
self.core = None
self.auto_reconnect = True if config.get('auto_reconnect', 'false').lower() in ('true', '1') else False