fixed use of common.xmpp namespace in a place it wasn't imported

This commit is contained in:
Brendan Taylor 2007-11-28 19:26:40 +00:00
parent 16e8369e23
commit 1cd5b3da39
2 changed files with 20 additions and 14 deletions

View File

@ -584,7 +584,7 @@ class EncryptedStanzaSession(StanzaSession):
self.status = 'responded-e2e' self.status = 'responded-e2e'
feature.addChild(node=x) feature.addChild(node=x)
if not_acceptable: if not_acceptable:
response = xmpp.Error(response, xmpp.ERR_NOT_ACCEPTABLE) response = xmpp.Error(response, xmpp.ERR_NOT_ACCEPTABLE)
@ -853,14 +853,29 @@ class EncryptedStanzaSession(StanzaSession):
def acknowledge_termination(self): def acknowledge_termination(self):
StanzaSession.acknowledge_termination(self) StanzaSession.acknowledge_termination(self)
self.enable_encryption = False self.enable_encryption = False
def fail_bad_negotiation(self, reason): def fail_bad_negotiation(self, reason, fields = None):
'''they've tried to feed us a bogus value, send an error and cancel everything.''' '''sends an error and cancels everything.
if fields == None, the remote party has given us a bad cryptographic value of some kind
otherwise, list the fields we haven't implemented'''
err = xmpp.Error(xmpp.Message(), xmpp.ERR_FEATURE_NOT_IMPLEMENTED) err = xmpp.Error(xmpp.Message(), xmpp.ERR_FEATURE_NOT_IMPLEMENTED)
err.T.error.T.text.setData(reason) err.T.error.T.text.setData(reason)
if fields:
feature = xmpp.Node(xmpp.NS_FEATURE + ' feature')
for field in fields:
fn = xmpp.Node('field')
fn['var'] = field
feature.addChild(node=feature)
err.addChild(node=feature)
self.send(err) self.send(err)
self.status = None self.status = None

View File

@ -1898,16 +1898,7 @@ class Interface:
# we don't support 3-message negotiation as the responder # we don't support 3-message negotiation as the responder
if 'dhkeys' in form.asDict(): if 'dhkeys' in form.asDict():
err = xmpp.Error(xmpp.Message(), xmpp.ERR_FEATURE_NOT_IMPLEMENTED) session.fail_bad_negotiation('3 message negotiation not supported when responding', ('dhkeys',))
feature = xmpp.Node(xmpp.NS_FEATURE + ' feature')
field = xmpp.Node('field')
field['var'] = 'dhkeys'
feature.addChild(node=field)
err.addChild(node=feature)
session.send(err)
return return
negotiated, not_acceptable, ask_user = session.verify_options_bob(form) negotiated, not_acceptable, ask_user = session.verify_options_bob(form)