diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-12 16:47:58 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-12 16:47:58 -0700 |
commit | 484efff156e344fc3ca1a7377539132b702c0c78 (patch) | |
tree | fa051515b9dc15eb3a5ab1a8e8b9c2e25b920d17 /sleekxmpp/plugins/xep_0078/stanza.py | |
parent | 89cffd43f48cfc835b70e137776eb8c2e73a0b67 (diff) | |
parent | 8f1d0e7a79b662e5f2849cea6e73716cc887e226 (diff) | |
download | slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.gz slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.bz2 slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.xz slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.zip |
Merge branch 'develop' into roster
Conflicts:
setup.py
sleekxmpp/clientxmpp.py
Diffstat (limited to 'sleekxmpp/plugins/xep_0078/stanza.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0078/stanza.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0078/stanza.py b/sleekxmpp/plugins/xep_0078/stanza.py new file mode 100644 index 00000000..86ba09ad --- /dev/null +++ b/sleekxmpp/plugins/xep_0078/stanza.py @@ -0,0 +1,43 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2011 Nathanael C. Fritz + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin + + +class IqAuth(ElementBase): + namespace = 'jabber:iq:auth' + name = 'query' + plugin_attrib = 'auth' + interfaces = set(('fields', 'username', 'password', 'resource', 'digest')) + sub_interfaces = set(('username', 'password', 'resource', 'digest')) + plugin_tag_map = {} + plugin_attrib_map = {} + + def get_fields(self): + fields = set() + for field in self.sub_interfaces: + if self.xml.find('{%s}%s' % (self.namespace, field)) is not None: + fields.add(field) + return fields + + def set_resource(self, value): + self._set_sub_text('resource', value, keep=True) + + def set_password(self, value): + self._set_sub_text('password', value, keep=True) + + +class AuthFeature(ElementBase): + namespace = 'http://jabber.org/features/iq-auth' + name = 'auth' + plugin_attrib = 'auth' + interfaces = set() + plugin_tag_map = {} + plugin_attrib_map = {} + + |