From 8476b3ba7e52f4099783e6066202bda140625c7e Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 2 Feb 2013 17:51:26 +0000 Subject: added hook for ME_FOLDERS_PATH_CHANGED git-svn-id: http://svn.miranda-ng.org/main/trunk@3399 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Src/NewsAggregator.cpp | 16 +--------------- plugins/NewsAggregator/Src/Services.cpp | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index e5eb15e66f..786313b309 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA. HINSTANCE hInst = NULL; int hLangpack; -HANDLE hPrebuildMenuHook = NULL, hPackUpdaterFolder = NULL; +HANDLE hPrebuildMenuHook = NULL; HANDLE hProtoService[8]; HWND hAddFeedDlg; HANDLE hChangeFeedDlgList = NULL; @@ -57,26 +57,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfoEx; } -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {{0x29517be5, 0x779a, 0x48e5, {0x89, 0x50, 0xcb, 0x4d, 0xe1, 0xd4, 0x31, 0x72}}, MIID_LAST}; - extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); mir_getXI(&xi); - if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) - { - hPackUpdaterFolder = FoldersRegisterCustomPathT("News Aggregator", "Avatars", MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)); - FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T("")); - } - else - { - TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"_T(DEFAULT_AVATARS_FOLDER))); - lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot)); - mir_free(tszFolder); - } - // Add options hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, NewsAggrInit); diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 10f0e72941..c302abdff2 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. int g_nStatus = ID_STATUS_ONLINE; UINT_PTR timerId = 0; -HANDLE hTBButton = NULL; +HANDLE hTBButton = NULL, hNewsAggregatorFolder = NULL; void SetContactStatus(HANDLE hContact, int nNewStatus) { @@ -43,8 +43,26 @@ static void __cdecl WorkingThread(void* param) } } +int OnFoldersChanged(WPARAM, LPARAM) +{ + FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); + return 0; +} + int NewsAggrInit(WPARAM wParam, LPARAM lParam) { + if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) + { + hNewsAggregatorFolder = FoldersRegisterCustomPathT("News Aggregator", "Avatars", MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)); + FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); + } + else + { + TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"_T(DEFAULT_AVATARS_FOLDER))); + lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot)); + mir_free(tszFolder); + } + HANDLE hContact = db_find_first(); while (hContact != NULL) { @@ -61,9 +79,10 @@ int NewsAggrInit(WPARAM wParam, LPARAM lParam) InitMenu(); HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); + HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged); // timer for the first update - timerId = SetTimer(NULL, 0, 10000, timerProc2); // first update is 10 sec after load + timerId = SetTimer(NULL, 0, 10000, timerProc2); // first update is 10 sec after load return 0; } -- cgit v1.2.3