update status in resource-specific chat windows

This commit is contained in:
Brendan Taylor 2008-07-19 18:31:45 +00:00
parent d83f9da555
commit 913c434c80
2 changed files with 26 additions and 16 deletions

View File

@ -2380,3 +2380,16 @@ class ChatControl(ChatControlBase):
if contact: if contact:
self.contact = contact self.contact = contact
self.draw_banner() self.draw_banner()
def update_status_display(self, name, uf_show, status):
'''print the contact's status and update the status/GPG image'''
self.update_ui()
self.parent_win.redraw_tab(self)
self.print_conversation(_('%s is now %s') % (name, uf_show),
'status')
if status:
ctrl.print_conversation(' (', 'status', simple=True)
ctrl.print_conversation('%s' % (status), 'status', simple=True)
ctrl.print_conversation(')', 'status', simple=True)

View File

@ -1803,7 +1803,7 @@ class RosterWindow:
contact.status = status contact.status = status
# name is to show in conversation window # name is to show in conversation window
name = contact.get_shown_name() name = contact.get_shown_name()
# The contact has several resources # The contact has several resources
if len(contact_instances) > 1: if len(contact_instances) > 1:
if contact.resource != '': if contact.resource != '':
@ -1828,24 +1828,21 @@ class RosterWindow:
# SelfContact went offline. Remove him when last pending message was read # SelfContact went offline. Remove him when last pending message was read
self.remove_contact(contact.jid, account, backend=True) self.remove_contact(contact.jid, account, backend=True)
uf_show = helpers.get_uf_show(show)
# print status in chat window and update status/GPG image # print status in chat window and update status/GPG image
if gajim.interface.msg_win_mgr.has_window(contact.jid, account): ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid, account)
win = gajim.interface.msg_win_mgr.get_window(contact.jid, account) if ctrl:
uf_show = helpers.get_uf_show(show) ctrl.contact = gajim.contacts.get_contact_with_highest_priority(
account, contact.jid)
ctrl.update_status_display(name, uf_show, status)
ctrl = win.get_control(contact.jid, account) if contact.resource != '':
fjid = contact.jid + '/' + contact.resource
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account)
if ctrl: if ctrl:
ctrl.contact = gajim.contacts.get_contact_with_highest_priority( ctrl.update_status_display(name, uf_show, status)
account, contact.jid)
ctrl.update_ui()
win.redraw_tab(ctrl)
ctrl.print_conversation(_('%s is now %s') % (name, uf_show),
'status')
if status:
ctrl.print_conversation(' (', 'status', simple=True)
ctrl.print_conversation('%s' % (status), 'status', simple=True)
ctrl.print_conversation(')', 'status', simple=True)
# unset custom status # unset custom status
if gajim.interface.status_sent_to_users.has_key(account) and \ if gajim.interface.status_sent_to_users.has_key(account) and \