diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-05 08:45:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-05 08:45:53 +0000 |
commit | 5527e01e0675fbb06b632ccdae423756fbff622b (patch) | |
tree | c2dd1a478a7789d3b01e77fdf31f9011a96a81c5 /kopete/protocols/yahoo/libkyahoo/conferencetask.cpp | |
parent | 1fc8db48741fae272e2d29078b266a3d0f2e2dd1 (diff) | |
download | tdenetwork-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/conferencetask.cpp')
-rw-r--r-- | kopete/protocols/yahoo/libkyahoo/conferencetask.cpp | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp b/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp index 5f68eaa0..9ab0d4c1 100644 --- a/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp +++ b/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp @@ -2,7 +2,7 @@ Kopete Yahoo Protocol Handles conferences - Copyright (c) 2005 André Duffeck <[email protected]> + Copyright (c) 2005 André Duffeck <[email protected]> ************************************************************************* * * @@ -25,7 +25,7 @@ ConferenceTask::ConferenceTask(Task* parent) : Task(parent) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; } ConferenceTask::~ConferenceTask() @@ -34,14 +34,12 @@ ConferenceTask::~ConferenceTask() bool ConferenceTask::take( Transfer* transfer ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; - if ( !forMe( transfer ) ) return false; YMSGTransfer *t = 0L; t = static_cast<YMSGTransfer*>(transfer); - + if( t->service() == Yahoo::ServiceConfInvite || t->service() == Yahoo::ServiceConfAddInvite) parseInvitation( t ); @@ -57,12 +55,10 @@ bool ConferenceTask::take( Transfer* transfer ) return true; } -bool ConferenceTask::forMe( Transfer* transfer ) const +bool ConferenceTask::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; @@ -71,7 +67,7 @@ bool ConferenceTask::forMe( Transfer* transfer ) const t->service() == Yahoo::ServiceConfDecline || t->service() == Yahoo::ServiceConfLogoff || t->service() == Yahoo::ServiceConfAddInvite || - t->service() == Yahoo::ServiceConfMsg ) + t->service() == Yahoo::ServiceConfMsg ) return true; else return false; @@ -79,8 +75,8 @@ bool ConferenceTask::forMe( Transfer* transfer ) const void ConferenceTask::parseInvitation( YMSGTransfer *t ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; - + kdDebug(YAHOO_RAW_DEBUG) ; + int i = 0; QString who = t->firstParam( 50 ); QString room = t->firstParam( 57 ); @@ -92,9 +88,9 @@ void ConferenceTask::parseInvitation( YMSGTransfer *t ) msg = t->firstParam( 58 ); QStringList members; - for( i = 0; i < t->paramCount( 52 ); i++ ) + for( i = 0; i < t->paramCount( 52 ); ++i ) members.append( t->nthParam( 52, i ) ); - for( i = 0; i < t->paramCount( 53 ); i++ ) + for( i = 0; i < t->paramCount( 53 ); ++i ) members.append( t->nthParam( 53, i ) ); if( who == client()->userId() ) return; @@ -105,7 +101,7 @@ void ConferenceTask::parseInvitation( YMSGTransfer *t ) void ConferenceTask::parseMessage( YMSGTransfer *t ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; QString room = t->firstParam( 57 ); QString from = t->firstParam( 3 ); @@ -117,12 +113,12 @@ void ConferenceTask::parseMessage( YMSGTransfer *t ) msg = t->firstParam( 14 ); if( !msg.isEmpty() ) - emit gotMessage( from, room, msg ); + emit gotMessage( from, room, msg ); } void ConferenceTask::parseUserJoined( YMSGTransfer *t ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; QString room = t->firstParam( 57 ); QString who = t->firstParam( 53 ); @@ -133,7 +129,7 @@ void ConferenceTask::parseUserJoined( YMSGTransfer *t ) void ConferenceTask::parseUserLeft( YMSGTransfer *t ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; QString room = t->firstParam( 57 ); QString who = t->firstParam( 56 ); @@ -144,7 +140,7 @@ void ConferenceTask::parseUserLeft( YMSGTransfer *t ) void ConferenceTask::parseUserDeclined( YMSGTransfer *t ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; QString room = t->firstParam( 57 ); QString who = t->firstParam( 54 ); @@ -156,7 +152,7 @@ void ConferenceTask::parseUserDeclined( YMSGTransfer *t ) void ConferenceTask::inviteConference( const QString &room, const QStringList &members, const QString &msg ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfInvite); t->setId( client()->sessionID() ); @@ -165,7 +161,7 @@ void ConferenceTask::inviteConference( const QString &room, const QStringList &m t->setParam( 57, room.local8Bit() ); t->setParam( 58, msg.local8Bit() ); t->setParam( 97, 1 ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) t->setParam( 52, (*it).local8Bit() ); t->setParam( 13, "0" ); @@ -174,21 +170,21 @@ void ConferenceTask::inviteConference( const QString &room, const QStringList &m void ConferenceTask::addInvite( const QString &room, const QStringList &who, const QStringList &members, const QString &msg ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfAddInvite); t->setId( client()->sessionID() ); t->setParam( 1, client()->userId().local8Bit() ); QString whoList = who.first(); - for( uint i = 1; i < who.size(); i++ ) + for( int i = 1; i < who.size(); i++ ) whoList += QString(",%1").arg( who[i] ); t->setParam( 51, whoList.local8Bit() ); t->setParam( 57, room.local8Bit() ); t->setParam( 58, msg.local8Bit() ); t->setParam( 97, 1 ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) { t->setParam( 52, (*it).local8Bit() ); t->setParam( 53, (*it).local8Bit() ); // Note: this field should only be set if the buddy has already joined the conference, but no harm is done this way @@ -200,12 +196,12 @@ void ConferenceTask::addInvite( const QString &room, const QStringList &who, con void ConferenceTask::joinConference( const QString &room, const QStringList &members ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfLogon); t->setId( client()->sessionID() ); t->setParam( 1, client()->userId().local8Bit() ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) t->setParam( 3, (*it).local8Bit() ); t->setParam( 57, room.local8Bit() ); @@ -214,14 +210,14 @@ void ConferenceTask::joinConference( const QString &room, const QStringList &mem void ConferenceTask::declineConference( const QString &room, const QStringList &members, const QString &msg ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfDecline); t->setId( client()->sessionID() ); t->setParam( 1, client()->userId().local8Bit() ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) t->setParam( 3, (*it).local8Bit() ); - t->setParam( 57, room.local8Bit() ); + t->setParam( 57, room.local8Bit() ); t->setParam( 14, msg.utf8() ); t->setParam( 97, 1 ); @@ -229,12 +225,12 @@ void ConferenceTask::declineConference( const QString &room, const QStringList & } void ConferenceTask::leaveConference( const QString &room, const QStringList &members ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfLogoff); t->setId( client()->sessionID() ); t->setParam( 1, client()->userId().local8Bit() ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) t->setParam( 3, (*it).local8Bit() ); t->setParam( 57, room.local8Bit() ); @@ -243,12 +239,12 @@ void ConferenceTask::leaveConference( const QString &room, const QStringList &me void ConferenceTask::sendMessage( const QString &room, const QStringList &members, const QString &msg ) { - kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) ; YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfMsg); t->setId( client()->sessionID() ); t->setParam( 1, client()->userId().local8Bit() ); - for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + for( QStringList::const_iterator it = members.begin(); it != members.end(); ++it ) t->setParam( 53, (*it).local8Bit() ); t->setParam( 57, room.local8Bit() ); t->setParam( 14, msg.utf8() ); |