diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-17 14:58:29 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-17 14:58:29 +0000 |
commit | 6f9167b69872efc9c6d14daa8987d0ab51a5408e (patch) | |
tree | 8234a47381bc6efd2aeb91dd7ebdabadacf6594f /plugins/MirOTR/src/options.cpp | |
parent | 201d4c2175aab1032564893022e618098e81225d (diff) |
MirOTR:
- Fixed Apply button in options
- Fixed per contact policy (fixes #1070)
- Other bug fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15568 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src/options.cpp')
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 217e535f07..ae2e741ee9 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -21,17 +21,9 @@ void SetFilenames(const TCHAR *path) return; CreateDirectoryTreeT(path); - mir_tstrcpy(g_private_key_filename, path); - mir_tstrcat(g_private_key_filename, _T("\\")); - mir_tstrcat(g_private_key_filename, _T(PRIVATE_KEY_FILENAME)); - - mir_tstrcpy(g_fingerprint_store_filename, path); - mir_tstrcat(g_fingerprint_store_filename, _T("\\")); - mir_tstrcat(g_fingerprint_store_filename, _T(FINGERPRINT_STORE_FILENAME)); - - mir_tstrcpy(g_instag_filename, path); - mir_tstrcat(g_instag_filename, _T("\\")); - mir_tstrcat(g_instag_filename, _T(INSTAG_FILENAME)); + mir_sntprintf(g_private_key_filename, _T("%s\\") _T(PRIVATE_KEY_FILENAME), path); + mir_sntprintf(g_fingerprint_store_filename, _T("%s\\") _T(FINGERPRINT_STORE_FILENAME), path); + mir_sntprintf(g_instag_filename, _T("%s\\") _T(INSTAG_FILENAME), path); } int FoldersChanged(WPARAM wParam, LPARAM lParam) @@ -137,9 +129,11 @@ void ReadPrivkeyFiles() static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + static bool bInit = true; TCHAR *prefix; switch ( msg ) { case WM_INITDIALOG: + bInit = false; TranslateDialogDefault( hwndDlg ); // set default policy radio @@ -170,7 +164,8 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, prefix = mir_utf8decodeT(options.prefix); SetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix); mir_free(prefix); - return TRUE; + bInit = true; + return FALSE; case WM_COMMAND: switch ( HIWORD( wParam )) { @@ -187,11 +182,12 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_CHK_AUTOSHOW_VERIFY: case IDC_CHK_ENDOFFLINE: case IDC_CHK_ENDCLOSE: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + if (bInit) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; case EN_CHANGE: - if (LOWORD( wParam ) == IDC_ED_PREFIX && ( HWND )lParam == GetFocus()) + if ((LOWORD( wParam ) == IDC_ED_PREFIX) && bInit) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } @@ -526,7 +522,6 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM case CBN_SELCHANGE: switch (LOWORD(wParam)) { case IDC_CMB_CONT_POLICY: - MCONTACT hContact = 0; int iUser = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)); if (iUser == -1) break; int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETCURSEL, 0, 0); @@ -546,7 +541,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi); ContactPolicyMap* cpm = (ContactPolicyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - hContact = (MCONTACT)lvi.lParam; + MCONTACT hContact = (MCONTACT)lvi.lParam; (*cpm)[hContact].policy = policy; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -564,8 +559,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM // Using a const_iterator since we are not going to change the values. for (ContactPolicyMap::const_iterator it = cpm->begin(); it != cpm->end(); ++it) { if (!it->first) continue; - if (it->second.policy) db_set_dw(it->first, MODULENAME, "Policy", (DWORD)it->second.policy); - if (it->second.htmlconv) db_set_b(it->first, MODULENAME, "HTMLConv", it->second.htmlconv - 1); + db_set_dw(it->first, MODULENAME, "Policy", (DWORD)it->second.policy); + db_set_b(it->first, MODULENAME, "HTMLConv", it->second.htmlconv); } return TRUE; } @@ -604,7 +599,6 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM (*cp)[hContact].htmlconv = HTMLCONV_ENABLE; ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_YES)); } - (*cp)[hContact].htmlconv += 1; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } |