void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kDebug(OSCAR_ICQ_DEBUG) << contact; //if they don't have an SSI alias, make sure we use the capitalization from the //server so their contact id looks all pretty. QString nickname = property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if ( nickname.isEmpty() || Oscar::normalize( nickname ) == Oscar::normalize( contact ) ) setNickName( contact ); kDebug( OSCAR_ICQ_DEBUG ) << "extendedStatus is " << details.extendedStatus(); Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); setPresenceTarget( presence ); m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); setAwayMessage( details.personalMessage() ); if ( presence.type() != Oscar::Presence::Online && m_details.awaySinceTime() < details.awaySinceTime() ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); } OscarContact::userInfoUpdated( contact, details ); }
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; }
void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kDebug(OSCAR_ICQ_DEBUG) << contact; setNickName( contact ); kDebug( OSCAR_ICQ_DEBUG ) << "extendedStatus is " << details.extendedStatus(); Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); setPresenceTarget( presence ); m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); setAwayMessage( details.personalMessage() ); if ( presence.type() != Oscar::Presence::Online && m_details.awaySinceTime() < details.awaySinceTime() ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); } OscarContact::userInfoUpdated( contact, details ); }
void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << contact << endl; //if they don't have an SSI alias, make sure we use the capitalization from the //server so their contact id looks all pretty. QString nickname = property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if ( nickname.isEmpty() || Oscar::normalize( nickname ) == Oscar::normalize( contact ) ) setNickName( contact ); ( details.userClass() & CLASS_WIRELESS ) ? m_mobile = true : m_mobile = false; if ( ( details.userClass() & CLASS_AWAY ) == STATUS_ONLINE ) { if ( m_mobile ) { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is mobile-online." << endl; setOnlineStatus( mProtocol->statusWirelessOnline ); } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is online." << endl; setOnlineStatus( mProtocol->statusOnline ); //we're online } removeProperty( mProtocol->awayMessage ); m_haveAwayMessage = false; } else if ( ( details.userClass() & CLASS_AWAY ) ) // STATUS_AWAY { if ( m_mobile ) { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is mobile-away." << endl; setOnlineStatus( mProtocol->statusWirelessOnline ); } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is away." << endl; setOnlineStatus( mProtocol->statusAway ); //we're away } if ( !m_haveAwayMessage ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); m_haveAwayMessage = true; } } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " class " << details.userClass() << " is unhandled... defaulting to away." << endl; setOnlineStatus( mProtocol->statusAway ); //we're away if ( !m_haveAwayMessage ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); m_haveAwayMessage = true; } } if ( details.buddyIconHash().size() > 0 && details.buddyIconHash() != m_details.buddyIconHash() ) { if ( !mAccount->engine()->hasIconConnection() ) mAccount->engine()->requestServerRedirect( 0x0010 ); int time = ( KApplication::random() % 10 ) * 1000; kdDebug(OSCAR_ICQ_DEBUG) << k_funcinfo << "updating buddy icon in " << time/1000 << " seconds" << endl; QTimer::singleShot( time, this, SLOT( requestBuddyIcon() ) ); } OscarContact::userInfoUpdated( contact, details ); }
bool OwnUserInfoTask::take( Transfer* transfer ) { if ( forMe( transfer ) ) { SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer ); if ( !st ) return false; Buffer* b = transfer->buffer(); if ( st->snacSubtype() == 0x0F ) { UserDetails ud; ud.fill( b ); m_details = ud; emit gotInfo(); setSuccess( 0, QString() ); return true; } else { bool needUpload = false; Oscar::WORD infoType = b->getWord(); if ( infoType == 0x0000 || infoType == 0x0001 ) { Oscar::BYTE flags = b->getByte(); if ( flags == 0x41 ) //we need to do a buddy upload when bit 8 = 1 needUpload = true; QByteArray qba; if ( b->bytesAvailable() != 0 ) { //buffer might be empty if flags bit 8 = 1 Oscar::BYTE checksumLength = b->getByte(); qba = b->getBlock( checksumLength ); kDebug(OSCAR_RAW_DEBUG) << "Self icon checksum: " << qba.toHex(); } if ( needUpload ) { kDebug(OSCAR_RAW_DEBUG) << "Buddy icon upload requested"; emit buddyIconUploadRequested(); } else { kDebug(OSCAR_RAW_DEBUG) << "no item for hash found"; } } if ( infoType == 0x0002 ) { QString availableMsg( b->getBSTR() ); kDebug(OSCAR_RAW_DEBUG) << "self available message: "; } setSuccess( 0, QString() ); return true; } } return false; }
void Client::receivedInfo( Q_UINT16 sequence ) { UserDetails details = d->userInfoTask->getInfoFor( sequence ); emit receivedUserInfo( details.userId(), details ); }