summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-04-16 20:12:09 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-04-16 20:12:09 +0000
commiteb9fd10e43ea31ecaea55e5e22252fc59c23f108 (patch)
tree1e084adecf6ba7c2bfdf724914597d2c7af20667 /plugins/MirOTR/src
parent47482deb9eebd316a4caf6635c75636dfe88eebb (diff)
MirOTR:
-support for account names git-svn-id: http://svn.miranda-ng.org/main/trunk@12877 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r--plugins/MirOTR/src/language.h10
-rw-r--r--plugins/MirOTR/src/options.cpp38
-rw-r--r--plugins/MirOTR/src/resource.h119
-rw-r--r--plugins/MirOTR/src/utils.cpp2
4 files changed, 72 insertions, 97 deletions
diff --git a/plugins/MirOTR/src/language.h b/plugins/MirOTR/src/language.h
index a64c2e0b31..64c4373251 100644
--- a/plugins/MirOTR/src/language.h
+++ b/plugins/MirOTR/src/language.h
@@ -47,13 +47,13 @@
#define LANG_GENERATE_KEY LPGEN("Generating new private key for protocol '%s'.\nPlease Wait...")
-#define LANG_OPT_GENERAL LPGEN("General")
-#define LANG_OPT_PROTO LPGEN("Protocols")
-#define LANG_OPT_CONTACTS LPGEN("Contacts")
-#define LANG_OPT_FINGER LPGEN("Fingerprints")
+#define LANG_OPT_GENERAL LPGENT("General")
+#define LANG_OPT_PROTO LPGENT("Protocols")
+#define LANG_OPT_CONTACTS LPGENT("Contacts")
+#define LANG_OPT_FINGER LPGENT("Fingerprints")
#define LANG_CONTACT LPGEN("Contact")
-#define LANG_PROTO LPGEN("Protocol")
+#define LANG_PROTO LPGEN("Account")
#define LANG_POLICY LPGEN("Policy")
#define LANG_VERIFIED LPGEN("Verified")
#define LANG_ACTIVE LPGEN("Active")
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index c1105f4bd8..aa11497927 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -110,22 +110,22 @@ extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam)
odp.ptszTitle = _T("OTR");
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- odp.ptszTab = _T(LANG_OPT_GENERAL);
+ odp.ptszTab = LANG_OPT_GENERAL;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL);
odp.pfnDlgProc = DlgProcMirOTROpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = _T(LANG_OPT_PROTO);
+ odp.ptszTab = LANG_OPT_PROTO;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTO);
odp.pfnDlgProc = DlgProcMirOTROptsProto;
Options_AddPage(wParam, &odp);
- odp.ptszTab = _T(LANG_OPT_CONTACTS);
+ odp.ptszTab = LANG_OPT_CONTACTS;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS);
odp.pfnDlgProc = DlgProcMirOTROptsContacts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = _T(LANG_OPT_FINGER);
+ odp.ptszTab = LANG_OPT_FINGER;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER);
odp.pfnDlgProc = DlgProcMirOTROptsFinger;
Options_AddPage(wParam, &odp);
@@ -376,12 +376,10 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
if((strcmp(pppDesc[i]->szModuleName, META_PROTO) != 0)
&& (CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == PF1_IM)
{
- //if (unicode) {
item.mask = LVIF_TEXT;
- temp = mir_a2t(pppDesc[i]->szModuleName);
+ temp = pppDesc[i]->tszAccountName;
item.pszText = temp;
ilvItem = ListView_InsertItem(lv, &item);
- mir_free(temp);
ListView_SetItemText(lv, ilvItem, 1, (TCHAR*)policy_to_string(db_get_dw(0,MODULENAME"_ProtoPol", pppDesc[i]->szModuleName, CONTACT_DEFAULT_POLICY)) );
@@ -557,10 +555,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
// items.
lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
- const char *proto;
- TCHAR *proto_t;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- proto = GetContactProto(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
&& strcmp(proto, META_PROTO) != 0) // and MetaContacts
{
@@ -570,9 +566,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
lvI.pszText = (TCHAR*)contact_get_nameT(hContact);
lvI.iItem = ListView_InsertItem(lv , &lvI);
- proto_t = mir_a2t(proto);
- ListView_SetItemText(lv, lvI.iItem, 1, proto_t);
- mir_free(proto_t);
+ 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) );
@@ -741,12 +736,12 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
// items.
lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
- TCHAR *proto, *user, hash[45] = {0};
+ 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) {
- proto = mir_a2t(context->protocol);
+ PROTOACCOUNT *pa = ProtoGetAccount(context->protocol);
for(Fingerprint *fp = context->fingerprint_root.next;fp;fp = fp->next) {
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
@@ -755,12 +750,11 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
lvI.pszText = user;
int d = ListView_InsertItem(lv, &lvI);
- ListView_SetItemText(lv,d, 1, proto);
+ 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 );
}
- mir_free(proto);
}
}
}
@@ -814,9 +808,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (MCONTACT)fp->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
- TCHAR *proto = mir_a2t(GetContactProto(hContact));
- mir_sntprintf(buff, SIZEOF(buff)-1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), proto);
- mir_free(proto);
+ 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 {
@@ -847,9 +840,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
MCONTACT hContact = (MCONTACT)it->first->context->app_data;
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
- TCHAR *proto = mir_a2t(GetContactProto(hContact));
- mir_sntprintf(buff, SIZEOF(buff)-1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), proto);
- mir_free(proto);
+ 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 {
diff --git a/plugins/MirOTR/src/resource.h b/plugins/MirOTR/src/resource.h
index 3b117f8699..6757de6f81 100644
--- a/plugins/MirOTR/src/resource.h
+++ b/plugins/MirOTR/src/resource.h
@@ -1,87 +1,70 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by resource.rc
+// Used by C:\Users\xx\Documents\Visual Studio 2010\Projects\miranda-ng\plugins\MirOTR\res\resource.rc
//
#define IDD_GENKEYNOTIFY 101
#define IDD_OPT_GENERAL 102
-#define IDD_OPT_PROTO 103
-#define IDD_OPT_CONTACTS 104
-#define IDD_OPT_FINGER 105
-#define IDD_SMP_INPUT 106
-#define IDD_SMP_PROGRESS 107
-
-// General Options
-#define IDC_GRP_POLICY 1051
+#define IDD_OPT_PROTO 103
+#define IDD_OPT_CONTACTS 104
+#define IDD_OPT_FINGER 105
+#define IDD_SMP_INPUT 106
+#define IDD_SMP_PROGRESS 107
+#define IDC_GRP_POLICY 1051
#define IDC_RAD_ALWAYS 1052
#define IDC_RAD_OPP 1053
#define IDC_RAD_MANUAL 1054
#define IDC_RAD_NEVER 1055
-
#define IDC_CHK_PREFIX 1056
#define IDC_ED_PREFIX 1057
#define IDC_CHK_MSGINLINE 1058
#define IDC_CHK_MSGPOPUP 1059
-#define IDC_CHK_PREVENTSAVE 1060
-#define IDC_CHK_AUTOSHOW_VERIFY 1061
+#define IDC_CHK_PREVENTSAVE 1060
+#define IDC_CHK_AUTOSHOW_VERIFY 1061
#define IDC_CHK_ENDOFFLINE 1063
#define IDC_CHK_ENDCLOSE 1064
-#define IDC_CHK_PREVENTSYSSAVE 1065
-
-// Proto policy & keys
-#define IDC_LV_PROTO_PROTOS 1101
-#define IDC_BTN_PROTO_NEWKEY 1102
-#define IDC_CMB_PROTO_POLICY 1103
-#define IDC_BTN_PROTO_FORGET 1104
-#define IDC_STC_PROTO1 1151
-#define IDC_STC_PROTO2 1152
-
-// User policy
-#define IDC_LV_CONT_CONTACTS 1201
-#define IDC_CMB_CONT_POLICY 1202
-#define IDC_STC_CONT1 1251
-#define IDC_STC_CONT2 1252
-
-// User fingerprints
-#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
-
-// Generate dialog
-#define IDC_GENERATE 1401
-#define IDC_ICOOTR 1402
-#define IDC_ICOREFRESH 1403
-
-// SMP Progress
-#define IDC_PGB_SMP 1501
-#define IDC_STC_SMP_HEADPRO 1502
-#define IDC_ICO_SMP 1503
-#define IDC_STC_SMP_PROGRESS 1504
-
-// SMP Dialog
-#define IDC_STC_SMP_HEAD 1602
-#define IDC_CBO_SMP_CHOOSE 1603
-#define IDC_STC_SMP_INFO 1604
-#define IDC_STC_SMP_FIELD1 1605
-#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 IDC_CHK_PREVENTSYSSAVE 1065
+#define IDC_LV_PROTO_PROTOS 1101
+#define IDC_BTN_PROTO_NEWKEY 1102
+#define IDC_CMB_PROTO_POLICY 1103
+#define IDC_BTN_PROTO_FORGET 1104
+#define IDC_STC_PROTO1 1151
+#define IDC_STC_PROTO2 1152
+#define IDC_LV_CONT_CONTACTS 1201
+#define IDC_CMB_CONT_POLICY 1202
+#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
+#define IDC_PGB_SMP 1501
+#define IDC_STC_SMP_HEADPRO 1502
+#define IDC_ICO_SMP 1503
+#define IDC_STC_SMP_PROGRESS 1504
+#define IDC_STC_SMP_HEAD 1602
+#define IDC_CBO_SMP_CHOOSE 1603
+#define IDC_STC_SMP_INFO 1604
+#define IDC_STC_SMP_FIELD1 1605
+#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 IDM_OTR_MENU 10001
-#define IDR_CONTEXT 10000
-#define IDM_OTR_STATUS 10001
-#define IDM_OTR_START 10002
-#define IDM_OTR_REFRESH 10003
-#define IDM_OTR_STOP 10004
-#define IDM_OTR_VERIFY 10005
+#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
+#define IDM_OTR_START 10002
+#define IDM_OTR_REFRESH 10003
+#define IDM_OTR_STOP 10004
+#define IDM_OTR_VERIFY 10005
// Next default values for new objects
//
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index ac72f2094b..2261b089a8 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -284,7 +284,7 @@ void ShowError(TCHAR *msg) {
message = new TCHAR[size]; // newline and null terminator
mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg);
PUShowMessageT(message, SM_WARNING);
- delete message;
+ delete[] message;
}
break;
case ED_MB: