From 8726be3602d129ce335752d5fe036c6872d695a6 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 7 May 2015 21:20:18 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@13482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_avatars.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'protocols/Tox/src/tox_avatars.cpp') diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 5e9ddacef7..20d7681454 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -216,33 +216,33 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) { - MCONTACT hContact = transfer->pfts.hContact; if (transfer->pfts.totalBytes == 0) { - delSetting(hContact, TOX_SETTINGS_AVATAR_HASH); - ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0); - std::tstring path = GetAvatarFilePath(hContact); + std::tstring path = GetAvatarFilePath(transfer->pfts.hContact); if (IsFileExists(path)) DeleteFile(path.c_str()); - OnFileCancel(hContact, transfer); + + ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0); + delSetting(transfer->pfts.hContact, TOX_SETTINGS_AVATAR_HASH); + transfers.Remove(transfer); + return; } - else + + DBVARIANT dbv; + if (!db_get(transfer->pfts.hContact, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv)) { - DBVARIANT dbv; - if (!db_get(transfer->pfts.hContact, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv)) + if (memcmp(transfer->hash, dbv.pbVal, TOX_HASH_LENGTH) == 0) { - if (memcmp(transfer->hash, dbv.pbVal, TOX_HASH_LENGTH) == 0) - { - db_free(&dbv); - OnFileCancel(hContact, transfer); - return; - } db_free(&dbv); + OnFileCancel(transfer->pfts.hContact, transfer); + return; } - TCHAR path[MAX_PATH]; - mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); - OnFileAllow(hContact, transfer, path); + db_free(&dbv); } + + TCHAR path[MAX_PATH]; + mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); + OnFileAllow(transfer->pfts.hContact, transfer, path); } void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) -- cgit v1.2.3