diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-25 10:58:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-25 10:58:24 +0000 |
commit | dd1460d664f7266920b07527f25f87ec8233daaf (patch) | |
tree | 3753e6fa678edf1b3d9bb020bb97e16ca75ff69d /plugins | |
parent | 9ff92d1cc83e39859891a65f5ada186806cef133 (diff) |
valid options initialization
git-svn-id: http://svn.miranda-ng.org/main/trunk@6225 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
96 files changed, 1703 insertions, 1953 deletions
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<int, HANDLE> 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<wstring> 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<<str.c_str(); - f.close(); - } - break; - case IDC_COPY_KEY: - { - if(OpenClipboard(hwndDlg)) - { - char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); - std::string str = szKey; - mir_free(szKey); - boost::algorithm::replace_all(str, "\n", "\r\n"); - HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() +1); - if(!hMem) - { - MessageBox(0, TranslateT("Failed to alocate memory"), TranslateT("Error"), MB_OK); - break; - } - szKey = (char*)GlobalLock(hMem); - if(!szKey) - { - char msg[64]; - mir_snprintf(msg, 127, "Failed to lock memory with error %d", GetLastError()); - MessageBoxA(0, msg, "Error", MB_OK); - GlobalFree(hMem); - } - memcpy(szKey, str.c_str(), str.size()); - szKey[str.size()] = '\0'; - str.clear(); - EmptyClipboard(); - GlobalUnlock(hMem); - if(!SetClipboardData(CF_OEMTEXT, hMem)) - { - GlobalFree(hMem); - char msg[64]; - mir_snprintf(msg, 127, "Failed write to clipboard with error %d", GetLastError()); - MessageBoxA(0, msg, "Error", MB_OK); - } - CloseClipboard(); - } - else - { - char msg[64]; - mir_snprintf(msg, 127, "Failed to open clipboard with error %d", GetLastError()); - MessageBoxA(0, msg, "Error", MB_OK); - } - } - break; - case IDC_LOG_FILE_SET: - { - tmp = GetFilePath(TranslateT("Set log file"), _T("*"), TranslateT("LOG files"), 1); - SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp); - mir_free(tmp); - } - break; - default: - break; - } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_NOTIFY: - { - EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && IsDlgButtonChecked(hwndDlg, IDC_JABBER_API))); - if(hdr && IsWindowVisible(hdr->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<wstring> 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("<GPGdec>")); - SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>")); - SetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>")); - SetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp); - mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>")); - 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<wstring> 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<wstring> 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<<str.c_str(); - f.close(); - cmd.push_back(L"--batch"); - cmd.push_back(L"--import"); - cmd.push_back(tmp2); - } - gpg_execution_params params(cmd); - pxResult result; - params.out = &output; - params.code = &exitcode; - params.result = &result; - if(!gpg_launcher(params)) - break; - if(result == pxNotFound) - break; - mir_free(begin); - mir_free(end); - 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_unset(hcnt, szGPGModuleName, "bAlwatsTrust"); - } - } - else - db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); - } - else - db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); - } - { - TCHAR *tmp; - if(output.find("already in secret keyring") != string::npos) - { - MessageBox(0, TranslateT("Key already in scret key ring."), TranslateT("Info"), MB_OK); - boost::filesystem::remove(tmp2); - break; - } - char *tmp2; - string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); - string::size_type 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(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, "KeyID", tmp2); - } - } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2); - } - else - db_set_s(hContact, szGPGModuleName, "KeyID", tmp2); - } - mir_free(tmp2); - tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); - if(hContact && hwndList_p) - ListView_SetItemText(hwndList_p, item_num, 1, tmp); - mir_free(tmp); - s = output.find("“", s2); - if(s == string::npos) - { - s = output.find("\"", s2); - s += 1; - } - else - s += 3; - bool uncommon = false; - if((s2 = output.find("(", s)) == string::npos) - { - if((s2 = output.find("<", s)) == string::npos) - { - s2 = output.find("”", s); - uncommon = true; - } - } - else if(s2 > 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<wstring> 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<<std::string(time_str()+": info: Failed to read key file"); - break; - } - ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----")); - ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); - if(ws2 == wstring::npos || ws1 == wstring::npos) - { - ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----")); - ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); - } - if(ws2 == wstring::npos || ws1 == wstring::npos) - { - MessageBox(0, TranslateT("Where is no public or private key."), TranslateT("Info"), MB_OK); - break; - } - ws2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); - SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1,ws2-ws1).c_str()); - key_buf.clear(); - } - break; - case IDC_IMPORT: - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; - new_key_hcnt_mutex.lock(); - new_key_hcnt = hContact; - void ShowImportKeyDialog(); - ShowImportKeyDialog(); - break; - case IDC_SELECT_EXISTING: - void ShowSelectExistingKeyDialog(); - ShowSelectExistingKeyDialog(); - break; - } - break; - } - - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->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<int, HANDLE> 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<wstring> 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<<str.c_str();
+ f.close();
+ }
+ break;
+ case IDC_COPY_KEY:
+ {
+ if(OpenClipboard(hwndDlg))
+ {
+ char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
+ std::string str = szKey;
+ mir_free(szKey);
+ boost::algorithm::replace_all(str, "\n", "\r\n");
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() +1);
+ if(!hMem)
+ {
+ MessageBox(0, TranslateT("Failed to alocate memory"), TranslateT("Error"), MB_OK);
+ break;
+ }
+ szKey = (char*)GlobalLock(hMem);
+ if(!szKey)
+ {
+ char msg[64];
+ mir_snprintf(msg, 127, "Failed to lock memory with error %d", GetLastError());
+ MessageBoxA(0, msg, "Error", MB_OK);
+ GlobalFree(hMem);
+ }
+ memcpy(szKey, str.c_str(), str.size());
+ szKey[str.size()] = '\0';
+ str.clear();
+ EmptyClipboard();
+ GlobalUnlock(hMem);
+ if(!SetClipboardData(CF_OEMTEXT, hMem))
+ {
+ GlobalFree(hMem);
+ char msg[64];
+ mir_snprintf(msg, 127, "Failed write to clipboard with error %d", GetLastError());
+ MessageBoxA(0, msg, "Error", MB_OK);
+ }
+ CloseClipboard();
+ }
+ else
+ {
+ char msg[64];
+ mir_snprintf(msg, 127, "Failed to open clipboard with error %d", GetLastError());
+ MessageBoxA(0, msg, "Error", MB_OK);
+ }
+ }
+ break;
+ case IDC_LOG_FILE_SET:
+ {
+ tmp = GetFilePath(TranslateT("Set log file"), _T("*"), TranslateT("LOG files"), 1);
+ SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp);
+ mir_free(tmp);
+ }
+ break;
+ default:
+ break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && IsDlgButtonChecked(hwndDlg, IDC_JABBER_API)));
+ if(hdr && IsWindowVisible(hdr->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<wstring> 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("<GPGdec>"));
+ SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp);
+ mir_free(tmp);
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
+ SetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp);
+ mir_free(tmp);
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
+ SetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp);
+ mir_free(tmp);
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
+ 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<wstring> 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<wstring> 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<<str.c_str();
+ f.close();
+ cmd.push_back(L"--batch");
+ cmd.push_back(L"--import");
+ cmd.push_back(tmp2);
+ }
+ gpg_execution_params params(cmd);
+ pxResult result;
+ params.out = &output;
+ params.code = &exitcode;
+ params.result = &result;
+ if(!gpg_launcher(params))
+ break;
+ if(result == pxNotFound)
+ break;
+ mir_free(begin);
+ mir_free(end);
+ 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_unset(hcnt, szGPGModuleName, "bAlwatsTrust");
+ }
+ }
+ else
+ db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust");
+ }
+ else
+ db_unset(hContact, szGPGModuleName, "bAlwatsTrust");
+ }
+ {
+ TCHAR *tmp;
+ if(output.find("already in secret keyring") != string::npos)
+ {
+ MessageBox(0, TranslateT("Key already in scret key ring."), TranslateT("Info"), MB_OK);
+ boost::filesystem::remove(tmp2);
+ break;
+ }
+ char *tmp2;
+ string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
+ string::size_type 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(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, "KeyID", tmp2);
+ }
+ }
+ else
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2);
+ }
+ else
+ db_set_s(hContact, szGPGModuleName, "KeyID", tmp2);
+ }
+ mir_free(tmp2);
+ tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str());
+ if(hContact && hwndList_p)
+ ListView_SetItemText(hwndList_p, item_num, 1, tmp);
+ mir_free(tmp);
+ s = output.find("“", s2);
+ if(s == string::npos)
+ {
+ s = output.find("\"", s2);
+ s += 1;
+ }
+ else
+ s += 3;
+ bool uncommon = false;
+ if((s2 = output.find("(", s)) == string::npos)
+ {
+ if((s2 = output.find("<", s)) == string::npos)
+ {
+ s2 = output.find("”", s);
+ uncommon = true;
+ }
+ }
+ else if(s2 > 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<wstring> 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<<std::string(time_str()+": info: Failed to read key file");
+ break;
+ }
+ ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
+ if(ws2 == wstring::npos || ws1 == wstring::npos)
+ {
+ ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"));
+ ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
+ }
+ if(ws2 == wstring::npos || ws1 == wstring::npos)
+ {
+ MessageBox(0, TranslateT("Where is no public or private key."), TranslateT("Info"), MB_OK);
+ break;
+ }
+ ws2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1,ws2-ws1).c_str());
+ key_buf.clear();
+ }
+ break;
+ case IDC_IMPORT:
+ extern HANDLE new_key_hcnt;
+ extern boost::mutex new_key_hcnt_mutex;
+ new_key_hcnt_mutex.lock();
+ new_key_hcnt = hContact;
+ void ShowImportKeyDialog();
+ ShowImportKeyDialog();
+ break;
+ case IDC_SELECT_EXISTING:
+ void ShowSelectExistingKeyDialog();
+ ShowSelectExistingKeyDialog();
+ break;
+ }
+ break;
+ }
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->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<HANDLE>(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<LPTSTR>(GetInfo().m_sName.c_str()));
odp.ptszTab = const_cast<LPTSTR>(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<LPTSTR>(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;
}
|