Skip to content
Snippets Groups Projects
Commit 0441ccd4 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Move 'agent-removed' handler into Gateway module

parent f3d5babc
No related branches found
No related tags found
No related merge requests found
......@@ -265,25 +265,8 @@ class ConnectionHandlers(ConnectionSocks5Bytestream,
app.nec.register_incoming_event(StreamConflictReceivedEvent)
app.nec.register_incoming_event(NotificationEvent)
app.ged.register_event_handler('agent-removed', ged.CORE,
self._nec_agent_removed)
def cleanup(self):
ConnectionHandlersBase.cleanup(self)
app.ged.remove_event_handler('agent-removed', ged.CORE,
self._nec_agent_removed)
def _nec_agent_removed(self, obj):
if obj.conn.name != self.name:
return
for jid in obj.jid_list:
log.debug('Removing contact %s due to unregistered transport %s',
jid, obj.agent)
self.get_module('Presence').unsubscribe(jid)
# Transport contacts can't have 2 resources
if jid in app.to_be_removed[self.name]:
# This way we'll really remove it
app.to_be_removed[self.name].remove(jid)
def discover_ft_proxies(self):
cfg_proxies = app.config.get_per('accounts', self.name,
......
......@@ -51,6 +51,13 @@ class Gateway:
for jid in app.contacts.get_jid_list(self._account):
if jid.endswith('@' + agent):
jid_list.append(jid)
log.info('Removing contact %s due to unregistered transport %s',
jid, agent)
self._con.get_module('Presence').unsubscribe(jid)
# Transport contacts can't have 2 resources
if jid in app.to_be_removed[self._account]:
# This way we'll really remove it
app.to_be_removed[self._account].remove(jid)
app.nec.push_incoming_event(
NetworkEvent('agent-removed',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment