handle correctly when server return answer to register request when we create a new account. Fixes #1725
This commit is contained in:
parent
4f6c6d3d14
commit
ff7eb2356a
|
@ -156,14 +156,15 @@ class Connection(ConnectionHandlers):
|
||||||
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
|
||||||
|
if not data[1]: # wrong answer
|
||||||
|
print self.connection.lastErr
|
||||||
|
self.dispatch('ACC_NOT_OK', (
|
||||||
|
_('Transport %s answered wrongly to register request.') % \
|
||||||
|
data[0]))
|
||||||
|
return
|
||||||
req = data[1].asDict()
|
req = data[1].asDict()
|
||||||
req['username'] = self.new_account_info['name']
|
req['username'] = self.new_account_info['name']
|
||||||
req['password'] = self.new_account_info['password']
|
req['password'] = self.new_account_info['password']
|
||||||
|
@ -185,6 +186,11 @@ class Connection(ConnectionHandlers):
|
||||||
common.xmpp.features_nb.register(self.connection, data[0],
|
common.xmpp.features_nb.register(self.connection, data[0],
|
||||||
req, _on_register_result)
|
req, _on_register_result)
|
||||||
return
|
return
|
||||||
|
if not data[1]: # wrong answer
|
||||||
|
self.dispatch('ERROR', (_('Invalid answer'),
|
||||||
|
_('Transport %s answered wrongly to register request.') % \
|
||||||
|
data[0]))
|
||||||
|
return
|
||||||
is_form = data[2]
|
is_form = data[2]
|
||||||
if is_form:
|
if is_form:
|
||||||
conf = self.parse_data_form(data[1])
|
conf = self.parse_data_form(data[1])
|
||||||
|
|
|
@ -118,6 +118,7 @@ def getRegInfo(disp, host, info={}, sync=True):
|
||||||
def _ReceivedRegInfo(con, resp, agent):
|
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):
|
||||||
|
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False))
|
||||||
return
|
return
|
||||||
tag=resp.getTag('query',namespace=NS_REGISTER)
|
tag=resp.getTag('query',namespace=NS_REGISTER)
|
||||||
if not tag:
|
if not tag:
|
||||||
|
|
Loading…
Reference in New Issue