summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-05 13:31:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-05 13:31:16 +0300
commitcfc04a114e5d83318f26e0641cfd36ed26736196 (patch)
treee1fd9a268f717e6e6d3e2fb861ecf29407bdd94f /protocols/ICQ-WIM
parentbfa8abda6dc3b9eef08d9c1da2d512a8bcc4132a (diff)
fixes #2390 (ICQ игнорирует настройки приёма файлов)
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp13
-rw-r--r--protocols/ICQ-WIM/src/proto.h2
-rw-r--r--protocols/ICQ-WIM/src/server.cpp11
3 files changed, 23 insertions, 3 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 3fc7005795..3aaba62d5c 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -431,6 +431,19 @@ int CIcqProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
return 0;
}
+int CIcqProto::FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename)
+{
+ auto *ft = (IcqFileTransfer *)hTransfer;
+ if (!m_bOnline || ft == nullptr)
+ return 1;
+
+ if (*action == FILERESUME_RENAME) {
+ ft->m_wszFileName = *szFilename;
+ ft->pfts.szCurrentFile.w = ft->m_wszFileName.GetBuffer();
+ }
+ return 0;
+}
+
////////////////////////////////////////////////////////////////////////////////////////
// GetCaps - return protocol capabilities bits
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 0542497ee4..34f8ab8321 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -171,6 +171,7 @@ struct IcqFileTransfer : public MZeroedObject
CMStringW m_wszFileName, m_wszDescr;
const wchar_t *m_wszShortName;
PROTOFILETRANSFERSTATUS pfts;
+ HANDLE hWaitEvent;
void FillHeaders(AsyncHttpRequest *pReq)
{
@@ -412,6 +413,7 @@ class CIcqProto : public PROTO<CIcqProto>
HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath) override;
int FileCancel(MCONTACT hContact, HANDLE hTransfer) override;
+ int FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;
int SendMsg(MCONTACT hContact, int flags, const char *msg) override;
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 6f37950339..29528b9af1 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -865,9 +865,10 @@ LBL_Error:
return;
}
- ft->pfts.totalProgress += pReply->dataLength;
- ft->pfts.currentFileProgress += pReply->dataLength;
- ProtoBroadcastAck(ft->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
+ ft->hWaitEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ProtoBroadcastAck(ft->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->pfts))
+ WaitForSingleObject(ft->hWaitEvent, INFINITE);
+ CloseHandle(ft->hWaitEvent);
debugLogW(L"Saving to [%s]", ft->pfts.szCurrentFile.w);
int fileId = _wopen(ft->pfts.szCurrentFile.w, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
@@ -883,6 +884,10 @@ LBL_Error:
goto LBL_Error;
}
+ ft->pfts.totalProgress += pReply->dataLength;
+ ft->pfts.currentFileProgress += pReply->dataLength;
+ ProtoBroadcastAck(ft->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
+
ProtoBroadcastAck(ft->pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
delete ft;
}