From 054bb1949247445a29a68812579800904edf6a02 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Dec 2023 20:19:46 +0300 Subject: MS_FILE_* services became useless since StdFile died --- include/delphi/m_api.pas | 1 - include/delphi/m_file.inc | 85 ------------ include/delphi/m_system.inc | 2 + include/m_file.h | 44 ++---- libs/win32/mir_app.lib | Bin 275342 -> 275968 bytes libs/win64/mir_app.lib | Bin 274622 -> 275278 bytes plugins/FileAsMessage/src/dialog.cpp | 2 +- plugins/FloatingContacts/src/filedrop.cpp | 195 +++++++++++++-------------- plugins/HistoryPlusPlus/EventDetailForm.pas | 2 +- plugins/HistoryPlusPlus/GlobalSearch.pas | 2 +- plugins/HistoryPlusPlus/HistoryForm.pas | 2 +- plugins/HistoryPlusPlus/hpp_externalgrid.pas | 2 +- plugins/MenuItemEx/src/main.cpp | 4 +- plugins/NewStory/src/history_array.cpp | 2 +- plugins/QuickContacts/src/dialog.cpp | 2 +- plugins/ShellExt/src/shlcom.cpp | 39 +++--- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgother.cpp | 4 +- protocols/CloudFile/src/cloud_file.cpp | 5 +- protocols/IRCG/src/input.cpp | 9 +- protocols/JabberG/src/jabber_svc.cpp | 2 +- protocols/SkypeWeb/src/skype_utils.cpp | 2 +- src/mir_app/src/file.cpp | 58 +++----- src/mir_app/src/file.h | 10 -- src/mir_app/src/fileopts.cpp | 2 +- src/mir_app/src/filerecvdlg.cpp | 7 +- src/mir_app/src/filesenddlg.cpp | 14 +- src/mir_app/src/mir_app.def | 3 + src/mir_app/src/mir_app64.def | 3 + src/mir_app/src/srmm_util.cpp | 2 +- src/mir_app/src/utils.cpp | 2 +- 31 files changed, 183 insertions(+), 326 deletions(-) delete mode 100644 include/delphi/m_file.inc diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index 38c0b8afc6..08142e8cc8 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -197,7 +197,6 @@ var {$include m_descbutton.inc} {$include m_email.inc} {$include m_extraicons.inc} - {$include m_file.inc} {$include m_findadd.inc} {$include m_fontservice.inc} {$include m_history.inc} diff --git a/include/delphi/m_file.inc b/include/delphi/m_file.inc deleted file mode 100644 index d1eedc31b1..0000000000 --- a/include/delphi/m_file.inc +++ /dev/null @@ -1,85 +0,0 @@ -{ -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -} - -{$IFNDEF M_FILE} -{$DEFINE M_FILE} - -const - { - wParam : TMCONTACT - lParam : 0 - Affects: Brings up the send file dialog for a contact, see notes - Returns: returns file selection dialog's handle or 0 on error - Notes : Returns immediately without waiting for the send - } - MS_FILE_SENDFILE:PAnsiChar = 'SRFile/SendCommand'; - - { - wParam : TMCONTACT - lParam : pointer to an array of PAnsiChar's the first nil item - terminates the list -- see notes - Affects: Brings up the send file dialog with specifieed files already chosen - the user is not prevented from editing the list - Returns: returns file selection dialog's handle or 0 on error - returns immediately without waiting for the send to finish - Notes : both directories and files can be given - Version: v0.1.2.1+ - } - MS_FILE_SENDSPECIFICFILES:PAnsiChar = 'SRFile/SendSpecificFiles'; - -{ - v0.9.0+ - wParam=(WPARAM)(HANDLE)hContact - lParam=(LPARAM)(const TCHAR**)ppFiles - returns file selection dialog's handle or 0 on error - returns immediately, without waiting for the send -} - MS_FILE_SENDSPECIFICFILEST:PAnsiChar = 'SRFile/SendSpecificFilesT'; - - { - wParam : TMCONTACT - lParam : Pointer to a buffer - Affects: returns the received files folder for a contact, the buffer - should be at least MAX_PATH long (defined with WinAPI), - the returned path may not exist -- see notes - Returns: Returns 0 on success [non zero] on failure - notes : If TMCONTACT is NULL(0) the path returned is the path - without the postfix contact name. - Version: v0.1.2.2+ - } - MS_FILE_GETRECEIVEDFILESFOLDER:PAnsiChar = 'SRFile/GetReceivedFilesFolder'; - - { - wParam : TMCONTACT - lParam : file selection dialog's window - Notes : notifies a caller about file send start - } - ME_FILEDLG_SUCCEEDED:PAnsiChar = 'SRFile/Dlg/Succeeded'; - - { - wParam : TMCONTACT - lParam : file selection dialog's window - Notes : notifies a caller about file send cancellation - } - ME_FILEDLG_CANCELED:PAnsiChar = 'SRFile/Dlg/Canceled'; - -{$ENDIF} diff --git a/include/delphi/m_system.inc b/include/delphi/m_system.inc index a554b25a99..11c8732e45 100644 --- a/include/delphi/m_system.inc +++ b/include/delphi/m_system.inc @@ -76,4 +76,6 @@ const function Miranda_IsTerminated : bytebool; stdcall; external AppDll; +procedure GetFileReceivedFolder(hContact:TMCONTACT; szFolder:PWideChar); external AppDll; + {$ENDIF} diff --git a/include/m_file.h b/include/m_file.h index 9e616a57d6..abaecd9ece 100644 --- a/include/m_file.h +++ b/include/m_file.h @@ -25,42 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_FILE_H__ #define M_FILE_H__ 1 -// brings up the send file dialog for a contact -// wParam = (MCONTACT)hContact -// lParam = 0 -// returns file selection dialog's handle or 0 on error -// returns immediately, without waiting for the send -#define MS_FILE_SENDFILE "SRFile/SendCommand" - -// brings up the send file dialog with the specified files already chosen -// returns immediately, without waiting for the send -// wParam = (MCONTACT)hContact -// lParam = (LPARAM)(const char**)ppFiles -// returns file selection dialog's handle or 0 on error -// returns immediately, without waiting for the send -// the user is not prevented from changing the filename with the 'choose again' button -// ppFiles is a NULL-terminated array of fully qualified filenames. -// To send subdirectories, include their name in the list without a trailing -// backslash. In order to keep contained files in their correct place on -// receiving, the subdirectory they're in must preceed the file. This applies -// to subdirectories themselves too: they must be preceeded by their container -// if you want to send the container and keep the original directory inside it. -#define MS_FILE_SENDSPECIFICFILES "SRFile/SendSpecificFiles" - -// wParam = (MCONTACT)hContact -// lParam = (LPARAM)(const wchar_t**)ppFiles -// returns file selection dialog's handle or 0 on error -// returns immediately, without waiting for the send -#define MS_FILE_SENDSPECIFICFILEST "SRFile/SendSpecificFilesT" - -// wParam = (MCONTACT)hContact -// lParam = (LPARAM)(wchar_t *)pszOutput -// returns 0 on success or nonzero on failure -// pszOutput must be at least MAX_PATH characters long -// If hContact is NULL this function will retrieve the received files folder -// name without any appended user names. -// Note that the directory name returned by this function does not necessarily exist. -#define MS_FILE_GETRECEIVEDFILESFOLDER "SRFile/GetReceivedFilesFolder" +namespace File +{ + MIR_APP_DLL(wchar_t *) GetReceivedFolder(MCONTACT hContact, wchar_t *pwszDest, size_t cbDest, bool substVars = true); + + // List of files should be null-terminated + MIR_APP_DLL(MWindow) Send(MCONTACT hContact, wchar_t** const ppFiles = nullptr); + +}; // notifies a caller about file send start // wParam = (MCONTACT)hContact diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 95fab5b818..88d5d82528 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 0a825823ee..63178c0078 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 3301f9607c..60670e4e8c 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -369,7 +369,7 @@ void FILEECHO::incomeRequest(char *param) return; *p++ = 0; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf); + File::GetReceivedFolder(hContact, buf, _countof(buf)); wszFilename = buf; wszFilename.Append(Utf2T(param)); diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index e9f3c97618..05d0c14619 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -static void ProcessDroppedItems(char **ppDroppedItems, int nCount, char **ppFiles); -static int CountDroppedFiles(char **ppDroppedItems, int nCount); static BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb); HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid, LPVOID *ppvObj) @@ -132,159 +130,152 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D return S_OK; } -/////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// // Send files processing -BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) +static void SaveFiles(wchar_t *wszItem, wchar_t **ppFiles, int *pnCount) { - UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); - - char **ppDroppedItems = (char**)malloc(sizeof(char*)*(nDroppedItemsCount + 1)); - - if (ppDroppedItems == nullptr) { - return FALSE; - } - - ppDroppedItems[nDroppedItemsCount] = nullptr; - - char szFilename[MAX_PATH]; - for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) { - DragQueryFileA(hDrop, iItem, szFilename, sizeof(szFilename)); - ppDroppedItems[iItem] = _strdup(szFilename); - } - - UINT nFilesCount = CountDroppedFiles(ppDroppedItems, nDroppedItemsCount); + WIN32_FIND_DATA fd; + HANDLE hFind = FindFirstFileW(wszItem, &fd); - char **ppFiles = (char**)malloc(sizeof(char *)* (nFilesCount + 1)); + if (hFind != INVALID_HANDLE_VALUE) { + do { + if (fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) { + // Skip parent directories + if ((0 != mir_wstrcmp(fd.cFileName, L".")) && + (0 != mir_wstrcmp(fd.cFileName, L".."))) { + wchar_t wszDirName[MAX_PATH]; + wcsncpy(wszDirName, wszItem, MAX_PATH - 1); + + if (nullptr != wcsstr(wszItem, L"*.*")) { + size_t offset = mir_wstrlen(wszDirName) - 3; + mir_snwprintf(wszDirName + offset, _countof(wszDirName) - offset, L"%s\0", fd.cFileName); + } - BOOL bSuccess = FALSE; - if (ppFiles != nullptr) { - ppFiles[nFilesCount] = nullptr; + ppFiles[*pnCount] = _wcsdup(wszDirName); + ++(*pnCount); - ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles); + mir_wstrcat(wszDirName, L"\\*.*"); + SaveFiles(wszDirName, ppFiles, pnCount); - bSuccess = (BOOL)CallService(MS_FILE_SENDSPECIFICFILES, pThumb->hContact, (LPARAM)ppFiles); + } + } + else { + size_t nSize = mir_wstrlen(wszItem) + mir_wstrlen(fd.cFileName) + 1; + wchar_t *wszFile = (wchar_t *)malloc(nSize * sizeof(wchar_t)); - for (UINT iItem = 0; iItem < nFilesCount; ++iItem) - free(ppFiles[iItem]); + wcsncpy(wszFile, wszItem, nSize); - free(ppFiles); - } + if (nullptr != wcsstr(wszFile, L"*.*")) { + wszFile[mir_wstrlen(wszFile) - 3] = '\0'; + mir_wstrncat(wszFile, fd.cFileName, nSize - mir_wstrlen(wszFile)); + } - // Cleanup - for (UINT iItem = 0; ppDroppedItems[iItem]; ++iItem) { - free(ppDroppedItems[iItem]); + ppFiles[*pnCount] = wszFile; + ++(*pnCount); + } + } while (FALSE != FindNextFileW(hFind, &fd)); } +} - free(ppDroppedItems); +static void ProcessDroppedItems(wchar_t **ppDroppedItems, int nCount, wchar_t **ppFiles) +{ + int fileCount = 0; - return bSuccess; + for (int i = 0; i < nCount; ++i) + SaveFiles(ppDroppedItems[i], ppFiles, &fileCount); } +///////////////////////////////////////////////////////////////////////////////////////// -static int CountFiles(char *szItem) +static int CountFiles(wchar_t *wszItem) { int nCount = 0; - WIN32_FIND_DATAA fd; + WIN32_FIND_DATA fd; - HANDLE hFind = FindFirstFileA(szItem, &fd); + HANDLE hFind = FindFirstFileW(wszItem, &fd); if (hFind != INVALID_HANDLE_VALUE) { do { if (fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) { // Skip parent directories - if ((0 != mir_strcmp(fd.cFileName, ".")) && - (0 != mir_strcmp(fd.cFileName, ".."))) { - char szDirName[MAX_PATH]; - strncpy(szDirName, szItem, MAX_PATH - 1); - - if (nullptr != strstr(szItem, "*.*")) { - size_t offset = mir_strlen(szDirName) - 3; - mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); + if ((0 != mir_wstrcmp(fd.cFileName, L".")) && + (0 != mir_wstrcmp(fd.cFileName, L".."))) { + wchar_t szDirName[MAX_PATH]; + wcsncpy(szDirName, wszItem, MAX_PATH - 1); + + if (nullptr != wcsstr(wszItem, L"*.*")) { + size_t offset = mir_wstrlen(szDirName) - 3; + mir_snwprintf(szDirName + offset, _countof(szDirName) - offset, L"%s\0", fd.cFileName); } ++nCount; - mir_strcat(szDirName, "\\*.*"); + mir_wstrcat(szDirName, L"\\*.*"); nCount += CountFiles(szDirName); } } - else { - ++nCount; - } - } while (FALSE != FindNextFileA(hFind, &fd)); + else ++nCount; + } while (FALSE != FindNextFileW(hFind, &fd)); } return nCount; } - - -static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) +static int CountDroppedFiles(wchar_t **ppDroppedItems, int nCount) { - WIN32_FIND_DATAA fd; - HANDLE hFind = FindFirstFileA(szItem, &fd); + int fileCount = 0; - if (hFind != INVALID_HANDLE_VALUE) { - do { - if (fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) { - // Skip parent directories - if ((0 != mir_strcmp(fd.cFileName, ".")) && - (0 != mir_strcmp(fd.cFileName, ".."))) { - char szDirName[MAX_PATH]; - strncpy(szDirName, szItem, MAX_PATH - 1); - - if (nullptr != strstr(szItem, "*.*")) { - size_t offset = mir_strlen(szDirName) - 3; - mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); - } + for (int i = 0; i < nCount; ++i) + fileCount += CountFiles(ppDroppedItems[i]); - ppFiles[*pnCount] = _strdup(szDirName); - ++(*pnCount); + return fileCount; +} - mir_strcat(szDirName, "\\*.*"); - SaveFiles(szDirName, ppFiles, pnCount); +///////////////////////////////////////////////////////////////////////////////////////// - } - } - else { - size_t nSize = sizeof(char) * (mir_strlen(szItem) + mir_strlen(fd.cFileName) + sizeof(char)); - char *szFile = (char*)malloc(nSize); +BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) +{ + UINT nDroppedItemsCount = DragQueryFileW(hDrop, 0xFFFFFFFF, nullptr, 0); - strncpy(szFile, szItem, nSize - 1); + wchar_t **ppDroppedItems = (wchar_t **)malloc(sizeof(wchar_t *)*(nDroppedItemsCount + 1)); + if (ppDroppedItems == nullptr) + return FALSE; - if (nullptr != strstr(szFile, "*.*")) { - szFile[mir_strlen(szFile) - 3] = '\0'; - mir_strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile)); - } + ppDroppedItems[nDroppedItemsCount] = nullptr; - ppFiles[*pnCount] = szFile; - ++(*pnCount); - } - } while (FALSE != FindNextFileA(hFind, &fd)); + wchar_t wszFilename[MAX_PATH]; + for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) { + DragQueryFileW(hDrop, iItem, wszFilename, _countof(wszFilename)); + ppDroppedItems[iItem] = _wcsdup(wszFilename); } -} + UINT nFilesCount = CountDroppedFiles(ppDroppedItems, nDroppedItemsCount); -static void ProcessDroppedItems(char **ppDroppedItems, int nCount, char **ppFiles) -{ - int fileCount = 0; + wchar_t **ppFiles = (wchar_t **)malloc(sizeof(wchar_t *)* (nFilesCount + 1)); - for (int i = 0; i < nCount; ++i) - SaveFiles(ppDroppedItems[i], ppFiles, &fileCount); -} + BOOL bSuccess = FALSE; + if (ppFiles != nullptr) { + ppFiles[nFilesCount] = nullptr; + ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles); -static int CountDroppedFiles(char **ppDroppedItems, int nCount) -{ - int fileCount = 0; + bSuccess = File::Send(pThumb->hContact, ppFiles) != 0; - for (int i = 0; i < nCount; ++i) { - fileCount += CountFiles(ppDroppedItems[i]); + for (UINT iItem = 0; iItem < nFilesCount; ++iItem) + free(ppFiles[iItem]); + + free(ppFiles); } - return fileCount; -} + // Cleanup + for (UINT iItem = 0; ppDroppedItems[iItem]; ++iItem) { + free(ppDroppedItems[iItem]); + } + + free(ppDroppedItems); + return bSuccess; +} /////////////////////////////////////////////////////////////////////////////// // Init/destroy diff --git a/plugins/HistoryPlusPlus/EventDetailForm.pas b/plugins/HistoryPlusPlus/EventDetailForm.pas index 06bffc478d..9e9029cc9c 100644 --- a/plugins/HistoryPlusPlus/EventDetailForm.pas +++ b/plugins/HistoryPlusPlus/EventDetailForm.pas @@ -678,7 +678,7 @@ procedure TEventDetailsFrm.BrowseReceivedFilesClick(Sender: TObject); var Path: Array [0 .. MAX_PATH] of WideChar; begin - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, FParentForm.hContact, LPARAM(@Path)); + GetFileReceivedFolder(FParentForm.hContact, @Path); ShellExecuteW(0, 'open', Path, nil, nil, SW_SHOW); end; diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas index b7cafc091e..ffc955e3b3 100644 --- a/plugins/HistoryPlusPlus/GlobalSearch.pas +++ b/plugins/HistoryPlusPlus/GlobalSearch.pas @@ -2454,7 +2454,7 @@ var hContact: THandle; begin hContact := GetSearchItem(hg.Selected).Contact.Handle; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, LParam(@Path)); + GetFileReceivedFolder(hContact, @Path); ShellExecuteW(0, 'open', Path, nil, nil, SW_SHOW); end; diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index ad1bc32035..b61f0f0827 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -3798,7 +3798,7 @@ procedure THistoryFrm.BrowseReceivedFilesClick(Sender: TObject); var Path: Array [0 .. MAX_PATH] of WideChar; begin - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, lParam(@Path)); + GetFileReceivedFolder(hContact, @Path); ShellExecuteW(0, 'open', Path, nil, nil, SW_SHOW); end; diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 197b91db89..5651b3d57e 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -1333,7 +1333,7 @@ var begin if Grid.Selected = -1 then exit; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, Items[Grid.Selected].hContact,LParam(@Path)); + GetFileReceivedFolder(Items[Grid.Selected].hContact, @Path); ShellExecuteW(0, 'open', Path, nil, nil, SW_SHOW); end; diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 1ba2c38e31..fdca3118e8 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -207,7 +207,7 @@ static void ShowPopup(const wchar_t *pwszText, MCONTACT hContact) BOOL DirectoryExists(MCONTACT hContact) { wchar_t path[MAX_PATH]; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)&path); + File::GetReceivedFolder(hContact, path, _countof(path)); uint32_t attr = GetFileAttributesW(path); return (attr != -1) && (attr & FILE_ATTRIBUTE_DIRECTORY); } @@ -542,7 +542,7 @@ static INT_PTR OpenIgnoreOptions(WPARAM, LPARAM) static INT_PTR onRecvFiles(WPARAM hContact, LPARAM) { wchar_t path[MAX_PATH]; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)&path); + File::GetReceivedFolder(hContact, path, _countof(path)); ShellExecuteW(nullptr, L"open", path, nullptr, nullptr, SW_SHOW); return 0; } diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 22feefbb07..30ce49af66 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -415,7 +415,7 @@ void ItemData::load(bool bFullLoad) } wchar_t buf[MAX_PATH]; - CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf); + File::GetReceivedFolder(hContact, buf, _countof(buf)); CMStringW wszFileName = buf; wszFileName.Append(blob.getName()); diff --git a/plugins/QuickContacts/src/dialog.cpp b/plugins/QuickContacts/src/dialog.cpp index f52297f4cb..16e01c4b80 100644 --- a/plugins/QuickContacts/src/dialog.cpp +++ b/plugins/QuickContacts/src/dialog.cpp @@ -590,7 +590,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILE))) break; - CallService(MS_FILE_SENDFILE, hContact, 0); + File::Send(hContact); g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 96420df8e2..ee707d0da8 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -58,20 +58,20 @@ char* CreateProcessUID(int pid, char* buf, size_t bufLen) struct TAddArgList { - LPSTR szFile; // file being processed + LPWSTR szFile; // file being processed int cch; // it's length (with space for NULL char) int count; // number we have so far - LPSTR* files; + LPWSTR* files; MCONTACT hContact; HANDLE hEvent; }; BOOL AddToList(TAddArgList& args) { - char szBuf[MAX_PATH]; - LPSTR szThis; + wchar_t szBuf[MAX_PATH]; + LPWSTR szThis; - uint32_t attr = GetFileAttributesA(args.szFile); + uint32_t attr = GetFileAttributesW(args.szFile); if (attr != 0xFFFFFFFF && (attr & FILE_ATTRIBUTE_HIDDEN) == 0) { if ((args.count % 10) == 5) if (Miranda_IsTerminated() != 0) @@ -79,23 +79,23 @@ BOOL AddToList(TAddArgList& args) if (attr & FILE_ATTRIBUTE_DIRECTORY) { // add the directory - lstrcpyA(szBuf, args.szFile); - args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR)); - char* p = mir_strdup(szBuf); + lstrcpyW(szBuf, args.szFile); + args.files = (LPWSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPWSTR)); + wchar_t* p = mir_wstrdup(szBuf); args.files[args.count++] = p; // tack on ending search token - lstrcatA(szBuf, "\\*"); + lstrcatW(szBuf, L"\\*"); - WIN32_FIND_DATAA fd; - HANDLE hFind = FindFirstFileA(szBuf, &fd); + WIN32_FIND_DATAW fd; + HANDLE hFind = FindFirstFileW(szBuf, &fd); while (true) { if (fd.cFileName[0] != '.') { - mir_snprintf(szBuf, "%s\\%s", args.szFile, fd.cFileName); + mir_snwprintf(szBuf, L"%s\\%s", args.szFile, fd.cFileName); // keep a copy of the current thing being processed szThis = args.szFile; args.szFile = szBuf; int cchThis = args.cch; - args.cch = (int)strlen(szBuf) + 1; + args.cch = (int)wcslen(szBuf) + 1; // recurse BOOL Result = AddToList(args); // restore @@ -106,15 +106,15 @@ BOOL AddToList(TAddArgList& args) return true; } } - if (!FindNextFileA(hFind, &fd)) + if (!FindNextFileW(hFind, &fd)) break; } FindClose(hFind); } else { // add the file - args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR)); - args.files[args.count++] = mir_strdup(args.szFile); + args.files = (LPWSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPWSTR)); + args.files[args.count++] = mir_wstrdup(args.szFile); } } return false; @@ -124,7 +124,7 @@ void NTAPI MainThreadIssueTransfer(ULONG_PTR param) { TAddArgList* p = (TAddArgList*)param; g_plugin.setByte(p->hContact, SHLExt_MRU, 1); - CallService(MS_FILE_SENDSPECIFICFILES, (WPARAM)p->hContact, LPARAM(p->files)); + File::Send(p->hContact, p->files); SetEvent(p->hEvent); } @@ -143,7 +143,8 @@ void __cdecl IssueTransferThread(THeaderIPC * pipch) while (pct != nullptr) { if (pct->cbSize != sizeof(TSlotIPC)) break; - args.szFile = LPSTR(UINT_PTR(pct) + sizeof(TSlotIPC)); + + args.szFile = LPWSTR(UINT_PTR(pct) + sizeof(TSlotIPC)); args.hContact = pct->hContact; args.cch = pct->cbStrSection + 1; bQuit = AddToList(args); @@ -153,7 +154,7 @@ void __cdecl IssueTransferThread(THeaderIPC * pipch) } // while if (args.files != nullptr) { - args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR)); + args.files = (LPWSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPWSTR)); args.files[args.count++] = nullptr; if (!bQuit) { args.hEvent = CreateEvent(nullptr, true, false, nullptr); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 8af50246c9..28c77dd810 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1392,7 +1392,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) CallService(MS_TABMSG_SETUSERPREFS, m_hContact, 0); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_SENDFILE: - CallService(MS_FILE_SENDFILE, m_hContact, 0); + File::Send(m_hContact); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_QUOTEMSG: SendMessage(m_hwnd, WM_COMMAND, IDC_QUOTE, 0); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index bfda8bb78f..0aada80e85 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1979,8 +1979,8 @@ void CMsgDialog::SendHBitmapAsFile(HBITMAP hbmp) const vTempFilenames.insert(mir_wstrdup(filename)); - wchar_t *ppFiles[2] = { filename, nullptr }; - CallService(MS_FILE_SENDSPECIFICFILEST, m_cache->getActiveContact(), (LPARAM)&ppFiles); + wchar_t *ppFiles[2] = { filename, 0 }; + File::Send(m_cache->getActiveContact(), ppFiles); } // remove all temporary files created by the "send clipboard as file" feature. diff --git a/protocols/CloudFile/src/cloud_file.cpp b/protocols/CloudFile/src/cloud_file.cpp index 8674789126..9f66caaf82 100644 --- a/protocols/CloudFile/src/cloud_file.cpp +++ b/protocols/CloudFile/src/cloud_file.cpp @@ -77,11 +77,10 @@ void CCloudService::OpenUploadDialog(MCONTACT hContact) auto it = InterceptedContacts.find(hContact); if (it == InterceptedContacts.end()) { - HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, hContact, 0); + HWND hwnd = File::Send(hContact); InterceptedContacts[hContact] = hwnd; } - else - SetActiveWindow(it->second); + else SetActiveWindow(it->second); } MWindow CCloudService::OnCreateAccMgrUI(MWindow hwndParent) diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 2fd51e9fd1..42d91b309c 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -624,14 +624,11 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo } if (three.IsEmpty()) - CallService(MS_FILE_SENDFILE, ccNew, 0); + File::Send(ccNew); else { CMStringW temp = GetWordAddress(text, 3); - wchar_t* pp[2]; - wchar_t* p = (wchar_t*)temp.c_str(); - pp[0] = p; - pp[1] = nullptr; - CallService(MS_FILE_SENDSPECIFICFILEST, ccNew, (LPARAM)pp); + wchar_t *pp[2] = { temp.GetBuffer(), 0 }; + File::Send(ccNew, pp); } } } diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 5252c0865f..4a78c1101e 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -481,7 +481,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) hContact = DBCreateContact(jid, jid, true, true); if (hContact == 0) return 1; - CallService(MS_FILE_SENDFILE, hContact, 0); + File::Send(hContact); return 0; } diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index fc7a4bb6b1..acd02c6892 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -632,7 +632,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) if (!mir_wstrcmpi(szCommand, L"sendfile")) { MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true); - CallService(MS_FILE_SENDFILE, hContact, NULL); + File::Send(hContact); return 1; } diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp index 9410615939..8fa9291276 100644 --- a/src/mir_app/src/file.cpp +++ b/src/mir_app/src/file.cpp @@ -46,48 +46,20 @@ CMOption File::iOfflineSize(SRFILEMODULE, "OfflineSize", 2000); static HGENMENU hSRFileMenuItem; -static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) -{ - FileSendData fsd; - fsd.hContact = hContact; - fsd.ppFiles = nullptr; - return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); -} +///////////////////////////////////////////////////////////////////////////////////////// +// remove this piece of shit when we get rid of h++ -static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) +EXTERN_C MIR_APP_DLL(void) GetFileReceivedFolder(MCONTACT hContact, wchar_t *buf) { - FileSendData fsd; - fsd.hContact = hContact; - - char** ppFiles = (char**)lParam; - int count = 0; - while (ppFiles[count] != nullptr) - count++; - - fsd.ppFiles = (const wchar_t**)alloca((count + 1) * sizeof(void*)); - for (int i = 0; i < count; i++) - fsd.ppFiles[i] = mir_a2u(ppFiles[i]); - fsd.ppFiles[count] = nullptr; - - HWND hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); - for (int j = 0; j < count; j++) - mir_free((void*)fsd.ppFiles[j]); - return (INT_PTR)hWnd; + File::GetReceivedFolder(hContact, buf, MAX_PATH); } -static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) -{ - FileSendData fsd; - fsd.hContact = hContact; - fsd.ppFiles = (const wchar_t**)lParam; - return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); -} +///////////////////////////////////////////////////////////////////////////////////////// +// Services -static INT_PTR GetReceivedFilesFolder(WPARAM hContact, LPARAM lParam) +static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) { - wchar_t buf[MAX_PATH]; - GetContactReceivedFilesDir(hContact, buf, _countof(buf), TRUE); - mir_wstrncpy((wchar_t *)lParam, buf, MAX_PATH); + File::Send(hContact); return 0; } @@ -97,6 +69,9 @@ static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// Events + static void RemoveUnreadFileEvents(void) { for (auto &hContact : Contacts()) { @@ -148,7 +123,7 @@ static int OnToolbarButtonPressed(WPARAM, LPARAM lParam) return 0; if (cbcd->dwButtonId == 1) { - CallService(MS_FILE_SENDFILE, cbcd->hContact); + File::Send(cbcd->hContact); return 0; } return 1; @@ -162,8 +137,9 @@ static int SRFileModulesLoaded(WPARAM, LPARAM) mi.position = -2000020000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.name.a = LPGEN("&File"); - mi.pszService = MS_FILE_SENDFILE; + mi.pszService = "SRFile/SendCommand"; hSRFileMenuItem = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, SendFileCommand); // SRMM toolbar button BBButton bbd = {}; @@ -220,7 +196,7 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM) INT_PTR openContRecDir(WPARAM hContact, LPARAM) { wchar_t szContRecDir[MAX_PATH]; - GetContactReceivedFilesDir(hContact, szContRecDir, _countof(szContRecDir), TRUE); + File::GetReceivedFolder(hContact, szContRecDir, _countof(szContRecDir)); ShellExecute(nullptr, L"open", szContRecDir, nullptr, nullptr, SW_SHOW); return 0; } @@ -357,10 +333,6 @@ int LoadSendRecvFileModule(void) hDlgSucceeded = CreateHookableEvent(ME_FILEDLG_SUCCEEDED); hDlgCanceled = CreateHookableEvent(ME_FILEDLG_CANCELED); - CreateServiceFunction(MS_FILE_SENDFILE, SendFileCommand); - CreateServiceFunction(MS_FILE_SENDSPECIFICFILES, SendSpecificFiles); - CreateServiceFunction(MS_FILE_SENDSPECIFICFILEST, SendSpecificFilesT); - CreateServiceFunction(MS_FILE_GETRECEIVEDFILESFOLDER, GetReceivedFilesFolder); CreateServiceFunction("SRFile/RecvFile", RecvFileCommand); CreateServiceFunction("SRFile/OpenContRecDir", openContRecDir); diff --git a/src/mir_app/src/file.h b/src/mir_app/src/file.h index 62931d81b4..20985753c8 100644 --- a/src/mir_app/src/file.h +++ b/src/mir_app/src/file.h @@ -40,12 +40,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_FILEEXISTSDLGREPLY (WM_USER+200) -struct FileSendData -{ - MCONTACT hContact; - const wchar_t **ppFiles; -}; - #define BYTESRECVEDHISTORYCOUNT 10 //the number of bytes recved is sampled once a second and the last 10 are used to get the transfer speed struct FileDlgData : public MZeroedObject @@ -76,14 +70,10 @@ struct FileDlgData : public MZeroedObject // file.c MEVENT Proto_RecvFile(MCONTACT hContact, PROTORECVFILE *pre); -// filesenddlg.c -INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - // filerecv.c void LaunchRecvDialog(CLISTEVENT *cle); void RemoveInvalidFilenameChars(wchar_t *tszString); void RemoveInvalidPathChars(wchar_t *tszString); -void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL substVars); void GetContactSentFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir); void GetReceivedFilesDir(wchar_t *szDir, int cchDir); int BrowseForFolder(HWND hwnd, wchar_t *szPath); diff --git a/src/mir_app/src/fileopts.cpp b/src/mir_app/src/fileopts.cpp index eaac150a16..3685e9f4b0 100644 --- a/src/mir_app/src/fileopts.cpp +++ b/src/mir_app/src/fileopts.cpp @@ -73,7 +73,7 @@ public: cmbFileExists.SelectData(File::iIfExists); wchar_t str[MAX_PATH]; - GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE); + File::GetReceivedFolder(NULL, str, _countof(str)); SetDlgItemText(m_hwnd, IDC_FILEDIR, str); return true; } diff --git a/src/mir_app/src/filerecvdlg.cpp b/src/mir_app/src/filerecvdlg.cpp index 58ef04afa6..e02a34f708 100644 --- a/src/mir_app/src/filerecvdlg.cpp +++ b/src/mir_app/src/filerecvdlg.cpp @@ -121,7 +121,7 @@ static void patchDir(wchar_t *str, size_t strSize) mir_wstrcpy(str + len, L"\\"); } -void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars) +MIR_APP_DLL(wchar_t*) File::GetReceivedFolder(MCONTACT hContact, wchar_t *szDir, size_t cchDir, bool patchVars) { wchar_t tszTemp[MAX_PATH]; @@ -158,6 +158,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B patchDir(tszTemp, _countof(tszTemp)); RemoveInvalidPathChars(tszTemp); mir_wstrncpy(szDir, tszTemp, cchDir); + return szDir; } void GetReceivedFilesDir(wchar_t *szDir, int cchDir) @@ -223,7 +224,7 @@ public: SetDlgItemText(m_hwnd, IDC_FROM, contactName); wchar_t szPath[450]; - GetContactReceivedFilesDir(dat->hContact, szPath, _countof(szPath), TRUE); + File::GetReceivedFolder(dat->hContact, szPath, _countof(szPath), TRUE); SetDlgItemText(m_hwnd, IDC_FILEDIR, szPath); SHAutoComplete(GetWindow(GetDlgItem(m_hwnd, IDC_FILEDIR), GW_CHILD), 1); @@ -280,7 +281,7 @@ public: wchar_t szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH]; GetDlgItemText(m_hwnd, IDC_FILEDIR, szRecvDir, _countof(szRecvDir)); RemoveInvalidPathChars(szRecvDir); - GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE); + File::GetReceivedFolder(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE); if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_wstrlen(szDefaultRecvDir))) { char idstr[32]; ptrW wszValue; diff --git a/src/mir_app/src/filesenddlg.cpp b/src/mir_app/src/filesenddlg.cpp index 3f19d4d5f7..b13e07d375 100644 --- a/src/mir_app/src/filesenddlg.cpp +++ b/src/mir_app/src/filesenddlg.cpp @@ -27,6 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "file.h" +struct FileSendData +{ + MCONTACT hContact; + wchar_t** const ppFiles; +}; + static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) { int fileCount = 0, dirCount = 0, i; @@ -198,7 +204,7 @@ static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, SendEditSubclassProc, msg, wParam, lParam); } -INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { FileDlgData *dat = (FileDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { @@ -333,3 +339,9 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } return FALSE; } + +MIR_APP_DLL(MWindow) File::Send(MCONTACT hContact, wchar_t** const ppFiles) +{ + FileSendData fsd = { hContact, ppFiles }; + return CreateDialogParamW(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); +} diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index a37fbe8acb..6d7da2e47a 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -115,6 +115,7 @@ ProtoGetAvatarFileFormat @120 ProtoGetAvatarFormat @121 ProtoGetBufferFormat @122 ProtoHookEvent @123 +GetFileReceivedFolder @124 Proto_IsProtocolLoaded @128 GetPluginLangId @129 Proto_GetAccount @130 @@ -917,3 +918,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?fetch@EventInfo@DB@@QAE_NI_N@Z @1035 NONAME ?unload@EventInfo@DB@@QAEXXZ @1036 NONAME ?isAlertable@EventInfo@DB@@QBE_NXZ @1037 NONAME +?Send@File@@YGPAUHWND__@@IQAPA_W@Z @1038 NONAME +?GetReceivedFolder@File@@YGPA_WIPA_WI_N@Z @1039 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 374e1a3e7c..c6da8544fd 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -115,6 +115,7 @@ ProtoGetAvatarFileFormat @120 ProtoGetAvatarFormat @121 ProtoGetBufferFormat @122 ProtoHookEvent @123 +GetFileReceivedFolder @124 Proto_IsProtocolLoaded @128 GetPluginLangId @129 Proto_GetAccount @130 @@ -917,3 +918,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?fetch@EventInfo@DB@@QEAA_NI_N@Z @1035 NONAME ?unload@EventInfo@DB@@QEAAXXZ @1036 NONAME ?isAlertable@EventInfo@DB@@QEBA_NXZ @1037 NONAME +?Send@File@@YAPEAUHWND__@@IQEAPEA_W@Z @1038 NONAME +?GetReceivedFolder@File@@YAPEA_WIPEA_W_K_N@Z @1039 NONAME diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index c8e1747e67..978ebd8aa8 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -165,7 +165,7 @@ static void GenerateLocalName(const DB::EventInfo &dbei, DB::FILE_BLOB &blob, MC if (dbei.flags & DBEF_SENT) // don't mix sent & received files GetContactSentFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder)); else - GetContactReceivedFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder), true); + File::GetReceivedFolder(hContact, wszReceiveFolder, _countof(wszReceiveFolder), true); CreateDirectoryTreeW(wszReceiveFolder); MFilePath wszFullName(wszReceiveFolder); diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index 1c23ded07a..0449381f16 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -364,7 +364,7 @@ bool ProcessFileDrop(HDROP hDrop, MCONTACT hContact) AddToFileList(ppFiles, totalCount, szFilename); } - CallService(MS_FILE_SENDSPECIFICFILEST, hContact, (LPARAM)ppFiles); + File::Send(hContact, ppFiles); for (int i=0; ppFiles[i]; i++) mir_free(ppFiles[i]); -- cgit v1.2.3