first pass at stripping out the one-tab-per-session code
This commit is contained in:
parent
59b9e86fbb
commit
e3613be1fa
|
@ -958,24 +958,20 @@ def get_chat_control(account, contact):
|
|||
full_jid_with_resource += '/' + contact.resource
|
||||
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
||||
account, contact.jid)
|
||||
|
||||
# Look for a chat control that has the given resource, or default to
|
||||
# one without resource
|
||||
ctrls = gajim.interface.msg_win_mgr.get_chat_controls(full_jid_with_resource,
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(full_jid_with_resource,
|
||||
account)
|
||||
if ctrls:
|
||||
return ctrls[0]
|
||||
elif not highest_contact or not highest_contact.resource:
|
||||
# unknow contact or offline message
|
||||
pass # fall through, handle this at the end
|
||||
elif highest_contact and contact.resource != \
|
||||
highest_contact.resource:
|
||||
return None
|
||||
|
||||
ctrls = gajim.interface.msg_win_mgr.get_chat_controls(contact.jid, account)
|
||||
if ctrls:
|
||||
return ctrls[0]
|
||||
else:
|
||||
if ctrl:
|
||||
return ctrl
|
||||
elif highest_contact and highest_contact.resource and \
|
||||
contact.resource != highest_contact.resource:
|
||||
return None
|
||||
else:
|
||||
# unknown contact or offline message
|
||||
return gajim.interface.msg_win_mgr.get_control(contact.jid, account)
|
||||
|
||||
def reduce_chars_newlines(text, max_chars = 0, max_lines = 0):
|
||||
'''Cut the chars after 'max_chars' on each line
|
||||
|
|
|
@ -245,7 +245,9 @@ def user_nickname(items, name, jid):
|
|||
for contact in gajim.contacts.get_contacts(name, user):
|
||||
contact.contact_name = nick
|
||||
gajim.interface.roster.draw_contact(user, name)
|
||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(user, name):
|
||||
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(user, name)
|
||||
if ctrl:
|
||||
ctrl.update_ui()
|
||||
win = ctrl.parent_win
|
||||
win.redraw_tab(ctrl)
|
||||
|
|
59
src/gajim.py
59
src/gajim.py
|
@ -538,9 +538,9 @@ class Interface:
|
|||
conn.disconnect_transfer(file_props)
|
||||
return
|
||||
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(jid_from, account):
|
||||
if ctrl.type_id == message_control.TYPE_GC:
|
||||
ctrl.print_conversation('Error %s: %s' % (array[2], array[1]))
|
||||
ctrl = self.msg_win_mgr.get_control(jid_from, account)
|
||||
if ctrl and ctrl.type_id == message_control.TYPE_GC:
|
||||
ctrl.print_conversation('Error %s: %s' % (array[2], array[1]))
|
||||
|
||||
def handle_event_con_type(self, account, con_type):
|
||||
# ('CON_TYPE', account, con_type) which can be 'ssl', 'tls', 'tcp'
|
||||
|
@ -661,7 +661,8 @@ class Interface:
|
|||
# disconnect sessions from this contact's chat controls so we
|
||||
# don't have to open a new tab if a new session comes in
|
||||
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(jid, account):
|
||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl:
|
||||
ctrl.set_session(None)
|
||||
|
||||
if contact1:
|
||||
|
@ -812,14 +813,10 @@ class Interface:
|
|||
if len(jids) > 1: # it's a pm
|
||||
nick = jids[1]
|
||||
|
||||
ctrl = None
|
||||
if session:
|
||||
ctrl = session.control
|
||||
|
||||
if not ctrl:
|
||||
ctrls = self.msg_win_mgr.get_chat_controls(full_jid_with_resource, account)
|
||||
if ctrls:
|
||||
ctrl = ctrls[0]
|
||||
else:
|
||||
ctrl = self.msg_win_mgr.get_control(full_jid_with_resource, account)
|
||||
|
||||
if not ctrl:
|
||||
tv = gc_control.list_treeview
|
||||
|
@ -1124,8 +1121,9 @@ class Interface:
|
|||
if contact:
|
||||
self.roster.draw_contact(room_jid, account)
|
||||
|
||||
# print status in chat windows and update status/GPG image
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(fjid, account):
|
||||
# print status in chat window and update status/GPG image
|
||||
ctrl = self.msg_win_mgr.get_control(fjid, account)
|
||||
if ctrl:
|
||||
statusCode = array[9]
|
||||
if '303' in statusCode:
|
||||
new_nick = array[10]
|
||||
|
@ -1817,24 +1815,25 @@ class Interface:
|
|||
gajim.connections[account].change_status('offline','')
|
||||
|
||||
def handle_event_ping_sent(self, account, contact):
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.jid, account):
|
||||
ctrl.print_conversation(_('Ping?'), 'status')
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.get_full_jid(), account):
|
||||
ctrl.print_conversation(_('Ping?'), 'status')
|
||||
for jid in [contact.jid, contact.get_full_jid()]:
|
||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl:
|
||||
ctrl.print_conversation(_('Ping?'), 'status')
|
||||
|
||||
def handle_event_ping_reply(self, account, data):
|
||||
contact = data[0]
|
||||
seconds = data[1]
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.jid, account):
|
||||
ctrl.print_conversation(_('Pong! (%s s.)') % seconds, 'status')
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.get_full_jid(), account):
|
||||
ctrl.print_conversation(_('Pong! (%s s.)') % seconds, 'status')
|
||||
|
||||
for jid in [contact.jid, contact.get_full_jid()]:
|
||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl:
|
||||
ctrl.print_conversation(_('Pong! (%s s.)') % seconds, 'status')
|
||||
|
||||
def handle_event_ping_error(self, account, contact):
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.jid, account):
|
||||
ctrl.print_conversation(_('Error.'), 'status')
|
||||
for ctrl in self.msg_win_mgr.get_chat_controls(contact.get_full_jid(), account):
|
||||
ctrl.print_conversation(_('Error.'), 'status')
|
||||
for jid in [contact.jid, contact.get_full_jid()]:
|
||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl:
|
||||
ctrl.print_conversation(_('Error.'), 'status')
|
||||
|
||||
def handle_event_search_form(self, account, data):
|
||||
# ('SEARCH_FORM', account, (jid, dataform, is_dataform))
|
||||
|
@ -2126,10 +2125,7 @@ class Interface:
|
|||
session = event.parameters[8]
|
||||
ctrl = session.control
|
||||
elif type_ == '':
|
||||
ctrls = self.msg_win_mgr.get_chat_controls(fjid, account)
|
||||
|
||||
if ctrls:
|
||||
ctrl = ctrls[0]
|
||||
ctrl = self.msg_win_mgr.get_control(fjid, account)
|
||||
|
||||
if not ctrl:
|
||||
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
||||
|
@ -2578,10 +2574,9 @@ class Interface:
|
|||
contact = self.roster.add_to_not_in_the_roster(account, jid,
|
||||
resource=resource)
|
||||
|
||||
ctrls = self.msg_win_mgr.get_chat_controls(fjid, account)
|
||||
if ctrls:
|
||||
ctrl = ctrls[0]
|
||||
else:
|
||||
ctrl = self.msg_win_mgr.get_control(fjid, account)
|
||||
|
||||
if not ctrl:
|
||||
ctrl = self.new_chat(contact, account,
|
||||
resource=resource)
|
||||
if len(gajim.events.get_events(account, fjid)):
|
||||
|
|
|
@ -907,12 +907,15 @@ class GroupchatControl(ChatControlBase):
|
|||
fjid = self.room_jid + '/' + nick
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(fjid, self.account):
|
||||
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, self.account)
|
||||
if ctrl:
|
||||
gc_contact.show = 'offline'
|
||||
gc_contact.status = ''
|
||||
ctrl.update_ui()
|
||||
if ctrl.parent_win:
|
||||
ctrl.parent_win.redraw_tab(ctrl)
|
||||
|
||||
gajim.contacts.remove_gc_contact(self.account, gc_contact)
|
||||
gajim.gc_connected[self.account][self.room_jid] = False
|
||||
ChatControlBase.got_disconnected(self)
|
||||
|
@ -1620,7 +1623,7 @@ class GroupchatControl(ChatControlBase):
|
|||
# Minimize it
|
||||
win = gajim.interface.msg_win_mgr.get_window(self.contact.jid,
|
||||
self.account)
|
||||
ctrl = win.get_gc_control(self.contact.jid, self.account)
|
||||
ctrl = win.get_control(self.contact.jid, self.account)
|
||||
|
||||
ctrl_page = win.notebook.page_num(ctrl.widget)
|
||||
control = win.notebook.get_nth_page(ctrl_page)
|
||||
|
|
|
@ -140,13 +140,8 @@ class MessageControl:
|
|||
if self.resource:
|
||||
jid += '/' + self.resource
|
||||
|
||||
self.parent_win.change_thread_key(jid, self.account,
|
||||
oldsession.thread_id, new_key)
|
||||
|
||||
if oldsession.enable_encryption:
|
||||
self.print_esession_details()
|
||||
elif session:
|
||||
self.parent_win.move_from_sessionless(self)
|
||||
|
||||
def send_message(self, message, keyID = '', type = 'chat',
|
||||
chatstate = None, msg_id = None, composing_xep = None, resource = None,
|
||||
|
|
|
@ -54,15 +54,10 @@ class MessageWindow(object):
|
|||
) = range(5)
|
||||
|
||||
def __init__(self, acct, type, parent_window=None, parent_paned=None):
|
||||
# A dictionary of dictionaries of dictionaries
|
||||
# where _contacts[account][jid][thread_id] == A MessageControl
|
||||
# A dictionary of dictionaries
|
||||
# where _contacts[account][jid] == A MessageControl
|
||||
self._controls = {}
|
||||
|
||||
# a dictionary of dictionaries where
|
||||
# sessionless_ctrls[account][jid] = a list of MessageControls that don't have
|
||||
# sessions attached
|
||||
self.sessionless_ctrls = {}
|
||||
|
||||
# If None, the window is not tied to any specific account
|
||||
self.account = acct
|
||||
# If None, the window is not tied to any specific type
|
||||
|
@ -154,10 +149,6 @@ class MessageWindow(object):
|
|||
self._controls[new_name] = self._controls[old_name]
|
||||
del self._controls[old_name]
|
||||
|
||||
if self.sessionless_ctrls.has_key(old_name):
|
||||
self.sessionless_ctrls[new_name] = self.sessionless_ctrls[old_name]
|
||||
del self.sessionless_ctrls[old_name]
|
||||
|
||||
for ctrl in self.controls():
|
||||
if ctrl.account == old_name:
|
||||
ctrl.account = new_name
|
||||
|
@ -166,14 +157,8 @@ class MessageWindow(object):
|
|||
|
||||
def get_num_controls(self):
|
||||
n = 0
|
||||
for jid_dict in self._controls.values():
|
||||
for dict in jid_dict.values():
|
||||
n += len(dict)
|
||||
|
||||
for jid_dict in self.sessionless_ctrls.values():
|
||||
for ctrls in jid_dict.values():
|
||||
n += len(ctrls)
|
||||
|
||||
for dict in self._controls.values():
|
||||
n += len(dict)
|
||||
return n
|
||||
|
||||
def resize(self, width, height):
|
||||
|
@ -214,7 +199,6 @@ class MessageWindow(object):
|
|||
for ctrl in self.controls():
|
||||
ctrl.shutdown()
|
||||
self._controls.clear()
|
||||
self.sessionless_ctrls.clear()
|
||||
# Clean up handlers connected to the parent window, this is important since
|
||||
# self.window may be the RosterWindow
|
||||
for i in self.handlers.keys():
|
||||
|
@ -226,22 +210,10 @@ class MessageWindow(object):
|
|||
def new_tab(self, control):
|
||||
fjid = control.get_full_jid()
|
||||
|
||||
if control.session:
|
||||
if not self._controls.has_key(control.account):
|
||||
self._controls[control.account] = {}
|
||||
if not self._controls.has_key(control.account):
|
||||
self._controls[control.account] = {}
|
||||
|
||||
if not self._controls[control.account].has_key(fjid):
|
||||
self._controls[control.account][fjid] = {}
|
||||
|
||||
self._controls[control.account][fjid][control.session.thread_id] = control
|
||||
else:
|
||||
if not self.sessionless_ctrls.has_key(control.account):
|
||||
self.sessionless_ctrls[control.account] = {}
|
||||
|
||||
if not self.sessionless_ctrls[control.account].has_key(fjid):
|
||||
self.sessionless_ctrls[control.account][fjid] = []
|
||||
|
||||
self.sessionless_ctrls[control.account][fjid].append(control)
|
||||
self._controls[control.account][fjid] = control
|
||||
|
||||
if self.get_num_controls() == 2:
|
||||
# is first conversation_textview scrolled down ?
|
||||
|
@ -486,20 +458,10 @@ class MessageWindow(object):
|
|||
|
||||
self.notebook.remove_page(self.notebook.page_num(ctrl.widget))
|
||||
|
||||
if ctrl.session:
|
||||
dict = self._controls
|
||||
idx = ctrl.session.thread_id
|
||||
else:
|
||||
dict = self.sessionless_ctrls
|
||||
idx = dict[ctrl.account][fjid].index(ctrl)
|
||||
del self._controls[ctrl.account][fjid]
|
||||
|
||||
del dict[ctrl.account][fjid][idx]
|
||||
|
||||
if len(dict[ctrl.account][fjid]) == 0:
|
||||
del dict[ctrl.account][fjid]
|
||||
|
||||
if len(dict[ctrl.account]) == 0:
|
||||
del dict[ctrl.account]
|
||||
if len(self._controls[ctrl.account]) == 0:
|
||||
del self._controls[ctrl.account]
|
||||
|
||||
self.check_tabs()
|
||||
self.show_title()
|
||||
|
@ -601,16 +563,16 @@ class MessageWindow(object):
|
|||
for ctrl in self.controls():
|
||||
ctrl.update_tags()
|
||||
|
||||
def get_control(self, key, acct, thread_id):
|
||||
def get_control(self, key, acct):
|
||||
'''Return the MessageControl for jid or n, where n is a notebook page index.
|
||||
When key is an int index acct and thread_id may be None'''
|
||||
When key is an int index acct may be None'''
|
||||
if isinstance(key, str):
|
||||
key = unicode(key, 'utf-8')
|
||||
|
||||
if isinstance(key, unicode):
|
||||
jid = key
|
||||
try:
|
||||
return self._controls[acct][jid][thread_id]
|
||||
return self._controls[acct][jid]
|
||||
except:
|
||||
return None
|
||||
else:
|
||||
|
@ -622,26 +584,11 @@ class MessageWindow(object):
|
|||
return self._widget_to_control(nth_child)
|
||||
|
||||
def has_control(self, jid, acct):
|
||||
sessioned = (acct in self._controls and jid in self._controls[acct] \
|
||||
and self._controls[acct][jid])
|
||||
|
||||
return sessioned or self.sessionless_controls(acct, jid)
|
||||
|
||||
def get_gc_control(self, jid, acct):
|
||||
return self.get_control(jid, acct, 'gc')
|
||||
return (acct in self._controls and jid in self._controls[acct])
|
||||
|
||||
def get_controls(self, jid, acct):
|
||||
try:
|
||||
sessioned = self._controls[acct][jid].values()
|
||||
except KeyError:
|
||||
sessioned = []
|
||||
|
||||
sessionless = self.sessionless_controls(acct, jid)
|
||||
return sessioned + sessionless
|
||||
|
||||
def sessionless_controls(self, acct, jid):
|
||||
try:
|
||||
return self.sessionless_ctrls[acct][jid]
|
||||
return self._controls[acct][jid]
|
||||
except KeyError:
|
||||
return []
|
||||
|
||||
|
@ -649,78 +596,22 @@ class MessageWindow(object):
|
|||
'''Change the JID key of a control'''
|
||||
try:
|
||||
# Check if controls exists
|
||||
ctrls = self._controls[acct][old_jid]
|
||||
ctrl = self._controls[acct][old_jid]
|
||||
except KeyError:
|
||||
return
|
||||
self._controls[acct][new_jid] = ctrls
|
||||
|
||||
self._controls[acct][new_jid] = ctrl
|
||||
del self._controls[acct][old_jid]
|
||||
|
||||
try:
|
||||
ctrls = self.sessionless_ctrls[acct][old_jid]
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
self.sessionless_ctrls[acct][new_jid] = ctrls
|
||||
del self.sessionless_ctrls[acct][new_jid]
|
||||
|
||||
if old_jid in gajim.last_message_time[acct]:
|
||||
gajim.last_message_time[acct][new_jid] = \
|
||||
gajim.last_message_time[acct][old_jid]
|
||||
del gajim.last_message_time[acct][old_jid]
|
||||
|
||||
def change_thread_key(self, jid, acct, old_thread_id, new_thread_id):
|
||||
'''Change the thread_id key of a control'''
|
||||
|
||||
if jid in self._controls[acct]:
|
||||
ctrl = self._controls[acct][jid][old_thread_id]
|
||||
else:
|
||||
jid = gajim.get_jid_without_resource(jid)
|
||||
ctrl = self._controls[acct][jid][old_thread_id]
|
||||
|
||||
del self._controls[acct][jid][old_thread_id]
|
||||
|
||||
if new_thread_id:
|
||||
self._controls[acct][jid][new_thread_id] = ctrl
|
||||
else:
|
||||
if acct not in self.sessionless_ctrls:
|
||||
self.sessionless_ctrls[acct] = {}
|
||||
|
||||
if jid not in self.sessionless_ctrls[acct]:
|
||||
self.sessionless_ctrls[acct][jid] = []
|
||||
|
||||
self.sessionless_ctrls[acct][jid].append(ctrl)
|
||||
|
||||
def move_from_sessionless(self, ctrl):
|
||||
'''a control just got a session, move it to the proper holding cell'''
|
||||
acct = ctrl.account
|
||||
jid = ctrl.get_full_jid()
|
||||
|
||||
idx = self.sessionless_ctrls[acct][jid].index(ctrl)
|
||||
|
||||
del self.sessionless_ctrls[acct][jid][idx]
|
||||
|
||||
if len(self.sessionless_ctrls[acct][jid]) == 0:
|
||||
del self.sessionless_ctrls[acct][jid]
|
||||
|
||||
if not self._controls.has_key(acct):
|
||||
self._controls[acct] = {}
|
||||
|
||||
if not self._controls[acct].has_key(jid):
|
||||
self._controls[acct][jid] = {}
|
||||
|
||||
thread_id = ctrl.session.thread_id
|
||||
|
||||
self._controls[acct][jid][thread_id] = ctrl
|
||||
|
||||
def controls(self):
|
||||
for jid_dict in self._controls.values():
|
||||
for ctrl_dict in jid_dict.values():
|
||||
for ctrl in ctrl_dict.values():
|
||||
yield ctrl
|
||||
for jid_dict in self.sessionless_ctrls.values():
|
||||
for ctrl_dict in jid_dict.values():
|
||||
for ctrl in ctrl_dict:
|
||||
yield ctrl
|
||||
for ctrl in jid_dict.values():
|
||||
yield ctrl
|
||||
|
||||
def move_to_next_unread_tab(self, forward):
|
||||
ind = self.notebook.get_current_page()
|
||||
|
@ -935,25 +826,6 @@ class MessageWindowMgr(gobject.GObject):
|
|||
|
||||
return None
|
||||
|
||||
def get_gc_control(self, jid, acct):
|
||||
win = self.get_window(jid, acct)
|
||||
|
||||
if win:
|
||||
return win.get_gc_control(jid, acct)
|
||||
|
||||
return None
|
||||
|
||||
def get_sessionless_ctrl(self, acct, jid):
|
||||
'''returns a ChatControl associated with jid, that doesn't have a
|
||||
session attached'''
|
||||
mw = self.get_window(jid, acct)
|
||||
|
||||
if mw:
|
||||
ctrls = mw.sessionless_controls(acct, jid)
|
||||
|
||||
if len(ctrls):
|
||||
return ctrls[0]
|
||||
|
||||
def has_window(self, jid, acct):
|
||||
return self.get_window(jid, acct) is not None
|
||||
|
||||
|
@ -1084,13 +956,18 @@ class MessageWindowMgr(gobject.GObject):
|
|||
del self._windows[k]
|
||||
return
|
||||
|
||||
def get_control(self, jid, acct, session):
|
||||
def get_control(self, jid, acct):
|
||||
'''Amongst all windows, return the MessageControl for jid'''
|
||||
win = self.get_window(jid, acct)
|
||||
if win:
|
||||
return win.get_control(jid, acct, session)
|
||||
return win.get_control(jid, acct)
|
||||
return None
|
||||
|
||||
def get_gc_control(self, jid, acct):
|
||||
'''Same as get_control. Was briefly required, is not any more.
|
||||
May be useful some day in the future?'''
|
||||
return self.get_control(jid, acct)
|
||||
|
||||
def get_controls(self, type = None, acct = None):
|
||||
ctrls = []
|
||||
for c in self.controls():
|
||||
|
@ -1100,14 +977,6 @@ class MessageWindowMgr(gobject.GObject):
|
|||
ctrls.append(c)
|
||||
return ctrls
|
||||
|
||||
def get_chat_controls(self, jid, acct):
|
||||
win = self.get_window(jid, acct)
|
||||
|
||||
if win:
|
||||
return win.get_controls(jid, acct)
|
||||
else:
|
||||
return []
|
||||
|
||||
def windows(self):
|
||||
for w in self._windows.values():
|
||||
yield w
|
||||
|
|
|
@ -1517,8 +1517,8 @@ class RosterWindow:
|
|||
|
||||
# If we already have chat windows opened, update them with new contact
|
||||
# instance
|
||||
for chat_control in gajim.interface.msg_win_mgr.get_chat_controls(ji,
|
||||
account):
|
||||
chat_control = gajim.interface.msg_win_mgr.get_control(ji, account)
|
||||
if chat_control:
|
||||
chat_control.contact = contact1
|
||||
|
||||
def _change_awn_icon_status(self, status):
|
||||
|
@ -2581,9 +2581,10 @@ class RosterWindow:
|
|||
keyID = keyID[0]
|
||||
keys[contact.jid] = keyID
|
||||
|
||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(contact.jid,
|
||||
account):
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid, account)
|
||||
if ctrl:
|
||||
ctrl.update_ui()
|
||||
|
||||
keys_str = ''
|
||||
for jid in keys:
|
||||
keys_str += jid + ' ' + keys[jid] + ' '
|
||||
|
@ -3939,11 +3940,10 @@ class RosterWindow:
|
|||
# Update roster
|
||||
self.draw_avatar(jid, account)
|
||||
# Update chat window
|
||||
if gajim.interface.msg_win_mgr.has_window(jid, account):
|
||||
win = gajim.interface.msg_win_mgr.get_window(jid, account)
|
||||
for ctrl in win.get_chat_controls(jid, account):
|
||||
if win and ctrl.type_id != message_control.TYPE_GC:
|
||||
ctrl.show_avatar()
|
||||
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl and ctrl.type_id != message_control.TYPE_GC:
|
||||
ctrl.show_avatar()
|
||||
|
||||
def on_roster_treeview_style_set(self, treeview, style):
|
||||
'''When style (theme) changes, redraw all contacts'''
|
||||
|
|
|
@ -179,7 +179,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
|||
|
||||
if not self.control:
|
||||
# look for an existing chat control without a session
|
||||
ctrl = gajim.interface.msg_win_mgr.get_sessionless_ctrl(self.conn.name, jid)
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(jid, self.conn.name)
|
||||
if ctrl:
|
||||
self.control = ctrl
|
||||
self.control.set_session(self)
|
||||
|
|
|
@ -123,9 +123,9 @@ class VcardWindow:
|
|||
# Update roster
|
||||
gajim.interface.roster.draw_avatar(jid, self.account)
|
||||
# Update chat windows
|
||||
for ctrl in gajim.interface.msg_win_mgr.get_chat_controls(jid, self.account):
|
||||
if ctrl.type_id != message_control.TYPE_GC:
|
||||
ctrl.show_avatar()
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(jid, self.account)
|
||||
if ctrl and ctrl.type_id != message_control.TYPE_GC:
|
||||
ctrl.show_avatar()
|
||||
|
||||
def on_vcard_information_window_destroy(self, widget):
|
||||
if self.update_progressbar_timeout_id is not None:
|
||||
|
|
|
@ -177,9 +177,9 @@ class TestChatControlSession(unittest.TestCase):
|
|||
msgtxt = 'testing one two three'
|
||||
|
||||
ctrl = MockChatControl()
|
||||
gajim.interface.msg_win_mgr = Mock({'get_sessionless_ctrl': ctrl})
|
||||
gajim.interface.msg_win_mgr.mockSetExpectation('get_sessionless_ctrl',
|
||||
expectParams(account_name, jid))
|
||||
gajim.interface.msg_win_mgr = Mock({'get_control': ctrl})
|
||||
gajim.interface.msg_win_mgr.mockSetExpectation('get_control',
|
||||
expectParams(jid, account_name))
|
||||
|
||||
self.receive_chat_msg(fjid, msgtxt)
|
||||
|
||||
|
|
Loading…
Reference in New Issue