Ejemplo n.º 1
0
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 , QString::null );
        return;
    }

    QValueList<TLV> tlvList = st->buffer()->getTLVList();

    TLV uin = findTLV( tlvList, 0x0001 );
    if ( uin )
    {
        kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "found TLV(1) [SN], SN=" << QString( 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, QString::null );
        return; //if there's an error, we'll need to disconnect anyways
    }

    TLV server = findTLV( tlvList, 0x0005 );
    if ( server )
    {
        QString ip = QString( 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, QString::null );
    }
    tlvList.clear();
}
Ejemplo n.º 2
0
void OscarLoginTask::handleLoginResponse()
{
	kDebug(OSCAR_RAW_DEBUG) << "RECV SNAC 0x17, 0x07 - AIM Login Response";

	SnacTransfer* st = dynamic_cast<SnacTransfer*> ( transfer() );

	if ( !st )
	{
		setError( -1 , QString() );
		return;
	}

	QList<TLV> tlvList = st->buffer()->getTLVList();

	TLV uin = findTLV( tlvList, 0x0001 );
	if ( uin )
	{
		kDebug(OSCAR_RAW_DEBUG) << "found TLV(1) [SN], SN=" << QString( uin.data );
	}

	TLV err = findTLV( tlvList, 0x0008 );	
	if ( err )
	{
		Oscar::WORD errorNum = ( ( err.data[0] << 8 ) | err.data[1] );

		kDebug(OSCAR_RAW_DEBUG) << "found TLV(8) [ERROR] error= " << errorNum;
		Oscar::SNAC s = { 0, 0, 0, 0 };
		client()->fatalTaskError( s, errorNum );
		setError( errorNum, QString() );
		return; //if there's an error, we'll need to disconnect anyways
	}

	TLV server = findTLV( tlvList, 0x0005 );
	if ( server )
	{
		kDebug(OSCAR_RAW_DEBUG) << "found TLV(5) [SERVER] " << QString( server.data );
		QString ip = QString( server.data );
		int index = ip.indexOf( ':' );
		m_bosHost = ip.left( index );
		ip.remove( 0 , index+1 ); //get rid of the colon and everything before it
		m_bosPort = ip;
	}

	TLV cookie = findTLV( tlvList, 0x0006 );
	if ( cookie )
	{
		kDebug(OSCAR_RAW_DEBUG) << "found TLV(6) [COOKIE]";
		m_cookie = cookie.data;
	}

	TLV sslcert = findTLV( tlvList, 141 );
	if ( sslcert )
	{
		kDebug(OSCAR_RAW_DEBUG) << "found TLV(141) [SSLCERT]";
		m_bosSSLName = sslcert.data;
	}

	TLV ssl = findTLV( tlvList, 142 );
	{
		kDebug(OSCAR_RAW_DEBUG) << "found TLV(142) [SSL] " << (int)ssl.data[0];
		m_bosEncrypted = ssl.data[0];
	}

	tlvList.clear();

	if ( m_bosHost.isEmpty() )
	{
		kWarning(OSCAR_RAW_DEBUG) << "Empty host address!";
		
		Oscar::SNAC s = { 0, 0, 0, 0 };
		client()->fatalTaskError( s, 0 );
		setError( 0, QString() );
		return;
	}
	
	kDebug( OSCAR_RAW_DEBUG ) << "We should reconnect to server '"
		<< m_bosHost << "' on port " << m_bosPort << ( m_bosEncrypted ? " with " : " without " ) << "SSL" << endl;
	setSuccess( 0, QString() );
}