diff options
author | mathieui <mathieui@mathieui.net> | 2012-08-01 20:10:00 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-08-01 20:10:00 +0200 |
commit | 0cb39b32a4ee3a2f86f6db6d2354836bcf68a33e (patch) | |
tree | 3f3fd1fab5194da4ebf0f0e980ff0bcfe662dc70 | |
parent | f76e80c5fae108d29ba87a495cd92a1f185c1da2 (diff) | |
download | poezio-0cb39b32a4ee3a2f86f6db6d2354836bcf68a33e.tar.gz poezio-0cb39b32a4ee3a2f86f6db6d2354836bcf68a33e.tar.bz2 poezio-0cb39b32a4ee3a2f86f6db6d2354836bcf68a33e.tar.xz poezio-0cb39b32a4ee3a2f86f6db6d2354836bcf68a33e.zip |
Do not generate invalid jids (e.g. localpart@domainpart/)
This is in prevision of a sleekxmpp update with JID validation.
Also, comment the “server” option in the config file a bit better.
-rw-r--r-- | data/default_config.cfg | 3 | ||||
-rw-r--r-- | src/connection.py | 4 | ||||
-rw-r--r-- | src/contact.py | 6 |
3 files changed, 9 insertions, 4 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg index 8871de15..ff73ecc4 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -4,7 +4,8 @@ [Poezio] -# the server. Make sure the server you're using accepts anonymous authentification +# The server used for anonymous connection. +# Make sure the server you're using accepts anonymous authentication server = anon.louiz.org # SSL Certificate fingerprint diff --git a/src/connection.py b/src/connection.py index 80c41ee8..f4db0816 100644 --- a/src/connection.py +++ b/src/connection.py @@ -34,7 +34,9 @@ class Connection(sleekxmpp.ClientXMPP): self.anon = False # Field used to know if we are anonymous or not. # many features will be handled diferently # depending on this setting - jid = '%s/%s' % (config.get('jid', ''), resource) + jid = '%s' % config.get('jid', '') + if resource: + jid = '%s/%s' (jid, resource) password = config.get('password', '') or getpass.getpass() else: # anonymous auth self.anon = True diff --git a/src/contact.py b/src/contact.py index 3a8e38ab..b8963a71 100644 --- a/src/contact.py +++ b/src/contact.py @@ -100,8 +100,10 @@ class Contact(object): @property def resources(self): """List of the available resources as Resource objects""" - return [Resource('%s/%s' % (self.bare_jid, key), self.__item.resources[key]) - for key in self.__item.resources] + return [Resource( + '%s%s' % (self.bare_jid, ('/' + key) if key else ''), + self.__item.resources[key] + ) for key in self.__item.resources.keys()] @property def subscription(self): |