summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2010-10-17 02:26:06 +0800
committerLance Stout <lancestout@gmail.com>2010-10-17 08:55:30 +0800
commit2d18d905a537587ee9685877ae2c108511e57d91 (patch)
treea8e987b04525d80f1325653ddc3898b440600adc /sleekxmpp/xmlstream
parent4eb4d729eebd8049d68a944120360cb1f7e68895 (diff)
downloadslixmpp-2d18d905a537587ee9685877ae2c108511e57d91.tar.gz
slixmpp-2d18d905a537587ee9685877ae2c108511e57d91.tar.bz2
slixmpp-2d18d905a537587ee9685877ae2c108511e57d91.tar.xz
slixmpp-2d18d905a537587ee9685877ae2c108511e57d91.zip
Anonymous authentication
Implemented ANONYMOUS authentication on the ClientXMPP class. To use it, you just need to provide a domain (e.g 'anon.example.com') with an optional resource (e.g 'anon.example.com/resource') as the JID, with no password. The JID class has been improved to accept domains as fulljid. You can test this with echo_client.py python echo_client.py -j anon.louiz.org/ # anonymous with a resource # defined by the server python echo_client.py -j anon.louiz.org/resource # anonymous with given # resource The "normal" authentication method still works exactly like before.
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/jid.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/sleekxmpp/xmlstream/jid.py b/sleekxmpp/xmlstream/jid.py
index 789410b9..aa17c7bc 100644
--- a/sleekxmpp/xmlstream/jid.py
+++ b/sleekxmpp/xmlstream/jid.py
@@ -94,6 +94,14 @@ class JID(object):
elif name in ('server', 'domain', 'host'):
self.domain = value
elif name in ('full', 'jid'):
+ if '@' not in value:
+ if '/' in value:
+ d, r = value.split('/', 1)
+ object.__setattr__(self, "_resource", r)
+ else:
+ d = value
+ object.__setattr__(self, "_domain", d)
+ else:
self.reset(value)
elif name == 'bare':
if '@' in value: