Skip to content
Snippets Groups Projects
Commit 0e092980 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

show unread pm in tab and in chat window title. fixes #2645

parent f4a3bf3e
No related branches found
No related tags found
No related merge requests found
......@@ -395,9 +395,7 @@ def get_tab_label(self, chatstate):
# count waiting highlighted messages
unread = ''
jid = self.contact.jid
num_unread = len(gajim.events.get_events(self.account, jid,
['printed_gc_msg']))
num_unread = self.get_nb_unread()
if num_unread == 1:
unread = '*'
elif num_unread > 1:
......@@ -469,7 +467,7 @@ def on_private_message(self, nick, msg, tim, xhtml):
iter = self.get_contact_iter(nick)
path = self.list_treeview.get_model().get_path(iter)
if not autopopup or (not autopopupaway and \
gajim.connections[self.account].connected > 2):
gajim.connections[self.account].connected > 2):
if no_queue: # We didn't have a queue: we change icons
model = self.list_treeview.get_model()
state_images =\
......@@ -478,6 +476,7 @@ def on_private_message(self, nick, msg, tim, xhtml):
image = state_images['message']
model[iter][C_IMG] = image
self.parent_win.show_title()
self.parent_win.redraw_tab(self)
else:
self._start_private_message(nick)
# Scroll to line
......@@ -588,6 +587,11 @@ def print_conversation(self, text, contact = '', tim = None, xhtml = None):
def get_nb_unread(self):
nb = len(gajim.events.get_events(self.account, self.room_jid,
['printed_gc_msg']))
nb += self.get_nb_unread_pm()
return nb
def get_nb_unread_pm(self):
nb = 0
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
nb += len(gajim.events.get_events(self.account, self.room_jid + '/' + \
nick, ['pm']))
......
......@@ -238,8 +238,10 @@ def show_title(self, urgent = True, control = None):
unread = 0
for ctrl in self.controls():
if ctrl.type_id == message_control.TYPE_GC and not \
gajim.config.get('notify_on_all_muc_messages') and not \
ctrl.attention_flag:
gajim.config.get('notify_on_all_muc_messages') and not \
ctrl.attention_flag:
# count only pm messages
unread += ctrl.get_nb_unread_pm()
continue
unread += ctrl.get_nb_unread()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment