removed some odd flow control left behind when one of the session negotiation dialogs was removed

This commit is contained in:
Brendan Taylor 2008-08-30 01:31:11 +00:00
parent f64cd6d238
commit 29c6af7e1e
1 changed files with 27 additions and 34 deletions

View File

@ -369,42 +369,35 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
try:
# bob responds
if form.getType() == 'form' and 'security' in form.asDict():
def continue_with_negotiation():
# we don't support 3-message negotiation as the responder
if 'dhkeys' in form.asDict():
self.fail_bad_negotiation('3 message negotiation not supported when responding', ('dhkeys',))
return
negotiated, not_acceptable, ask_user = self.verify_options_bob(form)
if ask_user:
def accept_nondefault_options(is_checked):
self.dialog.destroy()
negotiated.update(ask_user)
self.respond_e2e_bob(form, negotiated, not_acceptable)
def reject_nondefault_options():
self.dialog.destroy()
for key in ask_user.keys():
not_acceptable.append(key)
self.respond_e2e_bob(form, negotiated, not_acceptable)
self.dialog = dialogs.YesNoDialog(_('Confirm these session options'),
_('''The remote client wants to negotiate an session with these features:
%s
Are these options acceptable?''') % (negotiation.describe_features(ask_user)),
on_response_yes=accept_nondefault_options,
on_response_no=reject_nondefault_options)
else:
self.respond_e2e_bob(form, negotiated, not_acceptable)
def ignore_negotiation(widget):
self.dialog.destroy()
# we don't support 3-message negotiation as the responder
if 'dhkeys' in form.asDict():
self.fail_bad_negotiation('3 message negotiation not supported when responding', ('dhkeys',))
return
continue_with_negotiation()
negotiated, not_acceptable, ask_user = self.verify_options_bob(form)
if ask_user:
def accept_nondefault_options(is_checked):
self.dialog.destroy()
negotiated.update(ask_user)
self.respond_e2e_bob(form, negotiated, not_acceptable)
def reject_nondefault_options():
self.dialog.destroy()
for key in ask_user.keys():
not_acceptable.append(key)
self.respond_e2e_bob(form, negotiated, not_acceptable)
self.dialog = dialogs.YesNoDialog(_('Confirm these session options'),
_('''The remote client wants to negotiate an session with these features:
%s
Are these options acceptable?''') % (negotiation.describe_features(ask_user)),
on_response_yes=accept_nondefault_options,
on_response_no=reject_nondefault_options)
else:
self.respond_e2e_bob(form, negotiated, not_acceptable)
return