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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo
From:       Michael Anthony Cole <colemichae () gmail ! com>
Date:       2010-01-21 12:50:43
Message-ID: 1264078243.489868.30513.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1078078 by michaelacole:

BUG: 212855
BUG: 156296
Added two files for the fix.
protocols/yahoo/libkyahoo/alivetask.h
protocols/yahoo/libkyahoo/alivetask.cpp

The code from ping.h and cpp now actually resides in those files, 
and the ping task actually sends the ping not the alive message, 
Alive messages are sent to keep communcation between Yahoo and the client, 
but the Ping keeps you connected to the service so as they dont send a disconnect \
after the hour. 

I have set the time out to 59 minutes for the alive and the alive to 1 minute.


 


 M  +2 -1      CMakeLists.txt  
 AM            alivetask.cpp   [License: LGPL (v2+)]
 AM            alivetask.h   [License: LGPL (v2+)]
 M  +20 -3     client.cpp  
 M  +6 -0      client.h  
 M  +1 -2      pingtask.cpp  
 M  +1 -1      ymsgprotocol.cpp  


--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/CMakeLists.txt \
#1078077:1078078 @@ -42,7 +42,8 @@
 webcamtask.cpp 
 conferencetask.cpp 
 sendauthresptask.cpp 
-pingtask.cpp 
+pingtask.cpp
+alivetask.cpp
 yabtask.cpp 
 yabentry.cpp 
 modifyyabtask.cpp 
** trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/alivetask.cpp #property \
svn:eol-style  + native
** trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/alivetask.h #property \
svn:eol-style  + native
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.cpp #1078077:1078078
@@ -46,6 +46,7 @@
 #include "conferencetask.h"
 #include "sendauthresptask.h"
 #include "pingtask.h"
+#include "alivetask.h"
 #include "yabtask.h"
 #include "modifyyabtask.h"
 #include "chatsessiontask.h"
@@ -127,7 +128,9 @@
 
 	m_pingTimer = new QTimer( this );
 	QObject::connect( m_pingTimer, SIGNAL( timeout() ), this, SLOT( sendPing() ) );
-
+	m_aliveTimer = new QTimer( this );
+	QObject::connect( m_aliveTimer, SIGNAL( timeout() ), this, SLOT( sendAlive() ) );
+	
 	QObject::connect( d->loginTask, SIGNAL( haveSessionID( uint ) ), SLOT( \
lt_gotSessionID( uint ) ) );  QObject::connect( d->loginTask, SIGNAL( \
buddyListReady() ), SLOT( processPictureQueue() ) );  QObject::connect( d->loginTask, \
SIGNAL( buddyListReady() ), SLOT( processStealthQueue() ) ); @@ -189,6 +192,7 @@
 {
 	kDebug(YAHOO_RAW_DEBUG) ;
 	m_pingTimer->stop();
+	m_aliveTimer->stop();
 	if( d->active )
 	{
 		LogoffTask *lt = new LogoffTask( d->root );
@@ -280,13 +284,15 @@
 			changeStatus( d->statusOnConnect, d->statusMessageOnConnect, \
Yahoo::StatusTypeAway );  d->statusMessageOnConnect.clear();
 		setStatus( d->statusOnConnect );
-		/* YM Client sends a ping every minute
+		/* YM Client sends a alert every minute
 		* If we time out and try to log out and log in
 		* we can lose messages therefore we should set this
 		* to the same as the Yahoo Messenger client
 		*. so as we dont get disconnected
+		* Also it sends a PING at every hour.
 		*/
-		m_pingTimer->start( 1 * 60 * 1000 );
+		m_aliveTimer->start( 1 * 60 * 1000 );
+		m_pingTimer->start( 59 * 60 * 1000 );
 		initTasks();
 	} else {
 		d->active = false;
@@ -452,6 +458,17 @@
 	pt->go( true );
 }
 
+void Client::sendAlive()
+{
+	if( !d->active )
+	{
+		kDebug(YAHOO_RAW_DEBUG) << "Disconnected. NOT sending a ALIVE.";
+		return;
+	}
+	kDebug(YAHOO_RAW_DEBUG) << "Sending a ALIVE.";
+	AliveTask *at = new AliveTask( d->root );
+	at->go( true );
+}
 // ***** Contactlist handling *****
 
 void Client::stealthContact(QString const &userId, Yahoo::StealthMode mode, \
                Yahoo::StealthStatus state)
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.h #1078077:1078078
@@ -714,6 +714,11 @@
 		void sendPing();
 
 		/**
+		 * Send a Yahoo Alert packet to the server
+		 */
+		void sendAlive();
+
+		/**
 		 * Send all queued buddy icon requests
 		 */
 		void processPictureQueue();
@@ -741,6 +746,7 @@
 		KNetworkConnector *m_connector;
 
 		QTimer *m_pingTimer;
+		QTimer *m_aliveTimer;
 };
 
 #endif
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/pingtask.cpp \
#1078077:1078078 @@ -37,8 +37,7 @@
 {
 	kDebug(YAHOO_RAW_DEBUG) ;
 
-	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePing7);
-	t->setParam( 0, client()->userId().toLocal8Bit() );
+	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePing);
 	t->setId( client()->sessionID() );
 	send( t );
 	
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp \
#1078077:1078078 @@ -331,7 +331,7 @@
 		*/
 
 		default:
-			kDebug(YAHOO_RAW_DEBUG) << "  Parsed packet service -  This means an unknown \
service " << servicenum; +			kDebug(YAHOO_RAW_DEBUG) << "***************  Parsed \
packet service -  This means an unknown service " << servicenum;  break;
 	}
 	


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

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