changeset 230d35d42d71 in /home/hg/repos/gajim
author: Yann Leboulanger <[email protected]>
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,
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits