diff options
102 files changed, 422 insertions, 759 deletions
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index edda1f5a23..17c723c7d7 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -866,6 +866,7 @@ void InitAssocList(void) icc.dwSize = sizeof(icc);
icc.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icc);
+
HookEvent(ME_OPT_INITIALISE, AssocListOptInit);
// Services
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index e4da8decb0..29d8456739 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -156,18 +156,18 @@ int onModulesLoaded(WPARAM, LPARAM) for (auto &hContact : Contacts())
onExtraImageApplying((WPARAM)hContact, 1);
- HookEvent(ME_OPT_INITIALISE, onOptInitialise);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
-
return 0;
}
int CMPlugin::Load()
{
- HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded);
+ HookEvent(ME_OPT_INITIALISE, onOptInitialise);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+
CreateServiceFunction("AuthState/MenuItem", onAuthMenuSelected);
CMenuItem mi(&g_plugin);
diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp index f9f7d81ce6..9fa00794ef 100644 --- a/plugins/AutoShutdown/src/main.cpp +++ b/plugins/AutoShutdown/src/main.cpp @@ -74,15 +74,14 @@ int CMPlugin::Load() InitShutdownSvc();
InitWatcher(); /* before InitSettingsDlg() */
InitSettingsDlg();
- InitOptions();
+ HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ShutdownModulesLoaded);
return 0;
}
int CMPlugin::Unload()
{
- UninitOptions();
UninitWatcher(); /* before UninitFrame() */
UninitFrame();
UninitShutdownSvc();
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index e882eb49d3..f46c1d344e 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -21,11 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-/* Option Page */
-static HANDLE hHookOptInit;
-/* Trigger */
-static HANDLE hHookModulesLoaded;
-
/************************* Option Page ********************************/
#define M_ENABLE_SUBCTLS (WM_APP+111)
@@ -103,7 +98,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return FALSE;
}
-static int ShutdownOptInit(WPARAM wParam, LPARAM)
+int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SHUTDOWN);
@@ -116,19 +111,3 @@ static int ShutdownOptInit(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp);
return 0;
}
-
-/************************* Misc ***************************************/
-
-void InitOptions(void)
-{
- /* Option Page */
- hHookOptInit = HookEvent(ME_OPT_INITIALISE, ShutdownOptInit);
-}
-
-void UninitOptions(void)
-{
- /* Option Page */
- UnhookEvent(hHookOptInit);
- /* Trigger */
- UnhookEvent(hHookModulesLoaded);
-}
diff --git a/plugins/AutoShutdown/src/options.h b/plugins/AutoShutdown/src/options.h index d5e735f7f0..238fefdb89 100644 --- a/plugins/AutoShutdown/src/options.h +++ b/plugins/AutoShutdown/src/options.h @@ -22,5 +22,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once
/* Misc */
-void InitOptions(void);
-void UninitOptions(void);
+int OptInit(WPARAM, LPARAM);
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index a55f34fd11..71b3c8ad6f 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -549,7 +549,6 @@ int OnModulesLoaded(WPARAM, LPARAM) LoadBassLibrary(CurrBassPath);
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
return 0;
}
@@ -590,9 +589,10 @@ static IconItem iconList[] = int CMPlugin::Load()
{
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
g_plugin.registerIcon(MODULENAME, iconList);
return 0;
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 54bd9479cf..b3a6b10ded 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -606,7 +606,6 @@ static int MirandaLoaded(WPARAM, LPARAM) g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, nullptr, WinEventProc, GetCurrentProcessId(), 0, 0);
HookEvent(ME_TTB_MODULELOADED, TopToolbarInit);
- HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
HookEvent(ME_MSG_WINDOWEVENT, MsgWinOpening);
HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtos);
HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
@@ -680,6 +679,7 @@ int CMPlugin::Load() CreateServiceFunction(MS_BOSSKEY_HIDE, BossKeyHideMiranda); // Create service
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
+ HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
return 0;
}
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 68421a0d0b..3d4d799d6d 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -647,7 +647,8 @@ int onShutdown(WPARAM, LPARAM) int CMPlugin::Load()
{
- InitOptions();
+ LoadOptions();
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
CreateServiceFunction("BuddyExpectator/actionReturned", ContactReturnedAction);
CreateServiceFunction("BuddyExpectator/actionStillAbsent", ContactStillAbsentAction);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 536b6100e7..01b36144dc 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -426,10 +426,10 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP return 0;
}
-/**
- * Init options panel
- */
-static int OptionsInit(WPARAM wParam, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Init options
+
+int OptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.szGroup.w = LPGENW("Contacts");
@@ -449,6 +449,9 @@ static int OptionsInit(WPARAM wParam, LPARAM) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// UserInfo initalization
+
INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg) {
@@ -535,10 +538,3 @@ int UserinfoInit(WPARAM wparam, LPARAM lparam) }
return 0;
}
-
-
-void InitOptions()
-{
- LoadOptions();
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
-}
diff --git a/plugins/BuddyExpectator/src/options.h b/plugins/BuddyExpectator/src/options.h index 3b6f0a9c32..e53ed061a2 100644 --- a/plugins/BuddyExpectator/src/options.h +++ b/plugins/BuddyExpectator/src/options.h @@ -52,6 +52,4 @@ typedef struct { extern Options options;
-void InitOptions();
-
#endif
diff --git a/plugins/BuddyExpectator/src/stdafx.h b/plugins/BuddyExpectator/src/stdafx.h index 3e3ed107e1..798492ec0c 100644 --- a/plugins/BuddyExpectator/src/stdafx.h +++ b/plugins/BuddyExpectator/src/stdafx.h @@ -60,4 +60,7 @@ extern HANDLE hExtraIcon; void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
extern DWORD timer_id;
+void LoadOptions();
+int OptionsInit(WPARAM wParam, LPARAM);
+
#endif
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index b6a2b82c2b..c8fbf90916 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -313,10 +313,6 @@ static int MirandaLoaded(WPARAM, LPARAM) COptPage PopupOptPage(g_PopupOptPage);
PopupOptPage.DBToMem();
RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS));
- HookEvent(ME_OPT_INITIALISE, OptionsDlgInit);
- HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
- HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
g_plugin.addSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed"));
@@ -346,6 +342,10 @@ static int MirandaLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
+ HookEvent(ME_OPT_INITIALISE, OptionsDlgInit);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
InitOptions();
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 442d479bbd..f5417c93b3 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -138,9 +138,9 @@ int CMPlugin::Load() CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccountsChanged);
HookEvent(ME_OPT_INITIALISE, OnOptsInit);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccountsChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
InitCustomMenus();
return 0;
diff --git a/plugins/CloudFile/src/events.cpp b/plugins/CloudFile/src/events.cpp index 08bbd2974d..010729dddb 100644 --- a/plugins/CloudFile/src/events.cpp +++ b/plugins/CloudFile/src/events.cpp @@ -40,17 +40,9 @@ int OnModulesLoaded(WPARAM, LPARAM) HookEvent(ME_PROTO_ACK, OnProtoAck); - // options - HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); - // srfile HookEvent(ME_FILEDLG_CANCELED, OnFileDialogCanceled); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); - - HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); - HookEvent(ME_MSG_BUTTONPRESSED, OnSrmmButtonPressed); - HookTemporaryEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); return 0; }
\ No newline at end of file diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp index 3e57d50035..2b9ffd6c2d 100644 --- a/plugins/CloudFile/src/main.cpp +++ b/plugins/CloudFile/src/main.cpp @@ -29,6 +29,10 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC int CMPlugin::Load() { + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); + HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); + HookEvent(ME_MSG_BUTTONPRESSED, OnSrmmButtonPressed); + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); InitializeIcons(); diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index c18dad2c35..107ff78e04 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -2,15 +2,10 @@ CMPlugin g_plugin;
-//PLUGINLINK *pluginLink=NULL;
-HANDLE hOptInit = nullptr;
static HWND hTimerWnd = (HWND)nullptr;
static UINT TID = (UINT)12021;
-//HANDLE hHookModulesLoaded=NULL;
HANDLE hCheckEvent = nullptr;
HANDLE hCheckHook = nullptr;
-HANDLE hHookModulesLoaded = nullptr;
-HANDLE hHookPreShutdown = nullptr;
HANDLE hConnectionCheckThread = nullptr;
HANDLE hFilterOptionsThread = nullptr;
HANDLE killCheckThreadEvent = nullptr;
@@ -861,13 +856,9 @@ int CMPlugin::Load() g_plugin.addSound(PLUGINNAME_NEWSOUND, PLUGINNAMEW, LPGENW("New Connection Notification"));
- hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call
- assert(hOptInit);
-
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded
- assert(hHookModulesLoaded);
-
- hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown);
+ HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit); // register service to hook option call
+ HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded); // hook event that all plugins are loaded
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown);
return 0;
}
@@ -876,15 +867,11 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
WaitForSingleObjectEx(hConnectionCheckThread, INFINITE, FALSE);
- if (hConnectionCheckThread)CloseHandle(hConnectionCheckThread);
- if (hCheckEvent)DestroyHookableEvent(hCheckEvent);
- if (hOptInit) UnhookEvent(hOptInit);
- if (hCheckHook)UnhookEvent(hCheckHook);
- if (hHookModulesLoaded)UnhookEvent(hHookModulesLoaded);
- if (hHookPreShutdown)UnhookEvent(hHookPreShutdown);
- if (killCheckThreadEvent)
- CloseHandle(killCheckThreadEvent);
- //if (hCurrentEditMutex) CloseHandle(hCurrentEditMutex);
+
+ if (hConnectionCheckThread) CloseHandle(hConnectionCheckThread);
+ if (hCheckEvent) DestroyHookableEvent(hCheckEvent);
+ if (hCheckHook) UnhookEvent(hCheckHook);
+ if (killCheckThreadEvent) CloseHandle(killCheckThreadEvent);
if (hExceptionsMutex) CloseHandle(hExceptionsMutex);
#ifdef _DEBUG
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index e5bd79a6a1..d68d3f0522 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -1278,5 +1278,3 @@ static int Openfile(wchar_t *outputFile, int selection) mir_wstrcpy(outputFile, filename);
return 1;
}
-
-////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 3ec4de1ad2..a7a9c2f4f4 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -22,31 +22,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "dlg_handlers.h"
#include "hooked_events.h"
-HANDLE hModulesLoaded;
-HANDLE hOptionsInitialise;
-HANDLE hPreShutdown;
-
UINT_PTR hCheckTimer = NULL;
UINT_PTR hReconnectTimer = NULL;
UINT_PTR hFirstCheckTimer = NULL;
int HookEvents()
{
- hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- hOptionsInitialise = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
- hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnSystemPreShutdown);
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnSystemPreShutdown);
return 0;
}
int UnhookEvents()
{
- UnhookEvent(hModulesLoaded);
- UnhookEvent(hOptionsInitialise);
- UnhookEvent(hPreShutdown);
-
KillTimers();
-
return 0;
}
@@ -63,9 +53,8 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.name.w = LPGENW("Check exchange mailbox");
Menu_AddMainMenuItem(&mi);
- hEmailsDlg = nullptr; //CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
+ hEmailsDlg = nullptr;
FirstTimeCheck();
-// CheckEmail();
return 0;
}
@@ -165,4 +154,4 @@ VOID CALLBACK OnFirstCheckTimer(HWND hWnd, UINT msg, UINT_PTR idEvent, DWORD dwT OnCheckTimer(hWnd, msg, idEvent, dwTime);
hFirstCheckTimer = NULL;
-}
\ No newline at end of file +}
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index e6cf69b0cd..4b41598829 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -887,8 +887,6 @@ int OnModulesLoaded(WPARAM, LPARAM) //Hook necessary events HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); - HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); - HookEvent(ME_OPT_INITIALISE, OnOptInitialise); HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowEvent); HookEvent(ME_MC_DEFAULTTCHANGED, OnExtraImageApply); @@ -911,6 +909,8 @@ int OnModulesLoaded(WPARAM, LPARAM) void InitFingerModule() { HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_OPT_INITIALISE, OnOptInitialise); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); CreateServiceFunction(MS_FP_SAMECLIENTSW, ServiceSameClientsW); CreateServiceFunction(MS_FP_GETCLIENTDESCRW, ServiceGetClientDescrW); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 0ebef29c0b..f2dbe2f004 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -863,7 +863,6 @@ static int OnModulesLoded(WPARAM, LPARAM) HookEvent(ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
- HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize);
HookEvent(ME_CLIST_STATUSMODECHANGE, OnStatusModeChange);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu);
@@ -922,6 +921,7 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize);
return 0;
}
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index a29911c2b5..1bc3745c7f 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -243,7 +243,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l return 0;
}
-static int OnOptionsInitialize(WPARAM wParam, LPARAM)
+int OnOptionsInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.position = 100000000;
@@ -255,8 +255,3 @@ static int OnOptionsInitialize(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp);
return 0;
}
-
-void InitOptions()
-{
- HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize);
-}
diff --git a/plugins/Folders/src/folders.cpp b/plugins/Folders/src/folders.cpp index ad83692bd4..a9dd862942 100644 --- a/plugins/Folders/src/folders.cpp +++ b/plugins/Folders/src/folders.cpp @@ -49,7 +49,8 @@ int CMPlugin::Load() {
InitServices();
InitEvents();
- InitOptions();
+
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize);
return 0;
}
diff --git a/plugins/Folders/src/services.h b/plugins/Folders/src/services.h index 419de6cad9..865bc82cc8 100644 --- a/plugins/Folders/src/services.h +++ b/plugins/Folders/src/services.h @@ -29,6 +29,7 @@ extern wchar_t szMirandaPath[MAX_FOLDERS_PATH]; extern wchar_t szUserDataPath[MAX_FOLDERS_PATH];
int InitServices();
-void InitOptions();
+
+int OnOptionsInitialize(WPARAM, LPARAM);
#endif //M_FOLDERS_PROVIDED_SERVICES_H
\ No newline at end of file diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index c24d707c59..e894e5c6d5 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -13,7 +13,6 @@ There is no warranty. CMPlugin g_plugin;
UINT hTimer;
-HANDLE hMirandaStarted, hOptionsInitial;
HNETLIBUSER hNetlibUser;
NOTIFYICONDATA niData;
optionSettings opt;
@@ -127,8 +126,8 @@ int CMPlugin::Load() db_set_dw(it->hContact, MODULENAME, "Status", ID_STATUS_NONEW);
hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc);
- hMirandaStarted = HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart);
- hOptionsInitial = HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
CreateServiceFunction(MODULENAME "/MenuCommand", PluginMenuCommand);
@@ -159,8 +158,5 @@ int CMPlugin::Unload() g_accs.destroy();
Netlib_CloseHandle(hNetlibUser);
-
- UnhookEvent(hMirandaStarted);
- UnhookEvent(hOptionsInitial);
return 0;
}
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 66fddc14aa..de1a8553af 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -28,8 +28,6 @@ static HANDLE hShowStatisticsViewService = nullptr; static HANDLE hShareNewFileMenuItem = nullptr;
static HANDLE hShowStatisticsViewMenuItem = nullptr;
-static HANDLE hEventOptionsInitialize = nullptr;
-
HWND hwndStatsticView = nullptr;
bool bLastAutoRefress = false;
@@ -1455,7 +1453,5 @@ void InitGuiElements() hShowStatisticsViewMenuItem = Menu_AddMainMenuItem(&mi);
}
- hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
-
bShowPopups = db_get_b(NULL, MODULENAME, "ShowPopups", bShowPopups) != 0;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index b20ef338c1..bc3e9e4d57 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -42,8 +42,8 @@ const char* pszDefaultShares[] = { nullptr, nullptr
};
-void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP);
-int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/);
+int OptionsInitialize(WPARAM, LPARAM);
+int PreShutdown(WPARAM, LPARAM);
HNETLIBUSER hNetlibUser;
HANDLE hDirectBoundPort;
@@ -74,7 +74,6 @@ int nMaxConnectionsPerUser = -1; int nDefaultDownloadLimit = -1;
bool bIsOnline = true;
-static HANDLE hEventProtoAck = nullptr;
bool bLimitOnlyWhenOnline = true;
@@ -330,7 +329,7 @@ bool bReadConfigurationFile() bool bWriteConfigurationFile()
{
CLFileShareListAccess clCritSection;
- char szBuf[1000], temp[200];
+ char szBuf[1000];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szConfigFile);
HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
@@ -833,7 +832,8 @@ int CMPlugin::Load() db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode);
}
- hEventProtoAck = HookEvent(ME_PROTO_ACK, nProtoAck);
+ HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
+ HookEvent(ME_PROTO_ACK, nProtoAck);
return 0;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index d51959d712..3941ac8bbf 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -172,7 +172,6 @@ int CMPlugin::Load() HookEvent(ME_OPT_INITIALISE, InitOptionsDlg);
HookEvent(ME_DB_EVENT_ADDED, DBUpdate);
-
return 0;
}
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index ea7bc5ea82..1683788a1b 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -357,9 +357,6 @@ static int EventModulesLoaded(WPARAM, LPARAM) g_pSettings = new SettingsSerializer(con::ModHistoryStats);
g_pSettings->readFromDB();
- // integrate into options dialog
- HookEvent(ME_OPT_INITIALISE, EventOptInitialise);
-
// integrate with icolib
IconLib::init();
IconLib::registerCallback(MenuIconsChanged, 0);
@@ -424,9 +421,9 @@ int CMPlugin::Load() CreateServiceFunction(MS_HISTORYSTATS_ISEXCLUDED, SvcIsExcluded);
CreateServiceFunction(MS_HISTORYSTATS_SETEXCLUDE, SvcSetExclude);
- // hook "modules loaded" to perform further initialization
+ // hooks
+ HookEvent(ME_OPT_INITIALISE, EventOptInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, EventModulesLoaded);
-
return 0;
}
diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 63652e826d..f8e5a290ee 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -86,7 +86,7 @@ int CMPlugin::Load() mi.name.w = LPGENW("&System History"); Menu_AddMainMenuItem(&mi); - HookEvents(); + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); return 0; } diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index f5db4c4597..6e5b146434 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -483,76 +483,6 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara return 0;
}
-INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWnd);
- {
- int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0);
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0);
-
- CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_ENABLE_RTL, db_get_b(NULL, MODULENAME, "EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, db_get_b(NULL, MODULENAME, "UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- wchar_t buffer[40];
- _itow_s(count, buffer, 10);
- SetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer);
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_LOAD_ALL:
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_LOAD_NUMBER:
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_ENABLE_RTL:
- case IDC_SHOW_LAST_FIRST:
- case IDC_EVENTS_COUNT:
- case IDC_LOAD_BACKGROUND:
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- long count;
- if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL))
- count = 0;
- else {
- wchar_t buffer[1024];
- GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, _countof(buffer));
- count = _wtol(buffer);
- count = (count < 0) ? 0 : count;
- }
- db_set_b(NULL, MODULENAME, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
- db_set_b(NULL, MODULENAME, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
- db_set_b(NULL, MODULENAME, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
- db_set_dw(NULL, MODULENAME, "EventsToLoad", count);
- }
- }
- break;
- }
- return 0;
-}
-
INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SearchWindowData *data = (SearchWindowData *)GetWindowLongPtr(hWnd, DWLP_USER);
@@ -671,3 +601,88 @@ INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam }
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// options
+
+static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWnd);
+ {
+ int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0);
+
+ CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_ENABLE_RTL, db_get_b(NULL, MODULENAME, "EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, db_get_b(NULL, MODULENAME, "UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ wchar_t buffer[40];
+ _itow_s(count, buffer, 10);
+ SetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer);
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_LOAD_ALL:
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_LOAD_NUMBER:
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_ENABLE_RTL:
+ case IDC_SHOW_LAST_FIRST:
+ case IDC_EVENTS_COUNT:
+ case IDC_LOAD_BACKGROUND:
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ long count;
+ if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL))
+ count = 0;
+ else {
+ wchar_t buffer[1024];
+ GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, _countof(buffer));
+ count = _wtol(buffer);
+ count = (count < 0) ? 0 : count;
+ }
+ db_set_b(NULL, MODULENAME, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
+ db_set_b(NULL, MODULENAME, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
+ db_set_b(NULL, MODULENAME, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
+ db_set_dw(NULL, MODULENAME, "EventsToLoad", count);
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+int OnOptionsInitialize(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 100000000;
+ odp.szTitle.w = LPGENW("History");
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORY);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/IEHistory/src/dlgHandlers.h b/plugins/IEHistory/src/dlgHandlers.h index 01d39a1351..03db94dd6e 100644 --- a/plugins/IEHistory/src/dlgHandlers.h +++ b/plugins/IEHistory/src/dlgHandlers.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_HISTORY_DLG_HANDLERS_H #define M_HISTORY_DLG_HANDLERS_H -#include "stdafx.h" - #define LOAD_IN_BACKGROUND 0x00000001 struct HistoryWindowData{ @@ -44,7 +42,6 @@ struct SearchWindowData{ }; INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); #endif //M_HISTORY_DLG_HANDLERS_H diff --git a/plugins/IEHistory/src/events.cpp b/plugins/IEHistory/src/events.cpp deleted file mode 100644 index 30b80dbf23..0000000000 --- a/plugins/IEHistory/src/events.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -IEView history viewer plugin for Miranda IM - -Copyright © 2005-2006 Cristian Libotean - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" -#include "events.h" - -HANDLE hOptionsInitialize; - -int HookEvents() -{ - hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); - return 0; -} - -int UnhookEvents() -{ - UnhookEvent(hOptionsInitialize); - return 0; -} - -int OnOptionsInitialize(WPARAM wParam, LPARAM) -{ - OPTIONSDIALOGPAGE odp = {}; - odp.position = 100000000; - odp.szTitle.w = LPGENW("History"); - odp.pfnDlgProc = OptionsDlgProc; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORY); - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; - g_plugin.addOptions(wParam, &odp); - return 0; -} diff --git a/plugins/IEHistory/src/events.h b/plugins/IEHistory/src/events.h deleted file mode 100644 index abfa66ac42..0000000000 --- a/plugins/IEHistory/src/events.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -IEView history viewer plugin for Miranda IM - -Copyright © 2005-2006 Cristian Libotean - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef M_HISTORY_HOOKED_EVENTS_H -#define M_HISTORY_HOOKED_EVENTS_H - -#include "stdafx.h" - -extern HANDLE hOptionsInitialize; - -int HookEvents(); -int UnhookEvents(); - -int OnOptionsInitialize(WPARAM wParam, LPARAM lParam); - -#endif //M_HISTORY_HOOKED_EVENTS_H diff --git a/plugins/IEHistory/src/services.h b/plugins/IEHistory/src/services.h index c1048ce9fc..a1b7dfb50d 100644 --- a/plugins/IEHistory/src/services.h +++ b/plugins/IEHistory/src/services.h @@ -21,11 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_IEHISTORY_PROVIDED_SERVICES_H #define M_IEHISTORY_PROVIDED_SERVICES_H -#include "stdafx.h" #include "dlgHandlers.h" int InitServices(); +int OnOptionsInitialize(WPARAM, LPARAM); + INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM lParam); #endif //M_IEHISTORY_PROVIDED_SERVICES_H diff --git a/plugins/IEHistory/src/stdafx.h b/plugins/IEHistory/src/stdafx.h index f073c987a4..3d182815ff 100644 --- a/plugins/IEHistory/src/stdafx.h +++ b/plugins/IEHistory/src/stdafx.h @@ -53,7 +53,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h" #include "utils.h" -#include "events.h" #include "dlgHandlers.h" #define _strcat strcat_s diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index fe614d542d..deac722df5 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -121,8 +121,6 @@ VOID fill_filter(void) int onModulesLoaded(WPARAM, LPARAM)
{
- HookEvent(ME_OPT_INITIALISE, onOptInitialise);
-
fill_filter();
// Set initial value for all contacts
@@ -153,11 +151,11 @@ int CMPlugin::Load() {
HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+ HookEvent(ME_OPT_INITIALISE, onOptInitialise);
//IcoLib support
g_plugin.registerIcon(LPGEN("Ignore State"), iconList);
hExtraIcon = ExtraIcon_RegisterIcolib("ignore", LPGEN("Ignore State"), "ignore_full");
-
return 0;
}
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 6fd274071b..b243cd9c43 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -911,10 +911,6 @@ static int ModulesLoaded(WPARAM, LPARAM) hThread = mir_forkthread(FlashThreadFunction);
- HookEvent(ME_MC_ENABLED, OnMetaChanged);
- HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
- HookEvent(ME_OPT_INITIALISE, InitializeOptions);
-
CreateServiceFunction(MS_KBDNOTIFY_ENABLE, EnableService);
CreateServiceFunction(MS_KBDNOTIFY_DISABLE, DisableService);
CreateServiceFunction(MS_KBDNOTIFY_STARTBLINK, StartBlinkService);
@@ -929,6 +925,9 @@ int CMPlugin::Load() GetWindowsVersion();
OpenKeyboardDevice();
+ HookEvent(ME_MC_ENABLED, OnMetaChanged);
+ HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
+ HookEvent(ME_OPT_INITIALISE, InitializeOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
return 0;
diff --git a/plugins/MirFox/src/MirandaInterface.cpp b/plugins/MirFox/src/MirandaInterface.cpp index f72400a2f6..bb5242f90a 100644 --- a/plugins/MirFox/src/MirandaInterface.cpp +++ b/plugins/MirFox/src/MirandaInterface.cpp @@ -5,11 +5,6 @@ // Miranda - handle from DllMain
CMPlugin g_plugin;
-//Miranda - Langpack
-
-//Miranda - HANDLE to hooked protocols ACK
-HANDLE hProtoAck;
-
//popup classes handles
HANDLE hPopupNotify;
HANDLE hPopupError;
@@ -136,11 +131,11 @@ static int OnShutdown(WPARAM, LPARAM) int CMPlugin::Load()
{
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_PROTO_ACK, MirandaUtils::onProtoAck);
HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
- hProtoAck = HookEvent(ME_PROTO_ACK, MirandaUtils::onProtoAck);
-
// Ensure that the common control DLL is loaded. needed to use ICC_LISTVIEW_CLASSES control in options TODO move to InitOptions();?
INITCOMMONCONTROLSEX icex = { 0 };
icex.dwSize = sizeof(icex);
@@ -150,7 +145,6 @@ int CMPlugin::Load() mirfoxMiranda.getMirfoxData().Plugin_Terminated = false;
mirfoxMiranda.getMirfoxData().setPluginState(MFENUM_PLUGIN_STATE_INIT);
mirfoxMiranda.onMirandaInterfaceLoad();
- InitOptions();
if (mirfoxMiranda.getMirfoxData().getPluginState() != MFENUM_PLUGIN_STATE_ERROR)
mirfoxMiranda.getMirfoxData().setPluginState(MFENUM_PLUGIN_STATE_WORK);
@@ -166,7 +160,7 @@ int CMPlugin::Unload() // wait for csmThread, msgQueueThread and userActionThread's end
mirfoxMiranda.getMirfoxData().Plugin_Terminated = true;
- UnhookEvent(hProtoAck);
+
int counter = 0;
const int UNLOAD_WAIT_TIME = 50; //[ms]
const int MAX_UNLOAD_WAIT_COUNTER = 10; //10 * 50ms = 0,5s
@@ -180,6 +174,5 @@ int CMPlugin::Unload() MFLogger::getInstance()->log(L"Unload: last log");
mirfoxMiranda.onMirandaInterfaceUnload();
- DeinitOptions();
return 0;
}
diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index 34991bb4b3..b316f3222b 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -667,8 +667,8 @@ INT_PTR CALLBACK DlgProcOpts_Tab3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM *
* called from: options.cpp.InitOptions()
*/
-int OptInit(WPARAM wParam, LPARAM) {
-
+int OptInit(WPARAM wParam, LPARAM)
+{
OPTIONSDIALOGPAGE odp = {};
odp.position = -790000000;
odp.szTitle.a = LPGEN(PLUGIN_OPTIONS_NAME);
@@ -694,23 +694,3 @@ int OptInit(WPARAM wParam, LPARAM) { g_plugin.addOptions(wParam, &odp);
return 0;
}
-
-
-
-HANDLE hEventOptInit;
-
-/**
- *
- * called from: MirfoxMiranda.cpp.Load(PLUGINLINK *link)
- */
-void InitOptions() {
- hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
-}
-
-/**
- *
- * called from: MirfoxMiranda.cpp.Unload()
- */
-void DeinitOptions() {
- UnhookEvent(hEventOptInit);
-}
diff --git a/plugins/MirFox/src/MirandaOptions.h b/plugins/MirFox/src/MirandaOptions.h index 8b68c25a53..02db76c1ce 100644 --- a/plugins/MirFox/src/MirandaOptions.h +++ b/plugins/MirFox/src/MirandaOptions.h @@ -3,8 +3,6 @@ #include "MirandaInterface.h"
-void InitOptions();
-
-void DeinitOptions();
+int OptInit(WPARAM, LPARAM);
#endif //#ifndef _MIRANDA_OPTIONS_INC
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index a825e79c61..b4738b3193 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -105,11 +105,6 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) bReadMirandaDirAndPath();
UpdateFileToColWidth();
- HookEvent(ME_DB_EVENT_ADDED, nExportEvent);
- HookEvent(ME_DB_EVENT_EDITED, nExportEvent);
- HookEvent(ME_DB_CONTACT_DELETED, nContactDeleted);
- HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
-
if (!g_bReplaceHistory) {
CMenuItem mi(&g_plugin);
SET_UID(mi, 0x701c543, 0xd078, 0x41dd, 0x95, 0xe3, 0x96, 0x49, 0x8a, 0x72, 0xc7, 0x50);
@@ -139,6 +134,10 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) int CMPlugin::Load()
{
+ HookEvent(ME_DB_EVENT_ADDED, nExportEvent);
+ HookEvent(ME_DB_EVENT_EDITED, nExportEvent);
+ HookEvent(ME_DB_CONTACT_DELETED, nContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
nMaxLineWidth = getWord("MaxLineWidth", nMaxLineWidth);
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index bd4c42fd95..e493b38fdd 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -131,14 +131,15 @@ static int MainUninit(WPARAM, LPARAM) int CMPlugin::Load()
{
+ g_plugin.registerIcon(LPGEN("My details"), iconList);
+
// Hook event to load messages and show first one
HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, MainUninit);
+ HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
// Options
- InitOptions();
-
- g_plugin.registerIcon(LPGEN("My details"), iconList);
+ LoadOptions();
// Register services
CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname);
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index e1cd488025..77b7c0dfb4 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -171,10 +171,3 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp);
return 0;
}
-
-void InitOptions()
-{
- LoadOptions();
-
- HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
-}
diff --git a/plugins/MyDetails/src/options.h b/plugins/MyDetails/src/options.h index 5dce0b8677..38ef790687 100644 --- a/plugins/MyDetails/src/options.h +++ b/plugins/MyDetails/src/options.h @@ -70,7 +70,7 @@ extern Options opts; // Initializations needed by options
-void InitOptions();
+int InitOptionsCallback(WPARAM, LPARAM);
// Loads the options from DB
// It don't need to be called, except in some rare cases
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 402fe90431..e6daa9821e 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -606,13 +606,7 @@ int MirandaLoaded(WPARAM, LPARAM) CreateServiceFunction(MS_AWAYSYS_SETSTATUSMODE, SetStatusMode);
HookEvent(ME_TTB_MODULELOADED, Create_TopToolbar);
- HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
- HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChanged);
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange); // for compatibility with StartupStatus and AdvancedAutoAway
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
- HookEvent(ME_DB_EVENT_FILTER_ADD, MsgEventAdded);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
- HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
HookEvent(ME_IDLE_CHANGED, IdleChangeEvent);
g_hReadWndList = WindowList_Create();
@@ -703,6 +697,12 @@ int MirandaLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
+ HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
+ HookEvent(ME_DB_EVENT_FILTER_ADD, MsgEventAdded);
+ HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
+ HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
g_plugin.registerIcon(MODULENAME, iconList, "nas");
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 8407d2bb96..194e7f6f94 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -16,6 +16,22 @@ #include "stdafx.h" +int GpgOptInit(WPARAM, LPARAM); +int OnPreBuildContactMenu(WPARAM, LPARAM); + +INT_PTR RecvMsgSvc(WPARAM, LPARAM); +INT_PTR SendMsgSvc(WPARAM, LPARAM); +INT_PTR onSendFile(WPARAM, LPARAM); + +int HookSendMsg(WPARAM, LPARAM); +int GetJabberInterface(WPARAM, LPARAM); +int onProtoAck(WPARAM, LPARAM); +int onWindowEvent(WPARAM, LPARAM); +int onIconPressed(WPARAM, LPARAM); + +void InitCheck(); +void FirstRun(); + // global variables CMPlugin g_plugin; @@ -88,21 +104,6 @@ void init_vars() static int OnModulesLoaded(WPARAM, LPARAM) { - int GpgOptInit(WPARAM, LPARAM); - int OnPreBuildContactMenu(WPARAM, LPARAM); - - INT_PTR RecvMsgSvc(WPARAM, LPARAM); - INT_PTR SendMsgSvc(WPARAM, LPARAM); - INT_PTR onSendFile(WPARAM, LPARAM); - - int HookSendMsg(WPARAM, LPARAM); - int GetJabberInterface(WPARAM, LPARAM); - int onProtoAck(WPARAM, LPARAM); - int onWindowEvent(WPARAM, LPARAM); - int onIconPressed(WPARAM, LPARAM); - - void InitCheck(); - void FirstRun(); FirstRun(); if (!db_get_b(NULL, MODULENAME, "FirstRun", 1)) InitCheck(); @@ -120,17 +121,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) sid.szTooltip = LPGEN("GPG Turn on encryption"); Srmm_AddIcon(&sid, &g_plugin); - if (globals.bJabberAPI) + if (globals.bJabberAPI) { GetJabberInterface(0, 0); - - HookEvent(ME_OPT_INITIALISE, GpgOptInit); - HookEvent(ME_DB_EVENT_FILTER_ADD, HookSendMsg); - if (globals.bJabberAPI) HookEvent(ME_PROTO_ACCLISTCHANGED, GetJabberInterface); - - HookEvent(ME_PROTO_ACK, onProtoAck); - - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu); + } HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent); HookEvent(ME_MSG_ICONPRESSED, onIconPressed); @@ -146,6 +140,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) int CMPlugin::Load() { + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu); + HookEvent(ME_DB_EVENT_FILTER_ADD, HookSendMsg); + HookEvent(ME_OPT_INITIALISE, GpgOptInit); + HookEvent(ME_PROTO_ACK, onProtoAck); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); init_vars(); diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 8fd739e37e..5ed96397cf 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -268,10 +268,10 @@ int CMPlugin::Load() InitCommonControlsEx(&icex);
InitIcons();
- InitOptions();
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_DB_EVENT_ADDED, OnDatabaseEventAdd);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
CreateServiceFunction(MS_NOHISTORY_TOGGLE, ServiceToggle);
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index 65f7728bab..6c05f824ee 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -229,8 +229,3 @@ int OptInit(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp);
return 0;
}
-
-void InitOptions()
-{
- HookEvent(ME_OPT_INITIALISE, OptInit);
-}
diff --git a/plugins/NoHistory/src/options.h b/plugins/NoHistory/src/options.h index c2eba8f246..921661cd7a 100644 --- a/plugins/NoHistory/src/options.h +++ b/plugins/NoHistory/src/options.h @@ -3,6 +3,6 @@ extern DWORD event_timeout;
-void InitOptions();
+int OptInit(WPARAM, LPARAM);
#endif
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 9255fcd318..317127c8b7 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -3,11 +3,6 @@ CMPlugin g_plugin;
HINSTANCE hmiranda = nullptr;
-HANDLE hkOptInit = nullptr;
-HANDLE hkTopToolbarInit = nullptr;
-HANDLE hkModulesLoaded = nullptr;
-HANDLE hkFontChange = nullptr;
-HANDLE hkColorChange = nullptr;
HMODULE hRichedDll = nullptr;
extern TREEELEMENT *g_Stickies;
@@ -144,8 +139,6 @@ int OnTopToolBarInit(WPARAM, LPARAM) ttb.pszService = MODULENAME"/MenuCommandNewReminder";
ttb.name = ttb.pszTooltipUp = LPGEN("Add New Reminder");
g_plugin.addTTB(&ttb);
-
- UnhookEvent(hkTopToolbarInit);
return 0;
}
@@ -251,9 +244,7 @@ int OnModulesLoaded(WPARAM, LPARAM) addMenuItem(mi);
// register misc
- hkOptInit = HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
- hkTopToolbarInit = HookEvent("TopToolBar/ModuleLoaded", OnTopToolBarInit);
- UnhookEvent(hkModulesLoaded);
+ HookEvent("TopToolBar/ModuleLoaded", OnTopToolBarInit);
// init vars and load all data
InitSettings();
@@ -284,7 +275,8 @@ int CMPlugin::Load() InitServices();
WS_Init();
- hkModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
InitIcons();
return 0;
@@ -302,11 +294,6 @@ int CMPlugin::Unload() WS_CleanUp();
TermSettings();
- UnhookEvent(hkFontChange);
- UnhookEvent(hkColorChange);
-
- UnhookEvent(hkOptInit);
-
IcoLib_ReleaseIcon(g_hReminderIcon);
DeleteObject(hBodyFont);
DeleteObject(hCaptionFont);
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 6b03a5493e..6e87a570be 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -3,9 +3,6 @@ // min allowed alpha (don't want 0 because it's a waste of resources as well as might confuse user)
#define MIN_ALPHA 30
-extern HANDLE hkFontChange;
-extern HANDLE hkColorChange;
-
BOOL g_CloseAfterAddReminder, g_UseDefaultPlaySound;
HICON g_hReminderIcon = nullptr;
@@ -268,8 +265,8 @@ void RegisterFontServiceFonts() g_plugin.addColor(&colorid);
}
- hkFontChange = HookEvent(ME_FONT_RELOAD, FS_FontsChanged);
- hkColorChange = HookEvent(ME_COLOUR_RELOAD, FS_ColorChanged);
+ HookEvent(ME_FONT_RELOAD, FS_FontsChanged);
+ HookEvent(ME_COLOUR_RELOAD, FS_ColorChanged);
}
void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour)
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index a9c4c801e6..8ccc42c19b 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -88,7 +88,6 @@ int CMPlugin::Load() HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
-
return 0;
}
diff --git a/plugins/QuickContacts/src/dialog.cpp b/plugins/QuickContacts/src/dialog.cpp index 0d6aecf812..ff03b01b4a 100644 --- a/plugins/QuickContacts/src/dialog.cpp +++ b/plugins/QuickContacts/src/dialog.cpp @@ -132,7 +132,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) BOOL metacontactsEnabled = db_mc_isEnabled(); // Read last-sent-to contact from db and set handle as window-userdata - HANDLE hlastsent = (HANDLE)db_get_dw(NULL, MODULENAME, "LastSentTo", -1); + HANDLE hlastsent = (HANDLE)g_plugin.getDword("LastSentTo", -1); SetWindowLongPtr(hwndMain, GWLP_USERDATA, (LONG_PTR)hlastsent); // enumerate all contacts and write them to the array @@ -160,7 +160,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) char setting[128]; mir_snprintf(setting, "ShowOffline%s", pszProto); - if (!db_get_b(NULL, MODULENAME, setting, FALSE)) + if (!g_plugin.getByte(setting, FALSE)) continue; // Check if proto offline @@ -179,7 +179,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) char setting[128]; mir_snprintf(setting, "ShowOffline%s", META_PROTO); - if (db_get_b(NULL, MODULENAME, setting, FALSE)) + if (g_plugin.getByte(setting, FALSE)) continue; } } @@ -530,8 +530,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA LoadContacts(hwndDlg, FALSE); EnableButtons(hwndDlg, NULL); - if (db_get_b(NULL, MODULENAME, "EnableLastSentTo", 0)) { - int pos = GetItemPos((MCONTACT)db_get_dw(NULL, MODULENAME, "LastSentTo", -1)); + if (g_plugin.getByte("EnableLastSentTo", 0)) { + int pos = GetItemPos(g_plugin.getDword("LastSentTo", -1)); if (pos != -1) { SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETCURSEL, (WPARAM)pos, 0); EnableButtons(hwndDlg, contacts[pos]->hcontact); @@ -559,7 +559,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Clist_ContactDoubleClicked(hContact); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); } break; @@ -578,7 +578,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_MSG_SENDMESSAGEW, hContact, 0); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); break; } @@ -599,7 +599,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_FILE_SENDFILE, hContact, 0); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); } break; @@ -620,7 +620,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_URL_SENDURL, hContact, 0); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); } break; @@ -641,7 +641,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); } break; @@ -662,7 +662,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0); - db_set_dw(NULL, MODULENAME, "LastSentTo", hContact); + g_plugin.setDword("LastSentTo", hContact); SendMessage(hwndDlg, WM_CLOSE, 0, 0); } break; @@ -692,7 +692,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Clist_MenuProcessCommand(LOWORD(ret), MPCF_CONTACTMENU, hContact); } - db_set_dw(NULL, MODULENAME, "LastSentTo", (DWORD)hContact); + g_plugin.setDword("LastSentTo", (DWORD)hContact); } break; diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp index e0b59efd5f..43cb95c914 100644 --- a/plugins/QuickContacts/src/options.cpp +++ b/plugins/QuickContacts/src/options.cpp @@ -22,54 +22,21 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////////////////
-HANDLE hOptHook = nullptr;
-
-
Options opts;
-static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-
-
// Functions //////////////////////////////////////////////////////////////////////////////////////
-
// Initializations needed by options
void LoadOptions()
{
- opts.last_sent_enable = db_get_b(NULL, MODULENAME, "EnableLastSentTo", TRUE);
- opts.last_sent_msg_type = db_get_w(NULL, MODULENAME, "MsgTypeRec", TYPE_GLOBAL);
- opts.hide_from_offline_proto = db_get_b(NULL, MODULENAME, "HideOfflineFromOfflineProto", TRUE);
- opts.group_append = db_get_b(NULL, MODULENAME, "AppendGroupName", FALSE);
- opts.group_column = db_get_b(NULL, MODULENAME, "GroupColumn", FALSE);
- opts.group_column_left = db_get_b(NULL, MODULENAME, "GroupColumnLeft", FALSE);
- opts.hide_subcontacts = db_get_b(NULL, MODULENAME, "HideSubcontacts", TRUE);
- opts.keep_subcontacts_from_offline = db_get_b(NULL, MODULENAME, "KeepSubcontactsFromOffline", TRUE);
-}
-
-int InitOptionsCallback(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.szGroup.w = LPGENW("Contacts");
- odp.szTitle.w = LPGENW("Quick Contacts");
- odp.pfnDlgProc = OptionsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
- odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
- g_plugin.addOptions(wParam, &odp);
- return 0;
-}
-
-void InitOptions()
-{
- LoadOptions();
-
- hOptHook = HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
-}
-
-// Deinitializations needed by options
-void DeInitOptions()
-{
- UnhookEvent(hOptHook);
+ opts.last_sent_enable = g_plugin.getByte("EnableLastSentTo", TRUE);
+ opts.last_sent_msg_type = g_plugin.getWord("MsgTypeRec", TYPE_GLOBAL);
+ opts.hide_from_offline_proto = g_plugin.getByte("HideOfflineFromOfflineProto", TRUE);
+ opts.group_append = g_plugin.getByte("AppendGroupName", FALSE);
+ opts.group_column = g_plugin.getByte("GroupColumn", FALSE);
+ opts.group_column_left = g_plugin.getByte("GroupColumnLeft", FALSE);
+ opts.hide_subcontacts = g_plugin.getByte("HideSubcontacts", TRUE);
+ opts.keep_subcontacts_from_offline = g_plugin.getByte("KeepSubcontactsFromOffline", TRUE);
}
// Options page
@@ -130,3 +97,15 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return ret;
}
+
+int InitOptionsCallback(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.szGroup.w = LPGENW("Contacts");
+ odp.szTitle.w = LPGENW("Quick Contacts");
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/QuickContacts/src/options.h b/plugins/QuickContacts/src/options.h index 9f9f5083c5..ca311b3b3d 100644 --- a/plugins/QuickContacts/src/options.h +++ b/plugins/QuickContacts/src/options.h @@ -43,17 +43,10 @@ extern Options opts; // Initializations needed by options
-void InitOptions();
-
-// Deinitializations needed by options
-void DeInitOptions();
-
+int InitOptionsCallback(WPARAM, LPARAM);
// Loads the options from DB
// It don't need to be called, except in some rare cases
void LoadOptions();
-
-
-
#endif // __OPTIONS_H__
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 99e8b69857..e6039dc83e 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -24,10 +24,6 @@ Boston, MA 02111-1307, USA. CMPlugin g_plugin;
-HANDLE hModulesLoaded = nullptr;
-HANDLE hEventAdded = nullptr;
-HANDLE hHotkeyPressed = nullptr;
-
INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam);
void FreeContacts();
@@ -57,8 +53,6 @@ CMPlugin::CMPlugin() : static int ModulesLoaded(WPARAM, LPARAM)
{
- InitOptions();
-
// Get number of protocols
Proto_EnumAccounts(&opts.num_protos, nullptr);
@@ -139,22 +133,25 @@ static int EventAdded(WPARAM wparam, LPARAM hDbEvent) DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & DBEF_SENT) || (dbei.flags & DBEF_READ)
- || !db_get_b(NULL, MODULENAME, "EnableLastSentTo", 0)
- || db_get_w(NULL, MODULENAME, "MsgTypeRec", TYPE_GLOBAL) != TYPE_GLOBAL)
+ || !g_plugin.getByte("EnableLastSentTo", 0)
+ || g_plugin.getWord("MsgTypeRec", TYPE_GLOBAL) != TYPE_GLOBAL)
return 0;
- db_set_dw(NULL, MODULENAME, "LastSentTo", (UINT_PTR)wparam);
+ g_plugin.setDword("LastSentTo", (UINT_PTR)wparam);
return 0;
}
int CMPlugin::Load()
{
+ LoadOptions();
+
+ // services
CreateServiceFunction(MS_QC_SHOW_DIALOG, ShowDialog);
// hooks
- hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- hEventAdded = HookEvent(ME_DB_EVENT_ADDED, EventAdded);
-
+ HookEvent(ME_DB_EVENT_ADDED, EventAdded);
+ HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
}
@@ -163,10 +160,5 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
FreeContacts();
-
- DeInitOptions();
-
- UnhookEvent(hModulesLoaded);
- UnhookEvent(hEventAdded);
return 0;
}
diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index a9a530efdd..e43b9b3fcb 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -258,7 +258,6 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) static int PluginInit(WPARAM, LPARAM)
{
g_bStartup = 1;
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed);
HookEvent(ME_MSG_WINDOWPOPUP, InputMenuPopup);
@@ -279,5 +278,6 @@ int CMPlugin::Load() {
HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
return 0;
}
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 9f40d42038..74870255db 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -30,7 +30,6 @@ int iNumber = 0; int OnModulesLoaded(WPARAM, LPARAM)
{
- HookEvent(ME_OPT_INITIALISE, OnOptInitialized);
HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
g_plugin.registerIcon("TabSRMM/Quick Replies", iconList);
diff --git a/plugins/QuickReplies/src/quickreplies.cpp b/plugins/QuickReplies/src/quickreplies.cpp index 7ca1696a00..4df1d2d9a3 100644 --- a/plugins/QuickReplies/src/quickreplies.cpp +++ b/plugins/QuickReplies/src/quickreplies.cpp @@ -46,5 +46,6 @@ CMPlugin::CMPlugin() : int CMPlugin::Load()
{
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OnOptInitialized);
return 0;
}
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 803ef766af..9bd92063ec 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -18,12 +18,6 @@ int LoadServices(void) int LoadModules(void)
{
- HookEvent(ME_OPT_INITIALISE, OptInitialise);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SmsRebuildContactMenu);
- HookEvent(ME_PROTO_ACK, handleAckSMS);
- HookEvent(ME_DB_EVENT_ADDED, handleNewMessage);
- HookEvent(ME_PROTO_ACCLISTCHANGED, RefreshAccountList);
-
char szServiceFunction[MAX_PATH];
mir_snprintf(szServiceFunction, "%s%s", MODULENAME, SMS_SEND);
diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 426c714da3..5002b87b3d 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -114,6 +114,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) int CMPlugin::Load()
{
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SmsRebuildContactMenu);
+ HookEvent(ME_DB_EVENT_ADDED, handleNewMessage);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
+ HookEvent(ME_PROTO_ACK, handleAckSMS);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, RefreshAccountList);
HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN,OnPreShutdown);
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 35bd01a72d..36e6f2067b 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -206,11 +206,6 @@ static int onModulesLoaded(WPARAM, LPARAM) g_IEC[i] = (HANDLE)-1;
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
-
- // hook init options
- HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
- if (bPopupExists)
- HookEvent(ME_OPT_INITIALISE, onRegisterPopOptions);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
@@ -323,6 +318,7 @@ int CMPlugin::Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, onShutdown);
HookEvent(ME_SYSTEM_MODULELOAD, onModuleLoad);
HookEvent(ME_SYSTEM_MODULEUNLOAD, onModuleLoad);
+ HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled");
g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established");
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 89fce2390d..02e0eb4e02 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1684,13 +1684,21 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) return TRUE;
}
-int onRegisterOptions(WPARAM wParam, LPARAM)
+int onRegisterOptions(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = {};
+ odp.szTitle.a = MODULENAME;
+
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSTAB);
- odp.szTitle.a = (char*)MODULENAME;
odp.szGroup.a = LPGEN("Services");
odp.pfnDlgProc = OptionsDlgProc;
g_plugin.addOptions(wParam, &odp);
+
+ if (bPopupExists) {
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP);
+ odp.szGroup.a = LPGEN("Popups");
+ odp.pfnDlgProc = PopOptionsDlgProc;
+ g_plugin.addOptions(wParam, &odp);
+ }
return 0;
}
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index f9288bdfac..f7dd998e49 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -1,5 +1,26 @@ #include "commonheaders.h"
+static void RefreshPopupOptionsDlg(HWND hec, HWND hdc, HWND hss, HWND hsr, HWND hks, HWND hkr)
+{
+ // ec checkbox
+ SendMessage(hec, BM_SETCHECK, db_get_b(0, MODULENAME, "ec", 1), 0L);
+
+ // dc checkbox
+ SendMessage(hdc, BM_SETCHECK, db_get_b(0, MODULENAME, "dc", 1), 0L);
+
+ // ks checkbox
+ SendMessage(hks, BM_SETCHECK, db_get_b(0, MODULENAME, "ks", 1), 0L);
+
+ // kr checkbox
+ SendMessage(hkr, BM_SETCHECK, db_get_b(0, MODULENAME, "kr", 1), 0L);
+
+ //ss checkbox
+ SendMessage(hss, BM_SETCHECK, db_get_b(0, MODULENAME, "ss", 0), 0L);
+
+ //sr checkbox
+ SendMessage(hsr, BM_SETCHECK, db_get_b(0, MODULENAME, "sr", 0), 0L);
+}
+
INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
char getTimeout[5];
@@ -137,37 +158,3 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l }
return TRUE;
}
-
-void RefreshPopupOptionsDlg(HWND hec, HWND hdc, HWND hss, HWND hsr, HWND hks, HWND hkr)
-{
- // ec checkbox
- SendMessage(hec, BM_SETCHECK, db_get_b(0, MODULENAME, "ec", 1), 0L);
-
- // dc checkbox
- SendMessage(hdc, BM_SETCHECK, db_get_b(0, MODULENAME, "dc", 1), 0L);
-
- // ks checkbox
- SendMessage(hks, BM_SETCHECK, db_get_b(0, MODULENAME, "ks", 1), 0L);
-
- // kr checkbox
- SendMessage(hkr, BM_SETCHECK, db_get_b(0, MODULENAME, "kr", 1), 0L);
-
- //ss checkbox
- SendMessage(hss, BM_SETCHECK, db_get_b(0, MODULENAME, "ss", 0), 0L);
-
- //sr checkbox
- SendMessage(hsr, BM_SETCHECK, db_get_b(0, MODULENAME, "sr", 0), 0L);
-}
-
-int onRegisterPopOptions(WPARAM wParam, LPARAM)
-{
- if (bPopupExists) {
- OPTIONSDIALOGPAGE odp = {};
- odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP);
- odp.szTitle.a = (char*)MODULENAME;
- odp.szGroup.a = LPGEN("Popups");
- odp.pfnDlgProc = PopOptionsDlgProc;
- g_plugin.addOptions(wParam, &odp);
- }
- return 0;
-}
diff --git a/plugins/SecureIM/src/popupOptions.h b/plugins/SecureIM/src/popupOptions.h index 22d3453adc..ae6dff7c66 100644 --- a/plugins/SecureIM/src/popupOptions.h +++ b/plugins/SecureIM/src/popupOptions.h @@ -2,7 +2,5 @@ #define __POPUP_OPTIONS__
INT_PTR CALLBACK PopOptionsDlgProc(HWND,UINT,WPARAM,LPARAM);
-void RefreshPopupOptionsDlg(HWND,HWND,HWND,HWND,HWND,HWND);
-int onRegisterPopOptions(WPARAM,LPARAM);
#endif
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index cf0b3bebcf..defae68111 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -745,7 +745,6 @@ static void CALLBACK LaunchSessions() static int PluginInit(WPARAM, LPARAM)
{
HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowEvent);
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_TTB_MODULELOADED, CreateButtons);
// Hotkeys
@@ -846,6 +845,7 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, SessionPreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
// Icons
g_plugin.registerIcon(MODULENAME, iconList);
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index a4883dfeeb..4b96392d79 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -260,7 +260,7 @@ int CMPlugin::Load() mi.pszService = MODULENAME"/ToggleAutoanswer";
hToggle = Menu_AddContactMenuItem(&mi);
- //add hook
+ // add hook
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_DB_EVENT_ADDED, addEvent);
HookEvent(ME_SYSTEM_MODULESLOADED, CheckDefaults);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 2e89bfffdd..95fc4dcff0 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1562,7 +1562,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) RegisterHotkey();
- HookEvent(ME_OPT_INITIALISE, InitOptions);
h_statusmodechange = HookEvent(ME_CLIST_STATUSMODECHANGE, ChangeStatusMessage);
HookEvent(ME_PROTO_ACK, ProcessProtoAck);
HookEvent(ME_IDLE_CHANGED, OnIdleChanged);
@@ -1676,6 +1675,8 @@ int CMPlugin::Load() accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+
+ HookEvent(ME_OPT_INITIALISE, InitOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 5c48d8a3f5..cb0fb0874e 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -1,6 +1,5 @@ #include "stdafx.h"
-HANDLE hOptInitialize, hModulesLoaded, hDBContactAdded, hDBEventAdded, hDBEventFilterAdd;
time_t last_queue_check = 0;
CMPlugin g_plugin;
@@ -28,12 +27,6 @@ CMPlugin::CMPlugin() : extern int OnOptInitialize(WPARAM wParam, LPARAM lParam);
-int OnModulesLoaded(WPARAM, LPARAM)
-{
- hOptInitialize = HookEvent(ME_OPT_INITIALISE, OnOptInitialize);
- return 0;
-}
-
int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = wParam;
@@ -515,8 +508,8 @@ int CMPlugin::Load() }
}
- hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- hDBEventFilterAdd = HookEvent(ME_DB_EVENT_FILTER_ADD, OnDBEventFilterAdd);
+ HookEvent(ME_DB_EVENT_FILTER_ADD, OnDBEventFilterAdd);
+ HookEvent(ME_OPT_INITIALISE, OnOptInitialize);
return 0;
}
@@ -525,10 +518,5 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
RemoveNotOnListSettings();
- UnhookEvent(hOptInitialize);
- UnhookEvent(hModulesLoaded);
- UnhookEvent(hDBContactAdded);
- UnhookEvent(hDBEventAdded);
- UnhookEvent(hDBEventFilterAdd);
return 0;
}
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 7fafa944e8..8188bad73a 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -73,13 +73,6 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) return 0;
}
-void InitOptions()
-{
- LoadOptions();
-
- HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
-}
-
void LoadOptions()
{
LoadOpts(optionsControls, _countof(optionsControls), MODULENAME);
diff --git a/plugins/SpellChecker/src/options.h b/plugins/SpellChecker/src/options.h index 8d699d4adf..5577c8fb3a 100644 --- a/plugins/SpellChecker/src/options.h +++ b/plugins/SpellChecker/src/options.h @@ -50,8 +50,7 @@ struct Options extern Options opts;
-// Initializations needed by options
-void InitOptions();
+int InitOptionsCallback(WPARAM, LPARAM);
// Loads the options from DB
// It don't need to be called, except in some rare cases
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index f5ce69d0a7..348946325e 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -118,8 +118,6 @@ static int ModulesLoaded(WPARAM, LPARAM) } else flagsDllFolder = Utils_ReplaceVarsW(FLAGS_DLL_FOLDER); - InitOptions(); - GetAvaibleDictionaries(languages, dictionariesFolder, customDictionariesFolder); LoadOptions(); @@ -231,6 +229,9 @@ int CMPlugin::Load() // hooks HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); + HookEvent(ME_OPT_INITIALISE, InitOptionsCallback); + + LoadOptions(); CreateServiceFunction(MS_SPELLCHECKER_ADD_RICHEDIT, AddContactTextBoxService); CreateServiceFunction(MS_SPELLCHECKER_REMOVE_RICHEDIT, RemoveContactTextBoxService); diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 89c9c2ec2d..08b15eb9b6 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -213,10 +213,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) }
}
- // Options initialize hook
- HookEvent(ME_OPT_INITIALISE, OptInit);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, PlugDisableHook);
-
// Service to call splash
CreateServiceFunction(MS_SHOWSPLASH, ShowSplashService);
@@ -230,10 +226,11 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) int CMPlugin::Load()
{
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, PlugDisableHook);
SplashMain();
mir_free(szMirDir);
-
return 0;
}
diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 4cf7cc8cad..71d7e9e2dc 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -131,11 +131,12 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
CreateServiceFunction("/RemoveTmp", (MIRANDASERVICE)RemoveTmp);
- HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
+
HookEvent(ME_DB_EVENT_ADDED, OnDbEventAdded);
HookEvent(ME_DB_EVENT_FILTER_ADD, OnDbEventFilterAdd);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbContactSettingChanged);
HookEvent(ME_OPT_INITIALISE, OnOptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
CMenuItem mi(&g_plugin);
SET_UID(mi, 0x60ce7660, 0x5a5, 0x4234, 0x99, 0xb6, 0x55, 0x21, 0xed, 0xa0, 0xb8, 0x32);
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 5b1c88200d..a4877a57b9 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -114,7 +114,6 @@ void TSAPI LoadIconTheme(); int DbEventIsForMsgWindow(DBEVENTINFO *dbei);
-int TSAPI InitOptions(void);
int TSAPI DbEventIsShown(DBEVENTINFO *dbei);
// custom tab control
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 8730257d47..2170dc0884 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1292,67 +1292,6 @@ static fontSettings[MSGDLGFONTCOUNT + 1]; #define SRFONTSETTINGMODULE FONTMODULE
-static int OptInitialise(WPARAM wParam, LPARAM lParam)
-{
- if (PluginConfig.g_bPopupAvail)
- TN_OptionsInitialize(wParam, lParam);
-
- // message sessions' options
- OPTIONSDIALOGPAGE odpnew = {};
- odpnew.position = 910000000;
- odpnew.flags = ODPF_BOLDGROUPS;
- odpnew.szTitle.a = LPGEN("Message sessions");
-
- odpnew.szTab.a = LPGEN("General");
- odpnew.pDialog = new COptMainDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- odpnew.szTab.a = LPGEN("Tabs and layout");
- odpnew.pDialog = new COptTabbedDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- odpnew.szTab.a = LPGEN("Containers");
- odpnew.pDialog = new COptContainersDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- odpnew.szTab.a = LPGEN("Message log");
- odpnew.pDialog = new COptLogDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- odpnew.szTab.a = LPGEN("Advanced tweaks");
- odpnew.pDialog = new COptAdvancedDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- odpnew.szGroup.a = LPGEN("Message sessions");
- odpnew.szTitle.a = LPGEN("Typing notify");
- odpnew.pDialog = new COptTypingDlg();
- g_plugin.addOptions(wParam, &odpnew);
-
- // skin options
- OPTIONSDIALOGPAGE odp = {};
- odp.flags = ODPF_BOLDGROUPS;
- odp.position = 910000000;
- odp.szGroup.a = LPGEN("Skins");
- odp.szTitle.a = LPGEN("Message window");
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
- odp.szTab.a = LPGEN("Load and apply");
- odp.pfnDlgProc = DlgProcSkinOpts;
- g_plugin.addOptions(wParam, &odp);
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_TABCONFIG);
- odp.szTab.a = LPGEN("Window layout tweaks");
- odp.pfnDlgProc = DlgProcTabConfig;
- g_plugin.addOptions(wParam, &odp);
-
- // popup options
- Popup_Options(wParam);
-
- // group chats
- Chat_Options(wParam);
- return 0;
-}
-
enum
{
CBVT_NONE,
@@ -1463,12 +1402,6 @@ void OptCheckBox_Save(HWND hwnd, OptCheckBox *cb) }
}
-int TSAPI InitOptions(void)
-{
- HookEvent(ME_OPT_INITIALISE, OptInitialise);
- return 0;
-}
-
INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DWORD dwStatusMask = GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -1527,3 +1460,66 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, }
return FALSE;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int OptInitialise(WPARAM wParam, LPARAM lParam)
+{
+ if (PluginConfig.g_bPopupAvail)
+ TN_OptionsInitialize(wParam, lParam);
+
+ // message sessions' options
+ OPTIONSDIALOGPAGE odpnew = {};
+ odpnew.position = 910000000;
+ odpnew.flags = ODPF_BOLDGROUPS;
+ odpnew.szTitle.a = LPGEN("Message sessions");
+
+ odpnew.szTab.a = LPGEN("General");
+ odpnew.pDialog = new COptMainDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ odpnew.szTab.a = LPGEN("Tabs and layout");
+ odpnew.pDialog = new COptTabbedDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ odpnew.szTab.a = LPGEN("Containers");
+ odpnew.pDialog = new COptContainersDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ odpnew.szTab.a = LPGEN("Message log");
+ odpnew.pDialog = new COptLogDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ odpnew.szTab.a = LPGEN("Advanced tweaks");
+ odpnew.pDialog = new COptAdvancedDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ odpnew.szGroup.a = LPGEN("Message sessions");
+ odpnew.szTitle.a = LPGEN("Typing notify");
+ odpnew.pDialog = new COptTypingDlg();
+ g_plugin.addOptions(wParam, &odpnew);
+
+ // skin options
+ OPTIONSDIALOGPAGE odp = {};
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.position = 910000000;
+ odp.szGroup.a = LPGEN("Skins");
+ odp.szTitle.a = LPGEN("Message window");
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
+ odp.szTab.a = LPGEN("Load and apply");
+ odp.pfnDlgProc = DlgProcSkinOpts;
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_TABCONFIG);
+ odp.szTab.a = LPGEN("Window layout tweaks");
+ odp.pfnDlgProc = DlgProcTabConfig;
+ g_plugin.addOptions(wParam, &odp);
+
+ // popup options
+ Popup_Options(wParam);
+
+ // group chats
+ Chat_Options(wParam);
+ return 0;
+}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 2c2374ab9c..b6261b6165 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -37,6 +37,7 @@ HMODULE g_hIconDLL = nullptr, g_hMsftedit; static void UnloadIcons();
+int OptInitialise(WPARAM wParam, LPARAM lParam);
void Chat_AddIcons();
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1051,7 +1052,7 @@ int LoadSendRecvMessageModule(void) Skin = new CSkin;
sendLater = new CSendLater;
- InitOptions();
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
InitAPI();
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 8b0c73ba99..888e848fd3 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -2120,17 +2120,8 @@ int OptInit(WPARAM wParam, LPARAM) return 0;
}
-HANDLE hEventOptInit;
-
-void InitOptions()
-{
- hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
-}
-
void DeinitOptions()
{
- UnhookEvent(hEventOptInit);
-
DIListNode *di_node = opt.diList;
while (opt.diList) {
di_node = opt.diList;
diff --git a/plugins/TipperYM/src/options.h b/plugins/TipperYM/src/options.h index 3161b5e2d4..da77526992 100644 --- a/plugins/TipperYM/src/options.h +++ b/plugins/TipperYM/src/options.h @@ -191,7 +191,8 @@ typedef struct { extern OPTIONS opt;
-void InitOptions();
+int OptInit(WPARAM wParam, LPARAM);
+
void LoadOptions();
void SaveOptions();
void DeinitOptions();
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index d7fcb2e9a4..3c048e0489 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -28,8 +28,6 @@ HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; // hooked here so it's in the main thread
HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide;
-HANDLE hSettingChangedEvent, hEventDeleted;
-HANDLE hReloadFonts = nullptr;
HANDLE hFolderChanged, hSkinFolder;
wchar_t SKIN_FOLDER[256];
@@ -221,7 +219,7 @@ static void InitFonts() g_plugin.addFont(&fontValues);
g_plugin.addFont(&fontTrayTitle);
- hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont);
+ HookEvent(ME_FONT_RELOAD, ReloadFont);
}
static int ModulesLoaded(WPARAM, LPARAM)
@@ -271,8 +269,6 @@ int Shutdown(WPARAM, LPARAM) return 0;
}
-HANDLE hEventPreShutdown, hEventModulesLoaded;
-
static INT_PTR ReloadSkin(WPARAM wParam, LPARAM lParam)
{
LoadOptions();
@@ -312,7 +308,6 @@ int CMPlugin::Load() InitTranslations();
InitMessagePump();
- InitOptions();
// for compatibility with mToolTip status tooltips
CreateServiceFunction("mToolTip/ShowTip", ShowTip);
@@ -320,12 +315,11 @@ int CMPlugin::Load() CreateServiceFunction("mToolTip/HideTip", HideTip);
CreateServiceFunction("mToolTip/ReloadSkin", ReloadSkin);
- hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
- hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
-
- hSettingChangedEvent = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged);
- hEventDeleted = HookEvent(ME_DB_EVENT_DELETED, EventDeleted);
-
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged);
+ HookEvent(ME_DB_EVENT_DELETED, EventDeleted);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
return 0;
}
@@ -333,12 +327,6 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
- UnhookEvent(hSettingChangedEvent);
- UnhookEvent(hEventDeleted);
- UnhookEvent(hEventPreShutdown);
- UnhookEvent(hEventModulesLoaded);
- UnhookEvent(hReloadFonts);
-
DeinitOptions();
DeleteObject(hFontTitle);
DeleteObject(hFontLabels);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.h b/plugins/TooltipNotify/src/TooltipNotify.h index 40aaac0db6..9a0e36b17d 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.h +++ b/plugins/TooltipNotify/src/TooltipNotify.h @@ -6,7 +6,7 @@ class CTooltip;
-class CTooltipNotify
+class CTooltipNotify : public MNonCopyable
{
private:
struct STooltipData;
@@ -33,11 +33,6 @@ public: static CTooltipNotify *GetObjInstance() { return s_pInstance; }
private:
- // prohibit copying
- CTooltipNotify(const CTooltipNotify& rhs);
- CTooltipNotify& operator= (const CTooltipNotify& rhs);
-
-private:
static CTooltipNotify *s_pInstance;
static const char *s_szModuleNameOld;
diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp index 608fcb4e18..ba385624bc 100644 --- a/plugins/TooltipNotify/src/main.cpp +++ b/plugins/TooltipNotify/src/main.cpp @@ -4,12 +4,6 @@ #include "stdafx.h"
-static HANDLE g_hContactSettingChanged = nullptr;
-static HANDLE g_hOptionsInitialize = nullptr;
-static HANDLE g_hModulesLoaded = nullptr;
-static HANDLE g_hProtoAck = nullptr;
-static HANDLE g_hProtoContactIsTyping = nullptr;
-
// Main global object
static CTooltipNotify *g_pTooltipNotify = nullptr;
@@ -59,20 +53,19 @@ static int InitializeOptions(WPARAM wParam, LPARAM lParam) static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- g_hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
- g_hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck);
- g_hProtoContactIsTyping = HookEvent(ME_PROTO_CONTACTISTYPING, ProtoContactIsTyping);
- g_hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, InitializeOptions);
-
return CTooltipNotify::GetObjInstance()->ModulesLoaded(wParam, lParam);
}
int CMPlugin::Load()
{
g_pTooltipNotify = new CTooltipNotify();
- assert(g_pTooltipNotify!=nullptr);
+ assert(g_pTooltipNotify != nullptr);
- g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
+ HookEvent(ME_OPT_INITIALISE, InitializeOptions);
+ HookEvent(ME_PROTO_ACK, ProtoAck);
+ HookEvent(ME_PROTO_CONTACTISTYPING, ProtoContactIsTyping);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
}
@@ -80,12 +73,6 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
- if (g_hContactSettingChanged) UnhookEvent(g_hContactSettingChanged);
- if (g_hProtoContactIsTyping) UnhookEvent(g_hProtoContactIsTyping);
- if (g_hProtoAck) UnhookEvent(g_hProtoAck);
- if (g_hOptionsInitialize) UnhookEvent(g_hOptionsInitialize);
- if (g_hModulesLoaded) UnhookEvent(g_hModulesLoaded);
delete g_pTooltipNotify;
-
return 0;
}
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index dc30e6f5ec..c71c1c64e8 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -93,9 +93,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) {
myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
- // options
- OptionsLoadModule();
-
// create services to receive string lists of languages and timezones
SvcConstantsLoadModule();
@@ -205,6 +202,7 @@ int CMPlugin::Load() SvcReminderLoadModule();
// Now the module is loaded! Start initializing certain things
+ HookEvent(ME_OPT_INITIALISE, OnInitOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded);
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index e8e6e9fd9c..0d9ea34eaa 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -1024,7 +1024,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR * @retval MIR_OK
**/
-static int OnInitOptions(WPARAM wParam, LPARAM)
+int OnInitOptions(WPARAM wParam, LPARAM)
{
DlgContactInfoInitTreeIcons();
@@ -1072,16 +1072,3 @@ static int OnInitOptions(WPARAM wParam, LPARAM) }
return MIR_OK;
}
-
-/**
-* This function loads the options module.
-*
-* @param none
-*
-* @retval nothing
-**/
-
-void OptionsLoadModule()
-{
- HookEvent(ME_OPT_INITIALISE, OnInitOptions);
-}
diff --git a/plugins/UserInfoEx/src/psp_options.h b/plugins/UserInfoEx/src/psp_options.h index 28bf533ef4..0eed35b99b 100644 --- a/plugins/UserInfoEx/src/psp_options.h +++ b/plugins/UserInfoEx/src/psp_options.h @@ -31,5 +31,6 @@ struct MenuOptionsList int idEXIMPORT;
};
-void OptionsLoadModule();
+int OnInitOptions(WPARAM, LPARAM);
+
#endif /* _UINFOEX_OPTIONS_H_INCLUDED_ */
\ No newline at end of file diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 4bbbe80c61..5c9c387e4d 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -244,6 +244,7 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
HookEvent(ME_DB_CONTACT_DELETED, SiteDeleted);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1);
return 0;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 2be23ed09a..f70712bc45 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -288,7 +288,7 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD) /*****************************************************************************/
-static int OptInitialise(WPARAM wParam, LPARAM)
+int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
@@ -330,8 +330,6 @@ void FontSettings(void) /*****************************************************************************/
int ModulesLoaded(WPARAM, LPARAM)
{
- HookEvent(ME_OPT_INITIALISE, OptInitialise);
-
hHookDisplayDataAlert = CreateHookableEvent(ME_DISPLAYDATA_ALERT);
HookEvent(ME_DISPLAYDATA_ALERT, DataWndAlertCommand);
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index ad69459257..561557e7e2 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -213,6 +213,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contact INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DataDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc);
+int OptInitialise(WPARAM, LPARAM);
void Filter(char *truncated);
void TxtclrLoop();
diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp index 86f79301ab..316ae9510b 100644 --- a/plugins/WinterSpeak/src/main.cpp +++ b/plugins/WinterSpeak/src/main.cpp @@ -4,12 +4,12 @@ CMPlugin g_plugin; SpeakConfig *g_speak_config = nullptr;
SpeakAnnounce *g_speak_announce = nullptr;
-HANDLE g_dialog_options_initialise;
HANDLE g_event_status_change;
HANDLE g_event_message_added;
HANDLE g_protocol_ack;
-PLUGININFOEX pluginInfoEx={
+PLUGININFOEX pluginInfoEx =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -24,7 +24,8 @@ PLUGININFOEX pluginInfoEx={ CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>("speak_config", pluginInfoEx)
-{}
+{
+}
//-----------------------------------------------------------------------------
// Description : External hook
@@ -73,8 +74,7 @@ int dialogOptionsInitialise(WPARAM wParam, LPARAM) odp.szGroup.w = LPGENW("Speak");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
- if (g_speak_config)
- {
+ if (g_speak_config) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONFIG);
odp.szTitle.w = LPGENW("Engine/Voice");
odp.pfnDlgProc = DialogConfigEngine::process;
@@ -86,8 +86,7 @@ int dialogOptionsInitialise(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp);
}
- if (g_speak_announce)
- {
+ if (g_speak_announce) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_ANNOUNCE);
odp.szTitle.w = LPGENW("Announce");
odp.pfnDlgProc = AnnounceDialog::process;
@@ -100,8 +99,7 @@ int dialogOptionsInitialise(WPARAM wParam, LPARAM) int CMPlugin::Load()
{
- if (!g_speak_config)
- {
+ if (!g_speak_config) {
g_speak_config = new SpeakConfig(g_plugin.getInst());
// expose to allow miranda + plugins to access my speak routines
@@ -109,8 +107,7 @@ int CMPlugin::Load() CreateServiceFunction(MS_SPEAK_MESSAGE, message);
}
- if (!g_speak_announce)
- {
+ if (!g_speak_announce) {
g_speak_announce = new SpeakAnnounce(g_plugin.getInst());
// tap into contact setting change event
@@ -125,8 +122,7 @@ int CMPlugin::Load() }
// a option dialog box request has occured
- g_dialog_options_initialise = HookEvent(ME_OPT_INITIALISE, dialogOptionsInitialise);
-
+ HookEvent(ME_OPT_INITIALISE, dialogOptionsInitialise);
return 0;
}
@@ -134,16 +130,12 @@ int CMPlugin::Load() int CMPlugin::Unload()
{
- UnhookEvent(g_dialog_options_initialise);
-
- if (g_speak_config)
- {
+ if (g_speak_config) {
delete g_speak_config;
g_speak_config = nullptr;
}
- if (g_speak_announce)
- {
+ if (g_speak_announce) {
UnhookEvent(g_event_status_change);
UnhookEvent(g_event_message_added);
UnhookEvent(g_protocol_ack);
diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 30d1097e35..f601ab947f 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -276,7 +276,6 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) }
break;
}
- //HookEvent(ME_OPT_INITIALISE,POP3OptInit);
HACCOUNT Finder;
DBVARIANT dbv;
@@ -300,7 +299,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) }
if (!Finder->hContact && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
- //No account contact found, have to create one
+ // No account contact found, have to create one
Finder->hContact = db_add_contact();
Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index e839edf429..ed1d995c65 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -62,6 +62,7 @@ GaduProto::GaduProto(const char *pszProtoName, const wchar_t *tszUserName) : CreateProtoService(PS_LEAVECHAT, &GaduProto::leavechat);
HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &GaduProto::dbsettingchanged);
+ HookProtoEvent(ME_OPT_INITIALISE, &GaduProto::options_init);
// Offline contacts and clear logon time
setalloffline();
@@ -704,7 +705,6 @@ int GaduProto::UserIsTyping(MCONTACT hContact, int type) void GaduProto::OnModulesLoaded()
{
- HookProtoEvent(ME_OPT_INITIALISE, &GaduProto::options_init);
HookProtoEvent(ME_USERINFO_INITIALISE, &GaduProto::details_init);
// Init misc stuff
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index da2972c014..bc33862ae0 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -151,6 +151,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : InitContactsCache();
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CIcqProto::OnPreBuildStatusMenu);
+ HookProtoEvent(ME_OPT_INITIALISE, &CIcqProto::OnOptionsInit);
// Register netlib users
wchar_t szBuffer[MAX_PATH + 64];
@@ -250,7 +251,6 @@ void CIcqProto::OnModulesLoaded() // Startup Auto Info-Update thread
icq_InitInfoUpdate();
- HookProtoEvent(ME_OPT_INITIALISE, &CIcqProto::OnOptionsInit);
HookProtoEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
HookProtoEvent(ME_IDLE_CHANGED, &CIcqProto::OnIdleChanged);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index cd8448b080..5cc4d7de2d 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -32,6 +32,10 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : CreateProtoService(PS_SEND_NUDGE, &CMraProto::MraSendNudge);
CreateProtoService(PS_GETUNREADEMAILCOUNT, &CMraProto::GetUnreadEmailCount);
+ HookProtoEvent(ME_OPT_INITIALISE, &CMraProto::OnOptionsInit);
+ HookProtoEvent(ME_DB_CONTACT_DELETED, &CMraProto::MraContactDeleted);
+ HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CMraProto::MraDbSettingChanged);
+
m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
wchar_t name[MAX_PATH];
@@ -80,9 +84,6 @@ INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM, LPARAM lParam) void CMraProto::OnModulesLoaded()
{
HookProtoEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CMraProto::MraExtraIconsApply);
- HookProtoEvent(ME_OPT_INITIALISE, &CMraProto::OnOptionsInit);
- HookProtoEvent(ME_DB_CONTACT_DELETED, &CMraProto::MraContactDeleted);
- HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CMraProto::MraDbSettingChanged);
HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CMraProto::MraRebuildContactMenu);
HookProtoEvent(ME_WAT_NEWSTATUS, &CMraProto::MraMusicChanged);
HookProtoEvent(ME_CLIST_GROUPCHANGE, &CMraProto::OnGroupChanged);
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 4fe03a0547..3b7d491a0c 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -38,7 +38,6 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t CreateProtoService(PS_CREATEACCMGRUI, &MinecraftDynmapProto::SvcCreateAccMgrUI); - // HookProtoEvent(ME_OPT_INITIALISE, &MinecraftDynmapProto::OnOptionsInit); HookProtoEvent(ME_GC_EVENT, &MinecraftDynmapProto::OnChatEvent); // Create standard network connection diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index fde09f0757..48046fa198 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -45,6 +45,9 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE); CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP); + HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); + HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead); + m_tszAvatarFolder = std::wstring(VARSW(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName; DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str()); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -85,9 +88,7 @@ void CSkypeProto::OnModulesLoaded() { setAllContactStatuses(ID_STATUS_OFFLINE, true); - HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage); - HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead); InitDBEvents(); InitPopups(); diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp index f98573de45..11411a00d5 100644 --- a/protocols/Steam/src/steam_events.cpp +++ b/protocols/Steam/src/steam_events.cpp @@ -4,7 +4,6 @@ void CSteamProto::OnModulesLoaded() { Clist_GroupCreate(0, m_defaultGroup); - HookProtoEvent(ME_OPT_INITIALISE, &CSteamProto::OnOptionsInit); HookProtoEvent(ME_IDLE_CHANGED, &CSteamProto::OnIdleChanged); HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSteamProto::OnPreCreateMessage); diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 4988470c66..dc64c54e33 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -69,6 +69,9 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) // custom db events API CreateProtoService(STEAM_DB_GETEVENTTEXT_CHATSTATES, &CSteamProto::OnGetEventTextChatStates); + // hooks + HookProtoEvent(ME_OPT_INITIALISE, &CSteamProto::OnOptionsInit); + // netlib support wchar_t name[128]; mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 40c34ff828..b71f664f20 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -36,6 +36,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) CreateServiceFunction(MODULE "/GetEventIcon", &CToxProto::EventGetIcon);
HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::OnPrebuildContactMenu);
+ HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
HookProtoEvent(ME_PROTO_ACCLISTCHANGED, &CToxProto::OnAccountRenamed);
m_hTimerQueue = CreateTimerQueue();
@@ -51,9 +52,8 @@ void CToxProto::OnModulesLoaded() {
Clist_GroupCreate(0, m_defaultGroup);
- HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
- HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
+ HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
InitCustomDbEvents();
}
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index b9a0a492e1..5655e16e18 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -540,9 +540,6 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) static int AwayMsgSendModulesLoaded(WPARAM, LPARAM)
{
AwayMsgSendAccountsChanged(0, 0);
-
- HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChange);
- HookEvent(ME_OPT_INITIALISE, AwayMsgOptInitialise);
return 0;
}
@@ -554,8 +551,10 @@ static INT_PTR sttGetAwayMessageT(WPARAM wParam, LPARAM lParam) int LoadAwayMessageSending(void)
{
- HookEvent(ME_SYSTEM_MODULESLOADED, AwayMsgSendModulesLoaded);
+ HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChange);
+ HookEvent(ME_OPT_INITIALISE, AwayMsgOptInitialise);
HookEvent(ME_PROTO_ACCLISTCHANGED, AwayMsgSendAccountsChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, AwayMsgSendModulesLoaded);
CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSGW, sttGetAwayMessageT);
return 0;
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 98cd0e55b2..c410ccab8e 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -583,7 +583,7 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
-static int OptInitialise(WPARAM wParam, LPARAM)
+int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.position = 910000000;
@@ -609,8 +609,3 @@ static int OptInitialise(WPARAM wParam, LPARAM) ChatOptionsInitialize(wParam);
return 0;
}
-
-void InitOptions(void)
-{
- HookEvent(ME_OPT_INITIALISE, OptInitialise);
-}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 628a1044c5..b3aea9901b 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -555,16 +555,16 @@ int LoadSendRecvMessageModule(void) }
InitGlobals();
- InitOptions();
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
- HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded);
- HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage);
+ HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 6dfe7f31af..aa78f440fb 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -222,7 +222,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *msg); void LoadMsgLogIcons(void);
void FreeMsgLogIcons(void);
-void InitOptions(void);
+int OptInitialise(WPARAM, LPARAM);
#define MSGFONTID_MYMSG 0
#define MSGFONTID_YOURMSG 1
|