according to JEP-0100, no need to get the key of an agent to remove it
This commit is contained in:
parent
1926369859
commit
b5244d8a9c
|
@ -707,23 +707,16 @@ class Connection:
|
||||||
if delroster:
|
if delroster:
|
||||||
self.connection.getRoster().delItem(jid)
|
self.connection.getRoster().delItem(jid)
|
||||||
|
|
||||||
def _receive_agent_info(self, con, iq_obj, agent):
|
def _continue_unsubscribe(self, con, iq_obj, agent):
|
||||||
if not iq_obj:
|
self.connection.getRoster().delItem(agent)
|
||||||
return
|
|
||||||
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')
|
|
||||||
iq.getTag('query').setTagData('key',key)
|
|
||||||
self.connection.send(iq)
|
|
||||||
self.dispatch('AGENT_REMOVED', agent)
|
self.dispatch('AGENT_REMOVED', agent)
|
||||||
|
|
||||||
def unsubscribe_agent(self, agent):
|
def unsubscribe_agent(self, agent):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
self.connection.getRoster().delItem(agent)
|
iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent)
|
||||||
iq = common.xmpp.Iq('get', common.xmpp.NS_REGISTER, to = agent)
|
iq.getTag('query').setTag('remove')
|
||||||
self.connection.SendAndCallForResponse(iq, self._receive_agent_info,
|
self.connection.SendAndCallForResponse(iq, self._continue_unsubscribe,
|
||||||
{'agent': agent})
|
{'agent': agent})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue