bool ICQTlvInfoRequestTask::take( Transfer* transfer )
{
	if ( forMe( transfer ) )
	{
		const SnacTransfer* st = dynamic_cast<const SnacTransfer*>( transfer );
		if ( !st )
			return false;
		
		setTransfer( transfer );
		TLV tlv1 = transfer->buffer()->getTLV();
		Buffer buffer( tlv1.data, tlv1.length );

		//FIXME this is silly. parseInitialData should take care of this for me.
		buffer.skipBytes( 12 );

		if ( buffer.getByte() == 0x0A )
		{
			kDebug(OSCAR_RAW_DEBUG) << "Received user info";
			parse( st->snacRequest(), buffer.getLEBlock() );
			setSuccess( 0, QString() );
		}
		else
		{
			kDebug(OSCAR_RAW_DEBUG) << "Couldn't receive user info!!!";
			setError( 0, QString() );
		}

		setTransfer( 0 );
		return true;
	}
	return false;
}
bool WIFISubscriber::notifyRsrcStatus(Notification &notification)
{
    bool notify = forMe(notification);

    if (notify) {
        switch(notification.rsrcStatus)
        {
        case RSRC_UNSUBSCRIBE:
            break;
        case RSRC_RELEASED:
            loc_eng_dmn_conn_loc_api_server_data_conn(
                senderId,
                GPSONE_LOC_API_IF_RELEASE_SUCCESS);
            break;
        case RSRC_DENIED:
            loc_eng_dmn_conn_loc_api_server_data_conn(
                senderId,
                GPSONE_LOC_API_IF_FAILURE);
            break;
        case RSRC_GRANTED:
            loc_eng_dmn_conn_loc_api_server_data_conn(
                senderId,
                GPSONE_LOC_API_IF_REQUEST_SUCCESS);
            break;
        default:
            notify = false;
        }
    }

    return notify;
}
Example #3
0
bool SSIAuthTask::take( Transfer* t )
{
	if ( forMe( t ) )
	{
		setTransfer( t );
		SnacTransfer* st = dynamic_cast<SnacTransfer*> ( t );
		
		switch ( st->snacSubtype() )
		{
			case 0x0015: // Future authorization granted
				handleFutureAuthGranted();
				break;
			case 0x0019: // Authorization request
				handleAuthRequested();
				break;
			case 0x001b: // Authorization reply
				handleAuthReplied();
				break;
			case 0x001c: // "You were added" message
				handleAddedMessage();
				break;
		}
		setTransfer( 0 );
		return true;
	}
	return false;
}
bool GetStatusTask::take( Transfer * transfer )
{
	if ( !forMe( transfer ) )
		return false;
	Response * response = dynamic_cast<Response *>( transfer );
	if ( !response )
		return false;
	
	Field::FieldList responseFields = response->fields();
	responseFields.dump( true );
	// parse received details and signal like billio
	Field::SingleField * sf = 0;
	Q_UINT16 status;
	sf = responseFields.findSingleField( NM_A_SZ_STATUS );
	if ( sf )
	{
		// As of Sept 2004 the server always responds with 2 (Available) here, even if the sender is not
		// This must be because the sender is not on our contact list but has sent us a message.
		// TODO: Check that the change to sending DNs above has fixed this problem.
		status = sf->value().toInt();
		// unfortunately getstatus doesn't give us an away message so we pass QString::null here
		emit gotStatus( m_userDN, status, QString::null );
		setSuccess();
	}	
	else
		setError();	
	return true;
}
bool SSIModifyTask::take( Transfer* transfer )
{
	if ( forMe( transfer ) )
	{
		SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer );
		if ( st )
		{
			setTransfer( transfer );

			if ( st->snacSubtype() == 0x0008 )
				handleContactAdd();
			else if ( st->snacSubtype() == 0x0009 )
				handleContactUpdate();
			else if ( st->snacSubtype() == 0x000A )
				handleContactRemove();
			else if ( st->snacSubtype() == 0x000E )
				handleContactAck();

			setTransfer( 0 );
		}
		return true;
	}
	else
		return false;
}
bool UserInfoTask::take( Transfer * transfer )
{
	if ( forMe( transfer ) )
	{
		setTransfer( transfer );
		Oscar::DWORD seq = 0;
		SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer );
		if ( st )
			seq = st->snacRequest();

		if ( seq != 0 )
		{
			//AFAIK location info packets always have user info
			Buffer* b = transfer->buffer();
			UserDetails ud;
			ud.fill( b );
			m_sequenceInfoMap[seq] = ud;
			emit gotInfo( seq );

			QList<TLV> list = b->getTLVList();
			QList<TLV>::iterator it = list.begin(), itEnd = list.end();
			QString profile;
			QString away;
			for ( ; it != itEnd; ++it )
			{
				switch( ( *it ).type )
				{
				case 0x0001: //profile text encoding
					kDebug(OSCAR_RAW_DEBUG) << "text encoding is " << QString( ( *it ).data );
					break;
				case 0x0002: //profile text
					kDebug(OSCAR_RAW_DEBUG) << "The profile is '" << QString( ( *it ).data ) << "'";
					profile = QString( ( *it ).data ); // aim always seems to use us-ascii encoding
					emit receivedProfile( m_contactSequenceMap[seq], profile );
					break;
				case 0x0003: //away message encoding
					kDebug(OSCAR_RAW_DEBUG) << "Away message encoding is " << QString( ( *it ).data );
					break;
				case 0x0004: //away message
					kDebug(OSCAR_RAW_DEBUG) << "Away message is '" << QString( ( *it ).data ) << "'";
					away = QString( (*it ).data ); // aim always seems to use us-ascii encoding
					emit receivedAwayMessage( m_contactSequenceMap[seq], away );
					break;
				case 0x0005: //capabilities
					break;
				default: //unknown
					kDebug(14151) << "Unknown user info type " << ( *it ).type;
					break;
				};
			}
			list.clear();
		}
		setTransfer( 0 );
		return true;
	}
	return false;
}
bool ICBMParamsTask::take( Transfer* transfer )
{
	if ( forMe( transfer ) )
	{
		setTransfer( transfer );
		handleICBMParameters();
		setTransfer( 0 );
		return true;
	}
	return false;
}
bool ATLSubscriber::notifyRsrcStatus(Notification &notification)
{
    bool notify = forMe(notification);

    if (notify) {
        switch(notification.rsrcStatus)
        {
        case RSRC_UNSUBSCRIBE:
        case RSRC_RELEASED:
            ((LocApiAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
            break;
        case RSRC_DENIED:
        {
#ifdef FEATURE_IPV6
            AGpsType type = mBackwardCompatibleMode ?
                              AGPS_TYPE_INVALID : mStateMachine->getType();
            ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
                                            (char*)mStateMachine->getAPN(),
                                            mStateMachine->getBearer(),
                                            type);
#else
            AGpsType type = mStateMachine->getType();
            ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
                                            (char*)mStateMachine->getAPN(),
                                            type);
#endif
        }
            break;
        case RSRC_GRANTED:
        {
#ifdef FEATURE_IPV6
            AGpsType type = mBackwardCompatibleMode ?
                              AGPS_TYPE_INVALID : mStateMachine->getType();
            ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
                                            (char*)mStateMachine->getAPN(),
                                            mStateMachine->getBearer(),
                                            type);
#else
            AGpsType type = mStateMachine->getType();
            ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
                                            (char*)mStateMachine->getAPN(),
                                            type);
#endif
        }
            break;
        default:
            notify = false;
        }
    }

    return notify;
}
Example #9
0
bool YABTask::take( Transfer* transfer )
{
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
	
	if ( !forMe( transfer ) )
		return false;

	YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer);
	
	if( t->service() == Yahoo::ServiceContactDetails )
		parseContactDetails( t );
	
	return true;
}
Example #10
0
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 );
	parseStealthList( t );

	return true;
}
Example #11
0
bool RequestTask::take( Transfer * transfer )
{
	if ( forMe( transfer ) )
	{
		client()->debug( "RequestTask::take() - Default take() Accepting transaction ack, taking no further action" );
		Response * response = dynamic_cast<Response *>( transfer );
		if ( response->resultCode() == GroupWise::None )
			setSuccess();
		else
			setError( response->resultCode() );
		return true;
	}
	else
		return false;
}
bool OfflineMessagesTask::take( Transfer* t )
{
	if ( forMe( t ) )
	{
		setTransfer( t );
		
		if ( requestType() == 0x0041 ) // Offline message
			handleOfflineMessage();
		else if ( requestType() == 0x0042 ) // end-of-offline messages
			endOfMessages();
			
		setTransfer( 0 );
		return true;
	}
	return false;
}
bool ModifyContactListTask::take( Transfer * transfer )
{
	if ( !forMe( transfer ) )
		return false;
	Response * response = dynamic_cast<Response *>( transfer );
	if ( !response )
		return false;
	client()->debug( "ModifyContactListTask::take()" );

	// scan the contact list received
	// emit each add and delete as a signal
	Field::FieldList fl = response->fields();
	fl.dump( true );
	Field::FieldListIterator it = fl.begin();
	Field::FieldListIterator end = fl.end();
	Field::MultiField * current = fl.findMultiField( NM_A_FA_RESULTS );
	if ( current )
		fl = current->fields();
	current = fl.findMultiField( NM_A_FA_CONTACT_LIST );
	if ( current )
	{
		Field::FieldList contactList = current->fields();
		Field::FieldListIterator cursor = contactList.begin();
		const Field::FieldListIterator end = contactList.end();
		while ( cursor != end )
		{
			Field::MultiField * mf = dynamic_cast< Field::MultiField * >( *cursor );
			if ( mf->tag() == NM_A_FA_CONTACT )
			{
				// contact change
				processContactChange( mf );
			}
			else if ( mf->tag() == NM_A_FA_FOLDER )
			{
				// folder change
				processFolderChange( mf );
			}
			++cursor;
		}
	}
	// TODO: call virtual here to read any fields after the contact list...
	if ( response->resultCode() == GroupWise::None )
		setSuccess();
	else 
		setError( response->resultCode() );
	return true;
}
bool MessageReceiverTask::take( Transfer* transfer )
{
	if ( !forMe( transfer ) )
		return false;

	YMSGTransfer *t = 0L;
	t = dynamic_cast<YMSGTransfer*>(transfer);
	if (!t)
		return false;

	if( t->service() == Yahoo::ServiceNotify )
		parseNotify( t );
	else
		parseMessage( t );

	return true;
}
bool DSSubscriber::notifyRsrcStatus(Notification &notification)
{
    bool notify = forMe(notification);
    LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
    if(notify) {
        switch(notification.rsrcStatus) {
        case RSRC_UNSUBSCRIBE:
        case RSRC_RELEASED:
        case RSRC_DENIED:
        case RSRC_GRANTED:
            ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
            break;
        default:
            notify = false;
        }
    }
    return notify;
}
Example #16
0
bool ErrorTask::take( Transfer* transfer )
{
	if ( forMe( transfer ) )
	{
		Buffer* buffer = transfer->buffer();
		//get the error code
		kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Error code is " << buffer->getWord() << endl;
		TLV t = buffer->getTLV();
		if ( t.type == 0x0008 && t.length > 0 )
		{
			kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "TLV error subcode is " 
					<< t.data << endl;
		}
		return true;
	}
	else 
		return false;
}
bool ConferenceTask::take( Transfer* transfer )
{
	if ( !forMe( transfer ) )
		return false;

	YMSGTransfer *t = 0L;
	t = static_cast<YMSGTransfer*>(transfer);

 	if( t->service() == Yahoo::ServiceConfInvite ||
		t->service() == Yahoo::ServiceConfAddInvite)
 		parseInvitation( t );
	else if( t->service() == Yahoo::ServiceConfMsg )
		parseMessage( t );
	else if( t->service() == Yahoo::ServiceConfLogon )
		parseUserJoined( t );
	else if( t->service() == Yahoo::ServiceConfLogoff )
		parseUserLeft( t );
	else if( t->service() == Yahoo::ServiceConfDecline )
		parseUserDeclined( t );

	return true;
}