From 9fec12425073b80a4b9fd9c6164ddb4f5375e6d3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 8 Aug 2012 23:59:00 +0200 Subject: Fix yet another bunch of potential tracebacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (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. --- src/connection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/connection.py') 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 -- cgit v1.2.3