infor user about success or failure of registration with an agent. Fixes #3474
This commit is contained in:
parent
2087fcb016
commit
2804251df6
|
@ -666,11 +666,21 @@ class ConnectionDisco:
|
||||||
iq.setID(id_)
|
iq.setID(id_)
|
||||||
# Wait the answer during 30 secondes
|
# Wait the answer during 30 secondes
|
||||||
self.awaiting_timeouts[gajim.idlequeue.current_time() + 30] = (id_,
|
self.awaiting_timeouts[gajim.idlequeue.current_time() + 30] = (id_,
|
||||||
_('Registration information for transport %s has not arrived in time') % \
|
_('Registration information for transport %s has not arrived in time')\
|
||||||
agent)
|
% agent)
|
||||||
self.connection.SendAndCallForResponse(iq, self._ReceivedRegInfo,
|
self.connection.SendAndCallForResponse(iq, self._ReceivedRegInfo,
|
||||||
{'agent': agent})
|
{'agent': agent})
|
||||||
|
|
||||||
|
def _agent_registered_cb(self, con, resp, agent):
|
||||||
|
if resp.getType() == 'result':
|
||||||
|
self.dispatch('INFORMATION', (_('Registration succeeded'),
|
||||||
|
_('Resgitration with agent %s succeeded') % agent))
|
||||||
|
if resp.getType() == 'error':
|
||||||
|
self.dispatch('ERROR', (_('Registration failed'), _('Resgitration with'
|
||||||
|
' agent %(agent)s failed with error %(error)s: %(error_msg)s') % {
|
||||||
|
'agent': agent, 'error': resp.getError(),
|
||||||
|
'error_msg': resp.getErrorMsg()}))
|
||||||
|
|
||||||
def register_agent(self, agent, info, is_form = False):
|
def register_agent(self, agent, info, is_form = False):
|
||||||
if not self.connection or self.connected < 2:
|
if not self.connection or self.connected < 2:
|
||||||
return
|
return
|
||||||
|
@ -679,7 +689,8 @@ class ConnectionDisco:
|
||||||
query = iq.getTag('query')
|
query = iq.getTag('query')
|
||||||
info.setAttr('type', 'submit')
|
info.setAttr('type', 'submit')
|
||||||
query.addChild(node = info)
|
query.addChild(node = info)
|
||||||
self.connection.send(iq)
|
self.connection.SendAndCallForResponse(iq, self._agent_registered_cb,
|
||||||
|
{'agent': agent})
|
||||||
else:
|
else:
|
||||||
# fixed: blocking
|
# fixed: blocking
|
||||||
common.xmpp.features_nb.register(self.connection, agent, info, None)
|
common.xmpp.features_nb.register(self.connection, agent, info, None)
|
||||||
|
|
Loading…
Reference in New Issue