summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-01 21:55:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-01 21:55:47 +0000
commit12012a3ea4d58c6624f8065c2ca2afb96090b70f (patch)
tree47e60353bc84f956e1c71241ef563c54dbc8765b /plugins
parentb2269a81668efaf157d541f2ffd67e52b89417c6 (diff)
service call replaced with helper
git-svn-id: http://svn.miranda-ng.org/main/trunk@3825 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ExternalAPI/delphi/m_folders.inc133
-rw-r--r--plugins/MirOTR/MirOTR/src/options.cpp25
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cppbin58860 -> 58754 bytes
-rw-r--r--plugins/Scriver/src/chat/tools.cpp2
-rw-r--r--plugins/SmileyAdd/src/download.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp4
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/mim.cpp8
-rw-r--r--plugins/TabSRMM/src/themes.cpp2
-rw-r--r--plugins/TrafficCounter/src/statistics.cpp2
10 files changed, 22 insertions, 158 deletions
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}
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp
index 39aa01d639..75c63b92c8 100644
--- a/plugins/MirOTR/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/MirOTR/src/options.cpp
@@ -11,9 +11,12 @@ struct PROTOREGENKEYOPTIONS {
TCHAR proto[129];
};
-void SetFilenames(const char *path) {
- if (!path || !path[0]) return;
- CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM) path);
+void SetFilenames(const char *path)
+{
+ if (!path || !path[0])
+ return;
+
+ CreateDirectoryTree(path);
strcpy(g_fingerprint_store_filename, path);
strcpy(g_private_key_filename, path);
strcat(g_fingerprint_store_filename, ("\\"));
@@ -23,18 +26,12 @@ void SetFilenames(const char *path) {
strcat(g_private_key_filename, PRIVATE_KEY_FILENAME);
}
-int FoldersChanged(WPARAM wParam, LPARAM lParam) {
+int FoldersChanged(WPARAM wParam, LPARAM lParam)
+{
char path[MAX_PATH];
-
- FOLDERSGETDATA fgd = {0};
- fgd.cbSize = sizeof(FOLDERSGETDATA);
- fgd.nMaxPathSize = MAX_PATH;
- fgd.szPath = path;
- if (CallService(MS_FOLDERS_GET_PATH, (LPARAM)hPATH_MIROTR, (LPARAM)&fgd)) {
- char *mypath = Utils_ReplaceVars(DATA_DIRECTORY);
- SetFilenames(mypath);
- mir_free(mypath);
- } else
+ if ( FoldersGetCustomPath(hPATH_MIROTR, path, SIZEOF(path), ""))
+ SetFilenames( VARS(DATA_DIRECTORY));
+ else
SetFilenames(path);
ReadPrivkeyFiles();
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index 681afb0d38..df4c11729f 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
Binary files differ
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index 43e29a7293..0eda0e0b52 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -520,7 +520,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
_tcscpy(tszFolder, tszFile);
PathRemoveFileSpec(tszFolder);
if (!PathIsDirectory(tszFolder))
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)tszFolder);
+ CreateDirectoryTreeT(tszFolder);
lstrcpyn(szTime, MakeTimeStamp(g_Settings.pszTimeStampLog, gce->time), 99);
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index 5ac7acfc59..ead34551a4 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -75,7 +75,7 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl)
{
char* delim = strrchr(szDest, '\\');
if (delim) *delim = '\0';
- CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM)szDest);
+ CreateDirectoryTree(szDest);
if (delim) *delim = '\\';
int res = -1;
int fh = _open(szDest, _O_BINARY | _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE);
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index 8388350d2c..c2e0644c95 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -778,7 +778,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
_tcscpy(tszFolder, si->pszLogFileName);
PathRemoveFileSpec(tszFolder);
if (!PathIsDirectory(tszFolder))
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)tszFolder);
+ CreateDirectoryTreeT(tszFolder);
lstrcpyn(szTime, MakeTimeStamp(g_Settings.pszTimeStampLog, gce->time), 99);
@@ -910,7 +910,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
mir_sntprintf(tszNewPath, _MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20, _T("%s%sarchived\\"),
tszDrive, tszDir);
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)tszNewPath);
+ CreateDirectoryTreeT(tszNewPath);
mir_sntprintf(tszNewName, _MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20, _T("%s%s-%s%s"), tszNewPath, tszName, tszTimestamp, tszExt);
fclose(hFile);
hFile = 0;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index eadc6e55b4..5472031de8 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -69,7 +69,7 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData* dat)
Utils::sanitizeFilename(szFilename);
mir_sntprintf(szInitialDir, MAX_PATH, _T("%s%s\\"), M->getDataPath(), _T("\\Saved message logs"));
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szInitialDir);
+ CreateDirectoryTreeT(szInitialDir);
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = dat->hwnd;
ofn.lpstrFile = szFilename;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 809a7b0a56..9da9942175 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -355,10 +355,10 @@ INT_PTR CMimAPI::foldersPathChanged()
Utils::ensureTralingBackslash(m_szChatLogsPath);
}
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)m_szProfilePath);
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)m_szSkinsPath);
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)m_szSavedAvatarsPath);
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)m_szChatLogsPath);
+ CreateDirectoryTreeT(m_szProfilePath);
+ CreateDirectoryTreeT(m_szSkinsPath);
+ CreateDirectoryTreeT(m_szSavedAvatarsPath);
+ CreateDirectoryTreeT(m_szChatLogsPath);
#if defined(_FOLDER_LOCKING)
mir_sntprintf(szTemp, MAX_PATH, L"%sfolder.lck", m_szChatLogsPath);
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 6c5d833ffe..e2032d04c6 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -2804,7 +2804,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
if (tszBasePath[lstrlen(tszBasePath) - 1] != '\\')
_tcscat(tszBasePath, _T("\\"));
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)tszBasePath);
+ CreateDirectoryTreeT(tszBasePath);
m_fAeroSkinsValid = true;
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp
index 859ecb40a9..e8a975fdf1 100644
--- a/plugins/TrafficCounter/src/statistics.cpp
+++ b/plugins/TrafficCounter/src/statistics.cpp
@@ -326,7 +326,7 @@ void Stat_ReadFile(BYTE n)
SYSTEMTIME stNow, stLast = {0};
pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\statistics"));
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszPath);
+ CreateDirectoryTreeT(pszPath);
mir_sntprintf(FileName, MAX_PATH, _T("%s\\%S.stat"), pszPath, ProtoList[n].name);
mir_free(pszPath);
GetLocalTime(&stNow);