summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-07 18:08:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-07 18:08:02 +0300
commit042fd8c584790a418df57e36da5c734f272c3962 (patch)
treeec5cd7cc765b1e2bd5061d7c51348f343f4d341a /plugins/MirOTR
parentc970f5a11e85c4efe5a27783c7c8d994c55daf8b (diff)
MirOTR:
- context menu item added to copy a fingerprint; - DlgProcMirOTROptsFinger -> UI classes
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/res/resource.rc29
-rw-r--r--plugins/MirOTR/src/language.h5
-rw-r--r--plugins/MirOTR/src/options.cpp374
-rw-r--r--plugins/MirOTR/src/options.h1
-rw-r--r--plugins/MirOTR/src/resource.h23
-rw-r--r--plugins/MirOTR/src/stdafx.h1
-rw-r--r--plugins/MirOTR/src/utils.cpp16
-rw-r--r--plugins/MirOTR/src/utils.h2
8 files changed, 231 insertions, 220 deletions
diff --git a/plugins/MirOTR/res/resource.rc b/plugins/MirOTR/res/resource.rc
index 04d547ec16..b6b419e54d 100644
--- a/plugins/MirOTR/res/resource.rc
+++ b/plugins/MirOTR/res/resource.rc
@@ -105,11 +105,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "View & Modify status of known fingerprints",IDC_STC_FINGER1,3,3,291,12,SS_NOPREFIX | NOT WS_GROUP
- CONTROL "",IDC_LV_FINGER_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,0,18,296,179
- PUSHBUTTON "Set verified",IDC_BTN_FINGER_TRUST,4,202,66,18
- PUSHBUTTON "Set unknown",IDC_BTN_FINGER_DONTTRUST,72,202,66,18
- PUSHBUTTON "Forget",IDC_BTN_FINGER_FORGET,225,202,66,18
+ LTEXT "View & Modify status of known fingerprints",IDC_STATIC,3,3,291,12,SS_NOPREFIX | NOT WS_GROUP
+ CONTROL "",IDC_LV_FINGER_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,0,18,296,210
END
IDD_SMP_PROGRESS DIALOGEX 10, 10, 200, 100
@@ -164,6 +161,18 @@ BEGIN
END
END
+IDR_OPT_FINGER MENU
+BEGIN
+ POPUP ""
+ BEGIN
+ MENUITEM "Set verified", IDM_OPT_FINGER_TRUST
+ MENUITEM "Set unknown", IDM_OPT_FINGER_DONTTRUST
+ MENUITEM SEPARATOR
+ MENUITEM "Copy", IDM_OPT_COPY
+ MENUITEM SEPARATOR
+ MENUITEM "Forget", IDM_OPT_FINGER_FORGET
+ END
+END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -206,19 +215,10 @@ BEGIN
IDD_OPT_GENERAL, DIALOG
BEGIN
RIGHTMARGIN, 296
- VERTGUIDE, 12
- VERTGUIDE, 23
- VERTGUIDE, 138
- VERTGUIDE, 144
- VERTGUIDE, 290
END
IDD_OPT_PROTO, DIALOG
BEGIN
- VERTGUIDE, 3
- VERTGUIDE, 155
- VERTGUIDE, 162
- VERTGUIDE, 285
BOTTOMMARGIN, 220
END
@@ -230,7 +230,6 @@ BEGIN
IDD_OPT_FINGER, DIALOG
BEGIN
BOTTOMMARGIN, 220
- HORZGUIDE, 203
END
IDD_SMP_INPUT, DIALOG
diff --git a/plugins/MirOTR/src/language.h b/plugins/MirOTR/src/language.h
index 67e035747f..40c98deb0b 100644
--- a/plugins/MirOTR/src/language.h
+++ b/plugins/MirOTR/src/language.h
@@ -35,11 +35,6 @@
#define LANG_GENERATE_KEY LPGENW("Generating new private key for account '%s'.\nPlease Wait...")
-#define LANG_OPT_GENERAL LPGENW("General")
-#define LANG_OPT_PROTO LPGENW("Accounts")
-#define LANG_OPT_CONTACTS LPGENW("Contacts")
-#define LANG_OPT_FINGER LPGENW("Fingerprints")
-
#define LANG_CONTACT LPGENW("Contact")
#define LANG_PROTO LPGENW("Account")
#define LANG_POLICY LPGENW("Policy")
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index bee9fa9280..7881bd4348 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -624,203 +624,198 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
return FALSE;
}
-static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwndList = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST);
-
- switch (msg) {
- case WM_INITDIALOG:
- 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);
- {
- // add list columns
- LVCOLUMN lvc;
- // Initialize the LVCOLUMN structure.
- // The mask specifies that the format, width, text, and
- // subitem members of the structure are valid.
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvc.fmt = LVCFMT_LEFT;
-
- lvc.iSubItem = 0;
- lvc.pszText = TranslateW(LANG_CONTACT);
- lvc.cx = 100; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
-
- lvc.iSubItem = 1;
- lvc.pszText = TranslateW(LANG_PROTO);
- lvc.cx = 90; // width of column in pixels
- ListView_InsertColumn(hwndList, 1, &lvc);
-
- lvc.iSubItem = 2;
- lvc.pszText = TranslateW(LANG_ACTIVE);
- lvc.cx = 50; // width of column in pixels
- ListView_InsertColumn(hwndList, 2, &lvc);
-
- lvc.iSubItem = 3;
- lvc.pszText = TranslateW(LANG_VERIFIED);
- lvc.cx = 50; // width of column in pixels
- ListView_InsertColumn(hwndList, 3, &lvc);
+/////////////////////////////////////////////////////////////////////////////////////////
- lvc.iSubItem = 4;
- lvc.pszText = TranslateW(LANG_FINGERPRINT);
- lvc.cx = 300; // width of column in pixels
- ListView_InsertColumn(hwndList, 4, &lvc);
- }
- SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
- return TRUE;
+class CFingerOptionsDlg : public CDlgBase
+{
+ CCtrlListView m_list;
+ std::map<Fingerprint *, FPModify> m_map;
- case WMU_REFRESHLIST:
+ void RefreshList()
+ {
// enumerate contacts, fill in list
- ListView_DeleteAllItems(hwndList);
- {
- 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;
-
- for (ConnContext *context = otr_user_state->context_root; context; context = context->next) {
- if (context->app_data) {
- wchar_t *user = (wchar_t*)contact_get_nameT((UINT_PTR)context->app_data);
- if (user) {
- PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);
-
- wchar_t hash[45];
- 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(hwndList, &lvI);
-
- ListView_SetItemText(hwndList, d, 1, pa->tszAccountName);
- ListView_SetItemText(hwndList, d, 2, (context->active_fingerprint == fp) ? TranslateW(LANG_YES) : TranslateW(LANG_NO));
- ListView_SetItemText(hwndList, d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateW(LANG_YES) : TranslateW(LANG_NO));
- ListView_SetItemText(hwndList, d, 4, hash);
- }
- }
- }
+ m_list.DeleteAllItems();
+
+ // Some code to create the list-view control.
+ // Initialize LVITEM members that are common to all
+ // items.
+ LVITEM lvI = { };
+ lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
+
+ for (ConnContext *context = otr_user_state->context_root; context; context = context->next) {
+ if (!context->app_data)
+ continue;
+
+ wchar_t *user = (wchar_t *)contact_get_nameT((UINT_PTR)context->app_data);
+ if (!user)
+ continue;
+
+ PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);
+
+ wchar_t hash[45];
+ for (auto *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 = m_list.InsertItem(&lvI);
+
+ m_list.SetItemText(d, 1, pa->tszAccountName);
+ m_list.SetItemText(d, 2, (context->active_fingerprint == fp) ? TranslateW(LANG_YES) : TranslateW(LANG_NO));
+ m_list.SetItemText(d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateW(LANG_YES) : TranslateW(LANG_NO));
+ m_list.SetItemText(d, 4, hash);
}
}
- return TRUE;
+ }
- case WM_COMMAND:
- 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, TranslateW(LANG_NO));
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+public:
+ CFingerOptionsDlg() :
+ CDlgBase(g_plugin, IDD_OPT_FINGER),
+ m_list(this, IDC_LV_FINGER_LIST)
+ {
+ m_list.OnBuildMenu = Callback(this, &CFingerOptionsDlg::OnContextMenu);
+ }
+
+ bool OnInitDialog() override
+ {
+ m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
+
+ // add list columns
+ LVCOLUMN lvc;
+ // Initialize the LVCOLUMN structure.
+ // The mask specifies that the format, width, text, and
+ // subitem members of the structure are valid.
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+
+ lvc.iSubItem = 0;
+ lvc.pszText = TranslateW(LANG_CONTACT);
+ lvc.cx = 100; // width of column in pixels
+ m_list.InsertColumn(0, &lvc);
+
+ lvc.iSubItem = 1;
+ lvc.pszText = TranslateW(LANG_PROTO);
+ lvc.cx = 90; // width of column in pixels
+ m_list.InsertColumn(1, &lvc);
+
+ lvc.iSubItem = 2;
+ lvc.pszText = TranslateW(LANG_ACTIVE);
+ lvc.cx = 50; // width of column in pixels
+ m_list.InsertColumn(2, &lvc);
+
+ lvc.iSubItem = 3;
+ lvc.pszText = TranslateW(LANG_VERIFIED);
+ lvc.cx = 50; // width of column in pixels
+ m_list.InsertColumn(3, &lvc);
+
+ lvc.iSubItem = 4;
+ lvc.pszText = TranslateW(LANG_FINGERPRINT);
+ lvc.cx = 300; // width of column in pixels
+ m_list.InsertColumn(4, &lvc);
+
+ RefreshList();
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ // 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 (auto &it : m_map) {
+ if (!it.first) continue;
+ switch (it.second) {
+ case FPM_DELETE:
+ if (it.first->context->active_fingerprint == it.first) {
+ MCONTACT hContact = (UINT_PTR)it.first->context->app_data;
+ wchar_t buff[1024], hash[45];
+ otrl_privkey_hash_to_humanT(hash, it.first->fingerprint);
+ PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
+ mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
+ ShowError(buff);
}
+ else otrl_context_forget_fingerprint(it.first, 1);
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, TranslateW(LANG_YES));
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+
+ 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 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 = (UINT_PTR)fp->context->app_data;
- wchar_t buff[1024], hash[45];
- otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
- PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
- mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
- 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);
- }
- }
+
+ case FPM_NOTRUST:
+ otrl_context_set_trust(it.first, nullptr);
+ if (it.first == it.first->context->active_fingerprint)
+ VerifyFingerprint(it.first->context, false);
break;
}
}
- break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
- // handle apply
- 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) {
- if (!it->first) continue;
- switch (it->second) {
- case FPM_DELETE:
- if (it->first->context->active_fingerprint == it->first) {
- MCONTACT hContact = (UINT_PTR)it->first->context->app_data;
- wchar_t buff[1024], hash[45];
- otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
- PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
- mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
- 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, nullptr);
- if (it->first == it->first->context->active_fingerprint)
- VerifyFingerprint(it->first->context, false);
- break;
- }
- }
+ if (!m_map.empty())
+ otr_gui_write_fingerprints(nullptr);
- if (!fpm->empty())
- otr_gui_write_fingerprints(nullptr);
- fpm->clear();
- SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
- return TRUE;
+ m_map.clear();
+ RefreshList();
+ return true;
+ }
+
+ void OnContextMenu(CCtrlListView *)
+ {
+ int sel = m_list.GetSelectionMark();
+ if (sel == -1)
+ return;
+
+ POINT pt;
+ GetCursorPos(&pt);
+
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_OPT_FINGER));
+ TranslateMenu(hMenu);
+
+ LVITEM lvi = {};
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = sel;
+ m_list.GetItem(&lvi);
+
+ auto *fp = (Fingerprint *)lvi.lParam;
+
+ switch (TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, 0)) {
+ case IDM_OPT_FINGER_DONTTRUST:
+ m_map[fp] = FPM_NOTRUST;
+ m_list.SetItemText(sel, 3, TranslateW(LANG_NO));
+ NotifyChange();
+ break;
+
+ case IDM_OPT_FINGER_TRUST:
+ m_map[fp] = FPM_VERIFY;
+ m_list.SetItemText(sel, 3, TranslateW(LANG_YES));
+ NotifyChange();
+ break;
+
+ case IDM_OPT_COPY:
+ wchar_t hash[45];
+ otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
+ CopyToClipboard(hash);
+ break;
+
+ case IDM_OPT_FINGER_FORGET:
+ if (fp->context->active_fingerprint == fp) {
+ MCONTACT hContact = (UINT_PTR)fp->context->app_data;
+ wchar_t buff[1024];
+ otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
+ PROTOACCOUNT *pa = Proto_GetAccount(Proto_GetBaseAccountName(hContact));
+ mir_snwprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
+ ShowError(buff);
+ }
+ else {
+ m_map[fp] = FPM_DELETE;
+ m_list.DeleteItem(sel);
+ NotifyChange();
+ }
+ break;
}
- break;
- case WM_DESTROY:
- FPModifyMap *fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- fpm->clear();
- delete fpm;
- break;
+ DestroyMenu(hMenu);
}
-
- return FALSE;
-}
+};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -828,28 +823,29 @@ static int OpenOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.position = 100;
- odp.szGroup.w = LPGENW("Services");
- odp.szTitle.w = L"OTR";
- odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ odp.szGroup.a = LPGEN("Services");
+ odp.szTitle.a = "OTR";
+ odp.flags = ODPF_BOLDGROUPS;
- odp.szTab.w = LANG_OPT_GENERAL;
+ odp.szTab.a = LPGEN("General");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL);
odp.pfnDlgProc = DlgProcMirOTROpts;
g_plugin.addOptions(wParam, &odp);
- odp.szTab.w = LANG_OPT_PROTO;
+ odp.szTab.a = LPGEN("Accounts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTO);
odp.pfnDlgProc = DlgProcMirOTROptsProto;
g_plugin.addOptions(wParam, &odp);
- odp.szTab.w = LANG_OPT_CONTACTS;
+ odp.szTab.a = LPGEN("Contacts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS);
odp.pfnDlgProc = DlgProcMirOTROptsContacts;
g_plugin.addOptions(wParam, &odp);
- odp.szTab.w = LANG_OPT_FINGER;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER);
- odp.pfnDlgProc = DlgProcMirOTROptsFinger;
+ odp.szTab.a = LPGEN("Fingerprints");
+ odp.pszTemplate = 0;
+ odp.pfnDlgProc = 0;
+ odp.pDialog = new CFingerOptionsDlg();
g_plugin.addOptions(wParam, &odp);
return 0;
}
diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h
index 46a0afc157..1e8953edbf 100644
--- a/plugins/MirOTR/src/options.h
+++ b/plugins/MirOTR/src/options.h
@@ -53,7 +53,6 @@ struct CONTACT_DATA {
};
typedef std::map<MCONTACT, CONTACT_DATA> ContactPolicyMap;
typedef enum {FPM_VERIFY, FPM_NOTRUST, FPM_DELETE } FPModify;
-typedef std::map<Fingerprint*, FPModify> FPModifyMap;
int OptInit(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/MirOTR/src/resource.h b/plugins/MirOTR/src/resource.h
index ac09389df9..d6102c36a3 100644
--- a/plugins/MirOTR/src/resource.h
+++ b/plugins/MirOTR/src/resource.h
@@ -9,6 +9,14 @@
#define IDD_OPT_FINGER 105
#define IDD_SMP_INPUT 106
#define IDD_SMP_PROGRESS 107
+#define IDR_OPT_FINGER 108
+#define IDI_OTR 109
+#define IDI_REFRESH 110
+#define IDI_INSECURE 111
+#define IDI_UNVERIFIED 112
+#define IDI_PRIVATE 113
+#define IDI_FINISHED 114
+
#define IDC_GRP_POLICY 1051
#define IDC_RAD_ALWAYS 1052
#define IDC_RAD_OPP 1053
@@ -34,10 +42,6 @@
#define IDC_STC_CONT1 1251
#define IDC_STC_CONT2 1252
#define IDC_LV_FINGER_LIST 1301
-#define IDC_BTN_FINGER_FORGET 1302
-#define IDC_BTN_FINGER_TRUST 1303
-#define IDC_BTN_FINGER_DONTTRUST 1304
-#define IDC_STC_FINGER1 1351
#define IDC_GENERATE 1401
#define IDC_ICOOTR 1402
#define IDC_ICOREFRESH 1403
@@ -52,12 +56,6 @@
#define IDC_EDT_SMP_FIELD1 1606
#define IDC_STC_SMP_FIELD2 1607
#define IDC_EDT_SMP_FIELD2 1608
-#define IDI_OTR 2000
-#define IDI_REFRESH 2001
-#define IDI_INSECURE 2002
-#define IDI_UNVERIFIED 2003
-#define IDI_PRIVATE 2004
-#define IDI_FINISHED 2005
#define IDR_CONTEXT 10000
#define IDM_OTR_MENU 10001
#define IDM_OTR_STATUS 10001
@@ -65,6 +63,11 @@
#define IDM_OTR_REFRESH 10003
#define IDM_OTR_STOP 10004
#define IDM_OTR_VERIFY 10005
+#define IDM_OPT_COPY 10006
+#define IDM_OPT_FINGER_FORGET 10007
+#define IDM_OPT_FINGER_TRUST 10008
+#define IDM_OPT_FINGER_DONTTRUST 10009
+
// Next default values for new objects
//
diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h
index 546a491222..dfbe88fd4c 100644
--- a/plugins/MirOTR/src/stdafx.h
+++ b/plugins/MirOTR/src/stdafx.h
@@ -34,6 +34,7 @@ using namespace std;
#include <m_contacts.h>
#include <m_icolib.h>
#include <m_skin.h>
+#include <m_gui.h>
#include <win2k.h>
#include <m_genmenu.h>
#include <m_options.h>
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index fa02d254cd..1b1a9fe55c 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -187,6 +187,22 @@ void ShowError(wchar_t *msg)
}
}
+void CopyToClipboard(const wchar_t *pwszMsg)
+{
+ if (pwszMsg == nullptr)
+ return;
+
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_wstrlen(pwszMsg) + 1) * sizeof(wchar_t));
+ LPWSTR lptstrCopy = (LPWSTR)GlobalLock(hglbCopy);
+ mir_wstrcpy(lptstrCopy, pwszMsg);
+ GlobalUnlock(hglbCopy);
+
+ if (OpenClipboard(nullptr)) {
+ EmptyClipboard();
+ SetClipboardData(CF_UNICODETEXT, hglbCopy);
+ CloseClipboard();
+ }
+}
void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact)
{
diff --git a/plugins/MirOTR/src/utils.h b/plugins/MirOTR/src/utils.h
index 17dc74d758..1bef577c29 100644
--- a/plugins/MirOTR/src/utils.h
+++ b/plugins/MirOTR/src/utils.h
@@ -24,6 +24,8 @@ extern __inline const wchar_t* contact_get_nameT(MCONTACT hContact);
wchar_t* ProtoGetNickname(const char* proto);
+void CopyToClipboard(const wchar_t *pwszMsg);
+
char* GetDlgItemTextUtf(HWND hwndDlg, int ctrlId);
void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact = NULL);