summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-07 17:08:24 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-07 17:08:24 +0300
commitc970f5a11e85c4efe5a27783c7c8d994c55daf8b (patch)
treefa8c6aa5c7de40f9066ea022bb136e96e262daae /protocols/Tox/src
parentb13f39a263e1969ec35006daf8f1f5cb4fb924b3 (diff)
fix for old PROTO_INTERFACE::FileResume interface error
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/tox_proto.cpp2
-rw-r--r--protocols/Tox/src/tox_proto.h22
-rw-r--r--protocols/Tox/src/tox_transfer.cpp18
3 files changed, 18 insertions, 24 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 62d7e3194a..c6ad418329 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -126,7 +126,7 @@ int CToxProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t*)
return FileCancel(hContact, hTransfer);
}
-int CToxProto::FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename)
+int CToxProto::FileResume(HANDLE hTransfer, int action, const wchar_t *szFilename)
{
if (hTransfer == nullptr) // file resume canceled
return 1;
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h
index 8b357a0dce..f78985f42b 100644
--- a/protocols/Tox/src/tox_proto.h
+++ b/protocols/Tox/src/tox_proto.h
@@ -19,30 +19,30 @@ public:
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
- MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
+ MCONTACT AddToList(int flags, PROTOSEARCHRESULT *psr) override;
int Authorize(MEVENT hDbEvent) override;
- int AuthRecv(MCONTACT hContact, PROTORECVEVENT*) override;
- int AuthRequest(MCONTACT hContact, const wchar_t* szMessage) override;
+ int AuthRecv(MCONTACT hContact, PROTORECVEVENT *) override;
+ int AuthRequest(MCONTACT hContact, const wchar_t *szMessage) override;
- HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszPath) override;
+ HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath) override;
int FileCancel(MCONTACT hContact, HANDLE hTransfer) override;
- int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszReason) override;
- int FileResume(HANDLE hTransfer, int* action, const wchar_t** tszFilename) override;
+ int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszReason) override;
+ int FileResume(HANDLE hTransfer, int action, const wchar_t *tszFilename) override;
INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
-
+
HWND SearchAdvanced(HWND owner) override;
HWND CreateExtendedSearchUI(HWND owner) override;
- int SendMsg(MCONTACT hContact, int flags, const char* msg) override;
+ int SendMsg(MCONTACT hContact, int flags, const char *msg) override;
- HANDLE SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles) override;
+ HANDLE SendFile(MCONTACT hContact, const wchar_t *, wchar_t **ppszFiles) override;
int SetStatus(int iNewStatus) override;
HANDLE GetAwayMsg(MCONTACT hContact) override;
- int SetAwayMsg(int iStatus, const wchar_t* msg) override;
+ int SetAwayMsg(int iStatus, const wchar_t *msg) override;
int UserIsTyping(MCONTACT hContact, int type) override;
@@ -195,7 +195,7 @@ private:
// transfer
HANDLE OnFileAllow(Tox *tox, MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath);
- int OnFileResume(Tox *tox, HANDLE hTransfer, int *action, const wchar_t **szFilename);
+ int OnFileResume(Tox *tox, HANDLE hTransfer, int action, const wchar_t *szFilename);
HANDLE OnSendFile(Tox *tox, MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles);
int CancelTransfer(MCONTACT hContact, HANDLE hTransfer);
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index 659b8d9e2e..ea914bed8d 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -81,32 +81,26 @@ HANDLE CToxProto::OnFileAllow(Tox *tox, MCONTACT hContact, HANDLE hTransfer, con
mir_snwprintf(fullPath, L"%s\\%s", transfer->pfts.szWorkingDir.w, transfer->pfts.szCurrentFile.w);
transfer->ChangeName(fullPath);
- if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts)) {
- int action = FILERESUME_OVERWRITE;
- const wchar_t **szFilename = (const wchar_t**)mir_alloc(sizeof(wchar_t*) * 2);
- szFilename[0] = fullPath;
- szFilename[1] = nullptr;
- OnFileResume(tox, hTransfer, &action, szFilename);
- mir_free(szFilename);
- }
+ if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
+ OnFileResume(tox, hTransfer, FILERESUME_OVERWRITE, fullPath);
return hTransfer;
}
// if file is exists
-int CToxProto::OnFileResume(Tox *tox, HANDLE hTransfer, int *action, const wchar_t **szFilename)
+int CToxProto::OnFileResume(Tox *tox, HANDLE hTransfer, int action, const wchar_t *szFilename)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- if (*action == FILERESUME_SKIP) {
+ if (action == FILERESUME_SKIP) {
tox_file_control(tox, transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)transfer, 0);
transfers.Remove(transfer);
return 0;
}
- if (*action == FILERESUME_RENAME)
- transfer->ChangeName(*szFilename);
+ if (action == FILERESUME_RENAME)
+ transfer->ChangeName(szFilename);
ToxHexAddress pubKey = GetContactPublicKey(tox, transfer->friendNumber);