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

This commit is contained in:
Yann Leboulanger 2006-03-15 08:56:36 +00:00
parent 721acff70f
commit 4cbc0666ff
2 changed files with 10 additions and 1 deletions

View File

@ -1674,6 +1674,11 @@ class Connection:
if realm == common.xmpp.NS_REGISTER: if realm == common.xmpp.NS_REGISTER:
if event == common.xmpp.features_nb.REGISTER_DATA_RECEIVED: if event == common.xmpp.features_nb.REGISTER_DATA_RECEIVED:
# data is (agent, DataFrom, is_form) # 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\ if self.new_account_info and\
self.new_account_info['hostname'] == data[0]: self.new_account_info['hostname'] == data[0]:
#it's a new account #it's a new account

View File

@ -119,7 +119,11 @@ def _ReceivedRegInfo(con, resp, agent):
iq=Iq('get',NS_REGISTER,to=agent) iq=Iq('get',NS_REGISTER,to=agent)
if not isResultNode(resp): if not isResultNode(resp):
return 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: if df:
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,DataForm(node=df),True)) con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,DataForm(node=df),True))
return return