summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_transfer.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-07 19:15:57 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-07 19:15:57 +0000
commit7e78293fcbabc945a8a9e5bcaab121fbbf697c4c (patch)
tree68a371d8f9b8ca5604ce5359e681f9461a956c71 /protocols/Tox/src/tox_transfer.cpp
parent81c987f5b850447389b2621037a364c3fcb0ba73 (diff)
Tox: fixed avatar work
git-svn-id: http://svn.miranda-ng.org/main/trunk@13480 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_transfer.cpp')
-rw-r--r--protocols/Tox/src/tox_transfer.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index 110b1fc895..90d61a4d87 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -14,13 +14,11 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
{
case TOX_FILE_KIND_AVATAR:
{
- ptrA id(proto->getStringA(hContact, TOX_SETTINGS_ID));
- char avatarName[MAX_PATH];
- mir_snprintf(avatarName, MAX_PATH, "%s.png", id);
- fileName = (const uint8_t*)avatarName;
- filenameLength = mir_strlen(avatarName);
+ ptrT id(proto->getTStringA(hContact, TOX_SETTINGS_ID));
+ TCHAR avatarName[MAX_PATH];
+ mir_sntprintf(avatarName, MAX_PATH, _T("%s.png"), id);
- AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, fileSize);
+ AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
transfer->pfts.hContact = hContact;
proto->transfers.Add(transfer);
@@ -81,9 +79,10 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCH
{
int action = FILERESUME_OVERWRITE;
const TCHAR **szFilename = (const TCHAR**)mir_alloc(sizeof(TCHAR) * 2);
- szFilename[0] = &fullPath[0];
+ szFilename[0] = fullPath;
szFilename[1] = NULL;
OnFileResume(hTransfer, &action, szFilename);
+ //mir_free(szFilename);
}
return hTransfer;
@@ -94,14 +93,14 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const PROTOCHAR **szF
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- if (*action = FILERESUME_SKIP)
+ if (*action == FILERESUME_SKIP)
{
tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
transfers.Remove(transfer);
return 0;
}
- if (*action = FILERESUME_RENAME)
+ if (*action == FILERESUME_RENAME)
transfer->ChangeName(*szFilename);
TCHAR *mode = *action == FILERESUME_OVERWRITE ? _T("wb") : _T("ab");