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 ---------------------------- plugins/MirOTR/MirOTR/src/options.cpp | 25 +++--- plugins/Quotes/src/QuotesProviderBase.cpp | Bin 58860 -> 58754 bytes plugins/Scriver/src/chat/tools.cpp | 2 +- plugins/SmileyAdd/src/download.cpp | 2 +- plugins/TabSRMM/src/chat/tools.cpp | 4 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/mim.cpp | 8 +- plugins/TabSRMM/src/themes.cpp | 2 +- plugins/TrafficCounter/src/statistics.cpp | 2 +- protocols/AimOscar/src/avatars.cpp | 2 +- protocols/AimOscar/src/file.cpp | 2 +- protocols/AimOscar/src/utility.cpp | 2 +- protocols/FacebookRM/src/communication.cpp | 2 +- protocols/Gadu-Gadu/src/avatar.cpp | 2 +- protocols/Gadu-Gadu/src/image.cpp | 2 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 2 +- protocols/MRA/src/MraAvatars.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 4 +- protocols/Tlen/src/tlen_avatar.cpp | 6 +- protocols/Tlen/src/tlen_picture.cpp | 6 +- protocols/Twitter/src/utility.cpp | 2 +- protocols/Yahoo/src/avatar.cpp | 2 +- src/core/stdchat/src/options.cpp | 4 +- src/core/stdchat/src/tools.cpp | 2 +- 26 files changed, 44 insertions(+), 180 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 Binary files a/plugins/Quotes/src/QuotesProviderBase.cpp and b/plugins/Quotes/src/QuotesProviderBase.cpp 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); diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 9eacdc6dad..a2277658de 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -202,7 +202,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen } if (ext && _taccess(pszDest, 0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CreateDirectoryTreeT(pszDest); size_t tPathLen2 = tPathLen; diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 14e453ef42..12ef935cd7 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -361,7 +361,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET if (ft->pfts.tszCurrentFile) { TCHAR* dir = get_dir(ft->pfts.tszCurrentFile); - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)dir); + CreateDirectoryTreeT(dir); mir_free(dir); oft->type = _htons(ft->pfts.currentFileProgress ? 0x0205 : 0x0202); diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 5ebf065227..549f2e4235 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -606,7 +606,7 @@ int CAimProto::open_contact_file(const char* sn, const TCHAR* file, const char* } if (_taccess(path, 0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path); + CreateDirectoryTreeT(path); mir_sntprintf(path + pos, MAX_PATH - pos, _T("\\%s"), file); int fid = _topen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD); diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index c51f757fe3..6f4d94a7ff 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1235,7 +1235,7 @@ bool facebook_client::save_url(const std::string &url,const std::tstring &filena // Create folder if necessary std::tstring dir = filename.substr(0,filename.rfind('\\')); if( _taccess(dir.c_str(),0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)dir.c_str()); + CreateDirectoryTreeT(dir.c_str()); // Write to file FILE *f = _tfopen(filename.c_str(), _T("wb")); diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index c6b49157fd..f3d2b87807 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -40,7 +40,7 @@ void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen) } if (_taccess(pszDest, 0)) { - int ret = CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + int ret = CreateDirectoryTreeT(pszDest); if (ret == 0){ netlog("getAvatarFilename(): Created new directory for avatar cache: %S.", pszDest); } else { diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 4bb12b042b..da9104004b 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -826,7 +826,7 @@ int GGPROTO::img_displayasmsg(HANDLE hContact, void *img) } if ( _taccess(szPath, 0)){ - int ret = CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath); + int ret = CreateDirectoryTreeT(szPath); if (ret == 0){ netlog("img_displayasmsg(): Created new directory for image cache: %S.", szPath); } else { diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index f1db812a5e..56f2ce55c4 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -145,7 +145,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, int tPathLen = strlennull(pszDest); // make sure the avatar cache directory exists - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath); + CreateDirectoryTreeT(szPath); if (dwUin != 0) { diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index abb15774a3..ce13696af7 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -276,7 +276,7 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CreateDirectoryTreeT(pszDest); pszDest[ tPathLen++ ] = '\\'; diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index aec806c687..584b8adca6 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -550,7 +550,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hConta if (dwPathSize) { // some path in buff and free space for file name is avaible - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)lpszPath); + CreateDirectoryTreeT(lpszPath); if (dwFormat != PA_FORMAT_DEFAULT) { if ( mraGetStaticStringW(hContact, "e-mail", lpszCurPath, dwPathSize-5, &dwEMailSize)) { diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 7c52fb5b9c..68c488fd9f 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -221,7 +221,7 @@ void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t c } if (_taccess(pszDest, 0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CreateDirectoryTreeT(pszDest); size_t tPathLen2 = tPathLen; if (hContact != NULL) { @@ -451,7 +451,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, si } if (!exist) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CreateDirectoryTreeT(pszDest); TCHAR *sztSmileyName = mir_a2t(SmileyName); mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s.%s"), sztSmileyName, diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 07de0e6b58..f6460e905b 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -41,9 +41,9 @@ void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, TCHAR* p tPathLen = mir_sntprintf( ptszDest, cbLen, TEXT("%s\\Tlen"), tmpPath ); mir_free(tmpPath); dwAttributes = GetFileAttributes( ptszDest ); - if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) { - CallService( MS_UTILS_CREATEDIRTREET, 0, ( LPARAM )ptszDest ); - } + if (dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0) + CreateDirectoryTreeT(ptszDest); + ptszDest[ tPathLen++ ] = '\\'; if (item != NULL) { format = item->avatarFormat; diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 8a86c1e2e5..d61842d8dd 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -224,9 +224,9 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { int tPathLen = mir_snprintf( fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath ); long oldSize = 0, lSize = atol(size); DWORD dwAttributes = GetFileAttributesA( fileName ); - if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) { - CallService( MS_UTILS_CREATEDIRTREE, 0, ( LPARAM )fileName ); - } + if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) + CreateDirectoryTree(fileName); + mir_free(tmpPath); fileName[ tPathLen++ ] = '\\'; mir_snprintf( fileName + tPathLen, MAX_PATH - tPathLen, "%s.%s", crc, ext ); diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 515399348f..f40eecc2e5 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -190,7 +190,7 @@ bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename // Create folder if necessary std::tstring dir = filename.substr(0,filename.rfind('\\')); if( _taccess(dir.c_str(),0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)dir.c_str()); + CreateDirectoryTreeT(dir.c_str()); // Write to file FILE *f = _tfopen(filename.c_str(), _T("wb")); diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index bc0a6ef32f..05cb9b9113 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -647,7 +647,7 @@ void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, } if ( _taccess(pszDest, 0)) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CreateDirectoryTreeT(pszDest); if (hContact != NULL) { int ck_sum = db_get_dw(hContact, m_szModuleName,"PictCK", 0); diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index c729fd5fe8..6eb8721533 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -796,7 +796,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED?TRUE:FALSE; DBWriteContactSettingByte(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled); if ( g_Settings.LoggingEnabled ) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)g_Settings.pszLogDir); + CreateDirectoryTreeT(g_Settings.pszLogDir); iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_GETPOS,0,0); db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen); @@ -1073,7 +1073,7 @@ int OptionsInit(void) SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed")); if ( g_Settings.LoggingEnabled ) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)g_Settings.pszLogDir); + CreateDirectoryTreeT(g_Settings.pszLogDir); { LOGFONT lf; HFONT hFont; diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 752e208cef..d89e1725dd 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -535,7 +535,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce) ValidateFilename(szName); mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), g_Settings.pszLogDir, szName ); - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szFolder); + CreateDirectoryTreeT(szFolder); mir_sntprintf( szName, MAX_PATH, _T("%s.log"), si->ptszID ); ValidateFilename(szName); -- cgit v1.2.3