rpms/kdenetwork/devel kdenetwork-4.2.0-yahoo.patch, NONE, 1.1 kdenetwork.spec, 1.171, 1.172

Than Ngo than at fedoraproject.org
Fri Feb 6 12:26:33 UTC 2009


Author: than

Update of /cvs/extras/rpms/kdenetwork/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32046

Modified Files:
	kdenetwork.spec 
Added Files:
	kdenetwork-4.2.0-yahoo.patch 
Log Message:
fix yahoo protocol to show contact list correctly


kdenetwork-4.2.0-yahoo.patch:

--- NEW FILE kdenetwork-4.2.0-yahoo.patch ---
Index: kopete/protocols/yahoo/libkyahoo/modifybuddytask.h
===================================================================
--- kopete/protocols/yahoo/libkyahoo/modifybuddytask.h	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/modifybuddytask.h	(Revision 921978)
@@ -26,6 +26,7 @@
 */
 class ModifyBuddyTask : public Task
 {
+Q_OBJECT
 public:
 	enum Type { AddBuddy, RemoveBuddy, MoveBuddy };
 	ModifyBuddyTask(Task *parent);
@@ -33,11 +34,22 @@
 	
 	virtual void onGo();
 	
+	bool take(Transfer *transfer);
+
 	void setType( Type type );
 	void setMessage( const QString &text );
 	void setTarget( const QString &target );
 	void setGroup( const QString &group );
 	void setOldGroup( const QString &group );
+
+signals:
+	void buddyAddResult( const QString &, const QString &, bool );
+	void buddyRemoveResult( const QString &, const QString &, bool );
+	void buddyChangeGroupResult( const QString &, const QString &, bool );
+
+protected:
+	virtual bool forMe( const Transfer *transfer ) const;
+
 private:
 	void addBuddy();
 	void removeBuddy();
Index: kopete/protocols/yahoo/libkyahoo/yahootypes.h
===================================================================
--- kopete/protocols/yahoo/libkyahoo/yahootypes.h	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/yahootypes.h	(Revision 921978)
@@ -72,8 +72,8 @@
 		ServiceAuthResp = 0x54,
 		ServiceList = 85,
 		ServiceAuth = 0x57,
-		ServiceAddBuddy = 0x83,
-		ServiceRemBuddy,
+		ServiceBuddyAdd = 0x83,
+		ServiceBuddyRemove = 0x84,
 		ServiceIgnoreContact,	/* > 1, 7, 13 < 1, 66, 13, 0*/
 		ServiceRejectContact,
 		ServiceGroupRename = 0x89, /* > 1, 65(new), 66(0), 67(old) */
Index: kopete/protocols/yahoo/libkyahoo/client.cpp
===================================================================
--- kopete/protocols/yahoo/libkyahoo/client.cpp	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/client.cpp	(Revision 921978)
@@ -450,6 +450,10 @@
 void Client::addBuddy( const QString &userId, const QString &group, const QString &message )
 {
 	ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root );
+	
+	QObject::connect(mbt, SIGNAL(buddyAddResult( const QString &, const QString &, bool )),
+			 SIGNAL(buddyAddResult( const QString &, const QString &, bool)));
+
 	mbt->setType( ModifyBuddyTask::AddBuddy );
 	mbt->setTarget( userId );
 	mbt->setGroup( group );
@@ -460,6 +464,10 @@
 void Client::removeBuddy( const QString &userId, const QString &group )
 {
 	ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root );
+
+	QObject::connect(mbt, SIGNAL(buddyRemoveResult( const QString &, const QString &, bool )),
+			 SIGNAL(buddyRemoveResult( const QString &, const QString &, bool)));
+
 	mbt->setType( ModifyBuddyTask::RemoveBuddy );
 	mbt->setTarget( userId );
 	mbt->setGroup( group );
@@ -469,6 +477,10 @@
 void Client::moveBuddy( const QString &userId, const QString &oldGroup, const QString &newGroup )
 {
 	ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root );
+
+	QObject::connect(mbt, SIGNAL(buddyChangeGroupResult( const QString &, const QString &, bool )),
+			 SIGNAL(buddyChangeGroupResult( const QString &, const QString &, bool)));
+
 	mbt->setType( ModifyBuddyTask::MoveBuddy );
 	mbt->setTarget( userId );
 	mbt->setOldGroup( oldGroup );
Index: kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp
===================================================================
--- kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp	(Revision 921978)
@@ -154,10 +154,18 @@
 			kDebug(YAHOO_RAW_DEBUG) << " Parsed packet service -  This means ServiceNotify " << servicenum;
 			service = Yahoo::ServiceNotify;
 		break;
-		case (Yahoo::ServiceAddBuddy) :
-			kDebug(YAHOO_RAW_DEBUG) << " Parsed packet service -  This means ServiceAddBuddy " << servicenum;
-			service = Yahoo::ServiceAddBuddy;
+		case (Yahoo::ServiceBuddyAdd) :
+			kDebug(YAHOO_RAW_DEBUG) << " Parsed packet service -  This means ServiceBuddyAdd " << servicenum;
+			service = Yahoo::ServiceBuddyAdd;
 		break;
+        	case (Yahoo::ServiceBuddyRemove) :
+	                kDebug(YAHOO_RAW_DEBUG) << "Parsed packet service -  This means ServiceBuddyRemove " << servicenum;
+	                service = Yahoo::ServiceBuddyRemove;
+	        break;
+        	case (Yahoo::ServiceBuddyChangeGroup) :
+	                kDebug(YAHOO_RAW_DEBUG) << "Parsed packet service -  This means ServiceBuddyChangeGroup " << servicenum;
+	                service = Yahoo::ServiceBuddyChangeGroup;
+	        break;
 		case (Yahoo::ServicePictureChecksum) :
 			kDebug(YAHOO_RAW_DEBUG) << " Parsed packet service -  This means ServicePictureChecksum " << servicenum;
 			service = Yahoo::ServicePictureChecksum;
Index: kopete/protocols/yahoo/libkyahoo/client.h
===================================================================
--- kopete/protocols/yahoo/libkyahoo/client.h	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/client.h	(Revision 921978)
@@ -486,6 +486,18 @@
 		 */
 		void gotBuddy( const QString &, const QString &, const QString & );
 		/**
+		 * Notifies about adding buddies
+		 */
+		void buddyAddResult( const QString &, const QString &, bool );
+		/**
+		 * Notifies about removing buddies
+		 */
+		void buddyRemoveResult( const QString &, const QString &, bool );
+		/**
+		 * Notifies about buddies changing groups
+		 */
+		void buddyChangeGroupResult( const QString &, const QString &, bool );
+		/**
 		 * Notifies about the status of online buddies
 		 */
 		void statusChanged( const QString&, int, const QString&, int, int, int );
Index: kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp
===================================================================
--- kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp	(Revision 921977)
+++ kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp	(Revision 921978)
@@ -31,6 +31,55 @@
 {
 }
 
+bool ModifyBuddyTask::take( Transfer* transfer )
+{
+     if( !forMe( transfer ) )
+	  return false;
+
+     YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
+
+     bool success = t->firstParam(66) == "0";
+
+     switch(t->service())
+     {
+     case Yahoo::ServiceBuddyAdd:
+	  emit buddyAddResult(m_target, m_group, success);
+	  break;
+     case Yahoo::ServiceBuddyRemove:
+	  emit buddyRemoveResult(m_target, m_group, success);
+	  break;
+     case Yahoo::ServiceBuddyChangeGroup:
+	  emit buddyChangeGroupResult(m_target, m_group, success);
+     default:
+	  return false;
+     }
+
+     if(success)
+	  setSuccess();
+     else
+	  setError();
+
+     return true;
+}
+
+bool ModifyBuddyTask::forMe( const Transfer* transfer ) const
+{
+     const YMSGTransfer *t = 0L;
+     t = dynamic_cast<const YMSGTransfer*>(transfer);
+     
+     if(!t)
+	  return false;
+
+     if( (t->service() == Yahoo::ServiceBuddyAdd ||
+	  t->service() == Yahoo::ServiceBuddyRemove) &&
+	 t->firstParam(7) == m_target)
+     {
+	  return true;
+     }
+     
+     return false;
+}
+
 void ModifyBuddyTask::onGo()
 {
 	kDebug(YAHOO_RAW_DEBUG) ;
@@ -47,27 +96,27 @@
 			moveBuddy();
 		break;
 	}
-
-
-	
-	setSuccess();
 }
 
 void ModifyBuddyTask::addBuddy()
 {
-	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAddBuddy);
+	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceBuddyAdd);
 	t->setId( client()->sessionID() );
+	t->setParam( 65, m_group.toLocal8Bit() );
+	t->setParam( 97, 1 );
 	t->setParam( 1, client()->userId().toLocal8Bit() );
-	t->setParam( 7, m_target.toLocal8Bit() );
-	t->setParam( 14, m_message.toUtf8() );
-	t->setParam( 65, m_group.toLocal8Bit() );	
-	t->setParam( 97, 1 );	// UTF-8
+	t->setParam( 302,  319 );
+	t->setParam( 300,  319 );
+	t->setParam( 7,  m_target.toLocal8Bit() );
+	t->setParam( 334,  0 );
+	t->setParam( 301, 319 );
+	t->setParam( 303, 319 );	// UTF-8
 	send( t );
 }
 
 void ModifyBuddyTask::removeBuddy()
 {
-	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceRemBuddy);
+	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceBuddyRemove);
 	t->setId( client()->sessionID() );
 	t->setParam( 1, client()->userId().toLocal8Bit() );
 	t->setParam( 7, m_target.toLocal8Bit() );
Index: kopete/protocols/yahoo/yahooaccount.h
===================================================================
--- kopete/protocols/yahoo/yahooaccount.h	(Revision 921977)
+++ kopete/protocols/yahoo/yahooaccount.h	(Revision 921978)
@@ -181,6 +181,9 @@
 	void slotDisconnected();
 	void slotLoginFailed();
 	void slotGotBuddy(const QString &userid, const QString &alias, const QString &group);
+	void slotBuddyAddResult(const QString &userid, const QString &group, bool success);
+	void slotBuddyRemoveResult(const QString &userid, const QString &group, bool success);
+	void slotBuddyChangeGroupResult(const QString &userid, const QString &group, bool success);
 	void slotAuthorizationAccepted( const QString &who );
 	void slotAuthorizationRejected( const QString &who, const QString &msg );
 	void slotgotAuthorizationRequest( const QString &, const QString &, const QString & );
Index: kopete/protocols/yahoo/yahooaccount.cpp
===================================================================
--- kopete/protocols/yahoo/yahooaccount.cpp	(Revision 921977)
+++ kopete/protocols/yahoo/yahooaccount.cpp	(Revision 921978)
@@ -244,6 +244,15 @@
 		QObject::connect(m_session, SIGNAL(gotBuddy(const QString &, const QString &, const QString &)),
 		                 this, SLOT(slotGotBuddy(const QString &, const QString &, const QString &)));
 
+		QObject::connect(m_session, SIGNAL(buddyAddResult(const QString &, const QString &, bool)),
+				 this, SLOT(slotBuddyAddResult(const QString &, const QString &, bool)));
+
+		QObject::connect(m_session, SIGNAL(buddyRemoveResult(const QString &, const QString &, bool)),
+				 this, SLOT(slotBuddyRemoveResult(const QString &, const QString &, bool)));
+
+		QObject::connect(m_session, SIGNAL(buddyChangeGroupResult(const QString &, const QString &, bool)),
+				 this, SLOT(slotBuddyChangeGroupResult(const QString &, const QString &, bool)));
+
 		QObject::connect(m_session, SIGNAL(authorizationAccepted( const QString & )),
 		                 this, SLOT(slotAuthorizationAccepted( const QString & )) );
 
@@ -377,6 +386,15 @@
 		QObject::disconnect(m_session, SIGNAL(gotBuddy(const QString &, const QString &, const QString &)),
 		                    this, SLOT(slotGotBuddy(const QString &, const QString &, const QString &)));
 
+		QObject::disconnect(m_session, SIGNAL(buddyAddResult(const QString &, const QString &, bool)),
+		                    this, SLOT(slotBuddyAddResult(const QString &, const QString &, bool)));
+
+		QObject::disconnect(m_session, SIGNAL(buddyRemoveResult(const QString &, const QString &, bool)),
+		                    this, SLOT(slotBuddyRemoveResult(const QString &, const QString &, bool)));
+
+		QObject::disconnect(m_session, SIGNAL(buddyChangeGroupResult(const QString &, const QString &, bool)),
+				 this, SLOT(slotBuddyChangeGroupResult(const QString &, const QString &, bool)));
+
 		QObject::disconnect(m_session, SIGNAL(authorizationAccepted( const QString &)),
 		                 this, SLOT(slotAuthorizationAccepted( const QString &)) );
 
@@ -696,6 +714,7 @@
 
 		setBuddyIcon( myself()->property( Kopete::Global::Properties::self()->photo() ).value().toString() );
 		m_session->getYABEntries( m_YABLastMerge, m_YABLastRemoteRevision );
+		IDs.clear();
 		m_lastDisconnectCode = 0;
 		theHaveContactList = true;
 		return;
@@ -804,8 +823,42 @@
 		Kopete::Group *g=Kopete::ContactList::self()->findGroup(group);
 		addContact(userid, alias.isEmpty() ? userid : alias, g, Kopete::Account::ChangeKABC);
 	}
+
+	kDebug(YAHOO_GEN_DEBUG) << IDs;
 }
 
+void YahooAccount::slotBuddyAddResult( const QString &userid, const QString &group, bool success )
+{
+     kDebug(YAHOO_GEN_DEBUG) << success;
+
+     if(success)
+	  IDs[userid] = QPair<QString, QString>(group, QString());
+
+     kDebug(YAHOO_GEN_DEBUG) << IDs;
+}
+
+void YahooAccount::slotBuddyRemoveResult( const QString &userid, const QString &group, bool success )
+{
+     kDebug(YAHOO_GEN_DEBUG);
+
+     // Ignore success here, the only reason this will fail is because the
+     // contact isn't on the server's list, so we shouldn't have them in our
+     // list either.
+     IDs.remove(userid);
+
+     kDebug(YAHOO_GEN_DEBUG) << IDs;
+}
+
+void YahooAccount::slotBuddyChangeGroupResult(const QString &userid, const QString &group, bool success)
+{
+     kDebug(YAHOO_GEN_DEBUG);
+     
+     if(success)
+	  IDs[userid] = QPair<QString, QString>(group, QString());
+
+     kDebug(YAHOO_GEN_DEBUG) << IDs;
+}
+
 void YahooAccount::slotAuthorizationAccepted( const QString &who )
 {
 	kDebug(YAHOO_GEN_DEBUG) ;


Index: kdenetwork.spec
===================================================================
RCS file: /cvs/extras/rpms/kdenetwork/devel/kdenetwork.spec,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -r1.171 -r1.172
--- kdenetwork.spec	4 Feb 2009 16:49:16 -0000	1.171
+++ kdenetwork.spec	6 Feb 2009 12:26:02 -0000	1.172
@@ -2,7 +2,7 @@
 Name: kdenetwork
 Epoch: 7
 Version: 4.2.0
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 License: GPLv2
 Group: Applications/Internet
@@ -14,6 +14,8 @@
 # http://websvn.kde.org/?view=rev&revision=909144
 # http://websvn.kde.org/?view=rev&revision=909145
 Patch100: kdenetwork-4.1.96-system-libgadu.patch
+Patch101: kdenetwork-4.2.0-yahoo.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: avahi-compat-libdns_sd-devel
@@ -93,6 +95,8 @@
 %patch0 -p1 -b .handle-enc-message
 %patch1 -p1 -b .libv4l
 %patch100 -p0 -b .system-libgadu
+%patch101 -p0 -b .yahoo
+
 rm -rf kopete/protocols/gadu/libgadu/
 
 %build
@@ -167,6 +171,9 @@
 
 
 %changelog
+* Fri Feb 06 2009 Than Ngo <than at redhat.com> - 4.2.0-4
+- fix yahoo protocol to show contact list correctly
+
 * Wed Feb 04 2009 Jaroslav Reznik <jreznik at redhat.com> - 4.2.0-3
 - port kopete video to libv4l (#475623)
 




More information about the fedora-extras-commits mailing list