Bug 122317

Summary: Cannot delete MSN contact
Product: [Unmaintained] kopete Reporter: Daniel Andersen <kdebugs>
Component: MSN PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: danielfm123, smoothhound, tiagomnm, yg
Priority: NOR    
Version First Reported In: 0.11   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Daniel Andersen 2006-02-20 00:52:03 UTC
Version:           0.11 (using KDE KDE 3.5.0)
Installed from:    Debian testing/unstable Packages

If i delete an MSN contact from my list, then close and restart Kopete, the users always re-appear on my list. I have been trying to get some people off my list for weeks with no success.
Comment 1 Michaël Larouche 2006-02-26 17:31:28 UTC
SVN commit 513817 by mlarouche:

BUG: 122317

Fix deletion of MSN contact.
Delete MSNContact instance when the remove command is confirmed by MSN Notification server.



 M  +9 -3      msnaccount.cpp  
 M  +16 -18    msncontact.cpp  


--- branches/kopete/0.12/kopete/protocols/msn/msnaccount.cpp #513816:513817
@@ -1062,6 +1062,7 @@
 		// The FL list only use the contact GUID, use the contact referenced by the GUID.
 		MSNContact *contactRemoved = findContactByGuid(contactGuid);
 		QStringList groupGuidList;
+		bool deleteContact = groupGuid.isEmpty() ? true : false; // Delete the contact when the group GUID is empty.
 		// Remove the contact from the contact list for all the group he is a member.
 		if( groupGuid.isEmpty() )
 		{
@@ -1112,6 +1113,11 @@
 				}
 			}
 		}
+		if(deleteContact && contactRemoved)
+		{
+			kdDebug(14140) << k_funcinfo << "Deleting the MSNContact " << contactRemoved->contactId() << endl;
+			contactRemoved->deleteLater();
+		}
 	}
 }
 
