From 93dbdd3dd8329715fa0a833846aa9e03e0e21584 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 17 May 2007 08:39:21 +0000 Subject: [PATCH] (Fix #3174) Groupchats in roster: Open groupchats with middleclick, fix notifications in systray and print number of unread marked messages in roster. --- src/chat_control.py | 18 ++++++++++++------ src/groupchat_control.py | 2 +- src/roster_window.py | 12 +++++++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index e05f81a3b..37ad46c72 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -578,13 +578,19 @@ class ChatControlBase(MessageControl): # other_tags_for_text == ['marked'] --> highlighted gc message type_ = 'printed_' + self.type_id event = 'message_received' - if gc_message: - type_ = 'printed_gc_msg' - event = 'gc_message_received' show_in_roster = notify.get_show_in_roster(event, self.account, self.contact) show_in_systray = notify.get_show_in_systray(event, self.account, self.contact) + if gc_message: + type_ = 'printed_gc_msg' + event = 'gc_message_received' + show_in_roster = True + show_in_systray = False + if gajim.config.get('notify_on_all_muc_messages'): + show_in_systray = True + if other_tags_for_text == ['marked']: + type_ = 'printed_marked_gc_msg' event = gajim.events.create_event(type_, None, show_in_roster = show_in_roster, show_in_systray = show_in_systray) @@ -694,11 +700,11 @@ class ChatControlBase(MessageControl): jid = self.contact.jid if self.was_at_the_end: # we are at the end - type_ = 'printed_' + self.type_id + type_ = ['printed_' + self.type_id] if self.type_id == message_control.TYPE_GC: - type_ = 'printed_gc_msg' + type_ = ['printed_gc_msg', 'printed_marked_gc_msg'] if not gajim.events.remove_events(self.account, self.get_full_jid(), - types = [type_]): + types = type_): # There were events to remove self.redraw_after_event_removed(jid) self.msg_textview.grab_focus() diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 67655e7e3..99a2d0e0b 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -657,7 +657,7 @@ class GroupchatControl(ChatControlBase): def get_nb_unread(self): nb = len(gajim.events.get_events(self.account, self.room_jid, - ['printed_gc_msg'])) + ['printed_gc_msg', 'printed_marked_gc_msg'])) nb += self.get_nb_unread_pm() return nb diff --git a/src/roster_window.py b/src/roster_window.py index 43b9852c9..b10d0874f 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -579,6 +579,16 @@ class RosterWindow: if not contact: return name = gobject.markup_escape_text(contact.get_shown_name()) + + # gets number of unread gc marked messages + nb_unread = len(gajim.events.get_events(account, jid, + ['printed_marked_gc_msg'])) + + if nb_unread == 1: + name = '%s *' % name + elif nb_unread > 1: + name = '%s [%s]' % (name, str(nb_unread)) + strike = False if jid in gajim.connections[account].blocked_contacts: strike = True @@ -2971,7 +2981,7 @@ class RosterWindow: self.tree.get_selection().unselect_all() self.tree.get_selection().select_path(path) type_ = model[path][C_TYPE] - if type_ in ('agent', 'contact', 'self_contact'): + if type_ in ('agent', 'contact', 'self_contact', 'groupchat'): self.on_row_activated(widget, path) elif type_ == 'account': account = model[path][C_ACCOUNT].decode('utf-8')