From 8a3d743b6faec1d7dfe76ff59ae2b07338211570 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 28 Mar 2016 20:52:24 +0200 Subject: [PATCH 1/7] fix error reply when S5B cannot be established. Fixes #8315 --- src/common/protocol/bytestream.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py index 6bd74b56e..448dcc36d 100644 --- a/src/common/protocol/bytestream.py +++ b/src/common/protocol/bytestream.py @@ -364,8 +364,8 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): from common.connection_handlers_events import FileRequestErrorEvent gajim.nec.push_incoming_event(FileRequestErrorEvent(None, conn=self, jid=receiver, file_props=file_props, error_msg='')) - self._connect_error(receiver, file_props.sid, - file_props.sid, code=406) + self._connect_error(file_props.sid, error='not-acceptable', + error_type='modify') else: iq = nbxmpp.Iq(to=receiver, typ='set') file_props.request_id = 'id_' + file_props.sid @@ -557,7 +557,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): file_props.hash_ = hash_id return - def _connect_error(self,sid, code=404): + def _connect_error(self, sid, error, error_type, msg=None): """ Called when there is an error establishing BS connection, or when connection is rejected @@ -568,23 +568,17 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): if file_props is None: log.error('can not send iq error on failed transfer') return - msg_dict = { - 404: 'Could not connect to given hosts', - 405: 'Cancel', - 406: 'Not acceptable', - } - msg = msg_dict[code] if file_props.type_ == 's': to = file_props.receiver else: to = file_props.sender - iq = nbxmpp.Iq(to=to, typ='error') - iq.setAttr('id', file_props.sid) + iq = nbxmpp.Iq(to=to, typ='error') + iq.setAttr('id', file_props.request_id) err = iq.setTag('error') - err.setAttr('code', str(code)) - err.setData(msg) + err.setAttr('type', error_type) + err.setTag(error, namespace=nbxmpp.NS_STANZAS) self.connection.send(iq) - if code == 404: + if msg: self.disconnect_transfer(file_props) file_props.error = -3 from common.connection_handlers_events import \ @@ -667,9 +661,12 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): raise nbxmpp.NodeProcessed file_props.streamhosts = streamhosts + def _connection_error(sid): + self._connect_error(sid, 'item-not-found', 'cancel', + msg='Could not connect to given hosts') if file_props.type_ == 'r': gajim.socks5queue.connect_to_hosts(self.name, sid, - self.send_success_connect_reply, self._connect_error) + self.send_success_connect_reply, _connection_error) raise nbxmpp.NodeProcessed def _ResultCB(self, con, iq_obj): From c5a22ce262a96a35c0f6e14925cebc1433e38d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Verrier?= Date: Sun, 27 Mar 2016 18:09:21 +0200 Subject: [PATCH 2/7] Use OrderedDict to maintain emoticons order in packs. --- data/emoticons/animated/emoticons.py | 100 ++++++++++++------------ data/emoticons/static-big/emoticons.py | 86 ++++++++++---------- data/emoticons/static/emoticons.py | 86 ++++++++++---------- data/emoticons/tango/emoticons.py | 104 +++++++++++++------------ 4 files changed, 192 insertions(+), 184 deletions(-) diff --git a/data/emoticons/animated/emoticons.py b/data/emoticons/animated/emoticons.py index 222358ef9..bf464b560 100644 --- a/data/emoticons/animated/emoticons.py +++ b/data/emoticons/animated/emoticons.py @@ -1,50 +1,52 @@ # coding=utf-8 -emoticons = { - 'smile.png': [':-)', ':)'], - 'coolglasses.png': ['B-)', '(H)'], - 'wink.gif': [';-)', ';)'], - 'biggrin.png': [':-D', ':D'], - 'unhappy.png': [':-(', ':('], - 'cry.gif': [":'-(", ":'(", ';-(', ';(', ";'-("], - 'frowning.png': [':-/', ':/', ':-\\', ':\\', ':-S', ':S'], - 'blush.png': [':-$', ':$'], - 'angry.png': [':-@', ':@'], - 'bat.gif': [':-[', ':['], - 'kiss.png': [':-{}', ':-*', ':*', '(K)'], - 'stare.png': [':-|', ':|'], - 'devil.png': [']:->', '>:-)', '>:)', '(6)'], - 'tongue.png': [':-P', ':P', ':-þ', ':þ'], - 'oh.png': ['=-O', ':-O', ':O'], - 'heart.png': ['<3', '(L)', '*IN LOVE*'], - 'pussy.png': ['(@)'], - 'cuffs.png': ['(%)'], - 'moon.png': ['(S)'], - 'lamp.png': ['(I)'], - 'music.png': ['(8)'], - 'beer.png': ['(B)', '*DRINK*'], - 'brflower.png': ['(W)'], - 'boy.png': ['(Z)'], - 'girl.png': ['(X)'], - 'mail.png': ['(E)'], - 'thumbdown.png': ['(N)'], - 'photo.png': ['(P)'], - 'thumbup.png': ['(Y)', '*THUMBS UP*'], - 'hugleft.png': ['(})'], - 'brheart.png': ['--', '(F)'], - 'drink.png': ['(D)'], - 'phone.png': ['(T)'], - 'coffee.png': ['(C)'], - 'hugright.png': ['({)'], - 'star.png': ['(*)'], - 'rainbow.png': ['(R)'], - 'cigarette.gif': ['(ci)'], - 'cake.gif': ['(^)'], - 'dontknow.gif': [':^)'], - 'eyeroll.gif': ['8-)'], - 'lightning.gif': ['(li)'], - 'party.gif': ['<:o)'], - 'sleepy.gif': ['|-)'], - 'think.gif': ['*-)'], - 'puke.gif': [':-!'], -} +from collections import OrderedDict + +emoticons = OrderedDict(( + ('smile.png', [':-)', ':)']), + ('coolglasses.png', ['B-)', '(H)']), + ('wink.gif', [';-)', ';)']), + ('biggrin.png', [':-D', ':D']), + ('unhappy.png', [':-(', ':(']), + ('cry.gif', [":'-(", ":'(", ';-(', ';(', ";'-("]), + ('frowning.png', [':-/', ':/', ':-\\', ':\\', ':-S', ':S']), + ('blush.png', [':-$', ':$']), + ('angry.png', [':-@', ':@']), + ('bat.gif', [':-[', ':[']), + ('kiss.png', [':-{}', ':-*', ':*', '(K)']), + ('stare.png', [':-|', ':|']), + ('devil.png', [']:->', '>:-)', '>:)', '(6)']), + ('tongue.png', [':-P', ':P', ':-þ', ':þ']), + ('oh.png', ['=-O', ':-O', ':O']), + ('heart.png', ['<3', '(L)', '*IN LOVE*']), + ('pussy.png', ['(@)']), + ('cuffs.png', ['(%)']), + ('moon.png', ['(S)']), + ('lamp.png', ['(I)']), + ('music.png', ['(8)']), + ('beer.png', ['(B)', '*DRINK*']), + ('brflower.png', ['(W)']), + ('boy.png', ['(Z)']), + ('girl.png', ['(X)']), + ('mail.png', ['(E)']), + ('thumbdown.png', ['(N)']), + ('photo.png', ['(P)']), + ('thumbup.png', ['(Y)', '*THUMBS UP*']), + ('hugleft.png', ['(})']), + ('brheart.png', ['--', '(F)']), + ('drink.png', ['(D)']), + ('phone.png', ['(T)']), + ('coffee.png', ['(C)']), + ('hugright.png', ['({)']), + ('star.png', ['(*)']), + ('rainbow.png', ['(R)']), + ('cigarette.gif', ['(ci)']), + ('cake.gif', ['(^)']), + ('dontknow.gif', [':^)']), + ('eyeroll.gif', ['8-)']), + ('lightning.gif', ['(li)']), + ('party.gif', ['<:o)']), + ('sleepy.gif', ['|-)']), + ('think.gif', ['*-)']), + ('puke.gif', [':-!']), +)) diff --git a/data/emoticons/static-big/emoticons.py b/data/emoticons/static-big/emoticons.py index 8ed1da834..ba51e1852 100644 --- a/data/emoticons/static-big/emoticons.py +++ b/data/emoticons/static-big/emoticons.py @@ -1,43 +1,45 @@ # coding=utf-8 -emoticons = { - 'smile.png': [':-)', ':)'], - 'coolglasses.png': ['8-)', 'B-)', '(H)'], - 'wink.png': [';-)', ';)'], - 'biggrin.png': [':-D', ':D'], - 'unhappy.png': [':-(', ':('], - 'cry.png': [":'-(", ":'(", ';-(', ';(', ";'-("], - 'frowning.png': [':-/', ':/', ':-\\', ':\\', ':-S', ':S'], - 'blush.png': [':-$', ':$'], - 'angry.png': [':-@', ':@'], - 'bat.png': [':-[', ':['], - 'kiss.png': [':-{}', ':-*', ':*', '(K)'], - 'stare.png': [':-|', ':|'], - 'devil.png': [']:->', '>:-)', '>:)', '(6)'], - 'tongue.png': [':-P', ':P', ':-þ', ':þ'], - 'oh.png': ['=-O', ':-O', ':O'], - 'heart.png': ['<3', '(L)', '*IN LOVE*'], - 'lion.png': [':3', '>:3'], - 'pussy.png': ['(@)', '=^.^='], - 'cuffs.png': ['(%)'], - 'moon.png': ['(S)'], - 'lamp.png': ['(I)'], - 'music.png': ['(8)'], - 'beer.png': ['(B)', '*DRINK*'], - 'brflower.png': ['(W)'], - 'boy.png': ['(Z)'], - 'girl.png': ['(X)'], - 'mail.png': ['(E)'], - 'thumbdown.png': ['(N)'], - 'photo.png': ['(P)'], - 'thumbup.png': ['(Y)', '*THUMBS UP*'], - 'hugleft.png': ['(})'], - 'brheart.png': ['--', '(F)'], - 'drink.png': ['(D)'], - 'phone.png': ['(T)'], - 'coffee.png': ['(C)'], - 'hugright.png': ['({)'], - 'star.png': ['(*)'], - 'rainbow.png': ['(R)'], - 'puke.png': [':-!'], -} +from collections import OrderedDict + +emoticons = OrderedDict(( + ('smile.png', [':-)', ':)']), + ('coolglasses.png', ['8-)', 'B-)', '(H)']), + ('wink.png', [';-)', ';)']), + ('biggrin.png', [':-D', ':D']), + ('unhappy.png', [':-(', ':(']), + ('cry.png', [":'-(", ":'(", ';-(', ';(', ";'-("]), + ('frowning.png', [':-/', ':/', ':-\\', ':\\', ':-S', ':S']), + ('blush.png', [':-$', ':$']), + ('angry.png', [':-@', ':@']), + ('bat.png', [':-[', ':[']), + ('kiss.png', [':-{}', ':-*', ':*', '(K)']), + ('stare.png', [':-|', ':|']), + ('devil.png', [']:->', '>:-)', '>:)', '(6)']), + ('tongue.png', [':-P', ':P', ':-þ', ':þ']), + ('oh.png', ['=-O', ':-O', ':O']), + ('heart.png', ['<3', '(L)', '*IN LOVE*']), + ('lion.png', [':3', '>:3']), + ('pussy.png', ['(@)', '=^.^=']), + ('cuffs.png', ['(%)']), + ('moon.png', ['(S)']), + ('lamp.png', ['(I)']), + ('music.png', ['(8)']), + ('beer.png', ['(B)', '*DRINK*']), + ('brflower.png', ['(W)']), + ('boy.png', ['(Z)']), + ('girl.png', ['(X)']), + ('mail.png', ['(E)']), + ('thumbdown.png', ['(N)']), + ('photo.png', ['(P)']), + ('thumbup.png', ['(Y)', '*THUMBS UP*']), + ('hugleft.png', ['(})']), + ('brheart.png', ['--', '(F)']), + ('drink.png', ['(D)']), + ('phone.png', ['(T)']), + ('coffee.png', ['(C)']), + ('hugright.png', ['({)']), + ('star.png', ['(*)']), + ('rainbow.png', ['(R)']), + ('puke.png', [':-!']), +)) diff --git a/data/emoticons/static/emoticons.py b/data/emoticons/static/emoticons.py index 8ed1da834..ba51e1852 100644 --- a/data/emoticons/static/emoticons.py +++ b/data/emoticons/static/emoticons.py @@ -1,43 +1,45 @@ # coding=utf-8 -emoticons = { - 'smile.png': [':-)', ':)'], - 'coolglasses.png': ['8-)', 'B-)', '(H)'], - 'wink.png': [';-)', ';)'], - 'biggrin.png': [':-D', ':D'], - 'unhappy.png': [':-(', ':('], - 'cry.png': [":'-(", ":'(", ';-(', ';(', ";'-("], - 'frowning.png': [':-/', ':/', ':-\\', ':\\', ':-S', ':S'], - 'blush.png': [':-$', ':$'], - 'angry.png': [':-@', ':@'], - 'bat.png': [':-[', ':['], - 'kiss.png': [':-{}', ':-*', ':*', '(K)'], - 'stare.png': [':-|', ':|'], - 'devil.png': [']:->', '>:-)', '>:)', '(6)'], - 'tongue.png': [':-P', ':P', ':-þ', ':þ'], - 'oh.png': ['=-O', ':-O', ':O'], - 'heart.png': ['<3', '(L)', '*IN LOVE*'], - 'lion.png': [':3', '>:3'], - 'pussy.png': ['(@)', '=^.^='], - 'cuffs.png': ['(%)'], - 'moon.png': ['(S)'], - 'lamp.png': ['(I)'], - 'music.png': ['(8)'], - 'beer.png': ['(B)', '*DRINK*'], - 'brflower.png': ['(W)'], - 'boy.png': ['(Z)'], - 'girl.png': ['(X)'], - 'mail.png': ['(E)'], - 'thumbdown.png': ['(N)'], - 'photo.png': ['(P)'], - 'thumbup.png': ['(Y)', '*THUMBS UP*'], - 'hugleft.png': ['(})'], - 'brheart.png': ['--', '(F)'], - 'drink.png': ['(D)'], - 'phone.png': ['(T)'], - 'coffee.png': ['(C)'], - 'hugright.png': ['({)'], - 'star.png': ['(*)'], - 'rainbow.png': ['(R)'], - 'puke.png': [':-!'], -} +from collections import OrderedDict + +emoticons = OrderedDict(( + ('smile.png', [':-)', ':)']), + ('coolglasses.png', ['8-)', 'B-)', '(H)']), + ('wink.png', [';-)', ';)']), + ('biggrin.png', [':-D', ':D']), + ('unhappy.png', [':-(', ':(']), + ('cry.png', [":'-(", ":'(", ';-(', ';(', ";'-("]), + ('frowning.png', [':-/', ':/', ':-\\', ':\\', ':-S', ':S']), + ('blush.png', [':-$', ':$']), + ('angry.png', [':-@', ':@']), + ('bat.png', [':-[', ':[']), + ('kiss.png', [':-{}', ':-*', ':*', '(K)']), + ('stare.png', [':-|', ':|']), + ('devil.png', [']:->', '>:-)', '>:)', '(6)']), + ('tongue.png', [':-P', ':P', ':-þ', ':þ']), + ('oh.png', ['=-O', ':-O', ':O']), + ('heart.png', ['<3', '(L)', '*IN LOVE*']), + ('lion.png', [':3', '>:3']), + ('pussy.png', ['(@)', '=^.^=']), + ('cuffs.png', ['(%)']), + ('moon.png', ['(S)']), + ('lamp.png', ['(I)']), + ('music.png', ['(8)']), + ('beer.png', ['(B)', '*DRINK*']), + ('brflower.png', ['(W)']), + ('boy.png', ['(Z)']), + ('girl.png', ['(X)']), + ('mail.png', ['(E)']), + ('thumbdown.png', ['(N)']), + ('photo.png', ['(P)']), + ('thumbup.png', ['(Y)', '*THUMBS UP*']), + ('hugleft.png', ['(})']), + ('brheart.png', ['--', '(F)']), + ('drink.png', ['(D)']), + ('phone.png', ['(T)']), + ('coffee.png', ['(C)']), + ('hugright.png', ['({)']), + ('star.png', ['(*)']), + ('rainbow.png', ['(R)']), + ('puke.png', [':-!']), +)) diff --git a/data/emoticons/tango/emoticons.py b/data/emoticons/tango/emoticons.py index db3376b93..3773ec32b 100644 --- a/data/emoticons/tango/emoticons.py +++ b/data/emoticons/tango/emoticons.py @@ -1,52 +1,54 @@ # coding=utf-8 -emoticons = { - 'angel.png': ['O:-)', 'o:-)', '0:-)'], - 'curl-lip.png': [':-)', ':)', '=)'], - 'sarcastic.png': [';D', ';-D'], - 'sad.png': [':-(', ':(', '=('], - 'wink.png': [';-)', ';)'], - 'tongue.png': [':-P', ':P', ':-p', ':p'], - 'glasses-cool': ['8-)', 'B-)', '(H)'], - 'laugh.png': [':-D', ':D'], - 'embarrassed.png': [':-[', ':['], - 'shout.png': ['=-O', ':-O', ':O'], - 'kiss.png': [':-{}', ':-*', ':*', '(K)'], - 'crying.png': [":'-(", ":'(", ';-(', ';(', ";'-("], - 'shut-mouth': [':-X'], - 'hypnotized.png': ['%)', '%-)'], - 'freaked-out.png': [':o'], - 'thinking.png': [':-|', ':|'], - 'arrogant.png': [':-/', ':/', ':-\\', ':\\', ':-S', ':S'], - 'devil.png': [':->', ']:->', '>:-)', '>:)', '(6)'], - 'musical-note.png': ['[:-}'], - 'sick.png': [':-!'], - 'giggle.png': ['*JOKINGLY*'], - 'cute.png': ['*KISSED*'], - 'sleepy.png': ['*TIRED*'], - 'terror.png': ['*STOP*'], - 'handshake.png': ['*KISSING*'], - 'rose.png': ['@}->--', '(F)'], - 'good.png': ['(Y)', '*THUMBS UP*'], - 'beer.png': ['(B)', '*DRINK*'], - 'love.png': ['<3', '(L)', '*IN LOVE*'], - 'bomb.png': ['@='], - 'question.png': ['*HELP*'], - 'cowboy.png': ['\m/'], - 'fingers-crossed.png': ['*OK*'], - 'alien.png': ['*WASSUP*'], - 'disapointed.png': ['*SORRY*'], - 'clap.png': ['*BRAVO*'], - 'rotfl.png': ['*ROFL*'], - 'dont-know.png': ['*PARDON*'], - 'confused.png': ['*NO*'], - 'silly.png': ['*CRAZY*'], - 'doh.png': ['*DONT_KNOW*'], - 'party.png': ['*DANCE*'], - 'dance.png': ['*YAHOO*'], - 'victory.png': ['*HI*'], - 'go-away.png': ['*BYE*'], - 'smirk.png': ['*YES*'], - 'pissed-off.png': ['*WALL*'], - 'mail.png': ['*WRITE*', '(E)'], - 'tremble.png': ['*SCRATCH*'], -} +from collections import OrderedDict + +emoticons = OrderedDict(( + ('angel.png', ['O:-)', 'o:-)', '0:-)']), + ('curl-lip.png', [':-)', ':)', '=)']), + ('sarcastic.png', [';D', ';-D']), + ('sad.png', [':-(', ':(', '=(']), + ('wink.png', [';-)', ';)']), + ('tongue.png', [':-P', ':P', ':-p', ':p']), + ('glasses-cool', ['8-)', 'B-)', '(H)']), + ('laugh.png', [':-D', ':D']), + ('embarrassed.png', [':-[', ':[']), + ('shout.png', ['=-O', ':-O', ':O']), + ('kiss.png', [':-{}', ':-*', ':*', '(K)']), + ('crying.png', [":'-(", ":'(", ';-(', ';(', ";'-("]), + ('shut-mouth', [':-X']), + ('hypnotized.png', ['%)', '%-)']), + ('freaked-out.png', [':o']), + ('thinking.png', [':-|', ':|']), + ('arrogant.png', [':-/', ':/', ':-\\', ':\\', ':-S', ':S']), + ('devil.png', [':->', ']:->', '>:-)', '>:)', '(6)']), + ('musical-note.png', ['[:-}']), + ('sick.png', [':-!']), + ('giggle.png', ['*JOKINGLY*']), + ('cute.png', ['*KISSED*']), + ('sleepy.png', ['*TIRED*']), + ('terror.png', ['*STOP*']), + ('handshake.png', ['*KISSING*']), + ('rose.png', ['@}->--', '(F)']), + ('good.png', ['(Y)', '*THUMBS UP*']), + ('beer.png', ['(B)', '*DRINK*']), + ('love.png', ['<3', '(L)', '*IN LOVE*']), + ('bomb.png', ['@=']), + ('question.png', ['*HELP*']), + ('cowboy.png', ['\m/']), + ('fingers-crossed.png', ['*OK*']), + ('alien.png', ['*WASSUP*']), + ('disapointed.png', ['*SORRY*']), + ('clap.png', ['*BRAVO*']), + ('rotfl.png', ['*ROFL*']), + ('dont-know.png', ['*PARDON*']), + ('confused.png', ['*NO*']), + ('silly.png', ['*CRAZY*']), + ('doh.png', ['*DONT_KNOW*']), + ('party.png', ['*DANCE*']), + ('dance.png', ['*YAHOO*']), + ('victory.png', ['*HI*']), + ('go-away.png', ['*BYE*']), + ('smirk.png', ['*YES*']), + ('pissed-off.png', ['*WALL*']), + ('mail.png', ['*WRITE*', '(E)']), + ('tremble.png', ['*SCRATCH*']), +)) From 0c67a2d212c7a73fb3aaea8c57825ebc0bf8fab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Verrier?= Date: Sun, 27 Mar 2016 18:09:58 +0200 Subject: [PATCH 3/7] Sort emoticons packs list in the preferences window. --- src/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.py b/src/config.py index d1e3caac9..e967abdae 100644 --- a/src/config.py +++ b/src/config.py @@ -153,19 +153,19 @@ class PreferencesWindow: # user themes if os.path.isdir(gajim.MY_EMOTS_PATH): emoticons_list += os.listdir(gajim.MY_EMOTS_PATH) + emoticons_list.sort() renderer_text = Gtk.CellRendererText() emoticons_combobox.pack_start(renderer_text, True) emoticons_combobox.add_attribute(renderer_text, 'text', 0) model = Gtk.ListStore(str) emoticons_combobox.set_model(model) - l = [] + l = [_('Disabled')] for dir_ in emoticons_list: if not os.path.isdir(os.path.join(gajim.DATA_DIR, 'emoticons', dir_)) \ and not os.path.isdir(os.path.join(gajim.MY_EMOTS_PATH, dir_)) : continue if dir_ != '.svn': l.append(dir_) - l.append(_('Disabled')) for i in range(len(l)): model.append([l[i]]) if gajim.config.get('emoticons_theme') == l[i]: From f2dd9a977317bbb2351ca7e7e6e5936ee34853de Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 3 Apr 2016 16:42:21 +0200 Subject: [PATCH 4/7] [ralf] correctly store roster window size in one window mode. Fixes #8314 --- src/roster_window.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/roster_window.py b/src/roster_window.py index b968a7c22..9a86c24c7 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2473,9 +2473,6 @@ class RosterWindow: gajim.config.set('roster_x-position', x) gajim.config.set('roster_y-position', y) width, height = self.window.get_size() - # For the width use the size of the vbox containing the tree and - # status combo, this will cancel out any hpaned width - width = self.xml.get_object('roster_vbox2').get_allocation().width gajim.config.set('roster_width', width) gajim.config.set('roster_height', height) if not self.xml.get_object('roster_vbox2').get_property('visible'): From 7c2c4cd0ac99c280f74e6c9bae61fd309c2a92d6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 3 Apr 2016 21:32:53 +0200 Subject: [PATCH 5/7] prevent traceback. Fixes #7978 --- src/common/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/connection.py b/src/common/connection.py index ab53f5258..3180937c5 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -2755,7 +2755,7 @@ class Connection(CommonConnection, ConnectionHandlers): msg_iq = nbxmpp.Message(obj.jid, obj.message, typ='groupchat', xhtml=obj.xhtml) if obj.label is not None: - msg_iq.addChild(node=label) + msg_iq.addChild(node=obj.label) obj.msg_id = self.connection.send(msg_iq) gajim.nec.push_incoming_event(MessageSentEvent(None, conn=self, jid=obj.jid, message=obj.message, keyID=None, chatstate=None, From e585c579cb9e971c16105adf3cd0bc2de45a0d83 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 17 Apr 2016 20:31:19 +0200 Subject: [PATCH 6/7] print timestamp as invisible in history window when we don't want to see it so we can search for it. See #3939 --- src/history_window.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/history_window.py b/src/history_window.py index 61f94d639..b7d03167a 100644 --- a/src/history_window.py +++ b/src/history_window.py @@ -74,6 +74,7 @@ class HistoryWindow: scrolledwindow.add(self.history_textview.tv) self.history_buffer = self.history_textview.tv.get_buffer() self.history_buffer.create_tag('highlight', background = 'yellow') + self.history_buffer.create_tag('invisible', invisible=True) self.checkbutton = xml.get_object('log_history_checkbutton') self.checkbutton.connect('toggled', self.on_log_history_checkbutton_toggled) @@ -429,6 +430,12 @@ class HistoryWindow: tim = time.strftime('%X ', time.localtime(float(tim))) buf.insert_with_tags_by_name(end_iter, tim + '\n', 'time_sometimes') + else: # don't print time. So we print it as invisible to be able to + # search for it + timestamp_str = gajim.config.get('time_stamp') + timestamp_str = helpers.from_one_line(timestamp_str) + tim = time.strftime(timestamp_str, time.localtime(float(tim))) + buf.insert_with_tags_by_name(end_iter, tim, 'invisible') tag_name = '' tag_msg = '' @@ -605,8 +612,8 @@ class HistoryWindow: timestamp_str = gajim.config.get('time_stamp') timestamp_str = helpers.from_one_line(timestamp_str) tim = time.strftime(timestamp_str, local_time) - result = start_iter.forward_search(tim, Gtk.TextSearchFlags.VISIBLE_ONLY, - None) + result = start_iter.forward_search(tim, Gtk.TextSearchFlags.TEXT_ONLY, + None) if result is not None: match_start_iter, match_end_iter = result match_start_iter.backward_char() # include '[' or other character before time From cc46d7b7d06ab3f4945a33bd62362af0f8d38b67 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 18 Apr 2016 22:38:17 +0200 Subject: [PATCH 7/7] call gpg with LANG=C to prevent decoding issues --- src/common/gnupg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/gnupg.py b/src/common/gnupg.py index 33e4fb9d7..2743f7ae8 100644 --- a/src/common/gnupg.py +++ b/src/common/gnupg.py @@ -741,8 +741,10 @@ class GPG(object): si = STARTUPINFO() si.dwFlags = STARTF_USESHOWWINDOW si.wShowWindow = SW_HIDE + env = os.environ + env['LANG'] = 'C' return Popen(cmd, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE, - startupinfo=si) + env=env, startupinfo=si) def _read_response(self, stream, result): # Internal method: reads all the stderr output from GPG, taking notice