(Fix #3174) Groupchats in roster: Open groupchats with middleclick, fix notifications in systray and print number of unread marked messages in roster.

This commit is contained in:
Julien Pivotto 2007-05-17 08:39:21 +00:00
parent 5b758a4977
commit 93dbdd3dd8
3 changed files with 24 additions and 8 deletions

View File

@ -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()

View File

@ -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

View File

@ -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')