summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_avatars.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-13 11:24:22 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-13 11:24:22 +0000
commit6647f383bff7d38db530c623caae63d1f50cbc71 (patch)
tree8c18f355e4567e28054187b83d4d789db71a4e35 /protocols/Tox/src/tox_avatars.cpp
parent1ab25705c372fc7436a49723b8db0e59fc0de6c0 (diff)
Tox:
- fixed incoming message encoding - added support "force ANSI" flag (please, don't use it) git-svn-id: http://svn.miranda-ng.org/main/trunk@12782 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_avatars.cpp')
-rw-r--r--protocols/Tox/src/tox_avatars.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index fb37813e26..1d9859f146 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -7,23 +7,15 @@ std::tstring CToxProto::GetAvatarFilePath(MCONTACT hContact)
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- {
CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- }
ptrT id(getTStringA(hContact, TOX_SETTINGS_ID));
if (hContact != NULL)
- {
mir_sntprintf(path, MAX_PATH, _T("%s\\%s.png"), path, id);
- }
else if (id != NULL)
- {
mir_sntprintf(path, MAX_PATH, _T("%s\\%s avatar.png"), path, id);
- }
else
- {
return _T("");
- }
return path;
}
@@ -40,7 +32,7 @@ void CToxProto::SetToxAvatar(std::tstring path, bool checkHash)
fseek(hFile, 0, SEEK_END);
size_t length = ftell(hFile);
rewind(hFile);
- if (length > 1024 * 1024)
+ if (length > TOX_MAX_AVATAR_SIZE)
{
fclose(hFile);
debugLogA(__FUNCTION__": new avatar size is excessive");
@@ -102,9 +94,7 @@ void CToxProto::SetToxAvatar(std::tstring path, bool checkHash)
mir_free(data);
if (checkHash)
- {
db_set_blob(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, (void*)hash, TOX_HASH_LENGTH);
- }
}
INT_PTR CToxProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam)
@@ -129,7 +119,7 @@ INT_PTR CToxProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam)
return lParam == PA_FORMAT_PNG;
case AF_MAXFILESIZE:
- return 1024 * 1024;
+ return TOX_MAX_AVATAR_SIZE;
}
return 0;