Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits: 819efbef by wurstsalat at 2021-09-05T22:55:53+02:00 Gateway: Fix removing gateway
- - - - -
2 changed files:
- gajim/common/modules/gateway.py - gajim/gtk/roster.py
Changes:
===================================== gajim/common/modules/gateway.py ===================================== @@ -34,7 +34,7 @@ def unsubscribe(self, agent):
self._con.connection.SendAndCallForResponse( iq, self._on_unsubscribe_result) - self._con.get_module('Roster').del_item(agent) + self._con.get_module('Roster').delete_item(agent)
def _on_unsubscribe_result(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): @@ -43,16 +43,19 @@ def _on_unsubscribe_result(self, _nbxmpp_client, stanza):
agent = stanza.getFrom().bare jid_list = [] - for jid in app.contacts.get_jid_list(self._account): - if jid.endswith('@' + agent): - jid_list.append(jid) - self._log.info('Removing contact %s due to' - ' unregistered transport %s', jid, agent) - self._con.get_module('Presence').unsubscribe(jid) + for contact in self._client.get_module('Roster').iter_contacts: + if contact.jid.domain == agent: + jid_list.append(contact.jid) + self._log.info( + 'Removing contact %s due to unregistered transport %s', + contact.jid, + agent) + self._con.get_module('Presence').unsubscribe(contact.jid) + # Transport contacts can't have 2 resources - if jid in app.to_be_removed[self._account]: + if contact.jid in app.to_be_removed[self._account]: # This way we'll really remove it - app.to_be_removed[self._account].remove(jid) + app.to_be_removed[self._account].remove(contact.jid)
app.nec.push_incoming_event( NetworkEvent('agent-removed',
===================================== gajim/gtk/roster.py ===================================== @@ -289,7 +289,6 @@ def _on_remove_contact(self, _action, param): def _on_remove(): self._client.get_module('Gateway').unsubscribe( selected_contact.jid) - app.window.remove_contact(self._account, jid)
ConfirmationDialog( _('Remove Transport'),
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/819efbefd60cd86afcc807f3dc1e71e43...