Philipp Hörist pushed to branch nbxmpp_0.6 at gajim / python-nbxmpp
Commits:
a85b5376 by Philipp Hörist at 2019-01-08T18:23:49Z
Dont try to guess system language
getdefaultlocale() is not a good way for determining the users configured language
Let the client figure it out and pass it to nbxmpp
- - - - -
9f7a5212 by Philipp Hörist at 2019-01-08T18:59:00Z
Always bind after sm resume fails
- - - - -
82764c3a by Philipp Hörist at 2019-01-08T18:59:59Z
Update .gitignore
- - - - -
5 changed files:
- .gitignore
- nbxmpp/bosh.py
- nbxmpp/client_nb.py
- nbxmpp/dispatcher_nb.py
- nbxmpp/smacks.py
Changes:
=====================================
.gitignore
=====================================
@@ -1,2 +1,4 @@
build/
__pycache__/
+dist/
+nbxmpp.egg-info/
\ No newline at end of file
=====================================
nbxmpp/bosh.py
=====================================
@@ -44,10 +44,7 @@ class NonBlockingBOSH(NonBlockingTransport):
idlequeue, estabilish_tls, certs, tls_version, cipher_list)
self.bosh_sid = None
- if locale.getdefaultlocale()[0]:
- self.bosh_xml_lang = locale.getdefaultlocale()[0].split('_')[0]
- else:
- self.bosh_xml_lang = 'en'
+ self.bosh_xml_lang = self._owner.lang
self.http_version = 'HTTP/1.1'
self.http_persistent = True
=====================================
nbxmpp/client_nb.py
=====================================
@@ -37,7 +37,7 @@ class NonBlockingClient(object):
handling, whereas underlying modules take care of feature-specific logic
"""
- def __init__(self, domain, idlequeue, caller=None):
+ def __init__(self, domain, idlequeue, caller=None, lang='en'):
"""
Caches connection data
@@ -48,6 +48,7 @@ class NonBlockingClient(object):
"""
self.Namespace = protocol.NS_CLIENT
self.defaultNamespace = self.Namespace
+ self.lang = lang
self.idlequeue = idlequeue
self.disconnect_handlers = []
=====================================
nbxmpp/dispatcher_nb.py
=====================================
@@ -194,9 +194,7 @@ class XMPPDispatcher(PlugIn):
self._metastream.setAttr('version', '1.0')
self._metastream.setAttr('xmlns:stream', NS_STREAMS)
self._metastream.setAttr('to', self._owner.Server)
- if locale.getdefaultlocale()[0]:
- self._metastream.setAttr('xml:lang',
- locale.getdefaultlocale()[0].split('_')[0])
+ self._metastream.setAttr('xml:lang', self._owner.lang)
self._owner.send("%s%s>" % (XML_DECLARATION, str(self._metastream)[:-2]))
def _check_stream_start(self, ns, tag, attrs):
@@ -623,9 +621,7 @@ class BOSHDispatcher(XMPPDispatcher):
self._metastream.setAttr('version', '1.0')
self._metastream.setAttr('xmlns:stream', NS_STREAMS)
self._metastream.setAttr('to', self._owner.Server)
- if locale.getdefaultlocale()[0]:
- self._metastream.setAttr('xml:lang',
- locale.getdefaultlocale()[0].split('_')[0])
+ self._metastream.setAttr('xml:lang', self._owner.lang)
self.restart = True
self._owner.Connection.send_init(after_SASL=self.after_SASL)
=====================================
nbxmpp/smacks.py
=====================================
@@ -184,43 +184,36 @@ class Smacks(object):
self.old_uqueue = []
def error_handling(self, disp, stanza):
- # If the server doesn't recognize previd, forget about resuming
- # Ask for service discovery, etc..
- if stanza.getTag('item-not-found'):
- self.resuming = False
- self.enabled = False
- # we need to bind a resource
- self._owner.NonBlockingBind.resuming = False
- self._owner.Dispatcher.Event(NS_STREAM_MGMT, 'RESUME FAILED', None)
- self._owner._on_auth_bind(None)
- self.failed_resume = True
-
- h = stanza.getAttr('h')
- log.info('Session resumption failed (item-not-found), server h: %s' % str(h))
- if not h:
- return
- #prepare old_queue to contain only unacked stanzas for later resend (which is happening after our session is established properly)
- h = int(h)
- diff = self.out_h - h
-
- if diff < 0:
- log.error('Server and client number of stanzas handled mismatch on session resumption (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.old_uqueue)))
- self.old_uqueue = [] #that's weird, but we don't resend this stanzas if the server says we don't need to
- elif len(self.old_uqueue) < diff:
- log.error('Server and client number of stanzas handled mismatch on session resumption (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.old_uqueue)))
- else:
- log.info('Removing %d already acked stanzas from old outgoing queue (our h: %d, server h: %d, #queue: %d, remaining in queue: %d)' % (len(self.old_uqueue) - diff, self.out_h, h, len(self.old_uqueue), diff))
- while (len(self.old_uqueue) > diff):
- self.old_uqueue.pop(0)
- return
-
# Doesn't support resumption
if stanza.getTag('feature-not-implemented'):
log.info('Session resumption failed (feature-not-implemented)')
self.negociate(False)
return
- if stanza.getTag('unexpected-request'):
- log.error('Gajim failed to negociate Stream Management')
- self.enabled = False
+ # If the server doesn't recognize previd, forget about resuming
+ # Ask for service discovery, etc..
+ self.resuming = False
+ self.enabled = False
+ # we need to bind a resource
+ self._owner.NonBlockingBind.resuming = False
+ self._owner.Dispatcher.Event(NS_STREAM_MGMT, 'RESUME FAILED', None)
+ self._owner._on_auth_bind(None)
+ self.failed_resume = True
+
+ h = stanza.getAttr('h')
+ log.info('Session resumption failed, server h: %s' % str(h))
+ if not h:
return
+ #prepare old_queue to contain only unacked stanzas for later resend (which is happening after our session is established properly)
+ h = int(h)
+ diff = self.out_h - h
+
+ if diff < 0:
+ log.error('Server and client number of stanzas handled mismatch on session resumption (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.old_uqueue)))
+ self.old_uqueue = [] #that's weird, but we don't resend this stanzas if the server says we don't need to
+ elif len(self.old_uqueue) < diff:
+ log.error('Server and client number of stanzas handled mismatch on session resumption (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.old_uqueue)))
+ else:
+ log.info('Removing %d already acked stanzas from old outgoing queue (our h: %d, server h: %d, #queue: %d, remaining in queue: %d)' % (len(self.old_uqueue) - diff, self.out_h, h, len(self.old_uqueue), diff))
+ while (len(self.old_uqueue) > diff):
+ self.old_uqueue.pop(0)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/3e4c66556bb830556b16ffae0…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/3e4c66556bb830556b16ffae0…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
dad671c1 by Philipp Hörist at 2019-01-07T22:52:51Z
Remove unused import
- - - - -
1 changed file:
- gajim/common/modules/muc.py
Changes:
=====================================
gajim/common/modules/muc.py
=====================================
@@ -23,7 +23,6 @@ from nbxmpp.const import InviteType
from nbxmpp.const import PresenceType
from nbxmpp.structs import StanzaHandler
-from gajim.common import i18n
from gajim.common import app
from gajim.common import helpers
from gajim.common.const import KindConstant
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dad671c1c72fe6b03ec2f98de4729f3f1d…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dad671c1c72fe6b03ec2f98de4729f3f1d…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
3b46b522 by Philipp Hörist at 2019-01-07T22:34:43Z
Dont set xml:lang for muc config
xml:lang we set on the stream is inherited
- - - - -
97f5f4a2 by Philipp Hörist at 2019-01-07T22:42:11Z
Raise version to 0.9.90.4
- - - - -
2 changed files:
- nbxmpp/__init__.py
- nbxmpp/modules/muc.py
Changes:
=====================================
nbxmpp/__init__.py
=====================================
@@ -15,4 +15,4 @@ from .client_nb import NonBlockingClient
from .plugin import PlugIn
from .smacks import Smacks
-__version__ = "0.9.90.3"
+__version__ = "0.9.90.4"
=====================================
nbxmpp/modules/muc.py
=====================================
@@ -354,11 +354,10 @@ class MUC:
return iq
@call_on_response('_config_received')
- def request_config(self, room_jid, lang):
+ def request_config(self, room_jid):
iq = Iq(typ='get',
queryNS=NS_MUC_OWNER,
to=room_jid)
- iq.setAttr('xml:lang', lang)
log.info('Request config for %s', room_jid)
return iq
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/1db41e016b94b22d89397a14f…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/1db41e016b94b22d89397a14f…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
1db41e01 by Philipp Hörist at 2019-01-07T22:23:22Z
Dont try to guess system language
getdefaultlocale() is not a good way for determining the users configured language
Let the client figure it out and pass it to nbxmpp
- - - - -
3 changed files:
- nbxmpp/bosh.py
- nbxmpp/client_nb.py
- nbxmpp/dispatcher_nb.py
Changes:
=====================================
nbxmpp/bosh.py
=====================================
@@ -45,10 +45,7 @@ class NonBlockingBOSH(NonBlockingTransport):
idlequeue, estabilish_tls, certs, tls_version, cipher_list)
self.bosh_sid = None
- if locale.getdefaultlocale()[0]:
- self.bosh_xml_lang = locale.getdefaultlocale()[0].split('_')[0]
- else:
- self.bosh_xml_lang = 'en'
+ self.bosh_xml_lang = self._owner.lang
self.http_version = 'HTTP/1.1'
self.http_persistent = True
=====================================
nbxmpp/client_nb.py
=====================================
@@ -42,7 +42,7 @@ class NonBlockingClient:
handling, whereas underlying modules take care of feature-specific logic
"""
- def __init__(self, domain, idlequeue, caller=None):
+ def __init__(self, domain, idlequeue, caller=None, lang='en'):
"""
Caches connection data
@@ -50,9 +50,11 @@ class NonBlockingClient:
:param idlequeue: processing idlequeue
:param caller: calling object - it has to implement methods
_event_dispatcher which is called from dispatcher instance
+ :param lang: the preferred stream language
"""
self.Namespace = protocol.NS_CLIENT
self.defaultNamespace = self.Namespace
+ self.lang = lang
self.idlequeue = idlequeue
self.disconnect_handlers = []
=====================================
nbxmpp/dispatcher_nb.py
=====================================
@@ -239,9 +239,7 @@ class XMPPDispatcher(PlugIn):
self._metastream.setAttr('version', '1.0')
self._metastream.setAttr('xmlns:stream', NS_STREAMS)
self._metastream.setAttr('to', self._owner.Server)
- if locale.getdefaultlocale()[0]:
- self._metastream.setAttr('xml:lang',
- locale.getdefaultlocale()[0].split('_')[0])
+ self._metastream.setAttr('xml:lang', self._owner.lang)
self._owner.send("%s%s>" % (XML_DECLARATION, str(self._metastream)[:-2]))
def _check_stream_start(self, ns, tag, attrs):
@@ -703,9 +701,7 @@ class BOSHDispatcher(XMPPDispatcher):
self._metastream.setAttr('version', '1.0')
self._metastream.setAttr('xmlns:stream', NS_STREAMS)
self._metastream.setAttr('to', self._owner.Server)
- if locale.getdefaultlocale()[0]:
- self._metastream.setAttr('xml:lang',
- locale.getdefaultlocale()[0].split('_')[0])
+ self._metastream.setAttr('xml:lang', self._owner.lang)
self.restart = True
self._owner.Connection.send_init(after_SASL=self.after_SASL)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/1db41e016b94b22d89397a14f0…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/1db41e016b94b22d89397a14f0…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
9879722d by Philipp Hörist at 2019-01-07T21:23:37Z
Update CONTRIBUTING.md
- - - - -
1 changed file:
- CONTRIBUTING.md
Changes:
=====================================
CONTRIBUTING.md
=====================================
@@ -2,6 +2,7 @@
If you want to create a fork and use an external account (Github, Google) drop us a message at the Gajim support [group chat](xmpp:gajim@conference.gajim.org?join) so we can give you the necessary rights
- master - Development branch
+- gajim_1.1 - Stable Gajim 1.1.x branch
- gajim_1.0 - Stable Gajim 1.0.x branch
- gajim_0.16 - Stable Gajim 0.16.x branch
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/9879722d427317a431914c347d67857b9b…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/9879722d427317a431914c347d67857b9b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
a917ea18 by Philipp Hörist at 2019-01-07T21:22:39Z
Update CONTRIBUTING.md
- - - - -
1 changed file:
- CONTRIBUTING.md
Changes:
=====================================
CONTRIBUTING.md
=====================================
@@ -1,5 +1,5 @@
-If you want to create a fork and use an external account (Github, Google) drop us a message at gajim(a)conference.gajim.org so we can give you the necessary rights
+If you want to create a fork and use an external account (Github, Google) drop us a message at the Gajim support [group chat](xmpp:gajim@conference.gajim.org?join) so we can give you the necessary rights
- master - Development branch
- gajim_1.0 - Stable Gajim 1.0.x branch
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a917ea18e25f5319c0c9c688cb1ae13b8e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a917ea18e25f5319c0c9c688cb1ae13b8e…
You're receiving this email because of your account on dev.gajim.org.