From dd1460d664f7266920b07527f25f87ec8233daaf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Sep 2013 10:58:24 +0000 Subject: valid options initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@6225 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/options.cpp | 4 +- plugins/AssocMgr/src/assoclist.cpp | 3 +- plugins/AuthState/src/options.cpp | 4 +- plugins/AutoRun/src/main.cpp | 3 +- plugins/AvatarHistory/src/options.cpp | 1 - plugins/BASS_interface/src/Main.cpp | 4 +- plugins/BasicHistory/src/Options.cpp | 5 +- plugins/Boltun/src/boltun.cpp | 22 +- plugins/BossKeyPlus/src/BossKey.cpp | 10 +- plugins/BossKeyPlus/src/Options.cpp | 203 +- plugins/BuddyExpectator/src/options.cpp | 7 +- plugins/BuddyPounce/src/main.cpp | 4 +- plugins/CSList/src/cslist.cpp | 3 +- plugins/ClientChangeNotify/src/OptDlg.cpp | 3 +- plugins/Clist_modern/src/modern_clcopts.cpp | 4 +- plugins/Clist_modern/src/modern_clistopts.cpp | 4 +- plugins/Clist_modern/src/modern_skinopt.cpp | 7 +- plugins/Clist_mw/src/BkgrCfg.cpp | 4 +- plugins/Clist_mw/src/clcopts.cpp | 3 +- plugins/Clist_mw/src/clistopts.cpp | 5 +- plugins/Clist_mw/src/cluiopts.cpp | 3 +- plugins/Clist_nicer/src/clcopts.cpp | 5 +- plugins/Console/src/Console.cpp | 3 +- plugins/CrashDumper/src/crshdmp.cpp | 5 +- plugins/DbEditorPP/src/options.cpp | 4 +- plugins/Db_autobackups/src/options.cpp | 4 +- plugins/Dbx_mmap_SA/src/dialogs.cpp | 3 +- plugins/Exchange/src/hooked_events.cpp | 6 +- plugins/FavContacts/src/main.cpp | 3 +- plugins/FileAsMessage/src/main.cpp | 7 +- plugins/Folders/src/dlg_handlers.cpp | 1 - plugins/HTTPServer/src/GuiElements.cpp | 14 +- plugins/HistoryLinkListPlus/src/linklist.cpp | 7 +- plugins/HistorySweeperLight/src/options.cpp | 5 +- plugins/IEView/src/Options.cpp | 3 +- plugins/IgnoreState/src/options.cpp | 4 +- plugins/KeyboardNotify/src/options.cpp | 5 +- plugins/LangMan/src/options.cpp | 6 +- plugins/ListeningTo/src/options.cpp | 4 +- plugins/LotusNotify/src/LotusNotify.cpp | 4 +- plugins/MirFox/src/MirandaOptions.cpp | 35 +- plugins/MirOTR/MirOTR/src/options.cpp | 5 +- plugins/MsgPopup/src/main.cpp | 5 +- plugins/Msg_Export/src/options.cpp | 4 +- plugins/MyDetails/src/options.cpp | 3 +- plugins/NewXstatusNotify/src/indsnd.cpp | 21 +- plugins/NewXstatusNotify/src/options.cpp | 5 +- plugins/New_GPG/src/options.cpp | 2706 ++++++++++---------- plugins/NotesAndReminders/src/main.cpp | 3 +- plugins/Nudge/src/options.cpp | 3 +- plugins/PackUpdater/Src/Options.cpp | 3 +- plugins/PasteIt/src/Options.cpp | 5 +- plugins/Ping/src/options.cpp | 26 +- plugins/PluginUpdater/src/Options.cpp | 3 +- plugins/QuickContacts/src/options.cpp | 10 +- plugins/QuickMessages/src/options.cpp | 1 - plugins/QuickReplies/src/options.cpp | 14 +- plugins/Quotes/src/Forex.cpp | 3 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 9 +- plugins/Quotes/src/QuotesProviderFinance.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogle.cpp | 10 +- plugins/RecentContacts/src/options.cpp | 4 +- plugins/Scriver/src/chat/options.cpp | 4 +- plugins/Scriver/src/msgoptions.cpp | 7 +- plugins/Sessions/Src/Options.cpp | 1 - plugins/SimpleAR/src/Options.cpp | 3 +- plugins/SimpleStatusMsg/src/options.cpp | 4 +- plugins/SmileyAdd/src/options.cpp | 4 +- plugins/Spamotron/src/options.cpp | 5 +- plugins/SpellChecker/src/options.cpp | 4 +- plugins/SplashScreen/src/options.cpp | 3 +- plugins/StartPosition/src/main.cpp | 5 +- plugins/StatusChange/src/main.cpp | 3 +- plugins/StatusPlugins/AdvancedAutoAway/options.cpp | 3 +- plugins/StatusPlugins/KeepStatus/options.cpp | 11 +- plugins/StatusPlugins/StartupStatus/options.cpp | 16 +- plugins/StopSpamMod/src/options.cpp | 143 +- plugins/StopSpamPlus/src/events.cpp | 4 +- plugins/TabSRMM/src/msgoptions.cpp | 3 +- plugins/TipperYM/src/options.cpp | 4 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 1 - plugins/TopToolBar/src/ttbopt.cpp | 4 +- plugins/TrafficCounter/src/options.cpp | 1 - plugins/UserInfoEx/src/Flags/svc_flags.cpp | 1 - plugins/UserInfoEx/src/dlg_propsheet.cpp | 82 +- plugins/UserInfoEx/src/psp_options.cpp | 2 +- plugins/Variables/src/options.cpp | 4 +- plugins/VersionInfo/src/hooked_events.cpp | 5 +- plugins/Watrack_MPD/src/options.cpp | 3 +- plugins/Weather/src/weather_opt.cpp | 7 +- plugins/Weather/src/weather_userinfo.cpp | 13 +- plugins/WhenWasIt/src/hooked_events.cpp | 1 - plugins/YAMN/src/proto/pop3/pop3opt.cpp | 3 +- plugins/YARelay/src/options.cpp | 12 +- plugins/YahooGroups/src/hooked_events.cpp | 7 +- plugins/ZeroNotification/src/main.cpp | 4 +- protocols/AimOscar/src/ui.cpp | 7 +- protocols/EmLanProto/src/amdproto.cpp | 1 - protocols/FacebookRM/src/proto.cpp | 1 - protocols/GTalkExt/src/options.cpp | 2 - protocols/Gadu-Gadu/src/dialogs.cpp | 4 +- protocols/IRCG/src/options.cpp | 4 +- protocols/IRCG/src/userinfo.cpp | 3 +- protocols/IcqOscarJ/src/UI/userinfotab.cpp | 6 +- protocols/IcqOscarJ/src/icq_opts.cpp | 3 +- protocols/JabberG/src/jabber_opt.cpp | 26 +- protocols/JabberG/src/jabber_userinfo.cpp | 1 - protocols/JabberG/src/jabber_vcard.cpp | 3 +- protocols/MRA/src/Mra_options.cpp | 3 +- protocols/MSN/msn_10.vcxproj | 1 - protocols/MSN/msn_10.vcxproj.filters | 3 - protocols/MSN/msn_11.vcxproj | 1 - protocols/MSN/msn_11.vcxproj.filters | 3 - protocols/MSN/src/msn_opts.cpp | 3 +- protocols/MSN/src/msn_useropts.cpp | 79 - protocols/Omegle/src/proto.cpp | 3 +- protocols/Skype/src/skype_events.cpp | 16 +- protocols/Twitter/src/proto.cpp | 6 +- protocols/Xfire/src/options.cpp | 1 - protocols/Xfire/src/userdetails.cpp | 8 +- protocols/Yahoo/src/options.cpp | 5 +- protocols/Yahoo/src/user_info.cpp | 7 +- src/core/stdaway/sendmsg.cpp | 3 +- src/core/stdchat/src/options.cpp | 4 +- src/core/stdclist/src/clcopts.cpp | 7 +- src/core/stdclist/src/clistopts.cpp | 3 +- src/core/stdclist/src/cluiopts.cpp | 4 +- src/core/stdfile/fileopts.cpp | 3 +- src/core/stdidle/idle.cpp | 3 +- src/core/stduserinfo/stdinfo.cpp | 5 +- src/modules/clist/clcutils.cpp | 15 +- src/modules/clist/contacts.cpp | 3 +- src/modules/clist/genmenuopt.cpp | 3 +- src/modules/extraicons/options_ei.cpp | 4 +- src/modules/fonts/FontOptions.cpp | 3 +- src/modules/icolib/skin2opts.cpp | 3 +- src/modules/ignore/ignore.cpp | 3 +- src/modules/netlib/netlibopts.cpp | 4 +- src/modules/plugins/pluginopts.cpp | 3 +- src/modules/skin/hotkey_opts.cpp | 3 +- src/modules/skin/sounds.cpp | 3 +- src/modules/visibility/visibility.cpp | 3 +- 142 files changed, 1760 insertions(+), 2178 deletions(-) delete mode 100644 protocols/MSN/src/msn_useropts.cpp diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index ffb359fabb..c16c8c118b 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -1141,8 +1141,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int OptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1); @@ -1151,7 +1150,6 @@ int OptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOpts; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 87daff26db..deb1b2b7eb 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -953,8 +953,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara static int AssocListOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ASSOCLIST); odp.position = 900000100; /* network opts = 900000000 */ diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index e7d3961b60..5fe5635b92 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -71,8 +71,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int onOptInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Icons"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_AUTHSTATE_OPT); @@ -80,6 +79,5 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcOptions; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 19b0db0f62..c4dc84640d 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -102,8 +102,7 @@ static INT_PTR CALLBACK DlgProcAutorunOpts(HWND hwndDlg, UINT msg, WPARAM wParam static int AutorunOptInitialise(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100100000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTORUN); diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index 0820278639..d7fbcdca68 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -163,7 +163,6 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index e974cbb4c3..c6219bd2b3 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -296,15 +296,13 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pszTitle = ModuleName; odp.pfnDlgProc = OptionsProc; odp.pszGroup = LPGEN("Sounds"); odp.flags = ODPF_BOLDGROUPS; - Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 4c8f129016..d3c088b537 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -121,9 +121,7 @@ Options::~Options() int Options::InitOptions(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; @@ -158,7 +156,6 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); odp.pfnDlgProc = Options::DlgProcOptsMain; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index c4670138a8..1c6b0aa59e 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -482,21 +482,19 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP static int MessageOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp, sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = 910000000; - odp.hInstance = hInst; - odp.pszGroup = BOLTUN_GROUP; - odp.pszTitle = BOLTUN_NAME; - odp.pfnDlgProc = MainDlgProc; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.position = 910000000; + odp.hInstance = hInst; + odp.pszGroup = BOLTUN_GROUP; + odp.pszTitle = BOLTUN_NAME; + odp.pfnDlgProc = MainDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN); - odp.pszTab = TAB_GENERAL; + odp.pszTab = TAB_GENERAL; Options_AddPage(wParam, &odp); - odp.pfnDlgProc = EngineDlgProc; + + odp.pfnDlgProc = EngineDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_ENGINE); - odp.pszTab = TAB_ENGINE; + odp.pszTab = TAB_ENGINE; Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 370eb8500c..9018cafb88 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -217,7 +217,7 @@ BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM) ShowWindow(hWnd,SW_HIDE); } } - return(true); + return true; } TCHAR* GetDefStatusMsg(unsigned uStatus, const char* szProto) @@ -414,7 +414,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) g_bOldSetting |= OLD_WASHIDDEN; db_set_b(NULL, MOD_NAME, "OldSetting", g_bOldSetting); - return(0); + return 0; } break; case WM_USER+52: // back { @@ -480,7 +480,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) g_bWindowHidden = false; db_set_b(NULL, MOD_NAME, "OldSetting", 0); - return(0); + return 0; } break; default:break; } @@ -764,7 +764,7 @@ int MirandaLoaded(WPARAM,LPARAM) if ((g_wMaskAdv & OPT_HIDEONSTART) || (g_wMaskAdv & OPT_RESTORE && g_bOldSetting)) BossKeyHideMiranda(0, 0); - return(0); + return 0; } extern "C" int __declspec(dllexport) Load(void) @@ -833,5 +833,5 @@ extern "C" int __declspec(dllexport) Unload(void) delete[] oldStatus; delete[] oldStatusMsg; - return(0); + return 0; } diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index bbd9e89a01..c9be056eb2 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -87,7 +87,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) SendMessage(hwndDlg,WM_USER + 50,0,0); s_fRedraw = true; - return(true); + return true; } break; case WM_NOTIFY: { @@ -138,7 +138,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) db_set_w(NULL,MOD_NAME,"optsmask",wMask); g_wMask = wMask; - return(true); + return true; } break; } } break; @@ -165,7 +165,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) } EnableWindow(GetDlgItem(hwndDlg,IDC_MAINOPT_STATMSG),(IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_CHANGESTATUSBOX) == BST_CHECKED) && (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_USEDEFMSG) != BST_CHECKED)); ShowWindow(GetDlgItem(hwndDlg, IDC_MAINOPT_VARHELP), IsWindowEnabled(GetDlgItem(hwndDlg,IDC_MAINOPT_STATMSG)) && ServiceExists(MS_VARS_FORMATSTRING)); - return(true); + return true; } break; case WM_USER+60: { @@ -175,7 +175,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) EnableWindow(GetDlgItem(hwndDlg,IDC_MAINOPT_ONLINEONLY),fEnable); EnableWindow(GetDlgItem(hwndDlg,IDC_MAINOPT_USEDEFMSG),fEnable); EnableWindow(GetDlgItem(hwndDlg,IDC_MAINOPT_PASS),IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_REQPASS) == BST_CHECKED); - return(true); + return true; } break; case WM_COMMAND: { @@ -190,7 +190,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) SendMessage(hwndDlg,WM_USER + 50,0,0); } SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(0); + return 0; } break; case BN_CLICKED: { @@ -202,32 +202,32 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) case IDC_MAINOPT_TRAYICON: { SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); + return true; } break; case IDC_MAINOPT_USEDEFMSG: { SendMessage(hwndDlg,WM_USER + 50,0,0); SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); + return true; } break; case IDC_MAINOPT_CHANGESTATUSBOX: { SendMessage(hwndDlg,WM_USER + 60,0,0); SendMessage(hwndDlg,WM_USER + 50,0,0); SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); + return true; } break; case IDC_MAINOPT_REQPASS: { SendMessage(hwndDlg,WM_USER + 60,0,0); SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); + return true; } break; case IDC_MAINOPT_VARHELP: { variables_showhelp(hwndDlg, IDC_MAINOPT_STATMSG, VHF_INPUT|VHF_HELP, 0, 0); SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); + return true; } break; case IDC_MAINOPT_LNK_HOTKEY: { @@ -239,7 +239,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) return (true); } break; } - return(0); + return 0; } break; case EN_UPDATE: { @@ -256,7 +256,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) case WM_DESTROY: { g_fOptionsOpen = false; - return(0); + return 0; } break; } return(false); @@ -266,12 +266,10 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { static bool inFocus = false; - switch (msg) - { - case WM_INITDIALOG: + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TranslateDialogDefault(hwndDlg); - g_fOptionsOpen = true; minutes = db_get_b(NULL,MOD_NAME,"time",10); @@ -287,107 +285,92 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFSCRSVR,(g_wMaskAdv & OPT_HIDEIFSCRSVR) ? (BST_CHECKED) : (BST_UNCHECKED)); CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEONSTART,(g_wMaskAdv & OPT_HIDEONSTART) ? (BST_CHECKED) : (BST_UNCHECKED)); CheckDlgButton(hwndDlg,IDC_MAINOPT_RESTORE,(g_wMaskAdv & OPT_RESTORE) ? (BST_CHECKED) : (BST_UNCHECKED)); + } + return true; - return(true); - } break; - case WM_NOTIFY: + case WM_NOTIFY: { NMHDR* nmhdr = (NMHDR*)lParam; - switch (nmhdr->code) - { - case PSN_APPLY: - { - WORD wMaskAdv = 0; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFLOCK) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFLOCK; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFWINIDLE; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFMIRIDLE; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFSCRSVR) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFSCRSVR; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEONSTART) == BST_CHECKED) wMaskAdv |= OPT_HIDEONSTART; - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_RESTORE) == BST_CHECKED) wMaskAdv |= OPT_RESTORE; - - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_MENUITEM) == BST_CHECKED ) - { - if (g_hMenuItem == 0) BossKeyMenuItemInit(); - wMaskAdv |= OPT_MENUITEM; - } else - if (g_hMenuItem != 0) BossKeyMenuItemUnInit(); - - TCHAR szMinutes[4] = {0}; - GetDlgItemText(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3); - minutes = _ttoi(szMinutes); - if(minutes<1) minutes = 1; - db_set_b(NULL,MOD_NAME,"time",minutes); - db_set_w(NULL,MOD_NAME,"optsmaskadv",wMaskAdv); - g_wMaskAdv = wMaskAdv; - - return(true); - } break; + switch (nmhdr->code) { + case PSN_APPLY: + WORD wMaskAdv = 0; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFLOCK) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFLOCK; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFWINIDLE; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFMIRIDLE; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFSCRSVR) == BST_CHECKED) wMaskAdv |= OPT_HIDEIFSCRSVR; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEONSTART) == BST_CHECKED) wMaskAdv |= OPT_HIDEONSTART; + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_RESTORE) == BST_CHECKED) wMaskAdv |= OPT_RESTORE; + + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_MENUITEM) == BST_CHECKED ) { + if (g_hMenuItem == 0) + BossKeyMenuItemInit(); + wMaskAdv |= OPT_MENUITEM; + } + else if (g_hMenuItem != 0) + BossKeyMenuItemUnInit(); + + TCHAR szMinutes[4] = {0}; + GetDlgItemText(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3); + minutes = _ttoi(szMinutes); + if(minutes<1) minutes = 1; + db_set_b(NULL,MOD_NAME,"time",minutes); + db_set_w(NULL,MOD_NAME,"optsmaskadv",wMaskAdv); + g_wMaskAdv = wMaskAdv; + return true; } - } break; - case WM_COMMAND: - { - switch (HIWORD(wParam)) - { - case BN_CLICKED: - { - switch(LOWORD(wParam)) - { - case IDC_MAINOPT_MENUITEM: - case IDC_MAINOPT_HIDEIFLOCK: - case IDC_MAINOPT_HIDEIFSCRSVR: - case IDC_MAINOPT_HIDEONSTART: - case IDC_MAINOPT_RESTORE: - { - SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); - } break; - case IDC_MAINOPT_HIDEIFWINIDLE: - { - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE) == BST_CHECKED) - CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE,BST_UNCHECKED); - SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); - } break; - case IDC_MAINOPT_HIDEIFMIRIDLE: - { - if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE) == BST_CHECKED) - CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE,BST_UNCHECKED); - SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - return(true); - } break; - } - return(0); - } break; - case EN_SETFOCUS: - { - inFocus = true; - return(0); - } break; - case EN_UPDATE: - { - switch( LOWORD( wParam )) { - case IDC_MAINOPT_TIME: - if(inFocus) - SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); - } - } break; - default:break; + } + break; + + case WM_COMMAND: + switch (HIWORD(wParam)) { + case BN_CLICKED: + switch(LOWORD(wParam)) { + case IDC_MAINOPT_MENUITEM: + case IDC_MAINOPT_HIDEIFLOCK: + case IDC_MAINOPT_HIDEIFSCRSVR: + case IDC_MAINOPT_HIDEONSTART: + case IDC_MAINOPT_RESTORE: + SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); + return true; + + case IDC_MAINOPT_HIDEIFWINIDLE: + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE) == BST_CHECKED) + CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE,BST_UNCHECKED); + SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); + return true; + + case IDC_MAINOPT_HIDEIFMIRIDLE: + if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_HIDEIFMIRIDLE) == BST_CHECKED) + CheckDlgButton(hwndDlg,IDC_MAINOPT_HIDEIFWINIDLE,BST_UNCHECKED); + SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); + return true; } - } break; - case WM_DESTROY: - { - g_fOptionsOpen = false; - return(0); - } break; + return 0; + + case EN_SETFOCUS: + inFocus = true; + return 0; + + case EN_UPDATE: + switch( LOWORD( wParam )) { + case IDC_MAINOPT_TIME: + if(inFocus) + SendMessage(GetParent(hwndDlg),PSM_CHANGED,(WPARAM)hwndDlg,0); + } + break; + } + break; + + case WM_DESTROY: + g_fOptionsOpen = false; + return 0; } - return(false); + return false; } int OptsDlgInit(WPARAM wParam,LPARAM) { - OPTIONSDIALOGPAGE optDi; - ZeroMemory(&optDi, sizeof(optDi)); - optDi.cbSize = sizeof(optDi); + OPTIONSDIALOGPAGE optDi = { sizeof(optDi) }; optDi.position = 920000000; optDi.pfnDlgProc = MainOptDlg; optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGMAIN); @@ -396,13 +379,11 @@ int OptsDlgInit(WPARAM wParam,LPARAM) optDi.ptszGroup = LPGENT("Events"); optDi.ptszTab = LPGENT("Main"); optDi.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; - Options_AddPage(wParam, &optDi); optDi.pfnDlgProc = AdvOptDlg; optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGADV); optDi.ptszTab = LPGENT("Advanced"); - Options_AddPage(wParam, &optDi); - return(0); + return 0; } diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index fd26b45ab7..935024308a 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -540,16 +540,13 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar int UserinfoInit(WPARAM wparam, LPARAM lparam) { - if (lparam > 0) - { - OPTIONSDIALOGPAGE uip = {0}; - uip.cbSize = sizeof(uip); + if (lparam > 0) { + OPTIONSDIALOGPAGE uip = { sizeof(uip) }; uip.hInstance = hInst; uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); uip.flags = ODPF_TCHAR; uip.ptszTitle = LPGENT("Buddy Expectator"); uip.pfnDlgProc = UserinfoDlgProc; - UserInfo_AddPage(wparam, &uip); } return 0; diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index eb48801848..83f7965ad4 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -95,8 +95,7 @@ int MsgAck(WPARAM wParam, LPARAM lParam) int BuddyPounceOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); @@ -104,7 +103,6 @@ int BuddyPounceOptInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = LPGENT("Buddy Pounce"); odp.pfnDlgProc = BuddyPounceOptionsDlgProc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 51706b9bf1..067dec2125 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -81,8 +81,7 @@ static int OnDbChanged(WPARAM wparam, LPARAM lparam) static int OnInitOptions(WPARAM wparam, LPARAM lparam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 955000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 9de39b0705..96a96ccc20 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -173,8 +173,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsDlgInit(WPARAM wParam, LPARAM lParam) { if (bPopupExists) { - OPTIONSDIALOGPAGE optDi = {0}; - optDi.cbSize = sizeof(optDi); + OPTIONSDIALOGPAGE optDi = { sizeof(optDi) }; optDi.position = 920000000; optDi.ptszTitle = LPGENT("ClientChangeNotify"); optDi.pfnDlgProc = PopupOptDlg; diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index c37020b629..916d7d7839 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -265,8 +265,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) if (MirandaExiting()) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); odp.pszTitle = LPGEN("Contact List"); @@ -290,7 +289,6 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 63eb97c90d..6b234ee068 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -965,8 +965,7 @@ static row_opt_items[] = int CListOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ITEMS); @@ -980,6 +979,5 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = row_opt_items[i].wnd_proc; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 8f0b01ddce..5d4003185e 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -45,12 +45,9 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int SkinOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - if ( !g_CluiData.fDisableSkinEngine ) - { + if ( !g_CluiData.fDisableSkinEngine) { //Tabbed settings - ZeroMemory( &odp, sizeof( odp )); - odp.cbSize = sizeof( odp ); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = g_hInst; odp.pfnDlgProc = DlgSkinOpts; diff --git a/plugins/Clist_mw/src/BkgrCfg.cpp b/plugins/Clist_mw/src/BkgrCfg.cpp index 8287bbc5d0..23fe520f98 100644 --- a/plugins/Clist_mw/src/BkgrCfg.cpp +++ b/plugins/Clist_mw/src/BkgrCfg.cpp @@ -273,8 +273,7 @@ static INT_PTR BkgrCfg_Register(WPARAM wParam,LPARAM lParam) int OnOptionsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Customize"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG2); @@ -282,7 +281,6 @@ int OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcBkgOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Clist_mw/src/clcopts.cpp b/plugins/Clist_mw/src/clcopts.cpp index 287a8e79d6..ef363ef11a 100644 --- a/plugins/Clist_mw/src/clcopts.cpp +++ b/plugins/Clist_mw/src/clcopts.cpp @@ -49,8 +49,7 @@ int BgStatusBarChange(WPARAM wParam,LPARAM lParam) int ClcOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 2f77d6b109..b85fa0e6a6 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -32,10 +32,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int CListOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index f3685f5c67..45d1dca8db 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -34,8 +34,7 @@ int OnStatusBarBackgroundChange(); int CluiOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); odp.pszTitle = LPGEN("Window"); diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 17f5b0e3b9..f4d058f234 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -524,9 +524,7 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int ClcOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; //////////////////////////////////////////////////////////////////////////// @@ -534,7 +532,6 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.position = -1000000000; odp.flags = ODPF_BOLDGROUPS; - odp.pszGroup = NULL; odp.pszTitle = LPGEN("Contact List"); odp.pszTab = LPGEN("General"); odp.pfnDlgProc = DlgProcGenOpts; diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index cda19327bc..0967c35341 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -1106,8 +1106,7 @@ static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int OptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp={0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pszGroup = LPGEN("Services"); diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index cd4aed83a5..5cea6dac9a 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -178,9 +178,7 @@ static int FoldersPathChanged(WPARAM, LPARAM) int OptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); @@ -189,7 +187,6 @@ int OptionsInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index 8d68527f05..70319c0c31 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -77,8 +77,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) INT OptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS); odp.pszGroup = LPGEN("Database"); @@ -86,6 +85,5 @@ INT OptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } \ No newline at end of file diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index fc411f9aa8..02a2c2bc7f 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -345,8 +345,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int OptionsInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); @@ -355,6 +354,5 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Dbx_mmap_SA/src/dialogs.cpp b/plugins/Dbx_mmap_SA/src/dialogs.cpp index 5ca3197958..5a999668a4 100644 --- a/plugins/Dbx_mmap_SA/src/dialogs.cpp +++ b/plugins/Dbx_mmap_SA/src/dialogs.cpp @@ -43,8 +43,7 @@ BOOL IsDlgItemEnabled(HWND hwndDlg, int iIDCtrl) static int OptionsInit(void *obj, WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 549664c2a6..b1fc66ce68 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -76,16 +76,14 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) //add the exchange options dialog to miranda int OnOptionsInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXCHANGE); odp.ptszTitle = LPGENT("Exchange notify"); odp.ptszGroup = LPGENT("Plugins"); odp.groupPosition = 910000000; - odp.flags=ODPF_BOLDGROUPS|ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); return 0; diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 1d081790de..7bd76ff5fc 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -240,8 +240,7 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) int ProcessOptInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index a7e7b64350..7574748758 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -146,11 +146,7 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) int OnOptInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp, sizeof(odp)); - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.ptszTitle = _T(SERVICE_TITLE); @@ -158,7 +154,6 @@ int OnOptInitialise(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; odp.pfnDlgProc = OptionsDlgProc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 2f5edb0c96..cfede62880 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -258,7 +258,6 @@ static int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOpts; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 67549050fc..2d6ff38bdb 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -1338,14 +1338,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Developer : KN ///////////////////////////////////////////////////////////////////// -int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) { - OPTIONSDIALOGPAGE odp; - /* - bWindowTextSet = FALSE; - bUnaplyedChanges = FALSE; - */ - ZeroMemory(&odp, sizeof(odp)); - odp.cbSize = sizeof(odp); +int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) +{ + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_HTTP_SERVER); @@ -1357,9 +1352,6 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) { return 0; } - - - ///////////////////////////////////////////////////////////////////// // Member Function : MainThreadCallback // Type : Global diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index cf3997327a..84a9b56bfc 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -107,12 +107,9 @@ extern "C" __declspec(dllexport) int Unload(void) return 0; } -int InitOptionsDlg(WPARAM wParam, LPARAM lParam) +int InitOptionsDlg(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - UNREFERENCED_PARAMETER(lParam); - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("History"); odp.pszTitle = LPGEN("History Linklist"); diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index f7e6b3e200..45541bbfa7 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -308,9 +308,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa int HSOptInitialise(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORYSWEEPER); odp.pszTitle = ModuleName; @@ -318,6 +316,5 @@ int HSOptInitialise(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcHSOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index ecde244899..a74c703ce1 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -417,8 +417,7 @@ static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, in int IEViewOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInstance; odp.ptszGroup = LPGENT("Message Sessions"); odp.ptszTitle = LPGENT("IEView"); diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index 776ed37c78..8829379d52 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -104,8 +104,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int onOptInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.flags = ODPF_BOLDGROUPS; odp.pszGroup = LPGEN("Icons"); @@ -113,6 +112,5 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Ignore State"); odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 54064e9065..d4d5d031bb 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -89,9 +89,7 @@ BYTE trillianLedsMsg, trillianLedsURL, trillianLedsFile, trillianLedsOther; // ** int InitializeOptions(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pszTitle = LPGEN("Keyboard Flash"); @@ -100,7 +98,6 @@ int InitializeOptions(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/LangMan/src/options.cpp b/plugins/LangMan/src/options.cpp index f7eaac87c7..809592c6d8 100644 --- a/plugins/LangMan/src/options.cpp +++ b/plugins/LangMan/src/options.cpp @@ -624,11 +624,9 @@ void ReloadLangOptList(void) } } -static int LangOptInit(WPARAM wParam, LPARAM lParam) +static int LangOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - UNREFERENCED_PARAMETER(lParam); - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; odp.position = 1200000090; diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp index 5d8b402bb6..c3ee3a0059 100644 --- a/plugins/ListeningTo/src/options.cpp +++ b/plugins/ListeningTo/src/options.cpp @@ -74,8 +74,7 @@ static OptPageControl playersControls[] = { int InitOptionsCallback(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize=sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; @@ -96,7 +95,6 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = PlayersDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_PLAYERS); Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 53a3c5f7f4..af50679f67 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1362,9 +1362,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L //options page on miranda called int LotusNotifyOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG); odp.ptszTitle = _A2T(PLUGINNAME); diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index 8404d37ce7..ea79b85297 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -698,35 +698,30 @@ INT_PTR CALLBACK DlgProcOpts_Tab3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM */ int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - - //options init - odp.cbSize = sizeof(odp); - odp.position = -790000000; - odp.hInstance = hInst; - odp.ptszTitle = LPGENT(PLUGIN_OPTIONS_NAME); - odp.ptszGroup = LPGENT("Services"); - - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.position = -790000000; + odp.hInstance = hInst; + odp.ptszTitle = LPGENT(PLUGIN_OPTIONS_NAME); + odp.ptszGroup = LPGENT("Services"); + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; //1 - options - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1); - odp.ptszTab = LPGENT("Options"); - odp.pfnDlgProc = DlgProcOpts_Tab1; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1); + odp.ptszTab = LPGENT("Options"); + odp.pfnDlgProc = DlgProcOpts_Tab1; Options_AddPage(wParam, &odp); //2 - contacts - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT2); - odp.ptszTab = LPGENT("Contacts"); - odp.pfnDlgProc = DlgProcOpts_Tab2; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT2); + odp.ptszTab = LPGENT("Contacts"); + odp.pfnDlgProc = DlgProcOpts_Tab2; Options_AddPage(wParam, &odp); //3 - accounts - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT3); - odp.ptszTab = LPGENT("Accounts"); - odp.pfnDlgProc = DlgProcOpts_Tab3; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT3); + odp.ptszTab = LPGENT("Accounts"); + odp.pfnDlgProc = DlgProcOpts_Tab3; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index f4a04006f3..04a985eccc 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -99,9 +99,7 @@ void LoadOptions() { extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100; odp.hInstance = hInst; odp.ptszGroup = LPGENT("Services"); @@ -127,7 +125,6 @@ extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER); odp.pfnDlgProc = DlgProcMirOTROptsFinger; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index 8c085c8c97..4c3121d726 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -199,9 +199,8 @@ int HookedInit(WPARAM wParam, LPARAM lParam) int HookedOptions(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_POPUP_ADDPOPUP)){ - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + if (ServiceExists(MS_POPUP_ADDPOPUP)) { + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.ptszTitle = LPGENT("MessagePopup"); diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 1b1fbda9e5..0fc823fac2 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -1416,11 +1416,9 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa int OptionsInitialize(WPARAM wParam,LPARAM /*lParam*/) { - OPTIONSDIALOGPAGE odp = {0}; - bUnaplyedChanges = FALSE; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGEXPORT); diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index fad38ed23c..a92e9a6a1d 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -137,8 +137,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int InitOptionsCallback(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = hInst; odp.pfnDlgProc = DlgProcOpts; diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index d8e747d6e1..88754c3a99 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -325,18 +325,15 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int UserInfoInitialise(WPARAM wParam, LPARAM lParam) { - if (lParam == NULL) - return 0; - - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); - odp.position = 100000000; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS); - odp.pszTitle = LPGEN("Status Notify"); - odp.pfnDlgProc = DlgProcSoundUIPage; - UserInfo_AddPage(wParam, &odp); - + if (lParam) { + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.position = 100000000; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS); + odp.pszTitle = LPGEN("Status Notify"); + odp.pfnDlgProc = DlgProcSoundUIPage; + UserInfo_AddPage(wParam, &odp); + } return 0; } diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 4173d34f3d..3d1bcb0d6d 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -1024,9 +1024,7 @@ INT_PTR CALLBACK DlgProcXLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int OptionsInitialize(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; @@ -1065,6 +1063,5 @@ int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcSMPopupOpts; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index d2b8740033..f04aeca6ae 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -1,1365 +1,1341 @@ -// Copyright � 2010-2012 sss -// -// 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 "commonheaders.h" - -extern HINSTANCE hInst; - -static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) -{ - BOOL state = db_get_b(NULL, szGPGModuleName, szSetting, bDef); - CheckDlgButton(hwndDlg, idCtrl, state); - return state; -} - -BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting) -{ - BOOL state = IsDlgButtonChecked(hwndDlg, idCtrl); - db_set_b(NULL, szGPGModuleName, szSetting, (BYTE)state); - return state; -} - - -int GpgOptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG); - odp.ptszTitle = _T(szGPGModuleName); - odp.ptszGroup = LPGENT("Services"); - odp.ptszTab = LPGENT("Main"); - odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = DlgProcGpgOpts; - Options_AddPage(wParam, &odp); - - ZeroMemory(&odp, sizeof(odp)); - - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_BIN); - odp.ptszTitle = _T(szGPGModuleName); - odp.ptszGroup = LPGENT("Services"); - odp.ptszTab = LPGENT("GnuPG Variables"); - odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = DlgProcGpgBinOpts; - Options_AddPage(wParam, &odp); - - ZeroMemory(&odp, sizeof(odp)); - - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_MESSAGES); - odp.ptszTitle = _T(szGPGModuleName); - odp.ptszGroup = LPGENT("Services"); - odp.ptszTab = LPGENT("Messages"); - odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = DlgProcGpgMsgOpts; - Options_AddPage(wParam, &odp); - - ZeroMemory(&odp, sizeof(odp)); - - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_ADVANCED); - odp.ptszTitle = _T(szGPGModuleName); - odp.ptszGroup = LPGENT("Services"); - odp.ptszTab = LPGENT("Advanced"); - odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = DlgProcGpgAdvOpts; - Options_AddPage(wParam, &odp); - - return 0; -} - -map user_data; - -int item_num = 0; -HWND hwndList_p = NULL; -HWND hwndCurKey_p = NULL; - -void ShowLoadPublicKeyDialog(); -static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - HWND hwndList=GetDlgItem(hwndDlg, IDC_USERLIST); - hwndList_p = hwndList; - hwndCurKey_p = GetDlgItem(hwndDlg, IDC_CURRENT_KEY); - LVCOLUMN col = {0}; - LVITEM item = {0}; - TCHAR *tmp = NULL; - char *tmp2 = NULL; - extern bool bIsMiranda09, bJabberAPI; - NMLISTVIEW * hdr = (NMLISTVIEW *) lParam; - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - col.pszText = TranslateT("Contact"); - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.fmt = LVCFMT_LEFT; - col.cx = 60; - ListView_InsertColumn(hwndList, 0, &col); - ZeroMemory(&col,sizeof(col)); - col.pszText = TranslateT("Key ID"); - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.fmt = LVCFMT_LEFT; - col.cx = 50; - ListView_InsertColumn(hwndList, 1, &col); - ZeroMemory(&col,sizeof(col)); - col.pszText = TranslateT("Name"); - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.fmt = LVCFMT_LEFT; - col.cx = 50; - ListView_InsertColumn(hwndList, 2, &col); - ZeroMemory(&col,sizeof(col)); - col.pszText = TranslateT("Email"); - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.fmt = LVCFMT_LEFT; - col.cx = 50; - ListView_InsertColumn(hwndList, 3, &col); - ZeroMemory(&col,sizeof(col)); - col.pszText = TranslateT("Protocol"); - col.mask = LVCF_TEXT | LVCF_WIDTH; - col.fmt = LVCFMT_LEFT; - col.cx = 60; - ListView_InsertColumn(hwndList, 4, &col); - ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); - int i = 1, iRow = 0; - bool isContactHaveKey(HANDLE); - for(HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { - if(isContactHaveKey(hContact)) { - TCHAR *name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); - item.mask = LVIF_TEXT; - item.iItem = i; - item.iSubItem = 0; - item.pszText = name; - iRow = ListView_InsertItem(hwndList, &item); - ListView_SetItemText(hwndList, iRow, 0, name); - TCHAR *tmp = mir_a2t(GetContactProto(hContact)); - ListView_SetItemText(hwndList, iRow, 4, tmp); - mir_free(tmp); - tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - tmp = mir_a2t(tmp2); - mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); - mir_free(tmp); - char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); - if(!toUTF16(tmp2).empty()) - tmp = mir_wstrdup(toUTF16(tmp2).c_str()); - else - tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); - mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); - mir_free(tmp); - tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); - if(!toUTF16(tmp2).empty()) - tmp = mir_wstrdup(toUTF16(tmp2).c_str()); - else - tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); - mir_free(tmp2); - ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); - mir_free(tmp); - if(db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)) - ListView_SetCheckState(hwndList, iRow, 1); - user_data[i] = hContact; - ZeroMemory(&item,sizeof(item)); - ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this - ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); - i++; - } - } - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T("")); - SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (_tcslen(tmp) > 1)?tmp:_T("c:\\GPGdebug.log")); - mir_free(tmp); - CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); - EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && bJabberAPI)); - { - string keyinfo = Translate("Default private key id"); - keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); - mir_free(keyid); - SetDlgItemTextA(hwndDlg, IDC_CURRENT_KEY, keyinfo.c_str()); - } - if(bIsMiranda09) - CheckStateLoadDB(hwndDlg, IDC_JABBER_API, "bJabberAPI", 1); - CheckStateLoadDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers", 0); - CheckStateLoadDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange", 0); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_DELETE_KEY_BUTTON: - void setClistIcon(HANDLE hContact); - void setSrmmIcon(HANDLE hContact); - { //gpg execute block - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - char *tmp; - bool keep = false; - bool ismetacontact = false; - HANDLE meta = NULL; - HANDLE hContact = user_data[item_num+1]; - if(metaIsProtoMetaContacts(hContact)) - { - meta = hContact; - hContact = metaGetMostOnline(hContact); - ismetacontact = true; - } - else if((meta = metaGetContact(user_data[item_num+1])) != NULL) - { - hContact = metaGetMostOnline(meta); - ismetacontact = true; - } - tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - for(HANDLE hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) { - if(hcnttmp != hContact) { - char *tmp2 = UniGetContactSettingUtf(hcnttmp, szGPGModuleName, "KeyID", ""); - if(!strcmp(tmp, tmp2)) { - mir_free(tmp2); - keep = true; - break; - } - mir_free(tmp2); - } - } - if(!keep) - if(MessageBox(0, TranslateT("This key not used by any contact, do you want to remove it from public keyring ?"), TranslateT("Key info"), MB_YESNO) == IDYES) - { - std::vector cmd; - string output; - DWORD exitcode; - cmd.push_back(L"--batch"); - cmd.push_back(L"--yes"); - cmd.push_back(L"--delete-key"); - ptmp = mir_a2t(tmp); - cmd.push_back(ptmp); - mir_free(ptmp); - gpg_execution_params params(cmd); - pxResult result; - params.out = &output; - params.code = &exitcode; - params.result = &result; - if(!gpg_launcher(params)) - { - mir_free(tmp); - break; - } - if(result == pxNotFound) - { - mir_free(tmp); - break; - } - if(output.find("--delete-secret-keys") != string::npos) - MessageBox(0, TranslateT("we have secret key for this public key, do not removing from GPG keyring"), TranslateT("info"), MB_OK); - else - MessageBox(0, TranslateT("Key removed from GPG keyring"), TranslateT("info"), MB_OK); - } - mir_free(tmp); - if(ismetacontact) - { - if(MessageBox(0, TranslateT("Do you want to remove key from entire metacontact (all subcontacts) ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) - { - HANDLE hcnt = NULL; - int count = metaGetContactsNum(meta); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(meta, i); - if(hcnt) - { - db_unset(hcnt, szGPGModuleName, "KeyID"); - db_unset(hcnt, szGPGModuleName, "GPGPubKey"); - db_unset(hcnt, szGPGModuleName, "KeyMainName"); - db_unset(hcnt, szGPGModuleName, "KeyType"); - db_unset(hcnt, szGPGModuleName, "KeyMainEmail"); - db_unset(hcnt, szGPGModuleName, "KeyComment"); - setClistIcon(hcnt); - setSrmmIcon(hcnt); - } - } - } - else - { - db_unset(hContact, szGPGModuleName, "KeyID"); - db_unset(hContact, szGPGModuleName, "GPGPubKey"); - db_unset(hContact, szGPGModuleName, "KeyMainName"); - db_unset(hContact, szGPGModuleName, "KeyType"); - db_unset(hContact, szGPGModuleName, "KeyMainEmail"); - db_unset(hContact, szGPGModuleName, "KeyComment"); - setClistIcon(hContact); - setSrmmIcon(hContact); - } - } - else - { - db_unset(user_data[item_num+1], szGPGModuleName, "KeyID"); - db_unset(user_data[item_num+1], szGPGModuleName, "GPGPubKey"); - db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainName"); - db_unset(user_data[item_num+1], szGPGModuleName, "KeyType"); - db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainEmail"); - db_unset(user_data[item_num+1], szGPGModuleName, "KeyComment"); - setClistIcon(user_data[item_num+1]); - setSrmmIcon(user_data[item_num+1]); - } - } - ListView_SetItemText(hwndList, item_num, 3, TranslateT("not set")); - ListView_SetItemText(hwndList, item_num, 2, TranslateT("not set")); - ListView_SetItemText(hwndList, item_num, 1, TranslateT("not set")); - break; - case IDC_SELECT_KEY: - { - void ShowFirstRunDialog(); - ShowFirstRunDialog(); - } - break; - case IDC_SAVE_KEY_BUTTON: - { - tmp = GetFilePath(TranslateT("Export public key"), _T("*"), TranslateT(".asc pubkey file"), true); - if(!tmp) - { - break; - } - wstring str; - { - TCHAR *tmp = UniGetContactSettingUtf(user_data[item_num+1], szGPGModuleName, "GPGPubKey", _T("")); - str.append(tmp); - mir_free(tmp); - } - wstring::size_type s = 0; - while((s = str.find(_T("\r"), s)) != wstring::npos) - { - str.erase(s, 1); - } - wfstream f(tmp, std::ios::out); - delete [] tmp; - f<hdr.hwndFrom) && hdr->iItem != (-1)) - { - if(hdr->hdr.code == NM_CLICK) - { - item_num = hdr->iItem; - } - else if(hdr->hdr.code == LVN_ITEMCHANGED) - { - void setClistIcon(HANDLE hContact); - void setSrmmIcon(HANDLE hContact); - if(ListView_GetCheckState(hwndList, item_num)) - db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1); - else - db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0); - setClistIcon(user_data[item_num+1]); - setSrmmIcon(user_data[item_num+1]); - } - } - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - extern bool bJabberAPI, bFileTransfers; - bDebugLog = CheckStateStoreDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog"); - if(bDebugLog) - debuglog.init(); - bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI"); - bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0); - bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers"); - if(bFileTransfers != old_bFileTransfers) - { - db_set_b(NULL, szGPGModuleName, "bSameAction", 0); - bSameAction = false; - } - bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); - { - TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512); - db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp); - } - return TRUE; - } - } - } - break; - } - - return FALSE; -} - - -static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - TCHAR *tmp = NULL; - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe")); - SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("gpg")); - SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); - mir_free(tmp); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_SET_BIN_PATH: - { - GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", _T("*.exe"), TranslateT("EXE Executables")); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe")); - SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); - bool gpg_exists = false; - { - if(_waccess(tmp, 0) != -1) - gpg_exists = true; - if(gpg_exists) - { - bool bad_version = false; - TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); - db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - string out; - DWORD code; - std::vector cmd; - cmd.push_back(L"--version"); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - auto old_gpg_state = gpg_valid; - gpg_valid = true; - gpg_launcher(params); - gpg_valid = old_gpg_state; - db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp_path); - mir_free(tmp_path); - string::size_type p1 = out.find("(GnuPG) "); - if(p1 != string::npos) - { - p1 += strlen("(GnuPG) "); - if(out[p1] != '1') - bad_version = true; - } - else - { - bad_version = false; - MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); - } -/* if(bad_version) //looks like working fine with gpg2 - MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); */ - } - } - char mir_path[MAX_PATH]; - char *atmp = mir_t2a(tmp); - mir_free(tmp); - PathToAbsolute("\\", mir_path); - char* p_path = NULL; - if(StriStr(atmp, mir_path)) - { - p_path = atmp + strlen(mir_path); - tmp = mir_a2t(p_path); - SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); - } - } - break; - case IDC_SET_HOME_DIR: - { - GetFolderPath(TranslateT("Set home diractory"), "szHomePath"); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); - char mir_path[MAX_PATH]; - char *atmp = mir_t2a(tmp); - mir_free(tmp); - PathToAbsolute("\\", mir_path); - char* p_path = NULL; - if(StriStr(atmp, mir_path)) - { - p_path = atmp + strlen(mir_path); - tmp = mir_a2t(p_path); - SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); - } - mir_free(atmp); - } - break; - default: - break; - } - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); - db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); - while(tmp[_tcslen(tmp)-1] == '\\') - tmp[_tcslen(tmp)-1] = '\0'; - db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); - return TRUE; - } - } - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - CheckStateLoadDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags", 0); - CheckStateLoadDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags", 0); - { - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("")); - SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("")); - SetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("")); - SetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("")); - SetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp); - mir_free(tmp); - } - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_APPEND_TAGS: - break; - default: - break; - } - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags"); - bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags"); - { - TCHAR tmp[128]; - GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128); - db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp); - mir_free(inopentag); - inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); - _tcscpy(inopentag, tmp); - GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128); - db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp); - mir_free(inclosetag); - inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); - _tcscpy(inclosetag, tmp); - GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128); - db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp); - mir_free(outopentag); - outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); - _tcscpy(outopentag, tmp); - GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128); - db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp); - mir_free(outclosetag); - outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); - _tcscpy(outclosetag, tmp); - } - return TRUE; - } - } - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - extern bool bJabberAPI; - TranslateDialogDefault(hwndDlg); - CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning", 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION), bJabberAPI); - - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_EXPORT: - { - INT_PTR ExportGpGKeys(WPARAM w, LPARAM l); - ExportGpGKeys(NULL, NULL); - } - break; - case IDC_IMPORT: - { - INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); - ImportGpGKeys(NULL, NULL); - } - break; - default: - break; - } - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - bPresenceSigning = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning"); - return TRUE; - } - } - } - break; - } - return FALSE; -} - -HWND hPubKeyEdit = NULL; - -static LRESULT CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) -{ - switch(msg) { - case WM_KEYDOWN: - if(wParam == 0x41 && GetKeyState(VK_CONTROL)< 0 ) - SendMessage(hwndDlg, EM_SETSEL, 0, -1); - return 0; - } - return mir_callNextSubclass(hwndDlg, editctrl_ctrl_a, msg, wParam, lParam); -} - -static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) -{ - static HANDLE hContact; - TCHAR *tmp = NULL; - wstring key_buf; - wstring::size_type ws1 = 0, ws2 = 0; - switch (msg) { - case WM_INITDIALOG: - { - hContact = user_data[1]; - SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a); - HANDLE hcnt = hContact; - if(metaIsProtoMetaContacts(hcnt)) - hcnt = metaGetMostOnline(hcnt); - TranslateDialogDefault(hwndDlg); - { - string msg = Translate("Load Public GPG Key for "); - msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); - SetWindowTextA(hwndDlg, msg.c_str()); - } - bool isContactSecured(HANDLE); - if(!hcnt) - { - EnableWindow(GetDlgItem(hwndDlg, IDC_SELECT_EXISTING), 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE_ENCRYPTION), 0); - } - if(isContactSecured(hcnt)) - SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn off encryption")); - else - { - SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn on encryption")); - CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); - } - if(hcnt) - { - tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); - wstring str = tmp; - mir_free(tmp); tmp = NULL; - wstring::size_type p = 0, stop = 0; - if(!str.empty()) - { - for(;;) - { - if((p = str.find(_T("\n"), p+2)) != wstring::npos) - { - if(p > stop) - { - stop = p; - str.insert(p, _T("\r")); - } - else - break; - } - } - } - // char *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID_Prescense", ""); - if(!hcontact_data[hcnt].key_in_prescense.empty()) - { - char *tmp2 = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); - if(!tmp2[0]) - { - string out; - DWORD code; - std::vector cmd; - cmd.push_back(L"--export"); - cmd.push_back(L"-a"); - cmd.push_back(toUTF16(hcontact_data[hcnt].key_in_prescense)); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - gpg_launcher(params); //TODO: handle errors - if((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) - { - string::size_type p = 0, stop = 0; - for(;;) - { - if((p = out.find("\n", p+2)) != string::npos) - { - if(p > stop) - { - stop = p; - out.insert(p, "\r"); - } - else - break; - } - } - TCHAR *tmp3 = mir_a2t(out.c_str()); - str.clear(); - str.append(tmp3); - mir_free(tmp3); - string msg = Translate("Load Public GPG Key for "); - msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); - msg += " (Key ID: "; - msg += hcontact_data[hcnt].key_in_prescense; - msg += Translate(" found in prescense, and exists in keyring.)"); - SetWindowTextA(hwndDlg, msg.c_str()); - } - else - { - string msg = Translate("Load Public GPG Key (Key ID: "); - msg += hcontact_data[hcnt].key_in_prescense; - msg += Translate(" found in prescense.)"); - SetWindowTextA(hwndDlg, msg.c_str()); - EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT), 1); - } - } - mir_free(tmp2); - } - if(tmp) - mir_free(tmp); - SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty()?str.c_str():_T("")); - } - hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT); - return TRUE; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case ID_OK: - { - tmp = new TCHAR [40960]; - TCHAR *begin, *end; - GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960); - key_buf.append(tmp); - key_buf.append(_T("\n")); //no new line at end of file ) - delete [] tmp; - while((ws1 = key_buf.find(_T("\r"), ws1)) != wstring::npos) - { - key_buf.erase(ws1, 1); //remove windows specific trash - } - ws1 = 0; - if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) - { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); - _tcscpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (_tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); - _tcscpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----")); - } - else if(((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) - { - begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); - _tcscpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); - end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); - _tcscpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----")); - } - else - { - MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK); - break; - } - ws2 += _tcslen(end); - bool allsubcontacts = false; - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) - { - allsubcontacts = true; - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - } - else - db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - else - db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); - } - tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1)); - _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str()); - { //gpg execute block - std::vector cmd; - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - string output; - DWORD exitcode; - { - HANDLE hcnt = hContact; - if(metaIsProtoMetaContacts(hcnt)) - hcnt = metaGetMostOnline(hcnt); - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcscpy(tmp2, ptmp); - mir_free(ptmp); - _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); - boost::filesystem::remove(tmp2); - wfstream f(tmp2, std::ios::out); - ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); - wstring str = ptmp; - mir_free(ptmp); - wstring::size_type s = 0; - while((s = str.find(_T("\r"), s)) != wstring::npos) - { - str.erase(s, 1); - } - f< output.find("<", s)) - s2 = output.find("<", s); - if(s2 != string::npos && s != string::npos) - { - tmp2 = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); - strcpy(tmp2, output.substr(s,s2-s-(uncommon?1:0)).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - else - db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 2, tmp); - mir_free(tmp); - if((s = output.find(")", s2)) == string::npos) - s = output.find(">", s2); - else if(s > output.find(">", s2)) - s = output.find(">", s2); - s2++; - if(s != string::npos && s2 != string::npos) - { - if(output[s] == ')') - { - tmp2 = (char*)mir_alloc((output.substr(s2,s-s2).length()+1)*sizeof(char)); - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - else - db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - } - mir_free(tmp2); - s+=3; - s2 = output.find(">", s); - tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1) * sizeof(char)); - strcpy(tmp2, output.substr(s,s2-s).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - else - db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 3, tmp); - mir_free(tmp); - } - else - { - tmp2 = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - else - db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 3, tmp); - mir_free(tmp); - } - } - } - if(hContact && hwndList_p) - { - ListView_SetColumnWidth(hwndList_p, 0, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 1, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 2, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList_p, 3, LVSCW_AUTOSIZE); - } - } - if(!hContact) - { - TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", _T("")); - { - string out; - DWORD code; - std::vector cmd; - cmd.push_back(L"--batch"); - cmd.push_back(L"-a"); - cmd.push_back(L"--export"); - cmd.push_back(fp); - mir_free(fp); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - if(!gpg_launcher(params)) - break; - if(result == pxNotFound) - break; - string::size_type s = 0; - while((s = out.find("\r", s)) != string::npos) - { - out.erase(s, 1); - } - db_set_s(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); - } - } - tmp = mir_wstrdup(toUTF16(output).c_str()); - MessageBox(0, tmp, _T(""), MB_OK); - mir_free(tmp); - boost::filesystem::remove(tmp2); - } - key_buf.clear(); - if(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ENCRYPTION)) - { - void setSrmmIcon(HANDLE); - void setClistIcon(HANDLE); - if(hContact) - { - if(metaIsProtoMetaContacts(hContact)) - { - HANDLE hcnt = NULL; - if(allsubcontacts) - { - int count = metaGetContactsNum(hContact); - for(int i = 0; i < count; i++) - { - hcnt = metaGetSubcontact(hContact, i); - if(hcnt) - { - if(!isContactSecured(hcnt)) - db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 1); - else - db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 0); - setSrmmIcon(hContact); - setClistIcon(hContact); - } - } - } - else if(!isContactSecured(hContact)) - db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); - else - db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); - } - else if(!isContactSecured(hContact)) - db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); - else - db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); - } - } - DestroyWindow(hwndDlg); - } - break; - case ID_LOAD_FROM_FILE: - { - tmp = GetFilePath(TranslateT("Set file containing GPG public key"), _T("*"), TranslateT("GPG public key file")); - if(!tmp) - { - break; - } - wfstream f(tmp, std::ios::in | std::ios::ate | std::ios::binary); - delete [] tmp; - if(!f.is_open()) - { - MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); - break; - } - if(f.is_open()) - { - std::wifstream::pos_type size = f.tellg(); - TCHAR *tmp = new TCHAR [(std::ifstream::pos_type)size+(std::ifstream::pos_type)1]; - f.seekg(0, std::ios::beg); - f.read(tmp, size); - tmp[size]= '\0'; - key_buf.append(tmp); - delete [] tmp; - f.close(); - } - if(key_buf.empty()) - { - key_buf.clear(); - if(bDebugLog) - debuglog<code) { - case PSN_APPLY: - return TRUE; - } - break; - - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - - case WM_DESTROY: - GetWindowRect(hwndDlg, &load_key_rect); - db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); - db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); - break; - } - - return FALSE; -} - -void ShowLoadPublicKeyDialog() -{ - DialogBox(hInst, MAKEINTRESOURCE(IDD_LOAD_PUBLIC_KEY), NULL, DlgProcLoadPublicKey); -} +// Copyright � 2010-2012 sss +// +// 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 "commonheaders.h" + +extern HINSTANCE hInst; + +static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) +{ + BOOL state = db_get_b(NULL, szGPGModuleName, szSetting, bDef); + CheckDlgButton(hwndDlg, idCtrl, state); + return state; +} + +BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting) +{ + BOOL state = IsDlgButtonChecked(hwndDlg, idCtrl); + db_set_b(NULL, szGPGModuleName, szSetting, (BYTE)state); + return state; +} + +int GpgOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG); + odp.ptszTitle = _T(szGPGModuleName); + odp.ptszGroup = LPGENT("Services"); + odp.ptszTab = LPGENT("Main"); + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.pfnDlgProc = DlgProcGpgOpts; + Options_AddPage(wParam, &odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_BIN); + odp.ptszTab = LPGENT("GnuPG Variables"); + odp.pfnDlgProc = DlgProcGpgBinOpts; + Options_AddPage(wParam, &odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_MESSAGES); + odp.ptszTab = LPGENT("Messages"); + odp.pfnDlgProc = DlgProcGpgMsgOpts; + Options_AddPage(wParam, &odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_ADVANCED); + odp.ptszTab = LPGENT("Advanced"); + odp.pfnDlgProc = DlgProcGpgAdvOpts; + Options_AddPage(wParam, &odp); + return 0; +} + +map user_data; + +int item_num = 0; +HWND hwndList_p = NULL; +HWND hwndCurKey_p = NULL; + +void ShowLoadPublicKeyDialog(); +static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND hwndList=GetDlgItem(hwndDlg, IDC_USERLIST); + hwndList_p = hwndList; + hwndCurKey_p = GetDlgItem(hwndDlg, IDC_CURRENT_KEY); + LVCOLUMN col = {0}; + LVITEM item = {0}; + TCHAR *tmp = NULL; + char *tmp2 = NULL; + extern bool bIsMiranda09, bJabberAPI; + NMLISTVIEW * hdr = (NMLISTVIEW *) lParam; + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + col.pszText = TranslateT("Contact"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 60; + ListView_InsertColumn(hwndList, 0, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = TranslateT("Key ID"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 1, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = TranslateT("Name"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 2, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = TranslateT("Email"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 3, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = TranslateT("Protocol"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 60; + ListView_InsertColumn(hwndList, 4, &col); + ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); + int i = 1, iRow = 0; + bool isContactHaveKey(HANDLE); + for(HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { + if(isContactHaveKey(hContact)) { + TCHAR *name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); + item.mask = LVIF_TEXT; + item.iItem = i; + item.iSubItem = 0; + item.pszText = name; + iRow = ListView_InsertItem(hwndList, &item); + ListView_SetItemText(hwndList, iRow, 0, name); + TCHAR *tmp = mir_a2t(GetContactProto(hContact)); + ListView_SetItemText(hwndList, iRow, 4, tmp); + mir_free(tmp); + tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); + tmp = mir_a2t(tmp2); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); + if(!toUTF16(tmp2).empty()) + tmp = mir_wstrdup(toUTF16(tmp2).c_str()); + else + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); + if(!toUTF16(tmp2).empty()) + tmp = mir_wstrdup(toUTF16(tmp2).c_str()); + else + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + if(db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)) + ListView_SetCheckState(hwndList, iRow, 1); + user_data[i] = hContact; + ZeroMemory(&item,sizeof(item)); + ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this + ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); + i++; + } + } + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T("")); + SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (_tcslen(tmp) > 1)?tmp:_T("c:\\GPGdebug.log")); + mir_free(tmp); + CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && bJabberAPI)); + { + string keyinfo = Translate("Default private key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_CURRENT_KEY, keyinfo.c_str()); + } + if(bIsMiranda09) + CheckStateLoadDB(hwndDlg, IDC_JABBER_API, "bJabberAPI", 1); + CheckStateLoadDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers", 0); + CheckStateLoadDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange", 0); + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_DELETE_KEY_BUTTON: + void setClistIcon(HANDLE hContact); + void setSrmmIcon(HANDLE hContact); + { //gpg execute block + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + char *tmp; + bool keep = false; + bool ismetacontact = false; + HANDLE meta = NULL; + HANDLE hContact = user_data[item_num+1]; + if(metaIsProtoMetaContacts(hContact)) + { + meta = hContact; + hContact = metaGetMostOnline(hContact); + ismetacontact = true; + } + else if((meta = metaGetContact(user_data[item_num+1])) != NULL) + { + hContact = metaGetMostOnline(meta); + ismetacontact = true; + } + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); + for(HANDLE hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) { + if(hcnttmp != hContact) { + char *tmp2 = UniGetContactSettingUtf(hcnttmp, szGPGModuleName, "KeyID", ""); + if(!strcmp(tmp, tmp2)) { + mir_free(tmp2); + keep = true; + break; + } + mir_free(tmp2); + } + } + if(!keep) + if(MessageBox(0, TranslateT("This key not used by any contact, do you want to remove it from public keyring ?"), TranslateT("Key info"), MB_YESNO) == IDYES) + { + std::vector cmd; + string output; + DWORD exitcode; + cmd.push_back(L"--batch"); + cmd.push_back(L"--yes"); + cmd.push_back(L"--delete-key"); + ptmp = mir_a2t(tmp); + cmd.push_back(ptmp); + mir_free(ptmp); + gpg_execution_params params(cmd); + pxResult result; + params.out = &output; + params.code = &exitcode; + params.result = &result; + if(!gpg_launcher(params)) + { + mir_free(tmp); + break; + } + if(result == pxNotFound) + { + mir_free(tmp); + break; + } + if(output.find("--delete-secret-keys") != string::npos) + MessageBox(0, TranslateT("we have secret key for this public key, do not removing from GPG keyring"), TranslateT("info"), MB_OK); + else + MessageBox(0, TranslateT("Key removed from GPG keyring"), TranslateT("info"), MB_OK); + } + mir_free(tmp); + if(ismetacontact) + { + if(MessageBox(0, TranslateT("Do you want to remove key from entire metacontact (all subcontacts) ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) + { + HANDLE hcnt = NULL; + int count = metaGetContactsNum(meta); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(meta, i); + if(hcnt) + { + db_unset(hcnt, szGPGModuleName, "KeyID"); + db_unset(hcnt, szGPGModuleName, "GPGPubKey"); + db_unset(hcnt, szGPGModuleName, "KeyMainName"); + db_unset(hcnt, szGPGModuleName, "KeyType"); + db_unset(hcnt, szGPGModuleName, "KeyMainEmail"); + db_unset(hcnt, szGPGModuleName, "KeyComment"); + setClistIcon(hcnt); + setSrmmIcon(hcnt); + } + } + } + else + { + db_unset(hContact, szGPGModuleName, "KeyID"); + db_unset(hContact, szGPGModuleName, "GPGPubKey"); + db_unset(hContact, szGPGModuleName, "KeyMainName"); + db_unset(hContact, szGPGModuleName, "KeyType"); + db_unset(hContact, szGPGModuleName, "KeyMainEmail"); + db_unset(hContact, szGPGModuleName, "KeyComment"); + setClistIcon(hContact); + setSrmmIcon(hContact); + } + } + else + { + db_unset(user_data[item_num+1], szGPGModuleName, "KeyID"); + db_unset(user_data[item_num+1], szGPGModuleName, "GPGPubKey"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainName"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyType"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainEmail"); + db_unset(user_data[item_num+1], szGPGModuleName, "KeyComment"); + setClistIcon(user_data[item_num+1]); + setSrmmIcon(user_data[item_num+1]); + } + } + ListView_SetItemText(hwndList, item_num, 3, TranslateT("not set")); + ListView_SetItemText(hwndList, item_num, 2, TranslateT("not set")); + ListView_SetItemText(hwndList, item_num, 1, TranslateT("not set")); + break; + case IDC_SELECT_KEY: + { + void ShowFirstRunDialog(); + ShowFirstRunDialog(); + } + break; + case IDC_SAVE_KEY_BUTTON: + { + tmp = GetFilePath(TranslateT("Export public key"), _T("*"), TranslateT(".asc pubkey file"), true); + if(!tmp) + { + break; + } + wstring str; + { + TCHAR *tmp = UniGetContactSettingUtf(user_data[item_num+1], szGPGModuleName, "GPGPubKey", _T("")); + str.append(tmp); + mir_free(tmp); + } + wstring::size_type s = 0; + while((s = str.find(_T("\r"), s)) != wstring::npos) + { + str.erase(s, 1); + } + wfstream f(tmp, std::ios::out); + delete [] tmp; + f<hdr.hwndFrom) && hdr->iItem != (-1)) + { + if(hdr->hdr.code == NM_CLICK) + { + item_num = hdr->iItem; + } + else if(hdr->hdr.code == LVN_ITEMCHANGED) + { + void setClistIcon(HANDLE hContact); + void setSrmmIcon(HANDLE hContact); + if(ListView_GetCheckState(hwndList, item_num)) + db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1); + else + db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0); + setClistIcon(user_data[item_num+1]); + setSrmmIcon(user_data[item_num+1]); + } + } + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + extern bool bJabberAPI, bFileTransfers; + bDebugLog = CheckStateStoreDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog"); + if(bDebugLog) + debuglog.init(); + bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI"); + bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0); + bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers"); + if(bFileTransfers != old_bFileTransfers) + { + db_set_b(NULL, szGPGModuleName, "bSameAction", 0); + bSameAction = false; + } + bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); + { + TCHAR tmp[512]; + GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512); + db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp); + } + return TRUE; + } + } + } + break; + } + + return FALSE; +} + + +static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + TCHAR *tmp = NULL; + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe")); + SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); + mir_free(tmp); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("gpg")); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); + mir_free(tmp); + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_SET_BIN_PATH: + { + GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", _T("*.exe"), TranslateT("EXE Executables")); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe")); + SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); + bool gpg_exists = false; + { + if(_waccess(tmp, 0) != -1) + gpg_exists = true; + if(gpg_exists) + { + bool bad_version = false; + TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); + string out; + DWORD code; + std::vector cmd; + cmd.push_back(L"--version"); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + auto old_gpg_state = gpg_valid; + gpg_valid = true; + gpg_launcher(params); + gpg_valid = old_gpg_state; + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp_path); + mir_free(tmp_path); + string::size_type p1 = out.find("(GnuPG) "); + if(p1 != string::npos) + { + p1 += strlen("(GnuPG) "); + if(out[p1] != '1') + bad_version = true; + } + else + { + bad_version = false; + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); + } +/* if(bad_version) //looks like working fine with gpg2 + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); */ + } + } + char mir_path[MAX_PATH]; + char *atmp = mir_t2a(tmp); + mir_free(tmp); + PathToAbsolute("\\", mir_path); + char* p_path = NULL; + if(StriStr(atmp, mir_path)) + { + p_path = atmp + strlen(mir_path); + tmp = mir_a2t(p_path); + SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); + } + } + break; + case IDC_SET_HOME_DIR: + { + GetFolderPath(TranslateT("Set home diractory"), "szHomePath"); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); + char mir_path[MAX_PATH]; + char *atmp = mir_t2a(tmp); + mir_free(tmp); + PathToAbsolute("\\", mir_path); + char* p_path = NULL; + if(StriStr(atmp, mir_path)) + { + p_path = atmp + strlen(mir_path); + tmp = mir_a2t(p_path); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); + } + mir_free(atmp); + } + break; + default: + break; + } + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + TCHAR tmp[512]; + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); + db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + while(tmp[_tcslen(tmp)-1] == '\\') + tmp[_tcslen(tmp)-1] = '\0'; + db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); + return TRUE; + } + } + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + CheckStateLoadDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags", 0); + CheckStateLoadDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags", 0); + { + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("")); + SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp); + mir_free(tmp); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("")); + SetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp); + mir_free(tmp); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("")); + SetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp); + mir_free(tmp); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("")); + SetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp); + mir_free(tmp); + } + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_APPEND_TAGS: + break; + default: + break; + } + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags"); + bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags"); + { + TCHAR tmp[128]; + GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128); + db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp); + mir_free(inopentag); + inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + _tcscpy(inopentag, tmp); + GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128); + db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp); + mir_free(inclosetag); + inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + _tcscpy(inclosetag, tmp); + GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128); + db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp); + mir_free(outopentag); + outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1)); + _tcscpy(outopentag, tmp); + GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128); + db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp); + mir_free(outclosetag); + outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); + _tcscpy(outclosetag, tmp); + } + return TRUE; + } + } + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + extern bool bJabberAPI; + TranslateDialogDefault(hwndDlg); + CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning", 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION), bJabberAPI); + + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_EXPORT: + { + INT_PTR ExportGpGKeys(WPARAM w, LPARAM l); + ExportGpGKeys(NULL, NULL); + } + break; + case IDC_IMPORT: + { + INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); + ImportGpGKeys(NULL, NULL); + } + break; + default: + break; + } + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + bPresenceSigning = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning"); + return TRUE; + } + } + } + break; + } + return FALSE; +} + +HWND hPubKeyEdit = NULL; + +static LRESULT CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch(msg) { + case WM_KEYDOWN: + if(wParam == 0x41 && GetKeyState(VK_CONTROL)< 0 ) + SendMessage(hwndDlg, EM_SETSEL, 0, -1); + return 0; + } + return mir_callNextSubclass(hwndDlg, editctrl_ctrl_a, msg, wParam, lParam); +} + +static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +{ + static HANDLE hContact; + TCHAR *tmp = NULL; + wstring key_buf; + wstring::size_type ws1 = 0, ws2 = 0; + switch (msg) { + case WM_INITDIALOG: + { + hContact = user_data[1]; + SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a); + HANDLE hcnt = hContact; + if(metaIsProtoMetaContacts(hcnt)) + hcnt = metaGetMostOnline(hcnt); + TranslateDialogDefault(hwndDlg); + { + string msg = Translate("Load Public GPG Key for "); + msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); + SetWindowTextA(hwndDlg, msg.c_str()); + } + bool isContactSecured(HANDLE); + if(!hcnt) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_SELECT_EXISTING), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE_ENCRYPTION), 0); + } + if(isContactSecured(hcnt)) + SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn off encryption")); + else + { + SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateT("Turn on encryption")); + CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); + } + if(hcnt) + { + tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); + wstring str = tmp; + mir_free(tmp); tmp = NULL; + wstring::size_type p = 0, stop = 0; + if(!str.empty()) + { + for(;;) + { + if((p = str.find(_T("\n"), p+2)) != wstring::npos) + { + if(p > stop) + { + stop = p; + str.insert(p, _T("\r")); + } + else + break; + } + } + } + // char *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID_Prescense", ""); + if(!hcontact_data[hcnt].key_in_prescense.empty()) + { + char *tmp2 = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); + if(!tmp2[0]) + { + string out; + DWORD code; + std::vector cmd; + cmd.push_back(L"--export"); + cmd.push_back(L"-a"); + cmd.push_back(toUTF16(hcontact_data[hcnt].key_in_prescense)); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + gpg_launcher(params); //TODO: handle errors + if((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) + { + string::size_type p = 0, stop = 0; + for(;;) + { + if((p = out.find("\n", p+2)) != string::npos) + { + if(p > stop) + { + stop = p; + out.insert(p, "\r"); + } + else + break; + } + } + TCHAR *tmp3 = mir_a2t(out.c_str()); + str.clear(); + str.append(tmp3); + mir_free(tmp3); + string msg = Translate("Load Public GPG Key for "); + msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0); + msg += " (Key ID: "; + msg += hcontact_data[hcnt].key_in_prescense; + msg += Translate(" found in prescense, and exists in keyring.)"); + SetWindowTextA(hwndDlg, msg.c_str()); + } + else + { + string msg = Translate("Load Public GPG Key (Key ID: "); + msg += hcontact_data[hcnt].key_in_prescense; + msg += Translate(" found in prescense.)"); + SetWindowTextA(hwndDlg, msg.c_str()); + EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT), 1); + } + } + mir_free(tmp2); + } + if(tmp) + mir_free(tmp); + SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty()?str.c_str():_T("")); + } + hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT); + return TRUE; + } + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case ID_OK: + { + tmp = new TCHAR [40960]; + TCHAR *begin, *end; + GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960); + key_buf.append(tmp); + key_buf.append(_T("\n")); //no new line at end of file ) + delete [] tmp; + while((ws1 = key_buf.find(_T("\r"), ws1)) != wstring::npos) + { + key_buf.erase(ws1, 1); //remove windows specific trash + } + ws1 = 0; + if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) + { + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1)); + _tcscpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); + end = (TCHAR*)mir_alloc(sizeof( TCHAR) * (_tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1)); + _tcscpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----")); + } + else if(((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) + { + begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1)); + _tcscpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); + end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1)); + _tcscpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----")); + } + else + { + MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK); + break; + } + ws2 += _tcslen(end); + bool allsubcontacts = false; + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) + { + allsubcontacts = true; + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + } + else + db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + else + db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); + } + tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1)); + _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str()); + { //gpg execute block + std::vector cmd; + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + string output; + DWORD exitcode; + { + HANDLE hcnt = hContact; + if(metaIsProtoMetaContacts(hcnt)) + hcnt = metaGetMostOnline(hcnt); + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + _tcscpy(tmp2, ptmp); + mir_free(ptmp); + _tcscat(tmp2, _T("\\")); + _tcscat(tmp2, _T("temporary_exported.asc")); + boost::filesystem::remove(tmp2); + wfstream f(tmp2, std::ios::out); + ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); + wstring str = ptmp; + mir_free(ptmp); + wstring::size_type s = 0; + while((s = str.find(_T("\r"), s)) != wstring::npos) + { + str.erase(s, 1); + } + f< output.find("<", s)) + s2 = output.find("<", s); + if(s2 != string::npos && s != string::npos) + { + tmp2 = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1)); + strcpy(tmp2, output.substr(s,s2-s-(uncommon?1:0)).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + } + else + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + else + db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 2, tmp); + mir_free(tmp); + if((s = output.find(")", s2)) == string::npos) + s = output.find(">", s2); + else if(s > output.find(">", s2)) + s = output.find(">", s2); + s2++; + if(s != string::npos && s2 != string::npos) + { + if(output[s] == ')') + { + tmp2 = (char*)mir_alloc((output.substr(s2,s-s2).length()+1)*sizeof(char)); + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + } + else + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + else + db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + } + mir_free(tmp2); + s+=3; + s2 = output.find(">", s); + tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1) * sizeof(char)); + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + } + else + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + else + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 3, tmp); + mir_free(tmp); + } + else + { + tmp2 = (char*)mir_alloc(output.substr(s2,s-s2).length()+1); + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + } + else + db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + else + db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + } + mir_free(tmp2); + tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); + if(hContact && hwndList_p) + ListView_SetItemText(hwndList_p, item_num, 3, tmp); + mir_free(tmp); + } + } + } + if(hContact && hwndList_p) + { + ListView_SetColumnWidth(hwndList_p, 0, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 3, LVSCW_AUTOSIZE); + } + } + if(!hContact) + { + TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", _T("")); + { + string out; + DWORD code; + std::vector cmd; + cmd.push_back(L"--batch"); + cmd.push_back(L"-a"); + cmd.push_back(L"--export"); + cmd.push_back(fp); + mir_free(fp); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + if(!gpg_launcher(params)) + break; + if(result == pxNotFound) + break; + string::size_type s = 0; + while((s = out.find("\r", s)) != string::npos) + { + out.erase(s, 1); + } + db_set_s(hContact, szGPGModuleName, "GPGPubKey", out.c_str()); + } + } + tmp = mir_wstrdup(toUTF16(output).c_str()); + MessageBox(0, tmp, _T(""), MB_OK); + mir_free(tmp); + boost::filesystem::remove(tmp2); + } + key_buf.clear(); + if(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ENCRYPTION)) + { + void setSrmmIcon(HANDLE); + void setClistIcon(HANDLE); + if(hContact) + { + if(metaIsProtoMetaContacts(hContact)) + { + HANDLE hcnt = NULL; + if(allsubcontacts) + { + int count = metaGetContactsNum(hContact); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(hContact, i); + if(hcnt) + { + if(!isContactSecured(hcnt)) + db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 1); + else + db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 0); + setSrmmIcon(hContact); + setClistIcon(hContact); + } + } + } + else if(!isContactSecured(hContact)) + db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + else + db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); + } + else if(!isContactSecured(hContact)) + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); + else + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0); + } + } + DestroyWindow(hwndDlg); + } + break; + case ID_LOAD_FROM_FILE: + { + tmp = GetFilePath(TranslateT("Set file containing GPG public key"), _T("*"), TranslateT("GPG public key file")); + if(!tmp) + { + break; + } + wfstream f(tmp, std::ios::in | std::ios::ate | std::ios::binary); + delete [] tmp; + if(!f.is_open()) + { + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); + break; + } + if(f.is_open()) + { + std::wifstream::pos_type size = f.tellg(); + TCHAR *tmp = new TCHAR [(std::ifstream::pos_type)size+(std::ifstream::pos_type)1]; + f.seekg(0, std::ios::beg); + f.read(tmp, size); + tmp[size]= '\0'; + key_buf.append(tmp); + delete [] tmp; + f.close(); + } + if(key_buf.empty()) + { + key_buf.clear(); + if(bDebugLog) + debuglog<code) { + case PSN_APPLY: + return TRUE; + } + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + GetWindowRect(hwndDlg, &load_key_rect); + db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); + break; + } + + return FALSE; +} + +void ShowLoadPublicKeyDialog() +{ + DialogBox(hInst, MAKEINTRESOURCE(IDD_LOAD_PUBLIC_KEY), NULL, DlgProcLoadPublicKey); +} diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 660b0a41d2..3bb0919e47 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -117,8 +117,7 @@ void InitIcons(void) int OnOptInitialise(WPARAM w, LPARAM L) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900002000; odp.hInstance = hinstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_STNOTEOPTIONS); diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp index 197a5006db..b89cadc97d 100644 --- a/plugins/Nudge/src/options.cpp +++ b/plugins/Nudge/src/options.cpp @@ -4,8 +4,7 @@ CNudgeElement* ActualNudge = NULL; int NudgeOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NUDGE); diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index f2762c6140..8781c25601 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -420,8 +420,7 @@ return FALSE; int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index 41b3b14c07..5a51cdc04b 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -761,9 +761,7 @@ void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage) int Options::InitOptions(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; @@ -779,7 +777,6 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PAGES); odp.pfnDlgProc = Options::DlgProcOptsPages; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index 1b0d6ea8dd..0f9e45726e 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -559,23 +559,21 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int PingOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = LPGENT("PING"); - - odp.ptszTab = LPGENT("Settings"); - odp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1); - odp.pfnDlgProc = DlgProcOpts; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.hInstance = hInst; + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; + odp.ptszGroup = LPGENT("Network"); + odp.ptszTitle = LPGENT("PING"); + + odp.ptszTab = LPGENT("Settings"); + odp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1); + odp.pfnDlgProc = DlgProcOpts; Options_AddPage(wParam,&odp); - odp.ptszTab = LPGENT("Hosts"); - odp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG2); - odp.pfnDlgProc = DlgProcOpts2; + odp.ptszTab = LPGENT("Hosts"); + odp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG2); + odp.pfnDlgProc = DlgProcOpts2; Options_AddPage(wParam,&odp); - return 0; } diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 30e06842cf..19bfa94821 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -394,8 +394,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp index 69e6b0968e..975c4e282a 100644 --- a/plugins/QuickContacts/src/options.cpp +++ b/plugins/QuickContacts/src/options.cpp @@ -49,23 +49,17 @@ void LoadOptions() int InitOptionsCallback(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp,sizeof(odp)); - odp.cbSize=sizeof(odp); - odp.position=0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance=hInst; odp.ptszGroup = LPGENT("Contacts"); odp.ptszTitle = LPGENT("Quick Contacts"); odp.pfnDlgProc = OptionsDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT); - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; Options_AddPage(wParam,&odp); - return 0; } - void InitOptions() { LoadOptions(); diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 8d0ea49efb..03c78fabff 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -1147,6 +1147,5 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszGroup = LPGEN("Message Sessions"); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wparam,&odp); - return 0; } diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 6cb7798b74..2c5b858671 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -173,15 +173,13 @@ int OnOptInitialized(WPARAM wParam, LPARAM lParam) mir_snprintf(tabName, SIZEOF(tabName), "Button %x", iNumber + 1); OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.pszGroup = LPGEN("Message Sessions"); - odp.pszTitle = LPGEN("Quick Replies"); - odp.pszTab = tabName; - odp.position = iNumber; - odp.hInstance = hInstance; - - odp.pszTemplate= MAKEINTRESOURCEA(IDD_OPTIONS_PAGE); + odp.pszGroup = LPGEN("Message Sessions"); + odp.pszTitle = LPGEN("Quick Replies"); + odp.pszTab = tabName; + odp.position = iNumber; + odp.hInstance = hInstance; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PAGE); odp.pfnDlgProc = DlgProcOptionsPage; Options_AddPage(wParam, &odp); - return 0; } \ No newline at end of file diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 32240ea123..4d61bd793b 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -311,8 +311,7 @@ namespace const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders(); - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInstance; odp.ptszTitle = _T(QUOTES_PROTOCOL_NAME); diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 756a17ad8f..d21b3f2fed 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -120,22 +120,15 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) { HANDLE hContact = reinterpret_cast(lp); if(NULL == hContact) - { return 0; - } - if(false == IsMyContact(hContact)) - { return 0; - } g_hContact = hContact; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof( odp ); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; - odp.hIcon = Quotes_LoadIconEx(ICON_STR_MAIN); odp.pfnDlgProc = QuoteInfoDlgProc; odp.position = -2000000000; diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index e7c9a16d06..cbd121ea4b 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -299,7 +299,7 @@ namespace } } -void CQuotesProviderFinance::ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) +void CQuotesProviderFinance::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_FINANCE); odp.pfnDlgProc = GoogleFinanceOptDlgProc; diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index bc07ec0f80..f2fbc5f8ca 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -445,19 +445,11 @@ namespace } } -void CQuotesProviderGoogle::ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) +void CQuotesProviderGoogle::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_GOOGLE); odp.pfnDlgProc = GoogleOptDlgProc; -// #if MIRANDA_VER >= 0x0600 - //odp.ptszTab = TranslateTS(const_cast(GetInfo().m_sName.c_str())); odp.ptszTab = const_cast(GetInfo().m_sName.c_str()); -// #else -// tostringstream o; -// o << TranslateTS(QUOTES_PROTOCOL_NAME) << _T(" - ") << TranslateTS(GetInfo().m_sName.c_str()); -// tstring sTitle = o.str(); -// odp.ptszTitle = TranslateTS(const_cast(sTitle.c_str())); -// #endif Options_AddPage(wp, &odp); } diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp index 4e082f85f0..e3905cff99 100644 --- a/plugins/RecentContacts/src/options.cpp +++ b/plugins/RecentContacts/src/options.cpp @@ -59,8 +59,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int onOptInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Contacts"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_LASTUC_OPT); @@ -68,6 +67,5 @@ int onOptInitialise(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcOptions; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index d426a179af..aa93737fa9 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -753,8 +753,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam static int OptionsInitialize(WPARAM wParam, LPARAM lParam) { if (g_dat.popupInstalled) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000002; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); @@ -762,7 +761,6 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pszGroup = LPGEN("Popups"); odp.pfnDlgProc = DlgProcOptionsPopup; odp.flags = ODPF_BOLDGROUPS; - odp.ptszTab = NULL; Options_AddPage(wParam, &odp); } diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 2a9354c5f1..6faf689160 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -1071,14 +1071,12 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam int OptInitialise(WPARAM wParam, LPARAM lParam) { - DWORD i; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInst; odp.pszTitle = LPGEN("Message Sessions"); odp.flags = ODPF_BOLDGROUPS; - for (i = 0; i < SIZEOF(tabPages); i++) { + for (int i = 0; i < SIZEOF(tabPages); i++) { odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId); odp.pfnDlgProc = tabPages[i].dlgProc; odp.pszTab = (char*)tabPages[i].tabName; @@ -1091,6 +1089,5 @@ int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcTypeOptions; odp.pszTab = NULL; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index fe8a8a2e59..caaae48365 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -503,6 +503,5 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszGroup = LPGEN("Message Sessions"); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wparam,&odp); - return 0; } diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index 4eca85a0dd..ac80cda1e6 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -150,8 +150,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara INT OptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hinstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTION); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 948bb912e4..d17b66b39d 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -1672,8 +1672,7 @@ int InitOptions(WPARAM wParam, LPARAM lParam) if (accounts->statusCount == 0) return 0; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.flags = ODPF_BOLDGROUPS; @@ -1704,6 +1703,5 @@ int InitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADVANCED); odp.pfnDlgProc = DlgAdvancedOptionsProc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 191bb92c58..62e1668848 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -53,8 +53,7 @@ static INT_PTR CALLBACK DlgProcSmileysOptions(HWND hwndDlg, UINT msg, WPARAM wPa //Init and de-init functions, called from main int SmileysOptionsInitialize(WPARAM addInfo, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMILEYS); @@ -63,7 +62,6 @@ int SmileysOptionsInitialize(WPARAM addInfo, LPARAM) odp.pfnDlgProc = DlgProcSmileysOptions; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(addInfo, &odp); - return 0; } diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 7ca88475f6..a2e4e3e0b3 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -559,9 +559,7 @@ extern INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wPara int OnOptInitialize(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.ptszGroup = LPGENT("Message Sessions"); odp.ptszTitle = _T(PLUGIN_NAME); @@ -589,6 +587,5 @@ int OnOptInitialize(WPARAM wParam, LPARAM lParam) odp.ptszTab = NULL; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index dd574537da..748e80163e 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -55,8 +55,7 @@ static OptPageControl autoReplaceControls[] = { int InitOptionsCallback(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Message Sessions"); odp.pszTitle = LPGEN("Spell Checker"); @@ -74,7 +73,6 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_REPLACEMENTS); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index ddbaadc001..5be6b5b57a 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -429,8 +429,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Skins"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPLASH_OPT); diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp index 127845c51d..f30a750d26 100644 --- a/plugins/StartPosition/src/main.cpp +++ b/plugins/StartPosition/src/main.cpp @@ -193,9 +193,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int OptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pszGroup = LPGEN("Contact List"); @@ -203,7 +201,6 @@ int OptInit(WPARAM wParam, LPARAM) odp.pfnDlgProc = OptionsDlgProc; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/StatusChange/src/main.cpp b/plugins/StatusChange/src/main.cpp index 012dabeeaa..06f6baf7fb 100644 --- a/plugins/StatusChange/src/main.cpp +++ b/plugins/StatusChange/src/main.cpp @@ -313,8 +313,7 @@ static INT_PTR CALLBACK DlgProcStatusChangeOpts(HWND hwndDlg, UINT msg, WPARAM w int StatusChangeOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.ptszTitle = LPGENT("Status Change"); diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index 9c89937a0f..329b83a986 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -520,8 +520,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM wPara int AutoAwayOptInitialise(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 1000000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index 5af3bc584f..934c494ee2 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -565,16 +565,14 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar int OptionsInit(WPARAM wparam,LPARAM lparam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.ptszGroup = LPGENT("Status"); odp.ptszTitle = LPGENT("KeepStatus"); - odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; - + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); - odp.pfnDlgProc = DlgProcKsTabs; - Options_AddPage(wparam,&odp); + odp.pfnDlgProc = DlgProcKsTabs; + Options_AddPage(wparam, &odp); if ( ServiceExists( MS_POPUP_ADDPOPUPT )) { ZeroMemory(&odp,sizeof(odp)); @@ -589,6 +587,5 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; Options_AddPage(wparam,&odp); } - return 0; } diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index ad68999701..c2ecff2710 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -908,19 +908,19 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP int OptionsInit(WPARAM wparam,LPARAM lparam) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = hInst; - odp.pszGroup = LPGEN("Status"); - odp.pszTitle = LPGEN("StartupStatus"); - odp.flags = ODPF_BOLDGROUPS; + odp.hInstance = hInst; + odp.pszGroup = LPGEN("Status"); + odp.pszTitle = LPGEN("StartupStatus"); + odp.flags = ODPF_BOLDGROUPS; - odp.pszTab = LPGEN("General"); + odp.pszTab = LPGEN("General"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STARTUPSTATUS); - odp.pfnDlgProc = StartupStatusOptDlgProc; + odp.pfnDlgProc = StartupStatusOptDlgProc; Options_AddPage(wparam,&odp); - odp.pszTab = LPGEN("Status Profiles"); + odp.pszTab = LPGEN("Status Profiles"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STATUSPROFILES); - odp.pfnDlgProc = StatusProfilesOptDlgProc; + odp.pfnDlgProc = StatusProfilesOptDlgProc; Options_AddPage(wparam,&odp); return 0; } diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 4205a6a19b..4a19cddff5 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -246,37 +246,35 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) - { - case WM_INITDIALOG: { - TranslateDialogDefault(hwnd); - SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_SETCHECK, gbInvisDisable ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_SETCHECK, gbCaseInsensitive ? BST_CHECKED : BST_UNCHECKED, 0); - gbDosServiceExist?EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),1):EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),0); - SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_SETCHECK, gbDosServiceIntegration ? BST_CHECKED : BST_UNCHECKED, 0); - SetDlgItemText(hwnd, ID_SPECIALGROUPNAME, gbSpammersGroup.c_str()); - SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_SETCHECK, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_SETCHECK, gbExclude ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_SETCHECK, gbDelExcluded ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_SETCHECK, gbDelAllTempory ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_SETCHECK, gbIgnoreURL ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_SETCHECK, gbAutoAuth ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_SETCHECK, gbAutoAddToServerList ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_SETCHECK, gbAutoReqAuth ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_REGEX, BM_SETCHECK, gbRegexMatch ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_SETCHECK, gbHistoryLog ? BST_CHECKED : BST_UNCHECKED, 0); - SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_SETCHECK, gbMathExpression ? BST_CHECKED : BST_UNCHECKED, 0 ); + switch(msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwnd); + SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_SETCHECK, gbInvisDisable ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_SETCHECK, gbCaseInsensitive ? BST_CHECKED : BST_UNCHECKED, 0); + gbDosServiceExist?EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),1):EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),0); + SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_SETCHECK, gbDosServiceIntegration ? BST_CHECKED : BST_UNCHECKED, 0); + SetDlgItemText(hwnd, ID_SPECIALGROUPNAME, gbSpammersGroup.c_str()); + SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_SETCHECK, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_SETCHECK, gbExclude ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_SETCHECK, gbDelExcluded ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_SETCHECK, gbDelAllTempory ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_SETCHECK, gbIgnoreURL ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_SETCHECK, gbAutoAuth ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_SETCHECK, gbAutoAddToServerList ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_SETCHECK, gbAutoReqAuth ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_REGEX, BM_SETCHECK, gbRegexMatch ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_SETCHECK, gbHistoryLog ? BST_CHECKED : BST_UNCHECKED, 0); + SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_SETCHECK, gbMathExpression ? BST_CHECKED : BST_UNCHECKED, 0 ); - SetDlgItemText(hwnd, IDC_AUTOADDGROUP, gbAutoAuthGroup.c_str()); - } + SetDlgItemText(hwnd, IDC_AUTOADDGROUP, gbAutoAuthGroup.c_str()); return TRUE; - case WM_COMMAND: { - switch (LOWORD(wParam)) - { - case IDC_MATH_DETAILS: { - MessageBox(hwnd, TranslateT("If math expression is turned on you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one random number and answer will be expression result\nMessage must contain only one expression without spaces"), TranslateT("Info"), MB_OK); - } + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_MATH_DETAILS: + MessageBox(hwnd, TranslateT("If math expression is turned on you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one random number and answer will be expression result\nMessage must contain only one expression without spaces"), TranslateT("Info"), MB_OK); break; + case IDC_INVIS_DISABLE: case IDC_CASE_INSENSITIVE: case ID_DOS_INTEGRATION: @@ -295,56 +293,53 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; } - } break; - case WM_NOTIFY: { - NMHDR* nmhdr = (NMHDR*)lParam; - switch (nmhdr->code) + + case WM_NOTIFY: + NMHDR* nmhdr = (NMHDR*)lParam; + switch (nmhdr->code) { + case PSN_APPLY: + db_set_b(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DisableInInvis", gbInvisDisable = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0)); { - case PSN_APPLY: { - db_set_b(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "DisableInInvis", gbInvisDisable = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0)); - { - static tstring NewGroupName, CurrentGroupName; - NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME); - CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0")); - if (wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) { - bool GroupExist = Clist_GroupExists(NewGroupName.c_str()) != NULL; - db_set_ws(NULL,pluginName, "SpammersGroup", NewGroupName.c_str()); - gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers")); - if(!GroupExist && gbSpecialGroup) - CreateCListGroup((TCHAR*)gbSpammersGroup.c_str()); - } - } - db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "ExcludeContacts", gbExclude = BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "DelExcluded", gbDelExcluded = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "DelAllTempory", gbDelAllTempory = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "IgnoreURL", gbIgnoreURL = BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_GETCHECK, 0, 0)); + static tstring NewGroupName, CurrentGroupName; + NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME); + CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0")); + if (wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) { + bool GroupExist = Clist_GroupExists(NewGroupName.c_str()) != NULL; + db_set_ws(NULL,pluginName, "SpammersGroup", NewGroupName.c_str()); + gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers")); + if(!GroupExist && gbSpecialGroup) + CreateCListGroup((TCHAR*)gbSpammersGroup.c_str()); + } + } + db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "ExcludeContacts", gbExclude = BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DelExcluded", gbDelExcluded = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DelAllTempory", gbDelAllTempory = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "IgnoreURL", gbIgnoreURL = BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "AutoAuth", gbAutoAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "RegexMatch", gbRegexMatch = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REGEX, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "HistoryLog", gbHistoryLog = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_GETCHECK, 0, 0)); - db_set_b(NULL, pluginName, "MathExpression", gbMathExpression = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoAuth", gbAutoAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "RegexMatch", gbRegexMatch = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REGEX, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "HistoryLog", gbHistoryLog = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "MathExpression", gbMathExpression = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_GETCHECK, 0, 0)); - { - static tstring NewAGroupName, CurrentAGroupName; - NewAGroupName = GetDlgItemString(hwnd, IDC_AUTOADDGROUP); - CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("0")); - if (wcscmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) { - bool GroupExist = Clist_GroupExists(NewAGroupName.c_str()); - db_set_ws(NULL,pluginName, "AutoAuthGroup", NewAGroupName.c_str()); - gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL,pluginName,"AutoAuthGroup", _T("Not Spammers")); - if(!GroupExist && gbAutoAddToServerList) - CreateCListGroup((TCHAR*)gbAutoAuthGroup.c_str()); - } - } + { + static tstring NewAGroupName, CurrentAGroupName; + NewAGroupName = GetDlgItemString(hwnd, IDC_AUTOADDGROUP); + CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("0")); + if (wcscmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) { + bool GroupExist = Clist_GroupExists(NewAGroupName.c_str()) != NULL; + db_set_ws(NULL,pluginName, "AutoAuthGroup", NewAGroupName.c_str()); + gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL,pluginName,"AutoAuthGroup", _T("Not Spammers")); + if(!GroupExist && gbAutoAddToServerList) + CreateCListGroup((TCHAR*)gbAutoAuthGroup.c_str()); } - return TRUE; } + return TRUE; } break; } @@ -355,8 +350,7 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HINSTANCE hInst; MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.ptszGroup = LPGENT("Message Sessions"); odp.ptszTitle = LPGENT("StopSpam"); odp.position = -1; @@ -383,6 +377,5 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADVANCED); odp.pfnDlgProc = AdvancedDlgProc; Options_AddPage(w, &odp); - return 0; } diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 75694b5090..1f1ef5caf1 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -190,8 +190,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.pszGroup = LPGEN("Message Sessions"); odp.pszTitle = pluginName; odp.position = -1; @@ -211,7 +210,6 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO); odp.pfnDlgProc = ProtoDlgProc; Options_AddPage(w, &odp); - return 0; } diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 2968002b44..7a5e3bdb72 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1256,8 +1256,7 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) if (PluginConfig.g_PopupAvail) TN_OptionsInitialize(wParam, lParam); - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInst; odp.pszTitle = LPGEN("Message Sessions"); diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 98195ce74d..f5d3512084 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -2377,8 +2377,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_BOLDGROUPS; odp.position = -790000000; odp.hInstance = hInst; @@ -2416,7 +2415,6 @@ int OptInit(WPARAM wParam, LPARAM lParam) odp.pszGroup = LPGEN("Customize"); odp.pfnDlgProc = DlgProcOptsExtra; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index f25b549e5a..3aca1cc6e2 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -287,7 +287,6 @@ int CTooltipNotify::InitializeOptions(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = CTooltipNotify::OptionsDlgProcWrapper; ::Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index 5055ae2639..3c86fca869 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -547,11 +547,9 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int TTBOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Contact List"); - odp.position = -1000000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER); odp.pszTitle = LPGEN("Toolbar"); diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 755eaa5108..f545961c02 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -370,6 +370,5 @@ int TrafficCounterOptInitialise(WPARAM wParam,LPARAM lParam) odp.flags=ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index da66562cf0..48c0eb8936 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -476,7 +476,6 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L //hookProc ME_OPT_INITIALISE static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; return 0; } diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 3582c99a10..79fb013ac6 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -460,59 +460,59 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.ptszTitle = szTitle; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_GENERAL); - odp.position = 0x8000000; - odp.pfnDlgProc = PSPProcGeneral; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_GENERAL); + odp.position = 0x8000000; + odp.pfnDlgProc = PSPProcGeneral; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL); mir_tcsncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS); - odp.position = 0x8000001; - odp.pfnDlgProc = PSPProcContactHome; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS); + odp.position = 0x8000001; + odp.pfnDlgProc = PSPProcContactHome; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS); mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN); - odp.position = 0x8000002; - odp.pfnDlgProc = PSPProcOrigin; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN); + odp.position = 0x8000002; + odp.pfnDlgProc = PSPProcOrigin; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED); mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY); - odp.position = 0x8000003; - odp.pfnDlgProc = PSPProcAnniversary; - odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY); + odp.position = 0x8000003; + odp.pfnDlgProc = PSPProcAnniversary; + odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY); mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY); - odp.position = 0x8000004; - odp.pfnDlgProc = PSPProcCompany; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY); + odp.position = 0x8000004; + odp.pfnDlgProc = PSPProcCompany; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY); mir_tcsncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS); - odp.position = 0x8000005; - odp.pfnDlgProc = PSPProcContactWork; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS); + odp.position = 0x8000005; + odp.pfnDlgProc = PSPProcContactWork; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS); mir_tcsncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (Work)"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); - odp.position = 0x8000006; - odp.pfnDlgProc = PSPProcAbout; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); + odp.position = 0x8000006; + odp.pfnDlgProc = PSPProcAbout; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT); mir_tcsncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE); - odp.position = 0x8000007; - odp.pfnDlgProc = PSPProcContactProfile; - odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE); + odp.position = 0x8000007; + odp.pfnDlgProc = PSPProcContactProfile; + odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE); mir_tcsncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs); AddPage(wParam, (LPARAM)&odp); return 0; @@ -529,32 +529,22 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt static int InitDetails(WPARAM wParam, LPARAM lParam) { CPsHdr* pPsh = (CPsHdr*)wParam; - if (!(pPsh->_dwFlags & PSF_PROTOPAGESONLY)) { - - OPTIONSDIALOGPAGE odp; BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE); - - // important to avoid craches!! - ZeroMemory(&odp, sizeof(odp)); - if (lParam || bChangeDetailsEnabled) { - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = ghInst; odp.flags = ODPF_ICON | ODPF_TCHAR; odp.ptszGroup = IcoLib_GetDefaultIconFileName(); if (lParam) { - // ignore common pages for weather contacts - if (!pPsh->_pszProto || _stricmp(pPsh->_pszProto, "weather")) - { + if (!pPsh->_pszProto || _stricmp(pPsh->_pszProto, "weather")) { AddProtocolPages(odp, wParam); odp.ptszTitle = LPGENT("About") _T("\\") LPGENT("Notes"); } - else { - odp.ptszTitle = LPGENT("Notes"); - } + else odp.ptszTitle = LPGENT("Notes"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT); odp.position = 0x8000008; odp.pfnDlgProc = PSPProcMyNotes; diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 76356d6316..2477eb66fc 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -1225,7 +1225,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM lParam) { DlgContactInfoInitTreeIcons(); - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 95400; odp.hInstance = ghInst; odp.pszTitle = MODNAME; diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index 047ec195e9..cca948aa3c 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -129,8 +129,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA int OptionsInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 150000000; odp.pszGroup = LPGEN("Services"); odp.groupPosition = 910000000; @@ -140,6 +139,5 @@ int OptionsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = SetOptsDlgProc; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/VersionInfo/src/hooked_events.cpp b/plugins/VersionInfo/src/hooked_events.cpp index 6e9b74d5f6..d718db4a09 100644 --- a/plugins/VersionInfo/src/hooked_events.cpp +++ b/plugins/VersionInfo/src/hooked_events.cpp @@ -36,8 +36,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VERSIONINFO); @@ -46,8 +45,6 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.groupPosition = 910000000; odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = DlgProcOpts; - Options_AddPage(wParam, &odp); - return 0; } \ No newline at end of file diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index a3cc00d498..066fd03d69 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -68,8 +68,7 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int WaMpdOptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WA_MPD); odp.ptszTitle = LPGENT("Winamp Track"); diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 836a52ce8a..558b35175f 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -278,10 +278,9 @@ void SaveOptions(void) //============ OPTION INITIALIZATION ============ // register the weather option pages -int OptInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); +int OptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; // plugin options diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index 9ddce8d703..7d06772caa 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -33,24 +33,20 @@ information // lParam = current contact int UserInfoInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.position = 100000000; odp.ptszTitle = _T(WEATHERPROTONAME); - if (lParam == 0) - { + if (lParam == 0) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO); odp.pfnDlgProc = DlgProcINIPage; odp.flags = ODPF_TCHAR; UserInfo_AddPage(wParam, &odp); } - else - { + else { // check if it is a weather contact - if (IsMyContact((HANDLE)lParam)) - { + if (IsMyContact((HANDLE)lParam)) { // register the contact info page odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); odp.pfnDlgProc = DlgProcUIPage; @@ -58,7 +54,6 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) UserInfo_AddPage(wParam, &odp); } } - return 0; } diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index c34865fbc6..97fe0bdfbb 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -60,7 +60,6 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 33e8d0be3c..b1e330b882 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -162,8 +162,7 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp={0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = YAMNVar.hInst; odp.pszGroup = LPGEN("Network"); odp.pszTitle = LPGEN("YAMN"); diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp index dbfb88afde..4d96a1ca49 100644 --- a/plugins/YARelay/src/options.cpp +++ b/plugins/YARelay/src/options.cpp @@ -189,13 +189,13 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, int OptionsInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = hInst; - odp.position = -1; - odp.pszGroup = LPGEN("Plugins"); + odp.hInstance = hInst; + odp.position = -1; + odp.pszGroup = LPGEN("Plugins"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETTINGS); - odp.pszTitle = LPGEN("yaRelay"); - odp.pfnDlgProc = OptionsFrameProc; - odp.flags = ODPF_BOLDGROUPS; + odp.pszTitle = LPGEN("yaRelay"); + odp.pfnDlgProc = OptionsFrameProc; + odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/YahooGroups/src/hooked_events.cpp b/plugins/YahooGroups/src/hooked_events.cpp index 76b31d4802..c09ad2a71d 100644 --- a/plugins/YahooGroups/src/hooked_events.cpp +++ b/plugins/YahooGroups/src/hooked_events.cpp @@ -53,18 +53,15 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) int OnOptionsInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.ptszTitle = LPGENT("Yahoo Groups"); odp.ptszGroup = LPGENT("Plugins"); odp.groupPosition = 810000000; - odp.flags= ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pfnDlgProc = DlgProcOptions; Options_AddPage(wParam, &odp); - return 0; } diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index 0a1b5ed491..83935d2e4e 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -208,8 +208,7 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam //Called when the user opened the options dialog static int OptionsInitialize(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_TCHAR; @@ -219,7 +218,6 @@ static int OptionsInitialize(WPARAM wParam,LPARAM lParam) odp.groupPosition = 100000000; odp.pfnDlgProc = DlgProcNoSoundOpts; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 9e5a82cab0..fe5b2f256f 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -746,8 +746,7 @@ int CAimProto::OnUserInfoInit(WPARAM wParam,LPARAM lParam) { if (!lParam)//hContact { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1900000000; odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR; odp.hInstance = hInstance; @@ -1141,8 +1140,7 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP int CAimProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 1003000; odp.hInstance = hInstance; odp.ptszGroup = LPGENT("Network"); @@ -1159,7 +1157,6 @@ int CAimProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_PRIVACY); odp.pfnDlgProc = privacy_dialog; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index ada5f38202..29e286a969 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -292,7 +292,6 @@ int __cdecl EMPCreateOptionsDlg(WPARAM wParam,LPARAM) odp.flags = ODPF_BOLDGROUPS; odp.pfnDlgProc = EMPDlgProcMainOpts; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index bd2dd4e071..b35a1e230e 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -427,7 +427,6 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_ADVANCED); odp.pfnDlgProc = FBOptionsAdvancedProc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 7cf97347b8..ade91850e9 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -242,7 +242,6 @@ void AddPopupsPage(WPARAM wParam) odp.hInstance = g_hInst; odp.ptszGroup = POPUPS_OPTIONS_GROUP; odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB; - Options_AddPage(wParam, &odp); } @@ -257,7 +256,6 @@ void AddAccPage(LPTSTR acc, LPCSTR mod, WPARAM wParam) odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; odp.ptszTab = MAIL_NOTIFICATIONS; odp.dwInitParam = (LPARAM)mod; - Options_AddPage(wParam, &odp); } diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index ffc5c96f4e..771796230f 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -153,8 +153,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, int GGPROTO::options_init(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_TCHAR; odp.position = 1003000; odp.hInstance = hInstance; @@ -177,7 +176,6 @@ int GGPROTO::options_init(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_ADVANCED); odp.pfnDlgProc = gg_advoptsdlgproc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index fcca7bbc3f..ea5e4e116c 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -1658,9 +1658,7 @@ void CIgnorePrefsDlg::UpdateList() int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_CONNECT); odp.ptszTitle = m_tszUserName; diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 46432e6166..e3ac6f23c3 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -208,8 +208,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) db_free(&dbv); } - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_DONTTRANSLATE; odp.pszTitle = m_szModuleName; odp.hIcon = NULL; diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index e8a8e01b34..d913bc50f4 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -287,8 +287,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if ((!IsICQContact((HANDLE)lParam)) && lParam) return 0; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; odp.hInstance = hInst; odp.dwInitParam = LPARAM(this); @@ -298,8 +297,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_ICQ); UserInfo_AddPage(wParam, &odp); - if (!lParam) - { + if (!lParam) { TCHAR buf[200]; mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s Details"), m_tszUserName); odp.ptszTitle = buf; diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 8aa34ba65d..d7b3153502 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -569,8 +569,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -800000000; odp.hInstance = hInst; odp.ptszGroup = LPGENT("Network"); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 2062c06c12..43b48918fa 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1571,37 +1571,35 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRosterControl(WPARAM, LPARAM) int CJabberProto::OnOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = m_tszUserName; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - - odp.ptszTab = LPGENT("Account"); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.hInstance = hInst; + odp.ptszGroup = LPGENT("Network"); + odp.ptszTitle = m_tszUserName; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; + + odp.ptszTab = LPGENT("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; + odp.pfnDlgProc = CDlgBase::DynamicDlgProc; odp.dwInitParam = (LPARAM)&OptCreateAccount; OptCreateAccount.create = CDlgOptAccount::Create; OptCreateAccount.param = this; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Conferences"); + odp.ptszTab = LPGENT("Conferences"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER4); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; + odp.pfnDlgProc = CDlgBase::DynamicDlgProc; odp.dwInitParam = (LPARAM)&OptCreateGc; OptCreateGc.create = CDlgOptGc::Create; OptCreateGc.param = this; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.ptszTab = LPGENT("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER2); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; + odp.pfnDlgProc = CDlgBase::DynamicDlgProc; odp.dwInitParam = (LPARAM)&OptCreateAdvanced; OptCreateAdvanced.create = CDlgOptAdvanced::Create; OptCreateAdvanced.param = this; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 986213bf90..ee67004503 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -865,7 +865,6 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.pszTitle = LPGEN("Photo"); UserInfo_AddPage(wParam, &odp); } - return 0; } diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 89a5e69c88..022725d273 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -1209,8 +1209,7 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM) m_bPhotoChanged = FALSE; m_szPhotoFileName[0] = 0; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR|ODPF_USERINFOTAB|ODPF_DONTTRANSLATE; diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 163f0f90bc..2744a00c1b 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -216,8 +216,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.dwInitParam = (LPARAM)this; odp.hInstance = masMraSettings.hInstance; odp.ptszTitle = m_tszUserName; diff --git a/protocols/MSN/msn_10.vcxproj b/protocols/MSN/msn_10.vcxproj index 2f1775f088..81e3580c47 100644 --- a/protocols/MSN/msn_10.vcxproj +++ b/protocols/MSN/msn_10.vcxproj @@ -239,7 +239,6 @@ - diff --git a/protocols/MSN/msn_10.vcxproj.filters b/protocols/MSN/msn_10.vcxproj.filters index ea6d433142..b9585f0393 100644 --- a/protocols/MSN/msn_10.vcxproj.filters +++ b/protocols/MSN/msn_10.vcxproj.filters @@ -110,9 +110,6 @@ Source Files - - Source Files - Source Files diff --git a/protocols/MSN/msn_11.vcxproj b/protocols/MSN/msn_11.vcxproj index 7d38255630..e2574dfdc2 100644 --- a/protocols/MSN/msn_11.vcxproj +++ b/protocols/MSN/msn_11.vcxproj @@ -242,7 +242,6 @@ - diff --git a/protocols/MSN/msn_11.vcxproj.filters b/protocols/MSN/msn_11.vcxproj.filters index ea6d433142..b9585f0393 100644 --- a/protocols/MSN/msn_11.vcxproj.filters +++ b/protocols/MSN/msn_11.vcxproj.filters @@ -110,9 +110,6 @@ Source Files - - Source Files - Source Files diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 2351be7f5f..240768ee53 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -669,8 +669,7 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int CMsnProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN); diff --git a/protocols/MSN/src/msn_useropts.cpp b/protocols/MSN/src/msn_useropts.cpp deleted file mode 100644 index ee7856fe9b..0000000000 --- a/protocols/MSN/src/msn_useropts.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -Plugin of Miranda IM for communicating with users of the MSN Messenger protocol. - -Copyright (c) 2012-2013 Miranda NG Team -Copyright (c) 2006-2012 Boris Krasnovskiy. -Copyright (c) 2003-2005 George Hazan. -Copyright (c) 2002-2003 Richard Hughes (original version). - -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, see . -*/ - -#include "msn_global.h" - -///////////////////////////////////////////////////////////////////////////////////////// -// MSN contact option page dialog procedure. - -/* -INT_PTR CALLBACK MsnDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - - const HANDLE hContact = (HANDLE)lParam; - - SetDlgItemInt(hwndDlg, IDC_MOBILE, db_get_b(hContact, m_szModuleName, "MobileAllowed", 0), 0); - SetDlgItemInt(hwndDlg, IDC_MSN_MOBILE, db_get_b(hContact, m_szModuleName, "MobileEnabled", 0), 0); - - DWORD dwFlagBits = setDword(hContact, "FlagBits", 0); - SetDlgItemTextA(hwndDlg, IDC_WEBMESSENGER, (dwFlagBits & 0x200) ? "Y" : "N"); - } - - return TRUE; - - case WM_DESTROY: - break; - } - - return FALSE; -} -*/ -///////////////////////////////////////////////////////////////////////////////////////// -// MsnOnDetailsInit - initializes user info dialog pages. - -int MsnOnDetailsInit(WPARAM wParam, LPARAM lParam) -{ -/* - if (!MSN_IsMyContact(hContact)) - return 0; - - if (getDword(hContact, "FlagBits", 0)) - { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); - odp.pfnDlgProc = MsnDlgProc; - odp.position = -1900000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_USEROPTS); - odp.ptszTitle = m_tszUserName; - odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; - - UserInfo_AddPage(wParam, &odp); - } -*/ - return 0; -} diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index c6f0bef34a..fd9b9d9dd2 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -189,7 +189,7 @@ int OmegleProto::OnModulesLoaded(WPARAM wParam,LPARAM lParam) int OmegleProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {sizeof(odp)}; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; odp.ptszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); @@ -201,7 +201,6 @@ int OmegleProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pfnDlgProc = OmegleOptionsProc; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 4c7cb48dc9..a42e1ea31d 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -101,8 +101,7 @@ int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) { char *title = ::mir_t2a(this->m_tszUserName); - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; odp.pszTitle = title; odp.dwInitParam = LPARAM(this); @@ -133,8 +132,7 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if ((!this->IsProtoContact((HANDLE)lParam)) && lParam) return 0; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; odp.hInstance = g_hInstance; odp.dwInitParam = LPARAM(this); @@ -142,18 +140,15 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.ptszTitle = this->m_tszUserName; HANDLE hContact = (HANDLE)lParam; - if (hContact) - { + if (hContact) { char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if (szProto != NULL && !strcmp(szProto, m_szModuleName)) - { + if (szProto != NULL && !strcmp(szProto, m_szModuleName)) { odp.pfnDlgProc = SkypeDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SKYPE); UserInfo_AddPage(wParam, &odp); } } - else - { + else { NeedUpdate = 0; odp.pfnDlgProc = ContactSkypeDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_CONTACT); @@ -175,7 +170,6 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.ptszTab = LPGENT("Skype account"); UserInfo_AddPage(wParam, &odp); } - return 0; } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 4130ce44a3..f60e2c1d82 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -319,7 +319,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM,LPARAM) int TwitterProto::OnOptionsInit(WPARAM wParam,LPARAM) { - OPTIONSDIALOGPAGE odp = {sizeof(odp)}; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 271828; odp.hInstance = g_hInstance; odp.ptszGroup = LPGENT("Network"); @@ -332,14 +332,12 @@ int TwitterProto::OnOptionsInit(WPARAM wParam,LPARAM) odp.pfnDlgProc = options_proc; Options_AddPage(wParam, &odp); - if(ServiceExists(MS_POPUP_ADDPOPUPT)) - { + if (ServiceExists(MS_POPUP_ADDPOPUPT)) { odp.ptszTab = LPGENT("Popups"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS); odp.pfnDlgProc = popup_options_proc; Options_AddPage(wParam, &odp); } - return 0; } diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 2d1fc9ea2e..b7a6ee094d 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -1133,6 +1133,5 @@ int OptInit(WPARAM wParam,LPARAM) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTFEAT4); odp.ptszTab = LPGENT("Games"); Options_AddPage(wParam, &odp); - return 0; } \ No newline at end of file diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 0873545bd2..93a71349a4 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -429,21 +429,15 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam int OnDetailsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - if (!IsXFireContact((HANDLE)lParam)) return 0; - odp.cbSize = sizeof(odp); - odp.hIcon = NULL; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hinstance; odp.pfnDlgProc = DlgProcUserDetails; odp.position = -1900000000; odp.pszTemplate = MAKEINTRESOURCE(IDD_UD); odp.ptszTitle = TranslateT("XFire"); - odp.pszGroup = NULL; - UserInfo_AddPage(wParam, &odp); - return 0; } \ No newline at end of file diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 3c6462c0d4..d53e46b965 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -357,9 +357,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO); @@ -380,6 +378,5 @@ int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO_IGNORE); odp.pfnDlgProc = DlgProcYahooOptsIgnore; Options_AddPage(wParam, &odp); - return 0; } diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 9aba43ac7a..39d5ed9027 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -113,11 +113,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa int __cdecl CYahooProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) { - //if ( !JCallService( MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName )) - // return 0; - - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof( odp ); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInstance; odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; @@ -130,7 +126,6 @@ int __cdecl CYahooProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) odp.ptszTitle = m_tszUserName; UserInfo_AddPage(wParam, &odp); } - return 0; } diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index e9119d4eda..b981615f65 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -534,8 +534,7 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) if (protoModeMsgFlags == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 870000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG); diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 96dc9f1cf3..65a41422ff 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -903,9 +903,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam static int OptionsInitialize(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1); diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index 5b3bd0e4fa..62ddcc3626 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -421,11 +421,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int ClcOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp; - - ZeroMemory(&odp, sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); @@ -439,7 +435,6 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcClcBkgOpts; odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 8191f2c7b6..77727d539c 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -234,8 +234,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int CListOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 4552b10015..c93baae470 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -320,9 +320,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int CluiOptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 0; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); odp.pszTitle = LPGEN("Window"); diff --git a/src/core/stdfile/fileopts.cpp b/src/core/stdfile/fileopts.cpp index a19a912e6a..26baee16ff 100644 --- a/src/core/stdfile/fileopts.cpp +++ b/src/core/stdfile/fileopts.cpp @@ -230,8 +230,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int FileOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER); diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index 4881c0f592..5dff57cefc 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -416,8 +416,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L static int IdleOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IDLE); diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 9858bf59b1..5ef8310ce6 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -580,11 +580,8 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if (GetContactProto((HANDLE)lParam) == 0) return 0; - OPTIONSDIALOGPAGE odp; - odp.cbSize = sizeof(odp); - odp.hIcon = NULL; + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; - odp.flags = 0; odp.pfnDlgProc = SummaryDlgProc; odp.position = -2100000000; diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 4de2705787..e6ad8acf57 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -67,7 +67,6 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClcContact *hitcontact = NULL; ClcGroup *hitgroup = NULL; int indent, i; - HFONT hFont; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); if (flags) @@ -79,20 +78,16 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClientToScreen(hwnd, &pt); HWND hwndParent = hwnd, hwndTemp; - do - { + do { hwndTemp = hwndParent; hwndParent = (HWND)GetWindowLongPtr(hwndTemp, GWLP_HWNDPARENT); POINT pt1 = pt; ScreenToClient(hwndParent, &pt1); - HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), - pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); + HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); if (h != hwndTemp) - { if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; - } } while (hwndParent); @@ -164,11 +159,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * return hit; } } + HDC hdc = GetDC(hwnd); - if (hitcontact->type == CLCIT_GROUP) - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont); - else - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont); + HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont); SIZE textSize; GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index ff2763964c..cc95f496c6 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -487,8 +487,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara static int ContactOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACT); diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 8c4b35dafe..d290d4cd7f 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -857,8 +857,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int GenMenuOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.position = -1000000000; diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index 81d5a3f7bf..38ce9bb2b3 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -742,8 +742,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) if (GetNumberOfSlots() < 1) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pszGroup = LPGEN("Contact List"); odp.pszTitle = LPGEN("Extra icons"); @@ -752,6 +751,5 @@ int InitOptionsCallback(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_EI_OPTIONS); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - return 0; } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 694eb01ad9..820090b3ac 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -1255,8 +1255,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS); diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 261f239ce7..093317a516 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -1037,8 +1037,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 5e07e69bfa..b7e2ca1728 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -323,8 +323,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM static int IgnoreOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE); diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index b165f55156..1c81da3c41 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -512,9 +512,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) if (optionsCount == 0) return 0; - OPTIONSDIALOGPAGE odp = { 0 }; - - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 900000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB); diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 5d0aced019..6e3a88d6a3 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -479,8 +479,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int PluginOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.pfnDlgProc = DlgPluginOpt; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PLUGINS); diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index 21372b1eec..6f524e422a 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -997,8 +997,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int HotkeyOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index a4f5c52bcb..e73a73d0bd 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -433,8 +433,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static int SkinOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -200000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND); diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index a2a0f71c88..0bd0c007c0 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -278,8 +278,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP static int VisibilityOptInitialise(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 850000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY); -- cgit v1.2.3