Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
279ec6b8 by Thilo Molitor at 2017-02-13T23:11:54+01:00
Fix smacks delayed tag addition.
Only add delayed tag to stanzas saved into smacks queue, not to the ones
send out directly.
- - - - -
027b7a30 by Thilo Molitor at 2017-02-13T23:11:54+01:00
Fix bug in failed smacks resumption
Extract correct h value when session resumption failed.
Add some more logging output.
- - - - -
ed4a9e05 by Philipp Hörist at 2017-02-13T23:15:43+01:00
Merge branch 'smacks_rev_1.5' into 'master'
Fix smacks delayed tag addition.
See merge request !3
- - - - -
2 changed files:
- nbxmpp/dispatcher_nb.py
- nbxmpp/smacks.py
Changes:
=====================================
nbxmpp/dispatcher_nb.py
=====================================
--- a/nbxmpp/dispatcher_nb.py
+++ b/nbxmpp/dispatcher_nb.py
@@ -27,6 +27,7 @@ import time
import locale
import re
import uuid
+import copy
from xml.parsers.expat import ExpatError
from .plugin import PlugIn
from .protocol import (NS_DELAY2, NS_STREAMS, NS_XMPP_STREAMS, NS_HTTP_BIND, Iq, Presence,
@@ -572,14 +573,15 @@ class XMPPDispatcher(PlugIn):
# If no ID then it is a whitespace
if self.sm and self.sm.enabled and ID:
+ stanza_copy = copy.deepcopy(stanza)
# add timestamp to message stanza in queue
- if stanza.getName() == 'message' and \
- (stanza.getType() == 'chat' or stanza.getType() == 'groupchat'):
- our_jid = stanza.getAttr('from')
+ if stanza_copy.getName() == 'message' and \
+ (stanza_copy.getType() == 'chat' or stanza_copy.getType() == 'groupchat'):
+ our_jid = stanza_copy.getAttr('from')
timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(None))
- stanza.addChild('delay', namespace=NS_DELAY2,
- attrs={'from': our_jid, 'stamp': timestamp})
- self.sm.uqueue.append(stanza)
+ stanza_copy.addChild('delay', namespace=NS_DELAY2,
+ attrs={'from': our_jid or "Gajim", 'stamp': timestamp})
+ self.sm.uqueue.append(stanza_copy)
self.sm.out_h += 1
self._owner.Connection.send(stanza, now)
=====================================
nbxmpp/smacks.py
=====================================
--- a/nbxmpp/smacks.py
+++ b/nbxmpp/smacks.py
@@ -124,13 +124,13 @@ class Smacks(object):
diff = self.out_h - h
if diff < 0:
- log.error('Server and client number of stanzas handled mismatch (our h: %d, server h: %d)' % (self.out_h, h))
+ log.error('Server and client number of stanzas handled mismatch (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.uqueue)))
while (len(self.uqueue)): #don't accumulate all messages in this case (they would otherwise all be resent on the next reconnect)
self.uqueue.pop(0)
elif len(self.uqueue) < diff:
- log.error('Server and client number of stanzas handled mismatch (our h: %d, server h: %d)' % (self.out_h, h))
+ log.error('Server and client number of stanzas handled mismatch (our h: %d, server h: %d, #queue: %d)' % (self.out_h, h, len(self.uqueue)))
else:
- log.debug('Got ack for outgoing stanzas (our h: %d, server h: %d), removing %d messages from queue...' % (self.out_h, h, len(self.uqueue) - diff))
+ log.debug('Got ack for outgoing stanzas (our h: %d, server h: %d, #queue: %d), removing %d messages from queue...' % (self.out_h, h, len(self.uqueue), len(self.uqueue) - diff))
while (len(self.uqueue) > diff):
self.uqueue.pop(0)
@@ -149,12 +149,12 @@ class Smacks(object):
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)' % (self.out_h, h))
+ 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)' % (self.out_h, h))
+ 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, remaining in queue: %d)' % (len(self.old_uqueue) - diff, self.out_h, h, diff))
+ 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)
@@ -178,7 +178,7 @@ class Smacks(object):
self._owner._on_auth_bind(None)
self.failed_resume = True
- h = stanza.getTag('item-not-found').getAttr('h')
+ h = stanza.getAttr('h')
log.info('Session resumption failed (item-not-found), server h: %s' % str(h))
if not h:
return
@@ -187,12 +187,12 @@ class Smacks(object):
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)' % (self.out_h, h))
+ 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)' % (self.out_h, h))
+ 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, remaining in queue: %d)' % (len(self.old_uqueue) - diff, self.out_h, h, diff))
+ 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
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/8f1c3b113c75f1f81fcdd8807…
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
171bac23 by Philipp Hörist at 2017-02-13T00:18:28+01:00
Save own full jid
- - - - -
8f1c3b11 by Philipp Hörist at 2017-02-13T22:45:15+01:00
Merge branch 'master' into 'master'
Save own full jid
See merge request !4
- - - - -
1 changed file:
- nbxmpp/auth_nb.py
Changes:
=====================================
nbxmpp/auth_nb.py
=====================================
--- a/nbxmpp/auth_nb.py
+++ b/nbxmpp/auth_nb.py
@@ -731,6 +731,7 @@ class NonBlockingBind(PlugIn):
self.bound.append(resp.getTag('bind').getTagData('jid'))
log.info('Successfully bound %s.' % self.bound[-1])
jid = JID(resp.getTag('bind').getTagData('jid'))
+ self._owner._registered_name = jid
self._owner.User = jid.getNode()
self._owner.Resource = jid.getResource()
# Only negociate stream management after bounded
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/5c2c0b22f09c8bc541046f91f…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
aaef09fc by Philipp Hörist at 2017-02-12T16:45:56+01:00
Remove old gtk2 code
- - - - -
2a599d1e by Philipp Hörist at 2017-02-12T16:45:56+01:00
Fix constants usage in history manager
- - - - -
eec1a69e by Philipp Hörist at 2017-02-12T16:50:28+01:00
Merge branch 'history-manager' into 'master'
History manager fixes
See merge request !57
- - - - -
1 changed file:
- src/history_manager.py
Changes:
=====================================
src/history_manager.py
=====================================
--- a/src/history_manager.py
+++ b/src/history_manager.py
@@ -29,24 +29,6 @@
## the same can be said for history_window.py
import os
-
-if os.name == 'nt':
- import warnings
- warnings.filterwarnings(action='ignore')
-
- if os.path.isdir('gtk'):
- # Used to create windows installer with GTK included
- paths = os.environ['PATH']
- list_ = paths.split(';')
- new_list = []
- for p in list_:
- if p.find('gtk') < 0 and p.find('GTK') < 0:
- new_list.append(p)
- new_list.insert(0, 'gtk/lib')
- new_list.insert(0, 'gtk/bin')
- os.environ['PATH'] = ';'.join(new_list)
- os.environ['GTK_BASEPATH'] = 'gtk'
-
import sys
import signal
import gi
@@ -91,11 +73,7 @@ common.configpaths.gajimpaths.init(config_path)
del config_path
from common import gajim
import gtkgui_helpers
-from common.logger import LOG_DB_PATH, constants
-
-#FIXME: constants should implement 2 way mappings
-status = dict((constants.__dict__[i], i[5:].lower()) for i in \
- constants.__dict__.keys() if i.startswith('SHOW_'))
+from common.logger import LOG_DB_PATH, JIDConstant, KindConstant
from common import helpers
import dialogs
@@ -342,7 +320,7 @@ class HistoryManager:
possible_room_jid = jid.split('/', 1)[0]
self.cur.execute('SELECT jid_id FROM jids WHERE jid = ? AND type = ?',
- (possible_room_jid, constants.JID_ROOM_TYPE))
+ (possible_room_jid, JIDConstant.ROOM_TYPE))
row = self.cur.fetchone()
if row is None:
return False
@@ -357,7 +335,7 @@ class HistoryManager:
row = self.cur.fetchone()
if row is None:
raise
- elif row[0] == constants.JID_ROOM_TYPE:
+ elif row[0] == JIDConstant.ROOM_TYPE:
return True
else: # normal type
return False
@@ -399,15 +377,15 @@ class HistoryManager:
pass
else:
color = None
- if kind in (constants.KIND_SINGLE_MSG_RECV,
- constants.KIND_CHAT_MSG_RECV, constants.KIND_GC_MSG):
+ if kind in (KindConstant.SINGLE_MSG_RECV,
+ KindConstant.CHAT_MSG_RECV, KindConstant.GC_MSG):
# it is the other side
color = gajim.config.get('inmsgcolor') # so incoming color
- elif kind in (constants.KIND_SINGLE_MSG_SENT,
- constants.KIND_CHAT_MSG_SENT): # it is us
+ elif kind in (KindConstant.SINGLE_MSG_SENT,
+ KindConstant.CHAT_MSG_SENT): # it is us
color = gajim.config.get('outmsgcolor') # so outgoing color
- elif kind in (constants.KIND_STATUS,
- constants.KIND_GCSTATUS): # is is statuses
+ elif kind in (KindConstant.STATUS,
+ KindConstant.GCSTATUS): # is is statuses
# so status color
color = gajim.config.get('statusmsgcolor')
# include status into (status) message
@@ -540,13 +518,13 @@ class HistoryManager:
# in store: time, kind, message, contact_name FROM logs
# in text: JID or You or nickname (if it's gc_msg), time, message
time_, kind, message, nickname = row
- if kind in (constants.KIND_SINGLE_MSG_RECV,
- constants.KIND_CHAT_MSG_RECV):
+ if kind in (KindConstant.SINGLE_MSG_RECV,
+ KindConstant.CHAT_MSG_RECV):
who = self._get_jid_from_jid_id(jid_id)
- elif kind in (constants.KIND_SINGLE_MSG_SENT,
- constants.KIND_CHAT_MSG_SENT):
+ elif kind in (KindConstant.SINGLE_MSG_SENT,
+ KindConstant.CHAT_MSG_SENT):
who = _('You')
- elif kind == constants.KIND_GC_MSG:
+ elif kind == KindConstant.GC_MSG:
who = nickname
else: # status or gc_status. do not save
#print kind
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/7814f07bd3fae75d76e29bd1229d6a49b…
Yann Leboulanger pushed to branch master at gajim / gajim
Commits:
f5eb35cb by Johannes 'josch' Schauer at 2017-02-11T20:05:30+01:00
Use more gender neutral language
- - - - -
c8e03993 by Yann Leboulanger at 2017-02-11T21:16:26+01:00
Merge branch 'master' into 'master'
Use more gender neutral language
See merge request !55
- - - - -
3 changed files:
- src/chat_control.py
- src/gui_interface.py
- src/roster_window.py
Changes:
=====================================
src/chat_control.py
=====================================
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -429,7 +429,7 @@ class ChatControl(ChatControlBase):
else:
self._send_file_button.set_tooltip_text(
_("You need to know the real JID of the contact to send "
- "him or her a file."))
+ "them a file."))
# Convert to GC
if gajim.config.get_per('accounts', self.account, 'is_zeroconf'):
=====================================
src/gui_interface.py
=====================================
--- a/src/gui_interface.py
+++ b/src/gui_interface.py
@@ -520,8 +520,8 @@ class Interface:
list_ = [(contact, account)]
dialogs.YesNoDialog(
_('Contact "%s" removed subscription from you') % contact.jid,
- _('You will always see him or her as offline.\nDo you want to '
- 'remove him or her from your contact list?'),
+ _('You will always see them as offline.\nDo you want to '
+ 'remove them from your contact list?'),
on_response_yes=(on_yes, list_))
# FIXME: Per RFC 3921, we can "deny" ack as well, but the GUI does
# not show deny
=====================================
src/roster_window.py
=====================================
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -3575,7 +3575,7 @@ class RosterWindow:
if contact.sub == 'to':
dialogs.ConfirmationDialog(pritext, sectext + \
_('By removing this contact you also remove authorization '
- 'resulting in him or her always seeing you as offline.'),
+ 'resulting in them always seeing you as offline.'),
on_response_ok=(on_ok2, list_))
elif _('Not in Roster') in contact.get_shown_groups():
# Contact is not in roster
@@ -3585,7 +3585,7 @@ class RosterWindow:
else:
dialogs.ConfirmationDialogCheck(pritext, sectext + \
_('By removing this contact you also by default remove '
- 'authorization resulting in him or her always seeing you as'
+ 'authorization resulting in them always seeing you as'
' offline.'),
_('I want this contact to know my status after removal'),
on_response_ok=(on_ok, list_))
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/26aa0382d31e4264157b6665ae6cf7ebb…