Compare commits
	
		
			37 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 6034df0a78 | ||
|   | df4012e66d | ||
|   | c372f3071a | ||
|   | 829c8b27b6 | ||
|   | fb3ac78bf9 | ||
|   | ffd9436e5c | ||
|   | bbb1344d79 | ||
|   | 457785b286 | ||
|   | 4847f834bd | ||
|   | 53191ff1cf | ||
|   | ffdb6ffd69 | ||
|   | 7560db856b | ||
|   | 63d245ac48 | ||
|   | 7ddd37be29 | ||
|   | a4d3a4a25e | ||
|   | 58bd07628b | ||
|   | 3569038493 | ||
|   | 20c4ff823a | ||
|   | 8a7448a5a1 | ||
|   | d23d8f901e | ||
|   | 391f12eeab | ||
|   | d008988843 | ||
|   | dcacc7d7d5 | ||
|   | c4285961df | ||
|   | 1038f656eb | ||
|   | 3c7236fe73 | ||
|   | 36824379c3 | ||
|   | a0a37c19ff | ||
|   | 1b5fe57a5e | ||
|   | 5da31db0c7 | ||
|   | f8cea760b6 | ||
|   | 5ef01ecdd1 | ||
|   | 62aafe0ee7 | ||
|   | cf3f36ac52 | ||
|   | b88d2ecd77 | ||
|   | e691850a2b | ||
|   | d4bff8dee6 | 
							
								
								
									
										8
									
								
								.gitlab-ci.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.gitlab-ci.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| test: | ||||
|   tags: | ||||
|     - docker | ||||
|   image: ubuntu:latest | ||||
|   script: | ||||
|     - apt update | ||||
|     - apt install -y python3 cython3 | ||||
|     - ./run_tests.py | ||||
| @@ -163,7 +163,7 @@ behaviour: | ||||
|         namespace = 'jabber:iq:register' | ||||
|         name = 'query' | ||||
|         plugin_attrib = 'register' | ||||
|         interfaces = set(('username', 'password', 'registered', 'remove')) | ||||
|         interfaces = {'username', 'password', 'registered', 'remove'} | ||||
|         sub_interfaces = interfaces | ||||
|  | ||||
|         def getRegistered(self): | ||||
| @@ -535,10 +535,10 @@ with some additional registration fields implemented. | ||||
|         namespace = 'jabber:iq:register' | ||||
|         name = 'query' | ||||
|         plugin_attrib = 'register' | ||||
|         interfaces = set(('username', 'password', 'email', 'nick', 'name', | ||||
|                           'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                           'phone', 'url', 'date', 'misc', 'text', 'key', | ||||
|                           'registered', 'remove', 'instructions')) | ||||
|         interfaces = {'username', 'password', 'email', 'nick', 'name', | ||||
|                       'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                       'phone', 'url', 'date', 'misc', 'text', 'key', | ||||
|                       'registered', 'remove', 'instructions'} | ||||
|         sub_interfaces = interfaces | ||||
|  | ||||
|         def getRegistered(self): | ||||
|   | ||||
| @@ -41,7 +41,7 @@ class Action(ElementBase): | ||||
|     #:     del action['status'] | ||||
|     #: | ||||
|     #: 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 | ||||
|     #: attribute values. This can be changed such that an interface | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|  | ||||
| from slixmpp import ClientXMPP | ||||
|  | ||||
| from optparse import OptionParser | ||||
| from argparse import ArgumentParser | ||||
| import logging | ||||
| import getpass | ||||
|  | ||||
| @@ -58,40 +58,40 @@ if __name__ == '__main__': | ||||
|     # ./http_over_xmpp.py -J <jid> -P <pwd> -i <ip> -p <port> [-v] | ||||
|     # | ||||
|  | ||||
|     parser = OptionParser() | ||||
|     parser = ArgumentParser() | ||||
|  | ||||
|     # Output verbosity options. | ||||
|     parser.add_option( | ||||
|     parser.add_argument( | ||||
|         '-v', '--verbose', help='set logging to DEBUG', action='store_const', | ||||
|         dest='loglevel', const=logging.DEBUG, default=logging.ERROR | ||||
|     ) | ||||
|  | ||||
|     # JID and password options. | ||||
|     parser.add_option('-J', '--jid', dest='jid', help='JID') | ||||
|     parser.add_option('-P', '--password', dest='password', help='Password') | ||||
|     parser.add_argument('-J', '--jid', dest='jid', help='JID') | ||||
|     parser.add_argument('-P', '--password', dest='password', help='Password') | ||||
|  | ||||
|     # XMPP server ip and port options. | ||||
|     parser.add_option( | ||||
|     parser.add_argument( | ||||
|         '-i', '--ipaddr', dest='ipaddr', | ||||
|         help='IP Address of the XMPP server', default=None | ||||
|     ) | ||||
|     parser.add_option( | ||||
|     parser.add_argument( | ||||
|         '-p', '--port', dest='port', | ||||
|         help='Port of the XMPP server', default=None | ||||
|     ) | ||||
|  | ||||
|     opts, args = parser.parse_args() | ||||
|     args = parser.parse_args() | ||||
|  | ||||
|     # Setup logging. | ||||
|     logging.basicConfig(level=opts.loglevel, | ||||
|     logging.basicConfig(level=args.loglevel, | ||||
|                         format='%(levelname)-8s %(message)s') | ||||
|  | ||||
|     if opts.jid is None: | ||||
|         opts.jid = input('Username: ') | ||||
|     if opts.password is None: | ||||
|         opts.password = getpass.getpass('Password: ') | ||||
|     if args.jid is None: | ||||
|         args.jid = input('Username: ') | ||||
|     if args.password is None: | ||||
|         args.password = getpass.getpass('Password: ') | ||||
|  | ||||
|     xmpp = HTTPOverXMPPClient(opts.jid, opts.password) | ||||
|     xmpp = HTTPOverXMPPClient(args.jid, args.password) | ||||
|     xmpp.connect() | ||||
|     xmpp.process() | ||||
|  | ||||
|   | ||||
							
								
								
									
										45
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								setup.py
									
									
									
									
									
								
							| @@ -7,20 +7,15 @@ | ||||
| # This software is licensed as described in the README.rst and LICENSE | ||||
| # file, which you should have received as part of this distribution. | ||||
|  | ||||
| import os | ||||
| from pathlib import Path | ||||
| from subprocess import call, DEVNULL, check_output, CalledProcessError | ||||
| from tempfile import TemporaryFile | ||||
| try: | ||||
|     from setuptools import setup | ||||
| except ImportError: | ||||
|     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 slixmpp.version import __version__ | ||||
|  | ||||
| @@ -40,6 +35,40 @@ CLASSIFIERS = [ | ||||
|  | ||||
| packages = [str(mod.parent) for mod in Path('slixmpp').rglob('__init__.py')] | ||||
|  | ||||
| def check_include(library_name, header): | ||||
|     command = [os.environ.get('PKG_CONFIG', 'pkg-config'), '--cflags', library_name] | ||||
|     try: | ||||
|         cflags = check_output(command).decode('utf-8').split() | ||||
|     except FileNotFoundError: | ||||
|         print('pkg-config not found.') | ||||
|         return False | ||||
|     except CalledProcessError: | ||||
|         # pkg-config already prints the missing libraries on stderr. | ||||
|         return False | ||||
|     command = [os.environ.get('CC', 'cc')] + cflags + ['-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: | ||||
|             print('%s headers not found.' % library_name) | ||||
|             return False | ||||
|  | ||||
| HAS_PYTHON_HEADERS = check_include('python3', 'Python.h') | ||||
| HAS_STRINGPREP_HEADERS = check_include('libidn', 'stringprep.h') | ||||
|  | ||||
| ext_modules = None | ||||
| if HAS_PYTHON_HEADERS and HAS_STRINGPREP_HEADERS: | ||||
|     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('Falling back to the slow stringprep module.') | ||||
|  | ||||
| setup( | ||||
|     name="slixmpp", | ||||
|     version=VERSION, | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
| import asyncio | ||||
| import logging | ||||
|  | ||||
| from slixmpp.jid import JID | ||||
| from slixmpp.stanza import StreamFeatures | ||||
| from slixmpp.basexmpp import BaseXMPP | ||||
| from slixmpp.exceptions import XMPPError | ||||
| @@ -108,10 +109,21 @@ class ClientXMPP(BaseXMPP): | ||||
|                 CoroutineCallback('Stream Features', | ||||
|                      MatchXPath('{%s}features' % self.stream_ns), | ||||
|                      self._handle_stream_features)) | ||||
|         def roster_push_filter(iq): | ||||
|             from_ = iq['from'] | ||||
|             if from_ and from_ != JID('') and from_ != self.boundjid.bare: | ||||
|                 reply = iq.reply() | ||||
|                 reply['type'] = 'error' | ||||
|                 reply['error']['type'] = 'cancel' | ||||
|                 reply['error']['code'] = 503 | ||||
|                 reply['error']['condition'] = 'service-unavailable' | ||||
|                 reply.send() | ||||
|                 return | ||||
|             self.event('roster_update', iq) | ||||
|         self.register_handler( | ||||
|                 Callback('Roster Update', | ||||
|                          StanzaPath('iq@type=set/roster'), | ||||
|                          lambda iq: self.event('roster_update', iq))) | ||||
|                          roster_push_filter)) | ||||
|  | ||||
|         # Setup default stream features | ||||
|         self.register_plugin('feature_starttls') | ||||
|   | ||||
| @@ -16,6 +16,6 @@ class Bind(ElementBase): | ||||
|  | ||||
|     name = 'bind' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-bind' | ||||
|     interfaces = set(('resource', 'jid')) | ||||
|     interfaces = {'resource', 'jid'} | ||||
|     sub_interfaces = interfaces | ||||
|     plugin_attrib = 'bind' | ||||
|   | ||||
| @@ -49,7 +49,7 @@ class FeatureMechanisms(BasePlugin): | ||||
|         if self.security_callback is None: | ||||
|             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']: | ||||
|             self.use_mech = 'ANONYMOUS' | ||||
|  | ||||
|   | ||||
| @@ -19,12 +19,12 @@ class Auth(StanzaBase): | ||||
|  | ||||
|     name = 'auth' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(('mechanism', 'value')) | ||||
|     interfaces = {'mechanism', 'value'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     #: Some SASL mechs require sending values as is, | ||||
|     #: without converting base64. | ||||
|     plain_mechs = set(['X-MESSENGER-OAUTH2']) | ||||
|     plain_mechs = {'X-MESSENGER-OAUTH2'} | ||||
|  | ||||
|     def setup(self, xml): | ||||
|         StanzaBase.setup(self, xml) | ||||
|   | ||||
| @@ -19,7 +19,7 @@ class Challenge(StanzaBase): | ||||
|  | ||||
|     name = 'challenge' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(('value',)) | ||||
|     interfaces = {'value'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     def setup(self, xml): | ||||
|   | ||||
| @@ -16,13 +16,14 @@ class Failure(StanzaBase): | ||||
|  | ||||
|     name = 'failure' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(('condition', 'text')) | ||||
|     interfaces = {'condition', 'text'} | ||||
|     plugin_attrib = name | ||||
|     sub_interfaces = set(('text',)) | ||||
|     conditions = set(('aborted', 'account-disabled', 'credentials-expired', | ||||
|         'encryption-required', 'incorrect-encoding', 'invalid-authzid', | ||||
|         'invalid-mechanism', 'malformed-request', 'mechansism-too-weak', | ||||
|         'not-authorized', 'temporary-auth-failure')) | ||||
|     sub_interfaces = {'text'} | ||||
|     conditions = {'aborted', 'account-disabled', 'credentials-expired', | ||||
|                   'encryption-required', 'incorrect-encoding', | ||||
|                   'invalid-authzid', 'invalid-mechanism', 'malformed-request', | ||||
|                   'mechansism-too-weak', 'not-authorized', | ||||
|                   'temporary-auth-failure'} | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
|         """ | ||||
|   | ||||
| @@ -16,7 +16,7 @@ class Mechanisms(ElementBase): | ||||
|  | ||||
|     name = 'mechanisms' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(('mechanisms', 'required')) | ||||
|     interfaces = {'mechanisms', 'required'} | ||||
|     plugin_attrib = name | ||||
|     is_extension = True | ||||
|  | ||||
|   | ||||
| @@ -19,7 +19,7 @@ class Response(StanzaBase): | ||||
|  | ||||
|     name = 'response' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(('value',)) | ||||
|     interfaces = {'value'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     def setup(self, xml): | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class Success(StanzaBase): | ||||
|  | ||||
|     name = 'success' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' | ||||
|     interfaces = set(['value']) | ||||
|     interfaces = {'value'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     def setup(self, xml): | ||||
|   | ||||
| @@ -16,7 +16,7 @@ class STARTTLS(ElementBase): | ||||
|  | ||||
|     name = 'starttls' | ||||
|     namespace = 'urn:ietf:params:xml:ns:xmpp-tls' | ||||
|     interfaces = set(('required',)) | ||||
|     interfaces = {'required'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     def get_required(self): | ||||
|   | ||||
| @@ -79,7 +79,7 @@ def _validate_node(node): | ||||
|     :returns: The local portion of a JID, as validated by nodeprep. | ||||
|     """ | ||||
|     if node is None: | ||||
|         return None | ||||
|         return '' | ||||
|  | ||||
|     try: | ||||
|         node = nodeprep(node) | ||||
| @@ -160,7 +160,7 @@ def _validate_resource(resource): | ||||
|     :returns: The local portion of a JID, as validated by resourceprep. | ||||
|     """ | ||||
|     if resource is None: | ||||
|         return None | ||||
|         return '' | ||||
|  | ||||
|     try: | ||||
|         resource = resourceprep(resource) | ||||
|   | ||||
| @@ -21,15 +21,15 @@ class GmailQuery(ElementBase): | ||||
|     namespace = 'google:mail:notify' | ||||
|     name = 'query' | ||||
|     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'] | ||||
|  | ||||
|     def setSearch(self, search): | ||||
|     def set_search(self, search): | ||||
|         self['q'] = search | ||||
|  | ||||
|     def delSearch(self): | ||||
|     def del_search(self): | ||||
|         del self['q'] | ||||
|  | ||||
|  | ||||
| @@ -37,20 +37,20 @@ class MailBox(ElementBase): | ||||
|     namespace = 'google:mail:notify' | ||||
|     name = 'mailbox' | ||||
|     plugin_attrib = 'mailbox' | ||||
|     interfaces = set(('result-time', 'total-matched', 'total-estimate', | ||||
|                       'url', 'threads', 'matched', 'estimate')) | ||||
|     interfaces = {'result-time', 'total-matched', 'total-estimate', | ||||
|                   'url', 'threads', 'matched', 'estimate'} | ||||
|  | ||||
|     def getThreads(self): | ||||
|     def get_threads(self): | ||||
|         threads = [] | ||||
|         for threadXML in self.xml.findall('{%s}%s' % (MailThread.namespace, | ||||
|                                                       MailThread.name)): | ||||
|             threads.append(MailThread(xml=threadXML, parent=None)) | ||||
|         return threads | ||||
|  | ||||
|     def getMatched(self): | ||||
|     def get_matched(self): | ||||
|         return self['total-matched'] | ||||
|  | ||||
|     def getEstimate(self): | ||||
|     def get_estimate(self): | ||||
|         return self['total-estimate'] == '1' | ||||
|  | ||||
|  | ||||
| @@ -58,11 +58,11 @@ class MailThread(ElementBase): | ||||
|     namespace = 'google:mail:notify' | ||||
|     name = 'mail-thread-info' | ||||
|     plugin_attrib = 'thread' | ||||
|     interfaces = set(('tid', 'participation', 'messages', 'date', | ||||
|                       'senders', 'url', 'labels', 'subject', 'snippet')) | ||||
|     sub_interfaces = set(('labels', 'subject', 'snippet')) | ||||
|     interfaces = {'tid', 'participation', 'messages', 'date', | ||||
|                   'senders', 'url', 'labels', 'subject', 'snippet'} | ||||
|     sub_interfaces = {'labels', 'subject', 'snippet'} | ||||
|  | ||||
|     def getSenders(self): | ||||
|     def get_senders(self): | ||||
|         senders = [] | ||||
|         sendersXML = self.xml.find('{%s}senders' % self.namespace) | ||||
|         if sendersXML is not None: | ||||
| @@ -75,12 +75,12 @@ class MailSender(ElementBase): | ||||
|     namespace = 'google:mail:notify' | ||||
|     name = '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' | ||||
|  | ||||
|     def getUnread(self): | ||||
|     def get_unread(self): | ||||
|         return self.xml.attrib.get('unread', '0') == '1' | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,7 @@ class GoogleAuth(ElementBase): | ||||
|     name = 'auth' | ||||
|     namespace = 'http://www.google.com/talk/protocol/auth' | ||||
|     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 | ||||
|     service_attr= '{%s}service' % namespace | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class NoSave(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'google:nosave' | ||||
|     plugin_attrib = 'google_nosave' | ||||
|     interfaces = set(['value']) | ||||
|     interfaces = {'value'} | ||||
|  | ||||
|     def get_value(self): | ||||
|         return self._get_attr('value', '') == 'enabled' | ||||
| @@ -35,7 +35,7 @@ class Item(ElementBase): | ||||
|     namespace = 'google:nosave' | ||||
|     plugin_attrib = 'item' | ||||
|     plugin_multi_attrib = 'items' | ||||
|     interfaces = set(['jid', 'source', 'value']) | ||||
|     interfaces = {'jid', 'source', 'value'} | ||||
|  | ||||
|     def get_value(self): | ||||
|         return self._get_attr('value', '') == 'enabled' | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0004(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0004' | ||||
|     description = 'XEP-0004: Data Forms' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -14,21 +14,21 @@ class FormField(ElementBase): | ||||
|     name = 'field' | ||||
|     plugin_attrib = 'field' | ||||
|     plugin_multi_attrib = 'fields' | ||||
|     interfaces = set(('answer', 'desc', 'required', 'value', | ||||
|                       'label', 'type', 'var')) | ||||
|     sub_interfaces = set(('desc',)) | ||||
|     interfaces = {'answer', 'desc', 'required', 'value', | ||||
|                   'label', 'type', 'var'} | ||||
|     sub_interfaces = {'desc'} | ||||
|     plugin_tag_map = {} | ||||
|     plugin_attrib_map = {} | ||||
|  | ||||
|     field_types = set(('boolean', 'fixed', 'hidden', 'jid-multi', | ||||
|                        'jid-single', 'list-multi', 'list-single', | ||||
|                        'text-multi', 'text-private', 'text-single')) | ||||
|     field_types = {'boolean', 'fixed', 'hidden', 'jid-multi', | ||||
|                    'jid-single', 'list-multi', 'list-single', | ||||
|                    'text-multi', 'text-private', 'text-single'} | ||||
|  | ||||
|     true_values = set((True, '1', 'true')) | ||||
|     option_types = set(('list-multi', 'list-single')) | ||||
|     multi_line_types = set(('hidden', 'text-multi')) | ||||
|     multi_value_types = set(('hidden', 'jid-multi', | ||||
|                              'list-multi', 'text-multi')) | ||||
|     true_values = {True, '1', 'true'} | ||||
|     option_types = {'list-multi', 'list-single'} | ||||
|     multi_line_types = {'hidden', 'text-multi'} | ||||
|     multi_value_types = {'hidden', 'jid-multi', | ||||
|                          'list-multi', 'text-multi'} | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
|         if ElementBase.setup(self, xml): | ||||
| @@ -164,8 +164,8 @@ class FieldOption(ElementBase): | ||||
|     namespace = 'jabber:x:data' | ||||
|     name = 'option' | ||||
|     plugin_attrib = 'option' | ||||
|     interfaces = set(('label', 'value')) | ||||
|     sub_interfaces = set(('value',)) | ||||
|     interfaces = {'label', 'value'} | ||||
|     sub_interfaces = {'value'} | ||||
|     plugin_multi_attrib = 'options' | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -24,8 +24,8 @@ class Form(ElementBase): | ||||
|     name = 'x' | ||||
|     plugin_attrib = 'form' | ||||
|     interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', )) | ||||
|     sub_interfaces = set(('title',)) | ||||
|     form_types = set(('cancel', 'form', 'result', 'submit')) | ||||
|     sub_interfaces = {'title'} | ||||
|     form_types = {'cancel', 'form', 'result', 'submit'} | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         title = None | ||||
|   | ||||
| @@ -92,13 +92,13 @@ def _py2xml(*args): | ||||
| def xml2py(params): | ||||
|     namespace = 'jabber:iq:rpc' | ||||
|     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))) | ||||
|     return vals | ||||
|  | ||||
| def _xml2py(value): | ||||
|     namespace = 'jabber:iq:rpc' | ||||
|     find_value = value.xml.find | ||||
|     find_value = value.find | ||||
|     if find_value('{%s}nil' % namespace) is not None: | ||||
|         return None | ||||
|     if find_value('{%s}i4' % namespace) is not None: | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class XEP_0009(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0009' | ||||
|     description = 'XEP-0009: Jabber-RPC' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
| @@ -121,7 +121,7 @@ class XEP_0009(BasePlugin): | ||||
|     def _recipient_unvailable(self, iq): | ||||
|         payload = iq.get_payload() | ||||
|         iq = iq.reply() | ||||
|         error().set_payload(payload) | ||||
|         iq.error().set_payload(payload) | ||||
|         iq['error']['code'] = '404' | ||||
|         iq['error']['type'] = 'wait' | ||||
|         iq['error']['condition'] = 'recipient-unavailable' | ||||
|   | ||||
| @@ -14,8 +14,8 @@ class RPCQuery(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'jabber:iq:rpc' | ||||
|     plugin_attrib = 'rpc_query' | ||||
|     interfaces = set(()) | ||||
|     subinterfaces = set(()) | ||||
|     interfaces = {} | ||||
|     subinterfaces = {} | ||||
|     plugin_attrib_map = {} | ||||
|     plugin_tag_map = {} | ||||
|  | ||||
| @@ -24,8 +24,8 @@ class MethodCall(ElementBase): | ||||
|     name = 'methodCall' | ||||
|     namespace = 'jabber:iq:rpc' | ||||
|     plugin_attrib = 'method_call' | ||||
|     interfaces = set(('method_name', 'params')) | ||||
|     subinterfaces = set(()) | ||||
|     interfaces = {'method_name', 'params'} | ||||
|     subinterfaces = {} | ||||
|     plugin_attrib_map = {} | ||||
|     plugin_tag_map = {} | ||||
|  | ||||
| @@ -46,8 +46,8 @@ class MethodResponse(ElementBase): | ||||
|     name = 'methodResponse' | ||||
|     namespace = 'jabber:iq:rpc' | ||||
|     plugin_attrib = 'method_response' | ||||
|     interfaces = set(('params', 'fault')) | ||||
|     subinterfaces = set(()) | ||||
|     interfaces = {'params', 'fault'} | ||||
|     subinterfaces = {} | ||||
|     plugin_attrib_map = {} | ||||
|     plugin_tag_map = {} | ||||
|  | ||||
|   | ||||
| @@ -29,7 +29,7 @@ class XEP_0012(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0012' | ||||
|     description = 'XEP-0012: Last Activity' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class LastActivity(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'jabber:iq:last' | ||||
|     plugin_attrib = 'last_activity' | ||||
|     interfaces = set(('seconds', 'status')) | ||||
|     interfaces = {'seconds', 'status'} | ||||
|  | ||||
|     def get_seconds(self): | ||||
|         return int(self._get_attr('seconds')) | ||||
|   | ||||
| @@ -29,7 +29,7 @@ class XEP_0013(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0013' | ||||
|     description = 'XEP-0013: Flexible Offline Message Retrieval' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class Offline(ElementBase): | ||||
|     name = 'offline' | ||||
|     namespace = 'http://jabber.org/protocol/offline' | ||||
|     plugin_attrib = 'offline' | ||||
|     interfaces = set(['fetch', 'purge', 'results']) | ||||
|     interfaces = {'fetch', 'purge', 'results'} | ||||
|     bool_interfaces = interfaces | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
| @@ -39,9 +39,9 @@ class Item(ElementBase): | ||||
|     name = 'item' | ||||
|     namespace = 'http://jabber.org/protocol/offline' | ||||
|     plugin_attrib = 'item' | ||||
|     interfaces = set(['action', 'node', 'jid']) | ||||
|     interfaces = {'action', 'node', 'jid'} | ||||
|  | ||||
|     actions = set(['view', 'remove']) | ||||
|     actions = {'view', 'remove'} | ||||
|  | ||||
|     def get_jid(self): | ||||
|         return JID(self._get_attr('jid')) | ||||
|   | ||||
| @@ -17,7 +17,7 @@ class XEP_0016(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0016' | ||||
|     description = 'XEP-0016: Privacy Lists' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -18,14 +18,14 @@ class Active(ElementBase): | ||||
|     name = 'active' | ||||
|     namespace = 'jabber:iq:privacy' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(['name']) | ||||
|     interfaces = {'name'} | ||||
|  | ||||
|  | ||||
| class Default(ElementBase): | ||||
|     name = 'default' | ||||
|     namespace = 'jabber:iq:privacy' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(['name']) | ||||
|     interfaces = {'name'} | ||||
|  | ||||
|  | ||||
| class List(ElementBase): | ||||
| @@ -33,7 +33,7 @@ class List(ElementBase): | ||||
|     namespace = 'jabber:iq:privacy' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'lists' | ||||
|     interfaces = set(['name']) | ||||
|     interfaces = {'name'} | ||||
|  | ||||
|     def add_item(self, value, action, order, itype=None, iq=False, | ||||
|                  message=False, presence_in=False, presence_out=False): | ||||
| @@ -55,9 +55,9 @@ class Item(ElementBase): | ||||
|     namespace = 'jabber:iq:privacy' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'items' | ||||
|     interfaces = set(['type', 'value', 'action', 'order', 'iq', | ||||
|                       'message', 'presence_in', 'presence_out']) | ||||
|     bool_interfaces = set(['message', 'iq', 'presence_in', 'presence_out']) | ||||
|     interfaces = {'type', 'value', 'action', 'order', 'iq', | ||||
|                   'message', 'presence_in', 'presence_out'} | ||||
|     bool_interfaces = {'message', 'iq', 'presence_in', 'presence_out'} | ||||
|  | ||||
|     type_values = ('', 'jid', 'group', 'subscription') | ||||
|     action_values = ('allow', 'deny') | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class XEP_0020(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0020' | ||||
|     description = 'XEP-0020: Feature Negotiation' | ||||
|     dependencies = set(['xep_0004', 'xep_0030']) | ||||
|     dependencies = {'xep_0004', 'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -13,7 +13,7 @@ class Signed(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'jabber:x:signed' | ||||
|     plugin_attrib = 'signed' | ||||
|     interfaces = set(['signed']) | ||||
|     interfaces = {'signed'} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_signed(self, value): | ||||
| @@ -33,7 +33,7 @@ class Encrypted(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'jabber:x:encrypted' | ||||
|     plugin_attrib = 'encrypted' | ||||
|     interfaces = set(['encrypted']) | ||||
|     interfaces = {'encrypted'} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_encrypted(self, value): | ||||
|   | ||||
| @@ -71,8 +71,8 @@ class DiscoInfo(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'http://jabber.org/protocol/disco#info' | ||||
|     plugin_attrib = 'disco_info' | ||||
|     interfaces = set(('node', 'features', 'identities')) | ||||
|     lang_interfaces = set(('identities',)) | ||||
|     interfaces = {'node', 'features', 'identities'} | ||||
|     lang_interfaces = {'identities'} | ||||
|  | ||||
|     # Cache identities and features | ||||
|     _identities = set() | ||||
| @@ -91,7 +91,7 @@ class DiscoInfo(ElementBase): | ||||
|         """ | ||||
|         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'] | ||||
|  | ||||
|     def add_identity(self, category, itype, name=None, lang=None): | ||||
|   | ||||
| @@ -45,7 +45,7 @@ class DiscoItems(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'http://jabber.org/protocol/disco#items' | ||||
|     plugin_attrib = 'disco_items' | ||||
|     interfaces = set(('node', 'items')) | ||||
|     interfaces = {'node', 'items'} | ||||
|  | ||||
|     # Cache items | ||||
|     _items = set() | ||||
| @@ -62,7 +62,7 @@ class DiscoItems(ElementBase): | ||||
|             xml -- Use an existing XML object for the stanza's values. | ||||
|         """ | ||||
|         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): | ||||
|         """ | ||||
| @@ -138,7 +138,7 @@ class DiscoItem(ElementBase): | ||||
|     name = 'item' | ||||
|     namespace = 'http://jabber.org/protocol/disco#items' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('jid', 'node', 'name')) | ||||
|     interfaces = {'jid', 'node', 'name'} | ||||
|  | ||||
|     def get_node(self): | ||||
|         """Return the item's node name or ``None``.""" | ||||
|   | ||||
| @@ -22,7 +22,7 @@ class XEP_0033(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0033' | ||||
|     description = 'XEP-0033: Extended Stanza Addressing' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -37,9 +37,9 @@ class Address(ElementBase): | ||||
|     name = 'address' | ||||
|     namespace = 'http://jabber.org/protocol/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): | ||||
|         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, "del_%s" % atype, del_multi) | ||||
|  | ||||
|     # To retain backwards compatibility: | ||||
|     if atype == 'all': | ||||
|         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) | ||||
|   | ||||
| @@ -25,9 +25,9 @@ class MUCPresence(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'http://jabber.org/protocol/muc#user' | ||||
|     plugin_attrib = 'muc' | ||||
|     interfaces = set(('affiliation', 'role', 'jid', 'nick', 'room')) | ||||
|     affiliations = set(('', )) | ||||
|     roles = set(('', )) | ||||
|     interfaces = {'affiliation', 'role', 'jid', 'nick', 'room'} | ||||
|     affiliations = {'', } | ||||
|     roles = {'', } | ||||
|  | ||||
|     def get_xml_item(self): | ||||
|         item = self.xml.find('{http://jabber.org/protocol/muc#user}item') | ||||
| @@ -117,7 +117,7 @@ class XEP_0045(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0045' | ||||
|     description = 'XEP-0045: Multi-User Chat' | ||||
|     dependencies = set(['xep_0030', 'xep_0004']) | ||||
|     dependencies = {'xep_0030', 'xep_0004'} | ||||
|  | ||||
|     def plugin_init(self): | ||||
|         self.rooms = {} | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class XEP_0047(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0047' | ||||
|     description = 'XEP-0047: In-band Bytestreams' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'block_size': 4096, | ||||
|   | ||||
| @@ -21,7 +21,7 @@ class Open(ElementBase): | ||||
|     name = 'open' | ||||
|     namespace = 'http://jabber.org/protocol/ibb' | ||||
|     plugin_attrib = 'ibb_open' | ||||
|     interfaces = set(('block_size', 'sid', 'stanza')) | ||||
|     interfaces = {'block_size', 'sid', 'stanza'} | ||||
|  | ||||
|     def get_block_size(self): | ||||
|         return int(self._get_attr('block-size', '0')) | ||||
| @@ -37,8 +37,8 @@ class Data(ElementBase): | ||||
|     name = 'data' | ||||
|     namespace = 'http://jabber.org/protocol/ibb' | ||||
|     plugin_attrib = 'ibb_data' | ||||
|     interfaces = set(('seq', 'sid', 'data')) | ||||
|     sub_interfaces = set(['data']) | ||||
|     interfaces = {'seq', 'sid', 'data'} | ||||
|     sub_interfaces = {'data'} | ||||
|  | ||||
|     def get_seq(self): | ||||
|         return int(self._get_attr('seq', '0')) | ||||
| @@ -67,4 +67,4 @@ class Close(ElementBase): | ||||
|     name = 'close' | ||||
|     namespace = 'http://jabber.org/protocol/ibb' | ||||
|     plugin_attrib = 'ibb_close' | ||||
|     interfaces = set(['sid']) | ||||
|     interfaces = {'sid'} | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class XEP_0048(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0048' | ||||
|     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 | ||||
|     default_config = { | ||||
|         'auto_join': False, | ||||
|   | ||||
| @@ -40,8 +40,8 @@ class Conference(ElementBase): | ||||
|     namespace = 'storage:bookmarks' | ||||
|     plugin_attrib = 'conference' | ||||
|     plugin_multi_attrib = 'conferences' | ||||
|     interfaces = set(['nick', 'password', 'autojoin', 'jid', 'name']) | ||||
|     sub_interfaces = set(['nick', 'password']) | ||||
|     interfaces = {'nick', 'password', 'autojoin', 'jid', 'name'} | ||||
|     sub_interfaces = {'nick', 'password'} | ||||
|  | ||||
|     def get_autojoin(self): | ||||
|         value = self._get_attr('autojoin') | ||||
| @@ -58,7 +58,7 @@ class URL(ElementBase): | ||||
|     namespace = 'storage:bookmarks' | ||||
|     plugin_attrib = 'url' | ||||
|     plugin_multi_attrib = 'urls' | ||||
|     interfaces = set(['url', 'name']) | ||||
|     interfaces = {'url', 'name'} | ||||
|  | ||||
|  | ||||
| register_stanza_plugin(Bookmarks, Conference, iterable=True) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0049(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0049' | ||||
|     description = 'XEP-0049: Private XML Storage' | ||||
|     dependencies = set([]) | ||||
|     dependencies = {} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -74,7 +74,7 @@ class XEP_0050(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0050' | ||||
|     description = 'XEP-0050: Ad-Hoc Commands' | ||||
|     dependencies = set(['xep_0030', 'xep_0004']) | ||||
|     dependencies = {'xep_0030', 'xep_0004'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'session_db': None | ||||
| @@ -225,8 +225,8 @@ class XEP_0050(BasePlugin): | ||||
|         if len(payload) == 1: | ||||
|             payload = payload[0] | ||||
|  | ||||
|         interfaces = set([item.plugin_attrib for item in payload]) | ||||
|         payload_classes = set([item.__class__ for item in payload]) | ||||
|         interfaces = {item.plugin_attrib for item in payload} | ||||
|         payload_classes = {item.__class__ for item in payload} | ||||
|  | ||||
|         initial_session = {'id': sessionid, | ||||
|                            'from': iq['from'], | ||||
| @@ -322,8 +322,8 @@ class XEP_0050(BasePlugin): | ||||
|         interfaces = session.get('interfaces', set()) | ||||
|         payload_classes = session.get('payload_classes', set()) | ||||
|  | ||||
|         interfaces.update(set([item.plugin_attrib for item in payload])) | ||||
|         payload_classes.update(set([item.__class__ for item in payload])) | ||||
|         interfaces.update({item.plugin_attrib for item in payload}) | ||||
|         payload_classes.update({item.__class__ for item in payload}) | ||||
|  | ||||
|         session['interfaces'] = interfaces | ||||
|         session['payload_classes'] = payload_classes | ||||
|   | ||||
| @@ -72,11 +72,11 @@ class Command(ElementBase): | ||||
|     name = 'command' | ||||
|     namespace = 'http://jabber.org/protocol/commands' | ||||
|     plugin_attrib = 'command' | ||||
|     interfaces = set(('action', 'sessionid', 'node', | ||||
|                       'status', 'actions', 'notes')) | ||||
|     actions = set(('cancel', 'complete', 'execute', 'next', 'prev')) | ||||
|     statuses = set(('canceled', 'completed', 'executing')) | ||||
|     next_actions = set(('prev', 'next', 'complete')) | ||||
|     interfaces = {'action', 'sessionid', 'node', | ||||
|                   'status', 'actions', 'notes'} | ||||
|     actions = {'cancel', 'complete', 'execute', 'next', 'prev'} | ||||
|     statuses = {'canceled', 'completed', 'executing'} | ||||
|     next_actions = {'prev', 'next', 'complete'} | ||||
|  | ||||
|     def get_action(self): | ||||
|         """ | ||||
|   | ||||
| @@ -10,15 +10,15 @@ class VCardTemp(ElementBase): | ||||
|     name = 'vCard' | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = 'vcard_temp' | ||||
|     interfaces = set(['FN', 'VERSION']) | ||||
|     sub_interfaces = set(['FN', 'VERSION']) | ||||
|     interfaces = {'FN', 'VERSION'} | ||||
|     sub_interfaces = {'FN', 'VERSION'} | ||||
|  | ||||
|  | ||||
| class Name(ElementBase): | ||||
|     name = 'N' | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(['FAMILY', 'GIVEN', 'MIDDLE', 'PREFIX', 'SUFFIX']) | ||||
|     interfaces = {'FAMILY', 'GIVEN', 'MIDDLE', 'PREFIX', 'SUFFIX'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|     def _set_component(self, name, value): | ||||
| @@ -72,7 +72,7 @@ class Nickname(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'nicknames' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_nickname(self, value): | ||||
| @@ -95,9 +95,9 @@ class Email(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'emails' | ||||
|     interfaces = set(['HOME', 'WORK', 'INTERNET', 'PREF', 'X400', 'USERID']) | ||||
|     sub_interfaces = set(['USERID']) | ||||
|     bool_interfaces = set(['HOME', 'WORK', 'INTERNET', 'PREF', 'X400']) | ||||
|     interfaces = {'HOME', 'WORK', 'INTERNET', 'PREF', 'X400', 'USERID'} | ||||
|     sub_interfaces = {'USERID'} | ||||
|     bool_interfaces = {'HOME', 'WORK', 'INTERNET', 'PREF', 'X400'} | ||||
|  | ||||
|  | ||||
| class Address(ElementBase): | ||||
| @@ -105,12 +105,12 @@ class Address(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'addresses' | ||||
|     interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', | ||||
|                       'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', | ||||
|                       'REGION', 'PCODE', 'CTRY']) | ||||
|     sub_interfaces = set(['POBOX', 'EXTADD', 'STREET', 'LOCALITY', | ||||
|                           'REGION', 'PCODE', 'CTRY']) | ||||
|     bool_interfaces = set(['HOME', 'WORK', 'DOM', 'INTL', 'PREF']) | ||||
|     interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', | ||||
|                   'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', | ||||
|                   'REGION', 'PCODE', 'CTRY'} | ||||
|     sub_interfaces = {'POBOX', 'EXTADD', 'STREET', 'LOCALITY', | ||||
|                       'REGION', 'PCODE', 'CTRY'} | ||||
|     bool_interfaces = {'HOME', 'WORK', 'DOM', 'INTL', 'PREF'} | ||||
|  | ||||
|  | ||||
| class Telephone(ElementBase): | ||||
| @@ -118,13 +118,13 @@ class Telephone(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'telephone_numbers' | ||||
|     interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', | ||||
|                       'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', | ||||
|                       'PREF', 'NUMBER']) | ||||
|     sub_interfaces = set(['NUMBER']) | ||||
|     bool_interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', | ||||
|                            'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', | ||||
|                            'ISDN', 'PCS', 'PREF']) | ||||
|     interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', | ||||
|                   'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', | ||||
|                   'PREF', 'NUMBER'} | ||||
|     sub_interfaces = {'NUMBER'} | ||||
|     bool_interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', | ||||
|                        'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', | ||||
|                        'ISDN', 'PCS', 'PREF'} | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
|         super().setup(xml=xml) | ||||
| @@ -143,10 +143,10 @@ class Label(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'labels' | ||||
|     interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', | ||||
|                       'PREF', 'lines']) | ||||
|     bool_interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', | ||||
|                            'INT', 'PREF']) | ||||
|     interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', | ||||
|                   'PREF', 'lines'} | ||||
|     bool_interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', | ||||
|                        'INT', 'PREF'} | ||||
|  | ||||
|     def add_line(self, value): | ||||
|         line = ET.Element('{%s}LINE' % self.namespace) | ||||
| @@ -177,7 +177,7 @@ class Geo(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'geolocations' | ||||
|     interfaces = set(['LAT', 'LON']) | ||||
|     interfaces = {'LAT', 'LON'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -186,8 +186,8 @@ class Org(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'organizations' | ||||
|     interfaces = set(['ORGNAME', 'ORGUNIT', 'orgunits']) | ||||
|     sub_interfaces = set(['ORGNAME', 'ORGUNIT']) | ||||
|     interfaces = {'ORGNAME', 'ORGUNIT', 'orgunits'} | ||||
|     sub_interfaces = {'ORGNAME', 'ORGUNIT'} | ||||
|  | ||||
|     def add_orgunit(self, value): | ||||
|         orgunit = ET.Element('{%s}ORGUNIT' % self.namespace) | ||||
| @@ -218,7 +218,7 @@ class Photo(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'photos' | ||||
|     interfaces = set(['TYPE', 'EXTVAL']) | ||||
|     interfaces = {'TYPE', 'EXTVAL'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -227,7 +227,7 @@ class Logo(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'logos' | ||||
|     interfaces = set(['TYPE', 'EXTVAL']) | ||||
|     interfaces = {'TYPE', 'EXTVAL'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -236,7 +236,7 @@ class Sound(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'sounds' | ||||
|     interfaces = set(['PHONETC', 'EXTVAL']) | ||||
|     interfaces = {'PHONETC', 'EXTVAL'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -244,7 +244,7 @@ class BinVal(ElementBase): | ||||
|     name = 'BINVAL' | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(['BINVAL']) | ||||
|     interfaces = {'BINVAL'} | ||||
|     is_extension = True | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
| @@ -275,7 +275,7 @@ class Classification(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'classifications' | ||||
|     interfaces = set(['PUBLIC', 'PRIVATE', 'CONFIDENTIAL']) | ||||
|     interfaces = {'PUBLIC', 'PRIVATE', 'CONFIDENTIAL'} | ||||
|     bool_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -284,7 +284,7 @@ class Categories(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'categories' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_categories(self, values): | ||||
| @@ -314,7 +314,7 @@ class Birthday(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'birthdays' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_bday(self, value): | ||||
| @@ -336,7 +336,7 @@ class Rev(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'revision_dates' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_rev(self, value): | ||||
| @@ -358,7 +358,7 @@ class Title(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'titles' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_title(self, value): | ||||
| @@ -373,7 +373,7 @@ class Role(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'roles' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_role(self, value): | ||||
| @@ -388,7 +388,7 @@ class Note(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'notes' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_note(self, value): | ||||
| @@ -403,7 +403,7 @@ class Desc(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'descriptions' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_desc(self, value): | ||||
| @@ -418,7 +418,7 @@ class URL(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'urls' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_url(self, value): | ||||
| @@ -433,7 +433,7 @@ class UID(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'uids' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_uid(self, value): | ||||
| @@ -448,7 +448,7 @@ class ProdID(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'product_ids' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_prodid(self, value): | ||||
| @@ -463,7 +463,7 @@ class Mailer(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'mailers' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_mailer(self, value): | ||||
| @@ -478,7 +478,7 @@ class SortString(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = 'SORT_STRING' | ||||
|     plugin_multi_attrib = 'sort_strings' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_sort_string(self, value): | ||||
| @@ -493,7 +493,7 @@ class Agent(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'agents' | ||||
|     interfaces = set(['EXTVAL']) | ||||
|     interfaces = {'EXTVAL'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|  | ||||
| @@ -502,7 +502,7 @@ class JabberID(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'jids' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_jabberid(self, value): | ||||
| @@ -517,7 +517,7 @@ class TimeZone(ElementBase): | ||||
|     namespace = 'vcard-temp' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'timezones' | ||||
|     interfaces = set([name]) | ||||
|     interfaces = {name} | ||||
|     is_extension = True | ||||
|  | ||||
|     def set_tz(self, value): | ||||
|   | ||||
| @@ -29,7 +29,7 @@ class XEP_0054(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0054' | ||||
|     description = 'XEP-0054: vcard-temp' | ||||
|     dependencies = set(['xep_0030', 'xep_0082']) | ||||
|     dependencies = {'xep_0030', 'xep_0082'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -111,7 +111,7 @@ class XEP_0059(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0059' | ||||
|     description = 'XEP-0059: Result Set Management' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -64,10 +64,10 @@ class Set(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/rsm' | ||||
|     name = 'set' | ||||
|     plugin_attrib = 'rsm' | ||||
|     sub_interfaces = set(('first', 'after', 'before', 'count', | ||||
|                           'index', 'last', 'max')) | ||||
|     interfaces = set(('first_index', 'first', 'after', 'before', | ||||
|                       'count', 'index', 'last', 'max')) | ||||
|     sub_interfaces = {'first', 'after', 'before', 'count', | ||||
|                       'index', 'last', 'max'} | ||||
|     interfaces = {'first_index', 'first', 'after', 'before', | ||||
|                   'count', 'index', 'last', 'max'} | ||||
|  | ||||
|     def set_first_index(self, val): | ||||
|         fi = self.xml.find("{%s}first" % (self.namespace)) | ||||
|   | ||||
| @@ -26,7 +26,7 @@ class XEP_0060(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0060' | ||||
|     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 | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -11,7 +11,7 @@ from slixmpp.xmlstream import ET | ||||
|  | ||||
| class OptionalSetting(object): | ||||
|  | ||||
|     interfaces = set(('required',)) | ||||
|     interfaces = {'required'} | ||||
|  | ||||
|     def set_required(self, value): | ||||
|         if value in (True, 'true', 'True', '1'): | ||||
|   | ||||
| @@ -23,14 +23,14 @@ class Affiliations(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'affiliations' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class Affiliation(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'affiliation' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'affiliation', 'jid')) | ||||
|     interfaces = {'node', 'affiliation', 'jid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
| @@ -43,7 +43,7 @@ class Subscription(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'subscription' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('jid', 'node', 'subscription', 'subid')) | ||||
|     interfaces = {'jid', 'node', 'subscription', 'subid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
| @@ -56,21 +56,21 @@ class Subscriptions(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'subscriptions' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class SubscribeOptions(ElementBase, OptionalSetting): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'subscribe-options' | ||||
|     plugin_attrib = 'suboptions' | ||||
|     interfaces = set(('required',)) | ||||
|     interfaces = {'required'} | ||||
|  | ||||
|  | ||||
| class Item(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'item' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('id', 'payload')) | ||||
|     interfaces = {'id', 'payload'} | ||||
|  | ||||
|     def set_payload(self, value): | ||||
|         del self['payload'] | ||||
| @@ -95,7 +95,7 @@ class Items(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'items' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'max_items')) | ||||
|     interfaces = {'node', 'max_items'} | ||||
|  | ||||
|     def set_max_items(self, value): | ||||
|         self._set_attr('max_items', str(value)) | ||||
| @@ -105,14 +105,14 @@ class Create(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'create' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class Default(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'default' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'type')) | ||||
|     interfaces = {'node', 'type'} | ||||
|  | ||||
|     def get_type(self): | ||||
|         t = self._get_attr('type') | ||||
| @@ -125,14 +125,14 @@ class Publish(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'publish' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class Retract(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'retract' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'notify')) | ||||
|     interfaces = {'node', 'notify'} | ||||
|  | ||||
|     def get_notify(self): | ||||
|         notify = self._get_attr('notify') | ||||
| @@ -156,7 +156,7 @@ class Unsubscribe(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'unsubscribe' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'jid', 'subid')) | ||||
|     interfaces = {'node', 'jid', 'subid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
| @@ -169,7 +169,7 @@ class Subscribe(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'subscribe' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'jid')) | ||||
|     interfaces = {'node', 'jid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
| @@ -182,7 +182,7 @@ class Configure(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'configure' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'type')) | ||||
|     interfaces = {'node', 'type'} | ||||
|  | ||||
|     def getType(self): | ||||
|         t = self._get_attr('type') | ||||
| @@ -195,7 +195,7 @@ class Options(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'options' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('jid', 'node', 'options')) | ||||
|     interfaces = {'jid', 'node', 'options'} | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         ElementBase.__init__(self, *args, **kwargs) | ||||
| @@ -206,7 +206,10 @@ class Options(ElementBase): | ||||
|         return form | ||||
|  | ||||
|     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 | ||||
|  | ||||
|     def del_options(self): | ||||
| @@ -224,7 +227,7 @@ class PublishOptions(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub' | ||||
|     name = 'publish-options' | ||||
|     plugin_attrib = 'publish_options' | ||||
|     interfaces = set(('publish_options',)) | ||||
|     interfaces = {'publish_options'} | ||||
|     is_extension = True | ||||
|  | ||||
|     def get_publish_options(self): | ||||
| @@ -238,7 +241,10 @@ class PublishOptions(ElementBase): | ||||
|         if value is None: | ||||
|             self.del_publish_options() | ||||
|         else: | ||||
|             self.xml.append(value) | ||||
|             if isinstance(value, ElementBase): | ||||
|                 self.xml.append(value.xml) | ||||
|             else: | ||||
|                 self.xml.append(value) | ||||
|         return self | ||||
|  | ||||
|     def del_publish_options(self): | ||||
|   | ||||
| @@ -13,18 +13,18 @@ from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin | ||||
| class PubsubErrorCondition(ElementBase): | ||||
|  | ||||
|     plugin_attrib = 'pubsub' | ||||
|     interfaces = set(('condition', 'unsupported')) | ||||
|     interfaces = {'condition', 'unsupported'} | ||||
|     plugin_attrib_map = {} | ||||
|     plugin_tag_map = {} | ||||
|     conditions = set(('closed-node', 'configuration-required', 'invalid-jid', | ||||
|                       'invalid-options', 'invalid-payload', 'invalid-subid', | ||||
|                       'item-forbidden', 'item-required', 'jid-required', | ||||
|                       'max-items-exceeded', 'max-nodes-exceeded', | ||||
|                       'nodeid-required', 'not-in-roster-group', | ||||
|                       'not-subscribed', 'payload-too-big', | ||||
|                       'payload-required', 'pending-subscription', | ||||
|                       'presence-subscription-required', 'subid-required', | ||||
|                       'too-many-subscriptions', 'unsupported')) | ||||
|     conditions = {'closed-node', 'configuration-required', 'invalid-jid', | ||||
|                   'invalid-options', 'invalid-payload', 'invalid-subid', | ||||
|                   'item-forbidden', 'item-required', 'jid-required', | ||||
|                   'max-items-exceeded', 'max-nodes-exceeded', | ||||
|                   'nodeid-required', 'not-in-roster-group', | ||||
|                   'not-subscribed', 'payload-too-big', | ||||
|                   'payload-required', 'pending-subscription', | ||||
|                   'presence-subscription-required', 'subid-required', | ||||
|                   'too-many-subscriptions', 'unsupported'} | ||||
|     condition_ns = 'http://jabber.org/protocol/pubsub#errors' | ||||
|  | ||||
|     def setup(self, xml): | ||||
|   | ||||
| @@ -25,7 +25,7 @@ class EventItem(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'item' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('id', 'payload', 'node', 'publisher')) | ||||
|     interfaces = {'id', 'payload', 'node', 'publisher'} | ||||
|  | ||||
|     def set_payload(self, value): | ||||
|         self.xml.append(value) | ||||
| @@ -44,56 +44,56 @@ class EventRetract(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'retract' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('id',)) | ||||
|     interfaces = {'id'} | ||||
|  | ||||
|  | ||||
| class EventItems(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'items' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventCollection(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'collection' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventAssociate(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'associate' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventDisassociate(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'disassociate' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventConfiguration(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'configuration' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventPurge(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'purge' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class EventDelete(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'delete' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'redirect')) | ||||
|     interfaces = {'node', 'redirect'} | ||||
|  | ||||
|     def set_redirect(self, uri): | ||||
|         del self['redirect'] | ||||
| @@ -117,7 +117,7 @@ class EventSubscription(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#event' | ||||
|     name = 'subscription' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription')) | ||||
|     interfaces = {'node', 'expiry', 'jid', 'subid', 'subscription'} | ||||
|  | ||||
|     def get_expiry(self): | ||||
|         expiry = self._get_attr('expiry') | ||||
|   | ||||
| @@ -25,7 +25,7 @@ class DefaultConfig(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'default' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'config')) | ||||
|     interfaces = {'node', 'config'} | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         ElementBase.__init__(self, *args, **kwargs) | ||||
| @@ -41,7 +41,7 @@ class DefaultConfig(ElementBase): | ||||
|  | ||||
| class OwnerAffiliations(Affiliations): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|     def append(self, affiliation): | ||||
|         if not isinstance(affiliation, OwnerAffiliation): | ||||
| @@ -51,40 +51,40 @@ class OwnerAffiliations(Affiliations): | ||||
|  | ||||
| class OwnerAffiliation(Affiliation): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     interfaces = set(('affiliation', 'jid')) | ||||
|     interfaces = {'affiliation', 'jid'} | ||||
|  | ||||
|  | ||||
| class OwnerConfigure(Configure): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'configure' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class OwnerDefault(OwnerConfigure): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class OwnerDelete(ElementBase, OptionalSetting): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'delete' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class OwnerPurge(ElementBase, OptionalSetting): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'purge' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|  | ||||
| class OwnerRedirect(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'redirect' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node', 'jid')) | ||||
|     interfaces = {'node', 'jid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
| @@ -97,7 +97,7 @@ class OwnerSubscriptions(Subscriptions): | ||||
|     name = 'subscriptions' | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('node',)) | ||||
|     interfaces = {'node'} | ||||
|  | ||||
|     def append(self, subscription): | ||||
|         if not isinstance(subscription, OwnerSubscription): | ||||
| @@ -109,7 +109,7 @@ class OwnerSubscription(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/pubsub#owner' | ||||
|     name = 'subscription' | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('jid', 'subscription')) | ||||
|     interfaces = {'jid', 'subscription'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         self._set_attr('jid', str(value)) | ||||
|   | ||||
| @@ -22,7 +22,7 @@ class XEP_0065(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0065' | ||||
|     description = "XEP-0065: SOCKS5 Bytestreams" | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     default_config = { | ||||
|         'auto_accept': False | ||||
|     } | ||||
|   | ||||
| @@ -6,8 +6,8 @@ class Socks5(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'http://jabber.org/protocol/bytestreams' | ||||
|     plugin_attrib = 'socks' | ||||
|     interfaces = set(['sid', 'activate']) | ||||
|     sub_interfaces = set(['activate']) | ||||
|     interfaces = {'sid', 'activate'} | ||||
|     sub_interfaces = {'activate'} | ||||
|  | ||||
|     def add_streamhost(self, jid, host, port): | ||||
|         sh = StreamHost(parent=self) | ||||
| @@ -21,7 +21,7 @@ class StreamHost(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/bytestreams' | ||||
|     plugin_attrib = 'streamhost' | ||||
|     plugin_multi_attrib = 'streamhosts' | ||||
|     interfaces = set(['host', 'jid', 'port']) | ||||
|     interfaces = {'host', 'jid', 'port'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         return self._set_attr('jid', str(value)) | ||||
| @@ -34,7 +34,7 @@ class StreamHostUsed(ElementBase): | ||||
|     name = 'streamhost-used' | ||||
|     namespace = 'http://jabber.org/protocol/bytestreams' | ||||
|     plugin_attrib = 'streamhost_used' | ||||
|     interfaces = set(['jid']) | ||||
|     interfaces = {'jid'} | ||||
|  | ||||
|     def set_jid(self, value): | ||||
|         return self._set_attr('jid', str(value)) | ||||
|   | ||||
| @@ -44,7 +44,7 @@ class XEP_0066(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0066' | ||||
|     description = 'XEP-0066: Out of Band Data' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -17,8 +17,8 @@ class OOBTransfer(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'jabber:iq:oob' | ||||
|     plugin_attrib = 'oob_transfer' | ||||
|     interfaces = set(('url', 'desc', 'sid')) | ||||
|     sub_interfaces = set(('url', 'desc')) | ||||
|     interfaces = {'url', 'desc', 'sid'} | ||||
|     sub_interfaces = {'url', 'desc'} | ||||
|  | ||||
|  | ||||
| class OOB(ElementBase): | ||||
| @@ -29,5 +29,5 @@ class OOB(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'jabber:x:oob' | ||||
|     plugin_attrib = 'oob' | ||||
|     interfaces = set(('url', 'desc')) | ||||
|     interfaces = {'url', 'desc'} | ||||
|     sub_interfaces = interfaces | ||||
|   | ||||
| @@ -19,8 +19,8 @@ class XHTML_IM(ElementBase): | ||||
|  | ||||
|     namespace = 'http://jabber.org/protocol/xhtml-im' | ||||
|     name = 'html' | ||||
|     interfaces = set(['body']) | ||||
|     lang_interfaces = set(['body']) | ||||
|     interfaces = {'body'} | ||||
|     lang_interfaces = {'body'} | ||||
|     plugin_attrib = name | ||||
|  | ||||
|     def set_body(self, content, lang=None): | ||||
|   | ||||
| @@ -17,7 +17,7 @@ class XEP_0071(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0071' | ||||
|     description = 'XEP-0071: XHTML-IM' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -26,7 +26,7 @@ class XEP_0077(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0077' | ||||
|     description = 'XEP-0077: In-Band Registration' | ||||
|     dependencies = set(['xep_0004', 'xep_0066']) | ||||
|     dependencies = {'xep_0004', 'xep_0066'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'create_account': True, | ||||
|   | ||||
| @@ -16,14 +16,14 @@ class Register(ElementBase): | ||||
|     namespace = 'jabber:iq:register' | ||||
|     name = 'query' | ||||
|     plugin_attrib = 'register' | ||||
|     interfaces = set(('username', 'password', 'email', 'nick', 'name', | ||||
|                       'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                       'phone', 'url', 'date', 'misc', 'text', 'key', | ||||
|                       'registered', 'remove', 'instructions', 'fields')) | ||||
|     interfaces = {'username', 'password', 'email', 'nick', 'name', | ||||
|                   'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                   'phone', 'url', 'date', 'misc', 'text', 'key', | ||||
|                   'registered', 'remove', 'instructions', 'fields'} | ||||
|     sub_interfaces = interfaces | ||||
|     form_fields = set(('username', 'password', 'email', 'nick', 'name', | ||||
|                        'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                        'phone', 'url', 'date', 'misc', 'text', 'key')) | ||||
|     form_fields = {'username', 'password', 'email', 'nick', 'name', | ||||
|                    'first', 'last', 'address', 'city', 'state', 'zip', | ||||
|                    'phone', 'url', 'date', 'misc', 'text', 'key'} | ||||
|  | ||||
|     def get_registered(self): | ||||
|         present = self.xml.find('{%s}registered' % self.namespace) | ||||
|   | ||||
| @@ -13,8 +13,8 @@ class IqAuth(ElementBase): | ||||
|     namespace = 'jabber:iq:auth' | ||||
|     name = 'query' | ||||
|     plugin_attrib = 'auth' | ||||
|     interfaces = set(('fields', 'username', 'password', 'resource', 'digest')) | ||||
|     sub_interfaces = set(('username', 'password', 'resource', 'digest')) | ||||
|     interfaces = {'fields', 'username', 'password', 'resource', 'digest'} | ||||
|     sub_interfaces = {'username', 'password', 'resource', 'digest'} | ||||
|     plugin_tag_map = {} | ||||
|     plugin_attrib_map = {} | ||||
|  | ||||
|   | ||||
| @@ -27,7 +27,7 @@ class XEP_0079(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0079' | ||||
|     description = 'XEP-0079: Advanced Message Processing' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -8,6 +8,7 @@ | ||||
|  | ||||
| from __future__ import unicode_literals | ||||
|  | ||||
| from slixmpp import JID | ||||
| from slixmpp.xmlstream import ElementBase, register_stanza_plugin | ||||
|  | ||||
|  | ||||
| @@ -15,7 +16,7 @@ class AMP(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/amp' | ||||
|     name = 'amp' | ||||
|     plugin_attrib = 'amp' | ||||
|     interfaces = set(['from', 'to', 'status', 'per_hop']) | ||||
|     interfaces = {'from', 'to', 'status', 'per_hop'} | ||||
|  | ||||
|     def get_from(self): | ||||
|         return JID(self._get_attr('from')) | ||||
| @@ -53,7 +54,7 @@ class Rule(ElementBase): | ||||
|     name = 'rule' | ||||
|     plugin_attrib = name | ||||
|     plugin_multi_attrib = 'rules' | ||||
|     interfaces = set(['action', 'condition', 'value']) | ||||
|     interfaces = {'action', 'condition', 'value'} | ||||
|  | ||||
|  | ||||
| class InvalidRules(ElementBase): | ||||
|   | ||||
| @@ -25,7 +25,7 @@ class XEP_0080(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0080' | ||||
|     description = 'XEP-0080: User Location' | ||||
|     dependencies = set(['xep_0163']) | ||||
|     dependencies = {'xep_0163'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_end(self): | ||||
|   | ||||
| @@ -65,11 +65,11 @@ class Geoloc(ElementBase): | ||||
|  | ||||
|     namespace = 'http://jabber.org/protocol/geoloc' | ||||
|     name = 'geoloc' | ||||
|     interfaces = set(('accuracy', 'alt', 'area', 'bearing', 'building', | ||||
|                       'country', 'countrycode', 'datum', 'dscription', | ||||
|                       'error', 'floor', 'lat', 'locality', 'lon', | ||||
|                       'postalcode', 'region', 'room', 'speed', 'street', | ||||
|                       'text', 'timestamp', 'uri')) | ||||
|     interfaces = {'accuracy', 'alt', 'area', 'bearing', 'building', | ||||
|                   'country', 'countrycode', 'datum', 'dscription', | ||||
|                   'error', 'floor', 'lat', 'locality', 'lon', | ||||
|                   'postalcode', 'region', 'room', 'speed', 'street', | ||||
|                   'text', 'timestamp', 'uri'} | ||||
|     sub_interfaces = interfaces | ||||
|     plugin_attrib = name | ||||
|  | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class XEP_0084(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0084' | ||||
|     description = 'XEP-0084: User Avatar' | ||||
|     dependencies = set(['xep_0163', 'xep_0060']) | ||||
|     dependencies = {'xep_0163', 'xep_0060'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -16,7 +16,7 @@ class Data(ElementBase): | ||||
|     name = 'data' | ||||
|     namespace = 'urn:xmpp:avatar:data' | ||||
|     plugin_attrib = 'avatar_data' | ||||
|     interfaces = set(['value']) | ||||
|     interfaces = {'value'} | ||||
|  | ||||
|     def get_value(self): | ||||
|         if self.xml.text: | ||||
| @@ -63,7 +63,7 @@ class Info(ElementBase): | ||||
|     namespace = 'urn:xmpp:avatar:metadata' | ||||
|     plugin_attrib = 'info' | ||||
|     plugin_multi_attrib = 'items' | ||||
|     interfaces = set(['bytes', 'height', 'id', 'type', 'url', 'width']) | ||||
|     interfaces = {'bytes', 'height', 'id', 'type', 'url', 'width'} | ||||
|  | ||||
|  | ||||
| class Pointer(ElementBase): | ||||
|   | ||||
| @@ -28,7 +28,7 @@ class XEP_0085(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0085' | ||||
|     description = 'XEP-0085: Chat State Notifications' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -37,11 +37,11 @@ class ChatState(ElementBase): | ||||
|     name = '' | ||||
|     namespace = 'http://jabber.org/protocol/chatstates' | ||||
|     plugin_attrib = 'chat_state' | ||||
|     interfaces = set(('chat_state',)) | ||||
|     interfaces = {'chat_state'} | ||||
|     sub_interfaces = interfaces | ||||
|     is_extension = True | ||||
|  | ||||
|     states = set(('active', 'composing', 'gone', 'inactive', 'paused')) | ||||
|     states = {'active', 'composing', 'gone', 'inactive', 'paused'} | ||||
|  | ||||
|     def setup(self, xml=None): | ||||
|         self.xml = ET.Element('') | ||||
|   | ||||
| @@ -44,7 +44,7 @@ class LegacyError(ElementBase): | ||||
|     name = 'legacy' | ||||
|     namespace = Error.namespace | ||||
|     plugin_attrib = name | ||||
|     interfaces = set(('condition',)) | ||||
|     interfaces = {'condition'} | ||||
|     overrides = ['set_condition'] | ||||
|  | ||||
|     error_map = {'bad-request': ('modify', '400'), | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class LegacyDelay(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'jabber:x:delay' | ||||
|     plugin_attrib = 'legacy_delay' | ||||
|     interfaces = set(('from', 'stamp', 'text')) | ||||
|     interfaces = {'from', 'stamp', 'text'} | ||||
|  | ||||
|     def get_from(self): | ||||
|         from_ = self._get_attr('from') | ||||
|   | ||||
| @@ -38,5 +38,5 @@ class Version(ElementBase): | ||||
|     name = 'query' | ||||
|     namespace = 'jabber:iq:version' | ||||
|     plugin_attrib = 'software_version' | ||||
|     interfaces = set(('name', 'version', 'os')) | ||||
|     interfaces = {'name', 'version', 'os'} | ||||
|     sub_interfaces = interfaces | ||||
|   | ||||
| @@ -28,7 +28,7 @@ class XEP_0092(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0092' | ||||
|     description = 'XEP-0092: Software Version' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'software_name': 'Slixmpp', | ||||
|   | ||||
| @@ -13,7 +13,7 @@ class SI(ElementBase): | ||||
|     name = 'si' | ||||
|     namespace = 'http://jabber.org/protocol/si' | ||||
|     plugin_attrib = 'si' | ||||
|     interfaces = set(['id', 'mime_type', 'profile']) | ||||
|     interfaces = {'id', 'mime_type', 'profile'} | ||||
|  | ||||
|     def get_mime_type(self): | ||||
|         return self._get_attr('mime-type', 'application/octet-stream') | ||||
|   | ||||
| @@ -31,7 +31,7 @@ class XEP_0095(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0095' | ||||
|     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 | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0096(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0096' | ||||
|     description = 'XEP-0096: SI File Transfer' | ||||
|     dependencies = set(['xep_0095']) | ||||
|     dependencies = {'xep_0095'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -16,8 +16,8 @@ class File(ElementBase): | ||||
|     name = 'file' | ||||
|     namespace = 'http://jabber.org/protocol/si/profile/file-transfer' | ||||
|     plugin_attrib = 'file' | ||||
|     interfaces = set(['name', 'size', 'date', 'hash', 'desc']) | ||||
|     sub_interfaces = set(['desc']) | ||||
|     interfaces = {'name', 'size', 'date', 'hash', 'desc'} | ||||
|     sub_interfaces = {'desc'} | ||||
|  | ||||
|     def set_size(self, value): | ||||
|         self._set_attr('size', str(value)) | ||||
| @@ -36,7 +36,7 @@ class Range(ElementBase): | ||||
|     name = 'range' | ||||
|     namespace = 'http://jabber.org/protocol/si/profile/file-transfer' | ||||
|     plugin_attrib = 'range' | ||||
|     interfaces = set(['length', 'offset']) | ||||
|     interfaces = {'length', 'offset'} | ||||
|  | ||||
|     def set_length(self, value): | ||||
|         self._set_attr('length', str(value)) | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class XEP_0106(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0106' | ||||
|     description = 'XEP-0106: JID Escaping' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|  | ||||
|     def session_bind(self, jid): | ||||
|         self.xmpp['xep_0030'].add_feature(feature='jid\\20escaping') | ||||
|   | ||||
| @@ -14,25 +14,25 @@ class UserMood(ElementBase): | ||||
|     name = 'mood' | ||||
|     namespace = 'http://jabber.org/protocol/mood' | ||||
|     plugin_attrib = 'mood' | ||||
|     interfaces = set(['value', 'text']) | ||||
|     sub_interfaces = set(['text']) | ||||
|     moods = set(['afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', | ||||
|                  'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', | ||||
|                  'cold', 'confident', 'confused', 'contemplative', 'contented', | ||||
|                  'cranky', 'crazy', 'creative', 'curious', 'dejected', | ||||
|                  'depressed', 'disappointed', 'disgusted', 'dismayed', | ||||
|                  'distracted', 'embarrassed', 'envious', 'excited', | ||||
|                  'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy', | ||||
|                  'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated', | ||||
|                  'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', | ||||
|                  'indignant', 'interested', 'intoxicated', 'invincible', | ||||
|                  'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody', | ||||
|                  'nervous', 'neutral', 'offended', 'outraged', 'playful', | ||||
|                  'proud', 'relaxed', 'relieved', 'remorseful', 'restless', | ||||
|                  'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', | ||||
|                  'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', | ||||
|                  'surprised', 'thankful', 'thirsty', 'tired', 'undefined', | ||||
|                  'weak', 'worried']) | ||||
|     interfaces = {'value', 'text'} | ||||
|     sub_interfaces = {'text'} | ||||
|     moods = {'afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', | ||||
|              'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', | ||||
|              'cold', 'confident', 'confused', 'contemplative', 'contented', | ||||
|              'cranky', 'crazy', 'creative', 'curious', 'dejected', | ||||
|              'depressed', 'disappointed', 'disgusted', 'dismayed', | ||||
|              'distracted', 'embarrassed', 'envious', 'excited', | ||||
|              'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy', | ||||
|              'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated', | ||||
|              'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', | ||||
|              'indignant', 'interested', 'intoxicated', 'invincible', | ||||
|              'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody', | ||||
|              'nervous', 'neutral', 'offended', 'outraged', 'playful', | ||||
|              'proud', 'relaxed', 'relieved', 'remorseful', 'restless', | ||||
|              'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', | ||||
|              'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', | ||||
|              'surprised', 'thankful', 'thirsty', 'tired', 'undefined', | ||||
|              'weak', 'worried'} | ||||
|  | ||||
|     def set_value(self, value): | ||||
|         self.del_value() | ||||
|   | ||||
| @@ -27,7 +27,7 @@ class XEP_0107(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0107' | ||||
|     description = 'XEP-0107: User Mood' | ||||
|     dependencies = set(['xep_0163']) | ||||
|     dependencies = {'xep_0163'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -14,30 +14,30 @@ class UserActivity(ElementBase): | ||||
|     name = 'activity' | ||||
|     namespace = 'http://jabber.org/protocol/activity' | ||||
|     plugin_attrib = 'activity' | ||||
|     interfaces = set(['value', 'text']) | ||||
|     sub_interfaces = set(['text']) | ||||
|     general = set(['doing_chores', 'drinking', 'eating', 'exercising', | ||||
|                    'grooming', 'having_appointment', 'inactive', 'relaxing', | ||||
|                    'talking', 'traveling', 'undefined', 'working']) | ||||
|     specific = set(['at_the_spa', 'brushing_teeth', 'buying_groceries', | ||||
|                     'cleaning', 'coding', 'commuting', 'cooking', 'cycling', | ||||
|                     'dancing', 'day_off', 'doing_maintenance', | ||||
|                     'doing_the_dishes', 'doing_the_laundry', 'driving', | ||||
|                     'fishing', 'gaming', 'gardening', 'getting_a_haircut', | ||||
|                     'going_out', 'hanging_out', 'having_a_beer', | ||||
|                     'having_a_snack', 'having_breakfast', 'having_coffee', | ||||
|                     'having_dinner', 'having_lunch', 'having_tea', 'hiding', | ||||
|                     'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', | ||||
|                     'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', | ||||
|                     'on_a_trip', 'on_the_phone', 'on_vacation', | ||||
|                     'on_video_phone', 'other', 'partying', 'playing_sports', | ||||
|                     'praying', 'reading', 'rehearsing', 'running', | ||||
|                     'running_an_errand', 'scheduled_holiday', 'shaving', | ||||
|                     'shopping', 'skiing', 'sleeping', 'smoking', | ||||
|                     'socializing', 'studying', 'sunbathing', 'swimming', | ||||
|                     'taking_a_bath', 'taking_a_shower', 'thinking', | ||||
|                     'walking', 'walking_the_dog', 'watching_a_movie', | ||||
|                     'watching_tv', 'working_out', 'writing']) | ||||
|     interfaces = {'value', 'text'} | ||||
|     sub_interfaces = {'text'} | ||||
|     general = {'doing_chores', 'drinking', 'eating', 'exercising', | ||||
|                'grooming', 'having_appointment', 'inactive', 'relaxing', | ||||
|                'talking', 'traveling', 'undefined', 'working'} | ||||
|     specific = {'at_the_spa', 'brushing_teeth', 'buying_groceries', | ||||
|                 'cleaning', 'coding', 'commuting', 'cooking', 'cycling', | ||||
|                 'dancing', 'day_off', 'doing_maintenance', | ||||
|                 'doing_the_dishes', 'doing_the_laundry', 'driving', | ||||
|                 'fishing', 'gaming', 'gardening', 'getting_a_haircut', | ||||
|                 'going_out', 'hanging_out', 'having_a_beer', | ||||
|                 'having_a_snack', 'having_breakfast', 'having_coffee', | ||||
|                 'having_dinner', 'having_lunch', 'having_tea', 'hiding', | ||||
|                 'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', | ||||
|                 'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', | ||||
|                 'on_a_trip', 'on_the_phone', 'on_vacation', | ||||
|                 'on_video_phone', 'other', 'partying', 'playing_sports', | ||||
|                 'praying', 'reading', 'rehearsing', 'running', | ||||
|                 'running_an_errand', 'scheduled_holiday', 'shaving', | ||||
|                 'shopping', 'skiing', 'sleeping', 'smoking', | ||||
|                 'socializing', 'studying', 'sunbathing', 'swimming', | ||||
|                 'taking_a_bath', 'taking_a_shower', 'thinking', | ||||
|                 'walking', 'walking_the_dog', 'watching_a_movie', | ||||
|                 'watching_tv', 'working_out', 'writing'} | ||||
|  | ||||
|     def set_value(self, value): | ||||
|         self.del_value() | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0108(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0108' | ||||
|     description = 'XEP-0108: User Activity' | ||||
|     dependencies = set(['xep_0163']) | ||||
|     dependencies = {'xep_0163'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_end(self): | ||||
|   | ||||
| @@ -32,7 +32,7 @@ class XEP_0115(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0115' | ||||
|     description = 'XEP-0115: Entity Capabilities' | ||||
|     dependencies = set(['xep_0030', 'xep_0128', 'xep_0004']) | ||||
|     dependencies = {'xep_0030', 'xep_0128', 'xep_0004'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'hash': 'sha-1', | ||||
|   | ||||
| @@ -16,4 +16,4 @@ class Capabilities(ElementBase): | ||||
|     namespace = 'http://jabber.org/protocol/caps' | ||||
|     name = 'c' | ||||
|     plugin_attrib = 'caps' | ||||
|     interfaces = set(('hash', 'node', 'ver', 'ext')) | ||||
|     interfaces = {'hash', 'node', 'ver', 'ext'} | ||||
|   | ||||
| @@ -14,8 +14,8 @@ class UserTune(ElementBase): | ||||
|     name = 'tune' | ||||
|     namespace = 'http://jabber.org/protocol/tune' | ||||
|     plugin_attrib = 'tune' | ||||
|     interfaces = set(['artist', 'length', 'rating', 'source', | ||||
|                       'title', 'track', 'uri']) | ||||
|     interfaces = {'artist', 'length', 'rating', 'source', | ||||
|                   'title', 'track', 'uri'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|     def set_length(self, value): | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0118(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0118' | ||||
|     description = 'XEP-0118: User Tune' | ||||
|     dependencies = set(['xep_0163']) | ||||
|     dependencies = {'xep_0163'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_end(self): | ||||
|   | ||||
| @@ -12,7 +12,7 @@ class XEP_0122(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0122' | ||||
|     description = 'XEP-0122: Data Forms Validation' | ||||
|     dependencies = set(['xep_0004']) | ||||
|     dependencies = {'xep_0004'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
| @@ -41,7 +41,7 @@ class XEP_0128(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0128' | ||||
|     description = 'XEP-0128: Service Discovery Extensions' | ||||
|     dependencies = set(['xep_0030', 'xep_0004']) | ||||
|     dependencies = {'xep_0030', 'xep_0004'} | ||||
|  | ||||
|     def plugin_init(self): | ||||
|         """Start the XEP-0128 plugin.""" | ||||
|   | ||||
| @@ -38,9 +38,8 @@ class StaticExtendedDisco(object): | ||||
|         The data parameter may provide: | ||||
|             data -- Either a single data form, or a list of data forms. | ||||
|         """ | ||||
|         with self.static.lock: | ||||
|             self.del_extended_info(jid, node, ifrom, data) | ||||
|             self.add_extended_info(jid, node, ifrom, data) | ||||
|         self.del_extended_info(jid, node, ifrom, data) | ||||
|         self.add_extended_info(jid, node, ifrom, data) | ||||
|  | ||||
|     def add_extended_info(self, jid, node, ifrom, data): | ||||
|         """ | ||||
| @@ -49,16 +48,15 @@ class StaticExtendedDisco(object): | ||||
|         The data parameter may provide: | ||||
|             data -- Either a single data form, or a list of data forms. | ||||
|         """ | ||||
|         with self.static.lock: | ||||
|             self.static.add_node(jid, node) | ||||
|         self.static.add_node(jid, node) | ||||
|  | ||||
|             forms = data.get('data', []) | ||||
|             if not isinstance(forms, list): | ||||
|                 forms = [forms] | ||||
|         forms = data.get('data', []) | ||||
|         if not isinstance(forms, list): | ||||
|             forms = [forms] | ||||
|  | ||||
|             info = self.static.get_node(jid, node)['info'] | ||||
|             for form in forms: | ||||
|                 info.append(form) | ||||
|         info = self.static.get_node(jid, node)['info'] | ||||
|         for form in forms: | ||||
|             info.append(form) | ||||
|  | ||||
|     def del_extended_info(self, jid, node, ifrom, data): | ||||
|         """ | ||||
| @@ -66,8 +64,7 @@ class StaticExtendedDisco(object): | ||||
|  | ||||
|         The data parameter is not used. | ||||
|         """ | ||||
|         with self.static.lock: | ||||
|             if self.static.node_exists(jid, node): | ||||
|                 info = self.static.get_node(jid, node)['info'] | ||||
|                 for form in info['substanza']: | ||||
|                     info.xml.remove(form.xml) | ||||
|         if self.static.node_exists(jid, node): | ||||
|             info = self.static.get_node(jid, node)['info'] | ||||
|             for form in info['substanza']: | ||||
|                 info.xml.remove(form.xml) | ||||
|   | ||||
| @@ -17,7 +17,7 @@ class XEP_0131(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0131' | ||||
|     description = 'XEP-0131: Stanza Headers and Internet Metadata' | ||||
|     dependencies = set(['xep_0030']) | ||||
|     dependencies = {'xep_0030'} | ||||
|     stanza = stanza | ||||
|     default_config = { | ||||
|         'supported_headers': set() | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class Headers(ElementBase): | ||||
|     name = 'headers' | ||||
|     namespace = 'http://jabber.org/protocol/shim' | ||||
|     plugin_attrib = 'headers' | ||||
|     interfaces = set(['headers']) | ||||
|     interfaces = {'headers'} | ||||
|     is_extension = True | ||||
|  | ||||
|     def get_headers(self): | ||||
|   | ||||
| @@ -14,19 +14,19 @@ class XEP_0133(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0133' | ||||
|     description = 'XEP-0133: Service Administration' | ||||
|     dependencies = set(['xep_0030', 'xep_0004', 'xep_0050']) | ||||
|     commands = set(['add-user', 'delete-user', 'disable-user', | ||||
|                     'reenable-user', 'end-user-session', 'get-user-password', | ||||
|                     'change-user-password', 'get-user-roster', | ||||
|                     'get-user-lastlogin', 'user-stats', 'edit-blacklist', | ||||
|                     'edit-whitelist', 'get-registered-users-num', | ||||
|                     'get-disabled-users-num', 'get-online-users-num', | ||||
|                     'get-active-users-num', 'get-idle-users-num', | ||||
|                     'get-registered-users-list', 'get-disabled-users-list', | ||||
|                     'get-online-users-list', 'get-online-users', | ||||
|                     'get-active-users', 'get-idle-userslist', 'announce', | ||||
|                     'set-motd', 'edit-motd', 'delete-motd', 'set-welcome', | ||||
|                     'delete-welcome', 'edit-admin', 'restart', 'shutdown']) | ||||
|     dependencies = {'xep_0030', 'xep_0004', 'xep_0050'} | ||||
|     commands = {'add-user', 'delete-user', 'disable-user', | ||||
|                 'reenable-user', 'end-user-session', 'get-user-password', | ||||
|                 'change-user-password', 'get-user-roster', | ||||
|                 'get-user-lastlogin', 'user-stats', 'edit-blacklist', | ||||
|                 'edit-whitelist', 'get-registered-users-num', | ||||
|                 'get-disabled-users-num', 'get-online-users-num', | ||||
|                 'get-active-users-num', 'get-idle-users-num', | ||||
|                 'get-registered-users-list', 'get-disabled-users-list', | ||||
|                 'get-online-users-list', 'get-online-users', | ||||
|                 'get-active-users', 'get-idle-userslist', 'announce', | ||||
|                 'set-motd', 'edit-motd', 'delete-motd', 'set-welcome', | ||||
|                 'delete-welcome', 'edit-admin', 'restart', 'shutdown'} | ||||
|  | ||||
|     def get_commands(self, jid=None, **kwargs): | ||||
|         if jid is None: | ||||
|   | ||||
| @@ -22,7 +22,7 @@ log = logging.getLogger(__name__) | ||||
| class Compression(ElementBase): | ||||
|     name = 'compression' | ||||
|     namespace = 'http://jabber.org/features/compress' | ||||
|     interfaces = set(('methods',)) | ||||
|     interfaces = {'methods'} | ||||
|     plugin_attrib = 'compression' | ||||
|     plugin_tag_map = {} | ||||
|     plugin_attrib_map = {} | ||||
| @@ -37,7 +37,7 @@ class Compression(ElementBase): | ||||
| class Compress(StanzaBase): | ||||
|     name = 'compress' | ||||
|     namespace = 'http://jabber.org/protocol/compress' | ||||
|     interfaces = set(('method',)) | ||||
|     interfaces = {'method'} | ||||
|     sub_interfaces = interfaces | ||||
|     plugin_attrib = 'compress' | ||||
|     plugin_tag_map = {} | ||||
| @@ -95,7 +95,7 @@ class XEP_0138(BasePlugin): | ||||
|     """ | ||||
|     name = "xep_0138" | ||||
|     description = "XEP-0138: Compression" | ||||
|     dependencies = set(["xep_0030"]) | ||||
|     dependencies = {"xep_0030"} | ||||
|  | ||||
|     def plugin_init(self): | ||||
|         self.xep = '0138' | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class XEP_0152(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0152' | ||||
|     description = 'XEP-0152: Reachability Addresses' | ||||
|     dependencies = set(['xep_0163']) | ||||
|     dependencies = {'xep_0163'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_end(self): | ||||
|   | ||||
| @@ -21,9 +21,9 @@ class Address(ElementBase): | ||||
|     namespace = 'urn:xmpp:reach:0' | ||||
|     plugin_attrib = 'address' | ||||
|     plugin_multi_attrib = 'addresses' | ||||
|     interfaces = set(['uri', 'desc']) | ||||
|     lang_interfaces = set(['desc']) | ||||
|     sub_interfaces = set(['desc']) | ||||
|     interfaces = {'uri', 'desc'} | ||||
|     lang_interfaces = {'desc'} | ||||
|     sub_interfaces = {'desc'} | ||||
|  | ||||
|  | ||||
| register_stanza_plugin(Reachability, Address, iterable=True) | ||||
|   | ||||
| @@ -13,7 +13,7 @@ class VCardTempUpdate(ElementBase): | ||||
|     name = 'x' | ||||
|     namespace = 'vcard-temp:x:update' | ||||
|     plugin_attrib = 'vcard_temp_update' | ||||
|     interfaces = set(['photo']) | ||||
|     interfaces = {'photo'} | ||||
|     sub_interfaces = interfaces | ||||
|  | ||||
|     def set_photo(self, value): | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class XEP_0153(BasePlugin): | ||||
|  | ||||
|     name = 'xep_0153' | ||||
|     description = 'XEP-0153: vCard-Based Avatars' | ||||
|     dependencies = set(['xep_0054']) | ||||
|     dependencies = {'xep_0054'} | ||||
|     stanza = stanza | ||||
|  | ||||
|     def plugin_init(self): | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user