Fix a bug with receiving Private Messages when roster is minimized, print the number of unread pm in roster, and change icon when a pm is received.
This commit is contained in:
parent
93dbdd3dd8
commit
993d72a8c1
|
@ -827,9 +827,15 @@ class ChatControlBase(MessageControl):
|
|||
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
|
||||
groupchat_control = gajim.interface.msg_win_mgr.get_control(
|
||||
room_jid, self.account)
|
||||
if not groupchat_control and \
|
||||
gajim.interface.minimized_controls.has_key(self.account) and \
|
||||
room_jid in gajim.interface.minimized_controls[self.account]:
|
||||
groupchat_control = \
|
||||
gajim.interface.minimized_controls[self.account][room_jid]
|
||||
groupchat_control.draw_contact(nick)
|
||||
mw = gajim.interface.msg_win_mgr.get_window(room_jid, self.account)
|
||||
mw.redraw_tab(groupchat_control)
|
||||
if mw:
|
||||
mw.redraw_tab(groupchat_control)
|
||||
else:
|
||||
gajim.interface.roster.draw_contact(jid, self.account)
|
||||
gajim.interface.roster.show_title()
|
||||
|
|
|
@ -548,6 +548,10 @@ def get_icon_name_to_show(contact, account = None):
|
|||
if account and gajim.events.get_nb_roster_events(account,
|
||||
contact.get_full_jid()):
|
||||
return 'message'
|
||||
if account and gajim.interface.minimized_controls.has_key(account) and \
|
||||
contact.jid in gajim.interface.minimized_controls[account] and gajim.interface.\
|
||||
minimized_controls[account][contact.jid].get_nb_unread_pm() > 0:
|
||||
return 'message'
|
||||
if contact.jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
||||
return contact.show
|
||||
if contact.sub in ('both', 'to'):
|
||||
|
|
|
@ -686,6 +686,10 @@ class Interface:
|
|||
jid = jid.replace('@', '')
|
||||
|
||||
groupchat_control = self.msg_win_mgr.get_control(jid, account)
|
||||
if not groupchat_control and \
|
||||
gajim.interface.minimized_controls.has_key(account) and \
|
||||
jid in gajim.interface.minimized_controls[account]:
|
||||
groupchat_control = gajim.interface.minimized_controls[account][jid]
|
||||
pm = False
|
||||
if groupchat_control and groupchat_control.type_id == \
|
||||
message_control.TYPE_GC:
|
||||
|
|
|
@ -543,14 +543,16 @@ class GroupchatControl(ChatControlBase):
|
|||
self.room_jid, icon_name = 'message')
|
||||
image = state_images['message']
|
||||
model[iter][C_IMG] = image
|
||||
self.parent_win.show_title()
|
||||
self.parent_win.redraw_tab(self)
|
||||
if self.parent_win:
|
||||
self.parent_win.show_title()
|
||||
self.parent_win.redraw_tab(self)
|
||||
else:
|
||||
self._start_private_message(nick)
|
||||
# Scroll to line
|
||||
self.list_treeview.expand_row(path[0:1], False)
|
||||
self.list_treeview.scroll_to_cell(path)
|
||||
self.list_treeview.set_cursor(path)
|
||||
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
||||
|
||||
def get_contact_iter(self, nick):
|
||||
model = self.list_treeview.get_model()
|
||||
|
|
|
@ -581,13 +581,17 @@ class RosterWindow:
|
|||
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 gajim.interface.minimized_controls.has_key(account) and \
|
||||
jid in gajim.interface.minimized_controls[account]:
|
||||
nb_unread = len(gajim.events.get_events(account, jid,
|
||||
['printed_marked_gc_msg']))
|
||||
nb_unread += \
|
||||
gajim.interface.minimized_controls[account][jid].get_nb_unread_pm()
|
||||
|
||||
if nb_unread == 1:
|
||||
name = '%s *' % name
|
||||
elif nb_unread > 1:
|
||||
name = '%s [%s]' % (name, str(nb_unread))
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue