Commit 298adcf0 authored by Philipp Hörist's avatar Philipp Hörist

Commands: Fix giving a reason when executing /leave

parent 91f82a8f
Pipeline #3985 passed with stages
in 2 minutes and 53 seconds
......@@ -312,7 +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.leave()
self.leave(reason=reason)
@command(raw=True, empty=True)
@doc(_("""
......
......@@ -163,14 +163,15 @@ class MUC(BaseModule):
self._set_muc_state(muc_data.jid, MUCJoinedState.JOINING)
self._con.connection.send(presence)
def leave(self, room_jid):
def leave(self, room_jid, reason=None):
self._log.info('Leave MUC: %s', room_jid)
self._remove_join_timeout(room_jid)
self._set_muc_state(room_jid, MUCJoinedState.NOT_JOINED)
muc_data = self._get_muc_data(room_jid)
self._con.get_module('Presence').send_presence(
muc_data.occupant_jid,
typ='unavailable')
typ='unavailable',
status=reason)
# We leave a group chat, disable bookmark autojoin
self._con.get_module('Bookmarks').set_autojoin(room_jid, False)
......
......@@ -1544,8 +1544,9 @@ class GroupchatControl(ChatControlBase):
self.update_actions()
def leave(self):
app.connections[self.account].get_module('MUC').leave(self.room_jid)
def leave(self, reason=None):
app.connections[self.account].get_module('MUC').leave(self.room_jid,
reason=reason)
self.got_disconnected()
self._close_control()
......
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