From ee5082485f26dc96fa15f0a3414983ccc9eb118f Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 14 Sep 2006 19:14:59 +0000 Subject: [PATCH] don't remove a transport if there are unread events from contacts from this transport. Fixes #2144 --- src/roster_window.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/roster_window.py b/src/roster_window.py index b7f46ba33..cde3a40b3 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1204,7 +1204,7 @@ class RosterWindow: gajim.connections[account].request_register_agent_info(contact.jid) def on_remove_agent(self, widget, list_): - '''When an agent is requested to log in or off. list_ is a list of + '''When an agent is requested to be removed. list_ is a list of (contact, account) tuple''' for (contact, account) in list_: if gajim.config.get_per('accounts', account, 'hostname') == \ @@ -1226,6 +1226,17 @@ class RosterWindow: gajim.contacts.remove_jid(account, contact.jid) gajim.contacts.remove_contact(account, contact) + # Check if there are unread events from some contacts + has_unread_events = False + for (contact, account) in list_: + for jid in gajim.events.get_events(account): + if jid.endswith(contact.jid): + has_unread_events = True + break + if has_unread_events: + dialogs.ErrorDialog(_('You have unread messages'), + _('You must read them before removing this transport.')) + return if len(list_) == 1: pritext = _('Transport "%s" will be removed') % contact.jid sectext = _('You will no longer be able to send and receive messages to contacts from this transport.')