summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2015-03-26 20:39:16 +0000
committerRené Schümann <white06tiger@gmail.com>2015-03-26 20:39:16 +0000
commita02de2743a09366b17473f77567a8ca47a8db0d9 (patch)
treee1a356de0257a8c53b99faaeb377567948476c63 /plugins/MirOTR/src
parent5f2e4efe46fefa7cd11f275896954c24be37b568 (diff)
MirOTR:
! fixed options dialog radio button grouping (resource.rc) ! fixed crash when trying to delete fingerprint in use (options.cpp) * changed default OTR prefix to one that cannot be faked by other parties and added note about this fact to options (options.cpp) + small improvement to options. Reset prefix to default if user enters an empty one (options.cpp) git-svn-id: http://svn.miranda-ng.org/main/trunk@12504 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r--plugins/MirOTR/src/options.cpp20
-rw-r--r--plugins/MirOTR/src/options.h2
2 files changed, 18 insertions, 4 deletions
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index 89f2b49b46..c547d7afde 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -90,7 +90,7 @@ void LoadOptions() {
options.prefix[OPTIONS_PREFIXLEN-1] = 0;
db_free(&dbv);
} else
- strncpy(options.prefix, ("OTR: "), OPTIONS_PREFIXLEN-1);
+ strncpy(options.prefix, OPTIONS_DEFAULT_PREFIX, OPTIONS_PREFIXLEN-1);
options.end_offline = (db_get_b(0, MODULENAME, "EndOffline", 1) == 1);
options.end_window_close = (db_get_b(0, MODULENAME, "EndWindowClose", 0) == 1);
@@ -265,7 +265,11 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam,
GetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix, OPTIONS_PREFIXLEN);
prefix_utf = mir_utf8encodeT(prefix);
mir_free(prefix);
- strncpy(options.prefix, prefix_utf, OPTIONS_PREFIXLEN-1);
+ if(!prefix_utf[0]){
+ SetDlgItemTextA(hwndDlg, IDC_ED_PREFIX, OPTIONS_DEFAULT_PREFIX);
+ strncpy(options.prefix, OPTIONS_DEFAULT_PREFIX, OPTIONS_PREFIXLEN-1);
+ } else
+ strncpy(options.prefix, prefix_utf, OPTIONS_PREFIXLEN-1);
mir_free(prefix_utf);
SaveOptions();
@@ -808,9 +812,13 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
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);
- mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT((MCONTACT)fp->context->app_data));
+ 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);
+ buff[SIZEOF(buff)-1] = '\0';
ShowError(buff);
} else {
FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -837,9 +845,13 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
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);
- mir_sntprintf(buff, SIZEOF(buff), TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT((MCONTACT)it->first->context->app_data));
+ 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);
+ buff[SIZEOF(buff)-1] = '\0';
ShowError(buff);
} else {
otrl_context_forget_fingerprint(it->first, 1);
diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h
index da2e59ba3c..fc236d05cd 100644
--- a/plugins/MirOTR/src/options.h
+++ b/plugins/MirOTR/src/options.h
@@ -14,6 +14,8 @@ extern char g_instag_filename[MAX_PATH];
typedef enum {ED_POP, ED_BAL, ED_MB} ErrorDisplay;
#define OPTIONS_PREFIXLEN 64
+//#define OPTIONS_DEFAULT_PREFIX "OTR: "
+#define OPTIONS_DEFAULT_PREFIX "?OTR? "
typedef struct {
OtrlPolicy default_policy;