kopete: Remove the AIM specific code from liboscar

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 036b0229db)
pull/38/head
Slávek Banko 7 years ago
parent f59b2e28c7
commit 70e337eaa8

@ -27,7 +27,7 @@ tde_add_library( oscar STATIC_PIC AUTOMOC
inputprotocolbase.cpp coreprotocol.cpp flapprotocol.cpp
snacprotocol.cpp transfer.cpp rtf.cc bytestream.cpp
oscarclientstream.cpp safedelete.cpp stream.cpp oscarconnector.cpp
oscarbytestream.cpp buffer.cpp md5.c logintask.cpp aimlogintask.cpp
oscarbytestream.cpp buffer.cpp md5.c logintask.cpp
icqlogintask.cpp closeconnectiontask.cpp rateclassmanager.cpp
serverversionstask.cpp rateinfotask.cpp errortask.cpp
locationrightstask.cpp profiletask.cpp blmlimitstask.cpp

@ -8,7 +8,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/kopete/libkopete $(all_includes)
liboscar_la_SOURCES = oscarutils.cpp client.cpp task.cpp connector.cpp \
inputprotocolbase.cpp coreprotocol.cpp flapprotocol.cpp snacprotocol.cpp transfer.cpp rtf.cc \
bytestream.cpp oscarclientstream.cpp safedelete.cpp stream.cpp oscarconnector.cpp \
oscarbytestream.cpp buffer.cpp md5.c logintask.cpp aimlogintask.cpp icqlogintask.cpp \
oscarbytestream.cpp buffer.cpp md5.c logintask.cpp icqlogintask.cpp \
closeconnectiontask.cpp rateclassmanager.cpp serverversionstask.cpp rateinfotask.cpp \
errortask.cpp locationrightstask.cpp profiletask.cpp blmlimitstask.cpp \
servicesetuptask.cpp icbmparamstask.cpp ssimanager.cpp rateclass.cpp rateclass.h \

@ -1,254 +0,0 @@
/*
Kopete Oscar Protocol
aimlogintask.h - Handles logging into to the AIM service
Copyright (c) 2004 Matt Rogers <mattr@kde.org>
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#include "aimlogintask.h"
#include <stdlib.h>
#include <kdebug.h>
#include <tdelocale.h>
#include "connection.h"
#include "oscartypes.h"
#include "oscarutils.h"
#include "transfer.h"
#include "md5.h"
using namespace Oscar;
AimLoginTask::AimLoginTask( Task* parent )
: Task ( parent )
{
}
AimLoginTask::~AimLoginTask()
{
}
void AimLoginTask::onGo()
{
//send Snac 17,06
sendAuthStringRequest();
//when we have the authKey, login
connect( this, TQT_SIGNAL( haveAuthKey() ), this, TQT_SLOT( sendLoginRequest() ) );
}
bool AimLoginTask::forMe( Transfer* transfer ) const
{
SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer );
if (!st)
return false;
if ( st && st->snacService() == 0x17 )
{
WORD subtype = st->snacSubtype();
switch ( subtype )
{
case 0x0002:
case 0x0003:
case 0x0006:
case 0x0007:
return true;
break;
default:
return false;
break;
}
}
return false;
}
const TQByteArray& AimLoginTask::cookie() const
{
return m_cookie;
}
const TQString& AimLoginTask::bosHost() const
{
return m_bosHost;
}
const TQString& AimLoginTask::bosPort() const
{
return m_bosPort;
}
bool AimLoginTask::take( Transfer* transfer )
{
if ( forMe( transfer ) )
{
SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer );
if (!st)
return false;
WORD subtype = st->snacSubtype();
switch ( subtype )
{
case 0x0003:
setTransfer( transfer );
handleLoginResponse();
setTransfer( 0 );
return true;
break;
case 0x0007:
setTransfer( transfer );
processAuthStringReply();
setTransfer( 0 );
return true;
break;
default:
return false;
break;
}
return false;
}
return false;
}
void AimLoginTask::sendAuthStringRequest()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo
<< "SEND CLI_AUTH_REQUEST, sending login request" << endl;
FLAP f = { 0x02, 0, 0 };
SNAC s = { 0x0017, 0x0006, 0x0000, client()->snacSequence() };
Buffer* outbuf = new Buffer;
outbuf->addTLV(0x0001, client()->userId().length(), client()->userId().latin1() );
outbuf->addDWord(0x004B0000); // empty TLV 0x004B
outbuf->addDWord(0x005A0000); // empty TLV 0x005A
Transfer* st = createTransfer( f, s, outbuf );
send( st );
}
void AimLoginTask::processAuthStringReply()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Got the authorization key" << endl;
Buffer *inbuf = transfer()->buffer();
WORD keylen = inbuf->getWord();
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Key length is " << keylen << endl;
m_authKey.duplicate( inbuf->getBlock(keylen) );
emit haveAuthKey();
}
void AimLoginTask::sendLoginRequest()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "SEND (CLI_MD5_LOGIN) sending AIM login" << endl;
FLAP f = { 0x02, 0, 0 };
SNAC s = { 0x0017, 0x0002, 0x0000, client()->snacSequence() };
Buffer *outbuf = new Buffer;
const Oscar::ClientVersion* version = client()->version();
outbuf->addTLV(0x0001, client()->userId().length(), client()->userId().latin1());
TQByteArray digest( 17 ); //apparently MD5 digests are 16 bytes long
encodePassword( digest );
digest[16] = '\0'; //do this so that addTLV sees a NULL-terminator
outbuf->addTLV(0x0025, 16, digest);
outbuf->addTLV(0x0003, version->clientString.length(), version->clientString.latin1() );
outbuf->addTLV16(0x0016, version->clientId );
outbuf->addTLV16(0x0017, version->major );
outbuf->addTLV16(0x0018, version->minor );
outbuf->addTLV16(0x0019, version->point );
outbuf->addTLV16(0x001a, version->build );
outbuf->addDWord(0x00140004); //TLV type 0x0014, length 0x0004
outbuf->addDWord( version->other ); //TLV data for type 0x0014
outbuf->addTLV(0x000f, version->lang.length(), version->lang.latin1() );
outbuf->addTLV(0x000e, version->country.length(), version->country.latin1() );
//if set, old-style buddy lists will not work... you will need to use SSI
outbuf->addTLV8(0x004a,0x01);
Transfer *st = createTransfer( f, s, outbuf );
send( st );
}
void AimLoginTask::handleLoginResponse()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "RECV SNAC 0x17, 0x07 - AIM Login Response" << endl;
SnacTransfer* st = dynamic_cast<SnacTransfer*> ( transfer() );
if ( !st )
{
setError( -1 , TQString() );
return;
}
TQValueList<TLV> tlvList = st->buffer()->getTLVList();
TLV uin = findTLV( tlvList, 0x0001 );
if ( uin )
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "found TLV(1) [SN], SN=" << TQString( uin.data ) << endl;
}
TLV err = findTLV( tlvList, 0x0008 );
if ( err )
{
WORD errorNum = ( ( err.data[0] << 8 ) | err.data[1] );
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << k_funcinfo << "found TLV(8) [ERROR] error= " <<
errorNum << endl;
Oscar::SNAC s = { 0, 0, 0, 0 };
client()->fatalTaskError( s, errorNum );
setError( errorNum, TQString() );
return; //if there's an error, we'll need to disconnect anyways
}
TLV server = findTLV( tlvList, 0x0005 );
if ( server )
{
TQString ip = TQString( server.data );
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "found TLV(5) [SERVER] " << ip << endl;
int index = ip.find( ':' );
m_bosHost = ip.left( index );
ip.remove( 0 , index+1 ); //get rid of the colon and everything before it
m_bosPort = ip.left(4); //we only need 4 bytes
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "We should reconnect to server '" << m_bosHost <<
"' on port " << m_bosPort << endl;
}
TLV cookie = findTLV( tlvList, 0x0006 );
if ( cookie )
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "found TLV(6) [COOKIE]" << endl;
m_cookie.duplicate( cookie.data );
setSuccess( 0, TQString() );
}
tlvList.clear();
}
void AimLoginTask::encodePassword( TQByteArray& digest ) const
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << endl;
md5_state_t state;
md5_init( &state );
md5_append( &state, ( const md5_byte_t* ) m_authKey.data(), m_authKey.size() );
md5_append( &state, ( const md5_byte_t* ) client()->password().latin1(), client()->password().length() );
md5_append( &state, ( const md5_byte_t* ) AIM_MD5_STRING, strlen( AIM_MD5_STRING ) );
md5_finish( &state, ( md5_byte_t* ) digest.data() );
}
//kate: indent-mode csands; tab-width 4;
#include "aimlogintask.moc"

@ -1,83 +0,0 @@
/*
Kopete Oscar Protocol
aimlogintask.h - Handles logging into to the AIM service
Copyright (c) 2004 Matt Rogers <mattr@kde.org>
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef _OSCAR_AIMLOGINTASK_H_
#define _OSCAR_AIMLOGINTASK_H_
#include "task.h"
using namespace Oscar;
class AimLoginTask : public Task
{
Q_OBJECT
public:
AimLoginTask( Task* parent );
~AimLoginTask();
bool take( Transfer* transfer );
virtual void onGo();
//Protocol specific stuff
const TQByteArray& cookie() const;
const TQString& bosHost() const;
const TQString& bosPort() const;
protected:
bool forMe( Transfer* transfer ) const;
signals:
void haveAuthKey();
private:
//! Encodes a password using MD5
void encodePassword( TQByteArray& digest ) const;
//! Send SNAC 0x17, 0x06
void sendAuthStringRequest();
//! Handle SNAC 0x17, 0x07
void processAuthStringReply();
//! Handle SNAC 0x17, 0x03
void handleLoginResponse();
//! Parse the error codes to generate a reason why sign-on failed
//Massive code duplication with CloseConnectionTask
bool parseDisconnectCode( int error, TQString& reason );
private slots:
//! Send SNAC 0x17, 0x02
void sendLoginRequest();
private:
//! The authorization key to use when encoding the password
TQByteArray m_authKey;
//! The all important connection cookie
TQByteArray m_cookie;
//! The new BOS Host
TQString m_bosHost;
//! The new BOS Port
TQString m_bosPort;
};
#endif

@ -69,10 +69,7 @@ void BuddyIconTask::onGo()
if ( m_action == Receive )
{
if ( client()->isIcq() )
sendICQBuddyIconRequest();
else
sendAIMBuddyIconRequest();
}
else
sendIcon();
@ -120,8 +117,6 @@ bool BuddyIconTask::take( Transfer* transfer )
setTransfer( transfer );
if ( st->snacSubtype() == 0x0003 )
handleUploadResponse();
else if ( st->snacSubtype() == 0x0005 )
handleAIMBuddyIconResponse();
else
handleICQBuddyIconResponse();
@ -157,41 +152,6 @@ void BuddyIconTask::handleUploadResponse()
}
void BuddyIconTask::sendAIMBuddyIconRequest()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "requesting buddy icon for " << m_user << endl;
FLAP f = { 0x02, 0, 0 };
m_seq = client()->snacSequence();
SNAC s = { 0x0010, 0x0004, 0x0000, m_seq };
Buffer* b = new Buffer;
b->addBUIN( m_user.latin1() ); //TODO: check encoding
b->addByte( 0x01 );
b->addWord( 0x0001 );
b->addByte( m_hashType );
b->addByte( m_hash.size() ); //MD5 Hash Size
b->addString( m_hash, m_hash.size() ); //MD5 Hash
Transfer* t = createTransfer( f, s, b );
send( t );
}
void BuddyIconTask::handleAIMBuddyIconResponse()
{
Buffer* b = transfer()->buffer();
TQString user = b->getBUIN();
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Receiving buddy icon for " << user << endl;
b->skipBytes(2); //unknown field. not used
BYTE iconType = b->getByte();
Q_UNUSED( iconType );
BYTE hashSize = b->getByte();
TQByteArray iconHash;
iconHash.duplicate( b->getBlock(hashSize) );
WORD iconSize = b->getWord();
TQByteArray icon;
icon.duplicate( b->getBlock(iconSize) );
emit haveIcon( user, icon );
}
void BuddyIconTask::sendICQBuddyIconRequest()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "requesting buddy icon for " << m_user << endl;

@ -50,8 +50,6 @@ signals:
private:
void sendIcon();
void handleUploadResponse();
void sendAIMBuddyIconRequest();
void handleAIMBuddyIconResponse();
void sendICQBuddyIconRequest();
void handleICQBuddyIconResponse();

@ -24,7 +24,7 @@
/**
* This class provides a way to change how the account user
* appears on everybody else's contact list. It is used to
* implement the invisible online status in ICQ and AIM
* implement the invisible online status in ICQ
* @author Matt Rogers
*/
class ChangeVisibilityTask : public Task

@ -93,7 +93,6 @@ public:
int stage;
//Protocol specific data
bool isIcq;
bool redirectRequested;
TQValueList<WORD> redirectionServices;
WORD currentRedirect;
@ -146,7 +145,6 @@ Client::Client( TQObject* parent )
d = new ClientPrivate;
d->tzoffset = 0;
d->active = false;
d->isIcq = false; //default to AIM
d->redirectRequested = false;
d->currentRedirect = 0;
d->connectAsStatus = 0x0; // default to online
@ -233,30 +231,6 @@ void Client::close()
d->ssiManager->clear();
}
void Client::setStatus( AIMStatus status, const TQString &_message )
{
// AIM: you're away exactly when your away message isn't empty.
// can't use TQString() as a message either; ProfileTask
// interprets null as "don't change".
TQString message;
if ( status == Online )
message = TQString::fromAscii("");
else
{
if ( _message.isEmpty() )
message = TQString::fromAscii(" ");
else
message = _message;
}
Connection* c = d->connections.connectionForFamily( 0x0002 );
if ( !c )
return;
ProfileTask* pt = new ProfileTask( c->rootTask() );
pt->setAwayMessage( message );
pt->go( true );
}
void Client::setStatus( DWORD status, const TQString &message )
{
// remember the message to reply with, when requested
@ -398,23 +372,20 @@ void Client::serviceSetupFinished()
{
d->active = true;
if ( isIcq() )
setStatus( d->connectAsStatus, d->connectWithMessage );
d->ownStatusTask->go();
if ( isIcq() )
{
//retrieve offline messages
Connection* c = d->connections.connectionForFamily( 0x0015 );
if ( !c )
if ( !c ) {
return;
}
OfflineMessagesTask *offlineMsgTask = new OfflineMessagesTask( c->rootTask() );
connect( offlineMsgTask, TQT_SIGNAL( receivedOfflineMessage(const Oscar::Message& ) ),
this, TQT_SIGNAL( messageReceived(const Oscar::Message& ) ) );
offlineMsgTask->go( true );
}
emit haveSSIList();
emit loggedIn();
@ -595,16 +566,6 @@ bool Client::isActive() const
return d->active;
}
bool Client::isIcq() const
{
return d->isIcq;
}
void Client::setIsIcq( bool isIcq )
{
d->isIcq = isIcq;
}
void Client::debug( const TQString& str )
{
Q_UNUSED(str);
@ -852,16 +813,6 @@ void Client::setChatExchangeList( const TQValueList<int>& exchanges )
d->exchanges = exchanges;
}
void Client::requestAIMProfile( const TQString& contact )
{
d->userInfoTask->requestInfoFor( contact, UserInfoTask::Profile );
}
void Client::requestAIMAwayMessage( const TQString& contact )
{
d->userInfoTask->requestInfoFor( contact, UserInfoTask::AwayMessage );
}
void Client::requestICQAwayMessage( const TQString& contact, ICQStatus contactStatus )
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "requesting away message for " << contact << endl;
@ -993,16 +944,6 @@ void Client::uinSearch( const TQString& uin )
ust->searchUserByUIN( uin );
}
void Client::updateProfile( const TQString& profile )
{
Connection* c = d->connections.connectionForFamily( 0x0002 );
if ( !c )
return;
ProfileTask* pt = new ProfileTask( c->rootTask() );
pt->setProfileText( profile );
pt->go(true);
}
void Client::sendTyping( const TQString & contact, bool typing )
{
Connection* c = d->connections.connectionForFamily( 0x0004 );

@ -68,7 +68,6 @@ public:
FatalProtocolError = 3
};
enum AIMStatus { Online = 0, Away };
enum ICQStatus { ICQOnline = 0, ICQAway, ICQNotAvailable, ICQOccupied, ICQDoNotDisturb, ICQFreeForChat };
/*************
@ -102,8 +101,6 @@ public:
/** Logout and disconnect */
void close();
/** Set our status for AIM */
void setStatus( AIMStatus status, const TQString &message = TQString() );
/** Set our status for ICQ */
void setStatus( DWORD status, const TQString &message = TQString() );
@ -240,18 +237,6 @@ public:
*/
TQValueList<int> chatExchangeList() const;
/**
* Request the aim profile
* \param contact the contact to get info for
*/
void requestAIMProfile( const TQString& contact );
/**
* Request the aim away message
* \param contact the contact to get info for
*/
void requestAIMAwayMessage( const TQString& contact );
/**
* Add the icq away message request to queue
* \param contact the contact to get info for
@ -273,9 +258,6 @@ public:
//! Run a UIN search
void uinSearch( const TQString& uin );
//! Update the user's AIM profile
void updateProfile( const TQString& profile );
//! Get buddy icon information for a person
void requestBuddyIcon( const TQString& user, const TQByteArray& hash, BYTE hashType );
@ -344,10 +326,6 @@ public:
/** Change the current status message w/o changing status */
void setStatusMessage( const TQString &message );
/** ICQ Settings */
bool isIcq() const;
void setIsIcq( bool isIcq );
/** Host's IP address */
TQCString ipAddress() const;

@ -64,39 +64,22 @@ void ClientReadyTask::onGo()
buffer->addWord( 0x0003 );
break;
case 0x0013:
buffer->addWord( client()->isIcq() ? 0x0002 : 0x0003 );
buffer->addWord( 0x0002 );
break;
default:
buffer->addWord( 0x0001 );
};
if ( client()->isIcq() )
{
if ( i == 0x0002 )
if ( i == 0x0002 ) {
buffer->addWord( 0x0101 );
else
}
else {
buffer->addWord( 0x0110 );
}
//always add 0x047B
buffer->addWord( 0x047B );
}
else //we're AIM so AOL has us do something completely different! *sigh*
{
switch( i )
{
case 0x0008:
case 0x000B:
case 0x000C:
buffer->addWord( 0x0104 );
buffer->addWord( 0x0001 );
break;
default:
buffer->addWord( 0x0110 );
buffer->addWord( 0x059B );
break;
};
}
}
//send the damn thing so we can finally be finished
//with the hell that is oscar login. (just wait until you get a message)

@ -154,11 +154,6 @@ TQString Connection::password() const
return d->client->password();
}
bool Connection::isIcq() const
{
return d->client->isIcq();
}
Task* Connection::rootTask() const
{
return d->root;

@ -143,7 +143,6 @@ public:
TQString userId() const;
TQString password() const;
bool isIcq() const;
SSIManager* ssiManager() const;
const Oscar::ClientVersion* version() const;
RateClassManager* rateManager() const;

@ -1,6 +1,6 @@
/*
Kopete Oscar Protocol
logintask.cpp - Handles logging into to the AIM or ICQ service
logintask.cpp - Handles logging into to the ICQ service
Copyright (c) 2004 Matt Rogers <mattr@kde.org>
@ -22,7 +22,6 @@
#include <kdebug.h>
#include <tdelocale.h>
#include "aimlogintask.h"
#include "connection.h"
#include "closeconnectiontask.h"
#include "icqlogintask.h"
@ -40,24 +39,19 @@
StageOneLoginTask::StageOneLoginTask( Task* parent )
: Task ( parent )
{
m_aimTask = 0L;
m_icqTask = 0L;
m_closeTask = 0L;
}
StageOneLoginTask::~StageOneLoginTask()
{
delete m_aimTask;
delete m_icqTask;
delete m_closeTask;
}
bool StageOneLoginTask::take( Transfer* transfer )
{
if ( forMe( transfer ) )
{
if ( client()->isIcq() )
{
if ( forMe( transfer ) ) {
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Starting ICQ login" << endl;
m_icqTask = new IcqLoginTask( client()->rootTask() );
m_closeTask = new CloseConnectionTask( client()->rootTask() );
@ -65,24 +59,6 @@ bool StageOneLoginTask::take( Transfer* transfer )
//connect finished signal
connect( m_closeTask, TQT_SIGNAL( finished() ), this, TQT_SLOT( closeTaskFinished() ) );
m_icqTask->go( true );
}
else
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Starting AIM login" << endl;
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Sending the FLAP version back" << endl;
//send the flap version response
FLAP f = { 0x01, 0 , 0 };
Buffer *outbuf = new Buffer;
outbuf->addDWord(0x00000001); //flap version
f.length = outbuf->length();
Transfer* ft = createTransfer( f, outbuf );
send( ft );
m_aimTask = new AimLoginTask( client()->rootTask() );
connect( m_aimTask, TQT_SIGNAL( finished() ), this, TQT_SLOT( aimTaskFinished() ) );
m_aimTask->go( true );
}
return true;
}
return false;
@ -98,16 +74,6 @@ void StageOneLoginTask::closeTaskFinished()
setSuccess( m_closeTask->statusCode(), m_closeTask->statusString() );
}
void StageOneLoginTask::aimTaskFinished()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << endl;
m_cookie = m_aimTask->cookie();
m_bosPort = m_aimTask->bosPort();
m_bosServer = m_aimTask->bosHost();
setSuccess( m_aimTask->statusCode(), m_aimTask->statusString() );
}
bool StageOneLoginTask::forMe( Transfer* transfer ) const
{
FlapTransfer* ft = dynamic_cast<FlapTransfer*> ( transfer );

@ -1,6 +1,6 @@
/*
Kopete Oscar Protocol
logintask.h - Handles logging into to the AIM or ICQ service
logintask.h - Handles logging into to the ICQ service
Copyright (c) 2004 Matt Rogers <mattr@kde.org>
@ -23,7 +23,6 @@
#include "oscartypes.h"
#include "task.h"
#include "aimlogintask.h"
#include "icqlogintask.h"
#include "closeconnectiontask.h"
@ -70,7 +69,6 @@ public:
public slots:
void closeTaskFinished();
void aimTaskFinished();
protected:
bool forMe( Transfer* transfer ) const;
@ -78,7 +76,6 @@ protected:
private:
//Tasks we want to control
AimLoginTask* m_aimTask;
IcqLoginTask* m_icqTask;
CloseConnectionTask* m_closeTask;

@ -27,7 +27,6 @@
//! Debug Areas
const int OSCAR_RAW_DEBUG = 14151;
const int OSCAR_GEN_DEBUG = 14150;
const int OSCAR_AIM_DEBUG = 14152;
const int OSCAR_ICQ_DEBUG = 14153;
namespace Oscar
@ -248,9 +247,6 @@ struct ClientVersion
/* ICQ Version Characteristics */
const unsigned char ICQ_TCP_VERSION = 0x0008;
/* AIM Version Characteristics */
const char AIM_MD5_STRING[] = "AOL Instant Messenger (SM)";
/* SSI types */
const WORD ROSTER_CONTACT = 0x0000; // a normal contact
const WORD ROSTER_GROUP = 0x0001; // a group of contacts

@ -74,24 +74,6 @@ void ProfileTask::sendProfileUpdate()
Buffer *buffer = new Buffer();
Buffer capBuf;
if ( !m_profileText.isNull() && !client()->isIcq() )
{
static const TQString defencoding = "text/aolrtf; charset=\"us-ascii\"";
buffer->addTLV(0x0001, defencoding.length(), defencoding.latin1());
buffer->addTLV(0x0002, m_profileText.length(), m_profileText.local8Bit());
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "setting profile = " << m_profileText << endl;
}
if ( !m_awayMessage.isNull() && !client()->isIcq() )
{
static const TQString defencoding = "text/aolrtf; charset=\"us-ascii\"";
buffer->addTLV(0x0003, defencoding.length(), defencoding.latin1());
buffer->addTLV(0x0004, m_awayMessage.length(), m_awayMessage.local8Bit());
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "setting away message = " << m_awayMessage << endl;
}
if ( client()->isIcq() )
{
capBuf.addString( oscar_caps[CAP_ICQSERVERRELAY], 16 ); // we support type-2 messages
capBuf.addString( oscar_caps[CAP_UTF8], 16 ); // we can send/receive UTF encoded messages
capBuf.addString( oscar_caps[CAP_ISICQ], 16 ); // I think this is an icq client, but maybe I'm wrong
@ -99,14 +81,6 @@ void ProfileTask::sendProfileUpdate()
//capBuf.addString( oscar_caps[CAP_RTFMSGS], 16 ); // we do incoming RTF messages
capBuf.addString( oscar_caps[CAP_TYPING], 16 ); // we know you're typing something to us!
capBuf.addString( oscar_caps[CAP_BUDDYICON], 16 ); //can you take my picture?
}
else
{
capBuf.addString( oscar_caps[CAP_UTF8], 16 ); //we can send/receive UTF encoded messages
capBuf.addString( oscar_caps[CAP_KOPETE], 16 ); // we are the borg, resistance is futile
capBuf.addString( oscar_caps[CAP_TYPING], 16 ); // we know you're typing something to us!
capBuf.addString( oscar_caps[CAP_BUDDYICON], 16 ); //can you take my picture?
}
//kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "adding capabilities, size=" << capBuf.length() << endl;
buffer->addTLV(0x0005, capBuf.length(), capBuf.buffer());

@ -21,8 +21,7 @@
#include "task.h"
/**
Task that sets the profile and away message on the server (AIM only).
Also takes care of updating the capabilities supported by the client (AIM and ICQ).
Also takes care of updating the capabilities supported by the client (ICQ).
The profile will be updated only if the profile text has been set non-null.
The away message will be set only if the away message has been set non-null.

@ -98,23 +98,12 @@ void SendMessageTask::onGo()
break;
}
// Add the TLV to indicate if this is an autoresponse: 0x00040000
// Right now, only supported for the AIM client, I'm not sure about ICQ
// For some reason you can't have both a 0x0004 and 0x0003 TLV in the same
// SNAC, if you do the AIM server complains
if ( !client()->isIcq() && (m_autoResponse == true) )
{
TLV tlv4( 0x0004, 0, NULL);
b->addTLV( tlv4 );
}
else
{
b->addDWord( 0x00030000 ); //empty TLV 3 to get an ack from the server
}
if ( client()->isIcq() && m_message.type() != 2 && ! m_message.hasProperty( Oscar::Message::StatusMessageRequest ) )
if ( m_message.type() != 2 && ! m_message.hasProperty( Oscar::Message::StatusMessageRequest ) ) {
b->addDWord( 0x00060000 ); //empty TLV 6 to store message on the server if not online
}
}
else
{
/* send an autoresponse */
@ -141,18 +130,10 @@ void SendMessageTask::addChannel1Data( Buffer* b )
{
Buffer tlv2buffer;
//Send features TLV using data from pidgin. Features are different
//depending on whether we're ICQ or AIM
if ( client()->isIcq() )
{
//Send features TLV using data from pidgin.
tlv2buffer.addDWord( 0x05010002 ); //TLV 0x0501, length 2
tlv2buffer.addWord( 0x0106 ); //TLV 0x0501 data
}
else
{
tlv2buffer.addDWord( 0x05010004 ); //TLV 0x0501, length 4
tlv2buffer.addDWord( 0x01010102 ); //TLV 0x0501 data.
}
//we only send one message part. There's only one client that actually uses
//them and it's quite old and infrequently used
tlv2buffer.addWord( 0x0101 ); //add TLV(0x0101) also known as TLV(257)

@ -115,7 +115,6 @@ void ServerVersionsTask::handleFamilies()
void ServerVersionsTask::requestFamilyVersions()
{
bool isIcq = client()->isIcq();
int listLength = m_familiesList.count();
FLAP f = { 0x02, 0, 0 };
@ -125,23 +124,19 @@ void ServerVersionsTask::requestFamilyVersions()
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "SEND SNAC 0x01, 0x17 - Snac family versions we want" << endl;
for ( int i = 0; i < listLength; i++ )
{
for ( int i = 0; i < listLength; i++ ) {
outbuf->addWord( m_familiesList[i] );
if ( m_familiesList[i] == 0x0001 )
if ( m_familiesList[i] == 0x0001 ) {
val = 0x0003;
else
{
if ( m_familiesList[i] == 0x0013 )
{
if ( isIcq )
}
else {
if ( m_familiesList[i] == 0x0013 ) {
val = 0x0004; // for ICQ2002
else
val = 0x0003;
}
else
else {
val = 0x0001;
}
}
outbuf->addWord(val);
}

@ -33,7 +33,6 @@ void LoginTest::slotDoTest()
// connect to server
tqDebug( "connecting to server ");
myClient->setIsIcq( true );
myClient->start( server, 5190, "userid", "password" );
myClient->connectToServer( myConnection, server, true );
connected = true;

@ -33,7 +33,6 @@ void LoginTest::slotDoTest()
// connect to server
tqDebug( "connecting to server ");
myClient->setIsIcq( true );
myClient->start( server, 5190, "userid", "password" );
myClient->connectToServer( myConnection, server, true );
TQTimer::singleShot( 10000, this, TQT_SLOT(runAddGroupTest() ) );

@ -33,7 +33,6 @@ void LoginTest::slotDoTest()
// connect to server
tqDebug( "connecting to server ");
myClient->setIsIcq( true );
myClient->start( server, 5190, "userid", "password" );
myClient->connectToServer( myConnection, server, true );
//TQObject::connect( myClient, TQT_SIGNAL( userIsOnline( const TQString& ) ), this, TQT_SLOT( runUserInfoTest()));

@ -95,21 +95,17 @@ public:
};
OscarAccount::OscarAccount(Kopete::Protocol *parent, const TQString &accountID, const char *name, bool isICQ)
: Kopete::PasswordedAccount( parent, accountID, isICQ ? 8 : 16, name )
: Kopete::PasswordedAccount( parent, accountID, 8, name )
{
kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << " accountID='" << accountID <<
"', isICQ=" << isICQ << endl;
d = new OscarAccountPrivate( *this );
d->engine = new Client( this );
d->engine->setIsIcq( isICQ );
d->versionAlreadyUpdated = false;
d->versionUpdaterStamp = OscarVersionUpdater::self()->stamp();
if ( isICQ )
d->engine->setVersion( OscarVersionUpdater::self()->getICQVersion() );
else
d->engine->setVersion( OscarVersionUpdater::self()->getAIMVersion() );
d->engine->setCodecProvider( d );
d->olnscDialog = 0L;
@ -182,13 +178,6 @@ void OscarAccount::loginActions()
kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "processing SSI list" << endl;
processSSIList();
//start a chat nav connection
if ( !engine()->isIcq() )
{
kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "sending request for chat nav service" << endl;
d->engine->requestServerRedirect( 0x000D );
}
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "sending request for icon service" << endl;
d->engine->requestServerRedirect( 0x0010 );
@ -473,7 +462,7 @@ void OscarAccount::setBuddyIcon( KURL url )
if ( image.isNull() )
return;
const TQSize size = ( d->engine->isIcq() ) ? TQSize( 52, 64 ) : TQSize( 48, 48 );
const TQSize size = TQSize( 52, 64 );
image = image.smoothScale( size, TQ_ScaleMax );
if( image.width() > size.width())
@ -805,9 +794,8 @@ void OscarAccount::slotSendBuddyIcon()
TQString OscarAccount::getFLAPErrorMessage( int code )
{
bool isICQ = d->engine->isIcq();
TQString acctType = isICQ ? i18n("ICQ") : i18n("AIM");
TQString acctDescription = isICQ ? i18n("ICQ user id", "UIN") : i18n("AIM user id", "screen name");
TQString acctType = i18n("ICQ");
TQString acctDescription = i18n("ICQ user id", "UIN");
TQString reason;
//FLAP errors are always fatal
//negative codes are things added by liboscar developers

@ -45,7 +45,7 @@ class KDE_EXPORT OscarAccount : public Kopete::PasswordedAccount
public:
OscarAccount(Kopete::Protocol *parent, const TQString &accountID, const char *name=0L, bool isICQ=false);
OscarAccount(Kopete::Protocol *parent, const TQString &accountID, const char *name=0L, bool isICQ=true);
virtual ~OscarAccount();
/** Provide the derived accounts and contacts with access to the backend */

@ -170,16 +170,10 @@ void OscarContact::userInfoUpdated( const TQString& contact, const UserDetails&
TQStringList capList;
// Append client name and version in case we found one
if ( m_details.userClass() & 0x0080 /* WIRELESS */ )
capList << i18n( "Mobile AIM Client" );
else
{
if ( !m_details.clientName().isEmpty() )
{
if ( !m_details.clientName().isEmpty() ) {
capList << i18n( "Translators: client name and version",
"%1").arg( m_details.clientName() );
}
}
// and now for some general informative capabilities
if ( m_details.hasCap( CAP_BUDDYICON ) )

@ -32,7 +32,6 @@ OscarVersionUpdater::OscarVersionUpdater()
: mStamp( 1 ), mUpdating( false )
{
initICQVersionInfo();
initAIMVersionInfo();
}
OscarVersionUpdater::~OscarVersionUpdater()
@ -100,37 +99,8 @@ void OscarVersionUpdater::initICQVersionInfo()
mICQVersion.lang = config.readEntry( "Lang", "en" );
}
void OscarVersionUpdater::initAIMVersionInfo()
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << endl;
TDEConfigGroup config( TDEGlobal::config(), "AIMVersion" );
mAIMVersion.clientString = config.readEntry( "ClientString", "AOL Instant Messenger (SM), version 5.1.3036/WIN32" );
mAIMVersion.clientId = config.readEntry( "ClientId", "0x0109" ).toUShort( 0, 0 );
mAIMVersion.major = config.readEntry( "Major", "0x0005" ).toUShort( 0, 0 );
mAIMVersion.minor = config.readEntry( "Minor", "0x0001" ).toUShort( 0, 0 );
mAIMVersion.point = config.readEntry( "Point", "0x0000" ).toUShort( 0, 0 );
mAIMVersion.build = config.readEntry( "Build", "0x0bdc" ).toUShort( 0, 0 );
mAIMVersion.other = config.readEntry( "Other", "0x000000d2" ).toUInt( 0, 0 );
mAIMVersion.country = config.readEntry( "Country", "us" );
mAIMVersion.lang = config.readEntry( "Lang", "en" );
}
void OscarVersionUpdater::printDebug()
{
kdDebug(OSCAR_RAW_DEBUG) << "*************** AIM VERSION INFO ***************" << endl;
kdDebug(OSCAR_RAW_DEBUG) << "client string: " << mAIMVersion.clientString << endl;
kdDebug(OSCAR_RAW_DEBUG) << "client id: " << TQString::number( mAIMVersion.clientId, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "major: " << TQString::number( mAIMVersion.major, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "minor: " << TQString::number( mAIMVersion.minor, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "point: " << TQString::number( mAIMVersion.point, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "build: " << TQString::number( mAIMVersion.build, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "other: " << TQString::number( mAIMVersion.other, 16 ) << endl;
kdDebug(OSCAR_RAW_DEBUG) << "country: " << mAIMVersion.country << endl;
kdDebug(OSCAR_RAW_DEBUG) << "lang: " << mAIMVersion.lang << endl;
kdDebug(OSCAR_RAW_DEBUG) << "************************************************" << endl;
kdDebug(OSCAR_RAW_DEBUG) << "*************** ICQ VERSION INFO ***************" << endl;
kdDebug(OSCAR_RAW_DEBUG) << "client string: " << mICQVersion.clientString << endl;
kdDebug(OSCAR_RAW_DEBUG) << "client id: " << TQString::number( mICQVersion.clientId, 16 ) << endl;
@ -169,7 +139,6 @@ void OscarVersionUpdater::slotTransferResult ( TDEIO::Job *job )
if ( doc.setContent ( mVersionData ) )
{
Oscar::ClientVersion tmpICQ = mICQVersion;
Oscar::ClientVersion tmpAIM = mAIMVersion;
parseDocument( doc );
@ -178,12 +147,6 @@ void OscarVersionUpdater::slotTransferResult ( TDEIO::Job *job )
storeVersionInfo( "ICQVersion", mICQVersion );
bUpdate = true;
}
if ( !equal( tmpAIM, mAIMVersion ) )
{
storeVersionInfo( "AIMVersion", mAIMVersion );
bUpdate = true;
}
}
}
@ -211,9 +174,6 @@ void OscarVersionUpdater::parseDocument( TQDomDocument& doc )
{
if ( versionElement.tagName() == "icq" )
parseVersion( mICQVersion, versionElement );
else if ( versionElement.tagName() == "aim" )
parseVersion( mAIMVersion, versionElement );
versionElement = versionElement.nextSibling().toElement();
}
}

@ -63,22 +63,11 @@ public:
*/
const Oscar::ClientVersion* getICQVersion() const { return &mICQVersion; }
/**
* Return structure with version info for AIM.
* @return Oscar::ClientVersion.
*/
const Oscar::ClientVersion* getAIMVersion() const { return &mAIMVersion; }
/**
* Set structure with ICQ version info to default.
*/
void initICQVersionInfo();
/**
* Set structure with AIM version info to default.
*/
void initAIMVersionInfo();
/**
* Print debug info.
*/
@ -109,7 +98,6 @@ private:
static OscarVersionUpdater *versionUpdaterStatic;
Oscar::ClientVersion mICQVersion;
Oscar::ClientVersion mAIMVersion;
TDEIO::TransferJob *mTransferJob;
TQByteArray mVersionData;

Loading…
Cancel
Save