Hello community, here is the log from the commit of package python-nbxmpp for openSUSE:Factory checked in at 2017-06-12 15:28:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nbxmpp (Old) and /work/SRC/openSUSE:Factory/.python-nbxmpp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nbxmpp" Mon Jun 12 15:28:57 2017 rev:14 rq:501306 version:0.5.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nbxmpp/python-nbxmpp.changes 2016-10-20 23:09:31.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-nbxmpp.new/python-nbxmpp.changes 2017-06-12 15:29:05.184669150 +0200 @@ -1,0 +2,8 @@ +Wed May 17 13:12:21 UTC 2017 - [email protected] + +- Update to version 0.5.5: + * Add some namespaces. + * Some cleanup. +- Update for the multipython build. + +------------------------------------------------------------------- Old: ---- nbxmpp-0.5.4.tar.gz New: ---- nbxmpp-0.5.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nbxmpp.spec ++++++ --- /var/tmp/diff_new_pack.bncAiB/_old 2017-06-12 15:29:08.460207195 +0200 +++ /var/tmp/diff_new_pack.bncAiB/_new 2017-06-12 15:29:08.460207195 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-nbxmpp # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,30 +16,28 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define _name nbxmpp Name: python-nbxmpp -Version: 0.5.4 +Version: 0.5.5 Release: 0 Summary: XMPP library by Gajim team License: GPL-3.0+ Group: Development/Languages/Python Url: https://python-nbxmpp.gajim.org/ Source: https://files.pythonhosted.org/packages/source/n/%{_name}/%{_name}-%{version}.tar.gz +BuildRequires: %{python_module devel} BuildRequires: fdupes -BuildRequires: python-devel -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} >= 1120 +BuildRequires: python-rpm-macros BuildArch: noarch -%else -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%py_requires -%endif %description Python-nbxmpp is a Python library that provides a way for Python applications to use Jabber/XMPP networks in a non-blocking way. This library is initialy a fork of xmpppy one, but using non-blocking sockets. +%python_subpackages + %package doc Summary: Nbxmpp Documentation Group: Documentation/Other @@ -49,25 +47,23 @@ %prep %setup -q -n %{_name}-%{version} -rm doc/examples/*.orig %build -python setup.py build +%python_build %install -python setup.py install \ - --root %{buildroot} --prefix=%{_prefix} -%fdupes %{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib}/ -%files +%files %{python_files} %defattr(-,root,root) %doc COPYING %{python_sitelib}/%{_name}/ %{python_sitelib}/%{_name}-* -%files doc +%files %{python_files doc} %defattr(-,root,root) %doc ChangeLog README -%doc doc/apidocs doc/examples +%doc doc/apidocs/ doc/examples/ %changelog ++++++ nbxmpp-0.5.4.tar.gz -> nbxmpp-0.5.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/ChangeLog new/nbxmpp-0.5.5/ChangeLog --- old/nbxmpp-0.5.4/ChangeLog 2016-09-04 13:45:11.000000000 +0200 +++ new/nbxmpp-0.5.5/ChangeLog 2017-01-30 22:34:33.000000000 +0100 @@ -1,3 +1,8 @@ +python-nbxmpp 0.5.5 (30 January 2017) + + * Some cleanup + * Add some namespaces + python-nbxmpp 0.5.4 (04 September 2016) * Fix SCRAM authentication diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/PKG-INFO new/nbxmpp-0.5.5/PKG-INFO --- old/nbxmpp-0.5.4/PKG-INFO 2016-09-04 13:50:47.000000000 +0200 +++ new/nbxmpp-0.5.5/PKG-INFO 2017-01-30 22:49:18.000000000 +0100 @@ -1,8 +1,8 @@ Metadata-Version: 1.0 Name: nbxmpp -Version: 0.5.4 +Version: 0.5.5 Summary: Non blocking Jabber/XMPP module -Home-page: http://python-nbxmpp.gajim.org +Home-page: http://dev.gajim.org/gajim/python-nbxmpp Author: Yann Leboulanger Author-email: [email protected] License: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/README new/nbxmpp-0.5.5/README --- old/nbxmpp-0.5.4/README 2015-07-26 13:10:28.000000000 +0200 +++ new/nbxmpp-0.5.5/README 2017-01-01 23:13:23.000000000 +0100 @@ -1,5 +1,5 @@ python-nbxmpp - http://python-nbxmpp.gajim.org + http://dev.gajim.org/gajim/python-nbxmpp The goal of this python library is to provide a way for python applications to use Jabber/XMPP networks in a non-blocking way. This library is initialy a @@ -11,7 +11,7 @@ Usage -You have to 'import xmpppy' in your program. Then look at examples in the doc +You have to 'import nbxmpp' in your program. Then look at examples in the doc folder. 2012-05-08 Yann Leboulanger diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/doc/examples/xsend.py.orig new/nbxmpp-0.5.5/doc/examples/xsend.py.orig --- old/nbxmpp-0.5.4/doc/examples/xsend.py.orig 2016-05-15 21:04:13.000000000 +0200 +++ new/nbxmpp-0.5.5/doc/examples/xsend.py.orig 1970-01-01 01:00:00.000000000 +0100 @@ -1,89 +0,0 @@ -#!/usr/bin/python3 - -import sys -import os -import nbxmpp -import time -import logging -try: - from gi.repository import GObject as gobject -except Exception: - import gobject - -consoleloghandler = logging.StreamHandler() -root_log = logging.getLogger('nbxmpp') -root_log.setLevel('DEBUG') -root_log.addHandler(consoleloghandler) - -if len(sys.argv) < 2: - print("Syntax: xsend JID text") - sys.exit(0) - -to_jid = sys.argv[1] -text = ' '.join(sys.argv[2:]) - -jidparams = {} -if os.access(os.environ['HOME'] + '/.xsend', os.R_OK): - for ln in open(os.environ['HOME'] + '/.xsend').readlines(): - if not ln[0] in ('#', ';'): - key, val = ln.strip().split('=', 1) - jidparams[key.lower()] = val -for mandatory in ['jid', 'password']: - if mandatory not in jidparams.keys(): - open(os.environ['HOME']+'/.xsend','w').write('#Uncomment fields before use and type in correct credentials.\n#[email protected]/resource (/resource is optional)\n#PASSWORD=juliet\n') - print('Please point ~/.xsend config file to valid JID for sending messages.') - sys.exit(0) - -class Connection: - def __init__(self): - self.jid = nbxmpp.protocol.JID(jidparams['jid']) - self.password = jidparams['password'] - self.sm = nbxmpp.Smacks(self) # Stream Management - self.client_cert = None - - def on_auth(self, con, auth): - if not auth: - print('could not authenticate!') - sys.exit() - print('authenticated using ' + auth) - ri = self.client.initRoster() - self.roster = self.client.getRoster(force=True) - id_ = self.roster.Request(force=True) - roster_list = self.roster.getItems() - self.send_message(to_jid, text) - - def on_connected(self, con, con_type): - print('connected with ' + con_type) - auth = self.client.auth(self.jid.getNode(), self.password, resource=self.jid.getResource(), sasl=1, on_auth=self.on_auth) - - def get_password(self, cb, mech): - cb(self.password) - - def on_connection_failed(self): - print('could not connect!') - - def _event_dispatcher(self, realm, event, data): - pass - - def connect(self): - idle_queue = nbxmpp.idlequeue.get_idlequeue() - self.client = nbxmpp.NonBlockingClient(self.jid.getDomain(), idle_queue, caller=self) - self.con = self.client.connect(self.on_connected, self.on_connection_failed, secure_tuple=('tls', '', '', None, None)) - - def send_message(self, to_jid, text): - id_ = self.client.send(nbxmpp.protocol.Message(to_jid, text, typ='chat')) - print('sent message with id ' + id_) - gobject.timeout_add(1000, self.quit) - - def quit(self): - self.disconnect() - ml.quit() - - def disconnect(self): - self.client.start_disconnect() - - -con = Connection() -con.connect() -ml = gobject.MainLoop() -ml.run() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/__init__.py new/nbxmpp-0.5.5/nbxmpp/__init__.py --- old/nbxmpp-0.5.4/nbxmpp/__init__.py 2016-09-04 13:48:01.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/__init__.py 2017-01-30 22:40:44.000000000 +0100 @@ -17,4 +17,4 @@ from .plugin import PlugIn from .smacks import Smacks -__version__ = "0.5.4" +__version__ = "0.5.5" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/auth_nb.py new/nbxmpp-0.5.5/nbxmpp/auth_nb.py --- old/nbxmpp-0.5.4/nbxmpp/auth_nb.py 2015-08-31 13:40:55.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/auth_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -193,7 +193,7 @@ # If the server supports a mechanism disable all weaker mechanisms. password_auth_mechs_strength = ['SCRAM-SHA-1-PLUS', 'SCRAM-SHA-1', 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2'] - if self.channel_binding == None: + if self.channel_binding is None: password_auth_mechs_strength.remove('SCRAM-SHA-1-PLUS') for i in range(0, len(password_auth_mechs_strength)): if password_auth_mechs_strength[i] in self.mecs: @@ -243,7 +243,7 @@ raise NodeProcessed except kerberos.GSSError as e: log.info('GSSAPI authentication failed: %s' % str(e)) - if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding != None: + if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding is not None: self.mecs.remove('SCRAM-SHA-1-PLUS') self.mechanism = 'SCRAM-SHA-1-PLUS' self._owner._caller.get_password(self.set_password, self.mechanism) @@ -461,18 +461,18 @@ self.realm = chal['realm'] if 'qop' in chal and ((chal['qop'] =='auth') or \ (isinstance(chal['qop'], list) and 'auth' in chal['qop'])): - self.resp = {} - self.resp['username'] = self.username + self.resp = {'username': self.username, + 'nonce': chal['nonce'], + 'cnonce': '%x' % rndg.getrandbits(196), + 'nc': ('00000001'), # ToDo: Is this a tupel or only a string? + 'qop': 'auth', + 'digest-uri': 'xmpp/' + self._owner.Server, + 'charset': 'utf-8' + } if self.realm: self.resp['realm'] = self.realm else: self.resp['realm'] = self._owner.Server - self.resp['nonce'] = chal['nonce'] - self.resp['cnonce'] = '%x' % rndg.getrandbits(196) - self.resp['nc'] = ('00000001') - self.resp['qop'] = 'auth' - self.resp['digest-uri'] = 'xmpp/' + self._owner.Server - self.resp['charset'] = 'utf-8' # Password is now required self._owner._caller.get_password(self.set_password, self.mechanism) elif 'rspauth' in chal: @@ -501,7 +501,7 @@ self.client_nonce = '%x' % rndg.getrandbits(196) self.scram_soup = 'n=' + self.username + ',r=' + self.client_nonce if self.mechanism == 'SCRAM-SHA-1': - if self.channel_binding == None: + if self.channel_binding is None: # Client doesn't support Channel Binding self.scram_gs2 = 'n,,' # No CB yet. else: @@ -663,7 +663,7 @@ self.resuming = False def plugin(self, owner): - ''' Start resource binding, if allowed at this time. Used internally. ''' + """ Start resource binding, if allowed at this time. Used internally. """ if self._owner.Dispatcher.Stream.features: try: self.FeaturesHandler(self._owner.Dispatcher, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/bosh.py new/nbxmpp-0.5.5/nbxmpp/bosh.py --- old/nbxmpp-0.5.4/nbxmpp/bosh.py 2014-04-09 17:32:52.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/bosh.py 2017-01-01 23:13:23.000000000 +0100 @@ -101,7 +101,7 @@ NonBlockingTransport.connect(self, conn_5tuple, on_connect, on_connect_failure) global FAKE_DESCRIPTOR - FAKE_DESCRIPTOR = FAKE_DESCRIPTOR - 1 + FAKE_DESCRIPTOR -= 1 self.fd = FAKE_DESCRIPTOR self.stanza_buffer = [] @@ -493,8 +493,7 @@ return rndg.getrandbits(50) - -class AckChecker(): +class AckChecker(object): """ Class for generating rids and generating and checking acknowledgements in BOSH messages @@ -537,10 +536,7 @@ return self.rid - - - -class KeyStack(): +class KeyStack(object): """ Class implementing key sequences for BOSH messages """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/c14n.py new/nbxmpp-0.5.5/nbxmpp/c14n.py --- old/nbxmpp-0.5.4/nbxmpp/c14n.py 2014-04-09 17:32:20.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/c14n.py 2017-01-01 23:13:23.000000000 +0100 @@ -28,7 +28,7 @@ s = "<" + node.name if node.namespace: if not node.parent or node.parent.namespace != node.namespace: - s = s + ' xmlns="%s"' % node.namespace + s += ' xmlns="%s"' % node.namespace sorted_attrs = sorted(node.attrs.keys()) for key in sorted_attrs: @@ -36,15 +36,15 @@ continue val = ustr(node.attrs[key]) # like XMLescape() but with whitespace and without > - s = s + ' %s="%s"' % ( key, normalise_attr(val) ) - s = s + ">" + s += ' %s="%s"' % (key, normalise_attr(val)) + s += ">" cnt = 0 if node.kids: for a in node.kids: if (len(node.data)-1) >= cnt: s = s + normalise_text(node.data[cnt]) s = s + c14n(a, is_buggy) - cnt=cnt+1 + cnt += 1 if (len(node.data)-1) >= cnt: s = s + normalise_text(node.data[cnt]) if not node.kids and s.endswith('>'): s=s[:-1]+' />' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/client_nb.py new/nbxmpp-0.5.5/nbxmpp/client_nb.py --- old/nbxmpp-0.5.4/nbxmpp/client_nb.py 2015-03-17 20:32:43.000000000 +0100 +++ new/nbxmpp-0.5.5/nbxmpp/client_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -29,7 +29,7 @@ log = logging.getLogger('nbxmpp.client_nb') -class NonBlockingClient: +class NonBlockingClient(object): """ Client class is XMPP connection mountpoint. Objects for authentication, network communication, roster, xml parsing ... are plugged to client object. @@ -160,6 +160,7 @@ :param port: port number of XMPP server :param on_proxy_failure: called if error occurs during TCP connection to proxy server or during proxy connecting process + :param on_stream_error_cb: called if error occurs :param proxy: dictionary with proxy data. It should contain at least values for keys 'host' and 'port' - connection details for proxy serve and optionally keys 'user' and 'pass' as proxy credentials @@ -273,9 +274,9 @@ """ if err_message: log.debug('While looping over DNS A records: %s' % err_message) - if self.ip_addresses == []: + if not self.ip_addresses: msg = 'Run out of hosts for name %s:%s.' % (self.Server, self.Port) - msg = msg + ' Error for last IP: %s' % err_message + msg += ' Error for last IP: %s' % err_message self.disconnect(msg) else: self.current_ip = self.ip_addresses.pop(0) @@ -498,10 +499,10 @@ if self.protocol_type != 'BOSH': self._channel_binding = self.Connection.NonBlockingTLS.get_channel_binding() # TLS handshake is finished so channel binding data muss exist - assert (self._channel_binding != None) + assert (self._channel_binding is not None) except NotImplementedError: pass - if auth_mechs == None: + if auth_mechs is None: self._auth_mechs = SASL_AUTHENTICATION_MECHANISMS | set(['XEP-0078']) else: self._auth_mechs = auth_mechs @@ -556,7 +557,7 @@ """ if data: self.Dispatcher.ProcessNonBlocking(data) - if not 'SASL' in self.__dict__: + if 'SASL' not in self.__dict__: # SASL is pluged out, possible disconnect return if self.SASL.startsasl == 'in-process': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/dispatcher_nb.py new/nbxmpp-0.5.5/nbxmpp/dispatcher_nb.py --- old/nbxmpp-0.5.4/nbxmpp/dispatcher_nb.py 2015-12-17 19:47:08.000000000 +0100 +++ new/nbxmpp-0.5.5/nbxmpp/dispatcher_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -43,7 +43,7 @@ XML_DECLARATION = '<?xml version=\'1.0\'?>' # FIXME: ugly -class Dispatcher(): +class Dispatcher(object): """ Why is this here - I needed to redefine Dispatcher for BOSH and easiest way was to inherit original Dispatcher (now renamed to XMPPDispatcher). Trouble @@ -104,7 +104,7 @@ # \ufddo -> \ufdef range c = '\ufdd0' r = c - while (c < '\ufdef'): + while c < '\ufdef': c = chr(ord(c) + 1) r += '|' + c @@ -112,7 +112,7 @@ c = '\ufffe' r += '|' + c r += '|' + chr(ord(c) + 1) - while (c < '\U0010fffe'): + while c < '\U0010fffe': c = chr(ord(c) + 0x10000) r += '|' + c r += '|' + chr(ord(c) + 1) @@ -298,6 +298,7 @@ :param typ: value of stanza's "type" attribute. If not specified any value will match :param ns: namespace of child that stanza must contain. + :param xmlns: xml namespace :param makefirst: insert handler in the beginning of handlers list instead of adding it to the end. Note that more common handlers i.e. w/o "typ" and " will be called first nevertheless. @@ -458,7 +459,7 @@ stanza.getName() != 'a' and stanza.getName() != 'enabled' and stanza.getName() != 'resumed'): # increments the number of stanzas that has been handled - self.sm.in_h = self.sm.in_h + 1 + self.sm.in_h += 1 list_ = ['default'] # we will use all handlers: if typ in self.handlers[xmlns][name]: list_.append(typ) # from very common... @@ -571,7 +572,7 @@ # If no ID then it is a whitespace if self.sm and self.sm.enabled and ID: self.sm.uqueue.append(stanza) - self.sm.out_h = self.sm.out_h + 1 + self.sm.out_h += 1 if len(self.sm.uqueue) > self.sm.max_queue: self.sm.request_ack() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/features_nb.py new/nbxmpp-0.5.5/nbxmpp/features_nb.py --- old/nbxmpp-0.5.4/nbxmpp/features_nb.py 2014-04-09 17:32:20.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/features_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -213,6 +213,6 @@ _on_default_response(disp, iq, None) def delPrivacyList(disp, listname, cb=None): - ''' Deletes privacy list 'listname'. Returns true on success. ''' + """ Deletes privacy list 'listname'. Returns true on success. """ iq = Iq('set', NS_PRIVACY, payload=[Node('list', {'name':listname})]) _on_default_response(disp, iq, cb) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/idlequeue.py new/nbxmpp-0.5.5/nbxmpp/idlequeue.py --- old/nbxmpp-0.5.4/nbxmpp/idlequeue.py 2015-09-01 22:04:43.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/idlequeue.py 2017-01-01 23:13:23.000000000 +0100 @@ -76,7 +76,7 @@ return SelectIdleQueue() -class IdleObject: +class IdleObject(object): """ Idle listener interface. Listed methods are called by IdleQueue. """ @@ -216,7 +216,7 @@ self._return_result() -class IdleQueue: +class IdleQueue(object): """ IdleQueue provide three distinct time based features. Uses select.poll() @@ -269,7 +269,7 @@ Remove alarm callback alarm_cb scheduled on alarm_time. Returns True if it was removed sucessfully, otherwise False """ - if not alarm_time in self.alarms: + if alarm_time not in self.alarms: return False i = -1 for i in range(len(self.alarms[alarm_time])): @@ -278,7 +278,7 @@ break if i != -1: del self.alarms[alarm_time][i] - if self.alarms[alarm_time] == []: + if not self.alarms[alarm_time]: del self.alarms[alarm_time] return True else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/plugin.py new/nbxmpp-0.5.5/nbxmpp/plugin.py --- old/nbxmpp-0.5.4/nbxmpp/plugin.py 2014-04-09 17:31:59.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/plugin.py 2017-01-01 23:13:23.000000000 +0100 @@ -21,7 +21,8 @@ import logging log = logging.getLogger('nbxmpp.plugin') -class PlugIn: + +class PlugIn(object): """ Abstract xmpppy plugin infrastructure code, providing plugging in/out and debugging functionality diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/protocol.py new/nbxmpp-0.5.5/nbxmpp/protocol.py --- old/nbxmpp-0.5.4/nbxmpp/protocol.py 2014-12-29 14:48:29.000000000 +0100 +++ new/nbxmpp-0.5.5/nbxmpp/protocol.py 2017-01-30 22:24:18.000000000 +0100 @@ -52,6 +52,7 @@ NS_CAPS = 'http://jabber.org/protocol/caps' # XEP-0115 NS_CAPTCHA = 'urn:xmpp:captcha' # XEP-0158 NS_CARBONS = 'urn:xmpp:carbons:2' # XEP-0280 +NS_CHATMARKERS = 'urn:xmpp:chat-markers:0' # XEP-0333 NS_CHATSTATES = 'http://jabber.org/protocol/chatstates' # XEP-0085 NS_CHATTING = 'http://jabber.org/protocol/chatting' # XEP-0194 NS_CLIENT = 'jabber:client' @@ -70,6 +71,7 @@ NS_DISCO = 'http://jabber.org/protocol/disco' NS_DISCO_INFO = NS_DISCO + '#info' NS_DISCO_ITEMS = NS_DISCO + '#items' +NS_EME = 'urn:xmpp:eme:0' # XEP-0380 NS_ENCRYPTED = 'jabber:x:encrypted' # XEP-0027 NS_ESESSION = 'http://www.xmpp.org/extensions/xep-0116.html#ns' NS_ESESSION_INIT = 'http://www.xmpp.org/extensions/xep-0116.html#ns-init' # XEP-0116 @@ -84,6 +86,7 @@ NS_MSG_HINTS = 'urn:xmpp:hints' # XEP-0280 NS_HTTP_AUTH = 'http://jabber.org/protocol/http-auth' # XEP-0070 NS_HTTP_BIND = 'http://jabber.org/protocol/httpbind' # XEP-0124 +NS_HTTPUPLOAD = 'urn:xmpp:http:upload' # XEP-0363 NS_IBB = 'http://jabber.org/protocol/ibb' NS_INVISIBLE = 'presence-invisible' # Jabberd2 NS_IQ = 'iq' # Jabberd2 @@ -111,6 +114,7 @@ NS_MUC_CONFIG = NS_MUC + '#roomconfig' NS_NICK = 'http://jabber.org/protocol/nick' # XEP-0172 NS_OFFLINE = 'http://www.jabber.org/jeps/jep-0030.html' # XEP-0013 +NS_OMEMO = 'urn:xmpp:omemo:0' # XEP-0384 NS_PHYSLOC = 'http://jabber.org/protocol/physloc' # XEP-0112 NS_PING = 'urn:xmpp:ping' # XEP-0199 NS_PRESENCE = 'presence' # Jabberd2 @@ -137,6 +141,7 @@ NS_SI = 'http://jabber.org/protocol/si' # XEP-0096 NS_SI_PUB = 'http://jabber.org/protocol/sipub' # XEP-0137 NS_SIGNED = 'jabber:x:signed' # XEP-0027 +NS_SIMS = 'urn:xmpp:sims:1' # XEP-0385 NS_SSN = 'urn:xmpp:ssn' # XEP-0155 NS_STANZA_CRYPTO = 'http://www.xmpp.org/extensions/xep-0200.html#ns' # XEP-0200 NS_STANZAS = 'urn:ietf:params:xml:ns:xmpp-stanzas' @@ -605,7 +610,8 @@ 'unsupported-version': UnsupportedVersion, 'xml-not-well-formed': XMLNotWellFormed} -class JID: + +class JID(object): """ JID can be built from string, modified, compared, serialised into string """ @@ -726,7 +732,7 @@ <body> tag that wraps usual XMPP stanzas in XMPP over BOSH """ - def __init__(self, attrs={}, payload=[], node=None): + def __init__(self, attrs=None, payload=None, node=None): Node.__init__(self, tag='body', attrs=attrs, payload=payload, node=node) self.setNamespace(NS_HTTP_BIND) @@ -737,8 +743,8 @@ and messages """ - def __init__(self, name=None, to=None, typ=None, frm=None, attrs={}, - payload=[], timestamp=None, xmlns=None, node=None): + def __init__(self, name=None, to=None, typ=None, frm=None, attrs=None, + payload=None, timestamp=None, xmlns=None, node=None): """ Constructor, name is the name of the stanza i.e. 'message' or 'presence'or 'iq' @@ -946,7 +952,7 @@ """ def __init__(self, to=None, body=None, xhtml=None, typ=None, subject=None, - attrs={}, frm=None, payload=[], timestamp=None, xmlns=NS_CLIENT, + attrs=None, frm=None, payload=None, timestamp=None, xmlns=NS_CLIENT, node=None): """ You can specify recipient, text of message, type of message any @@ -1061,7 +1067,7 @@ class Presence(Protocol): def __init__(self, to=None, typ=None, priority=None, show=None, status=None, - attrs={}, frm=None, timestamp=None, payload=[], xmlns=NS_CLIENT, + attrs=None, frm=None, timestamp=None, payload=None, xmlns=NS_CLIENT, node=None): """ You can specify recipient, type of message, priority, show and status @@ -1182,8 +1188,8 @@ XMPP Iq object - get/set dialog mechanism """ - def __init__(self, typ=None, queryNS=None, attrs={}, to=None, frm=None, - payload=[], xmlns=NS_CLIENT, node=None): + def __init__(self, typ=None, queryNS=None, attrs=None, to=None, frm=None, + payload=None, xmlns=NS_CLIENT, node=None): """ You can specify type, query namespace any additional attributes, recipient of the iq, sender of the iq, any additional payload (f.e. @@ -1443,7 +1449,7 @@ """ def __init__(self, name=None, value=None, typ=None, required=0, desc=None, - options=[], node=None): + options=None, node=None): """ Create new data field of specified name,value and type @@ -1592,7 +1598,7 @@ Relevant XEPs: 0004, 0068, 0122. Can be used in disco, pub-sub and many other applications. """ - def __init__(self, typ=None, data=[], title=None, node=None): + def __init__(self, typ=None, data=None, title=None, node=None): """ Create new dataform of type 'typ'. 'data' is the list of DataField instances that this dataform contains, 'title' - the title string. You @@ -1620,18 +1626,19 @@ self.setNamespace(NS_DATA) if title: self.setTitle(title) - if isinstance(data, dict): - newdata = [] - for name in data.keys(): - newdata.append(DataField(name, data[name])) - data = newdata - for child in data: - if child.__class__.__name__ == 'DataField': - self.kids.append(child) - elif isinstance(child, Node): - self.kids.append(DataField(node=child)) - else: # Must be a string - self.addInstructions(child) + if data is not None: + if isinstance(data, dict): + newdata = [] + for name in data.keys(): + newdata.append(DataField(name, data[name])) + data = newdata + for child in data: + if child.__class__.__name__ == 'DataField': + self.kids.append(child) + elif isinstance(child, Node): + self.kids.append(DataField(node=child)) + else: # Must be a string + self.addInstructions(child) def getType(self): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/proxy_connectors.py new/nbxmpp-0.5.5/nbxmpp/proxy_connectors.py --- old/nbxmpp-0.5.4/nbxmpp/proxy_connectors.py 2014-04-09 17:32:20.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/proxy_connectors.py 2017-01-01 23:13:23.000000000 +0100 @@ -27,7 +27,8 @@ import logging log = logging.getLogger('nbxmpp.proxy_connectors') -class ProxyConnector: + +class ProxyConnector(object): """ Interface for proxy-connecting object - when tunnneling XMPP over proxies, some connecting process usually has to be done before opening stream. Proxy @@ -195,7 +196,8 @@ # # Resolve locally # self.ipaddr = socket.inet_aton(socket.gethostbyname(self.xmpp_server[0])) # req = req + "\x01" + ipaddr - req = req + struct.pack(">H", self.xmpp_server[1]) + + req += struct.pack(">H", self.xmpp_server[1]) self.onreceive(self._on_req_sent) self.send(req) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/roster_nb.py new/nbxmpp-0.5.5/nbxmpp/roster_nb.py --- old/nbxmpp-0.5.4/nbxmpp/roster_nb.py 2015-05-10 14:45:29.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/roster_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -74,7 +74,7 @@ roster representation """ sender = stanza.getAttr('from') - if not sender is None and not sender.bareMatch( + if sender is not None and not sender.bareMatch( self._owner.User + '@' + self._owner.Server): return query = stanza.getTag('query') @@ -224,7 +224,7 @@ """ return list(self._data[jid[:(jid+'/').find('/')]]['resources'].keys()) - def setItem(self, jid, name=None, groups=[]): + def setItem(self, jid, name=None, groups=None): """ Rename contact 'jid' and sets the groups list that it now belongs to """ @@ -234,8 +234,9 @@ if name: attrs['name'] = name item = query.setTag('item', attrs) - for group in groups: - item.addChild(node=Node('group', payload=[group])) + if groups is not None: + for group in groups: + item.addChild(node=Node('group', payload=[group])) self._owner.send(iq) def setItemMulti(self, items): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/simplexml.py new/nbxmpp-0.5.5/nbxmpp/simplexml.py --- old/nbxmpp-0.5.4/nbxmpp/simplexml.py 2014-04-24 20:41:09.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/simplexml.py 2017-01-04 14:11:04.000000000 +0100 @@ -92,7 +92,7 @@ FORCE_NODE_RECREATION = 0 - def __init__(self, tag=None, attrs={}, payload=[], parent=None, nsp=None, + def __init__(self, tag=None, attrs=None, payload=None, parent=None, nsp=None, node_built=False, node=None): """ Takes "tag" argument as the name of node (prepended by namespace, if @@ -129,12 +129,15 @@ self.nsp_cache = {} if nsp: for k, v in nsp.items(): self.nsp_cache[k] = v - for attr, val in attrs.items(): - if attr == 'xmlns': - self.nsd[''] = val - elif attr.startswith('xmlns:'): - self.nsd[attr[6:]] = val - self.attrs[attr]=attrs[attr] + + if attrs is not None: + for attr, val in attrs.items(): + if attr == 'xmlns': + self.nsd[''] = val + elif attr.startswith('xmlns:'): + self.nsd[attr[6:]] = val + self.attrs[attr] = attrs[attr] + if tag: if node_built: pfx, self.name = (['']+tag.split(':'))[-2:] @@ -144,13 +147,14 @@ self.namespace, self.name = tag.split() else: self.name = tag - if not isinstance(payload, list): - payload = [payload] - for i in payload: - if isinstance(i, Node): - self.addChild(node=i) - else: - self.data.append(ustr(i)) + if payload is not None: + if not isinstance(payload, list): + payload = [payload] + for i in payload: + if isinstance(i, Node): + self.addChild(node=i) + else: + self.data.append(ustr(i)) def lookup_nsp(self, pfx=''): ns = self.nsd.get(pfx, None) @@ -173,39 +177,53 @@ if self.namespace: if not self.parent or self.parent.namespace!=self.namespace: if 'xmlns' not in self.attrs: - s = s + ' xmlns="%s"'%self.namespace + s += ' xmlns="%s"' % self.namespace for key in self.attrs.keys(): val = ustr(self.attrs[key]) - s = s + ' %s="%s"' % ( key, XMLescape(val) ) - s = s + ">" + s += ' %s="%s"' % (key, XMLescape(val)) + + s += ">" cnt = 0 if self.kids: - if fancy: s = s + "\n" + if fancy: + s += "\n" for a in self.kids: - if not fancy and (len(self.data)-1)>=cnt: s=s+XMLescape(self.data[cnt]) - elif (len(self.data)-1)>=cnt: s=s+XMLescape(self.data[cnt].strip()) + if not fancy and (len(self.data)-1) >= cnt: + s += XMLescape(self.data[cnt]) + elif (len(self.data)-1) >= cnt: + s += XMLescape(self.data[cnt].strip()) if isinstance(a, str): - s = s + a.__str__() + s += a.__str__() else: - s = s + a.__str__(fancy and fancy+1) - cnt=cnt+1 - if not fancy and (len(self.data)-1) >= cnt: s = s + XMLescape(self.data[cnt]) - elif (len(self.data)-1) >= cnt: s = s + XMLescape(self.data[cnt].strip()) + s += a.__str__(fancy and fancy+1) + cnt += 1 + if not fancy and (len(self.data)-1) >= cnt: + s += XMLescape(self.data[cnt]) + elif (len(self.data)-1) >= cnt: + s += XMLescape(self.data[cnt].strip()) if not self.kids and s.endswith('>'): - s=s[:-1]+' />' - if fancy: s = s + "\n" + s = s[:-1] + ' />' + if fancy: + s += "\n" else: - if fancy and not self.data: s = s + (fancy-1) * 2 * ' ' - s = s + "</" + self.name + ">" - if fancy: s = s + "\n" + if fancy and not self.data: + s += (fancy-1) * 2 * ' ' + s += "</" + self.name + ">" + if fancy: + s += "\n" return s - def addChild(self, name=None, attrs={}, payload=[], namespace=None, node=None): + def addChild(self, name=None, attrs=None, payload=None, namespace=None, node=None): """ If "node" argument is provided, adds it as child node. Else creates new node from the other arguments' values and adds it as well """ - if 'xmlns' in attrs: + if payload is None: + payload = [] + + if attrs is None: + attrs = {} + elif 'xmlns' in attrs: raise AttributeError("Use namespace=x instead of attrs={'xmlns':x}") if node: newnode=node @@ -234,7 +252,7 @@ """ del self.attrs[key] - def delChild(self, node, attrs={}): + def delChild(self, node, attrs=None): """ Delete the "node" from the node's childs list, if "node" is an instance. Else delete the first node that have specified name and (optionally) @@ -306,7 +324,7 @@ pass return ret - def getTag(self, name, attrs={}, namespace=None): + def getTag(self, name, attrs=None, namespace=None): """ Filter all child nodes using specified arguments as filter. Return the first found or None if not found @@ -332,7 +350,7 @@ except Exception: return None - def getTags(self, name, attrs={}, namespace=None, one=0): + def getTags(self, name, attrs=None, namespace=None, one=0): """ Filter all child nodes using specified arguments as filter. Returns the list of nodes found @@ -342,6 +360,8 @@ if namespace and namespace != node.getNamespace(): continue if node.getName() == name: + if attrs is None: + attrs = {} for key in attrs.keys(): if key not in node.attrs or node.attrs[key]!=attrs[key]: break @@ -352,7 +372,7 @@ if not one: return nodes - def iterTags(self, name, attrs={}, namespace=None): + def iterTags(self, name, attrs=None, namespace=None): """ Iterate over all children using specified arguments as filter """ @@ -360,6 +380,8 @@ if namespace is not None and namespace != node.getNamespace(): continue if node.getName() == name: + if attrs is None: + attrs = {} for key in attrs.keys(): if key not in node.attrs or \ node.attrs[key]!=attrs[key]: @@ -412,7 +434,7 @@ else: self.kids = payload - def setTag(self, name, attrs={}, namespace=None): + def setTag(self, name, attrs=None, namespace=None): """ Same as getTag but if the node with specified namespace/attributes not found, creates such node and returns it @@ -433,7 +455,7 @@ except Exception: self.addChild(tag, attrs={attr: val}) - def setTagData(self, tag, val, attrs={}): + def setTagData(self, tag, val, attrs=None): """ Creates new node (if not already present) with name "tag" and (optionally) attributes "attrs" and sets it's CDATA to string "val" @@ -485,7 +507,8 @@ return self.NT raise AttributeError -class T: + +class T(object): """ Auxiliary class used to quick access to node's child nodes """ @@ -519,7 +542,8 @@ else: return self.node.addChild(attr, payload=[val]) -class NodeBuilder: + +class NodeBuilder(object): """ Builds a Node class minidom from data parsed to it. This class used for two purposes: @@ -587,7 +611,7 @@ """ self.check_data_buffer() self._inc_depth() - log.info("STARTTAG.. DEPTH -> %i , tag -> %s, attrs -> %s" % (self.__depth, tag, attrs)) + log.debug("STARTTAG.. DEPTH -> %i , tag -> %s, attrs -> %s" % (self.__depth, tag, attrs)) if self.__depth == self._dispatch_depth: if not self._mini_dom : self._mini_dom = Node(tag=tag, attrs=attrs, nsp = self._document_nsp, node_built=True) @@ -622,7 +646,7 @@ """ XML Parser callback. Used internally """ - log.info("DEPTH -> %i , tag -> %s" % (self.__depth, tag)) + log.debug("DEPTH -> %i , tag -> %s" % (self.__depth, tag)) self.check_data_buffer() if self.__depth == self._dispatch_depth: if self._mini_dom.getName() == 'error': @@ -635,7 +659,7 @@ elif self.__depth > self._dispatch_depth: self._ptr = self._ptr.parent else: - log.info("Got higher than dispatch level. Stream terminated?") + log.debug("Got higher than dispatch level. Stream terminated?") self._dec_depth() self.last_is_data = 0 if self.__depth == 0: self.stream_footer_received() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/smacks.py new/nbxmpp-0.5.5/nbxmpp/smacks.py --- old/nbxmpp-0.5.4/nbxmpp/smacks.py 2015-12-17 19:42:45.000000000 +0100 +++ new/nbxmpp-0.5.5/nbxmpp/smacks.py 2017-01-01 23:13:23.000000000 +0100 @@ -3,14 +3,15 @@ import logging log = logging.getLogger('nbxmpp.smacks') -class Smacks(): - ''' + +class Smacks(object): + """ This is Smacks is the Stream Management class. It takes care of requesting and sending acks. Also, it keeps track of the unhandled outgoing stanzas. The dispatcher has to be able to access this class to increment the number of handled stanzas - ''' + """ def __init__(self, con): self.con = con # Connection object @@ -94,11 +95,11 @@ self._owner.Connection.send(r, False) def check_ack(self, disp, stanza): - ''' + """ Checks if the number of stanzas sent are the same as the number of stanzas received by the server. Pops stanzas that were handled by the server from the queue. - ''' + """ h = stanza.getAttr('h') if not h: log.error('Server did not send h attribute') @@ -118,11 +119,11 @@ self.uqueue.pop(0) def check_resume(self, disp, stanza): - ''' + """ Checks if the number of stanzas sent are the same as the number of stanzas received by the server. Resends stanzas not received by the server in the last session. - ''' + """ h = stanza.getAttr('h') if not h: log.error('Server did not send h attribute') @@ -143,7 +144,7 @@ self.enabled = True self.resuming = True self.con.set_oldst() - if self.old_uqueue != []: + if self.old_uqueue: log.info('Session resumed, replaying %s stanzas...' % len(self.old_uqueue)) for i in self.old_uqueue: self._owner.Connection.send(i, False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/stringprepare.py new/nbxmpp-0.5.5/nbxmpp/stringprepare.py --- old/nbxmpp-0.5.4/nbxmpp/stringprepare.py 2014-10-04 22:10:11.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/stringprepare.py 2017-01-01 23:13:23.000000000 +0100 @@ -25,7 +25,8 @@ import unicodedata from encodings import idna -class ILookupTable: + +class ILookupTable(object): """ Interface for character lookup classes """ @@ -36,7 +37,8 @@ """ pass -class IMappingTable: + +class IMappingTable(object): """ Interface for character mapping classes """ @@ -47,15 +49,15 @@ """ pass -class LookupTableFromFunction: +class LookupTableFromFunction(object): __implements__ = ILookupTable def __init__(self, in_table_function): self.lookup = in_table_function -class LookupTable: +class LookupTable(object): __implements__ = ILookupTable def __init__(self, table): @@ -64,15 +66,15 @@ def lookup(self, c): return c in self._table -class MappingTableFromFunction: +class MappingTableFromFunction(object): __implements__ = IMappingTable def __init__(self, map_table_function): self.map = map_table_function -class EmptyMappingTable: +class EmptyMappingTable(object): __implements__ = IMappingTable def __init__(self, in_table_function): @@ -84,12 +86,22 @@ else: return c -class Profile: - def __init__(self, mappings=[], normalize=True, prohibiteds=[], - check_unassigneds=True, check_bidi=True): - self.mappings = mappings + +class Profile(object): + def __init__(self, mappings=None, normalize=True, prohibiteds=None, + check_unassigneds=True, check_bidi=True): + if mappings is None: + self.mappings = [] + else: + self.mappings = mappings + self.normalize = normalize - self.prohibiteds = prohibiteds + + if prohibiteds is None: + self.prohibiteds = [] + else: + self.prohibiteds = prohibiteds + self.do_check_unassigneds = check_unassigneds self.do_check_bidi = check_bidi @@ -149,7 +161,7 @@ raise UnicodeError("Violation of BIDI Requirement 3") -class NamePrep: +class NamePrep(object): """ Implements preparation of internationalized domain names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/tls_nb.py new/nbxmpp-0.5.5/nbxmpp/tls_nb.py --- old/nbxmpp-0.5.4/nbxmpp/tls_nb.py 2016-04-02 17:59:03.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/tls_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -56,7 +56,7 @@ return default -class SSLWrapper: +class SSLWrapper(object): """ Abstract SSLWrapper base class """ @@ -120,7 +120,8 @@ if self.exc_str: if self.strerror: s += "(%s)" % self.exc_str - else: s += "(%s)" % str(self.exc_args) + else: + s += "(%s)" % str(self.exc_args) return s def __init__(self, sslobj, sock=None): @@ -157,7 +158,7 @@ self.parent.__init__(self, *args) def is_numtoolarge(self, e): - ''' Magic methods don't need documentation ''' + """ Magic methods don't need documentation """ t = ('asn1 encoding routines', 'a2d_ASN1_OBJECT', 'first num too large') return (isinstance(e.args, (list, tuple)) and len(e.args) == 1 and isinstance(e.args[0], (list, tuple)) and len(e.args[0]) == 2 and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/nbxmpp/transports_nb.py new/nbxmpp-0.5.5/nbxmpp/transports_nb.py --- old/nbxmpp-0.5.4/nbxmpp/transports_nb.py 2016-07-04 21:48:04.000000000 +0200 +++ new/nbxmpp-0.5.5/nbxmpp/transports_nb.py 2017-01-01 23:13:23.000000000 +0100 @@ -583,7 +583,7 @@ except UnicodeDecodeError: for i in range(-1, -4, -1): char = sent_data[i] - if char & 0xc0 == 0xc0: + if ord(char) & 0xc0 == 0xc0: self.sent_bytes_buff = sent_data[i:] sent_data = sent_data[:i] break @@ -794,7 +794,7 @@ headers.append('Connection: Keep-Alive') headers.append('\r\n') headers = '\r\n'.join(headers) - return('%s%s' % (headers, httpbody)) + return '%s%s' % (headers, httpbody) def parse_http_message(self, message): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbxmpp-0.5.4/setup.py new/nbxmpp-0.5.5/setup.py --- old/nbxmpp-0.5.4/setup.py 2016-09-04 13:48:08.000000000 +0200 +++ new/nbxmpp-0.5.5/setup.py 2017-01-30 22:40:36.000000000 +0100 @@ -3,10 +3,10 @@ from distutils.core import setup setup(name='nbxmpp', - version='0.5.4', + version='0.5.5', description='Non blocking Jabber/XMPP module', author='Yann Leboulanger', author_email='[email protected]', - url='http://python-nbxmpp.gajim.org', + url='http://dev.gajim.org/gajim/python-nbxmpp', packages=['nbxmpp'], )
