fix listing and leaving groupchats from adhoc commands. Fixes #4344
This commit is contained in:
parent
22cc993fa7
commit
c797a14b8c
2 changed files with 14 additions and 7 deletions
|
@ -158,7 +158,8 @@ def find_current_groupchats(account):
|
|||
import message_control
|
||||
rooms = []
|
||||
for gc_control in gajim.interface.msg_win_mgr.get_controls(
|
||||
message_control.TYPE_GC):
|
||||
message_control.TYPE_GC) + gajim.interface.minimized_controls[account].\
|
||||
values():
|
||||
acct = gc_control.account
|
||||
# check if account is the good one
|
||||
if acct != account:
|
||||
|
@ -224,8 +225,7 @@ class LeaveGroupchatsCommand(AdHocCommand):
|
|||
|
||||
try:
|
||||
gc = form['groupchats'].values
|
||||
except: # KeyError if there's no presence-type field in form or
|
||||
# AttributeError if that field is of wrong type
|
||||
except: # KeyError if there's no groupchats in form
|
||||
self.badRequest(request)
|
||||
return False
|
||||
account = self.connection.name
|
||||
|
@ -233,8 +233,14 @@ class LeaveGroupchatsCommand(AdHocCommand):
|
|||
for room_jid in gc:
|
||||
gc_control = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
|
||||
account)
|
||||
if not gc_control:
|
||||
gc_control = gajim.interface.minimized_controls[account]\
|
||||
[room_jid]
|
||||
gc_control.shutdown()
|
||||
gajim.interface.roster.remove_groupchat(room_jid, account)
|
||||
continue
|
||||
gc_control.parent_win.remove_tab(gc_control, None, force = True)
|
||||
except: # KeyError if there's no presence-type field in form or
|
||||
except: # KeyError if there's no such room opened
|
||||
self.badRequest(request)
|
||||
return False
|
||||
response, cmd = self.buildResponse(request, status = 'completed')
|
||||
|
|
|
@ -514,8 +514,6 @@ class MessageWindow(object):
|
|||
close(ctrl)
|
||||
|
||||
def on_no(ctrl):
|
||||
if not force:
|
||||
return
|
||||
close(ctrl)
|
||||
|
||||
def on_minimize(ctrl):
|
||||
|
@ -526,7 +524,10 @@ class MessageWindow(object):
|
|||
close(ctrl)
|
||||
|
||||
# Shutdown the MessageControl
|
||||
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
|
||||
if force:
|
||||
close(ctrl)
|
||||
else:
|
||||
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
|
||||
|
||||
def check_tabs(self):
|
||||
if self.get_num_controls() == 0:
|
||||
|
|
Loading…
Add table
Reference in a new issue