summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-16 17:55:46 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-16 17:55:46 +0000
commit8afb55f81f38daef246b9cdb82b680ef8538881d (patch)
tree7b3ae6624fd0c3e348509cebefd67bdb30cb1149 /protocols
parent958e8345292ae34336abf0722c82ede2692e9bf4 (diff)
Tox: setting direction flag of transfer
git-svn-id: http://svn.miranda-ng.org/main/trunk@13629 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/src/tox_avatars.cpp5
-rw-r--r--protocols/Tox/src/tox_contacts.cpp14
-rw-r--r--protocols/Tox/src/tox_transfer.cpp3
3 files changed, 10 insertions, 12 deletions
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index 40854b3b83..d93f62584a 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -87,6 +87,7 @@ void CToxProto::SetToxAvatar(std::tstring path, bool checkHash)
}
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
transfer->hFile = _tfopen(path.c_str(), L"rb");
@@ -131,8 +132,8 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam)
{
PROTO_AVATAR_INFORMATIONW *pai = (PROTO_AVATAR_INFORMATIONW *)lParam;
- ptrA id(getStringA(pai->hContact, TOX_SETTINGS_ID));
- if (id != NULL)
+ ptrA address(getStringA(pai->hContact, TOX_SETTINGS_ID));
+ if (address != NULL)
{
std::tstring path = GetAvatarFilePath(pai->hContact);
if (IsFileExists(path))
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 0e458c5e1a..95491995a1 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -331,7 +331,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
proto->delSetting(hContact, "Grant");
// resume transfers
- /*for (size_t i = 0; i < proto->transfers.Count(); i++)
+ for (size_t i = 0; i < proto->transfers.Count(); i++)
{
// only for receiving
FileTransferParam *transfer = proto->transfers.GetAt(i);
@@ -342,10 +342,10 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
if (!tox_file_control(proto->tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error))
{
proto->debugLogA(__FUNCTION__": failed to resume the transfer (%d)", error);
- tox_file_control(proto->tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, NULL);
+ tox_file_control(proto->tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, NULL);
}
}
- }*/
+ }
// update avatar
std::tstring avatarPath = proto->GetAvatarFilePath();
@@ -379,6 +379,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
}
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, NULL, length);
+ transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
transfer->hFile = hFile;
@@ -391,13 +392,6 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
{
proto->SetContactStatus(hContact, ID_STATUS_OFFLINE);
proto->setDword(hContact, "LastEventDateTS", time(NULL));
-
- /*for (size_t i = 0; i < proto->transfers.Count(); i++)
- {
- FileTransferParam *transfer = proto->transfers.GetAt(i);
- if (transfer->friendNumber == friendNumber)
- transfer->status = BROKEN;
- }*/
}
}
}
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index 5a1844383b..631705a6da 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -19,6 +19,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
mir_sntprintf(avatarName, MAX_PATH, _T("%s.png"), address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
+ transfer->pfts.flags |= PFTS_RECEIVING;
transfer->pfts.hContact = hContact;
proto->transfers.Add(transfer);
@@ -41,6 +42,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
TCHAR *name = mir_utf8decodeT(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
+ transfer->pfts.flags |= PFTS_RECEIVING;
transfer->pfts.hContact = hContact;
proto->transfers.Add(transfer);
@@ -220,6 +222,7 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const PROTOCHAR*, PROTOCHAR **pp
}
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, fileName, fileSize);
+ transfer->pfts.flags |= PFTS_SENDING;
transfer->pfts.hContact = hContact;
transfer->pfts.tszWorkingDir = fileDir;
transfer->hFile = hFile;