Commit b23759c9 authored by Philipp Hörist's avatar Philipp Hörist

Rename msg_stanza_id to message_id

This helps to prevent confusion because there exist XEP-0359 stanza-ids which are not used here
parent 99906bfc
......@@ -858,7 +858,7 @@ class ChatControl(ChatControlBase):
self.add_message(
obj.msgtxt, kind, tim=obj.timestamp,
encrypted=obj.encrypted, correct_id=obj.correct_id,
msg_stanza_id=obj.message_id, additional_data=obj.additional_data)
message_id=obj.message_id, additional_data=obj.additional_data)
def _nec_decrypted_message_received(self, obj):
if not obj.msgtxt:
......@@ -881,7 +881,7 @@ class ChatControl(ChatControlBase):
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, msg_stanza_id=obj.id_, correct_id=obj.correct_id,
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)
if obj.msg_log_id:
pw = self.parent_win
......@@ -899,11 +899,11 @@ class ChatControl(ChatControlBase):
return
self.last_sent_msg = obj.stanza_id
id_ = obj.msg_iq.getID()
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 = id_
xep0184_id = message_id
if obj.label:
displaymarking = obj.label.getTag('displaymarking')
else:
......@@ -915,7 +915,7 @@ class ChatControl(ChatControlBase):
self.add_message(obj.message, self.contact.jid, tim=obj.timestamp,
encrypted=obj.encrypted, xep0184_id=xep0184_id, xhtml=obj.xhtml,
displaymarking=displaymarking, msg_stanza_id=id_,
displaymarking=displaymarking, message_id=message_id,
correct_id=obj.correct_id,
additional_data=obj.additional_data)
......@@ -949,7 +949,7 @@ class ChatControl(ChatControlBase):
def add_message(self, text, frm='', tim=None, encrypted=None,
subject=None, xhtml=None, xep0184_id=None,
displaymarking=None, msg_log_id=None, correct_id=None,
msg_stanza_id=None, additional_data=None):
message_id=None, additional_data=None):
"""
Print a line in the conversation
......@@ -989,7 +989,7 @@ class ChatControl(ChatControlBase):
ChatControlBase.add_message(self, text, kind, name, tim,
subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
xep0184_id=xep0184_id, displaymarking=displaymarking,
msg_log_id=msg_log_id, msg_stanza_id=msg_stanza_id,
msg_log_id=msg_log_id, message_id=message_id,
correct_id=correct_id, additional_data=additional_data,
encrypted=encrypted)
if text.startswith('/me ') or text.startswith('/me\n'):
......
......@@ -934,7 +934,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
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, graphics=True, displaymarking=None, msg_log_id=None,
msg_stanza_id=None, correct_id=None, additional_data=None,
message_id=None, correct_id=None, additional_data=None,
encrypted=None):
"""
Print 'chat' type messages
......@@ -959,7 +959,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
textview.print_conversation_line(text, kind, name, tim,
other_tags_for_name, other_tags_for_time, other_tags_for_text,
subject, old_kind, xhtml, graphics=graphics,
displaymarking=displaymarking, msg_stanza_id=msg_stanza_id,
displaymarking=displaymarking, message_id=message_id,
correct_id=correct_id, additional_data=additional_data,
encrypted=encrypted)
......
......@@ -206,9 +206,9 @@ class ConversationTextview(GObject.GObject):
self.handlers = {}
self.image_cache = {}
self.xep0184_marks = {}
# self.last_sent_message_id = msg_stanza_id
# self.last_sent_message_id = message_id
self.last_sent_message_id = None
# last_received_message_id[name] = (msg_stanza_id, line_start_mark)
# last_received_message_id[name] = (message_id, line_start_mark)
self.last_received_message_id = {}
self.autoscroll = True
# connect signals
......@@ -894,9 +894,9 @@ class ConversationTextview(GObject.GObject):
buffer_.insert_with_tags_by_name(iter_, '\n', 'eol')
self.just_cleared = False
def get_end_mark(self, msg_stanza_id, start_mark):
def get_end_mark(self, message_id, start_mark):
for index, msg in enumerate(self.message_list):
if msg[2] == msg_stanza_id and msg[1] == start_mark:
if msg[2] == message_id and msg[1] == start_mark:
try:
end_mark = self.message_list[index + 1][1]
end_mark_name = end_mark.get_name()
......@@ -914,7 +914,7 @@ class ConversationTextview(GObject.GObject):
return None, None
def get_insert_mark(self, timestamp):
# message_list = [(timestamp, line_start_mark, msg_stanza_id)]
# message_list = [(timestamp, line_start_mark, message_id)]
# We check if this is a new Message
try:
if self.message_list[-1][0] <= timestamp:
......@@ -935,7 +935,7 @@ class ConversationTextview(GObject.GObject):
def print_conversation_line(self, text, kind, name, tim,
other_tags_for_name=None, other_tags_for_time=None, other_tags_for_text=None,
subject=None, old_kind=None, xhtml=None, graphics=True,
displaymarking=None, msg_stanza_id=None, correct_id=None, additional_data=None,
displaymarking=None, message_id=None, correct_id=None, additional_data=None,
encrypted=None):
"""
Print 'chat' type messages
......@@ -962,12 +962,12 @@ class ConversationTextview(GObject.GObject):
index, insert_mark, old_txt = \
self.correct_message(correct_id, kind, name)
if correct_id in self.corrected_text_list:
self.corrected_text_list[msg_stanza_id] = \
self.corrected_text_list[message_id] = \
self.corrected_text_list[correct_id] + '\n{}' \
.format(GLib.markup_escape_text(old_txt))
del self.corrected_text_list[correct_id]
else:
self.corrected_text_list[msg_stanza_id] = \
self.corrected_text_list[message_id] = \
_('<b>Message corrected. Original message:</b>\n{}') \
.format(GLib.markup_escape_text(old_txt))
corrected = True
......@@ -985,7 +985,7 @@ class ConversationTextview(GObject.GObject):
'Printed Line: %s, %s, %s, inserted after: %s'
', stanza-id: %s, correct-id: %s',
self.line, text, tim, insert_mark_name,
msg_stanza_id, correct_id)
message_id, correct_id)
if not insert_mark: # Texview is empty or Message is new
iter_ = buffer_.get_end_iter()
......@@ -1054,14 +1054,14 @@ class ConversationTextview(GObject.GObject):
if corrected:
# Show Correction Icon
buffer_.create_tag(tag_name=msg_stanza_id)
buffer_.create_tag(tag_name=message_id)
buffer_.insert(iter_, ' ')
icon = load_icon('document-edit-symbolic', self.tv, pixbuf=True)
buffer_.insert_pixbuf(
iter_, icon)
tag_start_iter = iter_.copy()
tag_start_iter.backward_chars(2)
buffer_.apply_tag_by_name(msg_stanza_id, tag_start_iter, iter_)
buffer_.apply_tag_by_name(message_id, tag_start_iter, iter_)
# If we inserted a Line we add a new line at the end
if insert_mark:
......@@ -1075,18 +1075,18 @@ class ConversationTextview(GObject.GObject):
if index is None:
# New Message
self.message_list.append((tim, new_mark, msg_stanza_id))
self.message_list.append((tim, new_mark, message_id))
elif corrected:
# Replace the corrected message
self.message_list[index] = (tim, new_mark, msg_stanza_id)
self.message_list[index] = (tim, new_mark, message_id)
else:
# We insert the message at index
self.message_list.insert(index, (tim, new_mark, msg_stanza_id))
self.message_list.insert(index, (tim, new_mark, message_id))
if kind == 'incoming':
self.last_received_message_id[name] = (msg_stanza_id, new_mark)
self.last_received_message_id[name] = (message_id, new_mark)
elif kind == 'outgoing':
self.last_sent_message_id = (msg_stanza_id, new_mark)
self.last_sent_message_id = (message_id, new_mark)
if not insert_mark:
if self.autoscroll or kind == 'outgoing':
......
......@@ -1202,7 +1202,7 @@ class GroupchatControl(ChatControlBase):
obj.msgtxt, contact=obj.nick,
tim=obj.timestamp, correct_id=obj.correct_id,
encrypted=obj.encrypted,
msg_stanza_id=obj.message_id,
message_id=obj.message_id,
additional_data=obj.additional_data)
def _nec_gc_message_received(self, obj):
......@@ -1222,7 +1222,7 @@ class GroupchatControl(ChatControlBase):
obj.msgtxt, contact=obj.nick,
tim=obj.timestamp, xhtml=obj.xhtml_msgtxt,
displaymarking=obj.displaymarking, encrypted=obj.encrypted,
correct_id=obj.correct_id, msg_stanza_id=obj.id_,
correct_id=obj.correct_id, message_id=obj.message_id,
additional_data=obj.additional_data)
obj.needs_highlight = self.needs_visual_notification(obj.msgtxt)
......@@ -1277,7 +1277,7 @@ class GroupchatControl(ChatControlBase):
return self.model.get_iter(path)
def add_message(self, text, contact='', tim=None, xhtml=None,
graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None,
graphics=True, displaymarking=None, correct_id=None, message_id=None,
encrypted=None, additional_data=None):
"""
Add message to the ConversationsTextview
......@@ -1320,7 +1320,7 @@ class GroupchatControl(ChatControlBase):
ChatControlBase.add_message(self, text, kind, contact, tim,
other_tags_for_name, [], other_tags_for_text, xhtml=xhtml,
graphics=graphics, displaymarking=displaymarking,
correct_id=correct_id, msg_stanza_id=msg_stanza_id, encrypted=encrypted,
correct_id=correct_id, message_id=message_id, encrypted=encrypted,
additional_data=additional_data)
def get_nb_unread(self):
......@@ -1499,7 +1499,7 @@ class GroupchatControl(ChatControlBase):
frm = 'out'
obj.session.control.add_message(obj.msgtxt, frm,
tim=obj.timestamp, xhtml=obj.xhtml, encrypted=obj.encrypted,
displaymarking=obj.displaymarking, msg_stanza_id=obj.id_,
displaymarking=obj.displaymarking, message_id=obj.message_id,
correct_id=obj.correct_id)
else:
# otherwise pass it off to the control to be queued
......
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