From 12012a3ea4d58c6624f8065c2ca2afb96090b70f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 1 Mar 2013 21:55:47 +0000 Subject: service call replaced with helper git-svn-id: http://svn.miranda-ng.org/main/trunk@3825 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ExternalAPI/delphi/m_folders.inc | 133 ------------------------------- 1 file changed, 133 deletions(-) (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/delphi/m_folders.inc b/plugins/ExternalAPI/delphi/m_folders.inc index 3cb3cbc294..7ab0ce1a11 100644 --- a/plugins/ExternalAPI/delphi/m_folders.inc +++ b/plugins/ExternalAPI/delphi/m_folders.inc @@ -136,137 +136,4 @@ const } ME_FOLDERS_PATH_CHANGED = 'Folders/On/Path/Changed'; -(* -#ifndef FOLDERS_NO_HELPER_FUNCTIONS - -#ifndef M_UTILS_H__ -#error The helper functions require that m_utils.h be included in the project. Please include that file if you want to use the helper functions. If you don't want to use the functions just define FOLDERS_NO_HELPER_FUNCTIONS. -#endif - -//#include "../../../include/newpluginapi.h" - -__inline static HANDLE FoldersRegisterCustomPath(const AnsiChar *section, const AnsiChar *name, const AnsiChar *defaultPath) -{ - FOLDERSDATA fd = {0}; - if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0; - fd.cbSize = sizeof(FOLDERSDATA); - strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE); - fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; - strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE); - fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; - fd.szFormat = defaultPath; - return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd); -} - -__inline static HANDLE FoldersRegisterCustomPathW(const AnsiChar *section, const AnsiChar *name, const wchar_t *defaultPathW) -{ - FOLDERSDATA fd = {0}; - if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0; - fd.cbSize = sizeof(FOLDERSDATA); - strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE); - fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated - strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE); - fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated - fd.szFormatW = defaultPathW; - fd.flags = FF_UNICODE; - return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd); -} - -__inline static int FoldersGetCustomPath(HANDLE hFolderEntry, AnsiChar *path, const int size, AnsiChar *notFound) -{ - FOLDERSGETDATA fgd = {0}; - int res; - fgd.cbSize = sizeof(FOLDERSGETDATA); - fgd.nMaxPathSize = size; - fgd.szPath = path; - res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); - if (res) - { - AnsiChar buffer[MAX_PATH]; - CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer); - mir_snprintf(path, size, "%s", buffer); - } - - return res; -} - -__inline static int FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW) -{ - FOLDERSGETDATA fgd = {0}; - int res; - fgd.cbSize = sizeof(FOLDERSGETDATA); - fgd.nMaxPathSize = count; - fgd.szPathW = pathW; - res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); - if (res) - { - wcsncpy(pathW, notFoundW, count); - pathW[count - 1] = '\0'; - } - - return res; -} - -__inline static int FoldersGetCustomPathEx(HANDLE hFolderEntry, AnsiChar *path, const int size, AnsiChar *notFound, AnsiChar *fileName) -{ - FOLDERSGETDATA fgd = {0}; - int res; - fgd.cbSize = sizeof(FOLDERSGETDATA); - fgd.nMaxPathSize = size; - fgd.szPath = path; - res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); - if (res) - { - AnsiChar buffer[MAX_PATH]; - CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer); - mir_snprintf(path, size, "%s", buffer); - } - if (strlen(path) > 0) - { - strcat(path, "\\"); - } - else{ - path[0] = '\0'; - } - - if (fileName) - { - strcat(path, fileName); - } - - return res; -} - -__inline static int FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW, wchar_t *fileNameW) -{ - FOLDERSGETDATA fgd = {0}; - int res; - fgd.cbSize = sizeof(FOLDERSGETDATA); - fgd.nMaxPathSize = count; - fgd.szPathW = pathW; - res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); - if (res) - { - wcsncpy(pathW, notFoundW, count); - pathW[count - 1] = '\0'; - } - - if (wcslen(pathW) > 0) - { - wcscat(pathW, L"\\"); - } - else{ - pathW[0] = L'\0'; - } - - if (fileNameW) - { - wcscat(pathW, fileNameW); - } - - return res; -} - -#endif -*) {$ENDIF} -- cgit v1.2.3