From 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 20:12:53 +0300 Subject: end of ME_OPT_INITIALISE related zoo in another plugins --- plugins/SecureIM/src/main.cpp | 6 +--- plugins/SecureIM/src/options.cpp | 12 ++++++-- plugins/SecureIM/src/popupOptions.cpp | 55 +++++++++++++---------------------- plugins/SecureIM/src/popupOptions.h | 2 -- 4 files changed, 32 insertions(+), 43 deletions(-) (limited to 'plugins/SecureIM/src') 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 -- cgit v1.2.3