get the correct gc_control according to the account when we want to print error message in it. Fixes #2456

This commit is contained in:
Yann Leboulanger 2006-10-03 10:03:07 +00:00
parent f34c41c93b
commit 8b494b8ff7
1 changed files with 25 additions and 25 deletions

View File

@ -619,33 +619,33 @@ class Interface:
full_jid_with_resource = array[0] full_jid_with_resource = array[0]
jids = full_jid_with_resource.split('/', 1) jids = full_jid_with_resource.split('/', 1)
jid = jids[0] jid = jids[0]
gcs = self.msg_win_mgr.get_controls(message_control.TYPE_GC) gc_control = self.msg_win_mgr.get_control(jid, account)
for gc_control in gcs: if gc_control:
if jid == gc_control.contact.jid: if len(jids) > 1: # it's a pm
if len(jids) > 1: # it's a pm nick = jids[1]
nick = jids[1] if not self.msg_win_mgr.get_control(full_jid_with_resource,
if not self.msg_win_mgr.get_control(full_jid_with_resource, account): account):
tv = gc_control.list_treeview tv = gc_control.list_treeview
model = tv.get_model() model = tv.get_model()
i = gc_control.get_contact_iter(nick) iter = gc_control.get_contact_iter(nick)
if i: if iter:
show = model[i][3] show = model[iter][3]
else: else:
show = 'offline' show = 'offline'
gc_c = gajim.contacts.create_gc_contact(room_jid = jid, gc_c = gajim.contacts.create_gc_contact(room_jid = jid,
name = nick, show = show) name = nick, show = show)
c = gajim.contacts.contact_from_gc_contact(gc_c) c = gajim.contacts.contact_from_gc_contact(gc_c)
self.roster.new_chat(c, account, private_chat = True) self.roster.new_chat(c, account, private_chat = True)
ctrl = self.msg_win_mgr.get_control(full_jid_with_resource, account) ctrl = self.msg_win_mgr.get_control(full_jid_with_resource, account)
ctrl.print_conversation('Error %s: %s' % (array[1], array[2]), ctrl.print_conversation('Error %s: %s' % (array[1], array[2]),
'status') 'status')
return
gc_control.print_conversation('Error %s: %s' % (array[1], array[2]))
if gc_control.parent_win.get_active_jid() == jid:
gc_control.set_subject(gc_control.subject)
return return
gc_control.print_conversation('Error %s: %s' % (array[1], array[2]))
if gc_control.parent_win.get_active_jid() == jid:
gc_control.set_subject(gc_control.subject)
return
if gajim.jid_is_transport(jid): if gajim.jid_is_transport(jid):
jid = jid.replace('@', '') jid = jid.replace('@', '')
msg = array[2] msg = array[2]