diff options
author | Lance Stout <lancestout@gmail.com> | 2012-10-24 13:00:01 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-10-24 13:00:01 -0700 |
commit | 14c9e9a9cc263a2695cb9d8e5575d60bd0a55197 (patch) | |
tree | 5e72741f828a0f1852086c6be83e23c7f94d10f1 /sleekxmpp/plugins | |
parent | 931d49560a1ebf3b767d20f8aeb692dd30a518c3 (diff) | |
parent | a22ca228cc3a121da8bad4268c39bff5190db969 (diff) | |
download | slixmpp-14c9e9a9cc263a2695cb9d8e5575d60bd0a55197.tar.gz slixmpp-14c9e9a9cc263a2695cb9d8e5575d60bd0a55197.tar.bz2 slixmpp-14c9e9a9cc263a2695cb9d8e5575d60bd0a55197.tar.xz slixmpp-14c9e9a9cc263a2695cb9d8e5575d60bd0a55197.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r-- | sleekxmpp/plugins/xep_0078/legacyauth.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0078/legacyauth.py b/sleekxmpp/plugins/xep_0078/legacyauth.py index be9fe3c5..7e2d7bdf 100644 --- a/sleekxmpp/plugins/xep_0078/legacyauth.py +++ b/sleekxmpp/plugins/xep_0078/legacyauth.py @@ -11,6 +11,7 @@ import hashlib import random import sys +from sleekxmpp.jid import JID from sleekxmpp.exceptions import IqError, IqTimeout from sleekxmpp.stanza import Iq, StreamFeatures from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin @@ -95,10 +96,11 @@ class XEP_0078(BasePlugin): iq['auth']['username'] = self.xmpp.requested_jid.user # A resource is required, so create a random one if necessary - if self.xmpp.requested_jid.resource: - iq['auth']['resource'] = self.xmpp.requested_jid.resource - else: - iq['auth']['resource'] = '%s' % random.random() + resource = self.xmpp.requested_jid.resource + if not resource: + resource = uuid.uuid4() + + iq['auth']['resource'] = resource if 'digest' in resp['auth']['fields']: log.debug('Authenticating via jabber:iq:auth Digest') @@ -130,6 +132,12 @@ class XEP_0078(BasePlugin): self.xmpp.features.add('auth') self.xmpp.authenticated = True + + self.xmpp.boundjid = JID(self.xmpp.requested_jid, + resource=resource, + cache_lock=True) + self.xmpp.event('session_bind', self.xmpp.boundjid, direct=True) + log.debug("Established Session") self.xmpp.sessionstarted = True self.xmpp.session_started_event.set() |