@@ -1371,13 +1377,13 @@
 
 MSNContact *MSNAccount::findContactByGuid(const QString &contactGuid)
 {
-	kdDebug(14140) << k_funcinfo << endl;
+	kdDebug(14140) << k_funcinfo << "Looking for " << contactGuid << endl;
 	QDictIterator<Kopete::Contact> it( contacts() );
 	for ( ; it.current(); ++it )
 	{
-		MSNContact *c = static_cast<MSNContact *>( *it );
+		MSNContact *c = dynamic_cast<MSNContact *>( it.current() );
 
-		if(c && c->property( MSNProtocol::protocol()->propGuid ).value().toString() == contactGuid )
+		if(c && c->guid() == contactGuid )
 		{
 			kdDebug(14140) << k_funcinfo << "OK found a contact. " << endl;
 			// Found the contact GUID
--- branches/kopete/0.12/kopete/protocols/msn/msncontact.cpp #513816:513817
@@ -84,6 +84,7 @@
 
 MSNContact::~MSNContact()
 {
+	kdDebug(14140) << k_funcinfo << endl;
 }
 
 bool MSNContact::isReachable()
@@ -224,28 +225,25 @@
 	MSNNotifySocket *notify = static_cast<MSNAccount*>( account() )->notifySocket();
 	if( notify )
 	{
-		if( m_serverGroups.isEmpty() || onlineStatus() == MSNProtocol::protocol()->UNK )
+		if( hasProperty(MSNProtocol::protocol()->propGuid.key()) )
 		{
-			if( hasProperty(MSNProtocol::protocol()->propGuid.key()) )
+			// Remove from all groups he belongs (if applicable)
+			for( QMap<QString, Kopete::Group*>::Iterator it = m_serverGroups.begin(); it != m_serverGroups.end(); ++it )
 			{
-				kdDebug( 14140 ) << k_funcinfo << "Removing contact from top-level." << endl;
-				notify->removeContact( contactId(), MSNProtocol::FL, guid(), QString::null );
+				kdDebug(14140) << k_funcinfo << "Removing contact from group \"" << it.key() << "\"" << endl;
+				notify->removeContact( contactId(), MSNProtocol::FL, guid(), it.key() );
 			}
-			else
-			{
-				kdDebug( 14140 ) << k_funcinfo << "The contact is already removed from server, just delete it" << endl;
-				deleteLater();
-			}
-			return;
+	
+			// Then trully remove it from server contact list, 
+			// because only removing the contact from his groups isn't sufficent from MSNP11.
+			kdDebug( 14140 ) << k_funcinfo << "Removing contact from top-level." << endl;
+			notify->removeContact( contactId(), MSNProtocol::FL, guid(), QString::null);
 		}
-
-		// Remove from all groups he belongs (if applicable)
-		for( QMap<QString, Kopete::Group*>::Iterator it = m_serverGroups.begin(); it != m_serverGroups.end(); ++it )
-			notify->removeContact( contactId(), MSNProtocol::FL, guid(), it.key() );
-
-		// Then trully remove it from server contact list, 
-		// because only removing the contact from his groups isn't sufficent from MSNP11.
-		notify->removeContact( contactId(), MSNProtocol::FL, guid(), QString::null);
+		else
+		{
+			kdDebug( 14140 ) << k_funcinfo << "The contact is already removed from server, just delete it" << endl;
+			deleteLater();
+		}
 	}
 	else
 	{
Comment 2 Daniel Andersen 2006-03-28 01:59:10 UTC
This still doesn't appear to be quite working as expected (at least in 0.12 beta 1 which I am currently running). I can delete the contacts fine, but they still tend to turn up on my contact list in a "Not on your contact list" group for some reason.
Comment 3 Michaël Larouche 2006-03-28 03:07:37 UTC
"Not on your contact list" is normal, that temporary contacts. The contact you supprimed still have you in their contact list, and they open connections to get display picture for example.
Comment 4 Daniel Andersen 2006-04-24 01:43:22 UTC
This doesn't appear to be the case. If I look at the User Info screen for that MSN contact it says I am not on that users contact list. Either this is inaccurate or something else is going wrong somewhere. In any case, would it be possible to make this group invisible?
Comment 5 Olivier Goffart 2006-04-24 07:24:05 UTC
the user info screen is accurate only if the contact is on your contactlist.
Comment 6 Olivier Goffart 2006-06-13 22:39:19 UTC
You should block the contact, so it will not be able to request your picture.
Comment 7 Olivier Goffart 2006-06-13 22:39:55 UTC
*** Bug 119034 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Goffart 2006-08-20 15:08:36 UTC
SVN commit 574872 by ogoffart:

Fix a problem where you cannot remove MSN contacts.
I have this patch localy for months, but i forgot to commit it.

Cf first part of BUG 122317   (the commit r513817 was not enough)
CCBUG: 122317



 M  +2 -3      msnaccount.cpp  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/msn/msnaccount.cpp #574871:574872
@@ -458,10 +458,9 @@
 					c->setOnlineStatus( MSNProtocol::protocol()->FLN );
 					addContactServerside( c->contactId() , c->metaContact()->groups() );
 				}
-				else //the contact had been deleted, give him the unknown status
+				else //the contact had been deleted, remove it.
 				{
-					c->clearServerGroups();
-					c->setOnlineStatus( MSNProtocol::protocol()->UNK );
+					c->deleteLater();
 				}
 			}
 		}
Comment 9 Daniel Fischer 2006-08-21 23:11:30 UTC
thanks, i will try the next relase of kopete, because now i
Comment 10 Thanos Kyritsis 2006-08-22 10:01:56 UTC
Thank you for the patch, I'm already trying it and I still haven't seen the "Not on your contact list" problem. Before upgrading from 0.12.2 to the latest svn, I had some "Not on your contact list" contacts appearing occasionally in my list, so far so good with the patch.
Comment 11 Frédéric COIFFIER 2006-08-26 14:47:27 UTC
I don't know if my problem is linked to this bug :

With Kopete 0.12.1, when I try to delete an MSN contact, my MSN connection is cut (with no other error). And, when I restart my MSN connection, the contact appears again. So it's impossible to remove this contact.
Comment 12 Jose 2007-02-05 11:02:19 UTC
Using Kopete 0.12.4 and still I'm having problems with different contact lists and duplicate MSN contacts. Using Gaim while it gets fixed. I'll try every new release but I refuse to use Kopete now that I know that with Gaim I can manage my contact list between every machine I have.
Comment 13 Philip Rodrigues 2007-02-05 20:35:40 UTC
*** Bug 139409 has been marked as a duplicate of this bug. ***
Comment 14 Jamie Ballin 2007-07-13 00:25:04 UTC
I'm unclear - is this going to be fixed? It's extremely idiosynchratic behaviour.  Will those patches mentioned above be committed to the next release version?
(Ubuntu 7.04, Kopete 0.12.4)
Comment 15 Scott Thomson 2007-07-16 12:01:02 UTC
This bug seems a little confused.

It is marked as WONTFIX but I can't see any explanation/justification for this in the comments, can anyone clarify?

I use MSN over jabber, and at the moment every time I log in I've to deny access to over 60 "deleted" contacts - so this is a bit of an annoyance for me :)
Comment 16 Jo Øiongen 2008-03-17 09:49:47 UTC
Why is this marked WONTFIX? Deleting MSN contacts in Kopete does not work in KDE3.5.9 or KDE SVN-TRUNK. 
Comment 17 Tiago Marques 2008-08-11 00:24:11 UTC
I would also like to know why this WONTFIX...
It seems rather ridiculous.
Comment 18 Daniel Fischer 2008-08-11 05:27:34 UTC
may be because the fix is not GNU
i cant use kopete like this
Comment 19 Tiago Marques 2008-08-11 11:46:05 UTC
Is not GNU what???!?!?
Comment 20 Dennis Nienhüser 2008-08-11 13:09:36 UTC
To me it looks like the bug was marked WONTFIX accidentially when it should have been marked FIXED. According to the comments it's either not fully fixed or the problem popped up again, therefore reopening.

Comment 21 Matt Rogers 2008-11-15 06:08:49 UTC
We've completely replaced the current MSN implementation with a new MSN implementation which  If you continue to experience this bug after testing the new implementation (which can be gotten from our subversion repository or with the KDE 4.2 Beta 1 release), PLEASE, open a new bug rather than reopening this bug. Thank you for your time and efforting in helping us find and fix problems in Kopete.