diff options
author | Lance Stout <lancestout@gmail.com> | 2010-11-17 02:00:20 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-11-17 02:01:12 -0500 |
commit | 26aca2b789f62123819041229ba40ab10268f49e (patch) | |
tree | 20388fb0559ed85f7143eb3b8a669142cdc43f6b /sleekxmpp/plugins/xep_0078.py | |
parent | 4f69a03bb1a8caab7899bd04f97b7975a78f2f34 (diff) | |
parent | 5424ede413393db5b835686e8544a9b703fb113b (diff) | |
download | slixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.gz slixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.bz2 slixmpp-26aca2b789f62123819041229ba40ab10268f49e.tar.xz slixmpp-26aca2b789f62123819041229ba40ab10268f49e.zip |
Merge branch 'roster' of github.com:fritzy/SleekXMPP into roster
Conflicts:
sleekxmpp/basexmpp.py
sleekxmpp/roster.py
sleekxmpp/test/sleektest.py
tests/test_stream_presence.py
tests/test_stream_roster.py
Diffstat (limited to 'sleekxmpp/plugins/xep_0078.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0078.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0078.py b/sleekxmpp/plugins/xep_0078.py index 4b3ab829..d2c81b16 100644 --- a/sleekxmpp/plugins/xep_0078.py +++ b/sleekxmpp/plugins/xep_0078.py @@ -2,7 +2,7 @@ SleekXMPP: The Sleek XMPP Library Copyright (C) 2010 Nathanael C. Fritz This file is part of SleekXMPP. - + See the file LICENSE for copying permission. """ from __future__ import with_statement @@ -12,6 +12,9 @@ import hashlib from . import base +log = logging.getLogger(__name__) + + class xep_0078(base.base_plugin): """ XEP-0078 NON-SASL Authentication @@ -23,14 +26,14 @@ class xep_0078(base.base_plugin): #disabling until I fix conflict with PLAIN #self.xmpp.registerFeature("<auth xmlns='http://jabber.org/features/iq-auth'/>", self.auth) self.streamid = '' - + def check_stream(self, xml): self.streamid = xml.attrib['id'] if xml.get('version', '0') != '1.0': self.auth() - + def auth(self, xml=None): - logging.debug("Starting jabber:iq:auth Authentication") + log.debug("Starting jabber:iq:auth Authentication") auth_request = self.xmpp.makeIqGet() auth_request_query = ET.Element('{jabber:iq:auth}query') auth_request.attrib['to'] = self.xmpp.server @@ -47,12 +50,12 @@ class xep_0078(base.base_plugin): query.append(username) query.append(resource) if rquery.find('{jabber:iq:auth}digest') is None: - logging.warning("Authenticating via jabber:iq:auth Plain.") + log.warning("Authenticating via jabber:iq:auth Plain.") password = ET.Element('password') password.text = self.xmpp.password query.append(password) else: - logging.debug("Authenticating via jabber:iq:auth Digest") + log.debug("Authenticating via jabber:iq:auth Digest") digest = ET.Element('digest') digest.text = hashlib.sha1(b"%s%s" % (self.streamid, self.xmpp.password)).hexdigest() query.append(digest) @@ -64,6 +67,6 @@ class xep_0078(base.base_plugin): self.xmpp.sessionstarted = True self.xmpp.event("session_start") else: - logging.info("Authentication failed") + log.info("Authentication failed") self.xmpp.disconnect() self.xmpp.event("failed_auth") |