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
|
import message_control
|
||||||
rooms = []
|
rooms = []
|
||||||
for gc_control in gajim.interface.msg_win_mgr.get_controls(
|
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
|
acct = gc_control.account
|
||||||
# check if account is the good one
|
# check if account is the good one
|
||||||
if acct != account:
|
if acct != account:
|
||||||
|
@ -224,8 +225,7 @@ class LeaveGroupchatsCommand(AdHocCommand):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gc = form['groupchats'].values
|
gc = form['groupchats'].values
|
||||||
except: # KeyError if there's no presence-type field in form or
|
except: # KeyError if there's no groupchats in form
|
||||||
# AttributeError if that field is of wrong type
|
|
||||||
self.badRequest(request)
|
self.badRequest(request)
|
||||||
return False
|
return False
|
||||||
account = self.connection.name
|
account = self.connection.name
|
||||||
|
@ -233,8 +233,14 @@ class LeaveGroupchatsCommand(AdHocCommand):
|
||||||
for room_jid in gc:
|
for room_jid in gc:
|
||||||
gc_control = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
|
gc_control = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
|
||||||
account)
|
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)
|
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)
|
self.badRequest(request)
|
||||||
return False
|
return False
|
||||||
response, cmd = self.buildResponse(request, status = 'completed')
|
response, cmd = self.buildResponse(request, status = 'completed')
|
||||||
|
|
|
@ -514,8 +514,6 @@ class MessageWindow(object):
|
||||||
close(ctrl)
|
close(ctrl)
|
||||||
|
|
||||||
def on_no(ctrl):
|
def on_no(ctrl):
|
||||||
if not force:
|
|
||||||
return
|
|
||||||
close(ctrl)
|
close(ctrl)
|
||||||
|
|
||||||
def on_minimize(ctrl):
|
def on_minimize(ctrl):
|
||||||
|
@ -526,6 +524,9 @@ class MessageWindow(object):
|
||||||
close(ctrl)
|
close(ctrl)
|
||||||
|
|
||||||
# Shutdown the MessageControl
|
# Shutdown the MessageControl
|
||||||
|
if force:
|
||||||
|
close(ctrl)
|
||||||
|
else:
|
||||||
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
|
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
|
||||||
|
|
||||||
def check_tabs(self):
|
def check_tabs(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue