summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src/dialogs.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
commite2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch)
treeba79bdcede96f80039f8b88d2791f198b9ec2981 /plugins/MirOTR/src/dialogs.cpp
parentf8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff)
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src/dialogs.cpp')
-rw-r--r--plugins/MirOTR/src/dialogs.cpp57
1 files changed, 26 insertions, 31 deletions
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index f724c5a371..350d761d8d 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -266,34 +266,32 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case WM_COMMAND:
switch ( HIWORD( wParam )) {
- case BN_CLICKED:
- {
- ConnContext *context = (ConnContext *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch ( LOWORD( wParam )) {
- case IDOK:
- {
- SMPInitUpdateDialog(context, true);
-
- int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
- TCHAR *answer = new TCHAR[len+1];
- GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
- char *ans = mir_utf8encodeT(answer);
- delete[] answer;
-
- otr_continue_smp(context, (const unsigned char *)ans, mir_strlen(ans));
- mir_free(ans);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL);
- DestroyWindow(hwndDlg);
- }break;
- case IDCANCEL:
- smp_for_contact.erase(context->app_data);
- DestroyWindow(hwndDlg);
- break;
- }
+ case BN_CLICKED:
+ ConnContext *context = (ConnContext *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ switch ( LOWORD( wParam )) {
+ case IDOK:
+ SMPInitUpdateDialog(context, true);
+ {
+ int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
+ TCHAR *answer = new TCHAR[len+1];
+ GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
+
+ T2Utf ans(answer);
+ otr_continue_smp(context, (const unsigned char *)ans, mir_strlen(ans));
+ delete[] answer;
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL);
+ DestroyWindow(hwndDlg);
}
+ break;
+
+ case IDCANCEL:
+ smp_for_contact.erase(context->app_data);
+ DestroyWindow(hwndDlg);
+ break;
+ }
}
break;
-
}
return FALSE;
@@ -429,19 +427,17 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0);
TCHAR *question = new TCHAR[len+1];
GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, question, len+1);
- char *quest = mir_utf8encodeT(question);
+ T2Utf quest(question);
delete question;
len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
TCHAR *answer = new TCHAR[len+1];
GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
- char *ans = mir_utf8encodeT(answer);
+ T2Utf ans(answer);
delete answer;
SMPInitUpdateDialog(context, false);
otr_start_smp(context, quest, (const unsigned char*)ans, mir_strlen(ans));
- mir_free(quest);
- mir_free(ans);
}
}else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
@@ -453,12 +449,11 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
TCHAR *answer = new TCHAR[len+1];
GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
- char *ans = mir_utf8encodeT(answer);
+ T2Utf ans(answer);
delete[] answer;
SMPInitUpdateDialog(context, false);
otr_start_smp(context, NULL, (const unsigned char*)ans, mir_strlen(ans));
- mir_free(ans);
}
}else break;