summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_avatars.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-07 21:20:18 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-07 21:20:18 +0000
commit8726be3602d129ce335752d5fe036c6872d695a6 (patch)
tree1c8542047a18e8717af45b939ecc327bca7c6e0f /protocols/Tox/src/tox_avatars.cpp
parent71217fff8d304b8047742e1f8f4612329a2f6044 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@13482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_avatars.cpp')
-rw-r--r--protocols/Tox/src/tox_avatars.cpp34
1 files changed, 17 insertions, 17 deletions
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)