Commit 91f82a8f authored by Philipp Hörist's avatar Philipp Hörist

Groupchat: Add and use leave() method

parent 2b3e1048
Pipeline #3984 failed with stages
in 2 minutes and 35 seconds
......@@ -312,8 +312,7 @@ class StandardGroupChatCommands(CommandContainer):
@command('part', 'close', raw=True, empty=True)
@doc(_("Leave the group chat, optionally giving a reason, and close tab or window"))
def leave(self, reason):
self.connection.get_module('MUC').leave(self.room_jid)
self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND, reason)
self.leave()
@command(raw=True, empty=True)
@doc(_("""
......
......@@ -631,8 +631,7 @@ class GroupchatControl(ChatControlBase):
# Actions
def _on_disconnect(self, action, param):
app.connections[self.account].get_module('MUC').leave(self.room_jid)
self._close_control()
self.leave()
def _on_destroy_room(self, action, param):
def _on_confirm(reason, jid):
......@@ -1545,6 +1544,11 @@ class GroupchatControl(ChatControlBase):
self.update_actions()
def leave(self):
app.connections[self.account].get_module('MUC').leave(self.room_jid)
self.got_disconnected()
self._close_control()
def rejoin(self):
if not self.autorejoin:
return False
......@@ -2227,7 +2231,10 @@ class GroupchatControl(ChatControlBase):
on_yes(self)
def _close_control(self):
self.parent_win.remove_tab(self, None, force=True)
if self.parent_win is None:
self.shutdown()
else:
self.parent_win.remove_tab(self, None, force=True)
def set_control_active(self, state):
self.conv_textview.allow_focus_out_line = True
......
......@@ -2960,11 +2960,9 @@ class RosterWindow:
"""
When disconnect menuitem is activated: disconnect from room
"""
app.connections[account].get_module('MUC').leave(jid)
if jid in app.interface.minimized_controls[account]:
ctrl = app.interface.minimized_controls[account][jid]
ctrl.shutdown()
ctrl.got_disconnected()
ctrl.leave()
self.remove_groupchat(jid, account)
def on_reconnect(self, widget, jid, account):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment