the removal of an agent is now async
This commit is contained in:
parent
2171def073
commit
1753a316e4
1 changed files with 13 additions and 8 deletions
|
@ -693,15 +693,10 @@ class Connection:
|
|||
if delroster:
|
||||
self.connection.getRoster().delItem(jid)
|
||||
|
||||
def unsubscribe_agent(self, agent):
|
||||
if not self.connection:
|
||||
def _receive_agent_info(self, con, iq_obj, agent):
|
||||
if not iq_obj:
|
||||
return
|
||||
self.connection.getRoster().delItem(agent)
|
||||
iq = common.xmpp.Iq('get', common.xmpp.NS_REGISTER, to = agent)
|
||||
agent_info = self.connection.SendAndWaitForResponse(iq) # FIXME: This blocks!
|
||||
if not agent_info:
|
||||
return
|
||||
key = agent_info.getTag('query').getTagData('key')
|
||||
key = iq_obj.getTag('query').getTagData('key')
|
||||
iq = common.xmpp.Iq(to = agent, typ = 'set', queryNS =\
|
||||
common.xmpp.NS_REGISTER)
|
||||
iq.getTag('query').setTag('remove')
|
||||
|
@ -709,6 +704,16 @@ class Connection:
|
|||
self.connection.send(iq)
|
||||
self.dispatch('AGENT_REMOVED', agent)
|
||||
|
||||
def unsubscribe_agent(self, agent):
|
||||
if not self.connection:
|
||||
return
|
||||
self.connection.getRoster().delItem(agent)
|
||||
iq = common.xmpp.Iq('get', common.xmpp.NS_REGISTER, to = agent)
|
||||
self.connection.SendAndCallForResponse(iq, self._receive_agent_info,
|
||||
{'agent': agent})
|
||||
return
|
||||
agent_info = self.connection.SendAndWaitForResponse(iq) # FIXME: This blocks!
|
||||
|
||||
def update_user(self, jid, name, groups):
|
||||
if self.connection:
|
||||
self.connection.getRoster().setItem(jid = jid, name = name,
|
||||
|
|
Loading…
Add table
Reference in a new issue