Commit 4cbc0666 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

show an error dialog when a transport answers wrongly to register request. Fixes #1702

parent 721acff7
......@@ -1674,6 +1674,11 @@ class Connection:
if realm == common.xmpp.NS_REGISTER:
if event == common.xmpp.features_nb.REGISTER_DATA_RECEIVED:
# data is (agent, DataFrom, is_form)
if not data[1]: # wrong answer
self.dispatch('ERROR', (_('Invalid answer'),
_('Transport %s answered wrongly to register request.') % \
data[0]))
return
if self.new_account_info and\
self.new_account_info['hostname'] == data[0]:
#it's a new account
......
......@@ -119,7 +119,11 @@ def _ReceivedRegInfo(con, resp, agent):
iq=Iq('get',NS_REGISTER,to=agent)
if not isResultNode(resp):
return
df=resp.getTag('query',namespace=NS_REGISTER).getTag('x',namespace=NS_DATA)
tag=resp.getTag('query',namespace=NS_REGISTER)
if not tag:
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False))
return
df=tag.getTag('x',namespace=NS_DATA)
if df:
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,DataForm(node=df),True))
return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment