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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo
From:       Andre Duffeck <duffeck () kde ! org>
Date:       2009-02-09 13:56:03
Message-ID: 1234187763.210152.639.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 923812 by duffeck:

fix bug where yahoo disconnects immediately when connecting.
BUG:163307


 M  +30 -0     client.cpp  
 M  +6 -0      client.h  
 M  +9 -0      logintask.cpp  
 M  +1 -0      logintask.h  


--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.cpp #923811:923812
@@ -99,6 +99,8 @@
 	QString statusMessageOnConnect;
 	Yahoo::PictureStatus pictureFlag;
 	int pictureChecksum;
+	bool buddyListReady;
+	QStringList pictureRequestQueue;
 };
 
 Client::Client(QObject *par) :QObject(par)
@@ -117,12 +119,14 @@
 	d->loginTask = new LoginTask( d->root );
 	d->listTask = new ListTask( d->root );
 	d->pictureFlag = Yahoo::NoPicture;
+	d->buddyListReady = false;
 	m_connector = 0L;
 
 	m_pingTimer = new QTimer( this );
 	QObject::connect( m_pingTimer, SIGNAL( timeout() ), this, SLOT( sendPing() ) );
 
 	QObject::connect( d->loginTask, SIGNAL( haveSessionID( uint ) ), SLOT( lt_gotSessionID( uint ) ) );
+	QObject::connect( d->loginTask, SIGNAL( buddyListReady() ), SLOT( processPictureQueue() ) );
 	QObject::connect( d->loginTask, SIGNAL( loginResponse( int, const QString& ) ), 
 				SLOT( slotLoginResponse( int, const QString& ) ) );
 	QObject::connect( d->loginTask, SIGNAL( haveCookies() ), SLOT( slotGotCookies() ) );
@@ -197,6 +201,7 @@
 		m_connector->deleteLater();
 	m_connector = 0L;
 	d->active = false;
+	d->buddyListReady = false;
 }
 
 int Client::error()
@@ -491,8 +496,33 @@
 
 // ***** Buddyicon handling *****
 
+void Client::processPictureQueue()
+{
+	kDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
+	d->buddyListReady = true;
+	if( d->pictureRequestQueue.isEmpty() )
+	{
+		return;
+	}
+
+	requestPicture( d->pictureRequestQueue.front() );
+	d->pictureRequestQueue.pop_front();
+
+	
+	if( !d->pictureRequestQueue.isEmpty() )
+	{
+		QTimer::singleShot( 1000, this, SLOT(processPictureQueue()) );
+	}
+}
+
 void Client::requestPicture( const QString &userId )
 {
+	if( !d->buddyListReady )
+	{
+		d->pictureRequestQueue << userId;
+		return;
+	}
+
 	RequestPictureTask *rpt = new RequestPictureTask( d->root );
 	rpt->setTarget( userId );
 	rpt->go( true );
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.h #923811:923812
@@ -705,6 +705,12 @@
 		 * Send a Yahoo Ping packet to the server
 		 */
 		void sendPing();
+
+		/**
+		 * Send all queued buddy icon requests
+		 */
+		void processPictureQueue();
+
 	private:
 		void distribute( Transfer *transfer );
 		
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.cpp #923811:923812
@@ -66,6 +66,12 @@
 
 	YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
 
+
+	if ( t->service() == Yahoo::ServicePing) {
+		emit buddyListReady();
+		return true;
+	}
+
 	switch (mState)
 	{
 		case (InitialState):
@@ -99,6 +105,9 @@
 	if (!t)
 		return false;
 
+	if ( t->service() == Yahoo::ServicePing)
+		return true;
+
 	switch (mState)
 	{
 		case (InitialState):
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.h #923811:923812
@@ -62,6 +62,7 @@
 	void haveSessionID( uint );
 	void haveCookies();
 	void loginResponse( int, const QString& );
+	void buddyListReady();
 private:
 	State mState;
 	Yahoo::Status m_stateOnConnect;
[prev in list] [next in list] [prev in thread] [next in thread] 

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