summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/yahoo/libkyahoo/listtask.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-05 08:45:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-05 08:45:53 +0000
commit5527e01e0675fbb06b632ccdae423756fbff622b (patch)
treec2dd1a478a7789d3b01e77fdf31f9011a96a81c5 /kopete/protocols/yahoo/libkyahoo/listtask.cpp
parent1fc8db48741fae272e2d29078b266a3d0f2e2dd1 (diff)
downloadtdenetwork-5527e01e0675fbb06b632ccdae423756fbff622b.tar.gz
tdenetwork-5527e01e0675fbb06b632ccdae423756fbff622b.zip
Many fixes to the Yahoo protocol, courtesy of Serghei Amelian
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1146108 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/yahoo/libkyahoo/listtask.cpp')
-rw-r--r--kopete/protocols/yahoo/libkyahoo/listtask.cpp67
1 files changed, 36 insertions, 31 deletions
diff --git a/kopete/protocols/yahoo/libkyahoo/listtask.cpp b/kopete/protocols/yahoo/libkyahoo/listtask.cpp
index 261e7896..b1e35940 100644
--- a/kopete/protocols/yahoo/libkyahoo/listtask.cpp
+++ b/kopete/protocols/yahoo/libkyahoo/listtask.cpp
@@ -2,7 +2,7 @@
Kopete Yahoo Protocol
Handles several lists such as buddylist, ignorelist and so on
- Copyright (c) 2005 André Duffeck <andre.duffeck@kdemail.net>
+ Copyright (c) 2005 André Duffeck <duffeck@kde.org>
*************************************************************************
* *
@@ -15,18 +15,17 @@
*/
#include <qstring.h>
+#include <qstringlist.h>
#include "listtask.h"
#include "transfer.h"
#include "ymsgtransfer.h"
#include "client.h"
-#include <qstring.h>
-#include <qstringlist.h>
#include <kdebug.h>
ListTask::ListTask(Task* parent) : Task(parent)
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
+ kdDebug(YAHOO_RAW_DEBUG) ;
}
ListTask::~ListTask()
@@ -36,11 +35,9 @@ ListTask::~ListTask()
bool ListTask::take( Transfer* transfer )
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
-
if ( !forMe( transfer ) )
return false;
-
+
YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
parseBuddyList( t );
@@ -49,16 +46,15 @@ bool ListTask::take( Transfer* transfer )
return true;
}
-bool ListTask::forMe( Transfer* transfer ) const
+bool ListTask::forMe( const Transfer* transfer ) const
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
- YMSGTransfer *t = 0L;
- t = dynamic_cast<YMSGTransfer*>(transfer);
+ const YMSGTransfer *t = 0L;
+ t = dynamic_cast<const YMSGTransfer*>(transfer);
if (!t)
return false;
- if ( t->service() == Yahoo::ServiceList )
+ if ( t->service() == Yahoo::ServiceBuddyList )
return true;
else
return false;
@@ -66,40 +62,49 @@ bool ListTask::forMe( Transfer* transfer ) const
void ListTask::parseBuddyList( YMSGTransfer *t )
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
+ kdDebug(YAHOO_RAW_DEBUG) ;
- QString raw;
- m_list.append( t->firstParam( 87 ) );
-
- if( t->firstParam( 59 ).isEmpty() )
- return;
+ QString group;
+ QString buddy;
+ // We need some low-level parsing here
- QStringList groups;
- groups = QStringList::split( "\n", m_list );
+ // FIXME same: need to check
+ //foreach( const Param &p, t->paramList() )
- for ( QStringList::Iterator groupIt = groups.begin(); groupIt != groups.end(); ++groupIt )
+ ParamList paramList = t->paramList();
+ ParamList::const_iterator it;
+ for ( it = paramList.begin(); it != paramList.end(); ++it )
{
- QString group = (*groupIt).section(":", 0, 0);
- QStringList buddies;
- buddies = QStringList::split( ",", (*groupIt).section(":", 1,1) );
- for ( QStringList::Iterator buddyIt = buddies.begin(); buddyIt != buddies.end(); ++buddyIt )
+ const Param &p = *it;
+
+ kdDebug(YAHOO_RAW_DEBUG) << "1:" << p.first << endl;
+ kdDebug(YAHOO_RAW_DEBUG) << "2:" << p.second << endl;
+ switch( p.first )
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Parsed buddy: " << *buddyIt << " in group " << group << endl;
- emit gotBuddy( *buddyIt, QString::null, group );
+ case 65:
+ group = p.second;
+ break;
+ case 7:
+ buddy = p.second;
+ break;
+ case 301:
+ if( p.second == "319"){
+ kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Parsed buddy: " << buddy << " in group " << group << endl;
+ emit gotBuddy( buddy, QString(), group );
+ }
}
}
- m_list.truncate( 0 );
}
void ListTask::parseStealthList( YMSGTransfer *t )
{
- kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
+ kdDebug(YAHOO_RAW_DEBUG) ;
QString raw;
raw = t->firstParam( 185 );
- QStringList buddies = QStringList::split( ",", raw );
- for ( QStringList::Iterator it = buddies.begin(); it != buddies.end(); ++it )
+ const QStringList buddies = QStringList::split( ',', raw );
+ for ( QStringList::ConstIterator it = buddies.begin(); it != buddies.end(); ++it )
{
emit stealthStatusChanged( *it, Yahoo::StealthActive );
}