don't count restored messages as new messages
This commit is contained in:
parent
c53a3286bd
commit
0d0835c112
11
src/chat.py
11
src/chat.py
|
@ -826,7 +826,7 @@ class Chat:
|
||||||
|
|
||||||
def print_conversation_line(self, text, jid, kind, name, tim,
|
def print_conversation_line(self, text, jid, kind, name, tim,
|
||||||
other_tags_for_name = [], other_tags_for_time = [],
|
other_tags_for_name = [], other_tags_for_time = [],
|
||||||
other_tags_for_text = []):
|
other_tags_for_text = [], count_as_new = True):
|
||||||
textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
buffer = textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
buffer.begin_user_action()
|
buffer.begin_user_action()
|
||||||
|
@ -869,9 +869,6 @@ class Chat:
|
||||||
text = '* ' + name + text[3:]
|
text = '* ' + name + text[3:]
|
||||||
text_tags.append(kind)
|
text_tags.append(kind)
|
||||||
|
|
||||||
if kind == 'incoming':
|
|
||||||
self.last_message_time[jid] = time.time()
|
|
||||||
|
|
||||||
if name and len(text_tags) == len(other_tags_for_text):
|
if name and len(text_tags) == len(other_tags_for_text):
|
||||||
# not status nor /me
|
# not status nor /me
|
||||||
name_tags = other_tags_for_name[:] #create a new list
|
name_tags = other_tags_for_name[:] #create a new list
|
||||||
|
@ -898,6 +895,12 @@ class Chat:
|
||||||
|
|
||||||
buffer.end_user_action()
|
buffer.end_user_action()
|
||||||
|
|
||||||
|
if not count_as_new:
|
||||||
|
return
|
||||||
|
|
||||||
|
if kind == 'incoming':
|
||||||
|
self.last_message_time[jid] = time.time()
|
||||||
|
|
||||||
if (jid != self.get_active_jid() or \
|
if (jid != self.get_active_jid() or \
|
||||||
not self.window.is_active() or \
|
not self.window.is_active() or \
|
||||||
not end) and kind == 'incoming':
|
not end) and kind == 'incoming':
|
||||||
|
|
|
@ -453,7 +453,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
text = ':'.join(msg[2:])[0:-1] #remove the latest \n
|
text = ':'.join(msg[2:])[0:-1] #remove the latest \n
|
||||||
self.print_conversation_line(text, jid, kind, name, tim,
|
self.print_conversation_line(text, jid, kind, name, tim,
|
||||||
['small'], ['small', 'grey'], ['small', 'grey'])
|
['small'], ['small', 'grey'], ['small', 'grey'], False)
|
||||||
|
|
||||||
if len(lines):
|
if len(lines):
|
||||||
self.print_empty_line(jid)
|
self.print_empty_line(jid)
|
||||||
|
|
Loading…
Reference in New Issue