From 8918f985d74fe3936bee51f3c4e40c604521faa4 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 1 Aug 2012 17:47:44 +0000 Subject: SmileyAdd: cleanup in folders registration git-svn-id: http://svn.miranda-ng.org/main/trunk@1305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/download.cpp | 49 ++++++++++---------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 39de234634..6da10b9525 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -222,51 +222,26 @@ bool GetSmileyFile(bkstring& url, const bkstring& packstr) return false; } -void GetDefaultSmileyCacheFolder(TCHAR* szPath, size_t cbLen) -{ - TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\SmileyCache")); - if ((INT_PTR)tmpPath != CALLSERVICE_NOTFOUND) - { - mir_sntprintf(szPath, cbLen, _T("%s"), tmpPath); - mir_free(tmpPath); - } - else - { - char dbPath[MAX_PATH]; - CallService(MS_DB_GETPROFILEPATH, SIZEOF(dbPath), (LPARAM)dbPath); - mir_sntprintf(szPath, cbLen, _T("%s\\SmileyCache"), A2T_SM(dbPath)); - } -} - int FolderChanged(WPARAM, LPARAM) { - FOLDERSGETDATA fgd = {0}; - fgd.cbSize = sizeof(FOLDERSGETDATA); - fgd.nMaxPathSize = SIZEOF(cachepath); - fgd.szPathT = cachepath; - if (CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolder, (LPARAM) &fgd)) - { - GetDefaultSmileyCacheFolder(cachepath, SIZEOF(cachepath)); - } - + FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, _T("")); return 0; } void GetSmileyCacheFolder(void) { TCHAR defaultPath[MAX_PATH]; - - GetDefaultSmileyCacheFolder(defaultPath, SIZEOF(defaultPath)); - - FOLDERSDATA fd = {0}; - fd.cbSize = sizeof(FOLDERSDATA); - strcpy(fd.szSection, "SmileyAdd"); - strcpy(fd.szName,"Smiley Cache"); - fd.szFormatT = defaultPath; - fd.flags = FF_TCHAR; - hFolder = (HANDLE)CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd); - - FolderChanged(0, 0); + if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) + { + hFolder = FoldersRegisterCustomPathT("SmileyAdd", "Smiley Cache", MIRANDA_USERDATAT _T("\\SmileyCache")); + FoldersGetCustomPathT(hFolder, defaultPath, MAX_PATH, _T("")); + } + else + { + TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\SmileyCache")); + lstrcpyn(defaultPath, tszFolder, SIZEOF(defaultPath)); + mir_free(tszFolder); + } hFolderHook = HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged); } -- cgit v1.2.3