win.get_controls() isn't needed anymore

This commit is contained in:
Brendan Taylor 2008-06-26 23:37:12 +00:00
parent e3613be1fa
commit b21a1e2489
4 changed files with 14 additions and 21 deletions

View File

@ -1034,17 +1034,15 @@ class Interface:
win.set_values(vcard)
# show avatar in chat
ctrls = []
if resource and self.msg_win_mgr.has_window(fjid, account):
win = self.msg_win_mgr.get_window(fjid, account)
ctrls = win.get_controls(fjid, account)
ctrl = win.get_control(fjid, account)
elif self.msg_win_mgr.has_window(jid, account):
win = self.msg_win_mgr.get_window(jid, account)
ctrls = win.get_controls(jid, account)
ctrl = win.get_control(jid, account)
for ctrl in ctrls:
if ctrl.type_id != message_control.TYPE_GC:
ctrl.show_avatar()
if ctrl and ctrl.type_id != message_control.TYPE_GC:
ctrl.show_avatar()
# Show avatar in roster or gc_roster
gc_ctrl = self.msg_win_mgr.get_gc_control(jid, account)
@ -2605,9 +2603,7 @@ class Interface:
win = self.msg_win_mgr.get_window(fjid, account)
if win:
ctrls = win.get_controls(fjid, account)
if ctrls:
ctrl = ctrls[0]
ctrl = win.get_control(fjid, account)
if not ctrl:
ctrl = self.new_chat(contact, account,
@ -2620,8 +2616,9 @@ class Interface:
win.set_active_tab(ctrl)
if gajim.connections[account].is_zeroconf and \
gajim.connections[account].status in ('offline', 'invisible'):
for ctrl in win.get_controls(fjid, account):
gajim.connections[account].status in ('offline', 'invisible'):
ctrl = win.get_control(fjid, account)
if ctrl:
ctrl.got_disconnected()
################################################################################

View File

@ -2076,7 +2076,7 @@ class GroupchatControl(ChatControlBase):
gajim.interface.new_private_chat(gc_c, self.account)
win = gajim.interface.msg_win_mgr.get_window(nick_jid, self.account)
ctrl = win.get_controls(nick_jid, self.account)[0]
ctrl = win.get_control(nick_jid, self.account)
win.set_active_tab(ctrl)

View File

@ -586,12 +586,6 @@ class MessageWindow(object):
def has_control(self, jid, acct):
return (acct in self._controls and jid in self._controls[acct])
def get_controls(self, jid, acct):
try:
return self._controls[acct][jid]
except KeyError:
return []
def change_key(self, old_jid, new_jid, acct):
'''Change the JID key of a control'''
try:

View File

@ -1812,7 +1812,7 @@ class RosterWindow:
if len(contact_instances) > 1:
if contact.resource != '':
name += '/' + contact.resource
# Remove resource when going offline
if show in ('offline', 'error') and \
len(gajim.events.get_events(account, contact.get_full_jid())) == 0:
@ -1821,7 +1821,8 @@ class RosterWindow:
account):
win = gajim.interface.msg_win_mgr.get_window(jid_with_resource,
account)
for ctrl in win.get_controls(jid_with_resource, account):
ctrl = win.get_control(jid_with_resource, account)
if ctrl:
ctrl.update_ui()
win.redraw_tab(ctrl)
gajim.contacts.remove_contact(account, contact)
@ -1836,7 +1837,8 @@ class RosterWindow:
win = gajim.interface.msg_win_mgr.get_window(contact.jid, account)
uf_show = helpers.get_uf_show(show)
for ctrl in win.get_controls(contact.jid, account):
ctrl = win.get_control(contact.jid, account)
if ctrl:
ctrl.contact = gajim.contacts.get_contact_with_highest_priority(
account, contact.jid)
ctrl.update_ui()