changeset 5ca3426c7dce in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=5ca3426c7dce
description: [Bahtiar `kalkin-` Gadimov]
Shorten name of a gc entry in "Join GC" submenu
Some XMPP clients save the subject of a group chat as the bookmark name. The
subject can be very long thus the MenuItems can get also very long. This simple
patch shortens the name to a carefully chosen value.
Fixes #8218
diffstat:
src/roster_window.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diffs (14 lines):
diff -r f32fb7e1628c -r 5ca3426c7dce src/roster_window.py
--- a/src/roster_window.py Tue Jan 05 20:53:54 2016 +0100
+++ b/src/roster_window.py Sat Jan 16 14:18:16 2016 +0100
@@ -6216,6 +6216,10 @@
# No name was given for this bookmark.
# Use the first part of JID instead...
name = bookmark['jid'].split("@")[0]
+
+ # Shorten long names
+ name = (name[:42] + '..') if len(name) > 42 else name
+
# Do not use underline.
item = gtk.MenuItem(name, False)
item.connect('activate', self.on_bookmark_menuitem_activate,
changeset 230d35d42d71 in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=230d35d42d71
description: correctly store and restore single message subject. Fixes #8251
diffstat:
src/chat_control.py | 12 ++++++++----
src/common/connection.py | 5 +----
src/common/logger.py | 6 +++---
3 files changed, 12 insertions(+), 11 deletions(-)
diffs (74 lines):
diff -r 5ca3426c7dce -r 230d35d42d71 src/chat_control.py
--- a/src/chat_control.py Sat Jan 16 14:18:16 2016 +0100
+++ b/src/chat_control.py Sun Jan 31 19:58:51 2016 +0100
@@ -3011,7 +3011,8 @@
local_old_kind = None
self.conv_textview.just_cleared = True
for row in rows: # row[0] time, row[1] has kind, row[2] the message
- if not row[2]: # message is empty, we don't print it
+ msg = row[2]
+ if not msg: # message is empty, we don't print it
continue
if row[1] in (constants.KIND_CHAT_MSG_SENT,
constants.KIND_SINGLE_MSG_SENT):
@@ -3032,9 +3033,12 @@
else:
small_attr = []
xhtml = None
- if row[2].startswith('<body '):
- xhtml = row[2]
- ChatControlBase.print_conversation_line(self, row[2], kind, name,
+ if msg.startswith('<body '):
+ xhtml = msg
+ if row[3]:
+ msg = _('Subject: %(subject)s\n%(message)s') % \
+ {'subject': row[3], 'message': msg}
+ ChatControlBase.print_conversation_line(self, msg, kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml)
diff -r 5ca3426c7dce -r 230d35d42d71 src/common/connection.py
--- a/src/common/connection.py Sat Jan 16 14:18:16 2016 +0100
+++ b/src/common/connection.py Sun Jan 31 19:58:51 2016 +0100
@@ -521,9 +521,6 @@
log_msg = msg
if original_message is not None:
log_msg = original_message
- if subject:
- log_msg = _('Subject: %(subject)s\n%(message)s') % \
- {'subject': subject, 'message': log_msg}
if log_msg:
if type_ == 'chat':
kind = 'chat_msg_sent'
@@ -533,7 +530,7 @@
if xhtml and gajim.config.get('log_xhtml_messages'):
log_msg = '<body xmlns="%s">%s</body>' % (
nbxmpp.NS_XHTML, xhtml)
- gajim.logger.write(kind, jid, log_msg)
+ gajim.logger.write(kind, jid, log_msg, subject=subject)
except exceptions.PysqliteOperationalError, e:
self.dispatch('DB_ERROR', (_('Disk Write Error'),
str(e)))
diff -r 5ca3426c7dce -r 230d35d42d71 src/common/logger.py
--- a/src/common/logger.py Sat Jan 16 14:18:16 2016 +0100
+++ b/src/common/logger.py Sun Jan 31 19:58:51 2016 +0100
@@ -585,8 +585,8 @@
Accept how many rows to restore and when to time them out (in minutes)
(mark them as too old) and number of messages that are in queue and are
already logged but pending to be viewed, returns a list of tupples
- containg time, kind, message, list with empty tupple if nothing found to
- meet our demands
+ containg time, kind, message, sibject list with empty tupple if nothing
+ found to meet our demands
"""
try:
self.get_jid_id(jid)
@@ -601,7 +601,7 @@
# 3 - 8 (we avoid the last 2 lines but we still return 5 asked)
try:
self.cur.execute('''
- SELECT time, kind, message FROM logs
+ SELECT time, kind, message, subject FROM logs
WHERE (%s) AND kind IN (%d, %d, %d, %d, %d) AND time > %d
ORDER BY time DESC LIMIT %d OFFSET %d
''' % (where_sql, constants.KIND_SINGLE_MSG_RECV,
changeset 80c2f82f7ed0 in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=80c2f82f7ed0
description: do not allow to drop a group on itself or a subgroup of itself. Fixes #8211
diffstat:
src/roster_window.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (18 lines):
diff -r 1c2fba2fae78 -r 80c2f82f7ed0 src/roster_window.py
--- a/src/roster_window.py Sat Jan 02 16:26:22 2016 +0100
+++ b/src/roster_window.py Sun Jan 03 13:02:22 2016 +0100
@@ -4781,8 +4781,12 @@
if type_dest == 'account':
new_grp = grp_source_list[-1]
elif type_dest == 'group':
- new_grp = model[iter_dest][C_JID].decode('utf-8') + delimiter +\
- grp_source_list[-1]
+ grp_dest = model[iter_dest][C_JID].decode('utf-8')
+ grp_dest_list = grp_dest.split(delimiter)
+ # Do not allow to drop on a subgroup of source group
+ if grp_source_list[0] != grp_dest_list[0]:
+ new_grp = model[iter_dest][C_JID].decode('utf-8') + \
+ delimiter + grp_source_list[-1]
if new_grp:
self.move_group(grp_source, new_grp, account_source)