Compare commits

..

37 Commits

Author SHA1 Message Date
mathieui
53191ff1cf slixmpp 1.2.2
Fix CVE-2015-8688, and a few bugfixes.
2016-11-21 21:46:02 +01:00
mathieui
ffdb6ffd69 Check origin of roster pushes
slixmpp is vulnerable to roster push attacks as described by Daniel
Gultsch at https://gultsch.de/gajim_roster_push_and_message_interception.html.

(CVE-2015-8688)
2016-11-21 21:42:51 +01:00
Emmanuel Gil Peyrot
7560db856b stringprep_profiles: Emit a correct StringPrepError on query + unassigned. 2016-10-27 06:44:38 +01:00
Emmanuel Gil Peyrot
63d245ac48 SASL: Fix traceback on non-hashing mechanism using channel binding. 2016-10-27 06:26:39 +01:00
Emmanuel Gil Peyrot
7ddd37be29 XEP-0323: Fix wrong import. 2016-10-27 06:23:08 +01:00
Emmanuel Gil Peyrot
a4d3a4a25e XEP-0313: Add missing setter argument. 2016-10-27 06:22:50 +01:00
mathieui
58bd07628b Add missing parameters in XEP-0222 and XEP-0223 2016-10-27 00:21:01 +02:00
mathieui
3569038493 XEP-0009: fix a traceback on recipient unavailable
(probably a past typo)
2016-10-27 00:18:43 +02:00
mathieui
20c4ff823a Add missing JID import in XEP-0079 and 0258 2016-10-27 00:17:29 +02:00
mathieui
8a7448a5a1 Add missing imports in XEP-0333 2016-10-27 00:15:25 +02:00
mathieui
d23d8f901e Fix a traceback on XEP-0221 del uri['value']
(typo)
2016-10-27 00:11:27 +02:00
Emmanuel Gil Peyrot
391f12eeab Transform an if into an elif in cert parsing. 2016-10-23 14:15:02 +01:00
Emmanuel Gil Peyrot
d008988843 Manual cleanup of the remaining set([…]) and set((…)). 2016-10-22 13:37:46 +01:00
Emmanuel Gil Peyrot
dcacc7d7d5 sed -i 's/set(\[\(.*\)\])$/{\1}/g' **/*.py 2016-10-22 13:21:44 +01:00
Emmanuel Gil Peyrot
c4285961df sed -i 's/set((\(.*\)))$/{\1}/g' **/*.py 2016-10-22 13:21:42 +01:00
Emmanuel Gil Peyrot
1038f656eb sed -i 's/set((\(.*\),))$/{\1}/g' **/*.py 2016-10-22 13:21:41 +01:00
Emmanuel Gil Peyrot
3c7236fe73 setup.py: Check for libidn before trying to use Cython. 2016-10-05 20:28:11 +01:00
mathieui
36824379c3 slixmpp 1.2.1
Fix a few bugs along with the testsuite, and remove the asyncio loop
monkeypatch hack.
2016-10-05 20:32:32 +02:00
mathieui
a0a37c19ff Remove monkeypatching hack on the event loop
This allowed us to schedule events in-order later in the event loop, but
was detrimental to using other event loops and debugging.
2016-10-05 20:19:07 +02:00
mathieui
1b5fe57a5e Fix XEP-0060 tests 2016-10-04 21:21:55 +02:00
mathieui
5da31db0c7 Fix stanza accessors case in tests
They were using deprecated (and-removed) style.
2016-10-04 21:15:01 +02:00
mathieui
f8cea760b6 Fix the gmail_notify plugin 2016-10-04 21:10:10 +02:00
mathieui
5ef01ecdd1 Fix XEP-0033
Re-add relevant stanza methods, broken in 7cd1cf32ae
2016-10-04 19:47:11 +02:00
mathieui
62aafe0ee7 Attrib property has been removed 2016-10-04 19:43:45 +02:00
mathieui
cf3f36ac52 Set unset part of a JID to empty string instead of None
it breaks assumptions on the type of the value
2016-10-04 19:42:05 +02:00
mathieui
b88d2ecd77 Add more checks in the XEP-0060 stanza building
Try to not append slixmpp stanzas to ElementTree objects.
2016-10-04 19:31:49 +02:00
mathieui
e691850a2b Fix XEP-0128
Broken since 125336aeee due to unforeseen consequences of a variable
removal.
2016-10-04 19:26:03 +02:00
mathieui
d4bff8dee6 Fix XEP-0009
Broken since 3a9b45e4f because of an overzealous cleanup.
2016-10-04 19:23:21 +02:00
mathieui
187c350805 Update for slixmpp 1.2 2016-10-02 17:36:14 +02:00
mathieui
96d1c26f90 Add a fallback if the lang we want is not available
Previously, trying to get a text node with a lang which is different
from the one we specified would return nothing, which means e.g. a
message would be ignored because its body is of lang 'fr' when we setup
slixmpp to prefer 'en'. We want to return something when there is an
available, valid content in a different language.
2016-10-02 17:12:47 +02:00
mathieui
46a90749f8 Fix uses of super() in the codebase
Fix #3165, we don’t need to use the long form to get the superobject in
our supported python versions.
2016-09-30 21:25:36 +02:00
mathieui
0c63a4bbda Fix #3226 (unicity of scheduled event names)
Thanks tchiroux for raising the issue and providing the fix as well.
2016-09-30 20:59:31 +02:00
mathieui
e4696e0471 Merge branch 'doc_fixes' of https://github.com/SamWhited/slixmpp 2016-09-30 20:53:36 +02:00
Sam Whited
8217dc5239 Minor documentation fixes 2016-09-30 13:49:04 -05:00
mathieui
2586abc0d3 Fix xep-0050 stanza
broken in 3a9b45e4f2
2016-09-20 20:51:21 +02:00
Emmanuel Gil Peyrot
28f84ab3d9 ElementBase: Remove support for TitleCase methods.
This gains about 1/8th of the time spent in __getitem__.
2016-09-21 01:31:53 +09:00
Emmanuel Gil Peyrot
813b45aded XEP-0045: Remove support for old-style {get,set,del}TitleCase methods. 2016-09-21 01:28:24 +09:00
191 changed files with 796 additions and 788 deletions

View File

@@ -12,8 +12,8 @@ Building
-------- --------
Slixmpp can make use of cython to improve performance on critical modules. Slixmpp can make use of cython to improve performance on critical modules.
To do that, cython3 is necessary along with libidn headers. Otherwise, To do that, **cython3** is necessary along with **libidn** headers.
no compilation is needed. Building is done by running setup.py:: Otherwise, no compilation is needed. Building is done by running setup.py::
python3 setup.py build_ext --inplace python3 setup.py build_ext --inplace
@@ -108,6 +108,11 @@ Slixmpp Credits
**Contributors:** **Contributors:**
- Emmanuel Gil Peyrot (`Link mauve <xmpp:linkmauve@linkmauve.fr?message>`_) - Emmanuel Gil Peyrot (`Link mauve <xmpp:linkmauve@linkmauve.fr?message>`_)
- Sam Whited (`Sam Whited <mailto:sam@samwhited.com>`_)
- Dan Sully (`Dan Sully <mailto:daniel@electricalrain.com>`_)
- Gasper Zejn (`Gasper Zejn <mailto:zejn@kiberpipa.org>`_)
- Krzysztof Kotlenga (`Krzysztof Kotlenga <mailto:pocek@users.sf.net>`_)
- Tsukasa Hiiragi (`Tsukasa Hiiragi <mailto:bakalolka@gmail.com>`_)
Credits (SleekXMPP) Credits (SleekXMPP)
------------------- -------------------

View File

@@ -163,7 +163,7 @@ behaviour:
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'registered', 'remove')) interfaces = {'username', 'password', 'registered', 'remove'}
sub_interfaces = interfaces sub_interfaces = interfaces
def getRegistered(self): def getRegistered(self):
@@ -535,10 +535,10 @@ with some additional registration fields implemented.
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'email', 'nick', 'name', interfaces = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key', 'phone', 'url', 'date', 'misc', 'text', 'key',
'registered', 'remove', 'instructions')) 'registered', 'remove', 'instructions'}
sub_interfaces = interfaces sub_interfaces = interfaces
def getRegistered(self): def getRegistered(self):

View File

@@ -70,7 +70,7 @@ as well.
class EchoBot(slixmpp.ClientXMPP): class EchoBot(slixmpp.ClientXMPP):
def __init__(self, jid, password): def __init__(self, jid, password):
super(EchoBot, self).__init__(jid, password) super().__init__(jid, password)
Handling Session Start Handling Session Start
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
@@ -83,7 +83,7 @@ started. To do that, we will register an event handler for the :term:`session_st
.. code-block:: python .. code-block:: python
def __init__(self, jid, password): def __init__(self, jid, password):
super(EchoBot, self).__init__(jid, password) super().__init__(jid, password)
self.add_event_handler('session_start', self.start) self.add_event_handler('session_start', self.start)
@@ -153,7 +153,7 @@ whenever a messsage is received.
.. code-block:: python .. code-block:: python
def __init__(self, jid, password): def __init__(self, jid, password):
super(EchoBot, self).__init__(jid, password) super().__init__(jid, password)
self.add_event_handler('session_start', self.start) self.add_event_handler('session_start', self.start)
self.add_event_handler('message', self.message) self.add_event_handler('message', self.message)

View File

@@ -63,13 +63,13 @@ has been established:
def start(self, event): def start(self, event):
self.get_roster() self.get_roster()
self.send_presence() self.send_presence()
self.plugin['xep_0045'].joinMUC(self.room, self.plugin['xep_0045'].join_muc(self.room,
self.nick, self.nick,
wait=True) wait=True)
Note that as in :ref:`echobot`, we need to include send an initial presence and request Note that as in :ref:`echobot`, we need to include send an initial presence and request
the roster. Next, we want to join the group chat, so we call the the roster. Next, we want to join the group chat, so we call the
``joinMUC`` method of the MUC plugin. ``join_muc`` method of the MUC plugin.
.. note:: .. note::

View File

@@ -24,7 +24,7 @@ for the JID that will receive our message, and the string content of the message
class SendMsgBot(slixmpp.ClientXMPP): class SendMsgBot(slixmpp.ClientXMPP):
def __init__(self, jid, password, recipient, msg): def __init__(self, jid, password, recipient, msg):
super(SendMsgBot, self).__init__(jid, password) super().__init__(jid, password)
self.recipient = recipient self.recipient = recipient
self.msg = msg self.msg = msg

View File

@@ -41,7 +41,7 @@ class Action(ElementBase):
#: del action['status'] #: del action['status']
#: #:
#: to set, get, or remove its values. #: to set, get, or remove its values.
interfaces = set(('method', 'param', 'status')) interfaces = {'method', 'param', 'status'}
#: By default, values in the `interfaces` set are mapped to #: By default, values in the `interfaces` set are mapped to
#: attribute values. This can be changed such that an interface #: attribute values. This can be changed such that an interface

View File

@@ -67,11 +67,11 @@ class MUCBot(slixmpp.ClientXMPP):
""" """
self.get_roster() self.get_roster()
self.send_presence() self.send_presence()
self.plugin['xep_0045'].joinMUC(self.room, self.plugin['xep_0045'].join_muc(self.room,
self.nick, self.nick,
# If a room password is needed, use: # If a room password is needed, use:
# password=the_room_password, # password=the_room_password,
wait=True) wait=True)
def muc_message(self, msg): def muc_message(self, msg):
""" """

View File

@@ -15,7 +15,7 @@ class PubsubClient(slixmpp.ClientXMPP):
def __init__(self, jid, password, server, def __init__(self, jid, password, server,
node=None, action='nodes', data=''): node=None, action='nodes', data=''):
super(PubsubClient, self).__init__(jid, password) super().__init__(jid, password)
self.register_plugin('xep_0030') self.register_plugin('xep_0030')
self.register_plugin('xep_0059') self.register_plugin('xep_0059')

View File

@@ -14,7 +14,7 @@ from slixmpp.xmlstream.handler import Callback
class PubsubEvents(slixmpp.ClientXMPP): class PubsubEvents(slixmpp.ClientXMPP):
def __init__(self, jid, password): def __init__(self, jid, password):
super(PubsubEvents, self).__init__(jid, password) super().__init__(jid, password)
self.register_plugin('xep_0030') self.register_plugin('xep_0030')
self.register_plugin('xep_0059') self.register_plugin('xep_0059')

View File

@@ -22,7 +22,7 @@ from slixmpp import ClientXMPP
class LocationBot(ClientXMPP): class LocationBot(ClientXMPP):
def __init__(self, jid, password): def __init__(self, jid, password):
super(LocationBot, self).__init__(jid, password) super().__init__(jid, password)
self.add_event_handler('session_start', self.start) self.add_event_handler('session_start', self.start)
self.add_event_handler('user_location_publish', self.add_event_handler('user_location_publish',

View File

@@ -17,7 +17,7 @@ from slixmpp import ClientXMPP
class TuneBot(ClientXMPP): class TuneBot(ClientXMPP):
def __init__(self, jid, password): def __init__(self, jid, password):
super(TuneBot, self).__init__(jid, password) super().__init__(jid, password)
# Check for the current song every 5 seconds. # Check for the current song every 5 seconds.
self.schedule('Check Current Tune', 5, self._update_tune, repeat=True) self.schedule('Check Current Tune', 5, self._update_tune, repeat=True)

View File

@@ -7,20 +7,15 @@
# This software is licensed as described in the README.rst and LICENSE # This software is licensed as described in the README.rst and LICENSE
# file, which you should have received as part of this distribution. # file, which you should have received as part of this distribution.
import os
from pathlib import Path from pathlib import Path
from subprocess import call, DEVNULL
from tempfile import TemporaryFile
try: try:
from setuptools import setup from setuptools import setup
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
try:
from Cython.Build import cythonize
except ImportError:
print('Cython not found, falling back to the slow stringprep module.')
ext_modules = None
else:
ext_modules = cythonize('slixmpp/stringprep.pyx')
from run_tests import TestCommand from run_tests import TestCommand
from slixmpp.version import __version__ from slixmpp.version import __version__
@@ -40,6 +35,27 @@ CLASSIFIERS = [
packages = [str(mod.parent) for mod in Path('slixmpp').rglob('__init__.py')] packages = [str(mod.parent) for mod in Path('slixmpp').rglob('__init__.py')]
def check_include(header):
command = [os.environ.get('CC', 'cc'), '-E', '-']
with TemporaryFile('w+') as c_file:
c_file.write('#include <%s>' % header)
c_file.seek(0)
try:
return call(command, stdin=c_file, stdout=DEVNULL, stderr=DEVNULL) == 0
except FileNotFoundError:
return False
ext_modules = None
if check_include('stringprep.h'):
try:
from Cython.Build import cythonize
except ImportError:
print('Cython not found, falling back to the slow stringprep module.')
else:
ext_modules = cythonize('slixmpp/stringprep.pyx')
else:
print('libidn-dev not found, falling back to the slow stringprep module.')
setup( setup(
name="slixmpp", name="slixmpp",
version=VERSION, version=VERSION,

View File

@@ -108,10 +108,15 @@ class ClientXMPP(BaseXMPP):
CoroutineCallback('Stream Features', CoroutineCallback('Stream Features',
MatchXPath('{%s}features' % self.stream_ns), MatchXPath('{%s}features' % self.stream_ns),
self._handle_stream_features)) self._handle_stream_features))
def roster_push_filter(iq):
from_ = iq['from']
if from_ and from_ != self.boundjid.bare:
return
self.event('roster_update', iq)
self.register_handler( self.register_handler(
Callback('Roster Update', Callback('Roster Update',
StanzaPath('iq@type=set/roster'), StanzaPath('iq@type=set/roster'),
lambda iq: self.event('roster_update', iq))) roster_push_filter))
# Setup default stream features # Setup default stream features
self.register_plugin('feature_starttls') self.register_plugin('feature_starttls')
@@ -141,8 +146,11 @@ class ClientXMPP(BaseXMPP):
will be used. will be used.
:param address: A tuple containing the server's host and port. :param address: A tuple containing the server's host and port.
:param use_tls: Indicates if TLS should be used for the :param force_starttls: Indicates that negotiation should be aborted
connection. Defaults to ``True``. if the server does not advertise support for
STARTTLS. Defaults to ``True``.
:param disable_starttls: Disables TLS for the connection.
Defaults to ``False``.
:param use_ssl: Indicates if the older SSL connection method :param use_ssl: Indicates if the older SSL connection method
should be used. Defaults to ``False``. should be used. Defaults to ``False``.
""" """

View File

@@ -77,7 +77,7 @@ class IqTimeout(XMPPError):
""" """
def __init__(self, iq): def __init__(self, iq):
super(IqTimeout, self).__init__( super().__init__(
condition='remote-server-timeout', condition='remote-server-timeout',
etype='cancel') etype='cancel')
@@ -94,7 +94,7 @@ class IqError(XMPPError):
""" """
def __init__(self, iq): def __init__(self, iq):
super(IqError, self).__init__( super().__init__(
condition=iq['error']['condition'], condition=iq['error']['condition'],
text=iq['error']['text'], text=iq['error']['text'],
etype=iq['error']['type']) etype=iq['error']['type'])

View File

@@ -16,6 +16,6 @@ class Bind(ElementBase):
name = 'bind' name = 'bind'
namespace = 'urn:ietf:params:xml:ns:xmpp-bind' namespace = 'urn:ietf:params:xml:ns:xmpp-bind'
interfaces = set(('resource', 'jid')) interfaces = {'resource', 'jid'}
sub_interfaces = interfaces sub_interfaces = interfaces
plugin_attrib = 'bind' plugin_attrib = 'bind'

View File

@@ -49,7 +49,7 @@ class FeatureMechanisms(BasePlugin):
if self.security_callback is None: if self.security_callback is None:
self.security_callback = self._default_security self.security_callback = self._default_security
creds = self.sasl_callback(set(['username']), set()) creds = self.sasl_callback({'username'}, set())
if not self.use_mech and not creds['username']: if not self.use_mech and not creds['username']:
self.use_mech = 'ANONYMOUS' self.use_mech = 'ANONYMOUS'

View File

@@ -19,12 +19,12 @@ class Auth(StanzaBase):
name = 'auth' name = 'auth'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('mechanism', 'value')) interfaces = {'mechanism', 'value'}
plugin_attrib = name plugin_attrib = name
#: Some SASL mechs require sending values as is, #: Some SASL mechs require sending values as is,
#: without converting base64. #: without converting base64.
plain_mechs = set(['X-MESSENGER-OAUTH2']) plain_mechs = {'X-MESSENGER-OAUTH2'}
def setup(self, xml): def setup(self, xml):
StanzaBase.setup(self, xml) StanzaBase.setup(self, xml)

View File

@@ -19,7 +19,7 @@ class Challenge(StanzaBase):
name = 'challenge' name = 'challenge'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('value',)) interfaces = {'value'}
plugin_attrib = name plugin_attrib = name
def setup(self, xml): def setup(self, xml):

View File

@@ -16,13 +16,14 @@ class Failure(StanzaBase):
name = 'failure' name = 'failure'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('condition', 'text')) interfaces = {'condition', 'text'}
plugin_attrib = name plugin_attrib = name
sub_interfaces = set(('text',)) sub_interfaces = {'text'}
conditions = set(('aborted', 'account-disabled', 'credentials-expired', conditions = {'aborted', 'account-disabled', 'credentials-expired',
'encryption-required', 'incorrect-encoding', 'invalid-authzid', 'encryption-required', 'incorrect-encoding',
'invalid-mechanism', 'malformed-request', 'mechansism-too-weak', 'invalid-authzid', 'invalid-mechanism', 'malformed-request',
'not-authorized', 'temporary-auth-failure')) 'mechansism-too-weak', 'not-authorized',
'temporary-auth-failure'}
def setup(self, xml=None): def setup(self, xml=None):
""" """

View File

@@ -16,7 +16,7 @@ class Mechanisms(ElementBase):
name = 'mechanisms' name = 'mechanisms'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('mechanisms', 'required')) interfaces = {'mechanisms', 'required'}
plugin_attrib = name plugin_attrib = name
is_extension = True is_extension = True

View File

@@ -19,7 +19,7 @@ class Response(StanzaBase):
name = 'response' name = 'response'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('value',)) interfaces = {'value'}
plugin_attrib = name plugin_attrib = name
def setup(self, xml): def setup(self, xml):

View File

@@ -18,7 +18,7 @@ class Success(StanzaBase):
name = 'success' name = 'success'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(['value']) interfaces = {'value'}
plugin_attrib = name plugin_attrib = name
def setup(self, xml): def setup(self, xml):

View File

@@ -16,7 +16,7 @@ class STARTTLS(ElementBase):
name = 'starttls' name = 'starttls'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls' namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = set(('required',)) interfaces = {'required'}
plugin_attrib = name plugin_attrib = name
def get_required(self): def get_required(self):

View File

@@ -79,7 +79,7 @@ def _validate_node(node):
:returns: The local portion of a JID, as validated by nodeprep. :returns: The local portion of a JID, as validated by nodeprep.
""" """
if node is None: if node is None:
return None return ''
try: try:
node = nodeprep(node) node = nodeprep(node)
@@ -160,7 +160,7 @@ def _validate_resource(resource):
:returns: The local portion of a JID, as validated by resourceprep. :returns: The local portion of a JID, as validated by resourceprep.
""" """
if resource is None: if resource is None:
return None return ''
try: try:
resource = resourceprep(resource) resource = resourceprep(resource)

View File

@@ -308,7 +308,7 @@ class BasePlugin(object):
if key in self.default_config: if key in self.default_config:
self.config[key] = value self.config[key] = value
else: else:
super(BasePlugin, self).__setattr__(key, value) super().__setattr__(key, value)
def _init(self): def _init(self):
"""Initialize plugin state, such as registering event handlers. """Initialize plugin state, such as registering event handlers.

View File

@@ -21,15 +21,15 @@ class GmailQuery(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'query' name = 'query'
plugin_attrib = 'gmail' plugin_attrib = 'gmail'
interfaces = set(('newer-than-time', 'newer-than-tid', 'q', 'search')) interfaces = {'newer-than-time', 'newer-than-tid', 'q', 'search'}
def getSearch(self): def get_search(self):
return self['q'] return self['q']
def setSearch(self, search): def set_search(self, search):
self['q'] = search self['q'] = search
def delSearch(self): def del_search(self):
del self['q'] del self['q']
@@ -37,20 +37,20 @@ class MailBox(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'mailbox' name = 'mailbox'
plugin_attrib = 'mailbox' plugin_attrib = 'mailbox'
interfaces = set(('result-time', 'total-matched', 'total-estimate', interfaces = {'result-time', 'total-matched', 'total-estimate',
'url', 'threads', 'matched', 'estimate')) 'url', 'threads', 'matched', 'estimate'}
def getThreads(self): def get_threads(self):
threads = [] threads = []
for threadXML in self.xml.findall('{%s}%s' % (MailThread.namespace, for threadXML in self.xml.findall('{%s}%s' % (MailThread.namespace,
MailThread.name)): MailThread.name)):
threads.append(MailThread(xml=threadXML, parent=None)) threads.append(MailThread(xml=threadXML, parent=None))
return threads return threads
def getMatched(self): def get_matched(self):
return self['total-matched'] return self['total-matched']
def getEstimate(self): def get_estimate(self):
return self['total-estimate'] == '1' return self['total-estimate'] == '1'
@@ -58,11 +58,11 @@ class MailThread(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'mail-thread-info' name = 'mail-thread-info'
plugin_attrib = 'thread' plugin_attrib = 'thread'
interfaces = set(('tid', 'participation', 'messages', 'date', interfaces = {'tid', 'participation', 'messages', 'date',
'senders', 'url', 'labels', 'subject', 'snippet')) 'senders', 'url', 'labels', 'subject', 'snippet'}
sub_interfaces = set(('labels', 'subject', 'snippet')) sub_interfaces = {'labels', 'subject', 'snippet'}
def getSenders(self): def get_senders(self):
senders = [] senders = []
sendersXML = self.xml.find('{%s}senders' % self.namespace) sendersXML = self.xml.find('{%s}senders' % self.namespace)
if sendersXML is not None: if sendersXML is not None:
@@ -75,12 +75,12 @@ class MailSender(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'sender' name = 'sender'
plugin_attrib = 'sender' plugin_attrib = 'sender'
interfaces = set(('address', 'name', 'originator', 'unread')) interfaces = {'address', 'name', 'originator', 'unread'}
def getOriginator(self): def get_originator(self):
return self.xml.attrib.get('originator', '0') == '1' return self.xml.attrib.get('originator', '0') == '1'
def getUnread(self): def get_unread(self):
return self.xml.attrib.get('unread', '0') == '1' return self.xml.attrib.get('unread', '0') == '1'

View File

@@ -13,7 +13,7 @@ class GoogleAuth(ElementBase):
name = 'auth' name = 'auth'
namespace = 'http://www.google.com/talk/protocol/auth' namespace = 'http://www.google.com/talk/protocol/auth'
plugin_attrib = 'google' plugin_attrib = 'google'
interfaces = set(['client_uses_full_bind_result', 'service']) interfaces = {'client_uses_full_bind_result', 'service'}
discovery_attr= '{%s}client-uses-full-bind-result' % namespace discovery_attr= '{%s}client-uses-full-bind-result' % namespace
service_attr= '{%s}service' % namespace service_attr= '{%s}service' % namespace

View File

@@ -14,7 +14,7 @@ class NoSave(ElementBase):
name = 'x' name = 'x'
namespace = 'google:nosave' namespace = 'google:nosave'
plugin_attrib = 'google_nosave' plugin_attrib = 'google_nosave'
interfaces = set(['value']) interfaces = {'value'}
def get_value(self): def get_value(self):
return self._get_attr('value', '') == 'enabled' return self._get_attr('value', '') == 'enabled'
@@ -35,7 +35,7 @@ class Item(ElementBase):
namespace = 'google:nosave' namespace = 'google:nosave'
plugin_attrib = 'item' plugin_attrib = 'item'
plugin_multi_attrib = 'items' plugin_multi_attrib = 'items'
interfaces = set(['jid', 'source', 'value']) interfaces = {'jid', 'source', 'value'}
def get_value(self): def get_value(self):
return self._get_attr('value', '') == 'enabled' return self._get_attr('value', '') == 'enabled'

View File

@@ -23,7 +23,7 @@ class XEP_0004(BasePlugin):
name = 'xep_0004' name = 'xep_0004'
description = 'XEP-0004: Data Forms' description = 'XEP-0004: Data Forms'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -14,21 +14,21 @@ class FormField(ElementBase):
name = 'field' name = 'field'
plugin_attrib = 'field' plugin_attrib = 'field'
plugin_multi_attrib = 'fields' plugin_multi_attrib = 'fields'
interfaces = set(('answer', 'desc', 'required', 'value', interfaces = {'answer', 'desc', 'required', 'value',
'label', 'type', 'var')) 'label', 'type', 'var'}
sub_interfaces = set(('desc',)) sub_interfaces = {'desc'}
plugin_tag_map = {} plugin_tag_map = {}
plugin_attrib_map = {} plugin_attrib_map = {}
field_types = set(('boolean', 'fixed', 'hidden', 'jid-multi', field_types = {'boolean', 'fixed', 'hidden', 'jid-multi',
'jid-single', 'list-multi', 'list-single', 'jid-single', 'list-multi', 'list-single',
'text-multi', 'text-private', 'text-single')) 'text-multi', 'text-private', 'text-single'}
true_values = set((True, '1', 'true')) true_values = {True, '1', 'true'}
option_types = set(('list-multi', 'list-single')) option_types = {'list-multi', 'list-single'}
multi_line_types = set(('hidden', 'text-multi')) multi_line_types = {'hidden', 'text-multi'}
multi_value_types = set(('hidden', 'jid-multi', multi_value_types = {'hidden', 'jid-multi',
'list-multi', 'text-multi')) 'list-multi', 'text-multi'}
def setup(self, xml=None): def setup(self, xml=None):
if ElementBase.setup(self, xml): if ElementBase.setup(self, xml):
@@ -164,8 +164,8 @@ class FieldOption(ElementBase):
namespace = 'jabber:x:data' namespace = 'jabber:x:data'
name = 'option' name = 'option'
plugin_attrib = 'option' plugin_attrib = 'option'
interfaces = set(('label', 'value')) interfaces = {'label', 'value'}
sub_interfaces = set(('value',)) sub_interfaces = {'value'}
plugin_multi_attrib = 'options' plugin_multi_attrib = 'options'

View File

@@ -24,8 +24,8 @@ class Form(ElementBase):
name = 'x' name = 'x'
plugin_attrib = 'form' plugin_attrib = 'form'
interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', )) interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', ))
sub_interfaces = set(('title',)) sub_interfaces = {'title'}
form_types = set(('cancel', 'form', 'result', 'submit')) form_types = {'cancel', 'form', 'result', 'submit'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
title = None title = None

View File

@@ -92,13 +92,13 @@ def _py2xml(*args):
def xml2py(params): def xml2py(params):
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
vals = [] vals = []
for param in params.xml.findall('{%s}param' % namespace): for param in params.findall('{%s}param' % namespace):
vals.append(_xml2py(param.find('{%s}value' % namespace))) vals.append(_xml2py(param.find('{%s}value' % namespace)))
return vals return vals
def _xml2py(value): def _xml2py(value):
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
find_value = value.xml.find find_value = value.find
if find_value('{%s}nil' % namespace) is not None: if find_value('{%s}nil' % namespace) is not None:
return None return None
if find_value('{%s}i4' % namespace) is not None: if find_value('{%s}i4' % namespace) is not None:

View File

@@ -24,7 +24,7 @@ class XEP_0009(BasePlugin):
name = 'xep_0009' name = 'xep_0009'
description = 'XEP-0009: Jabber-RPC' description = 'XEP-0009: Jabber-RPC'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):
@@ -121,7 +121,7 @@ class XEP_0009(BasePlugin):
def _recipient_unvailable(self, iq): def _recipient_unvailable(self, iq):
payload = iq.get_payload() payload = iq.get_payload()
iq = iq.reply() iq = iq.reply()
error().set_payload(payload) iq.error().set_payload(payload)
iq['error']['code'] = '404' iq['error']['code'] = '404'
iq['error']['type'] = 'wait' iq['error']['type'] = 'wait'
iq['error']['condition'] = 'recipient-unavailable' iq['error']['condition'] = 'recipient-unavailable'

View File

@@ -14,8 +14,8 @@ class RPCQuery(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'rpc_query' plugin_attrib = 'rpc_query'
interfaces = set(()) interfaces = {}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
@@ -24,8 +24,8 @@ class MethodCall(ElementBase):
name = 'methodCall' name = 'methodCall'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'method_call' plugin_attrib = 'method_call'
interfaces = set(('method_name', 'params')) interfaces = {'method_name', 'params'}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
@@ -46,8 +46,8 @@ class MethodResponse(ElementBase):
name = 'methodResponse' name = 'methodResponse'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'method_response' plugin_attrib = 'method_response'
interfaces = set(('params', 'fault')) interfaces = {'params', 'fault'}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}

View File

@@ -29,7 +29,7 @@ class XEP_0012(BasePlugin):
name = 'xep_0012' name = 'xep_0012'
description = 'XEP-0012: Last Activity' description = 'XEP-0012: Last Activity'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -14,7 +14,7 @@ class LastActivity(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:last' namespace = 'jabber:iq:last'
plugin_attrib = 'last_activity' plugin_attrib = 'last_activity'
interfaces = set(('seconds', 'status')) interfaces = {'seconds', 'status'}
def get_seconds(self): def get_seconds(self):
return int(self._get_attr('seconds')) return int(self._get_attr('seconds'))

View File

@@ -29,7 +29,7 @@ class XEP_0013(BasePlugin):
name = 'xep_0013' name = 'xep_0013'
description = 'XEP-0013: Flexible Offline Message Retrieval' description = 'XEP-0013: Flexible Offline Message Retrieval'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -14,7 +14,7 @@ class Offline(ElementBase):
name = 'offline' name = 'offline'
namespace = 'http://jabber.org/protocol/offline' namespace = 'http://jabber.org/protocol/offline'
plugin_attrib = 'offline' plugin_attrib = 'offline'
interfaces = set(['fetch', 'purge', 'results']) interfaces = {'fetch', 'purge', 'results'}
bool_interfaces = interfaces bool_interfaces = interfaces
def setup(self, xml=None): def setup(self, xml=None):
@@ -39,9 +39,9 @@ class Item(ElementBase):
name = 'item' name = 'item'
namespace = 'http://jabber.org/protocol/offline' namespace = 'http://jabber.org/protocol/offline'
plugin_attrib = 'item' plugin_attrib = 'item'
interfaces = set(['action', 'node', 'jid']) interfaces = {'action', 'node', 'jid'}
actions = set(['view', 'remove']) actions = {'view', 'remove'}
def get_jid(self): def get_jid(self):
return JID(self._get_attr('jid')) return JID(self._get_attr('jid'))

View File

@@ -17,7 +17,7 @@ class XEP_0016(BasePlugin):
name = 'xep_0016' name = 'xep_0016'
description = 'XEP-0016: Privacy Lists' description = 'XEP-0016: Privacy Lists'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -18,14 +18,14 @@ class Active(ElementBase):
name = 'active' name = 'active'
namespace = 'jabber:iq:privacy' namespace = 'jabber:iq:privacy'
plugin_attrib = name plugin_attrib = name
interfaces = set(['name']) interfaces = {'name'}
class Default(ElementBase): class Default(ElementBase):
name = 'default' name = 'default'
namespace = 'jabber:iq:privacy' namespace = 'jabber:iq:privacy'
plugin_attrib = name plugin_attrib = name
interfaces = set(['name']) interfaces = {'name'}
class List(ElementBase): class List(ElementBase):
@@ -33,7 +33,7 @@ class List(ElementBase):
namespace = 'jabber:iq:privacy' namespace = 'jabber:iq:privacy'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'lists' plugin_multi_attrib = 'lists'
interfaces = set(['name']) interfaces = {'name'}
def add_item(self, value, action, order, itype=None, iq=False, def add_item(self, value, action, order, itype=None, iq=False,
message=False, presence_in=False, presence_out=False): message=False, presence_in=False, presence_out=False):
@@ -55,9 +55,9 @@ class Item(ElementBase):
namespace = 'jabber:iq:privacy' namespace = 'jabber:iq:privacy'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'items' plugin_multi_attrib = 'items'
interfaces = set(['type', 'value', 'action', 'order', 'iq', interfaces = {'type', 'value', 'action', 'order', 'iq',
'message', 'presence_in', 'presence_out']) 'message', 'presence_in', 'presence_out'}
bool_interfaces = set(['message', 'iq', 'presence_in', 'presence_out']) bool_interfaces = {'message', 'iq', 'presence_in', 'presence_out'}
type_values = ('', 'jid', 'group', 'subscription') type_values = ('', 'jid', 'group', 'subscription')
action_values = ('allow', 'deny') action_values = ('allow', 'deny')

View File

@@ -24,7 +24,7 @@ class XEP_0020(BasePlugin):
name = 'xep_0020' name = 'xep_0020'
description = 'XEP-0020: Feature Negotiation' description = 'XEP-0020: Feature Negotiation'
dependencies = set(['xep_0004', 'xep_0030']) dependencies = {'xep_0004', 'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -13,7 +13,7 @@ class Signed(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:signed' namespace = 'jabber:x:signed'
plugin_attrib = 'signed' plugin_attrib = 'signed'
interfaces = set(['signed']) interfaces = {'signed'}
is_extension = True is_extension = True
def set_signed(self, value): def set_signed(self, value):
@@ -33,7 +33,7 @@ class Encrypted(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:encrypted' namespace = 'jabber:x:encrypted'
plugin_attrib = 'encrypted' plugin_attrib = 'encrypted'
interfaces = set(['encrypted']) interfaces = {'encrypted'}
is_extension = True is_extension = True
def set_encrypted(self, value): def set_encrypted(self, value):

View File

@@ -71,8 +71,8 @@ class DiscoInfo(ElementBase):
name = 'query' name = 'query'
namespace = 'http://jabber.org/protocol/disco#info' namespace = 'http://jabber.org/protocol/disco#info'
plugin_attrib = 'disco_info' plugin_attrib = 'disco_info'
interfaces = set(('node', 'features', 'identities')) interfaces = {'node', 'features', 'identities'}
lang_interfaces = set(('identities',)) lang_interfaces = {'identities'}
# Cache identities and features # Cache identities and features
_identities = set() _identities = set()
@@ -91,7 +91,7 @@ class DiscoInfo(ElementBase):
""" """
ElementBase.setup(self, xml) ElementBase.setup(self, xml)
self._identities = set([id[0:3] for id in self['identities']]) self._identities = {id[0:3] for id in self['identities']}
self._features = self['features'] self._features = self['features']
def add_identity(self, category, itype, name=None, lang=None): def add_identity(self, category, itype, name=None, lang=None):

View File

@@ -45,7 +45,7 @@ class DiscoItems(ElementBase):
name = 'query' name = 'query'
namespace = 'http://jabber.org/protocol/disco#items' namespace = 'http://jabber.org/protocol/disco#items'
plugin_attrib = 'disco_items' plugin_attrib = 'disco_items'
interfaces = set(('node', 'items')) interfaces = {'node', 'items'}
# Cache items # Cache items
_items = set() _items = set()
@@ -62,7 +62,7 @@ class DiscoItems(ElementBase):
xml -- Use an existing XML object for the stanza's values. xml -- Use an existing XML object for the stanza's values.
""" """
ElementBase.setup(self, xml) ElementBase.setup(self, xml)
self._items = set([item[0:2] for item in self['items']]) self._items = {item[0:2] for item in self['items']}
def add_item(self, jid, node=None, name=None): def add_item(self, jid, node=None, name=None):
""" """
@@ -138,7 +138,7 @@ class DiscoItem(ElementBase):
name = 'item' name = 'item'
namespace = 'http://jabber.org/protocol/disco#items' namespace = 'http://jabber.org/protocol/disco#items'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'name')) interfaces = {'jid', 'node', 'name'}
def get_node(self): def get_node(self):
"""Return the item's node name or ``None``.""" """Return the item's node name or ``None``."""

View File

@@ -22,7 +22,7 @@ class XEP_0033(BasePlugin):
name = 'xep_0033' name = 'xep_0033'
description = 'XEP-0033: Extended Stanza Addressing' description = 'XEP-0033: Extended Stanza Addressing'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -37,9 +37,9 @@ class Address(ElementBase):
name = 'address' name = 'address'
namespace = 'http://jabber.org/protocol/address' namespace = 'http://jabber.org/protocol/address'
plugin_attrib = 'address' plugin_attrib = 'address'
interfaces = set(['type', 'jid', 'node', 'uri', 'desc', 'delivered']) interfaces = {'type', 'jid', 'node', 'uri', 'desc', 'delivered'}
address_types = set(('bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to')) address_types = {'bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to'}
def get_jid(self): def get_jid(self):
return JID(self._get_attr('jid')) return JID(self._get_attr('jid'))
@@ -117,9 +117,12 @@ for atype in ('all', 'bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to'):
setattr(Addresses, "set_%s" % atype, set_multi) setattr(Addresses, "set_%s" % atype, set_multi)
setattr(Addresses, "del_%s" % atype, del_multi) setattr(Addresses, "del_%s" % atype, del_multi)
# To retain backwards compatibility:
if atype == 'all': if atype == 'all':
Addresses.interfaces.add('addresses') Addresses.interfaces.add('addresses')
setattr(Addresses, "get_addresses", get_multi)
setattr(Addresses, "set_addresses", set_multi)
setattr(Addresses, "del_addresses", del_multi)
register_stanza_plugin(Addresses, Address, iterable=True) register_stanza_plugin(Addresses, Address, iterable=True)

View File

@@ -25,86 +25,86 @@ class MUCPresence(ElementBase):
name = 'x' name = 'x'
namespace = 'http://jabber.org/protocol/muc#user' namespace = 'http://jabber.org/protocol/muc#user'
plugin_attrib = 'muc' plugin_attrib = 'muc'
interfaces = set(('affiliation', 'role', 'jid', 'nick', 'room')) interfaces = {'affiliation', 'role', 'jid', 'nick', 'room'}
affiliations = set(('', )) affiliations = {'', }
roles = set(('', )) roles = {'', }
def getXMLItem(self): def get_xml_item(self):
item = self.xml.find('{http://jabber.org/protocol/muc#user}item') item = self.xml.find('{http://jabber.org/protocol/muc#user}item')
if item is None: if item is None:
item = ET.Element('{http://jabber.org/protocol/muc#user}item') item = ET.Element('{http://jabber.org/protocol/muc#user}item')
self.xml.append(item) self.xml.append(item)
return item return item
def getAffiliation(self): def get_affiliation(self):
#TODO if no affilation, set it to the default and return default #TODO if no affilation, set it to the default and return default
item = self.getXMLItem() item = self.get_xml_item()
return item.get('affiliation', '') return item.get('affiliation', '')
def setAffiliation(self, value): def set_affiliation(self, value):
item = self.getXMLItem() item = self.get_xml_item()
#TODO check for valid affiliation #TODO check for valid affiliation
item.attrib['affiliation'] = value item.attrib['affiliation'] = value
return self return self
def delAffiliation(self): def del_affiliation(self):
item = self.getXMLItem() item = self.get_xml_item()
#TODO set default affiliation #TODO set default affiliation
if 'affiliation' in item.attrib: del item.attrib['affiliation'] if 'affiliation' in item.attrib: del item.attrib['affiliation']
return self return self
def getJid(self): def get_jid(self):
item = self.getXMLItem() item = self.get_xml_item()
return JID(item.get('jid', '')) return JID(item.get('jid', ''))
def setJid(self, value): def set_jid(self, value):
item = self.getXMLItem() item = self.get_xml_item()
if not isinstance(value, str): if not isinstance(value, str):
value = str(value) value = str(value)
item.attrib['jid'] = value item.attrib['jid'] = value
return self return self
def delJid(self): def del_jid(self):
item = self.getXMLItem() item = self.get_xml_item()
if 'jid' in item.attrib: del item.attrib['jid'] if 'jid' in item.attrib: del item.attrib['jid']
return self return self
def getRole(self): def get_role(self):
item = self.getXMLItem() item = self.get_xml_item()
#TODO get default role, set default role if none #TODO get default role, set default role if none
return item.get('role', '') return item.get('role', '')
def setRole(self, value): def set_role(self, value):
item = self.getXMLItem() item = self.get_xml_item()
#TODO check for valid role #TODO check for valid role
item.attrib['role'] = value item.attrib['role'] = value
return self return self
def delRole(self): def del_role(self):
item = self.getXMLItem() item = self.get_xml_item()
#TODO set default role #TODO set default role
if 'role' in item.attrib: del item.attrib['role'] if 'role' in item.attrib: del item.attrib['role']
return self return self
def getNick(self): def get_nick(self):
return self.parent()['from'].resource return self.parent()['from'].resource
def getRoom(self): def get_room(self):
return self.parent()['from'].bare return self.parent()['from'].bare
def setNick(self, value): def set_nick(self, value):
log.warning("Cannot set nick through mucpresence plugin.") log.warning("Cannot set nick through mucpresence plugin.")
return self return self
def setRoom(self, value): def set_room(self, value):
log.warning("Cannot set room through mucpresence plugin.") log.warning("Cannot set room through mucpresence plugin.")
return self return self
def delNick(self): def del_nick(self):
log.warning("Cannot delete nick through mucpresence plugin.") log.warning("Cannot delete nick through mucpresence plugin.")
return self return self
def delRoom(self): def del_room(self):
log.warning("Cannot delete room through mucpresence plugin.") log.warning("Cannot delete room through mucpresence plugin.")
return self return self
@@ -117,11 +117,11 @@ class XEP_0045(BasePlugin):
name = 'xep_0045' name = 'xep_0045'
description = 'XEP-0045: Multi-User Chat' description = 'XEP-0045: Multi-User Chat'
dependencies = set(['xep_0030', 'xep_0004']) dependencies = {'xep_0030', 'xep_0004'}
def plugin_init(self): def plugin_init(self):
self.rooms = {} self.rooms = {}
self.ourNicks = {} self.our_nicks = {}
self.xep = '0045' self.xep = '0045'
# load MUC support in presence stanzas # load MUC support in presence stanzas
register_stanza_plugin(Presence, MUCPresence) register_stanza_plugin(Presence, MUCPresence)
@@ -201,22 +201,22 @@ class XEP_0045(BasePlugin):
""" """
self.xmpp.event('groupchat_subject', msg) self.xmpp.event('groupchat_subject', msg)
def jidInRoom(self, room, jid): def jid_in_room(self, room, jid):
for nick in self.rooms[room]: for nick in self.rooms[room]:
entry = self.rooms[room][nick] entry = self.rooms[room][nick]
if entry is not None and entry['jid'].full == jid: if entry is not None and entry['jid'].full == jid:
return True return True
return False return False
def getNick(self, room, jid): def get_nick(self, room, jid):
for nick in self.rooms[room]: for nick in self.rooms[room]:
entry = self.rooms[room][nick] entry = self.rooms[room][nick]
if entry is not None and entry['jid'].full == jid: if entry is not None and entry['jid'].full == jid:
return nick return nick
def configureRoom(self, room, form=None, ifrom=None): def configure_room(self, room, form=None, ifrom=None):
if form is None: if form is None:
form = self.getRoomConfig(room, ifrom=ifrom) form = self.get_room_config(room, ifrom=ifrom)
iq = self.xmpp.make_iq_set() iq = self.xmpp.make_iq_set()
iq['to'] = room iq['to'] = room
if ifrom is not None: if ifrom is not None:
@@ -234,7 +234,7 @@ class XEP_0045(BasePlugin):
return False return False
return True return True
def joinMUC(self, room, nick, maxhistory="0", password='', wait=False, pstatus=None, pshow=None, pfrom=None): def join_muc(self, room, nick, maxhistory="0", password='', wait=False, pstatus=None, pshow=None, pfrom=None):
""" Join the specified room, requesting 'maxhistory' lines of history. """ Join the specified room, requesting 'maxhistory' lines of history.
""" """
stanza = self.xmpp.make_presence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom) stanza = self.xmpp.make_presence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom)
@@ -258,7 +258,7 @@ class XEP_0045(BasePlugin):
expect = ET.Element("{%s}presence" % self.xmpp.default_ns, {'from':"%s/%s" % (room, nick)}) expect = ET.Element("{%s}presence" % self.xmpp.default_ns, {'from':"%s/%s" % (room, nick)})
self.xmpp.send(stanza, expect) self.xmpp.send(stanza, expect)
self.rooms[room] = {} self.rooms[room] = {}
self.ourNicks[room] = nick self.our_nicks[room] = nick
def destroy(self, room, reason='', altroom = '', ifrom=None): def destroy(self, room, reason='', altroom = '', ifrom=None):
iq = self.xmpp.make_iq_set() iq = self.xmpp.make_iq_set()
@@ -283,7 +283,7 @@ class XEP_0045(BasePlugin):
return False return False
return True return True
def setAffiliation(self, room, jid=None, nick=None, affiliation='member', ifrom=None): def set_affiliation(self, room, jid=None, nick=None, affiliation='member', ifrom=None):
""" Change room affiliation.""" """ Change room affiliation."""
if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'): if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
raise TypeError raise TypeError
@@ -305,7 +305,7 @@ class XEP_0045(BasePlugin):
return False return False
return True return True
def setRole(self, room, nick, role): def set_role(self, room, nick, role):
""" Change role property of a nick in a room. """ Change role property of a nick in a room.
Typically, roles are temporary (they last only as long as you are in the Typically, roles are temporary (they last only as long as you are in the
room), whereas affiliations are permanent (they last across groupchat room), whereas affiliations are permanent (they last across groupchat
@@ -337,7 +337,7 @@ class XEP_0045(BasePlugin):
msg.append(x) msg.append(x)
self.xmpp.send(msg) self.xmpp.send(msg)
def leaveMUC(self, room, nick, msg='', pfrom=None): def leave_muc(self, room, nick, msg='', pfrom=None):
""" Leave the specified room. """ Leave the specified room.
""" """
if msg: if msg:
@@ -346,7 +346,7 @@ class XEP_0045(BasePlugin):
self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom) self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom)
del self.rooms[room] del self.rooms[room]
def getRoomConfig(self, room, ifrom=''): def get_room_config(self, room, ifrom=''):
iq = self.xmpp.make_iq_get('http://jabber.org/protocol/muc#owner') iq = self.xmpp.make_iq_get('http://jabber.org/protocol/muc#owner')
iq['to'] = room iq['to'] = room
iq['from'] = ifrom iq['from'] = ifrom
@@ -362,7 +362,7 @@ class XEP_0045(BasePlugin):
raise ValueError raise ValueError
return self.xmpp.plugin['xep_0004'].build_form(form) return self.xmpp.plugin['xep_0004'].build_form(form)
def cancelConfig(self, room, ifrom=None): def cancel_config(self, room, ifrom=None):
query = ET.Element('{http://jabber.org/protocol/muc#owner}query') query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
x = ET.Element('{jabber:x:data}x', type='cancel') x = ET.Element('{jabber:x:data}x', type='cancel')
query.append(x) query.append(x)
@@ -371,7 +371,7 @@ class XEP_0045(BasePlugin):
iq['from'] = ifrom iq['from'] = ifrom
iq.send() iq.send()
def setRoomConfig(self, room, config, ifrom=''): def set_room_config(self, room, config, ifrom=''):
query = ET.Element('{http://jabber.org/protocol/muc#owner}query') query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
config['type'] = 'submit' config['type'] = 'submit'
query.append(config) query.append(config)
@@ -380,31 +380,31 @@ class XEP_0045(BasePlugin):
iq['from'] = ifrom iq['from'] = ifrom
iq.send() iq.send()
def getJoinedRooms(self): def get_joined_rooms(self):
return self.rooms.keys() return self.rooms.keys()
def getOurJidInRoom(self, roomJid): def get_our_jid_in_room(self, room_jid):
""" Return the jid we're using in a room. """ Return the jid we're using in a room.
""" """
return "%s/%s" % (roomJid, self.ourNicks[roomJid]) return "%s/%s" % (room_jid, self.our_nicks[room_jid])
def getJidProperty(self, room, nick, jidProperty): def get_jid_property(self, room, nick, jid_property):
""" Get the property of a nick in a room, such as its 'jid' or 'affiliation' """ Get the property of a nick in a room, such as its 'jid' or 'affiliation'
If not found, return None. If not found, return None.
""" """
if room in self.rooms and nick in self.rooms[room] and jidProperty in self.rooms[room][nick]: if room in self.rooms and nick in self.rooms[room] and jid_property in self.rooms[room][nick]:
return self.rooms[room][nick][jidProperty] return self.rooms[room][nick][jid_property]
else: else:
return None return None
def getRoster(self, room): def get_roster(self, room):
""" Get the list of nicks in a room. """ Get the list of nicks in a room.
""" """
if room not in self.rooms.keys(): if room not in self.rooms.keys():
return None return None
return self.rooms[room].keys() return self.rooms[room].keys()
def getUsersByAffiliation(cls, room, affiliation='member', ifrom=None): def get_users_by_affiliation(cls, room, affiliation='member', ifrom=None):
if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'): if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
raise TypeError raise TypeError
query = ET.Element('{http://jabber.org/protocol/muc#admin}query') query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
@@ -415,5 +415,4 @@ class XEP_0045(BasePlugin):
return iq.send() return iq.send()
xep_0045 = XEP_0045
register_plugin(XEP_0045) register_plugin(XEP_0045)

View File

@@ -18,7 +18,7 @@ class XEP_0047(BasePlugin):
name = 'xep_0047' name = 'xep_0047'
description = 'XEP-0047: In-band Bytestreams' description = 'XEP-0047: In-band Bytestreams'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'block_size': 4096, 'block_size': 4096,

View File

@@ -21,7 +21,7 @@ class Open(ElementBase):
name = 'open' name = 'open'
namespace = 'http://jabber.org/protocol/ibb' namespace = 'http://jabber.org/protocol/ibb'
plugin_attrib = 'ibb_open' plugin_attrib = 'ibb_open'
interfaces = set(('block_size', 'sid', 'stanza')) interfaces = {'block_size', 'sid', 'stanza'}
def get_block_size(self): def get_block_size(self):
return int(self._get_attr('block-size', '0')) return int(self._get_attr('block-size', '0'))
@@ -37,8 +37,8 @@ class Data(ElementBase):
name = 'data' name = 'data'
namespace = 'http://jabber.org/protocol/ibb' namespace = 'http://jabber.org/protocol/ibb'
plugin_attrib = 'ibb_data' plugin_attrib = 'ibb_data'
interfaces = set(('seq', 'sid', 'data')) interfaces = {'seq', 'sid', 'data'}
sub_interfaces = set(['data']) sub_interfaces = {'data'}
def get_seq(self): def get_seq(self):
return int(self._get_attr('seq', '0')) return int(self._get_attr('seq', '0'))
@@ -67,4 +67,4 @@ class Close(ElementBase):
name = 'close' name = 'close'
namespace = 'http://jabber.org/protocol/ibb' namespace = 'http://jabber.org/protocol/ibb'
plugin_attrib = 'ibb_close' plugin_attrib = 'ibb_close'
interfaces = set(['sid']) interfaces = {'sid'}

View File

@@ -24,7 +24,7 @@ class XEP_0048(BasePlugin):
name = 'xep_0048' name = 'xep_0048'
description = 'XEP-0048: Bookmarks' description = 'XEP-0048: Bookmarks'
dependencies = set(['xep_0045', 'xep_0049', 'xep_0060', 'xep_0163', 'xep_0223']) dependencies = {'xep_0045', 'xep_0049', 'xep_0060', 'xep_0163', 'xep_0223'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'auto_join': False, 'auto_join': False,
@@ -59,7 +59,7 @@ class XEP_0048(BasePlugin):
for conf in bookmarks['conferences']: for conf in bookmarks['conferences']:
if conf['autojoin']: if conf['autojoin']:
log.debug('Auto joining %s as %s', conf['jid'], conf['nick']) log.debug('Auto joining %s as %s', conf['jid'], conf['nick'])
self.xmpp['xep_0045'].joinMUC(conf['jid'], conf['nick'], self.xmpp['xep_0045'].join_muc(conf['jid'], conf['nick'],
password=conf['password']) password=conf['password'])
def set_bookmarks(self, bookmarks, method=None, **iqargs): def set_bookmarks(self, bookmarks, method=None, **iqargs):

View File

@@ -40,8 +40,8 @@ class Conference(ElementBase):
namespace = 'storage:bookmarks' namespace = 'storage:bookmarks'
plugin_attrib = 'conference' plugin_attrib = 'conference'
plugin_multi_attrib = 'conferences' plugin_multi_attrib = 'conferences'
interfaces = set(['nick', 'password', 'autojoin', 'jid', 'name']) interfaces = {'nick', 'password', 'autojoin', 'jid', 'name'}
sub_interfaces = set(['nick', 'password']) sub_interfaces = {'nick', 'password'}
def get_autojoin(self): def get_autojoin(self):
value = self._get_attr('autojoin') value = self._get_attr('autojoin')
@@ -58,7 +58,7 @@ class URL(ElementBase):
namespace = 'storage:bookmarks' namespace = 'storage:bookmarks'
plugin_attrib = 'url' plugin_attrib = 'url'
plugin_multi_attrib = 'urls' plugin_multi_attrib = 'urls'
interfaces = set(['url', 'name']) interfaces = {'url', 'name'}
register_stanza_plugin(Bookmarks, Conference, iterable=True) register_stanza_plugin(Bookmarks, Conference, iterable=True)

View File

@@ -23,7 +23,7 @@ class XEP_0049(BasePlugin):
name = 'xep_0049' name = 'xep_0049'
description = 'XEP-0049: Private XML Storage' description = 'XEP-0049: Private XML Storage'
dependencies = set([]) dependencies = {}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -74,7 +74,7 @@ class XEP_0050(BasePlugin):
name = 'xep_0050' name = 'xep_0050'
description = 'XEP-0050: Ad-Hoc Commands' description = 'XEP-0050: Ad-Hoc Commands'
dependencies = set(['xep_0030', 'xep_0004']) dependencies = {'xep_0030', 'xep_0004'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'session_db': None 'session_db': None
@@ -225,8 +225,8 @@ class XEP_0050(BasePlugin):
if len(payload) == 1: if len(payload) == 1:
payload = payload[0] payload = payload[0]
interfaces = set([item.plugin_attrib for item in payload]) interfaces = {item.plugin_attrib for item in payload}
payload_classes = set([item.__class__ for item in payload]) payload_classes = {item.__class__ for item in payload}
initial_session = {'id': sessionid, initial_session = {'id': sessionid,
'from': iq['from'], 'from': iq['from'],
@@ -322,8 +322,8 @@ class XEP_0050(BasePlugin):
interfaces = session.get('interfaces', set()) interfaces = session.get('interfaces', set())
payload_classes = session.get('payload_classes', set()) payload_classes = session.get('payload_classes', set())
interfaces.update(set([item.plugin_attrib for item in payload])) interfaces.update({item.plugin_attrib for item in payload})
payload_classes.update(set([item.__class__ for item in payload])) payload_classes.update({item.__class__ for item in payload})
session['interfaces'] = interfaces session['interfaces'] = interfaces
session['payload_classes'] = payload_classes session['payload_classes'] = payload_classes

View File

@@ -72,11 +72,11 @@ class Command(ElementBase):
name = 'command' name = 'command'
namespace = 'http://jabber.org/protocol/commands' namespace = 'http://jabber.org/protocol/commands'
plugin_attrib = 'command' plugin_attrib = 'command'
interfaces = set(('action', 'sessionid', 'node', interfaces = {'action', 'sessionid', 'node',
'status', 'actions', 'notes')) 'status', 'actions', 'notes'}
actions = set(('cancel', 'complete', 'execute', 'next', 'prev')) actions = {'cancel', 'complete', 'execute', 'next', 'prev'}
statuses = set(('canceled', 'completed', 'executing')) statuses = {'canceled', 'completed', 'executing'}
next_actions = set(('prev', 'next', 'complete')) next_actions = {'prev', 'next', 'complete'}
def get_action(self): def get_action(self):
""" """
@@ -136,7 +136,7 @@ class Command(ElementBase):
('error', 'The command ran, but had errors')] ('error', 'The command ran, but had errors')]
""" """
notes = [] notes = []
notes_xml = self.findall('{%s}note' % self.namespace) notes_xml = self.xml.findall('{%s}note' % self.namespace)
for note in notes_xml: for note in notes_xml:
notes.append((note.attrib.get('type', 'info'), notes.append((note.attrib.get('type', 'info'),
note.text)) note.text))
@@ -167,7 +167,7 @@ class Command(ElementBase):
""" """
Remove all notes associated with the command result. Remove all notes associated with the command result.
""" """
notes_xml = self.findall('{%s}note' % self.namespace) notes_xml = self.xml.findall('{%s}note' % self.namespace)
for note in notes_xml: for note in notes_xml:
self.xml.remove(note) self.xml.remove(note)

View File

@@ -10,15 +10,15 @@ class VCardTemp(ElementBase):
name = 'vCard' name = 'vCard'
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = 'vcard_temp' plugin_attrib = 'vcard_temp'
interfaces = set(['FN', 'VERSION']) interfaces = {'FN', 'VERSION'}
sub_interfaces = set(['FN', 'VERSION']) sub_interfaces = {'FN', 'VERSION'}
class Name(ElementBase): class Name(ElementBase):
name = 'N' name = 'N'
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
interfaces = set(['FAMILY', 'GIVEN', 'MIDDLE', 'PREFIX', 'SUFFIX']) interfaces = {'FAMILY', 'GIVEN', 'MIDDLE', 'PREFIX', 'SUFFIX'}
sub_interfaces = interfaces sub_interfaces = interfaces
def _set_component(self, name, value): def _set_component(self, name, value):
@@ -72,7 +72,7 @@ class Nickname(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'nicknames' plugin_multi_attrib = 'nicknames'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_nickname(self, value): def set_nickname(self, value):
@@ -95,9 +95,9 @@ class Email(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'emails' plugin_multi_attrib = 'emails'
interfaces = set(['HOME', 'WORK', 'INTERNET', 'PREF', 'X400', 'USERID']) interfaces = {'HOME', 'WORK', 'INTERNET', 'PREF', 'X400', 'USERID'}
sub_interfaces = set(['USERID']) sub_interfaces = {'USERID'}
bool_interfaces = set(['HOME', 'WORK', 'INTERNET', 'PREF', 'X400']) bool_interfaces = {'HOME', 'WORK', 'INTERNET', 'PREF', 'X400'}
class Address(ElementBase): class Address(ElementBase):
@@ -105,12 +105,12 @@ class Address(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'addresses' plugin_multi_attrib = 'addresses'
interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL',
'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', 'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY',
'REGION', 'PCODE', 'CTRY']) 'REGION', 'PCODE', 'CTRY'}
sub_interfaces = set(['POBOX', 'EXTADD', 'STREET', 'LOCALITY', sub_interfaces = {'POBOX', 'EXTADD', 'STREET', 'LOCALITY',
'REGION', 'PCODE', 'CTRY']) 'REGION', 'PCODE', 'CTRY'}
bool_interfaces = set(['HOME', 'WORK', 'DOM', 'INTL', 'PREF']) bool_interfaces = {'HOME', 'WORK', 'DOM', 'INTL', 'PREF'}
class Telephone(ElementBase): class Telephone(ElementBase):
@@ -118,16 +118,16 @@ class Telephone(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'telephone_numbers' plugin_multi_attrib = 'telephone_numbers'
interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG',
'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', 'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS',
'PREF', 'NUMBER']) 'PREF', 'NUMBER'}
sub_interfaces = set(['NUMBER']) sub_interfaces = {'NUMBER'}
bool_interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', bool_interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER',
'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', 'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM',
'ISDN', 'PCS', 'PREF']) 'ISDN', 'PCS', 'PREF'}
def setup(self, xml=None): def setup(self, xml=None):
super(Telephone, self).setup(xml=xml) super().setup(xml=xml)
## this blanks out numbers received from server ## this blanks out numbers received from server
##self._set_sub_text('NUMBER', '', keep=True) ##self._set_sub_text('NUMBER', '', keep=True)
@@ -143,10 +143,10 @@ class Label(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'labels' plugin_multi_attrib = 'labels'
interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT',
'PREF', 'lines']) 'PREF', 'lines'}
bool_interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', bool_interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM',
'INT', 'PREF']) 'INT', 'PREF'}
def add_line(self, value): def add_line(self, value):
line = ET.Element('{%s}LINE' % self.namespace) line = ET.Element('{%s}LINE' % self.namespace)
@@ -177,7 +177,7 @@ class Geo(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'geolocations' plugin_multi_attrib = 'geolocations'
interfaces = set(['LAT', 'LON']) interfaces = {'LAT', 'LON'}
sub_interfaces = interfaces sub_interfaces = interfaces
@@ -186,8 +186,8 @@ class Org(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'organizations' plugin_multi_attrib = 'organizations'
interfaces = set(['ORGNAME', 'ORGUNIT', 'orgunits']) interfaces = {'ORGNAME', 'ORGUNIT', 'orgunits'}
sub_interfaces = set(['ORGNAME', 'ORGUNIT']) sub_interfaces = {'ORGNAME', 'ORGUNIT'}
def add_orgunit(self, value): def add_orgunit(self, value):
orgunit = ET.Element('{%s}ORGUNIT' % self.namespace) orgunit = ET.Element('{%s}ORGUNIT' % self.namespace)
@@ -218,7 +218,7 @@ class Photo(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'photos' plugin_multi_attrib = 'photos'
interfaces = set(['TYPE', 'EXTVAL']) interfaces = {'TYPE', 'EXTVAL'}
sub_interfaces = interfaces sub_interfaces = interfaces
@@ -227,7 +227,7 @@ class Logo(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'logos' plugin_multi_attrib = 'logos'
interfaces = set(['TYPE', 'EXTVAL']) interfaces = {'TYPE', 'EXTVAL'}
sub_interfaces = interfaces sub_interfaces = interfaces
@@ -236,7 +236,7 @@ class Sound(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'sounds' plugin_multi_attrib = 'sounds'
interfaces = set(['PHONETC', 'EXTVAL']) interfaces = {'PHONETC', 'EXTVAL'}
sub_interfaces = interfaces sub_interfaces = interfaces
@@ -244,7 +244,7 @@ class BinVal(ElementBase):
name = 'BINVAL' name = 'BINVAL'
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
interfaces = set(['BINVAL']) interfaces = {'BINVAL'}
is_extension = True is_extension = True
def setup(self, xml=None): def setup(self, xml=None):
@@ -275,7 +275,7 @@ class Classification(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'classifications' plugin_multi_attrib = 'classifications'
interfaces = set(['PUBLIC', 'PRIVATE', 'CONFIDENTIAL']) interfaces = {'PUBLIC', 'PRIVATE', 'CONFIDENTIAL'}
bool_interfaces = interfaces bool_interfaces = interfaces
@@ -284,7 +284,7 @@ class Categories(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'categories' plugin_multi_attrib = 'categories'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_categories(self, values): def set_categories(self, values):
@@ -314,7 +314,7 @@ class Birthday(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'birthdays' plugin_multi_attrib = 'birthdays'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_bday(self, value): def set_bday(self, value):
@@ -336,7 +336,7 @@ class Rev(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'revision_dates' plugin_multi_attrib = 'revision_dates'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_rev(self, value): def set_rev(self, value):
@@ -358,7 +358,7 @@ class Title(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'titles' plugin_multi_attrib = 'titles'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_title(self, value): def set_title(self, value):
@@ -373,7 +373,7 @@ class Role(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'roles' plugin_multi_attrib = 'roles'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_role(self, value): def set_role(self, value):
@@ -388,7 +388,7 @@ class Note(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'notes' plugin_multi_attrib = 'notes'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_note(self, value): def set_note(self, value):
@@ -403,7 +403,7 @@ class Desc(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'descriptions' plugin_multi_attrib = 'descriptions'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_desc(self, value): def set_desc(self, value):
@@ -418,7 +418,7 @@ class URL(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'urls' plugin_multi_attrib = 'urls'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_url(self, value): def set_url(self, value):
@@ -433,7 +433,7 @@ class UID(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'uids' plugin_multi_attrib = 'uids'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_uid(self, value): def set_uid(self, value):
@@ -448,7 +448,7 @@ class ProdID(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'product_ids' plugin_multi_attrib = 'product_ids'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_prodid(self, value): def set_prodid(self, value):
@@ -463,7 +463,7 @@ class Mailer(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'mailers' plugin_multi_attrib = 'mailers'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_mailer(self, value): def set_mailer(self, value):
@@ -478,7 +478,7 @@ class SortString(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = 'SORT_STRING' plugin_attrib = 'SORT_STRING'
plugin_multi_attrib = 'sort_strings' plugin_multi_attrib = 'sort_strings'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_sort_string(self, value): def set_sort_string(self, value):
@@ -493,7 +493,7 @@ class Agent(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'agents' plugin_multi_attrib = 'agents'
interfaces = set(['EXTVAL']) interfaces = {'EXTVAL'}
sub_interfaces = interfaces sub_interfaces = interfaces
@@ -502,7 +502,7 @@ class JabberID(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'jids' plugin_multi_attrib = 'jids'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_jabberid(self, value): def set_jabberid(self, value):
@@ -517,7 +517,7 @@ class TimeZone(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'timezones' plugin_multi_attrib = 'timezones'
interfaces = set([name]) interfaces = {name}
is_extension = True is_extension = True
def set_tz(self, value): def set_tz(self, value):

View File

@@ -29,7 +29,7 @@ class XEP_0054(BasePlugin):
name = 'xep_0054' name = 'xep_0054'
description = 'XEP-0054: vcard-temp' description = 'XEP-0054: vcard-temp'
dependencies = set(['xep_0030', 'xep_0082']) dependencies = {'xep_0030', 'xep_0082'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -111,7 +111,7 @@ class XEP_0059(BasePlugin):
name = 'xep_0059' name = 'xep_0059'
description = 'XEP-0059: Result Set Management' description = 'XEP-0059: Result Set Management'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -64,10 +64,10 @@ class Set(ElementBase):
namespace = 'http://jabber.org/protocol/rsm' namespace = 'http://jabber.org/protocol/rsm'
name = 'set' name = 'set'
plugin_attrib = 'rsm' plugin_attrib = 'rsm'
sub_interfaces = set(('first', 'after', 'before', 'count', sub_interfaces = {'first', 'after', 'before', 'count',
'index', 'last', 'max')) 'index', 'last', 'max'}
interfaces = set(('first_index', 'first', 'after', 'before', interfaces = {'first_index', 'first', 'after', 'before',
'count', 'index', 'last', 'max')) 'count', 'index', 'last', 'max'}
def set_first_index(self, val): def set_first_index(self, val):
fi = self.xml.find("{%s}first" % (self.namespace)) fi = self.xml.find("{%s}first" % (self.namespace))

View File

@@ -26,7 +26,7 @@ class XEP_0060(BasePlugin):
name = 'xep_0060' name = 'xep_0060'
description = 'XEP-0060: Publish-Subscribe' description = 'XEP-0060: Publish-Subscribe'
dependencies = set(['xep_0030', 'xep_0004', 'xep_0082', 'xep_0131']) dependencies = {'xep_0030', 'xep_0004', 'xep_0082', 'xep_0131'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -11,7 +11,7 @@ from slixmpp.xmlstream import ET
class OptionalSetting(object): class OptionalSetting(object):
interfaces = set(('required',)) interfaces = {'required'}
def set_required(self, value): def set_required(self, value):
if value in (True, 'true', 'True', '1'): if value in (True, 'true', 'True', '1'):

View File

@@ -23,14 +23,14 @@ class Affiliations(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'affiliations' name = 'affiliations'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class Affiliation(ElementBase): class Affiliation(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'affiliation' name = 'affiliation'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'affiliation', 'jid')) interfaces = {'node', 'affiliation', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@@ -43,7 +43,7 @@ class Subscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'subscription', 'subid')) interfaces = {'jid', 'node', 'subscription', 'subid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@@ -56,21 +56,21 @@ class Subscriptions(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscriptions' name = 'subscriptions'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class SubscribeOptions(ElementBase, OptionalSetting): class SubscribeOptions(ElementBase, OptionalSetting):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscribe-options' name = 'subscribe-options'
plugin_attrib = 'suboptions' plugin_attrib = 'suboptions'
interfaces = set(('required',)) interfaces = {'required'}
class Item(ElementBase): class Item(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'item' name = 'item'
plugin_attrib = name plugin_attrib = name
interfaces = set(('id', 'payload')) interfaces = {'id', 'payload'}
def set_payload(self, value): def set_payload(self, value):
del self['payload'] del self['payload']
@@ -95,7 +95,7 @@ class Items(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'items' name = 'items'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'max_items')) interfaces = {'node', 'max_items'}
def set_max_items(self, value): def set_max_items(self, value):
self._set_attr('max_items', str(value)) self._set_attr('max_items', str(value))
@@ -105,14 +105,14 @@ class Create(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'create' name = 'create'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class Default(ElementBase): class Default(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'default' name = 'default'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'type')) interfaces = {'node', 'type'}
def get_type(self): def get_type(self):
t = self._get_attr('type') t = self._get_attr('type')
@@ -125,14 +125,14 @@ class Publish(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'publish' name = 'publish'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class Retract(ElementBase): class Retract(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'retract' name = 'retract'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'notify')) interfaces = {'node', 'notify'}
def get_notify(self): def get_notify(self):
notify = self._get_attr('notify') notify = self._get_attr('notify')
@@ -156,7 +156,7 @@ class Unsubscribe(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'unsubscribe' name = 'unsubscribe'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid', 'subid')) interfaces = {'node', 'jid', 'subid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@@ -169,7 +169,7 @@ class Subscribe(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscribe' name = 'subscribe'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid')) interfaces = {'node', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@@ -182,7 +182,7 @@ class Configure(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'configure' name = 'configure'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'type')) interfaces = {'node', 'type'}
def getType(self): def getType(self):
t = self._get_attr('type') t = self._get_attr('type')
@@ -195,7 +195,7 @@ class Options(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'options' name = 'options'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'options')) interfaces = {'jid', 'node', 'options'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ElementBase.__init__(self, *args, **kwargs) ElementBase.__init__(self, *args, **kwargs)
@@ -206,7 +206,10 @@ class Options(ElementBase):
return form return form
def set_options(self, value): def set_options(self, value):
self.xml.append(value) if isinstance(value, ElementBase):
self.xml.append(value.xml)
else:
self.xml.append(value)
return self return self
def del_options(self): def del_options(self):
@@ -224,7 +227,7 @@ class PublishOptions(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'publish-options' name = 'publish-options'
plugin_attrib = 'publish_options' plugin_attrib = 'publish_options'
interfaces = set(('publish_options',)) interfaces = {'publish_options'}
is_extension = True is_extension = True
def get_publish_options(self): def get_publish_options(self):
@@ -238,7 +241,10 @@ class PublishOptions(ElementBase):
if value is None: if value is None:
self.del_publish_options() self.del_publish_options()
else: else:
self.xml.append(value) if isinstance(value, ElementBase):
self.xml.append(value.xml)
else:
self.xml.append(value)
return self return self
def del_publish_options(self): def del_publish_options(self):

View File

@@ -13,18 +13,18 @@ from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin
class PubsubErrorCondition(ElementBase): class PubsubErrorCondition(ElementBase):
plugin_attrib = 'pubsub' plugin_attrib = 'pubsub'
interfaces = set(('condition', 'unsupported')) interfaces = {'condition', 'unsupported'}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
conditions = set(('closed-node', 'configuration-required', 'invalid-jid', conditions = {'closed-node', 'configuration-required', 'invalid-jid',
'invalid-options', 'invalid-payload', 'invalid-subid', 'invalid-options', 'invalid-payload', 'invalid-subid',
'item-forbidden', 'item-required', 'jid-required', 'item-forbidden', 'item-required', 'jid-required',
'max-items-exceeded', 'max-nodes-exceeded', 'max-items-exceeded', 'max-nodes-exceeded',
'nodeid-required', 'not-in-roster-group', 'nodeid-required', 'not-in-roster-group',
'not-subscribed', 'payload-too-big', 'not-subscribed', 'payload-too-big',
'payload-required', 'pending-subscription', 'payload-required', 'pending-subscription',
'presence-subscription-required', 'subid-required', 'presence-subscription-required', 'subid-required',
'too-many-subscriptions', 'unsupported')) 'too-many-subscriptions', 'unsupported'}
condition_ns = 'http://jabber.org/protocol/pubsub#errors' condition_ns = 'http://jabber.org/protocol/pubsub#errors'
def setup(self, xml): def setup(self, xml):

View File

@@ -25,7 +25,7 @@ class EventItem(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'item' name = 'item'
plugin_attrib = name plugin_attrib = name
interfaces = set(('id', 'payload', 'node', 'publisher')) interfaces = {'id', 'payload', 'node', 'publisher'}
def set_payload(self, value): def set_payload(self, value):
self.xml.append(value) self.xml.append(value)
@@ -44,56 +44,56 @@ class EventRetract(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'retract' name = 'retract'
plugin_attrib = name plugin_attrib = name
interfaces = set(('id',)) interfaces = {'id'}
class EventItems(ElementBase): class EventItems(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'items' name = 'items'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventCollection(ElementBase): class EventCollection(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'collection' name = 'collection'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventAssociate(ElementBase): class EventAssociate(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'associate' name = 'associate'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventDisassociate(ElementBase): class EventDisassociate(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'disassociate' name = 'disassociate'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventConfiguration(ElementBase): class EventConfiguration(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'configuration' name = 'configuration'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventPurge(ElementBase): class EventPurge(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'purge' name = 'purge'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class EventDelete(ElementBase): class EventDelete(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'delete' name = 'delete'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'redirect')) interfaces = {'node', 'redirect'}
def set_redirect(self, uri): def set_redirect(self, uri):
del self['redirect'] del self['redirect']
@@ -117,7 +117,7 @@ class EventSubscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription')) interfaces = {'node', 'expiry', 'jid', 'subid', 'subscription'}
def get_expiry(self): def get_expiry(self):
expiry = self._get_attr('expiry') expiry = self._get_attr('expiry')

View File

@@ -25,7 +25,7 @@ class DefaultConfig(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'default' name = 'default'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'config')) interfaces = {'node', 'config'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ElementBase.__init__(self, *args, **kwargs) ElementBase.__init__(self, *args, **kwargs)
@@ -41,7 +41,7 @@ class DefaultConfig(ElementBase):
class OwnerAffiliations(Affiliations): class OwnerAffiliations(Affiliations):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
interfaces = set(('node',)) interfaces = {'node'}
def append(self, affiliation): def append(self, affiliation):
if not isinstance(affiliation, OwnerAffiliation): if not isinstance(affiliation, OwnerAffiliation):
@@ -51,40 +51,40 @@ class OwnerAffiliations(Affiliations):
class OwnerAffiliation(Affiliation): class OwnerAffiliation(Affiliation):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
interfaces = set(('affiliation', 'jid')) interfaces = {'affiliation', 'jid'}
class OwnerConfigure(Configure): class OwnerConfigure(Configure):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'configure' name = 'configure'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class OwnerDefault(OwnerConfigure): class OwnerDefault(OwnerConfigure):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
interfaces = set(('node',)) interfaces = {'node'}
class OwnerDelete(ElementBase, OptionalSetting): class OwnerDelete(ElementBase, OptionalSetting):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'delete' name = 'delete'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class OwnerPurge(ElementBase, OptionalSetting): class OwnerPurge(ElementBase, OptionalSetting):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'purge' name = 'purge'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
class OwnerRedirect(ElementBase): class OwnerRedirect(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'redirect' name = 'redirect'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid')) interfaces = {'node', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@@ -97,7 +97,7 @@ class OwnerSubscriptions(Subscriptions):
name = 'subscriptions' name = 'subscriptions'
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node',)) interfaces = {'node'}
def append(self, subscription): def append(self, subscription):
if not isinstance(subscription, OwnerSubscription): if not isinstance(subscription, OwnerSubscription):
@@ -109,7 +109,7 @@ class OwnerSubscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'subscription')) interfaces = {'jid', 'subscription'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))

View File

@@ -22,7 +22,7 @@ class XEP_0065(BasePlugin):
name = 'xep_0065' name = 'xep_0065'
description = "XEP-0065: SOCKS5 Bytestreams" description = "XEP-0065: SOCKS5 Bytestreams"
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
default_config = { default_config = {
'auto_accept': False 'auto_accept': False
} }

View File

@@ -6,8 +6,8 @@ class Socks5(ElementBase):
name = 'query' name = 'query'
namespace = 'http://jabber.org/protocol/bytestreams' namespace = 'http://jabber.org/protocol/bytestreams'
plugin_attrib = 'socks' plugin_attrib = 'socks'
interfaces = set(['sid', 'activate']) interfaces = {'sid', 'activate'}
sub_interfaces = set(['activate']) sub_interfaces = {'activate'}
def add_streamhost(self, jid, host, port): def add_streamhost(self, jid, host, port):
sh = StreamHost(parent=self) sh = StreamHost(parent=self)
@@ -21,7 +21,7 @@ class StreamHost(ElementBase):
namespace = 'http://jabber.org/protocol/bytestreams' namespace = 'http://jabber.org/protocol/bytestreams'
plugin_attrib = 'streamhost' plugin_attrib = 'streamhost'
plugin_multi_attrib = 'streamhosts' plugin_multi_attrib = 'streamhosts'
interfaces = set(['host', 'jid', 'port']) interfaces = {'host', 'jid', 'port'}
def set_jid(self, value): def set_jid(self, value):
return self._set_attr('jid', str(value)) return self._set_attr('jid', str(value))
@@ -34,7 +34,7 @@ class StreamHostUsed(ElementBase):
name = 'streamhost-used' name = 'streamhost-used'
namespace = 'http://jabber.org/protocol/bytestreams' namespace = 'http://jabber.org/protocol/bytestreams'
plugin_attrib = 'streamhost_used' plugin_attrib = 'streamhost_used'
interfaces = set(['jid']) interfaces = {'jid'}
def set_jid(self, value): def set_jid(self, value):
return self._set_attr('jid', str(value)) return self._set_attr('jid', str(value))

View File

@@ -44,7 +44,7 @@ class XEP_0066(BasePlugin):
name = 'xep_0066' name = 'xep_0066'
description = 'XEP-0066: Out of Band Data' description = 'XEP-0066: Out of Band Data'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -17,8 +17,8 @@ class OOBTransfer(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:oob' namespace = 'jabber:iq:oob'
plugin_attrib = 'oob_transfer' plugin_attrib = 'oob_transfer'
interfaces = set(('url', 'desc', 'sid')) interfaces = {'url', 'desc', 'sid'}
sub_interfaces = set(('url', 'desc')) sub_interfaces = {'url', 'desc'}
class OOB(ElementBase): class OOB(ElementBase):
@@ -29,5 +29,5 @@ class OOB(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:oob' namespace = 'jabber:x:oob'
plugin_attrib = 'oob' plugin_attrib = 'oob'
interfaces = set(('url', 'desc')) interfaces = {'url', 'desc'}
sub_interfaces = interfaces sub_interfaces = interfaces

View File

@@ -19,8 +19,8 @@ class XHTML_IM(ElementBase):
namespace = 'http://jabber.org/protocol/xhtml-im' namespace = 'http://jabber.org/protocol/xhtml-im'
name = 'html' name = 'html'
interfaces = set(['body']) interfaces = {'body'}
lang_interfaces = set(['body']) lang_interfaces = {'body'}
plugin_attrib = name plugin_attrib = name
def set_body(self, content, lang=None): def set_body(self, content, lang=None):

View File

@@ -17,7 +17,7 @@ class XEP_0071(BasePlugin):
name = 'xep_0071' name = 'xep_0071'
description = 'XEP-0071: XHTML-IM' description = 'XEP-0071: XHTML-IM'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -26,7 +26,7 @@ class XEP_0077(BasePlugin):
name = 'xep_0077' name = 'xep_0077'
description = 'XEP-0077: In-Band Registration' description = 'XEP-0077: In-Band Registration'
dependencies = set(['xep_0004', 'xep_0066']) dependencies = {'xep_0004', 'xep_0066'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'create_account': True, 'create_account': True,

View File

@@ -16,14 +16,14 @@ class Register(ElementBase):
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'email', 'nick', 'name', interfaces = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key', 'phone', 'url', 'date', 'misc', 'text', 'key',
'registered', 'remove', 'instructions', 'fields')) 'registered', 'remove', 'instructions', 'fields'}
sub_interfaces = interfaces sub_interfaces = interfaces
form_fields = set(('username', 'password', 'email', 'nick', 'name', form_fields = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key')) 'phone', 'url', 'date', 'misc', 'text', 'key'}
def get_registered(self): def get_registered(self):
present = self.xml.find('{%s}registered' % self.namespace) present = self.xml.find('{%s}registered' % self.namespace)

View File

@@ -13,8 +13,8 @@ class IqAuth(ElementBase):
namespace = 'jabber:iq:auth' namespace = 'jabber:iq:auth'
name = 'query' name = 'query'
plugin_attrib = 'auth' plugin_attrib = 'auth'
interfaces = set(('fields', 'username', 'password', 'resource', 'digest')) interfaces = {'fields', 'username', 'password', 'resource', 'digest'}
sub_interfaces = set(('username', 'password', 'resource', 'digest')) sub_interfaces = {'username', 'password', 'resource', 'digest'}
plugin_tag_map = {} plugin_tag_map = {}
plugin_attrib_map = {} plugin_attrib_map = {}

View File

@@ -27,7 +27,7 @@ class XEP_0079(BasePlugin):
name = 'xep_0079' name = 'xep_0079'
description = 'XEP-0079: Advanced Message Processing' description = 'XEP-0079: Advanced Message Processing'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -8,6 +8,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from slixmpp import JID
from slixmpp.xmlstream import ElementBase, register_stanza_plugin from slixmpp.xmlstream import ElementBase, register_stanza_plugin
@@ -15,7 +16,7 @@ class AMP(ElementBase):
namespace = 'http://jabber.org/protocol/amp' namespace = 'http://jabber.org/protocol/amp'
name = 'amp' name = 'amp'
plugin_attrib = 'amp' plugin_attrib = 'amp'
interfaces = set(['from', 'to', 'status', 'per_hop']) interfaces = {'from', 'to', 'status', 'per_hop'}
def get_from(self): def get_from(self):
return JID(self._get_attr('from')) return JID(self._get_attr('from'))
@@ -53,7 +54,7 @@ class Rule(ElementBase):
name = 'rule' name = 'rule'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'rules' plugin_multi_attrib = 'rules'
interfaces = set(['action', 'condition', 'value']) interfaces = {'action', 'condition', 'value'}
class InvalidRules(ElementBase): class InvalidRules(ElementBase):

View File

@@ -25,7 +25,7 @@ class XEP_0080(BasePlugin):
name = 'xep_0080' name = 'xep_0080'
description = 'XEP-0080: User Location' description = 'XEP-0080: User Location'
dependencies = set(['xep_0163']) dependencies = {'xep_0163'}
stanza = stanza stanza = stanza
def plugin_end(self): def plugin_end(self):

View File

@@ -65,11 +65,11 @@ class Geoloc(ElementBase):
namespace = 'http://jabber.org/protocol/geoloc' namespace = 'http://jabber.org/protocol/geoloc'
name = 'geoloc' name = 'geoloc'
interfaces = set(('accuracy', 'alt', 'area', 'bearing', 'building', interfaces = {'accuracy', 'alt', 'area', 'bearing', 'building',
'country', 'countrycode', 'datum', 'dscription', 'country', 'countrycode', 'datum', 'dscription',
'error', 'floor', 'lat', 'locality', 'lon', 'error', 'floor', 'lat', 'locality', 'lon',
'postalcode', 'region', 'room', 'speed', 'street', 'postalcode', 'region', 'room', 'speed', 'street',
'text', 'timestamp', 'uri')) 'text', 'timestamp', 'uri'}
sub_interfaces = interfaces sub_interfaces = interfaces
plugin_attrib = name plugin_attrib = name

View File

@@ -24,7 +24,7 @@ class XEP_0084(BasePlugin):
name = 'xep_0084' name = 'xep_0084'
description = 'XEP-0084: User Avatar' description = 'XEP-0084: User Avatar'
dependencies = set(['xep_0163', 'xep_0060']) dependencies = {'xep_0163', 'xep_0060'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -16,7 +16,7 @@ class Data(ElementBase):
name = 'data' name = 'data'
namespace = 'urn:xmpp:avatar:data' namespace = 'urn:xmpp:avatar:data'
plugin_attrib = 'avatar_data' plugin_attrib = 'avatar_data'
interfaces = set(['value']) interfaces = {'value'}
def get_value(self): def get_value(self):
if self.xml.text: if self.xml.text:
@@ -63,7 +63,7 @@ class Info(ElementBase):
namespace = 'urn:xmpp:avatar:metadata' namespace = 'urn:xmpp:avatar:metadata'
plugin_attrib = 'info' plugin_attrib = 'info'
plugin_multi_attrib = 'items' plugin_multi_attrib = 'items'
interfaces = set(['bytes', 'height', 'id', 'type', 'url', 'width']) interfaces = {'bytes', 'height', 'id', 'type', 'url', 'width'}
class Pointer(ElementBase): class Pointer(ElementBase):

View File

@@ -28,7 +28,7 @@ class XEP_0085(BasePlugin):
name = 'xep_0085' name = 'xep_0085'
description = 'XEP-0085: Chat State Notifications' description = 'XEP-0085: Chat State Notifications'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -37,11 +37,11 @@ class ChatState(ElementBase):
name = '' name = ''
namespace = 'http://jabber.org/protocol/chatstates' namespace = 'http://jabber.org/protocol/chatstates'
plugin_attrib = 'chat_state' plugin_attrib = 'chat_state'
interfaces = set(('chat_state',)) interfaces = {'chat_state'}
sub_interfaces = interfaces sub_interfaces = interfaces
is_extension = True is_extension = True
states = set(('active', 'composing', 'gone', 'inactive', 'paused')) states = {'active', 'composing', 'gone', 'inactive', 'paused'}
def setup(self, xml=None): def setup(self, xml=None):
self.xml = ET.Element('') self.xml = ET.Element('')

View File

@@ -44,7 +44,7 @@ class LegacyError(ElementBase):
name = 'legacy' name = 'legacy'
namespace = Error.namespace namespace = Error.namespace
plugin_attrib = name plugin_attrib = name
interfaces = set(('condition',)) interfaces = {'condition'}
overrides = ['set_condition'] overrides = ['set_condition']
error_map = {'bad-request': ('modify', '400'), error_map = {'bad-request': ('modify', '400'),

View File

@@ -18,7 +18,7 @@ class LegacyDelay(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:delay' namespace = 'jabber:x:delay'
plugin_attrib = 'legacy_delay' plugin_attrib = 'legacy_delay'
interfaces = set(('from', 'stamp', 'text')) interfaces = {'from', 'stamp', 'text'}
def get_from(self): def get_from(self):
from_ = self._get_attr('from') from_ = self._get_attr('from')

View File

@@ -38,5 +38,5 @@ class Version(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:version' namespace = 'jabber:iq:version'
plugin_attrib = 'software_version' plugin_attrib = 'software_version'
interfaces = set(('name', 'version', 'os')) interfaces = {'name', 'version', 'os'}
sub_interfaces = interfaces sub_interfaces = interfaces

View File

@@ -28,7 +28,7 @@ class XEP_0092(BasePlugin):
name = 'xep_0092' name = 'xep_0092'
description = 'XEP-0092: Software Version' description = 'XEP-0092: Software Version'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'software_name': 'Slixmpp', 'software_name': 'Slixmpp',

View File

@@ -13,7 +13,7 @@ class SI(ElementBase):
name = 'si' name = 'si'
namespace = 'http://jabber.org/protocol/si' namespace = 'http://jabber.org/protocol/si'
plugin_attrib = 'si' plugin_attrib = 'si'
interfaces = set(['id', 'mime_type', 'profile']) interfaces = {'id', 'mime_type', 'profile'}
def get_mime_type(self): def get_mime_type(self):
return self._get_attr('mime-type', 'application/octet-stream') return self._get_attr('mime-type', 'application/octet-stream')

View File

@@ -31,7 +31,7 @@ class XEP_0095(BasePlugin):
name = 'xep_0095' name = 'xep_0095'
description = 'XEP-0095: Stream Initiation' description = 'XEP-0095: Stream Initiation'
dependencies = set(['xep_0020', 'xep_0030', 'xep_0047', 'xep_0065']) dependencies = {'xep_0020', 'xep_0030', 'xep_0047', 'xep_0065'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -23,7 +23,7 @@ class XEP_0096(BasePlugin):
name = 'xep_0096' name = 'xep_0096'
description = 'XEP-0096: SI File Transfer' description = 'XEP-0096: SI File Transfer'
dependencies = set(['xep_0095']) dependencies = {'xep_0095'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -16,8 +16,8 @@ class File(ElementBase):
name = 'file' name = 'file'
namespace = 'http://jabber.org/protocol/si/profile/file-transfer' namespace = 'http://jabber.org/protocol/si/profile/file-transfer'
plugin_attrib = 'file' plugin_attrib = 'file'
interfaces = set(['name', 'size', 'date', 'hash', 'desc']) interfaces = {'name', 'size', 'date', 'hash', 'desc'}
sub_interfaces = set(['desc']) sub_interfaces = {'desc'}
def set_size(self, value): def set_size(self, value):
self._set_attr('size', str(value)) self._set_attr('size', str(value))
@@ -36,7 +36,7 @@ class Range(ElementBase):
name = 'range' name = 'range'
namespace = 'http://jabber.org/protocol/si/profile/file-transfer' namespace = 'http://jabber.org/protocol/si/profile/file-transfer'
plugin_attrib = 'range' plugin_attrib = 'range'
interfaces = set(['length', 'offset']) interfaces = {'length', 'offset'}
def set_length(self, value): def set_length(self, value):
self._set_attr('length', str(value)) self._set_attr('length', str(value))

View File

@@ -14,7 +14,7 @@ class XEP_0106(BasePlugin):
name = 'xep_0106' name = 'xep_0106'
description = 'XEP-0106: JID Escaping' description = 'XEP-0106: JID Escaping'
dependencies = set(['xep_0030']) dependencies = {'xep_0030'}
def session_bind(self, jid): def session_bind(self, jid):
self.xmpp['xep_0030'].add_feature(feature='jid\\20escaping') self.xmpp['xep_0030'].add_feature(feature='jid\\20escaping')

View File

@@ -14,25 +14,25 @@ class UserMood(ElementBase):
name = 'mood' name = 'mood'
namespace = 'http://jabber.org/protocol/mood' namespace = 'http://jabber.org/protocol/mood'
plugin_attrib = 'mood' plugin_attrib = 'mood'
interfaces = set(['value', 'text']) interfaces = {'value', 'text'}
sub_interfaces = set(['text']) sub_interfaces = {'text'}
moods = set(['afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', moods = {'afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious',
'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious',
'cold', 'confident', 'confused', 'contemplative', 'contented', 'cold', 'confident', 'confused', 'contemplative', 'contented',
'cranky', 'crazy', 'creative', 'curious', 'dejected', 'cranky', 'crazy', 'creative', 'curious', 'dejected',
'depressed', 'disappointed', 'disgusted', 'dismayed', 'depressed', 'disappointed', 'disgusted', 'dismayed',
'distracted', 'embarrassed', 'envious', 'excited', 'distracted', 'embarrassed', 'envious', 'excited',
'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy', 'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy',
'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated', 'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated',
'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love',
'indignant', 'interested', 'intoxicated', 'invincible', 'indignant', 'interested', 'intoxicated', 'invincible',
'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody', 'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody',
'nervous', 'neutral', 'offended', 'outraged', 'playful', 'nervous', 'neutral', 'offended', 'outraged', 'playful',
'proud', 'relaxed', 'relieved', 'remorseful', 'restless', 'proud', 'relaxed', 'relieved', 'remorseful', 'restless',
'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', 'sad', 'sarcastic', 'satisfied', 'serious', 'shocked',
'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', 'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong',
'surprised', 'thankful', 'thirsty', 'tired', 'undefined', 'surprised', 'thankful', 'thirsty', 'tired', 'undefined',
'weak', 'worried']) 'weak', 'worried'}
def set_value(self, value): def set_value(self, value):
self.del_value() self.del_value()

View File

@@ -27,7 +27,7 @@ class XEP_0107(BasePlugin):
name = 'xep_0107' name = 'xep_0107'
description = 'XEP-0107: User Mood' description = 'XEP-0107: User Mood'
dependencies = set(['xep_0163']) dependencies = {'xep_0163'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -14,30 +14,30 @@ class UserActivity(ElementBase):
name = 'activity' name = 'activity'
namespace = 'http://jabber.org/protocol/activity' namespace = 'http://jabber.org/protocol/activity'
plugin_attrib = 'activity' plugin_attrib = 'activity'
interfaces = set(['value', 'text']) interfaces = {'value', 'text'}
sub_interfaces = set(['text']) sub_interfaces = {'text'}
general = set(['doing_chores', 'drinking', 'eating', 'exercising', general = {'doing_chores', 'drinking', 'eating', 'exercising',
'grooming', 'having_appointment', 'inactive', 'relaxing', 'grooming', 'having_appointment', 'inactive', 'relaxing',
'talking', 'traveling', 'undefined', 'working']) 'talking', 'traveling', 'undefined', 'working'}
specific = set(['at_the_spa', 'brushing_teeth', 'buying_groceries', specific = {'at_the_spa', 'brushing_teeth', 'buying_groceries',
'cleaning', 'coding', 'commuting', 'cooking', 'cycling', 'cleaning', 'coding', 'commuting', 'cooking', 'cycling',
'dancing', 'day_off', 'doing_maintenance', 'dancing', 'day_off', 'doing_maintenance',
'doing_the_dishes', 'doing_the_laundry', 'driving', 'doing_the_dishes', 'doing_the_laundry', 'driving',
'fishing', 'gaming', 'gardening', 'getting_a_haircut', 'fishing', 'gaming', 'gardening', 'getting_a_haircut',
'going_out', 'hanging_out', 'having_a_beer', 'going_out', 'hanging_out', 'having_a_beer',
'having_a_snack', 'having_breakfast', 'having_coffee', 'having_a_snack', 'having_breakfast', 'having_coffee',
'having_dinner', 'having_lunch', 'having_tea', 'hiding', 'having_dinner', 'having_lunch', 'having_tea', 'hiding',
'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', 'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life',
'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', 'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train',
'on_a_trip', 'on_the_phone', 'on_vacation', 'on_a_trip', 'on_the_phone', 'on_vacation',
'on_video_phone', 'other', 'partying', 'playing_sports', 'on_video_phone', 'other', 'partying', 'playing_sports',
'praying', 'reading', 'rehearsing', 'running', 'praying', 'reading', 'rehearsing', 'running',
'running_an_errand', 'scheduled_holiday', 'shaving', 'running_an_errand', 'scheduled_holiday', 'shaving',
'shopping', 'skiing', 'sleeping', 'smoking', 'shopping', 'skiing', 'sleeping', 'smoking',
'socializing', 'studying', 'sunbathing', 'swimming', 'socializing', 'studying', 'sunbathing', 'swimming',
'taking_a_bath', 'taking_a_shower', 'thinking', 'taking_a_bath', 'taking_a_shower', 'thinking',
'walking', 'walking_the_dog', 'watching_a_movie', 'walking', 'walking_the_dog', 'watching_a_movie',
'watching_tv', 'working_out', 'writing']) 'watching_tv', 'working_out', 'writing'}
def set_value(self, value): def set_value(self, value):
self.del_value() self.del_value()

View File

@@ -23,7 +23,7 @@ class XEP_0108(BasePlugin):
name = 'xep_0108' name = 'xep_0108'
description = 'XEP-0108: User Activity' description = 'XEP-0108: User Activity'
dependencies = set(['xep_0163']) dependencies = {'xep_0163'}
stanza = stanza stanza = stanza
def plugin_end(self): def plugin_end(self):

View File

@@ -32,7 +32,7 @@ class XEP_0115(BasePlugin):
name = 'xep_0115' name = 'xep_0115'
description = 'XEP-0115: Entity Capabilities' description = 'XEP-0115: Entity Capabilities'
dependencies = set(['xep_0030', 'xep_0128', 'xep_0004']) dependencies = {'xep_0030', 'xep_0128', 'xep_0004'}
stanza = stanza stanza = stanza
default_config = { default_config = {
'hash': 'sha-1', 'hash': 'sha-1',

View File

@@ -16,4 +16,4 @@ class Capabilities(ElementBase):
namespace = 'http://jabber.org/protocol/caps' namespace = 'http://jabber.org/protocol/caps'
name = 'c' name = 'c'
plugin_attrib = 'caps' plugin_attrib = 'caps'
interfaces = set(('hash', 'node', 'ver', 'ext')) interfaces = {'hash', 'node', 'ver', 'ext'}

View File

@@ -14,8 +14,8 @@ class UserTune(ElementBase):
name = 'tune' name = 'tune'
namespace = 'http://jabber.org/protocol/tune' namespace = 'http://jabber.org/protocol/tune'
plugin_attrib = 'tune' plugin_attrib = 'tune'
interfaces = set(['artist', 'length', 'rating', 'source', interfaces = {'artist', 'length', 'rating', 'source',
'title', 'track', 'uri']) 'title', 'track', 'uri'}
sub_interfaces = interfaces sub_interfaces = interfaces
def set_length(self, value): def set_length(self, value):

View File

@@ -23,7 +23,7 @@ class XEP_0118(BasePlugin):
name = 'xep_0118' name = 'xep_0118'
description = 'XEP-0118: User Tune' description = 'XEP-0118: User Tune'
dependencies = set(['xep_0163']) dependencies = {'xep_0163'}
stanza = stanza stanza = stanza
def plugin_end(self): def plugin_end(self):

View File

@@ -12,7 +12,7 @@ class XEP_0122(BasePlugin):
name = 'xep_0122' name = 'xep_0122'
description = 'XEP-0122: Data Forms Validation' description = 'XEP-0122: Data Forms Validation'
dependencies = set(['xep_0004']) dependencies = {'xep_0004'}
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View File

@@ -41,7 +41,7 @@ class XEP_0128(BasePlugin):
name = 'xep_0128' name = 'xep_0128'
description = 'XEP-0128: Service Discovery Extensions' description = 'XEP-0128: Service Discovery Extensions'
dependencies = set(['xep_0030', 'xep_0004']) dependencies = {'xep_0030', 'xep_0004'}
def plugin_init(self): def plugin_init(self):
"""Start the XEP-0128 plugin.""" """Start the XEP-0128 plugin."""

Some files were not shown because too many files have changed in this diff Show More