[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    [Kopete-devel] IMPORTANT: 0.7.x patches for OSCAR
From:       Stefan Gehn <sgehn () gmx ! net>
Date:       2003-08-30 21:49:25
[Download RAW message or body]

Moin,

These patches change the following things:

- allow deleting contacts on serverside list as long as kopete and serverside 
group have the same name
- allow renaming contacts on serverside list, same logic as above

please test them NOW and if renaming and deleting contacts work immediately 
commit to 0_7_branch. I didn't even try compiling but as these are merely 
backports from HEAD it should compile fine.

Bye, Stefan aka mETz
-- 
sgehn@gmx.net | ICQ#51123152 | Moege der Pinguin mit euch sein

["possible-fix-for-59311-and-renaming.patch" (text/x-diff)]

Index: oscarcontact.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/protocols/oscar/Attic/oscarcontact.cpp,v
retrieving revision 1.103
diff -u -3 -p -r1.103 oscarcontact.cpp
--- oscarcontact.cpp	31 Jul 2003 16:16:19 -0000	1.103
+++ oscarcontact.cpp	30 Aug 2003 21:45:09 -0000
@@ -217,12 +217,29 @@ void OscarContact::slotUpdateNickname(co
 void OscarContact::slotDeleteContact()
 {
 	kdDebug(14150) << k_funcinfo << "contact '" << displayName() << "'" << endl;
+
 	AIMGroup *group = mAccount->internalBuddyList()->findGroup(mListContact->groupID());
+
+	if(!group && metaContact() && metaContact()->groups().count() > 0)
+	{
+		QString grpName=metaContact()->groups().first()->displayName();
+		kdDebug(14150) << k_funcinfo <<
+			"searching group by name '" << grpName << "'" << endl;
+		group=mAccount->internalBuddyList()->findGroup(grpName);
+	}
+
 	if (!group)
+	{
+		kdDebug(14150) << k_funcinfo <<
+			"Couldn't find serverside group for contact, cannot delete on server :(" << endl;
 		return;
+	}
+	else
+	{
+		mAccount->engine()->sendDelBuddy(contactName(), group->name());
+	}
 
 	mAccount->internalBuddyList()->removeBuddy(mListContact);
-	mAccount->engine()->sendDelBuddy(mListContact->screenname(),group->name());
 	deleteLater();
 }
 
@@ -471,11 +488,25 @@ void OscarContact::rename(const QString 
 	kdDebug(14150) << k_funcinfo << "Rename '" << displayName() << "' to '" <<
 		newNick << "'" << endl;
 
+	AIMGroup *currentOscarGroup = 0L;
+
 	if(mAccount->isConnected())
 	{
 		//FIXME: group handling!
-		AIMGroup *currentOscarGroup =
+		currentOscarGroup =
 			mAccount->internalBuddyList()->findGroup(mListContact->groupID());
+		if(!currentOscarGroup)
+		{
+			// FIXME: workaround for not knowing the groupid
+			if(metaContact() && metaContact()->groups().count() > 0)
+			{
+				QString grpName=metaContact()->groups().first()->displayName();
+				kdDebug(14150) << k_funcinfo <<
+					"searching group by name '" << grpName << "'" << endl;
+				currentOscarGroup=mAccount->internalBuddyList()->findGroup(grpName);
+			}
+		}
+
 		if(currentOscarGroup)
 		{
 			mAccount->engine()->sendRenameBuddy(mName,
Index: oscarsocket/oscarsocket.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/protocols/oscar/oscarsocket/Attic/oscarsocket.cpp,v
retrieving revision 1.97.2.3
diff -u -3 -p -r1.97.2.3 oscarsocket.cpp
--- oscarsocket/oscarsocket.cpp	14 Aug 2003 08:12:28 -0000	1.97.2.3
+++ oscarsocket/oscarsocket.cpp	30 Aug 2003 21:45:10 -0000
@@ -2694,68 +2694,64 @@ void OscarSocket::sendRenameBuddy(const 
 		return;
 	}
 
-	// BEGIN DEBUG, remove if working
 	Buffer tmpBuf(ssi->tlvlist, ssi->tlvlength);
 	QPtrList<TLV> lst = tmpBuf.getTLVList();
 	lst.setAutoDelete(FALSE);
 
-	TLV *oldNick = findTLV(lst,0x0131);
-	// END DEBUG
+	/*TLV *oldNick = findTLV(lst,0x0131);
 
-//	if (oldNick)
+	if (oldNick)
 	{
-		if (oldNick)
-		{
-			kdDebug(14150) << k_funcinfo <<
-				"Renaming contact, current alias='" << oldNick->data << "'" << endl;
-			lst.remove(oldNick); // get rid of TLV copy
-		}
-		else
-		{
-			kdDebug(14150) << k_funcinfo <<
-				"Renaming contact, no alias had been given before." << endl;
-		}
-
-		// construct new SSI entry replacing the old one
-		SSI *newSSI = new SSI();
-		newSSI->name = ssi->name;
-		newSSI->gid = ssi->gid;
-		newSSI->bid = ssi->bid;
-		newSSI->type = ssi->type;
-		Buffer *newSSITLV = new Buffer();
+	kdDebug(14150) << k_funcinfo <<
+			"Renaming contact, current alias='" << oldNick->data << "'" << endl;
+		lst.remove(oldNick); // get rid of TLV copy
+	}
+	else
+	{
+		kdDebug(14150) << k_funcinfo <<
+			"Renaming contact, no alias had been given before." << endl;
+	}*/
+
+	// construct new SSI entry replacing the old one
+	SSI *newSSI = new SSI();
+	newSSI->name = ssi->name;
+	newSSI->gid = ssi->gid;
+	newSSI->bid = ssi->bid;
+	newSSI->type = ssi->type;
+	Buffer *newSSIdata = new Buffer();
 
-		for(TLV* t = lst.first(); t; t = lst.next())
+	for(TLV* t = lst.first(); t; t = lst.next())
+	{
+		if(t->type != 0x0131)
 		{
-			if(t->type != 0x0131)
-			{
-				newSSITLV->addTLV(t->type, t->length, t->data);
-				lst.remove(t);
-			}
+			newSSIdata->addTLV(t->type, t->length, t->data);
+			lst.remove(t);
 		}
+	}
 
-		const char *newNickData = newAlias.local8Bit().copy();
-		newSSITLV->addTLV(0x0131, newAlias.local8Bit().length(), newNickData);
+	//const char *newNickData = newAlias.local8Bit().copy();
+	newSSIdata->addTLV(0x0131, newAlias.local8Bit().length(), newAlias.local8Bit());
 
-		if (!ssiData.remove(ssi))
-		{
-			kdDebug(14150) << k_funcinfo <<
-				"Couldn't remove old ssi containing visibility value" << endl;
-			delete newSSITLV;
-			delete newSSI;
-			return;
-		}
-		newSSI->tlvlist = newSSITLV->buffer();
-		newSSI->tlvlength = newSSITLV->length();
+	if (!ssiData.remove(ssi))
+	{
+		kdDebug(14150) << k_funcinfo <<
+			"Couldn't remove old ssi containing contact" << endl;
+		delete newSSIdata;
+		delete newSSI;
+		return;
+	}
+	newSSI->tlvlist = newSSIdata->buffer();
+	newSSI->tlvlength = newSSIdata->length();
 
-		ssiData.append(newSSI);
+	ssiData.append(newSSI);
 
-		kdDebug(14150) << k_funcinfo << "Renaming, new SSI block: name=" << newSSI->name <<
-			", gid=" << newSSI->gid << ", bid=" << newSSI->bid <<
-			", type=" << newSSI->type << ", datalength=" <<
-			newSSI->tlvlength << endl;
+	kdDebug(14150) << k_funcinfo << "Renaming, new SSI block: name=" << newSSI->name <<
+		", gid=" << newSSI->gid << ", bid=" << newSSI->bid <<
+		", type=" << newSSI->type << ", datalength=" << newSSI->tlvlength << endl;
 
-		sendSSIAddModDel(newSSI,0x0009);
-	}
+	kdDebug(14150) << "new SSI:" << newSSIdata->toString();
+
+	sendSSIAddModDel(newSSI, 0x0009);
 }
 
 void OscarSocket::sendAddGroup(const QString &name)

["possible-fix-for-68432.patch" (text/x-diff)]

? possible-fix-for-68432.patch
Index: oscaraccount.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/protocols/oscar/Attic/oscaraccount.cpp,v
retrieving revision 1.56.2.1
diff -u -3 -p -r1.56.2.1 oscaraccount.cpp
--- oscaraccount.cpp	10 Aug 2003 19:20:44 -0000	1.56.2.1
+++ oscaraccount.cpp	30 Aug 2003 18:07:41 -0000
@@ -63,8 +63,7 @@ OscarAccount::OscarAccount(KopeteProtoco
 
 OscarAccount::~OscarAccount()
 {
-	kdDebug(14150) << k_funcinfo << "'" << accountId() <<
-		"' deleted, Disconnecting..." << endl;
+	kdDebug(14150) << k_funcinfo << "'" << accountId() << "' deleted" << endl;
 
 	OscarAccount::disconnect();
 
@@ -73,26 +72,13 @@ OscarAccount::~OscarAccount()
 	// Delete the backend
 	if (mEngine)
 	{
-		delete mEngine;
-		mEngine = 0L;
+		kdDebug(14150) << k_funcinfo << "deleting Engine!" << endl;
+		mEngine->deleteLater();
 	}
 	else
 	{
 		kdDebug(14150) << k_funcinfo <<
 			"ERROR, we don't have an OscarSocket anymore!" << endl;
-	}
-
-	if (myself())
-	{
-		kdDebug(14150) << k_funcinfo << "'" << accountId() <<
-			"' deleting myself() contact" << endl;
-		delete mMyself;
-		mMyself=0L;
-	}
-	else
-	{
-		kdDebug(14150) << k_funcinfo << "'" << accountId() <<
-			"' myself() contact already gone, who deleted it before me?" << endl;
 	}
 }
 


_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic