diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-12-10 01:24:17 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-12-10 01:24:17 +0100 |
commit | 91ba38a1df42b56caa73babc90ffa4f674c000d4 (patch) | |
tree | cb65a7a13ac72de8a4ef610424da9195edca0a0c /kopete/protocols/oscar/liboscar/buddyicontask.cpp | |
parent | f2553c2ff47de1bcf060f22edd5c23d9cb653bc3 (diff) | |
download | tdenetwork-91ba38a1df42b56caa73babc90ffa4f674c000d4.tar.gz tdenetwork-91ba38a1df42b56caa73babc90ffa4f674c000d4.zip |
kopete: Restore the AIM protocol because a replacement AIM server was created.
This reverts commits 036b0229db and dc34f9c391.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kopete/protocols/oscar/liboscar/buddyicontask.cpp')
-rw-r--r-- | kopete/protocols/oscar/liboscar/buddyicontask.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/kopete/protocols/oscar/liboscar/buddyicontask.cpp b/kopete/protocols/oscar/liboscar/buddyicontask.cpp index 43e3e792..c7661481 100644 --- a/kopete/protocols/oscar/liboscar/buddyicontask.cpp +++ b/kopete/protocols/oscar/liboscar/buddyicontask.cpp @@ -69,7 +69,10 @@ void BuddyIconTask::onGo() if ( m_action == Receive ) { - sendICQBuddyIconRequest(); + if ( client()->isIcq() ) + sendICQBuddyIconRequest(); + else + sendAIMBuddyIconRequest(); } else sendIcon(); @@ -117,6 +120,8 @@ bool BuddyIconTask::take( Transfer* transfer ) setTransfer( transfer ); if ( st->snacSubtype() == 0x0003 ) handleUploadResponse(); + else if ( st->snacSubtype() == 0x0005 ) + handleAIMBuddyIconResponse(); else handleICQBuddyIconResponse(); @@ -152,6 +157,41 @@ 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; |