diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 081e61c03..842063248 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -876,13 +876,11 @@ class GroupchatControl(ChatControlBase): return True elif command == 'leave' or command == 'part' or command == 'close': # Leave the room and close the tab or window - # FIXME: Sometimes this doesn't actually leave the room. Why? reason = 'offline' if len(message_array): reason = message_array.pop(0) - gajim.connections[self.account].send_gc_status(self.nick, self.room_jid, - show='offline', status=reason) - self.parent_win.remove_tab(self) + self.parent_win.remove_tab(self,reason) + self.clear(self.msg_textview) return True elif command == 'ban': if len(message_array): @@ -1030,9 +1028,9 @@ class GroupchatControl(ChatControlBase): gajim.connections[self.account].change_gc_nick(self.room_jid, nick) self.nick = nick - def shutdown(self): + def shutdown(self, status='offline'): gajim.connections[self.account].send_gc_status(self.nick, self.room_jid, - show='offline', status='offline') + show='offline', status=status) # They can already be removed by the destroy function if self.room_jid in gajim.contacts.get_gc_list(self.account): gajim.contacts.remove_room(self.account, self.room_jid) diff --git a/src/message_window.py b/src/message_window.py index debdc7121..edd08e4bb 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -247,11 +247,14 @@ class MessageWindow: ctrl_page = self.notebook.page_num(ctrl.widget) self.notebook.set_current_page(ctrl_page) - def remove_tab(self, ctrl): + def remove_tab(self, ctrl,reason=None): # reason is only for gc (offline status message) # Shutdown the MessageControl if not ctrl.allow_shutdown(): return - ctrl.shutdown() + if reason is not None: # We are leaving gc with a status message + ctrl.shutdown(reason) + else: # We are leaving gc without status message or it's a chat + ctrl.shutdown() # Update external state if gajim.interface.systray_enabled: