diff options
author | George Hazan <ghazan@miranda.im> | 2020-03-22 14:20:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-03-22 14:20:52 +0300 |
commit | 93b3a77b2590443e2b1e868b96196175f99180b9 (patch) | |
tree | 70601e77b9f6f7256721967eed0be10b598ad2e4 /plugins/Scriver/src | |
parent | bb0498bf6aa0accd22bbc19091a12d54602a52be (diff) |
File transfers:
- fixes #2274 (StdMsg & Scriver cannot send files to offline contacts even if their protocol allows that to do);
- all copies of AddToFileList in all plugins removed;
- ProcessFileDrop() function introduced to handle all file drop operations in all SRMM plugins & contact list
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 1d4055b22a..f119bc4458 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -91,28 +91,6 @@ static wchar_t* GetQuotedTextW(wchar_t *text) return out;
}
-static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* szFilename)
-{
- *pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*));
- (*pppFiles)[*totalCount] = nullptr;
- (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
-
- if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
- WIN32_FIND_DATA fd;
- wchar_t szPath[MAX_PATH];
- mir_snwprintf(szPath, L"%s\\*", szFilename);
- HANDLE hFind = FindFirstFile(szPath, &fd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue;
- mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
- AddToFileList(pppFiles, totalCount, szPath);
- } while (FindNextFile(hFind, &fd));
- FindClose(hFind);
- }
- }
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
@@ -981,7 +959,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) if (OpenClipboard(m_message.GetHwnd())) {
HANDLE hDrop = GetClipboardData(CF_HDROP);
if (hDrop)
- SendMessage(m_hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
+ ProcessFileDrop((HDROP)hDrop, m_hContact);
CloseClipboard();
}
return 0;
@@ -989,7 +967,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DROPFILES:
- SendMessage(m_hwnd, WM_DROPFILES, wParam, lParam);
+ ProcessFileDrop((HDROP)wParam, m_hContact);
return 0;
case WM_CONTEXTMENU:
@@ -1117,22 +1095,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DROPFILES:
- if (m_szProto == nullptr) break;
- if (!(CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
- if (m_wStatus == ID_STATUS_OFFLINE) break;
- if (m_hContact != 0) {
- wchar_t szFilename[MAX_PATH];
- HDROP hDrop = (HDROP)wParam;
- int fileCount = DragQueryFile(hDrop, -1, nullptr, 0), totalCount = 0, i;
- wchar_t** ppFiles = nullptr;
- for (i = 0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
- AddToFileList(&ppFiles, &totalCount, szFilename);
- }
- CallServiceSync(MS_FILE_SENDSPECIFICFILEST, m_hContact, (LPARAM)ppFiles);
- for (i = 0; ppFiles[i]; i++) mir_free(ppFiles[i]);
- mir_free(ppFiles);
- }
+ ProcessFileDrop((HDROP)wParam, m_hContact);
break;
case DM_AVATARCHANGED:
|