Commit 0334f676 authored by Philipp Hörist's avatar Philipp Hörist

ChatControl: Simplify receipt code

Determine if we add a receipt mark inisde ConversationsTextview instead of in the ChatControl
parent 6d50b72e
Pipeline #3566 passed with stages
in 2 minutes and 52 seconds
......@@ -871,18 +871,16 @@ class ChatControl(ChatControlBase):
return
typ = ''
xep0184_id = None
if obj.mtype == 'error':
typ = 'error'
if obj.forwarded and obj.sent:
typ = 'out'
if obj.jid != app.get_jid_from_account(obj.conn.name):
xep0184_id = obj.id_
self.add_message(obj.msgtxt, typ,
tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject,
xhtml=obj.xhtml, displaymarking=obj.displaymarking,
msg_log_id=obj.msg_log_id, message_id=obj.message_id, correct_id=obj.correct_id,
xep0184_id=xep0184_id, additional_data=obj.additional_data)
additional_data=obj.additional_data)
if obj.msg_log_id:
pw = self.parent_win
end = self.conv_textview.autoscroll
......@@ -900,10 +898,7 @@ class ChatControl(ChatControlBase):
self.last_sent_msg = obj.stanza_id
message_id = obj.msg_iq.getID()
xep0184_id = None
if self.contact.jid != app.get_jid_from_account(self.account):
if app.config.get_per('accounts', self.account, 'request_receipt'):
xep0184_id = message_id
if obj.label:
displaymarking = obj.label.getTag('displaymarking')
else:
......@@ -914,7 +909,7 @@ class ChatControl(ChatControlBase):
self.msg_textview, 'gajim-msg-correcting')
self.add_message(obj.message, self.contact.jid, tim=obj.timestamp,
encrypted=obj.encrypted, xep0184_id=xep0184_id, xhtml=obj.xhtml,
encrypted=obj.encrypted, xhtml=obj.xhtml,
displaymarking=displaymarking, message_id=message_id,
correct_id=obj.correct_id,
additional_data=obj.additional_data)
......@@ -947,7 +942,7 @@ class ChatControl(ChatControlBase):
return app.nicks[self.account]
def add_message(self, text, frm='', tim=None, encrypted=None,
subject=None, xhtml=None, xep0184_id=None,
subject=None, xhtml=None,
displaymarking=None, msg_log_id=None, correct_id=None,
message_id=None, additional_data=None):
"""
......@@ -988,7 +983,7 @@ class ChatControl(ChatControlBase):
xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
ChatControlBase.add_message(self, text, kind, name, tim,
subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
xep0184_id=xep0184_id, displaymarking=displaymarking,
displaymarking=displaymarking,
msg_log_id=msg_log_id, message_id=message_id,
correct_id=correct_id, additional_data=additional_data,
encrypted=encrypted)
......
......@@ -933,7 +933,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def add_message(self, text, kind, name, tim,
other_tags_for_name=None, other_tags_for_time=None,
other_tags_for_text=None, restored=False, subject=None,
old_kind=None, xhtml=None, xep0184_id=None,
old_kind=None, xhtml=None,
displaymarking=None, msg_log_id=None,
message_id=None, correct_id=None, additional_data=None,
encrypted=None):
......@@ -964,9 +964,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
correct_id=correct_id, additional_data=additional_data,
encrypted=encrypted)
if xep0184_id is not None:
textview.add_xep0184_mark(xep0184_id)
if restored:
return
......
......@@ -1097,7 +1097,9 @@ class ConversationTextview(GObject.GObject):
buffer_.end_user_action()
self.line += 1
return iter_
if kind == 'outgoing' and message_id is not None:
self.add_xep0184_mark(message_id)
def get_time_to_show(self, tim, direction_mark=''):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment