changeset 2dc8e77a80e5 in /home/hg/repos/gajim-plugins
author: tmolitor <thilo(a)eightysoft.de>
branches:
details:gajim-plugins?cmd=changeset;node=2dc8e77a80e5
description: Added new (better) sorting to the twemoji resized package
diffstat:
emoticons_pack/contents.ini | 1 +
emoticons_pack/emoticons_pack.zip | Bin
emoticons_pack/manifest.ini | 2 +-
3 files changed, 2 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r e43eec160b86 -r 2dc8e77a80e5 emoticons_pack/contents.ini
--- a/emoticons_pack/contents.ini Thu Dec 17 00:28:18 2015 +0100
+++ b/emoticons_pack/contents.ini Sat Dec 19 02:26:57 2015 +0100
@@ -114,6 +114,7 @@
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
The size of this Emojis is 24px and thus a bit more usable than those of the Twemoji packet (having a size of 48px)<br/>
+ Also the sorting is more intuitive (displaying all important emojis at the top of the emoticons dropdown).<br />
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/TwemojiResized
diff -r e43eec160b86 -r 2dc8e77a80e5 emoticons_pack/emoticons_pack.zip
Binary file emoticons_pack/emoticons_pack.zip has changed
diff -r e43eec160b86 -r 2dc8e77a80e5 emoticons_pack/manifest.ini
--- a/emoticons_pack/manifest.ini Thu Dec 17 00:28:18 2015 +0100
+++ b/emoticons_pack/manifest.ini Sat Dec 19 02:26:57 2015 +0100
@@ -1,7 +1,7 @@
[info]
name: Emoticons pack
short_name: emoticons_pack
-version: 0.1.2
+version: 0.1.3
description: Install, update and view detailed legend of emoticons
authors: Denis Fomin <fominde(a)gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/
changeset 8c4514e0a423 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=8c4514e0a423
description: [tmolitor] fixes the race condition and provides a better handling of server h > our h as well. Fixes #36
diffstat:
nbxmpp/smacks.py | 53 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 43 insertions(+), 10 deletions(-)
diffs (95 lines):
diff -r 2b837401ad95 -r 8c4514e0a423 nbxmpp/smacks.py
--- a/nbxmpp/smacks.py Mon Nov 23 17:33:14 2015 -0400
+++ b/nbxmpp/smacks.py Thu Dec 17 19:45:59 2015 +0100
@@ -17,6 +17,7 @@
self.out_h = 0 # Outgoing stanzas handled
self.in_h = 0 # Incoming stanzas handled
self.uqueue = [] # Unhandled stanzas queue
+ self.old_uqueue = [] # Unhandled stanzas queue of the last session
self.session_id = None
self.resumption = False # If server supports resume
# Max number of stanzas in queue before making a request
@@ -38,7 +39,7 @@
xmlns=NS_STREAM_MGMT)
owner.Dispatcher.RegisterHandler('a', self.check_ack,
xmlns=NS_STREAM_MGMT)
- owner.Dispatcher.RegisterHandler('resumed', self.check_ack,
+ owner.Dispatcher.RegisterHandler('resumed', self.check_resume,
xmlns=NS_STREAM_MGMT)
owner.Dispatcher.RegisterHandler('failed', self.error_handling,
xmlns=NS_STREAM_MGMT)
@@ -61,6 +62,7 @@
# Every time we attempt to negociate, we must erase all previous info
# about any previous session
self.uqueue = []
+ self.old_uqueue = []
self.in_h = 0
self.out_h = 0
self.session_id = None
@@ -75,6 +77,8 @@
self.resuming = False
log.error('Attempted to resume without a valid session id ')
return
+ self.old_uqueue = self.uqueue #save old messages in an extra "queue" to avoid race conditions
+ self.uqueue = []
resume = Acks()
resume.buildResume(self.in_h, self.session_id)
self._owner.Connection.send(resume, False)
@@ -102,19 +106,48 @@
h = int(h)
diff = self.out_h - h
- if len(self.uqueue) < diff or diff < 0:
- log.error('Server and client number of stanzas handled mismatch ')
+ if diff < 0:
+ log.error('Server and client number of stanzas handled mismatch (our h: %d, server h: %d)' % (self.out_h, h))
+ 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))
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))
while (len(self.uqueue) > diff):
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')
+ return
+ h = int(h)
+ diff = self.out_h - h
- if stanza.getName() == 'resumed':
- self.enabled = True
- self.resuming = True
- self.con.set_oldst()
- if self.uqueue != []:
- for i in self.uqueue:
- self._owner.Connection.send(i, False)
+ 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))
+ 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))
+ else:
+ log.info('Removing %d already received 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))
+ while (len(self.old_uqueue) > diff):
+ self.old_uqueue.pop(0)
+
+ self.enabled = True
+ self.resuming = True
+ self.con.set_oldst()
+ 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)
+ self.old_uqueue = []
def error_handling(self, disp, stanza):
# If the server doesn't recognize previd, forget about resuming
changeset e43eec160b86 in /home/hg/repos/gajim-plugins
author: tmolitor <thilo(a)eightysoft.de>
branches:
details:gajim-plugins?cmd=changeset;node=e43eec160b86
description: Fixed a naming bug in the new Twemoji resized icon pack.
diffstat:
emoticons_pack/contents.ini | 2 +-
emoticons_pack/emoticons_pack.zip | Bin
emoticons_pack/manifest.ini | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 05bd522ba016 -r e43eec160b86 emoticons_pack/contents.ini
--- a/emoticons_pack/contents.ini Thu Dec 17 00:18:28 2015 +0100
+++ b/emoticons_pack/contents.ini Thu Dec 17 00:28:18 2015 +0100
@@ -113,7 +113,7 @@
converter: Emmanuel Gil Peyrot <linkmauve(a)linkmauve.fr>, Thilo Molitor <thilo(a)eightysoft.de>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
- The size of this Emojis is 24px and thus a bit more usable than those of the Twemoji packet (having a size of 48px)
+ The size of this Emojis is 24px and thus a bit more usable than those of the Twemoji packet (having a size of 48px)<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/TwemojiResized
diff -r 05bd522ba016 -r e43eec160b86 emoticons_pack/emoticons_pack.zip
Binary file emoticons_pack/emoticons_pack.zip has changed
diff -r 05bd522ba016 -r e43eec160b86 emoticons_pack/manifest.ini
--- a/emoticons_pack/manifest.ini Thu Dec 17 00:18:28 2015 +0100
+++ b/emoticons_pack/manifest.ini Thu Dec 17 00:28:18 2015 +0100
@@ -1,7 +1,7 @@
[info]
name: Emoticons pack
short_name: emoticons_pack
-version: 0.1.1
+version: 0.1.2
description: Install, update and view detailed legend of emoticons
authors: Denis Fomin <fominde(a)gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/