[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-19 1:51:23
Message-ID: 1263865883.400285.30249.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1076895 by michaelacole:

Kopete Yahoo Bug 180080 Bug 195471 Stealth settings are server based in yahoo and are \
received at login this preserves the settings that have been sent to the Yahoo \
servers 

 M  +32 -1     client.cpp  
 M  +13 -1     client.h  
 M  +42 -14    listtask.cpp  
 M  +2 -2      listtask.h  


--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.cpp #1076894:1076895
@@ -59,6 +59,7 @@
 
 using namespace KNetwork;
 
+
 class Client::ClientPrivate
 {
 public:
@@ -74,7 +75,8 @@
 	int error;
 	QString errorString;
 	QString errorInformation;
-	
+	QStringList stealthedBuddies;
+	QStringList unstealthedBuddies;
 	// tasks
 	bool tasksInitialized;
 	LoginTask * loginTask;
@@ -128,6 +130,7 @@
 
 	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() ) );  \
QObject::connect( d->loginTask, SIGNAL( loginResponse( int, const QString& ) ),   \
SLOT( slotLoginResponse( int, const QString& ) ) );  QObject::connect( d->loginTask, \
SIGNAL( haveCookies() ), SLOT( slotGotCookies() ) ); @@ -178,6 +181,7 @@
 
 	d->loginTask->setStateOnConnect( (d->statusOnConnect == Yahoo::StatusInvisible) ? \
Yahoo::StatusInvisible : Yahoo::StatusAvailable );  d->loginTask->go();
+	processStealthQueue();
 	d->active = true;
 }
 
@@ -589,6 +593,23 @@
 	spt->go( true );
 }
 
+// **** Stealth Handling **** michaelacole
+void Client::processStealthQueue()
+{
+	for ( QStringList::ConstIterator it = d->unstealthedBuddies.begin(); it != \
d->unstealthedBuddies.end(); ++it ) +	{
+		kDebug(YAHOO_RAW_DEBUG) << "unstealthed setting set on" << *it;
+	stealthContact( *it, Yahoo::StealthOffline , Yahoo::StealthNotActive );
+	}
+	for ( QStringList::ConstIterator it = d->stealthedBuddies.begin(); it != \
d->stealthedBuddies.end(); ++it ) +	{
+		kDebug(YAHOO_RAW_DEBUG) << "stealthed setting set on" << *it ;
+	stealthContact( *it, Yahoo::StealthPermOffline , Yahoo::StealthActive );
+	}
+
+}
+
+
 // ***** Webcam handling *****
 
 void Client::requestWebcam( const QString &userId )
@@ -718,6 +739,16 @@
 	emit error( level );
 }
 
+void Client::notifyStealthedBuddies( const QStringList &buddies)
+{
+	d->stealthedBuddies = buddies;
+}
+
+void Client::notifyUnstealthedBuddies( const QStringList &buddies)
+{
+	d->unstealthedBuddies = buddies;
+}
+
 QString Client::userId()
 {
 	return d->user;
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/client.h #1076894:1076895
@@ -94,7 +94,7 @@
 
 		/** Returns information about what went wrong */
 		QString errorInformation();
-
+		
 		/**
 		 * Specifies the status we connect with. 
 		 * The Yahoo protocol supports connecting into Online and Invisible state.
@@ -455,6 +455,13 @@
 		 * Error
 		 */
 		void notifyError( const QString &info, const QString &errorString, LogLevel level \
); +
+		/**
+		 * Steathed information from login..
+		 */
+		void notifyStealthedBuddies( const QStringList &buddies);
+		void notifyUnstealthedBuddies( const QStringList &buddies);
+
 	signals:
 		/** CONNECTION EVENTS */
 		/**
@@ -711,6 +718,11 @@
 		 */
 		void processPictureQueue();
 
+		 /** 
+		 * Update all Stealth info after login
+		 */
+		void processStealthQueue();
+                
 	private:
 		void distribute( Transfer *transfer );
 		
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/listtask.cpp \
#1076894:1076895 @@ -26,6 +26,7 @@
 ListTask::ListTask(Task* parent) : Task(parent)
 {
 	kDebug(YAHOO_RAW_DEBUG) ;
+	
 }
 
 ListTask::~ListTask()
@@ -33,6 +34,9 @@
 
 }
 
+QStringList loginstealthedbuddies;
+QStringList loginunstealthedbuddies;
+
 bool ListTask::take( Transfer* transfer )
 {
 	if ( !forMe( transfer ) )
@@ -41,7 +45,6 @@
 	YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
 
 	parseBuddyList( t );
-	parseStealthList( t );
 
 	return true;
 }
@@ -63,7 +66,6 @@
 void ListTask::parseBuddyList( YMSGTransfer *t )
 {
 	kDebug(YAHOO_RAW_DEBUG) ;
-
 	QString group;
 	QString buddy;
 	// We need some low-level parsing here
@@ -83,23 +85,49 @@
 		case 301:
 			if( p.second == "319"){
 				emit gotBuddy( buddy, QString(), group );
+                                /**
+                                * Note: michaelacole
+                                * Since you can log in from other places and remove \
or add Perm Offline status +                                * We have to reset both \
conditions at login +                                * Yahoo sends this data at this \
time, +                                * so better to compile list of both now then \
notify kopete client. +                                */
+				loginunstealthedbuddies.append( buddy );
 			}
+			break;
+		case 317:
+			if( p.second == "2"){
+			kDebug(YAHOO_RAW_DEBUG) << "Stealthed setting on" << buddy ;
+                        /** Note: michaelacole
+                        * Since you can log in from other places and remove or add \
Perm Offline status +                        * We have to reset both conditions at \
login +                        * Yahoo sends this data at this time,
+                        * so better to compile list of both now then notify kopete \
client. +                        */
+			loginstealthedbuddies.append( buddy );
+			loginunstealthedbuddies.removeLast();
+			};
+			break;
+                /**
+                * Note: michaelacole
+                * Other buddy codes are here for add to list and blacklist
+                * I will need to capute more codes for addition here.
+                * Blacklist is done on the server at Yahoo whereas
+                * Kopete has its own plugin for blacklisting.
+                */
 		}
 	}
+        /**
+        * Note: michaelacole
+        * Since you can log in from other places and remove or add Perm Offline \
status +        * We have to reset both conditions at login
+        * Yahoo sends this data at this time,
+        * so better to compile list of both now then notify kopete client.
+        */
+        client()->notifyUnstealthedBuddies( loginunstealthedbuddies );
+        client()->notifyStealthedBuddies( loginstealthedbuddies );
 }
 
-void ListTask::parseStealthList( YMSGTransfer *t )
-{
-	kDebug(YAHOO_RAW_DEBUG) ;
 
-	QString raw;
-	raw = t->firstParam( 185 );
 
-	const QStringList buddies = raw.split( ',', QString::SkipEmptyParts );
-	for ( QStringList::ConstIterator it = buddies.begin(); it != buddies.end(); ++it )
-	{
-		emit stealthStatusChanged( *it, Yahoo::StealthActive );
-	}
-}
-
 #include "listtask.moc"
--- trunk/KDE/kdenetwork/kopete/protocols/yahoo/libkyahoo/listtask.h #1076894:1076895
@@ -37,10 +37,10 @@
 protected:
 	virtual bool forMe( const Transfer *transfer ) const;
 	void parseBuddyList( YMSGTransfer *transfer );
-	void parseStealthList( YMSGTransfer *transfer );	
+
 signals:
 	void gotBuddy(const QString&, const QString&, const QString&);
-	void stealthStatusChanged( const QString&, Yahoo::StealthStatus );
+
 };
 
 #endif


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

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