diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-08-01 17:47:44 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-08-01 17:47:44 +0000 |
commit | 8918f985d74fe3936bee51f3c4e40c604521faa4 (patch) | |
tree | 71399653cc668ae05413f71be672567e07d6fb48 /plugins/SmileyAdd/src | |
parent | 16b3108be10c20c54d8ad47e2dac5b7cd908e3eb (diff) |
SmileyAdd:
cleanup in folders registration
git-svn-id: http://svn.miranda-ng.org/main/trunk@1305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src')
-rw-r--r-- | plugins/SmileyAdd/src/download.cpp | 49 |
1 files changed, 12 insertions, 37 deletions
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);
}
|