From 403de4add1193c54e6b4387485fd8eab0c3c00bb Mon Sep 17 00:00:00 2001 From: aunsane Date: Thu, 2 Mar 2017 22:45:54 +0300 Subject: Tox: more logs to #720 --- protocols/Tox/src/tox_avatars.cpp | 4 ++++ protocols/Tox/src/tox_contacts.cpp | 5 +++++ protocols/Tox/src/tox_transfer.cpp | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 76b59165c1..3c3bcbaaeb 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -82,6 +82,8 @@ void CToxProto::SetToxAvatar(const wchar_t* path) return; } + debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber); + TOX_ERR_FILE_SEND error; uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error); if (error != TOX_ERR_FILE_SEND_OK) @@ -184,6 +186,8 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) if (friendNumber == UINT32_MAX) continue; + debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber); + TOX_ERR_FILE_SEND error; tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error); if (error != TOX_ERR_FILE_SEND_OK) diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index d24da12812..a10fd03925 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -357,6 +357,8 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE db_free(&dbv); } + proto->debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber); + TOX_ERR_FILE_SEND error; uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error); if (error != TOX_ERR_FILE_SEND_OK) @@ -374,7 +376,10 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE proto->transfers.Add(transfer); } else + { + proto->debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber); tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, NULL); + } } int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index b66ad34d13..a85dcccc2e 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -255,9 +255,10 @@ void CToxProto::OnFileSendData(Tox*, uint32_t friendNumber, uint32_t fileNumber, ToxHexAddress pubKey = proto->GetContactPublicKey(friendNumber); FileTransferParam *transfer = proto->transfers.Get(friendNumber, fileNumber); - if (transfer == NULL) + if (!transfer) { proto->debugLogA(__FUNCTION__": failed to find transfer (%d) to %s(%d)", fileNumber, (const char*)pubKey, friendNumber); + tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, NULL); return; } -- cgit v1.2.3