From 5a20109e05aca12291291dc0a9489cb0e1ad516f Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 26 Apr 2006 21:43:58 +0000
Subject: [PATCH] don't definitively remove a contact when it has unread events

---
 src/gajim.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/gajim.py b/src/gajim.py
index 1bf378bb3a..b05af51f49 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -977,8 +977,21 @@ class Interface:
 		if (not sub or sub == 'none') and (not ask or ask == 'none') and \
 		not name and not groups:
 			if contacts:
-				self.roster.remove_contact(contacts[0], account)
+				c = contacts[0]
+				self.roster.remove_contact(c, account)
 				gajim.contacts.remove_jid(account, jid)
+				if gajim.awaiting_events[account].has_key(c.jid):
+					keyID = ''
+					attached_keys = gajim.config.get_per('accounts', account,
+						'attached_gpg_keys').split()
+					if jid in attached_keys:
+						keyID = attached_keys[attached_keys.index(jid) + 1]
+					contact = gajim.contacts.create_contact(jid = c.jid,
+						name = '', groups = [_('Not in Roster')],
+						show = 'not in roster', status = '', sub = 'none',
+						keyID = keyID)
+					gajim.contacts.add_contact(account, contact)
+					self.roster.add_contact_to_roster(contact.jid, account)
 				#FIXME if it was the only one in its group, remove the group
 				return
 		elif not contacts:
-- 
GitLab