Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits:
-
67188cee
by Philipp Hörist at 2016-12-19T19:23:33+01:00
-
6d76cfb2
by Philipp Hörist at 2016-12-24T09:03:54+01:00
2 changed files:
Changes:
| ... | ... | @@ -902,7 +902,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 902 | 902 |
|
| 903 | 903 |
def print_conversation_line(self, text, kind, name, tim,
|
| 904 | 904 |
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
|
| 905 |
- count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False,
|
|
| 905 |
+ count_as_new=True, subject=None, xhtml=None, simple=False,
|
|
| 906 | 906 |
xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None,
|
| 907 | 907 |
correct_id=None):
|
| 908 | 908 |
"""
|
| ... | ... | @@ -933,7 +933,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 933 | 933 |
else:
|
| 934 | 934 |
textview.print_conversation_line(text, jid, kind, name, tim,
|
| 935 | 935 |
other_tags_for_name, other_tags_for_time, other_tags_for_text,
|
| 936 |
- subject, old_kind, xhtml, simple=simple, graphics=graphics,
|
|
| 936 |
+ subject, xhtml, simple=simple, graphics=graphics,
|
|
| 937 | 937 |
displaymarking=displaymarking)
|
| 938 | 938 |
|
| 939 | 939 |
if xep0184_id is not None:
|
| ... | ... | @@ -1454,7 +1454,6 @@ class ChatControl(ChatControlBase): |
| 1454 | 1454 |
) = range(5)
|
| 1455 | 1455 |
|
| 1456 | 1456 |
TYPE_ID = message_control.TYPE_CHAT
|
| 1457 |
- old_msg_kind = None # last kind of the printed message
|
|
| 1458 | 1457 |
|
| 1459 | 1458 |
# Set a command host to bound to. Every command given through a chat will be
|
| 1460 | 1459 |
# processed with this command host.
|
| ... | ... | @@ -2577,13 +2576,9 @@ class ChatControl(ChatControlBase): |
| 2577 | 2576 |
if xhtml:
|
| 2578 | 2577 |
xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
|
| 2579 | 2578 |
ChatControlBase.print_conversation_line(self, text, kind, name, tim,
|
| 2580 |
- subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
|
|
| 2579 |
+ subject=subject, xhtml=xhtml,
|
|
| 2581 | 2580 |
simple=simple, xep0184_id=xep0184_id, displaymarking=displaymarking,
|
| 2582 | 2581 |
msg_log_id=msg_log_id, correct_id=correct_id)
|
| 2583 |
- if text.startswith('/me ') or text.startswith('/me\n'):
|
|
| 2584 |
- self.old_msg_kind = None
|
|
| 2585 |
- else:
|
|
| 2586 |
- self.old_msg_kind = kind
|
|
| 2587 | 2582 |
|
| 2588 | 2583 |
def get_tab_label(self, chatstate):
|
| 2589 | 2584 |
unread = ''
|
| ... | ... | @@ -3008,7 +3003,6 @@ class ChatControl(ChatControlBase): |
| 3008 | 3003 |
_('The database file (%s) cannot be read. Try to repair it or '
|
| 3009 | 3004 |
'remove it (all history will be lost).') % common.logger.LOG_DB_PATH)
|
| 3010 | 3005 |
rows = []
|
| 3011 |
- local_old_kind = None
|
|
| 3012 | 3006 |
self.conv_textview.just_cleared = True
|
| 3013 | 3007 |
for row in rows: # row[0] time, row[1] has kind, row[2] the message
|
| 3014 | 3008 |
msg = row[2]
|
| ... | ... | @@ -3040,12 +3034,7 @@ class ChatControl(ChatControlBase): |
| 3040 | 3034 |
{'subject': row[3], 'message': msg}
|
| 3041 | 3035 |
ChatControlBase.print_conversation_line(self, msg, kind, name,
|
| 3042 | 3036 |
tim, small_attr, small_attr + ['restored_message'],
|
| 3043 |
- small_attr + ['restored_message'], False,
|
|
| 3044 |
- old_kind=local_old_kind, xhtml=xhtml)
|
|
| 3045 |
- if row[2].startswith('/me ') or row[2].startswith('/me\n'):
|
|
| 3046 |
- local_old_kind = None
|
|
| 3047 |
- else:
|
|
| 3048 |
- local_old_kind = kind
|
|
| 3037 |
+ small_attr + ['restored_message'], False, xhtml=xhtml)
|
|
| 3049 | 3038 |
if len(rows):
|
| 3050 | 3039 |
self.conv_textview.print_empty_line()
|
| 3051 | 3040 |
|
| ... | ... | @@ -218,6 +218,10 @@ class ConversationTextview(gobject.GObject): |
| 218 | 218 |
# It's True when we scroll in the code, so we can detect scroll from user
|
| 219 | 219 |
self.auto_scrolling = False
|
| 220 | 220 |
|
| 221 |
+ # This holds the last Nickname we received a msg from
|
|
| 222 |
+ # for chat_merge_consecutive_nickname feature
|
|
| 223 |
+ self.last_msg_name = None
|
|
| 224 |
+ |
|
| 221 | 225 |
# connect signals
|
| 222 | 226 |
id_ = self.tv.connect('motion_notify_event',
|
| 223 | 227 |
self.on_textview_motion_notify_event)
|
| ... | ... | @@ -1228,7 +1232,7 @@ class ConversationTextview(gobject.GObject): |
| 1228 | 1232 |
|
| 1229 | 1233 |
def print_conversation_line(self, text, jid, kind, name, tim,
|
| 1230 | 1234 |
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
|
| 1231 |
- subject=None, old_kind=None, xhtml=None, simple=False, graphics=True,
|
|
| 1235 |
+ subject=None, xhtml=None, simple=False, graphics=True,
|
|
| 1232 | 1236 |
displaymarking=None, iter_=None):
|
| 1233 | 1237 |
"""
|
| 1234 | 1238 |
Print 'chat' type messages
|
| ... | ... | @@ -1275,8 +1279,6 @@ class ConversationTextview(gobject.GObject): |
| 1275 | 1279 |
self.marks_queue.put(mark)
|
| 1276 | 1280 |
if kind == 'incoming_queue':
|
| 1277 | 1281 |
kind = 'incoming'
|
| 1278 |
- if old_kind == 'incoming_queue':
|
|
| 1279 |
- old_kind = 'incoming'
|
|
| 1280 | 1282 |
# print the time stamp
|
| 1281 | 1283 |
if not tim:
|
| 1282 | 1284 |
# We don't have tim for outgoing messages...
|
| ... | ... | @@ -1325,13 +1327,20 @@ class ConversationTextview(gobject.GObject): |
| 1325 | 1327 |
mark1 = mark
|
| 1326 | 1328 |
else: # not status nor /me
|
| 1327 | 1329 |
if gajim.config.get('chat_merge_consecutive_nickname'):
|
| 1328 |
- if kind != old_kind or self.just_cleared:
|
|
| 1330 |
+ if self.last_msg_name != name or self.just_cleared:
|
|
| 1331 |
+ # Textview is empty or this is a msg from a new user
|
|
| 1332 |
+ # Print the Nickname
|
|
| 1329 | 1333 |
self.print_name(name, kind, other_tags_for_name,
|
| 1330 | 1334 |
direction_mark=direction_mark, iter_=end_iter)
|
| 1331 | 1335 |
else:
|
| 1336 |
+ # The last message was from the same Nickname
|
|
| 1337 |
+ # Dont print the Nickname
|
|
| 1332 | 1338 |
self.print_real_text(gajim.config.get(
|
| 1333 | 1339 |
'chat_merge_consecutive_nickname_indent'),
|
| 1334 | 1340 |
iter_=end_iter)
|
| 1341 |
+ # Save the last Chatname so we know if we have to
|
|
| 1342 |
+ # print the nickname on the next message
|
|
| 1343 |
+ self.last_msg_name = name
|
|
| 1335 | 1344 |
else:
|
| 1336 | 1345 |
self.print_name(name, kind, other_tags_for_name,
|
| 1337 | 1346 |
direction_mark=direction_mark, iter_=end_iter)
|