summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_avatars.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-06 21:10:28 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-06 21:10:28 +0000
commit7bea1db1766147e4294f92c55dc94f247f7ff0e1 (patch)
treebbb3673e3c822be04202841352bb11be3dfd3ee3 /protocols/Tox/src/tox_avatars.cpp
parent28543611a67b88a42e36a26c3cd2fd7f367b40b4 (diff)
Tox: fast fix for contacts avatar changing
git-svn-id: http://svn.miranda-ng.org/main/trunk@13472 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_avatars.cpp')
-rw-r--r--protocols/Tox/src/tox_avatars.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index 643e447853..33bde952d8 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -153,7 +153,7 @@ INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
return -2;
}
- std::tstring path(GetAvatarFilePath());
+ std::tstring path = GetAvatarFilePath();
if (IsFileExists(path))
{
_tcsncpy((TCHAR*)wParam, path.c_str(), (int)lParam);
@@ -218,11 +218,11 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
void CToxProto::OnGotFriendAvatarInfo(FileTransferParam *transfer, const uint8_t *hash)
{
MCONTACT hContact = transfer->pfts.hContact;
- std::tstring path = GetAvatarFilePath();
if (transfer->pfts.totalBytes == 0)
{
delSetting(hContact, TOX_SETTINGS_AVATAR_HASH);
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
+ std::tstring path = GetAvatarFilePath();
if (IsFileExists(path))
{
DeleteFile(path.c_str());
@@ -242,33 +242,8 @@ void CToxProto::OnGotFriendAvatarInfo(FileTransferParam *transfer, const uint8_t
}
db_free(&dbv);
}
- OnFileAllow(hContact, transfer, path.c_str());
+ TCHAR path[MAX_PATH];
+ mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
+ OnFileAllow(hContact, transfer, path);
}
-}
-
-/*void CToxProto::OnGotFriendAvatarData(Tox *, int32_t number, uint8_t, uint8_t *hash, uint8_t *data, uint32_t length, void *arg)
-{
-CToxProto *proto = (CToxProto*)arg;
-
-MCONTACT hContact = proto->GetContact(number);
-if (hContact)
-{
-db_set_blob(hContact, proto->m_szModuleName, TOX_SETTINGS_AVATAR_HASH, hash, TOX_HASH_LENGTH);
-
-std::tstring path = proto->GetAvatarFilePath(hContact);
-FILE *hFile = _tfopen(path.c_str(), L"wb");
-if (hFile)
-{
-if (fwrite(data, sizeof(uint8_t), length, hFile) == length)
-{
-PROTO_AVATAR_INFORMATIONW pai = { sizeof(pai) };
-pai.format = PA_FORMAT_PNG;
-pai.hContact = hContact;
-_tcscpy(pai.filename, path.c_str());
-
-proto->ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
-}
-fclose(hFile);
-}
-}
-}*/ \ No newline at end of file
+} \ No newline at end of file