we remove agent even if it doesn't reply. Fixes #1756

This commit is contained in:
Yann Leboulanger 2006-04-06 16:58:20 +00:00
parent 29f41b223a
commit 1bc78a3818
2 changed files with 4 additions and 4 deletions

View File

@ -717,16 +717,14 @@ class Connection(ConnectionHandlers):
if iq_obj.getTag('error'): if iq_obj.getTag('error'):
# error, probably not a real agent # error, probably not a real agent
return return
self.connection.getRoster().delItem(agent)
def unsubscribe_agent(self, agent): def unsubscribe_agent(self, agent):
if not self.connection: if not self.connection:
return return
iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent) iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent)
iq.getTag('query').setTag('remove') iq.getTag('query').setTag('remove')
self.connection.SendAndCallForResponse(iq, self._continue_unsubscribe, self.connection.send(iq)
{'agent': agent}) self.connection.getRoster().delItem(agent)
return
def update_contact(self, jid, name, groups): def update_contact(self, jid, name, groups):
'''update roster item on jabber server''' '''update roster item on jabber server'''

View File

@ -965,6 +965,8 @@ class Interface:
#FIXME if it was the only one in its group, remove the group #FIXME if it was the only one in its group, remove the group
return return
elif not contacts: elif not contacts:
if sub == 'remove':
return
# Add it to roster # Add it to roster
contact = gajim.contacts.create_contact(jid = jid, name = name, contact = gajim.contacts.create_contact(jid = jid, name = name,
groups = groups, show = 'offline', sub = sub, ask = ask) groups = groups, show = 'offline', sub = sub, ask = ask)