diff --git a/src/gajim.py b/src/gajim.py index 98dfd6829..34a7c66aa 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -2018,16 +2018,26 @@ class Interface: form.getField('terminate').getValue() in ('1', 'true'): was_encrypted = session.enable_encryption ctrl = session.control + jid = str(jid) session.acknowledge_termination() - gajim.connections[account].delete_session(str(jid), session.thread_id) + gajim.connections[account].delete_session(jid, session.thread_id) if ctrl: - new_sess = gajim.connections[account].make_new_session(str(jid)) + # replace the old session in this control with a new one + new_sess = gajim.connections[account].make_new_session(jid) + win = ctrl.parent_win + ctrl.set_session(new_sess) - gajim.connections[account].delete_session(str(jid), + gajim.connections[account].delete_session(jid, session.thread_id) + if not jid in win._controls[account]: + jid = gajim.get_jid_without_resource(jid) + + del win._controls[account][jid][session.thread_id] + win._controls[account][jid][new_sess.thread_id] = ctrl + if was_encrypted: ctrl.print_esession_details()