diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/MirOTR/src | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r-- | plugins/MirOTR/src/dialogs.cpp | 124 | ||||
-rw-r--r-- | plugins/MirOTR/src/dllmain.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/language.h | 182 | ||||
-rw-r--r-- | plugins/MirOTR/src/mirotrmenu.cpp | 22 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 130 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.h | 6 | ||||
-rw-r--r-- | plugins/MirOTR/src/otr.cpp | 50 | ||||
-rw-r--r-- | plugins/MirOTR/src/otr.h | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_menu.cpp | 38 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_proto.cpp | 6 | ||||
-rw-r--r-- | plugins/MirOTR/src/svcs_srmm.cpp | 8 | ||||
-rw-r--r-- | plugins/MirOTR/src/utils.cpp | 80 | ||||
-rw-r--r-- | plugins/MirOTR/src/utils.h | 20 |
13 files changed, 335 insertions, 335 deletions
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index 0451367f84..cc3ab94d61 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -6,7 +6,7 @@ struct SmpData TrustLevel oldlevel; ConnContext *context; bool responder; - TCHAR *question; + wchar_t *question; }; typedef std::map<HANDLE, SmpData> SmpForContactMap; SmpForContactMap smp_for_contact; @@ -40,11 +40,11 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, smp_for_contact[context->app_data].responder = data->responder; mir_free(data); - TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact)); - const TCHAR *name = contact_get_nameT(hContact); - mir_sntprintf(title, TranslateT(LANG_SMP_PROGRESS_TITLE), name, proto); + wchar_t title[512], *proto = mir_a2t(GetContactProto(hContact)); + const wchar_t *name = contact_get_nameT(hContact); + mir_sntprintf(title, TranslateW(LANG_SMP_PROGRESS_TITLE), name, proto); SetWindowText(hwndDlg, title); - mir_sntprintf(title, TranslateT(LANG_SMP_PROGRESS_DESC), name, proto); + mir_sntprintf(title, TranslateW(LANG_SMP_PROGRESS_DESC), name, proto); mir_free(proto); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEADPRO, title); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context); @@ -97,7 +97,7 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, case 0: EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), false); EnableWindow(GetDlgItem(hwndDlg, IDOK), true); - SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_ERROR)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateW(LANG_SMP_ERROR)); smp_for_contact.erase(context->app_data); break; case 100: @@ -107,14 +107,14 @@ static INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, smp_for_contact.erase(context->app_data); if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { if (context->active_fingerprint->trust && context->active_fingerprint->trust[0]) { - SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateW(LANG_SMP_SUCCESS)); } else { - SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS_VERIFY)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateW(LANG_SMP_SUCCESS_VERIFY)); } } else { - SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_FAILED)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateW(LANG_SMP_FAILED)); } } break; @@ -183,25 +183,25 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam smp_for_contact[context->app_data].oldlevel = data->oldlevel; smp_for_contact[context->app_data].responder = data->responder; - TCHAR buff[512], *proto = mir_a2t(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); + wchar_t buff[512], *proto = mir_a2t(GetContactProto(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); mir_free(proto); SetWindowText(hwndDlg, buff); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, buff); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context); if (data->question) { - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, data->question); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateW(LANG_SMP_QUESTION)); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_SMP_ANSWER)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA); @@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam mir_free(data->question); } else { - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -221,7 +221,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_PASSWORD)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_SMP_PASSWORD)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA); @@ -272,7 +272,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam SMPInitUpdateDialog(context, true); { int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0); - TCHAR *answer = new TCHAR[len + 1]; + wchar_t *answer = new wchar_t[len + 1]; GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1); T2Utf ans(answer); @@ -297,7 +297,7 @@ static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam } /* -void SMPInitResponseDialog(ConnContext *context, const TCHAR *question) { +void SMPInitResponseDialog(ConnContext *context, const wchar_t *question) { if (!context) return; SmpData *data = (SmpData*)mir_calloc(sizeof(SmpData)); data->context = context; @@ -326,8 +326,8 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } MCONTACT hContact = (UINT_PTR)context->app_data; - TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact)); - mir_sntprintf(title, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); + wchar_t title[512], *proto = mir_a2t(GetContactProto(hContact)); + mir_sntprintf(title, TranslateW(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto); mir_free(proto); SetWindowText(hwndDlg, title); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title); @@ -366,10 +366,10 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam HWND cmb = GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_QUESTION)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_PASSWORD)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_FINGERPRINT)); - SendMessage(cmb, CB_SELECTSTRING, -1, (WPARAM)TranslateT(LANG_SMPTYPE_QUESTION)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_SMPTYPE_QUESTION)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_SMPTYPE_PASSWORD)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_SMPTYPE_FINGERPRINT)); + SendMessage(cmb, CB_SELECTSTRING, -1, (WPARAM)TranslateW(LANG_SMPTYPE_QUESTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE), TRUE); @@ -378,21 +378,21 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam DestroyWindow(hwndDlg); return FALSE; } - TCHAR buff[1024]; + wchar_t buff[1024]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateW(LANG_SMP_QUESTION)); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_SMP_ANSWER)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA); @@ -409,27 +409,27 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam { ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); MCONTACT hContact = (UINT_PTR)context->app_data; - TCHAR szMsg[1024]; + wchar_t szMsg[1024]; switch (LOWORD(wParam)) { case IDCANCEL: DestroyWindow(hwndDlg); break; case IDOK: GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, szMsg, _countof(szMsg)); - if (_tcsncmp(szMsg, TranslateT(LANG_SMPTYPE_QUESTION), _countof(szMsg)) == 0) { + if (wcsncmp(szMsg, TranslateW(LANG_SMPTYPE_QUESTION), _countof(szMsg)) == 0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { - mir_sntprintf(szMsg, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); + mir_sntprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); ShowError(szMsg); } else { int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0); - TCHAR *question = new TCHAR[len + 1]; + wchar_t *question = new wchar_t[len + 1]; GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, question, len + 1); T2Utf quest(question); delete[] question; len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0); - TCHAR *answer = new TCHAR[len + 1]; + wchar_t *answer = new wchar_t[len + 1]; GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1); T2Utf ans(answer); delete[] answer; @@ -439,14 +439,14 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam } } - else if (_tcsncmp(szMsg, TranslateT(LANG_SMPTYPE_PASSWORD), _countof(szMsg)) == 0) { + else if (wcsncmp(szMsg, TranslateW(LANG_SMPTYPE_PASSWORD), _countof(szMsg)) == 0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { - mir_sntprintf(szMsg, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); + mir_sntprintf(szMsg, TranslateW(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact)); ShowError(szMsg); } else { int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0); - TCHAR *answer = new TCHAR[len + 1]; + wchar_t *answer = new wchar_t[len + 1]; GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len + 1); T2Utf ans(answer); delete[] answer; @@ -485,34 +485,34 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam BOOL trusted = false; if (fp->trust && fp->trust[0] != '\0') trusted = true; - TCHAR buff[512]; + wchar_t buff[512]; GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255); - if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_QUESTION), 255) == 0) { + if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_QUESTION), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateW(LANG_SMP_QUESTION)); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_SMP_ANSWER)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA); ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE); } - else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_PASSWORD), 255) == 0) { + else if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_PASSWORD), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -522,18 +522,18 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, L""); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_PASSWORD)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_SMP_PASSWORD)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA); ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE); } - else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_FINGERPRINT), 255) == 0) { + else if (wcsncmp(buff, TranslateW(LANG_SMPTYPE_FINGERPRINT), 255) == 0) { if (trusted) - mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -546,12 +546,12 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam otrl_privkey_hash_to_humanT(buff, hash); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateW(LANG_YOUR_PRIVKEY)); otrl_privkey_hash_to_humanT(buff, fp->fingerprint); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_CONTACT_FINGERPRINT)); ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA); @@ -626,8 +626,8 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w EndDialog(hwndDlg, IDCANCEL); return FALSE; } - SetWindowText(hwndDlg, _T(LANG_OTR_FPVERIFY_TITLE)); - SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, _T(LANG_OTR_FPVERIFY_TITLE)); + SetWindowText(hwndDlg, LANG_OTR_FPVERIFY_TITLE); + SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, LANG_OTR_FPVERIFY_TITLE); TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); @@ -669,11 +669,11 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w EndDialog(hwndDlg, IDCANCEL); return FALSE; } - TCHAR buff[512]; + wchar_t buff[512]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFY_DESC), contact_get_nameT(hContact)); else - mir_sntprintf(buff, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT(hContact)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -686,12 +686,12 @@ static INT_PTR CALLBACK DlgBoxProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM w otrl_privkey_hash_to_humanT(buff, hash); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateW(LANG_YOUR_PRIVKEY)); otrl_privkey_hash_to_humanT(buff, fp->fingerprint); SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff); SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0); - SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT)); + SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateW(LANG_CONTACT_FINGERPRINT)); EnableWindow(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE), FALSE); @@ -728,14 +728,14 @@ static unsigned int CALLBACK verify_context_thread(void *param) if (param) { ConnContext *context = (ConnContext *)param; MCONTACT hContact = (UINT_PTR)context->app_data; - TCHAR msg[1024]; + wchar_t msg[1024]; switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgBoxProcVerifyContext, (LPARAM)param)) { case IDOK: case IDYES: lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, "verified"); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); - mir_sntprintf(msg, TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact)); + mir_sntprintf(msg, TranslateW(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); SetEncryptionStatus(hContact, otr_context_get_trust(context)); break; @@ -744,7 +744,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, NULL); otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename)); - mir_sntprintf(msg, TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); + mir_sntprintf(msg, TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); SetEncryptionStatus(hContact, otr_context_get_trust(context)); break; diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index 134c5d8114..d32244bdef 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -51,7 +51,7 @@ int ModulesLoaded(WPARAM, LPARAM) db_set_b(0, MODULENAME, "sim_warned", 1);
options.default_policy = OTRL_POLICY_MANUAL_MOD;
SaveOptions();
- MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TEXT), TranslateT(LANG_OTR_SECUREIM_TITLE), 0x30);
+ MessageBox(0, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
}
return 0;
}
diff --git a/plugins/MirOTR/src/language.h b/plugins/MirOTR/src/language.h index ab93acfa5a..b191f1ab30 100644 --- a/plugins/MirOTR/src/language.h +++ b/plugins/MirOTR/src/language.h @@ -5,39 +5,39 @@ #define LANG_START_OTR LPGEN("Start OTR") #define LANG_STOP_OTR LPGEN("Stop OTR") -#define LANG_YES LPGEN("Yes") -#define LANG_NO LPGEN("No") +#define LANG_YES LPGENW("Yes") +#define LANG_NO LPGENW("No") #define LANG_OTR_TOOLTIP LPGEN("OTR status (Click for more options)") -#define LANG_STATUS_DISABLED LPGEN("OTR Encryption: Disabled") -#define LANG_STATUS_UNVERIFIED LPGEN("OTR Encryption: UNVERIFIED") -#define LANG_STATUS_PRIVATE LPGEN("OTR Encryption: Private") -#define LANG_STATUS_FINISHED LPGEN("OTR Encryption: Finished") - -#define LANG_MENU_START LPGENT("&Start OTR session") -#define LANG_MENU_REFRESH LPGENT("&Refresh OTR session") -#define LANG_MENU_STOP LPGENT("Sto&p OTR session") -#define LANG_MENU_VERIFY LPGENT("&Verify Fingerprint") -#define LANG_MENU_TOGGLEHTML LPGENT("&Convert HTML (for Pidgin)") - -#define LANG_SESSION_TERMINATED_OTR LPGEN("OTR encrypted session with '%s' has been terminated") -#define LANG_SESSION_REQUEST_OTR LPGEN("Requesting OTR encrypted session with '%s'") -#define LANG_SESSION_START_OTR LPGEN("Beginning OTR encrypted session with '%s'") -#define LANG_SESSION_START_OTR_VERIFY LPGEN("Beginning OTR encrypted session with '%s' (NOT VERIFIED)") -#define LANG_SESSION_TRY_CONTINUE_OTR LPGEN("Trying to refresh OTR encrypted session with '%s'") -#define LANG_SESSION_HAS_CONTINUE_OTR LPGEN("OTR encrypted session was refreshed by '%s'") -#define LANG_SESSION_HAS_CONTINUE_OTR_VERIFY LPGEN("OTR encrypted session was refreshed by '%s' (NOT VERIFIED)") -#define LANG_SESSION_CONTINUE_OTR LPGEN("OTR encrypted session with '%s' successfully refreshed") -#define LANG_SESSION_CONTINUE_OTR_VERIFY LPGEN("OTR encrypted session with '%s' successfully refreshed (NOT VERIFIED)") -#define LANG_SESSION_TERMINATED_BY_OTR LPGEN("OTR encrypted session has been terminated by '%s'. You should do that, too!") -#define LANG_SESSION_NOT_STARTED_OTR LPGEN("OTR encrypted session with '%s' could not be started") - -#define LANG_ENCRYPTION_ERROR LPGEN("OTR could not encrypt when sending message") +#define LANG_STATUS_DISABLED LPGENW("OTR Encryption: Disabled") +#define LANG_STATUS_UNVERIFIED LPGENW("OTR Encryption: UNVERIFIED") +#define LANG_STATUS_PRIVATE LPGENW("OTR Encryption: Private") +#define LANG_STATUS_FINISHED LPGENW("OTR Encryption: Finished") + +#define LANG_MENU_START LPGENW("&Start OTR session") +#define LANG_MENU_REFRESH LPGENW("&Refresh OTR session") +#define LANG_MENU_STOP LPGENW("Sto&p OTR session") +#define LANG_MENU_VERIFY LPGENW("&Verify Fingerprint") +#define LANG_MENU_TOGGLEHTML LPGENW("&Convert HTML (for Pidgin)") + +#define LANG_SESSION_TERMINATED_OTR LPGENW("OTR encrypted session with '%s' has been terminated") +#define LANG_SESSION_REQUEST_OTR LPGENW("Requesting OTR encrypted session with '%s'") +#define LANG_SESSION_START_OTR LPGENW("Beginning OTR encrypted session with '%s'") +#define LANG_SESSION_START_OTR_VERIFY LPGENW("Beginning OTR encrypted session with '%s' (NOT VERIFIED)") +#define LANG_SESSION_TRY_CONTINUE_OTR LPGENW("Trying to refresh OTR encrypted session with '%s'") +#define LANG_SESSION_HAS_CONTINUE_OTR LPGENW("OTR encrypted session was refreshed by '%s'") +#define LANG_SESSION_HAS_CONTINUE_OTR_VERIFY LPGENW("OTR encrypted session was refreshed by '%s' (NOT VERIFIED)") +#define LANG_SESSION_CONTINUE_OTR LPGENW("OTR encrypted session with '%s' successfully refreshed") +#define LANG_SESSION_CONTINUE_OTR_VERIFY LPGENW("OTR encrypted session with '%s' successfully refreshed (NOT VERIFIED)") +#define LANG_SESSION_TERMINATED_BY_OTR LPGENW("OTR encrypted session has been terminated by '%s'. You should do that, too!") +#define LANG_SESSION_NOT_STARTED_OTR LPGENW("OTR encrypted session with '%s' could not be started") + +#define LANG_ENCRYPTION_ERROR LPGENW("OTR could not encrypt when sending message") #define LANG_OTR_INFO LPGEN("OTR Information") -#define LANG_FINGERPRINT_VERIFIED LPGEN("OTR encrypted session with '%s' is now using a VERIFIED fingerprint") -#define LANG_FINGERPRINT_NOT_VERIFIED LPGEN("OTR encrypted session with '%s' is now using a NOT VERIFIED fingerprint") +#define LANG_FINGERPRINT_VERIFIED LPGENW("OTR encrypted session with '%s' is now using a VERIFIED fingerprint") +#define LANG_FINGERPRINT_NOT_VERIFIED LPGENW("OTR encrypted session with '%s' is now using a NOT VERIFIED fingerprint") #define LANG_ICON_UNVERIFIED LPGEN("OTR unverified") #define LANG_ICON_FINISHED LPGEN("OTR finished") @@ -46,66 +46,66 @@ #define LANG_ICON_OTR LPGEN("OTR") #define LANG_ICON_REFRESH LPGEN("Refresh") -#define LANG_GENERATE_KEY LPGEN("Generating new private key for protocol '%s'.\nPlease Wait...") - -#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("Account") -#define LANG_POLICY LPGEN("Policy") -#define LANG_VERIFIED LPGEN("Verified") -#define LANG_ACTIVE LPGEN("Active") -#define LANG_FINGERPRINT LPGEN("Fingerprint") -#define LANG_HTMLCONV LPGEN("Conv. HTML") - -#define LANG_POLICY_DEFAULT LPGEN("Default") -#define LANG_POLICY_ALWAYS LPGEN("Always") -#define LANG_POLICY_OPP LPGEN("Opportunistic") -#define LANG_POLICY_MANUAL LPGEN("Manual") -#define LANG_POLICY_NEVER LPGEN("Never") - -#define LANG_OTR_ASK_NEWKEY LPGEN("Generating new key for '%s'. Continue?") -#define LANG_OTR_ASK_REMOVEKEY LPGEN("Removing key for '%s'. Continue?") - -#define LANG_OTR_FPVERIFY_TITLE LPGEN("OTR Fingerprint Verification") -#define LANG_OTR_FPVERIFY_DESC LPGEN("OTR encrypted session with '%s'.\nThe OTR fingerprint used by your contact is NOT VERIFIED.\nDo you trust it?") -#define LANG_OTR_FPVERIFIED_DESC LPGEN("OTR encrypted session with '%s'.\nThe OTR fingerprint used by your contact is already verified.\nDo you still trust it?") -#define LANG_YOUR_PRIVKEY LPGEN("Your Fingerprint to tell your contact (use a trusted channel!)") -#define LANG_CONTACT_FINGERPRINT LPGEN("VERIFY: Fingerprint from contact") - -#define LANG_SMP_VERIFY_TITLE LPGEN("OTR Authenticate: %s (%s)") -#define LANG_SMPTYPE_QUESTION LPGEN("Challenge Question") -#define LANG_SMPTYPE_PASSWORD LPGEN("Known Password") -#define LANG_SMPTYPE_FINGERPRINT LPGEN("Manual fingerprint comparison") -#define LANG_SMP_ANSWER LPGEN("Secret Answer") -#define LANG_SMP_QUESTION LPGEN("Question") -#define LANG_SMP_PASSWORD LPGEN("Password") - -#define LANG_SMP_SUCCESS LPGEN("Authentication successful.") -#define LANG_SMP_SUCCESS_VERIFY LPGEN("Your contact authenticated you successfully. You can send your own request to authenticate him.") -#define LANG_SMP_ERROR LPGEN("Error during authentication.") -#define LANG_SMP_FAILED LPGEN("Authentication failed") -#define LANG_SMP_IN_PROGRESS LPGEN("Authentication for '%s' is already in progress.") - -#define LANG_SMP_PROGRESS_TITLE LPGEN("OTR Authenticating: %s (%s)") -#define LANG_SMP_PROGRESS_DESC LPGEN("Authenticating contact:\n%s (%s)") - -#define LANG_OTR_SMPQUESTION_VERIFY_DESC LPGEN("OTR encrypted session with '%s' (UNVERIFIED).\nUse a question only your partner can answer.") -#define LANG_OTR_SMPQUESTION_VERIFIED_DESC LPGEN("OTR encrypted session with '%s' (VERIFIED).\nVerify the session again using a question only your partner can answer.") - -#define LANG_OTR_SMPPASSWORD_VERIFY_DESC LPGEN("OTR encrypted session with '%s' (UNVERIFIED).\nUse a known password.") -#define LANG_OTR_SMPPASSWORD_VERIFIED_DESC LPGEN("OTR encrypted session with '%s' (VERIFIED).\nVerify the session again using a known password.") - -#define LANG_OTR_SMPQUESTION_RESPOND_DESC LPGEN("Your contact '%s' wants to verify your identity with a question only you can answer.") - -#define LANG_OTR_SMPPASSWORD_RESPOND_DESC LPGEN("Your contact '%s' wants to verify your identity with a secret password you should know.") - -#define LANG_FINGERPRINT_STILL_IN_USE LPGEN("Fingerprint '%s' still in use in conversation with '%s' (%s). You cannot delete it!") -#define LANG_FINGERPRINT_NOT_DELETED LPGEN("Fingerprint '%s' in use in conversation with '%s' (%s). It could not be deleted!") - -#define LANG_OTR_SECUREIM_STARTED LPGEN("Cannot start OTR for '%s'. SecureIM is already running") -#define LANG_OTR_SECUREIM_TITLE LPGEN("OTR: SecureIM installed") -#define LANG_OTR_SECUREIM_TEXT LPGEN("You are using SecureIM. MirOTR will only work for contacts with SecureIM disabled") +#define LANG_GENERATE_KEY LPGENW("Generating new private key for protocol '%s'.\nPlease Wait...") + +#define LANG_OPT_GENERAL LPGENW("General") +#define LANG_OPT_PROTO LPGENW("Protocols") +#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") +#define LANG_VERIFIED LPGENW("Verified") +#define LANG_ACTIVE LPGENW("Active") +#define LANG_FINGERPRINT LPGENW("Fingerprint") +#define LANG_HTMLCONV LPGENW("Conv. HTML") + +#define LANG_POLICY_DEFAULT LPGENW("Default") +#define LANG_POLICY_ALWAYS LPGENW("Always") +#define LANG_POLICY_OPP LPGENW("Opportunistic") +#define LANG_POLICY_MANUAL LPGENW("Manual") +#define LANG_POLICY_NEVER LPGENW("Never") + +#define LANG_OTR_ASK_NEWKEY LPGENW("Generating new key for '%s'. Continue?") +#define LANG_OTR_ASK_REMOVEKEY LPGENW("Removing key for '%s'. Continue?") + +#define LANG_OTR_FPVERIFY_TITLE LPGENW("OTR Fingerprint Verification") +#define LANG_OTR_FPVERIFY_DESC LPGENW("OTR encrypted session with '%s'.\nThe OTR fingerprint used by your contact is NOT VERIFIED.\nDo you trust it?") +#define LANG_OTR_FPVERIFIED_DESC LPGENW("OTR encrypted session with '%s'.\nThe OTR fingerprint used by your contact is already verified.\nDo you still trust it?") +#define LANG_YOUR_PRIVKEY LPGENW("Your Fingerprint to tell your contact (use a trusted channel!)") +#define LANG_CONTACT_FINGERPRINT LPGENW("VERIFY: Fingerprint from contact") + +#define LANG_SMP_VERIFY_TITLE LPGENW("OTR Authenticate: %s (%s)") +#define LANG_SMPTYPE_QUESTION LPGENW("Challenge Question") +#define LANG_SMPTYPE_PASSWORD LPGENW("Known Password") +#define LANG_SMPTYPE_FINGERPRINT LPGENW("Manual fingerprint comparison") +#define LANG_SMP_ANSWER LPGENW("Secret Answer") +#define LANG_SMP_QUESTION LPGENW("Question") +#define LANG_SMP_PASSWORD LPGENW("Password") + +#define LANG_SMP_SUCCESS LPGENW("Authentication successful.") +#define LANG_SMP_SUCCESS_VERIFY LPGENW("Your contact authenticated you successfully. You can send your own request to authenticate him.") +#define LANG_SMP_ERROR LPGENW("Error during authentication.") +#define LANG_SMP_FAILED LPGENW("Authentication failed") +#define LANG_SMP_IN_PROGRESS LPGENW("Authentication for '%s' is already in progress.") + +#define LANG_SMP_PROGRESS_TITLE LPGENW("OTR Authenticating: %s (%s)") +#define LANG_SMP_PROGRESS_DESC LPGENW("Authenticating contact:\n%s (%s)") + +#define LANG_OTR_SMPQUESTION_VERIFY_DESC LPGENW("OTR encrypted session with '%s' (UNVERIFIED).\nUse a question only your partner can answer.") +#define LANG_OTR_SMPQUESTION_VERIFIED_DESC LPGENW("OTR encrypted session with '%s' (VERIFIED).\nVerify the session again using a question only your partner can answer.") + +#define LANG_OTR_SMPPASSWORD_VERIFY_DESC LPGENW("OTR encrypted session with '%s' (UNVERIFIED).\nUse a known password.") +#define LANG_OTR_SMPPASSWORD_VERIFIED_DESC LPGENW("OTR encrypted session with '%s' (VERIFIED).\nVerify the session again using a known password.") + +#define LANG_OTR_SMPQUESTION_RESPOND_DESC LPGENW("Your contact '%s' wants to verify your identity with a question only you can answer.") + +#define LANG_OTR_SMPPASSWORD_RESPOND_DESC LPGENW("Your contact '%s' wants to verify your identity with a secret password you should know.") + +#define LANG_FINGERPRINT_STILL_IN_USE LPGENW("Fingerprint '%s' still in use in conversation with '%s' (%s). You cannot delete it!") +#define LANG_FINGERPRINT_NOT_DELETED LPGENW("Fingerprint '%s' in use in conversation with '%s' (%s). It could not be deleted!") + +#define LANG_OTR_SECUREIM_STARTED LPGENW("Cannot start OTR for '%s'. SecureIM is already running") +#define LANG_OTR_SECUREIM_TITLE LPGENW("OTR: SecureIM installed") +#define LANG_OTR_SECUREIM_TEXT LPGENW("You are using SecureIM. MirOTR will only work for contacts with SecureIM disabled") diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index e4c214f823..23e7ecf35c 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -64,25 +64,25 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) if (mi.flags & CMIF_NOTNOTPRIVATE && level == TRUST_NOT_PRIVATE) return FALSE; if (pcpp->MenuItemHandle == hStatusInfoItem) { - TCHAR text[128]; + wchar_t text[128]; switch (level) { case TRUST_PRIVATE: - mir_sntprintf(text, L"%s [v%i]", TranslateT(LANG_STATUS_PRIVATE), context->protocol_version); + mir_sntprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_PRIVATE), context->protocol_version); Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_PRIVATE)); break; case TRUST_UNVERIFIED: - mir_sntprintf(text, L"%s [v%i]", TranslateT(LANG_STATUS_UNVERIFIED), context->protocol_version); + mir_sntprintf(text, L"%s [v%i]", TranslateW(LANG_STATUS_UNVERIFIED), context->protocol_version); Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; case TRUST_FINISHED: - Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_FINISHED), IcoLib_GetIconHandle(ICON_UNVERIFIED)); + Menu_ModifyItem(hStatusInfoItem, TranslateW(LANG_STATUS_FINISHED), IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; default: - Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_DISABLED), IcoLib_GetIconHandle(ICON_NOT_PRIVATE)); + Menu_ModifyItem(hStatusInfoItem, TranslateW(LANG_STATUS_DISABLED), IcoLib_GetIconHandle(ICON_NOT_PRIVATE)); } } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) @@ -168,36 +168,36 @@ void InitMirOTRMenu(void) // menu items CMenuItem mi; mi.flags = CMIF_DISABLED | CMIF_TCHAR; - mi.name.t = LPGENT("OTR Status"); + mi.name.w = LPGENW("OTR Status"); mi.position = 0; hStatusInfoItem = AddMirOTRMenuItem(&mi, NULL); mi.flags = CMIF_TCHAR | CMIF_NOTPRIVATE | CMIF_NOTUNVERIFIED; - mi.name.t = LANG_MENU_START; + mi.name.w = LANG_MENU_START; mi.position = 100001; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_UNVERIFIED); AddMirOTRMenuItem(&mi, MS_OTR_MENUSTART); mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE | CMIF_NOTFINISHED; - mi.name.t = LANG_MENU_REFRESH; + mi.name.w = LANG_MENU_REFRESH; mi.position = 100002; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_FINISHED); AddMirOTRMenuItem(&mi, MS_OTR_MENUREFRESH); mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE; - mi.name.t = LANG_MENU_STOP; + mi.name.w = LANG_MENU_STOP; mi.position = 100003; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); AddMirOTRMenuItem(&mi, MS_OTR_MENUSTOP); mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE | CMIF_NOTFINISHED; - mi.name.t = LANG_MENU_VERIFY; + mi.name.w = LANG_MENU_VERIFY; mi.position = 200001; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_PRIVATE); AddMirOTRMenuItem(&mi, MS_OTR_MENUVERIFY); mi.flags = CMIF_TCHAR | CMIF_CHECKED; - mi.name.t = LANG_MENU_TOGGLEHTML; + mi.name.w = LANG_MENU_TOGGLEHTML; mi.position = 300001; mi.hIcolibItem = 0; hHTMLConvMenuItem = AddMirOTRMenuItem(&mi, MS_OTR_MENUTOGGLEHTML); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 6743a71079..246dbf71e9 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -3,19 +3,19 @@ extern "C"{ #include "otrlextensions.h" } -TCHAR g_private_key_filename[MAX_PATH]; -TCHAR g_fingerprint_store_filename[MAX_PATH]; -TCHAR g_instag_filename[MAX_PATH]; +wchar_t g_private_key_filename[MAX_PATH]; +wchar_t g_fingerprint_store_filename[MAX_PATH]; +wchar_t g_instag_filename[MAX_PATH]; HANDLE hPATH_MIROTR; Options options; #define DATA_DIRECTORY MIRANDA_USERDATAT L"\\" _T(MODULENAME) struct PROTOREGENKEYOPTIONS { HWND refresh; - TCHAR proto[129]; + wchar_t proto[129]; }; -void SetFilenames(const TCHAR *path) +void SetFilenames(const wchar_t *path) { if (!path || !path[0]) return; @@ -28,7 +28,7 @@ void SetFilenames(const TCHAR *path) int FoldersChanged(WPARAM, LPARAM) { - TCHAR path[MAX_PATH]; + wchar_t path[MAX_PATH]; if ( FoldersGetCustomPathT(hPATH_MIROTR, path, _countof(path), L"")) SetFilenames( VARST(DATA_DIRECTORY)); else @@ -130,7 +130,7 @@ void ReadPrivkeyFiles() static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bInit = true; - TCHAR *prefix; + wchar_t *prefix; switch ( msg ) { case WM_INITDIALOG: bInit = false; @@ -214,7 +214,7 @@ static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, options.end_offline = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_ENDOFFLINE)); options.end_window_close = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_ENDCLOSE)); - prefix = (TCHAR*)_alloca(sizeof(TCHAR)*OPTIONS_PREFIXLEN); + prefix = (wchar_t*)_alloca(sizeof(wchar_t)*OPTIONS_PREFIXLEN); GetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix, OPTIONS_PREFIXLEN); T2Utf prefix_utf(prefix); @@ -236,9 +236,9 @@ static unsigned int CALLBACK regen_key_thread(void* param) { Thread_Push(0); PROTOREGENKEYOPTIONS *opts = (PROTOREGENKEYOPTIONS *)param; - TCHAR buff[512]; + wchar_t buff[512]; - mir_sntprintf(buff, TranslateT(LANG_OTR_ASK_NEWKEY), opts->proto); + mir_sntprintf(buff, TranslateW(LANG_OTR_ASK_NEWKEY), opts->proto); EnableWindow(opts->refresh, FALSE); if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) { char* proto = mir_t2a(opts->proto); @@ -270,11 +270,11 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP TranslateDialogDefault(hwndDlg); { HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_ALWAYS)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_OPP)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_MANUAL)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_NEVER)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_DEFAULT)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_ALWAYS)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_OPP)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_MANUAL)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_NEVER)); 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); @@ -292,17 +292,17 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP lvc.fmt = LVCFMT_LEFT; lvc.iSubItem = 0; - lvc.pszText = TranslateT(LANG_PROTO); + lvc.pszText = TranslateW(LANG_PROTO); lvc.cx = 85; // width of column in pixels ListView_InsertColumn(lv, 0, &lvc); lvc.iSubItem = 1; - lvc.pszText = TranslateT(LANG_POLICY); + lvc.pszText = TranslateW(LANG_POLICY); lvc.cx = 80; // width of column in pixels ListView_InsertColumn(lv, 1, &lvc); lvc.iSubItem = 2; - lvc.pszText = TranslateT(LANG_FINGERPRINT); + lvc.pszText = TranslateW(LANG_FINGERPRINT); lvc.cx = 275; // width of column in pixels ListView_InsertColumn(lv, 2, &lvc); } @@ -328,11 +328,11 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP 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))); + ListView_SetItemText(lv, ilvItem, 1, (wchar_t*)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); + wchar_t *temp = mir_a2t(fprint); ListView_SetItemText(lv, ilvItem, 2, temp); mir_free(temp); } @@ -357,10 +357,10 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP case IDC_BTN_PROTO_FORGET: sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS)); if (sel != -1) { - TCHAR buff_proto[128]; + wchar_t buff_proto[128]; ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, _countof(buff_proto)); - TCHAR buff[512]; - mir_sntprintf(buff, TranslateT(LANG_OTR_ASK_REMOVEKEY), buff_proto); + wchar_t buff[512]; + mir_sntprintf(buff, TranslateW(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) @@ -386,7 +386,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP 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]; + wchar_t *text = new wchar_t[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; @@ -412,14 +412,14 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_NEWKEY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), TRUE); - TCHAR buff[50]; + wchar_t buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 1, buff, _countof(buff)); SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff); } } else if (((LPNMHDR)lParam)->code == PSN_APPLY) { int cnt = ListView_GetItemCount(lv); - TCHAR policy[64]; + wchar_t policy[64]; for (int i = 0; i < cnt; ++i) { char *proto = GetProtoName(lv, i); if (proto == NULL) @@ -447,11 +447,11 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new ContactPolicyMap()); HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_ALWAYS)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_OPP)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_MANUAL)); - SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_NEVER)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_DEFAULT)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_ALWAYS)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_OPP)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(LANG_POLICY_MANUAL)); + SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateW(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); @@ -465,22 +465,22 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM lvc.fmt = LVCFMT_LEFT; lvc.iSubItem = 0; - lvc.pszText = TranslateT(LANG_CONTACT); + lvc.pszText = TranslateW(LANG_CONTACT); lvc.cx = 150; // width of column in pixels ListView_InsertColumn(lv, 0, &lvc); lvc.iSubItem = 1; - lvc.pszText = TranslateT(LANG_PROTO); + lvc.pszText = TranslateW(LANG_PROTO); lvc.cx = 100; // width of column in pixels ListView_InsertColumn(lv, 1, &lvc); lvc.iSubItem = 2; - lvc.pszText = TranslateT(LANG_POLICY); + lvc.pszText = TranslateW(LANG_POLICY); lvc.cx = 90; // width of column in pixels ListView_InsertColumn(lv, 2, &lvc); lvc.iSubItem = 3; - lvc.pszText = TranslateT(LANG_HTMLCONV); + lvc.pszText = TranslateW(LANG_HTMLCONV); lvc.cx = 80; // width of column in pixels ListView_InsertColumn(lv, 3, &lvc); } @@ -505,14 +505,14 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM lvI.iItem = 0; lvI.iSubItem = 0; lvI.lParam = hContact; - lvI.pszText = (TCHAR*)contact_get_nameT(hContact); + lvI.pszText = (wchar_t*)contact_get_nameT(hContact); lvI.iItem = ListView_InsertItem(lv, &lvI); PROTOACCOUNT *pa = Proto_GetAccount(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, (wchar_t*)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)) ? TranslateW(LANG_YES) : TranslateW(LANG_NO)); } } } @@ -529,7 +529,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM 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]; + wchar_t *text = new wchar_t[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); @@ -574,7 +574,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM } else { EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), TRUE); - TCHAR buff[50]; + wchar_t buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 2, buff, _countof(buff)); SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff); } @@ -590,15 +590,15 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM MCONTACT hContact = (MCONTACT)lvi.lParam; ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - TCHAR buff[50]; + wchar_t buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, _countof(buff)); - if (_tcsncmp(buff, TranslateT(LANG_YES), 50) == 0) { + if (wcsncmp(buff, TranslateW(LANG_YES), 50) == 0) { (*cp)[hContact].htmlconv = HTMLCONV_DISABLE; - ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_NO)); + ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateW(LANG_NO)); } else { (*cp)[hContact].htmlconv = HTMLCONV_ENABLE; - ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_YES)); + ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateW(LANG_YES)); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } @@ -635,27 +635,27 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w lvc.fmt = LVCFMT_LEFT; lvc.iSubItem = 0; - lvc.pszText = TranslateT(LANG_CONTACT); + lvc.pszText = TranslateW(LANG_CONTACT); lvc.cx = 100; // width of column in pixels ListView_InsertColumn(lv, 0, &lvc); lvc.iSubItem = 1; - lvc.pszText = TranslateT(LANG_PROTO); + lvc.pszText = TranslateW(LANG_PROTO); lvc.cx = 90; // width of column in pixels ListView_InsertColumn(lv, 1, &lvc); lvc.iSubItem = 2; - lvc.pszText = TranslateT(LANG_ACTIVE); + lvc.pszText = TranslateW(LANG_ACTIVE); lvc.cx = 50; // width of column in pixels ListView_InsertColumn(lv, 2, &lvc); lvc.iSubItem = 3; - lvc.pszText = TranslateT(LANG_VERIFIED); + lvc.pszText = TranslateW(LANG_VERIFIED); lvc.cx = 50; // width of column in pixels ListView_InsertColumn(lv, 3, &lvc); lvc.iSubItem = 4; - lvc.pszText = TranslateT(LANG_FINGERPRINT); + lvc.pszText = TranslateW(LANG_FINGERPRINT); lvc.cx = 300; // width of column in pixels ListView_InsertColumn(lv, 4, &lvc); } @@ -673,10 +673,10 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w // items. lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE; - TCHAR *user, hash[45] = { 0 }; + wchar_t *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((UINT_PTR)context->app_data); + user = (wchar_t*)contact_get_nameT((UINT_PTR)context->app_data); if (user) { PROTOACCOUNT *pa = Proto_GetAccount(context->protocol); @@ -688,8 +688,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w 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, 2, (context->active_fingerprint == fp) ? TranslateW(LANG_YES) : TranslateW(LANG_NO)); + ListView_SetItemText(lv, d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateW(LANG_YES) : TranslateW(LANG_NO)); ListView_SetItemText(lv, d, 4, hash); } } @@ -713,7 +713,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w 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)); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateW(LANG_NO)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; @@ -727,7 +727,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w 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)); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateW(LANG_YES)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; @@ -742,10 +742,10 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w Fingerprint *fp = (Fingerprint*)lvi.lParam; if (fp->context->active_fingerprint == fp) { MCONTACT hContact = (UINT_PTR)fp->context->app_data; - TCHAR buff[1024], hash[45]; + wchar_t buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, fp->fingerprint); PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); + mir_sntprintf(buff, TranslateW(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName); ShowError(buff); } else { @@ -772,10 +772,10 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w case FPM_DELETE: if (it->first->context->active_fingerprint == it->first) { MCONTACT hContact = (UINT_PTR)it->first->context->app_data; - TCHAR buff[1024], hash[45]; + wchar_t buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, it->first->fingerprint); PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact)); - mir_sntprintf(buff, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); + mir_sntprintf(buff, TranslateW(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName); ShowError(buff); } else otrl_context_forget_fingerprint(it->first, 1); @@ -820,26 +820,26 @@ static int OpenOptions(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100; odp.hInstance = hInst; - odp.ptszGroup = LPGENT("Services"); - odp.ptszTitle = L"OTR"; + odp.pwszGroup = LPGENW("Services"); + odp.pwszTitle = L"OTR"; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszTab = LANG_OPT_GENERAL; + odp.pwszTab = LANG_OPT_GENERAL; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENERAL); odp.pfnDlgProc = DlgProcMirOTROpts; Options_AddPage(wParam, &odp); - odp.ptszTab = LANG_OPT_PROTO; + odp.pwszTab = LANG_OPT_PROTO; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTO); odp.pfnDlgProc = DlgProcMirOTROptsProto; Options_AddPage(wParam, &odp); - odp.ptszTab = LANG_OPT_CONTACTS; + odp.pwszTab = LANG_OPT_CONTACTS; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACTS); odp.pfnDlgProc = DlgProcMirOTROptsContacts; Options_AddPage(wParam, &odp); - odp.ptszTab = LANG_OPT_FINGER; + odp.pwszTab = LANG_OPT_FINGER; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FINGER); odp.pfnDlgProc = DlgProcMirOTROptsFinger; Options_AddPage(wParam, &odp); diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index d7f46344ea..1aca058985 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -5,9 +5,9 @@ #define FINGERPRINT_STORE_FILENAME "otr.fingerprints" #define INSTAG_FILENAME "otr.instag" -extern TCHAR g_fingerprint_store_filename[MAX_PATH]; -extern TCHAR g_private_key_filename[MAX_PATH]; -extern TCHAR g_instag_filename[MAX_PATH]; +extern wchar_t g_fingerprint_store_filename[MAX_PATH]; +extern wchar_t g_private_key_filename[MAX_PATH]; +extern wchar_t g_instag_filename[MAX_PATH]; #define CONTACT_DEFAULT_POLICY 0xFFFF diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index 8f2c9f0bb8..da2af8a178 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -56,9 +56,9 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM, LPARAM lParam) } TranslateDialogDefault(hWndDlg); SetClassLongPtr(hWndDlg, GCLP_HICON, (LONG_PTR)IcoLib_GetIcon(ICON_OTR, 1)); - TCHAR buff[256]; - TCHAR *proto = mir_a2t((char*)lParam); - mir_sntprintf(buff, TranslateT(LANG_GENERATE_KEY), proto); + wchar_t buff[256]; + wchar_t *proto = mir_a2t((char*)lParam); + mir_sntprintf(buff, TranslateW(LANG_GENERATE_KEY), proto); mir_free(proto); SetDlgItemText(hWndDlg, IDC_GENERATE, buff); GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData)); @@ -175,20 +175,20 @@ extern "C" { MCONTACT hContact = (UINT_PTR)opdata; TrustLevel trusted = otr_context_get_trust(context); SetEncryptionStatus(hContact, trusted); - TCHAR buff[512]; + wchar_t buff[512]; if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateT(LANG_SESSION_START_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_START_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, TranslateT(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } if (context->protocol_version < MIROTR_PROTO_LATEST){ size_t remaining = mir_tstrlen(buff); - TCHAR *offset = buff + remaining; + wchar_t *offset = buff + remaining; remaining = _countof(buff) - remaining; mir_sntprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version); } @@ -200,8 +200,8 @@ extern "C" { void otr_gui_gone_insecure(void *opdata, ConnContext *context) { MCONTACT hContact = (UINT_PTR)opdata; DEBUGOUTA("OTR_GUI_GONE_INSECURE\n"); - TCHAR buff[512]; - mir_sntprintf(buff, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact)); + wchar_t buff[512]; + mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); if (!Miranda_Terminated()) { ShowMessage(hContact, buff); @@ -218,30 +218,30 @@ extern "C" { DEBUGOUTA("OTR_GUI_STILL_SECURE\n"); TrustLevel trusted = otr_context_get_trust(context); SetEncryptionStatus(hContact, trusted); - TCHAR buff[1024]; + wchar_t buff[1024]; if (!is_reply) { if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateT(LANG_SESSION_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, TranslateT(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } // opdata is hContact ShowMessage(hContact, buff); } else { if (trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT(hContact)); } else if (trusted == TRUST_UNVERIFIED) { - mir_sntprintf(buff, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT(hContact)); } else { // should never happen - mir_sntprintf(buff, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT(hContact)); } } @@ -313,12 +313,12 @@ extern "C" { void handle_msg_event(void *opdata, OtrlMessageEvent msg_event, ConnContext *, const char *message, gcry_error_t err) { DEBUGOUTA("HANDLE_MSG_EVENT\n"); MCONTACT hContact = (UINT_PTR)opdata; - const TCHAR* contact = contact_get_nameT(hContact); + const wchar_t* contact = contact_get_nameT(hContact); - typedef void(*msgfunc_t)(const MCONTACT, const TCHAR*); + typedef void(*msgfunc_t)(const MCONTACT, const wchar_t*); msgfunc_t msgfunc = ShowMessage; - // TCHAR* title = NULL; - TCHAR msg[512]; + // wchar_t* title = NULL; + wchar_t msg[512]; msg[0] = '\0'; switch (msg_event){ case OTRL_MSGEVENT_NONE: @@ -346,7 +346,7 @@ extern "C" { mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received")); break; default:{ - TCHAR* tmp = mir_utf8decodeT(gcry_strerror(err)); + wchar_t* tmp = mir_utf8decodeT(gcry_strerror(err)); mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), tmp); mir_free(tmp); } } @@ -373,14 +373,14 @@ extern "C" { break; case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:{ // title = TranslateT("OTR Error"); - TCHAR* tmp = mir_utf8decodeT(message); + wchar_t* tmp = mir_utf8decodeT(message); mir_tstrncpy(msg, tmp, _countof(msg)); mir_free(tmp); break; } case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:{ // title = TranslateT("Received unencrypted message"); msgfunc = ShowMessageInline; - TCHAR* tmp = mir_utf8decodeT(message); + wchar_t* tmp = mir_utf8decodeT(message); mir_snwprintf(msg, _countof(msg), TranslateT("The following message received from '%s' was NOT encrypted:\n\n%s"), contact, tmp); mir_free(tmp); ProtoChainSend(hContact, PSS_MESSAGE, PREF_BYPASS_OTR, (LPARAM)message); @@ -400,7 +400,7 @@ extern "C" { //void otr_create_instag(void *opdata, const char *accountname, const char *protocol) { void otr_create_instag(void *, const char *accountname, const char *protocol){ DEBUGOUTA("OTR_CREATE_INSTAG\n"); - FILE* instagf = _tfopen(g_instag_filename, L"w+b"); + FILE* instagf = _wfopen(g_instag_filename, L"w+b"); if (!instagf) return; otrl_instag_generate_FILEp(otr_user_state, instagf, accountname, protocol); diff --git a/plugins/MirOTR/src/otr.h b/plugins/MirOTR/src/otr.h index efa67f4aed..7746f2dd79 100644 --- a/plugins/MirOTR/src/otr.h +++ b/plugins/MirOTR/src/otr.h @@ -8,7 +8,7 @@ extern OtrlMessageAppOps ops; #define MIROTR_PROTO_HELLO "?OTRv23?" /* OTR link normally is https://otr.cypherpunks.ca/ but it's blocked by ICQ as of March 2015 (even something like "ot-r.cyp her_ pun ks. ca") It might be a good idea to use http://wikipedia.org/wiki/Off-the-Record_Messaging instead as it's not yet blocked by ICQ but might still help users to find a client/plugin */ -#define MIROTR_PROTO_HELLO_MSG LPGENT(" has requested an Off-the-Record private conversation. However, you do not have a plugin to support that.\nSee http://wikipedia.org/wiki/Off-the-Record_Messaging for more information.") +#define MIROTR_PROTO_HELLO_MSG LPGENW(" has requested an Off-the-Record private conversation. However, you do not have a plugin to support that.\nSee http://wikipedia.org/wiki/Off-the-Record_Messaging for more information.") extern "C" { diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 15a139bef8..e21c05c762 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -19,22 +19,22 @@ int StartOTR(MCONTACT hContact) { otr_gui_inject_message((void*)hContact, proto, proto, uname, msg ? msg : MIROTR_PROTO_HELLO); free(msg); #else - TCHAR* nick=ProtoGetNickname(proto); + wchar_t* nick=ProtoGetNickname(proto); if(nick){ - TCHAR msg[1024]; - TCHAR* msgend = msg+_countof(msg)-1; - TCHAR* msgoff = msg; + wchar_t msg[1024]; + wchar_t* msgend = msg+_countof(msg)-1; + wchar_t* msgoff = msg; for(const char* c=MIROTR_PROTO_HELLO; *c; *msgoff++=*c++); *msgoff++ = '\n'; - for(const TCHAR* c=nick; *c && msgoff<msgend; *msgoff++=*c++); - for(const TCHAR* c=MIROTR_PROTO_HELLO_MSG; *c && msgoff<msgend; *msgoff++=*c++); + for(const wchar_t* c=nick; *c && msgoff<msgend; *msgoff++=*c++); + for(const wchar_t* c=MIROTR_PROTO_HELLO_MSG; *c && msgoff<msgend; *msgoff++=*c++); LCID langid = Langpack_GetDefaultLocale(); if(langid != 0x0409/*US*/ && langid != 0x1009/*CA*/ && langid != 0x0809/*GB*/){ // non english - const TCHAR* translated=TranslateTS(MIROTR_PROTO_HELLO_MSG); + const wchar_t* translated=TranslateTS(MIROTR_PROTO_HELLO_MSG); if(mir_tstrcmp(MIROTR_PROTO_HELLO_MSG,translated)){ *msgoff++ = '\n'; - for(const TCHAR* c=nick; *c && msgoff<msgend; *msgoff++=*c++); - for(const TCHAR* c=translated; *c && msgoff<msgend; *msgoff++=*c++); + for(const wchar_t* c=nick; *c && msgoff<msgend; *msgoff++=*c++); + for(const wchar_t* c=translated; *c && msgoff<msgend; *msgoff++=*c++); } } *msgoff='\0'; @@ -50,19 +50,19 @@ int StartOTR(MCONTACT hContact) { INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM) { - TCHAR buff[512]; + wchar_t buff[512]; MCONTACT hSub = db_mc_getMostOnline(hContact); if(hSub != 0) hContact = hSub; if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) { - mir_sntprintf(buff, TranslateT(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); ShowError(buff); return 0; } - mir_sntprintf(buff, TranslateT(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); return StartOTR(hContact); @@ -70,19 +70,19 @@ INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM) INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM) { - TCHAR buff[512]; + wchar_t buff[512]; MCONTACT hSub = db_mc_getMostOnline(hContact); if(hSub != 0) hContact = hSub; if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) { - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); + mir_sntprintf(buff, 512, TranslateW(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact)); ShowError(buff); return 0; } - mir_sntprintf(buff, TranslateT(LANG_SESSION_TRY_CONTINUE_OTR), contact_get_nameT(hContact)); + mir_sntprintf(buff, TranslateW(LANG_SESSION_TRY_CONTINUE_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); int res = StartOTR(hContact); @@ -115,8 +115,8 @@ INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM) SetEncryptionStatus(hContact, TRUST_NOT_PRIVATE); - TCHAR buff[512]; - mir_sntprintf(buff, TranslateT(LANG_SESSION_TERMINATED_OTR), contact_get_nameT(hContact)); + wchar_t buff[512]; + mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); return 0; } @@ -163,13 +163,13 @@ void InitMenu() mi.position = -400000; SET_UID(mi, 0xAB574FAD, 0x15D8, 0x49FF, 0xB7, 0x03, 0xDA, 0x2B, 0x45, 0x46, 0xC3, 0x56); - mi.name.t = _T(LANG_STOP_OTR); + mi.name.w = _T(LANG_STOP_OTR); mi.pszService = MS_OTR_MENUSTOP; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_PRIVATE); hStopItem = Menu_AddContactMenuItem(&mi); mi.uid.d[7]++; - mi.name.t = _T(LANG_START_OTR); + mi.name.w = _T(LANG_START_OTR); mi.pszService = MS_OTR_MENUSTART; mi.hIcolibItem = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); hStartItem = Menu_AddContactMenuItem(&mi); diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 9aa72920d9..375484f775 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -45,7 +45,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ if (err) { /* Be *sure* not to send out plaintext */ DEBUGOUTA("otrl_message_sending err"); - ShowError(TranslateT(LANG_ENCRYPTION_ERROR)); + ShowError(TranslateW(LANG_ENCRYPTION_ERROR)); otrl_message_free(newmessage); return 1; } @@ -110,8 +110,8 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED); if (tlv && !Miranda_Terminated()) { /* Notify the user that the other side disconnected. */ - TCHAR buff[256]; - mir_sntprintf(buff, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); + wchar_t buff[256]; + mir_sntprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); SetEncryptionStatus(ccs->hContact, otr_context_get_trust(context)); // required since libotr 4!? ShowMessage(ccs->hContact, buff); } diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index 51ebb6145d..025b968610 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -40,22 +40,22 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) switch (level) { case TRUST_FINISHED: sid.flags = 0; - button.ptszTooltip = TranslateT(LANG_STATUS_FINISHED); + button.ptszTooltip = TranslateW(LANG_STATUS_FINISHED); button.hIcon = IcoLib_GetIconHandle(ICON_FINISHED); break; case TRUST_UNVERIFIED: sid2.flags = MBF_DISABLED; - button.ptszTooltip = TranslateT(LANG_STATUS_UNVERIFIED); + button.ptszTooltip = TranslateW(LANG_STATUS_UNVERIFIED); button.hIcon = IcoLib_GetIconHandle(ICON_UNVERIFIED); break; case TRUST_PRIVATE: sid2.flags = 0; - button.ptszTooltip = TranslateT(LANG_STATUS_PRIVATE); + button.ptszTooltip = TranslateW(LANG_STATUS_PRIVATE); button.hIcon = IcoLib_GetIconHandle(ICON_PRIVATE); break; default: sid.flags = MBF_DISABLED; - button.ptszTooltip = TranslateT(LANG_STATUS_DISABLED); + button.ptszTooltip = TranslateW(LANG_STATUS_DISABLED); button.hIcon = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); break; } diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 0fc9e6a450..f7471b9c98 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -66,22 +66,22 @@ void VerifyFingerprint(ConnContext *context, bool verify) { void VerifyFingerprintMessage(ConnContext *context, bool verify) { MCONTACT hContact = (UINT_PTR)context->app_data; - TCHAR msg[1024]; - mir_sntprintf(msg, (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); + wchar_t msg[1024]; + mir_snwprintf(msg, (verify) ? TranslateW(LANG_FINGERPRINT_VERIFIED) : TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact)); ShowMessage(hContact, msg); SetEncryptionStatus(hContact, otr_context_get_trust(context)); } /* Convert a 20-byte hash value to a 45-byte human-readable value */ -void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20]) +void otrl_privkey_hash_to_humanT(wchar_t human[45], const unsigned char hash[20]) { int word, byte; - TCHAR *p = human; + wchar_t *p = human; for(word=0; word<5; ++word) { for(byte=0; byte<4; ++byte) { - _stprintf(p, L"%02X", hash[word*4+byte]); //!!!!!!!!!!!!!! + swprintf(p, L"%02X", hash[word*4+byte]); //!!!!!!!!!!!!!! p += 2; } *(p++) = ' '; @@ -100,26 +100,26 @@ char* contact_get_id(MCONTACT hContact, bool bNameOnError) return mir_t2a(pszUniqueID); } -__inline const TCHAR* contact_get_nameT(MCONTACT hContact) { +__inline const wchar_t* contact_get_nameT(MCONTACT hContact) { return pcli->pfnGetContactDisplayName(hContact, 0); } -TCHAR* ProtoGetNickname(const char* proto) +wchar_t* ProtoGetNickname(const char* proto) { - TCHAR *p = Contact_GetInfo(CNF_NICK, NULL, proto); + wchar_t *p = Contact_GetInfo(CNF_NICK, NULL, proto); return (p != NULL) ? p : mir_tstrdup(L""); } -void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTACT hContact) { +void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { if(CallService(MS_SYSTEM_TERMINATED, 0, 0)) return; if ( !options.bHavePopups) { - TCHAR title[256]; + wchar_t title[256]; mir_sntprintf(title, L"%s Message", _T(MODULENAME)); if(line1 && line2) { int size = int(mir_tstrlen(line1) + mir_tstrlen(line2) + 3); - TCHAR *message = new TCHAR[size]; // newline and null terminator + wchar_t *message = new wchar_t[size]; // newline and null terminator mir_sntprintf(message, size, L"%s\r\n%s", line1, line2); MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); delete[] message; @@ -138,12 +138,12 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTA ppd.lchIcon = NULL; if(line1 && line2) { - _tcsncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); - _tcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); + wcsncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); + wcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); } else if(line1) - _tcsncpy( ppd.lptzText, line1, MAX_SECONDLINE-1 ); + wcsncpy( ppd.lptzText, line1, MAX_SECONDLINE-1 ); else if(line2) - _tcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); + wcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); ppd.iSeconds = timeout; @@ -154,8 +154,8 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTA } -void ShowWarning(TCHAR *msg) { - TCHAR buffer[512]; +void ShowWarning(wchar_t *msg) { + wchar_t buffer[512]; ErrorDisplay disp = options.err_method; // funny logic :) ... try to avoid message boxes // if want baloons but no balloons, try popups @@ -172,7 +172,7 @@ void ShowWarning(TCHAR *msg) { case ED_POP: { int size = int(mir_tstrlen(msg) + 515); - TCHAR *message = new TCHAR[size]; // newline and null terminator + wchar_t *message = new wchar_t[size]; // newline and null terminator mir_sntprintf(message, size, L"%s\r\n%s", buffer, msg); PUShowMessageT(message, SM_WARNING); delete[] message; @@ -200,8 +200,8 @@ void ShowWarning(TCHAR *msg) { } } -void ShowError(TCHAR *msg) { - TCHAR buffer[512]; +void ShowError(wchar_t *msg) { + wchar_t buffer[512]; ErrorDisplay disp = options.err_method; // funny logic :) ... try to avoid message boxes // if want baloons but no balloons, try popups @@ -214,12 +214,12 @@ void ShowError(TCHAR *msg) { mir_sntprintf(buffer, L"%s Error", _T(MODULENAME)); - TCHAR *message; + wchar_t *message; switch(disp) { case ED_POP: { int size = int(mir_tstrlen(msg) + 515); - message = new TCHAR[size]; // newline and null terminator + message = new wchar_t[size]; // newline and null terminator mir_sntprintf(message, size, L"%s\r\n%s", buffer, msg); PUShowMessageT(message, SM_WARNING); delete[] message; @@ -249,26 +249,26 @@ void ShowError(TCHAR *msg) { void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { - TCHAR* l1 = (line1) ? mir_utf8decodeT(line1) : NULL; - TCHAR* l2 = (line2) ? mir_utf8decodeT(line2) : NULL; + wchar_t* l1 = (line1) ? mir_utf8decodeT(line1) : NULL; + wchar_t* l2 = (line2) ? mir_utf8decodeT(line2) : NULL; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); } void ShowWarningUtf(char* msg) { - TCHAR* m = (msg) ? mir_utf8decodeT(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeT(msg) : NULL; ShowWarning(m); if (m) mir_free(m); } void ShowErrorUtf(char* msg) { - TCHAR* m = (msg) ? mir_utf8decodeT(msg) : NULL; + wchar_t* m = (msg) ? mir_utf8decodeT(msg) : NULL; ShowError(m); if (m) mir_free(m); } -void ShowMessageInline(const MCONTACT hContact, const TCHAR *msg) { - TCHAR buff[1024]; +void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) { + wchar_t buff[1024]; mir_sntprintf(buff, L"%s%s", _T(LANG_INLINE_PREFIX), msg); T2Utf utf(buff); @@ -297,37 +297,37 @@ void ShowMessageUtf(const MCONTACT hContact, const char *msg) { ShowPopupUtf(Translate(LANG_OTR_INFO), msg, 0, hContact); } -void ShowMessage(const MCONTACT hContact, const TCHAR *msg) { +void ShowMessage(const MCONTACT hContact, const wchar_t *msg) { if(options.msg_inline) ShowMessageInline(hContact, msg); if(options.msg_popup) ShowPopup(TranslateT(LANG_OTR_INFO), msg, 0, hContact); } -const TCHAR *policy_to_string(OtrlPolicy policy) { +const wchar_t *policy_to_string(OtrlPolicy policy) { switch (policy) { case OTRL_POLICY_NEVER: - return TranslateT(LANG_POLICY_NEVER); + return TranslateW(LANG_POLICY_NEVER); case OTRL_POLICY_OPPORTUNISTIC: - return TranslateT(LANG_POLICY_OPP); + return TranslateW(LANG_POLICY_OPP); case OTRL_POLICY_MANUAL: case OTRL_POLICY_MANUAL_MOD: - return TranslateT(LANG_POLICY_MANUAL); + return TranslateW(LANG_POLICY_MANUAL); case OTRL_POLICY_ALWAYS: - return TranslateT(LANG_POLICY_ALWAYS); + return TranslateW(LANG_POLICY_ALWAYS); default: - return TranslateT(LANG_POLICY_DEFAULT); + return TranslateW(LANG_POLICY_DEFAULT); } } -OtrlPolicy policy_from_string(const TCHAR *polstring) { - if (mir_tstrcmp(polstring, TranslateT(LANG_POLICY_NEVER)) == 0) +OtrlPolicy policy_from_string(const wchar_t *polstring) { + if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_NEVER)) == 0) return OTRL_POLICY_NEVER; - else if (mir_tstrcmp(polstring, TranslateT(LANG_POLICY_OPP)) == 0) + else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_OPP)) == 0) return OTRL_POLICY_OPPORTUNISTIC; - else if (mir_tstrcmp(polstring, TranslateT(LANG_POLICY_MANUAL)) == 0) + else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_MANUAL)) == 0) return OTRL_POLICY_MANUAL_MOD; - else if (mir_tstrcmp(polstring, TranslateT(LANG_POLICY_ALWAYS)) == 0) + else if (mir_tstrcmp(polstring, TranslateW(LANG_POLICY_ALWAYS)) == 0) return OTRL_POLICY_ALWAYS; else return CONTACT_DEFAULT_POLICY; diff --git a/plugins/MirOTR/src/utils.h b/plugins/MirOTR/src/utils.h index 633b5a0647..aec0e4a01a 100644 --- a/plugins/MirOTR/src/utils.h +++ b/plugins/MirOTR/src/utils.h @@ -19,28 +19,28 @@ TrustLevel otr_context_get_trust(ConnContext *context); void VerifyFingerprint(ConnContext *context, bool verify); void VerifyFingerprintMessage(ConnContext *context, bool verify); -void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20]); +void otrl_privkey_hash_to_humanT(wchar_t human[45], const unsigned char hash[20]); char* contact_get_id(MCONTACT hContact, bool bNameOnError=true); __inline const char* contact_get_account(MCONTACT hContact); -extern __inline const TCHAR* contact_get_nameT(MCONTACT hContact); +extern __inline const wchar_t* contact_get_nameT(MCONTACT hContact); -TCHAR* ProtoGetNickname(const char* proto); +wchar_t* ProtoGetNickname(const char* proto); -void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTACT hContact = NULL); -void ShowWarning(TCHAR* msg); -void ShowError(TCHAR* msg); +void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact = NULL); +void ShowWarning(wchar_t* msg); +void ShowError(wchar_t* msg); void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact = NULL); void ShowWarningUtf(char* msg); void ShowErrorUtf(char* msg); -void ShowMessageInline(const MCONTACT hContact, const TCHAR *msg); +void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg); void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg); -void ShowMessage(const MCONTACT hContact, const TCHAR *msg); +void ShowMessage(const MCONTACT hContact, const wchar_t *msg); void ShowMessageUtf(const MCONTACT hContact, const char *msg); -const TCHAR *policy_to_string(OtrlPolicy policy); -OtrlPolicy policy_from_string(const TCHAR *polstring); +const wchar_t *policy_to_string(OtrlPolicy policy); +OtrlPolicy policy_from_string(const wchar_t *polstring); #endif |