diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-21 13:10:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-21 13:10:23 +0000 |
commit | 6ec0e14c86d0ff1266e1b838d04684fbc3a28b0b (patch) | |
tree | 0f5321ffd7934c50f89b913842bb737c1462e26a /plugins/MirOTR | |
parent | 7ef51f4d1e0209fb54faf18f7ad7c8349090bebd (diff) |
- fix for a bug in options (policy & hash aren't saved for protos whose name differs from module name);
- code cleaning;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@13008 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r-- | plugins/MirOTR/src/dllmain.cpp | 1 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 642 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.h | 7 | ||||
-rw-r--r-- | plugins/MirOTR/src/version.h | 4 |
4 files changed, 313 insertions, 341 deletions
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index 3e90e5c17b..643ffea251 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -108,7 +108,6 @@ extern "C" __declspec(dllexport) int Unload(void) //UnhookEvent(hEventDbEventAdded); DEBUGOUT_T("UNLOAD MIROTR"); DeinitSRMM(); - DeinitOptions(); DeinitDBFilter(); lib_cs_lock(); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index aa11497927..d72d0b486c 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -9,7 +9,7 @@ char g_instag_filename[MAX_PATH]; HANDLE hPATH_MIROTR; Options options; #define DATA_DIRECTORY MIRANDA_USERDATA "\\" MODULENAME -HANDLE hHookOptions; + struct PROTOREGENKEYOPTIONS { HWND refresh; TCHAR proto[129]; @@ -60,7 +60,8 @@ void LoadFilenames() } } -void LoadOptions() { +void LoadOptions() +{ options.default_policy = db_get_w(0, MODULENAME, "DefaultPolicy", OTRL_POLICY_OPPORTUNISTIC); // deal with changed flags in proto.h and new interpretation of 'manual' mode (see common.h) switch(options.default_policy) { @@ -101,47 +102,8 @@ void LoadOptions() { LoadFilenames(); } -extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam) +void SaveOptions() { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.position = 100; - odp.hInstance = hInst; - odp.ptszGroup = LPGENT("Services"); - odp.ptszTitle = _T("OTR"); - odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; - - odp.ptszTab = LANG_OPT_GENERAL; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL); - odp.pfnDlgProc = DlgProcMirOTROpts; - Options_AddPage(wParam, &odp); - - odp.ptszTab = LANG_OPT_PROTO; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTO); - odp.pfnDlgProc = DlgProcMirOTROptsProto; - Options_AddPage(wParam, &odp); - - odp.ptszTab = LANG_OPT_CONTACTS; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS); - odp.pfnDlgProc = DlgProcMirOTROptsContacts; - Options_AddPage(wParam, &odp); - - odp.ptszTab = LANG_OPT_FINGER; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER); - odp.pfnDlgProc = DlgProcMirOTROptsFinger; - Options_AddPage(wParam, &odp); - return 0; -} - -void InitOptions() { - LoadOptions(); - hHookOptions = HookEvent(ME_OPT_INITIALISE, OpenOptions); -} - -void DeinitOptions() { - UnhookEvent(hHookOptions); -} - -void SaveOptions() { db_set_w(0, MODULENAME, "DefaultPolicy", options.default_policy); db_set_w(0, MODULENAME, "ErrorDisplay", (int)options.err_method); db_set_b(0, MODULENAME, "PrefixMessages", options.prefix_messages ? 1 : 0); @@ -164,7 +126,8 @@ extern "C" void set_context_contact(void *data, ConnContext *context) context->app_data = (void*)hContact; } -void ReadPrivkeyFiles() { +void ReadPrivkeyFiles() +{ DEBUGOUT_T("READ privkey"); lib_cs_lock(); otrl_privkey_read(otr_user_state, g_private_key_filename); @@ -208,9 +171,7 @@ 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; - break; case WM_COMMAND: switch ( HIWORD( wParam )) { @@ -238,10 +199,8 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) { // handle apply - if (IsDlgButtonChecked(hwndDlg, IDC_RAD_OPP)) options.default_policy = OTRL_POLICY_OPPORTUNISTIC; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_MANUAL)) @@ -272,10 +231,8 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, mir_free(prefix_utf); SaveOptions(); - return TRUE; } - break; } return FALSE; @@ -289,20 +246,10 @@ static unsigned int CALLBACK regen_key_thread(void* param) mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_OTR_ASK_NEWKEY), opts->proto); EnableWindow(opts->refresh, FALSE); - if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) - { + if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) { char* proto = mir_t2a(opts->proto); otr_gui_create_privkey(0, proto, proto); SendMessage(opts->refresh, WMU_REFRESHPROTOLIST, 0, 0); - /* - char *fp = (char*)mir_alloc(20); - otrl_privkey_fingerprint(otr_user_state, fp, proto, proto); - TCHAR *fpt = mir_a2t(fp); - mir_free(fp); - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 2, fpt); - mir_free(fpt); - mir_free(proto); - */ } EnableWindow(opts->refresh, TRUE); delete opts; @@ -310,14 +257,22 @@ static unsigned int CALLBACK regen_key_thread(void* param) return 0; } +static char* GetProtoName(HWND lv, int iItem) +{ + LV_ITEM item; + item.iItem = iItem; + item.mask = LVIF_PARAM; + return (ListView_GetItem(lv, &item) == -1) ? NULL : (char*)item.lParam; +} + static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HWND lv; - switch ( msg ) { - case WM_INITDIALOG: - TranslateDialogDefault( hwndDlg ); - lv = GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS); + HWND lv = GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS); + int sel; + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY); SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT)); @@ -331,7 +286,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), FALSE); } - SendMessage(lv,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); + SendMessage(lv, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); { // add list columns LVCOLUMN lvc; @@ -357,109 +312,106 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP ListView_InsertColumn(lv, 2, &lvc); } PostMessage(hwndDlg, WMU_REFRESHPROTOLIST, 0, 0); - return TRUE; + case WMU_REFRESHPROTOLIST: + ListView_DeleteAllItems(lv); { - lv = GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS); - ListView_DeleteAllItems(lv); + LV_ITEM item = { 0 }; + int num_protocols; PROTOACCOUNT **pppDesc; - int ilvItem; - LV_ITEM item = {0}; - char fprint[45]; - TCHAR* temp; - //BOOL unicode = ListView_GetUnicodeFormat(lv); - ProtoEnumAccounts(&num_protocols, &pppDesc); - for(int i = 0; i < num_protocols; i++) { - if((strcmp(pppDesc[i]->szModuleName, META_PROTO) != 0) - && (CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == PF1_IM) - { - item.mask = LVIF_TEXT; - temp = pppDesc[i]->tszAccountName; - item.pszText = temp; - ilvItem = ListView_InsertItem(lv, &item); - - - ListView_SetItemText(lv, ilvItem, 1, (TCHAR*)policy_to_string(db_get_dw(0,MODULENAME"_ProtoPol", pppDesc[i]->szModuleName, CONTACT_DEFAULT_POLICY)) ); - if(otrl_privkey_fingerprint(otr_user_state, fprint, pppDesc[i]->szModuleName, pppDesc[i]->szModuleName)) { - temp = mir_a2t(fprint); - ListView_SetItemText(lv, ilvItem, 2, temp); - mir_free(temp); - } + for (int i = 0; i < num_protocols; i++) { + if (!strcmp(pppDesc[i]->szModuleName, META_PROTO)) + continue; + if ((CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == 0) + continue; + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.pszText = pppDesc[i]->tszAccountName; + item.lParam = (LPARAM)pppDesc[i]->szModuleName; + int ilvItem = ListView_InsertItem(lv, &item); + + ListView_SetItemText(lv, ilvItem, 1, (TCHAR*)policy_to_string(db_get_dw(0, MODULENAME"_ProtoPol", pppDesc[i]->szModuleName, CONTACT_DEFAULT_POLICY))); + + char fprint[45]; + if (otrl_privkey_fingerprint(otr_user_state, fprint, pppDesc[i]->szModuleName, pppDesc[i]->szModuleName)) { + TCHAR *temp = mir_a2t(fprint); + ListView_SetItemText(lv, ilvItem, 2, temp); + mir_free(temp); } } } return TRUE; + case WM_COMMAND: - switch ( HIWORD( wParam )) { - case BN_CLICKED: - switch ( LOWORD( wParam )) { - case IDC_BTN_PROTO_NEWKEY: - { - int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); - if (sel != -1) { - PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS(); - opts->refresh = hwndDlg; - ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, SIZEOF(opts->proto)); - CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0)); - } - }break; - case IDC_BTN_PROTO_FORGET: - { - int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); - if (sel != -1) { - TCHAR buff_proto[128]; - ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, SIZEOF(buff_proto)); - TCHAR buff[512]; - mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_OTR_ASK_REMOVEKEY), buff_proto); - if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) - { - char* proto = mir_t2a(buff_proto); - OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto); - mir_free(proto); - if (key) { - otrl_privkey_forget(key); - otrl_privkey_write(otr_user_state, g_private_key_filename); - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 2, _T("")); - } - } - } - }break; + switch (HIWORD(wParam)) { + case BN_CLICKED: + switch (LOWORD(wParam)) { + case IDC_BTN_PROTO_NEWKEY: + sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); + if (sel != -1) { + PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS(); + opts->refresh = hwndDlg; + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, SIZEOF(opts->proto)); + CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0)); } break; - case CBN_SELCHANGE: - switch ( LOWORD( wParam )) { - case IDC_CMB_PROTO_POLICY: - { - int proto = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); - if (proto == -1) break; - int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETCURSEL, 0, 0); - if (sel==CB_ERR) break; - int len = SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETLBTEXTLEN, sel, 0); - if (len < 0) break; - TCHAR *text = new TCHAR[len+1]; - SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETLBTEXT, sel, (LPARAM)text); - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), proto, 1, text); - delete[] text; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - }break; + + case IDC_BTN_PROTO_FORGET: + sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); + if (sel != -1) { + TCHAR buff_proto[128]; + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, SIZEOF(buff_proto)); + TCHAR buff[512]; + mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_OTR_ASK_REMOVEKEY), buff_proto); + if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION | MB_YESNO)) { + char *proto = GetProtoName(lv, sel); + if (proto == NULL) + break; + + OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto); + if (key) { + otrl_privkey_forget(key); + otrl_privkey_write(otr_user_state, g_private_key_filename); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 2, _T("")); + } + } } - break; + } + break; + + case CBN_SELCHANGE: + switch (LOWORD(wParam)) { + case IDC_CMB_PROTO_POLICY: + int proto = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); + if (proto == -1) break; + int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETCURSEL, 0, 0); + if (sel == CB_ERR) break; + int len = SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETLBTEXTLEN, sel, 0); + if (len < 0) break; + TCHAR *text = new TCHAR[len + 1]; + SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_GETLBTEXT, sel, (LPARAM)text); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), proto, 1, text); + delete[] text; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; } break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->code == (UINT) LVN_ITEMCHANGED && ((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS) - && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED )) { - int sel = ListView_GetSelectionMark(((LPNMHDR) lParam)->hwndFrom); + if (((LPNMHDR)lParam)->code == LVN_ITEMCHANGED && ((LPNMHDR)lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS) + && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED)) { + int sel = ListView_GetSelectionMark(((LPNMHDR)lParam)->hwndFrom); if (sel == -1) { SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_SETCURSEL, (LPARAM)-1, 0); EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_NEWKEY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), FALSE); - } else { + } + else { EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_NEWKEY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), TRUE); @@ -467,18 +419,17 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, sel, 1, buff, SIZEOF(buff)); SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff); } - - } else if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) { - lv = GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS); + } + else if (((LPNMHDR)lParam)->code == PSN_APPLY) { int cnt = ListView_GetItemCount(lv); - TCHAR proto_t[128], policy[64]; - char* proto; + TCHAR policy[64]; for (int i = 0; i < cnt; ++i) { - ListView_GetItemText(lv, i, 0, proto_t, SIZEOF(proto_t)); + char *proto = GetProtoName(lv, i); + if (proto == NULL) + continue; + ListView_GetItemText(lv, i, 1, policy, SIZEOF(policy)); - proto = mir_t2a(proto_t); db_set_dw(0, MODULENAME"_ProtoPol", proto, policy_from_string(policy)); - mir_free(proto); } // handle apply return TRUE; @@ -490,11 +441,12 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch ( msg ) { + HWND lv = GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS); + + switch (msg) { case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TranslateDialogDefault( hwndDlg ); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new ContactPolicyMap()); HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY); @@ -505,11 +457,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_NEVER)); EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), FALSE); - SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS ,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); - - - HWND lv = GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS); - + SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); // add list columns LVCOLUMN lvc; @@ -540,15 +488,12 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM ListView_InsertColumn(lv, 3, &lvc); } SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0); - return TRUE; + case WMU_REFRESHLIST: + ListView_DeleteAllItems(lv); { - HWND lv = GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS); - - ListView_DeleteAllItems(lv); - - LVITEM lvI = {0}; + LVITEM lvI = { 0 }; // Some code to create the list-view control. // Initialize LVITEM members that are common to all @@ -557,88 +502,88 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { const char *proto = GetContactProto(hContact); - if(proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME) // ignore chatrooms + if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME) // ignore chatrooms && strcmp(proto, META_PROTO) != 0) // and MetaContacts { lvI.iItem = 0; lvI.iSubItem = 0; lvI.lParam = hContact; lvI.pszText = (TCHAR*)contact_get_nameT(hContact); - lvI.iItem = ListView_InsertItem(lv , &lvI); + lvI.iItem = ListView_InsertItem(lv, &lvI); PROTOACCOUNT *pa = ProtoGetAccount(proto); ListView_SetItemText(lv, lvI.iItem, 1, pa->tszAccountName); - ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY)) ); - ListView_SetItemText(lv, lvI.iItem, 3, (db_get_b(hContact, MODULENAME, "HTMLConv", 0))?TranslateT(LANG_YES):TranslateT(LANG_NO) ); + ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY))); + ListView_SetItemText(lv, lvI.iItem, 3, (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) ? TranslateT(LANG_YES) : TranslateT(LANG_NO)); } } } return TRUE; - break; case WM_COMMAND: - switch ( HIWORD( 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); - if (sel==CB_ERR) break; - int len = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXTLEN, sel, 0); - if (len < 0) break; - TCHAR *text = new TCHAR[len+1]; - SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXT, sel, (LPARAM)text); - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), iUser, 2, text); - OtrlPolicy policy = policy_from_string(text); - delete[] text; - LVITEM lvi = {0}; - lvi.mask = LVIF_PARAM; - lvi.iItem = iUser; - lvi.iSubItem = 0; - ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi); - ContactPolicyMap* cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - hContact = (MCONTACT)lvi.lParam; - (*cpm)[hContact].policy = policy; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - }break; - } + switch (HIWORD(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); + if (sel == CB_ERR) break; + int len = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXTLEN, sel, 0); + if (len < 0) break; + TCHAR *text = new TCHAR[len + 1]; + SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETLBTEXT, sel, (LPARAM)text); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), iUser, 2, text); + OtrlPolicy policy = policy_from_string(text); + delete[] text; + + LVITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM; + lvi.iItem = iUser; + lvi.iSubItem = 0; + ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi); + + ContactPolicyMap* cpm = (ContactPolicyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + hContact = (MCONTACT)lvi.lParam; + (*cpm)[hContact].policy = policy; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; + } + break; } break; case WM_NOTIFY: - { - UINT code = ((LPNMHDR) lParam)->code; - if (code == (UINT) PSN_APPLY ) { + if (((LPNMHDR)lParam)->code == PSN_APPLY) { // handle apply - ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + ContactPolicyMap *cpm = (ContactPolicyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Iterate over the map and print out all key/value pairs. // Using a const_iterator since we are not going to change the values. - for(ContactPolicyMap::const_iterator it = cpm->begin(); it != cpm->end(); ++it) - { + 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); + if (it->second.htmlconv) db_set_b(it->first, MODULENAME, "HTMLConv", it->second.htmlconv - 1); } return TRUE; - } else if (((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)) { - if (code == (UINT) LVN_ITEMCHANGED && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED )) { - int sel = ListView_GetSelectionMark(((LPNMHDR) lParam)->hwndFrom); + } + else if (((LPNMHDR)lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)) { + if (((LPNMHDR)lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED)) { + int sel = ListView_GetSelectionMark(((LPNMHDR)lParam)->hwndFrom); if (sel == -1) { SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_SETCURSEL, (LPARAM)-1, 0); EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), FALSE); - } else { + } + else { EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), TRUE); TCHAR buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, sel, 2, buff, SIZEOF(buff)); SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff); } - } else if (code == (UINT) NM_CLICK) { + } + else if (((LPNMHDR)lParam)->code == NM_CLICK) { if (((LPNMLISTVIEW)lParam)->iSubItem == 3) { LVITEM lvi; lvi.mask = LVIF_PARAM; @@ -651,23 +596,23 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCHAR buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, SIZEOF(buff)); - if (_tcsncmp(buff, TranslateT(LANG_YES), 50)==0){ + if (_tcsncmp(buff, TranslateT(LANG_YES), 50) == 0) { (*cp)[hContact].htmlconv = HTMLCONV_DISABLE; ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_NO)); - }else { + } + else { (*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); } - - } } - }break; + break; + case WM_DESTROY: - ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + ContactPolicyMap *cpm = (ContactPolicyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); cpm->clear(); delete cpm; break; @@ -677,15 +622,15 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch ( msg ) { + HWND lv = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST); + + switch (msg) { case WM_INITDIALOG: - TranslateDialogDefault( hwndDlg ); + TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new FPModifyMap()); - SendDlgItemMessage(hwndDlg, IDC_LV_FINGER_LIST ,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); - + SendDlgItemMessage(hwndDlg, IDC_LV_FINGER_LIST, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES); { - HWND lv = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST); // add list columns LVCOLUMN lvc; // Initialize the LVCOLUMN structure. @@ -720,157 +665,153 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w ListView_InsertColumn(lv, 4, &lvc); } SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0); - return TRUE; case WMU_REFRESHLIST: - //enumerate contacts, fill in list + // enumerate contacts, fill in list + ListView_DeleteAllItems(lv); { - HWND lv = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST); - ListView_DeleteAllItems(lv); - - LVITEM lvI = {0}; + LVITEM lvI = { 0 }; // Some code to create the list-view control. // Initialize LVITEM members that are common to all // items. lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE; - - TCHAR *user, hash[45] = {0}; - for (ConnContext *context = otr_user_state->context_root;context;context = context->next) { + + TCHAR *user, hash[45] = { 0 }; + for (ConnContext *context = otr_user_state->context_root; context; context = context->next) { if (context->app_data) { user = (TCHAR*)contact_get_nameT((MCONTACT)context->app_data); if (user) { PROTOACCOUNT *pa = ProtoGetAccount(context->protocol); - - for(Fingerprint *fp = context->fingerprint_root.next;fp;fp = fp->next) { + + for (Fingerprint *fp = context->fingerprint_root.next; fp; fp = fp->next) { otrl_privkey_hash_to_humanT(hash, fp->fingerprint); lvI.iSubItem = 0; lvI.lParam = (LPARAM)fp; lvI.pszText = user; int d = ListView_InsertItem(lv, &lvI); - ListView_SetItemText(lv,d, 1, pa->tszAccountName); - ListView_SetItemText(lv,d, 2, (context->active_fingerprint == fp)? TranslateT(LANG_YES) : TranslateT(LANG_NO)); - ListView_SetItemText(lv,d, 3, (fp->trust && fp->trust[0] != '\0')? TranslateT(LANG_YES) : TranslateT(LANG_NO)); - ListView_SetItemText(lv,d, 4, hash ); + ListView_SetItemText(lv, d, 1, pa->tszAccountName); + ListView_SetItemText(lv, d, 2, (context->active_fingerprint == fp) ? TranslateT(LANG_YES) : TranslateT(LANG_NO)); + ListView_SetItemText(lv, d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateT(LANG_YES) : TranslateT(LANG_NO)); + ListView_SetItemText(lv, d, 4, hash); } } } } } + return TRUE; - return TRUE; case WM_COMMAND: - switch ( HIWORD( wParam )) { - case BN_CLICKED: - switch ( LOWORD( wParam )) { - case IDC_BTN_FINGER_DONTTRUST: - { - int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); - if (sel != -1) { - LVITEM lvi = {0}; - lvi.mask = LVIF_PARAM; - lvi.iItem = sel; - ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); - Fingerprint *fp = (Fingerprint*) lvi.lParam; - FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - (*fpm)[fp] = FPM_NOTRUST; - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_NO)); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - }break; - case IDC_BTN_FINGER_TRUST: - { - int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); - if (sel != -1) { - LVITEM lvi = {0}; - lvi.mask = LVIF_PARAM; - lvi.iItem = sel; - ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); - Fingerprint *fp = (Fingerprint*) lvi.lParam; - FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - (*fpm)[fp] = FPM_VERIFY; - ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_YES)); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - }break; - case IDC_BTN_FINGER_FORGET: - { - int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); - if (sel != -1) { - LVITEM lvi = {0}; - lvi.mask = LVIF_PARAM; - lvi.iItem = sel; - ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); - Fingerprint *fp = (Fingerprint*) lvi.lParam; - if (fp->context->active_fingerprint == fp) { - MCONTACT hContact = (MCONTACT)fp->context->app_data; - TCHAR buff[1024], hash[45]; - otrl_privkey_hash_to_humanT(hash, fp->fingerprint); - PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, SIZEOF(buff)-1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); - buff[SIZEOF(buff)-1] = '\0'; - ShowError(buff); - } else { - FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - (*fpm)[fp] = FPM_DELETE; - ListView_DeleteItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - }break; + switch (HIWORD(wParam)) { + int sel; + case BN_CLICKED: + switch (LOWORD(wParam)) { + case IDC_BTN_FINGER_DONTTRUST: + sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); + if (sel != -1) { + LVITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM; + lvi.iItem = sel; + ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); + Fingerprint *fp = (Fingerprint*)lvi.lParam; + FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + (*fpm)[fp] = FPM_NOTRUST; + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_NO)); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } + break; + case IDC_BTN_FINGER_TRUST: + sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); + if (sel != -1) { + LVITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM; + lvi.iItem = sel; + ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); + Fingerprint *fp = (Fingerprint*)lvi.lParam; + FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + (*fpm)[fp] = FPM_VERIFY; + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_YES)); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + + case IDC_BTN_FINGER_FORGET: + sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST)); + if (sel != -1) { + LVITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM; + lvi.iItem = sel; + ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi); + Fingerprint *fp = (Fingerprint*)lvi.lParam; + if (fp->context->active_fingerprint == fp) { + MCONTACT hContact = (MCONTACT)fp->context->app_data; + TCHAR buff[1024], hash[45]; + otrl_privkey_hash_to_humanT(hash, fp->fingerprint); + PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact)); + mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); + buff[SIZEOF(buff) - 1] = '\0'; + ShowError(buff); + } + else { + FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + (*fpm)[fp] = FPM_DELETE; + ListView_DeleteItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + break; + } } break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) { + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { // handle apply - - FPModifyMap *fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + FPModifyMap *fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Iterate over the map and print out all key/value pairs. // Using a const_iterator since we are not going to change the values. - for(FPModifyMap::const_iterator it = fpm->begin(); it != fpm->end(); ++it) - { + for (FPModifyMap::const_iterator it = fpm->begin(); it != fpm->end(); ++it) { if (!it->first) continue; switch (it->second) { - case FPM_DELETE: - if (it->first->context->active_fingerprint == it->first) { - MCONTACT hContact = (MCONTACT)it->first->context->app_data; - TCHAR buff[1024], hash[45]; - otrl_privkey_hash_to_humanT(hash, it->first->fingerprint); - PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, SIZEOF(buff)-1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); - buff[SIZEOF(buff)-1] = '\0'; - ShowError(buff); - } else { - otrl_context_forget_fingerprint(it->first, 1); - } - break; - case FPM_VERIFY: - otrl_context_set_trust(it->first, "verified"); - if (it->first == it->first->context->active_fingerprint) - VerifyFingerprint(it->first->context, true); - //SetEncryptionStatus((HANDLE)it->first->context->app_data, otr_context_get_trust(it->first->context)); - break; - case FPM_NOTRUST: - otrl_context_set_trust(it->first, NULL); - if (it->first == it->first->context->active_fingerprint) - VerifyFingerprint(it->first->context, false); - //SetEncryptionStatus((HANDLE)it->first->context->app_data, otr_context_get_trust(it->first->context)); - break; + case FPM_DELETE: + if (it->first->context->active_fingerprint == it->first) { + MCONTACT hContact = (MCONTACT)it->first->context->app_data; + TCHAR buff[1024], hash[45]; + otrl_privkey_hash_to_humanT(hash, it->first->fingerprint); + PROTOACCOUNT *pa = ProtoGetAccount(GetContactProto(hContact)); + mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); + buff[SIZEOF(buff) - 1] = '\0'; + ShowError(buff); + } + else otrl_context_forget_fingerprint(it->first, 1); + break; + + case FPM_VERIFY: + otrl_context_set_trust(it->first, "verified"); + if (it->first == it->first->context->active_fingerprint) + VerifyFingerprint(it->first->context, true); + break; + + case FPM_NOTRUST: + otrl_context_set_trust(it->first, NULL); + if (it->first == it->first->context->active_fingerprint) + VerifyFingerprint(it->first->context, false); + break; } } - if (!fpm->empty()) otr_gui_write_fingerprints(0); + + if (!fpm->empty()) + otr_gui_write_fingerprints(0); fpm->clear(); SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0); - return TRUE; } break; + case WM_DESTROY: - FPModifyMap *fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + FPModifyMap *fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); fpm->clear(); delete fpm; break; @@ -878,3 +819,42 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w return FALSE; } + +///////////////////////////////////////////////////////////////////////////////////////// + +static int OpenOptions(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.position = 100; + odp.hInstance = hInst; + odp.ptszGroup = LPGENT("Services"); + odp.ptszTitle = _T("OTR"); + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + + odp.ptszTab = LANG_OPT_GENERAL; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL); + odp.pfnDlgProc = DlgProcMirOTROpts; + Options_AddPage(wParam, &odp); + + odp.ptszTab = LANG_OPT_PROTO; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTO); + odp.pfnDlgProc = DlgProcMirOTROptsProto; + Options_AddPage(wParam, &odp); + + odp.ptszTab = LANG_OPT_CONTACTS; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS); + odp.pfnDlgProc = DlgProcMirOTROptsContacts; + Options_AddPage(wParam, &odp); + + odp.ptszTab = LANG_OPT_FINGER; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER); + odp.pfnDlgProc = DlgProcMirOTROptsFinger; + Options_AddPage(wParam, &odp); + return 0; +} + +void InitOptions() +{ + LoadOptions(); + HookEvent(ME_OPT_INITIALISE, OpenOptions); +} diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index 440cc5f32a..b291297596 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -59,15 +59,8 @@ int OptInit(WPARAM wParam, LPARAM lParam); void LoadOptions(); void SaveOptions(); -extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam); void InitOptions(); -void DeinitOptions(); void ReadPrivkeyFiles(); -static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - #endif diff --git a/plugins/MirOTR/src/version.h b/plugins/MirOTR/src/version.h index b25995734b..4c0e80e662 100644 --- a/plugins/MirOTR/src/version.h +++ b/plugins/MirOTR/src/version.h @@ -1,14 +1,14 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 14
#define __RELEASE_NUM 1
-#define __BUILD_NUM 15
+#define __BUILD_NUM 16
#include <stdver.h>
#define __PLUGIN_NAME "Miranda OTR"
#define __FILENAME "MirOTR.dll"
#define __DESCRIPTION "OTR (Off-the-Record) plugin for Miranda NG (using some code and ideas from SecureIM, Pidgin-OTR and old Miranda OTR (by SJE))."
-#define __AUTHOR "ProgAndy & CHEF-KOCH"
+#define __AUTHOR "ProgAndy & CHEF-KOCH"
#define __AUTHOREMAIL ""
#define __AUTHORWEB "http://miranda-ng.org/p/MirOTR/"
#define __COPYRIGHT "© ProgAndy & CHEF-KOCH"
|