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
Make chat_merge_consecutive_nickname work in GC
- - - - -
6d76cfb2 by Philipp Hörist at 2016-12-24T09:03:54+01:00
Merge branch 'merge_nicks' into 'gajim_0.16'
Make chat_merge_consecutive_nickname work in GC
See merge request !8
- - - - -
2 changed files:
- src/chat_control.py
- src/conversation_textview.py
Changes:
=====================================
src/chat_control.py
=====================================
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -902,7 +902,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def print_conversation_line(self, text, kind, name, tim,
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
- count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False,
+ count_as_new=True, subject=None, xhtml=None, simple=False,
xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None,
correct_id=None):
"""
@@ -933,7 +933,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
else:
textview.print_conversation_line(text, jid, kind, name, tim,
other_tags_for_name, other_tags_for_time, other_tags_for_text,
- subject, old_kind, xhtml, simple=simple, graphics=graphics,
+ subject, xhtml, simple=simple, graphics=graphics,
displaymarking=displaymarking)
if xep0184_id is not None:
@@ -1454,7 +1454,6 @@ class ChatControl(ChatControlBase):
) = range(5)
TYPE_ID = message_control.TYPE_CHAT
- old_msg_kind = None # last kind of the printed message
# Set a command host to bound to. Every command given through a chat will be
# processed with this command host.
@@ -2577,13 +2576,9 @@ class ChatControl(ChatControlBase):
if xhtml:
xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
ChatControlBase.print_conversation_line(self, text, kind, name, tim,
- subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
+ subject=subject, xhtml=xhtml,
simple=simple, xep0184_id=xep0184_id, displaymarking=displaymarking,
msg_log_id=msg_log_id, correct_id=correct_id)
- if text.startswith('/me ') or text.startswith('/me\n'):
- self.old_msg_kind = None
- else:
- self.old_msg_kind = kind
def get_tab_label(self, chatstate):
unread = ''
@@ -3008,7 +3003,6 @@ class ChatControl(ChatControlBase):
_('The database file (%s) cannot be read. Try to repair it or '
'remove it (all history will be lost).') % common.logger.LOG_DB_PATH)
rows = []
- 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
msg = row[2]
@@ -3040,12 +3034,7 @@ class ChatControl(ChatControlBase):
{'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)
- if row[2].startswith('/me ') or row[2].startswith('/me\n'):
- local_old_kind = None
- else:
- local_old_kind = kind
+ small_attr + ['restored_message'], False, xhtml=xhtml)
if len(rows):
self.conv_textview.print_empty_line()
=====================================
src/conversation_textview.py
=====================================
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -218,6 +218,10 @@ class ConversationTextview(gobject.GObject):
# It's True when we scroll in the code, so we can detect scroll from user
self.auto_scrolling = False
+ # This holds the last Nickname we received a msg from
+ # for chat_merge_consecutive_nickname feature
+ self.last_msg_name = None
+
# connect signals
id_ = self.tv.connect('motion_notify_event',
self.on_textview_motion_notify_event)
@@ -1228,7 +1232,7 @@ class ConversationTextview(gobject.GObject):
def print_conversation_line(self, text, jid, kind, name, tim,
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
- subject=None, old_kind=None, xhtml=None, simple=False, graphics=True,
+ subject=None, xhtml=None, simple=False, graphics=True,
displaymarking=None, iter_=None):
"""
Print 'chat' type messages
@@ -1275,8 +1279,6 @@ class ConversationTextview(gobject.GObject):
self.marks_queue.put(mark)
if kind == 'incoming_queue':
kind = 'incoming'
- if old_kind == 'incoming_queue':
- old_kind = 'incoming'
# print the time stamp
if not tim:
# We don't have tim for outgoing messages...
@@ -1325,13 +1327,20 @@ class ConversationTextview(gobject.GObject):
mark1 = mark
else: # not status nor /me
if gajim.config.get('chat_merge_consecutive_nickname'):
- if kind != old_kind or self.just_cleared:
+ if self.last_msg_name != name or self.just_cleared:
+ # Textview is empty or this is a msg from a new user
+ # Print the Nickname
self.print_name(name, kind, other_tags_for_name,
direction_mark=direction_mark, iter_=end_iter)
else:
+ # The last message was from the same Nickname
+ # Dont print the Nickname
self.print_real_text(gajim.config.get(
'chat_merge_consecutive_nickname_indent'),
iter_=end_iter)
+ # Save the last Chatname so we know if we have to
+ # print the nickname on the next message
+ self.last_msg_name = name
else:
self.print_name(name, kind, other_tags_for_name,
direction_mark=direction_mark, iter_=end_iter)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/bb7e4a4366f77f94d5da6c367408872f6…
Thilo Molitor pushed to branch gajim_0.16 at gajim / gajim
Commits:
35b6f3c1 by Thilo Molitor at 2016-12-23T15:33:40+01:00
Correctly search for chat_control when message receipts are received (XEP-0184) and chat_control is not currently bound to a session
- - - - -
1 changed file:
- src/common/connection_handlers.py
Changes:
=====================================
src/common/connection_handlers.py
=====================================
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1219,11 +1219,12 @@ class ConnectionHandlersBase:
self.name, 'request_receipt'):
ctrl = obj.session.control
if not ctrl:
- # Received <message> doesn't have the <thread> element?
- # search in all sessions
- for s in self.get_sessions(obj.jid):
- if s.control:
- ctrl = s.control
+ # Received <message> doesn't have the <thread> element
+ # or control is not bound to session?
+ # --> search for it
+ ctrl = gajim.interface.msg_win_mgr.search_control(obj.jid,
+ obj.conn.name, obj.resource)
+
if ctrl:
id_ = obj.receipt_received_tag.getAttr('id')
if not id_:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/35b6f3c1fdd0940fa5b5ee17f354b8fcd9…
Thilo Molitor pushed to branch master at gajim / gajim
Commits:
55eaf70f by Thilo Molitor at 2016-12-16T21:53:51+01:00
Correctly search for chat_control when message receipts are received (XEP-0184) and chat_control is not currently bound to a session
- - - - -
c48f0419 by Thilo Molitor at 2016-12-18T04:22:08+01:00
Merge branch 'master' of dev.gajim.org:gajim/gajim
- - - - -
f15497b0 by Thilo Molitor at 2016-12-23T15:21:03+01:00
Merge branch 'master' of dev.gajim.org:gajim/gajim
- - - - -
1 changed file:
- src/common/connection_handlers.py
Changes:
=====================================
src/common/connection_handlers.py
=====================================
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1203,11 +1203,12 @@ class ConnectionHandlersBase:
self.name, 'request_receipt'):
ctrl = obj.session.control
if not ctrl:
- # Received <message> doesn't have the <thread> element?
- # search in all sessions
- for s in self.get_sessions(obj.jid):
- if s.control:
- ctrl = s.control
+ # Received <message> doesn't have the <thread> element
+ # or control is not bound to session?
+ # --> search for it
+ ctrl = gajim.interface.msg_win_mgr.search_control(obj.jid,
+ obj.conn.name, obj.resource)
+
if ctrl:
id_ = obj.receipt_received_tag.getAttr('id')
if not id_:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/ac4859fb87ef74564e1514a8789031616…