[Jim++] Patch for #1603

This commit is contained in:
Travis Shirk 2006-03-03 13:58:52 +00:00
parent 7126dfb679
commit 554b508e9f
2 changed files with 9 additions and 8 deletions

View File

@ -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)

View File

@ -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: