diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-25 10:31:04 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-25 10:31:04 +0000 |
commit | 8ae3679aa1339ce9abee53adb69902bd6b7513dc (patch) | |
tree | 94ef8927e12043ed6dcc15e1e640d68a8add520e /plugins/New_GPG | |
parent | 1e273e28d89b5838e3d0f0cafac9676577cb71ce (diff) |
hello, Unix.
phase 1: removing _T()
git-svn-id: http://svn.miranda-ng.org/main/trunk@17127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-x | plugins/New_GPG/src/gpg_wrapper.cpp | 10 | ||||
-rw-r--r-- | plugins/New_GPG/src/init.cpp | 12 | ||||
-rw-r--r-- | plugins/New_GPG/src/log.cpp | 2 | ||||
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 118 | ||||
-rwxr-xr-x | plugins/New_GPG/src/messages.cpp | 72 | ||||
-rwxr-xr-x | plugins/New_GPG/src/options.cpp | 104 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 178 |
7 files changed, 248 insertions, 248 deletions
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index c979149e2f..1e2fcfce97 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -25,7 +25,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae extern logtofile debuglog; - TCHAR *bin_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); + TCHAR *bin_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L""); { if(!boost::filesystem::exists(bin_path)) { @@ -48,7 +48,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae env.push_back(L"LC_ALL=English"); env.push_back(L"LANG=C"); argv.push_back(bin_path); - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); if(mir_tstrlen(home_dir)) //this check are required for first run gpg binary validation { argv.push_back(L"--homedir"); @@ -81,7 +81,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae file_descriptor_sink serr(perr.sink, close_handle); TCHAR *mir_path = new TCHAR [MAX_PATH]; - PathToAbsoluteW(_T("\\"), mir_path); + PathToAbsoluteW(L"\\", mir_path); c = new child(execute(set_args(argv), bind_stdout(sout), bind_stderr(serr), close_stdin(),/*bind_stdin(sin),*/ show_window(SW_HIDE), hide_console(), inherit_env(), set_env(env), start_in_dir(mir_path))); _child = c; @@ -175,7 +175,7 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, pxResult *res return pxNotConfigured; extern logtofile debuglog; - TCHAR *bin_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); + TCHAR *bin_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L""); { if(!boost::filesystem::exists(bin_path)) { @@ -197,7 +197,7 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, pxResult *res env.push_back(L"LC_ALL=English"); argv.push_back(bin_path); argv.push_back(L"--homedir"); - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); argv.push_back(home_dir); mir_free(home_dir); argv.push_back(L"--display-charset"); diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index a8834fd1d5..9a84c466ee 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -74,14 +74,14 @@ void init_vars() {
bAppendTags = db_get_b(NULL, szGPGModuleName, "bAppendTags", 0) != 0;
bStripTags = db_get_b(NULL, szGPGModuleName, "bStripTags", 0) != 0;
- inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
- inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
- outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
- outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
+ inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", L"<GPGdec>");
+ inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", L"</GPGdec>");
+ outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", L"<GPGenc>");
+ outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", L"</GPGenc>");
bDebugLog = db_get_b(NULL, szGPGModuleName, "bDebugLog", 0) != 0;
bAutoExchange = db_get_b(NULL, szGPGModuleName, "bAutoExchange", 0) != 0;
bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0) != 0;
- password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
+ password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L"");
debuglog.init();
bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001;
bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09) != 0;
@@ -102,7 +102,7 @@ void init_vars() load_existing_key_rect.left = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
load_existing_key_rect.top = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
tabsrmm_used = isTabsrmmUsed();
- bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Arial"));
+ bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, L"Arial");
}
static int OnModulesLoaded(WPARAM, LPARAM)
diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp index e9daf7d1df..87c72605da 100644 --- a/plugins/New_GPG/src/log.cpp +++ b/plugins/New_GPG/src/log.cpp @@ -73,7 +73,7 @@ void logtofile::init() {
if(path)
mir_free(path);
- path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T("C:\\GPGdebug.log"));
+ path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", L"C:\\GPGdebug.log");
}
_bDebugLog = bDebugLog;
}
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 3de785cc84..8e50ba8998 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -49,7 +49,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PASSWD), 0); LVCOLUMN col = { 0 }; - col.pszText = _T("Key ID"); + col.pszText = L"Key ID"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 50; @@ -96,7 +96,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, item.mask = LVIF_TEXT; item.iItem = i; item.iSubItem = 0; - item.pszText = _T(""); + item.pszText = L""; { //parse gpg output string out; @@ -216,10 +216,10 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, setting += accounts[n]->szModuleName; setting += ")"; setting += "_KeyID"; - TCHAR *str = UniGetContactSettingUtf(NULL, szGPGModuleName, setting.c_str(), _T("")); + TCHAR *str = UniGetContactSettingUtf(NULL, szGPGModuleName, setting.c_str(), L""); if (key_id == str) { if (!accs.empty()) - accs += _T(","); + accs += L","; accs += accounts[n]->tszAccountName; } mir_free(str); @@ -279,7 +279,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, { if (_tcschr(name, _T('('))) { wstring str = name; - wstring::size_type p = str.find(_T("(")) - 1; + wstring::size_type p = str.find(L"(") - 1; mir_tstrcpy(name, str.substr(0, p).c_str()); } } @@ -323,8 +323,8 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, } if (!mir_strcmp(buf, Translate("Default"))) { wstring keyinfo = TranslateT("Default private key ID"); - keyinfo += _T(": "); - keyinfo += (fp[0]) ? fp : _T("not set"); + keyinfo += L": "; + keyinfo += (fp[0]) ? fp : L"not set"; extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, keyinfo.c_str()); } @@ -358,7 +358,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, item.mask = LVIF_TEXT; item.iItem = i; item.iSubItem = 0; - item.pszText = _T(""); + item.pszText = L""; {//parse gpg output string out; DWORD code; @@ -505,10 +505,10 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, wstring path; { // generating key file - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); path = tmp; mir_free(tmp); - path.append(_T("\\new_key")); + path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); @@ -681,7 +681,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, case IDC_EXPORT_PRIVATE: { - TCHAR *p = GetFilePath(_T("Choose file to export key"), _T("*"), _T("Any file"), true); + TCHAR *p = GetFilePath(L"Choose file to export key", L"*", L"Any file", true); if (!p || !p[0]) { delete[] p; //TODO: handle error @@ -796,12 +796,12 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ptrT tmp(mir_a2t(mir_path)); - wstring gpg_path(tmp); gpg_path += _T("\\GnuPG\\gpg.exe"); - wstring gpg_lang_path(tmp); gpg_lang_path += _T("\\GnuPG\\gnupg.nls\\en@quot.mo"); + wstring gpg_path(tmp); gpg_path += L"\\GnuPG\\gpg.exe"; + wstring gpg_lang_path(tmp); gpg_lang_path += L"\\GnuPG\\gnupg.nls\\en@quot.mo"; if (boost::filesystem::exists(gpg_path)) { gpg_exists = true; - mir_tstrcpy(path, _T("GnuPG\\gpg.exe")); + mir_tstrcpy(path, L"GnuPG\\gpg.exe"); } else mir_tstrcpy(path, gpg_path.c_str()); @@ -815,7 +815,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { ptrT tmp; if (!gpg_exists) { - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValue(HKEY_CURRENT_USER, _T("Software\\GNU\\GnuPG"), _T("gpgProgram"), 0, path, &len) == ERROR_SUCCESS) ? path : _T("")); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValue(HKEY_CURRENT_USER, L"Software\\GNU\\GnuPG", L"gpgProgram", 0, path, &len) == ERROR_SUCCESS) ? path : L""); if (tmp[0]) if (!boost::filesystem::exists((TCHAR*)tmp)) MessageBox(0, TranslateT("Wrong GPG binary location found in system.\nPlease choose another location"), TranslateT("Warning"), MB_OK); @@ -854,7 +854,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } } { - ptrT tmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""))); + ptrT tmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); if (!tmp[0]) { mir_free(tmp); char *mir_path = (char*)mir_alloc(sizeof(char) * MAX_PATH); @@ -865,12 +865,12 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("\"GPG\" directory found in Miranda root.\nAssuming it's GPG home directory.\nGPG home directory set."), TranslateT("Info"), MB_OK); } else { - wstring path_ = _wgetenv(_T("APPDATA")); - path_ += _T("\\GnuPG"); + wstring path_ = _wgetenv(L"APPDATA"); + path_ += L"\\GnuPG"; tmp = mir_wstrdup(path_.c_str()); } } - SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists ? tmp : _T("gpg")); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists ? tmp : L"gpg"); } //TODO: additional check for write access if (gpg_exists && lang_exists && !bad_version) @@ -886,8 +886,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (LOWORD(wParam)) { case IDC_SET_BIN_PATH: { - GetFilePath(_T("Choose gpg.exe"), "szGpgBinPath", _T("*.exe"), _T("EXE Executables")); - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe")); + GetFilePath(L"Choose gpg.exe", "szGpgBinPath", L"*.exe", L"EXE Executables"); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe"); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); char mir_path[MAX_PATH]; char *atmp = mir_t2a(tmp); @@ -903,8 +903,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, break; case IDC_SET_HOME_DIR: { - GetFolderPath(_T("Set home directory"), "szHomePath"); - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + GetFolderPath(L"Set home directory", "szHomePath"); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp); char mir_path[MAX_PATH]; char *atmp = mir_t2a(tmp); @@ -975,7 +975,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); { - TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); DWORD dwFileAttr = GetFileAttributes(path); if (dwFileAttr != INVALID_FILE_ATTRIBUTES) { dwFileAttr &= ~FILE_ATTRIBUTE_READONLY; @@ -1046,7 +1046,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp); { - TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); DWORD dwFileAttr = GetFileAttributes(path); if (dwFileAttr != INVALID_FILE_ATTRIBUTES) { dwFileAttr &= ~FILE_ATTRIBUTE_READONLY; @@ -1058,10 +1058,10 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { wstring path; { //generating key file - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); path = tmp; mir_free(tmp); - path.append(_T("\\new_key")); + path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); @@ -1190,7 +1190,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara //new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); - TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0] ? TranslateT("There is existing key for contact, would you like to replace it with new key?") : TranslateT("New public key was received, do you want to import it?")); EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0) ? 0 : 1); SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0] ? TranslateT("Replace") : TranslateT("Accept")); @@ -1248,8 +1248,8 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara SetWindowPos(hwndDlg, 0, key_gen_rect.left, key_gen_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); SetWindowText(hwndDlg, TranslateT("Key Generation dialog")); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("RSA"), 0); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), L"RSA", 0); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), L"DSA", 1); SendDlgItemMessage(hwndDlg, IDC_KEY_TYPE, CB_SETCURSEL, 1, 0); SetDlgItemInt(hwndDlg, IDC_KEY_EXPIRE_DATE, 0, 0); SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 4096, 0); @@ -1315,12 +1315,12 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara mir_free(tmp); } { //generating key file - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); char *tmp2;// = mir_t2a(tmp); path = tmp; mir_free(tmp); // mir_free(tmp2); - path.append(_T("\\new_key")); + path.append(L"\\new_key"); wfstream f(path.c_str(), std::ios::out); if (!f.is_open()) { MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); @@ -1436,7 +1436,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara item.mask = LVIF_TEXT; item.iItem = i; item.iSubItem = 0; - item.pszText = _T(""); + item.pszText = L""; string out; DWORD code; string::size_type p = 0, p2 = 0, stop = 0; @@ -1546,37 +1546,37 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP { SetWindowPos(hwndDlg, 0, load_existing_key_rect.left, load_existing_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); - col.pszText = _T("Key ID"); + col.pszText = L"Key ID"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 50; ListView_InsertColumn(hwndList, 0, &col); memset(&col, 0, sizeof(col)); - col.pszText = _T("Email"); + col.pszText = L"Email"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 30; ListView_InsertColumn(hwndList, 1, &col); memset(&col, 0, sizeof(col)); - col.pszText = _T("Name"); + col.pszText = L"Name"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 250; ListView_InsertColumn(hwndList, 2, &col); memset(&col, 0, sizeof(col)); - col.pszText = _T("Creation date"); + col.pszText = L"Creation date"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 30; ListView_InsertColumn(hwndList, 3, &col); memset(&col, 0, sizeof(col)); - col.pszText = _T("Expiration date"); + col.pszText = L"Expiration date"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 30; ListView_InsertColumn(hwndList, 4, &col); memset(&col, 0, sizeof(col)); - col.pszText = _T("Key length"); + col.pszText = L"Key length"; col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 30; @@ -1587,7 +1587,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP item.mask = LVIF_TEXT; item.iItem = i; item.iSubItem = 0; - item.pszText = _T(""); + item.pszText = L""; {//parse gpg output string out; DWORD code; @@ -1773,8 +1773,8 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0, import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("keys.gnupg.net"), 0); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), L"subkeys.pgp.net", 0); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), L"keys.gnupg.net", 0); } return TRUE; @@ -1875,33 +1875,33 @@ void InitCheck() { { // parse gpg output - TCHAR *current_home = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - db_set_ts(NULL, szGPGModuleName, "szHomePath", _T("")); //we do not need home for gpg binary validation + TCHAR *current_home = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); + db_set_ts(NULL, szGPGModuleName, "szHomePath", L""); //we do not need home for gpg binary validation gpg_valid = isGPGValid(); db_set_ts(NULL, szGPGModuleName, "szHomePath", current_home); //return current home dir back mir_free(current_home); bool home_dir_access = false, temp_access = false; - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); std::wstring test_path = home_dir; mir_free(home_dir); - test_path += _T("/"); + test_path += L"/"; test_path += toUTF16(get_random(13)); wfstream test_file; test_file.open(test_path, std::ios::trunc | std::ios::out); if (test_file.is_open() && test_file.good()) { - test_file << _T("access_test\n"); + test_file << L"access_test\n"; if (test_file.good()) home_dir_access = true; test_file.close(); boost::filesystem::remove(test_path); } - home_dir = _tgetenv(_T("TEMP")); + home_dir = _tgetenv(L"TEMP"); test_path = home_dir; - test_path += _T("/"); + test_path += L"/"; test_path += toUTF16(get_random(13)); test_file.open(test_path, std::ios::trunc | std::ios::out); if (test_file.is_open() && test_file.good()) { - test_file << _T("access_test\n"); + test_file << L"access_test\n"; if (test_file.good()) temp_access = true; test_file.close(); @@ -1936,10 +1936,10 @@ void InitCheck() if (result == pxNotFound) return; } - home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); wstring tmp_dir = home_dir; mir_free(home_dir); - tmp_dir += _T("\\tmp"); + tmp_dir += L"\\tmp"; _wmkdir(tmp_dir.c_str()); int count = 0; PROTOACCOUNT **accounts; @@ -2072,7 +2072,7 @@ void InitCheck() mir_free(key); } { - TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); DWORD dwFileAttr = GetFileAttributes(path); if (dwFileAttr != INVALID_FILE_ATTRIBUTES) { dwFileAttr &= ~FILE_ATTRIBUTE_READONLY; @@ -2137,16 +2137,16 @@ void ImportKey() std::vector<wstring> cmd; TCHAR tmp2[MAX_PATH] = { 0 }; { - _tcsncpy(tmp2, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""))), MAX_PATH - 1); - mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2)); + _tcsncpy(tmp2, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")), MAX_PATH - 1); + mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2)); boost::filesystem::remove(tmp2); ptrT ptmp; if (db_mc_isMeta(hContact)) - ptmp = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", _T("")); + ptmp = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", L""); else - ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); wfstream f(tmp2, std::ios::out); f << ptmp; @@ -2358,6 +2358,6 @@ void ImportKey() db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); } - MessageBox(0, toUTF16(output).c_str(), _T(""), MB_OK); + MessageBox(0, toUTF16(output).c_str(), L"", MB_OK); boost::filesystem::remove(tmp2); } diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index e04ccc6e7f..de5940cb32 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -29,8 +29,8 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR DWORD dbflags = DBEF_UTF; { // check for gpg related data - wstring::size_type s1 = str.find(_T("-----BEGIN PGP MESSAGE-----")); - wstring::size_type s2 = str.find(_T("-----END PGP MESSAGE-----")); + wstring::size_type s1 = str.find(L"-----BEGIN PGP MESSAGE-----"); + wstring::size_type s2 = str.find(L"-----END PGP MESSAGE-----"); if (s2 != wstring::npos && s1 != wstring::npos) { //this is generic encrypted data block if (!isContactSecured(hContact)) @@ -68,13 +68,13 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR else if (bDebugLog) debuglog << std::string(time_str() + ": info: received encrypted message from: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))); boost::algorithm::erase_all(str, "\r"); - s2 += mir_tstrlen(_T("-----END PGP MESSAGE-----")); + s2 += mir_tstrlen(L"-----END PGP MESSAGE-----"); - ptrT ptszHomePath(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""))); + ptrT ptszHomePath(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); wstring encfile = toUTF16(get_random(10)); wstring decfile = toUTF16(get_random(10)); { - wstring path = wstring(ptszHomePath) + _T("\\tmp\\") + encfile; + wstring path = wstring(ptszHomePath) + L"\\tmp\\" + encfile; if(!bDebugLog) { boost::system::error_code e; @@ -117,13 +117,13 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); if (pass[0] && bDebugLog) debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid + ", trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)) + " with password"); } else { - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); if (pass[0] && bDebugLog) debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)) + " with password"); } @@ -147,7 +147,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR if(!bDebugLog) { boost::system::error_code e; - boost::filesystem::remove(wstring(ptszHomePath) + _T("\\tmp\\") + decfile, e); + boost::filesystem::remove(wstring(ptszHomePath) + L"\\tmp\\" + decfile, e); } cmd.push_back(L"--output"); @@ -296,10 +296,10 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR if(!bDebugLog) { boost::system::error_code e; - boost::filesystem::remove(wstring(ptszHomePath) + _T("\\tmp\\") + encfile, e); + boost::filesystem::remove(wstring(ptszHomePath) + L"\\tmp\\" + encfile, e); } - if (!boost::filesystem::exists(wstring(ptszHomePath) + _T("\\tmp\\") + decfile)) + if (!boost::filesystem::exists(wstring(ptszHomePath) + L"\\tmp\\" + decfile)) { string str1 = msg; str1.insert(0, "Received unencrypted message:\n"); @@ -319,7 +319,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR str.clear(); - wstring tszDecPath = wstring(ptszHomePath) + _T("\\tmp\\") + decfile; + wstring tszDecPath = wstring(ptszHomePath) + L"\\tmp\\" + decfile; { fstream f(tszDecPath.c_str(), std::ios::in | std::ios::ate | std::ios::binary); if (f.is_open()) @@ -408,17 +408,17 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } wstring str = toUTF16(msg); size_t s1, s2; - if (bAutoExchange && (str.find(_T("-----PGP KEY RESPONSE-----")) != wstring::npos)) + if (bAutoExchange && (str.find(L"-----PGP KEY RESPONSE-----") != wstring::npos)) { if (bDebugLog) debuglog << std::string(time_str() + ": info(autoexchange): parsing key response:" + toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0))); - s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----")); - s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); + s2 = str.find(L"-----END PGP PUBLIC KEY BLOCK-----"); + s1 = str.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----"); if (s1 != wstring::npos && s2 != wstring::npos) { if (bDebugLog) debuglog << std::string(time_str() + ": info(autoexchange): found pubkey block:" + toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0))); - s2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")); + s2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1, s2 - s1).c_str()); { //gpg execute block std::vector<wstring> cmd; @@ -426,15 +426,15 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) string output; DWORD exitcode; { - ptrT ptmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""))); + ptrT ptmp(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")); mir_tstrcpy(tmp2, ptmp); mir_free(ptmp); - mir_tstrcat(tmp2, _T("\\")); + mir_tstrcat(tmp2, L"\\"); TCHAR *tmp3 = mir_a2t(get_random(5).c_str()); mir_tstrcat(tmp2, tmp3); - mir_tstrcat(tmp2, _T(".asc")); + mir_tstrcat(tmp2, L".asc"); mir_free(tmp3); - //mir_tstrcat(tmp2, _T("temporary_exported.asc")); + //mir_tstrcat(tmp2, L"temporary_exported.asc"); if(!bDebugLog) { boost::system::error_code e; @@ -459,7 +459,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) f.open(tmp2, std::ios::out); } } - ptmp = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "GPGPubKey", _T("")); + ptmp = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "GPGPubKey", L""); f << (TCHAR*)ptmp; f.close(); cmd.push_back(L"--batch"); @@ -551,23 +551,23 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) return 1; } } - if (((s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) == wstring::npos) || ((s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) == wstring::npos)) + if (((s2 = str.find(L"-----END PGP PUBLIC KEY BLOCK-----")) == wstring::npos) || ((s1 = str.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----")) == wstring::npos)) { - s2 = str.find(_T("-----END PGP PRIVATE KEY BLOCK-----")); - s1 = str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")); + s2 = str.find(L"-----END PGP PRIVATE KEY BLOCK-----"); + s1 = str.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----"); } if ((s2 != wstring::npos) && (s1 != wstring::npos)) { //this is public key if (bDebugLog) debuglog << std::string(time_str() + ": info: received key from: " + toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0))); s1 = 0; - while ((s1 = str.find(_T("\r"), s1)) != wstring::npos) + while ((s1 = str.find(L"\r", s1)) != wstring::npos) str.erase(s1, 1); void ShowNewKeyDialog(); - if (((s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) - s2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")); - else if (((s2 = str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) - s2 += mir_tstrlen(_T("-----END PGP PRIVATE KEY BLOCK-----")); + if (((s2 = str.find(L"-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && ((s1 = str.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos)) + s2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----"); + else if (((s2 = str.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && ((s1 = str.find(L"-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos)) + s2 += mir_tstrlen(L"-----END PGP PRIVATE KEY BLOCK-----"); new_key.append(str.substr(s1, s2 - s1)); //new_key_hcnt_mutex.lock(); new_key_hcnt = ccs->hContact; @@ -613,7 +613,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } else { - TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", _T("")); + TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L""); if (jid[0]) { extern list <JabberAccount*> Accounts; @@ -632,7 +632,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) break; } mir_free(caps); - if (str1.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos) + if (str1.find(L"GPG_Key_Auto_Exchange:0") != string::npos) { ProtoChainSend(ccs->hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; @@ -658,8 +658,8 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) debuglog << std::string(time_str() + ": info: stripping tags in outgoing message, name: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))); strip_tags(str); } - /* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) - str.replace(i, 2, _T("\n")); */ + /* for(std::wstring::size_type i = str.find(L"\r\n"); i != std::wstring::npos; i = str.find(L"\r\n", i+1)) + str.replace(i, 2, L"\n"); */ string out; DWORD code; wstring file = toUTF16(get_random(10)), path; @@ -695,7 +695,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) mir_free(tmp2); } { - TCHAR *tmp2 = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *tmp2 = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); path = tmp2; cmd.push_back(std::wstring(tmp2) + L"\\tmp\\" + file); mir_free(tmp2); @@ -794,7 +794,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) boost::system::error_code e; boost::filesystem::remove(path, e); } - path.append(_T(".asc")); + path.append(L".asc"); wfstream f(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary); count = 0; while (!f.is_open()) { @@ -933,7 +933,7 @@ int HookSendMsg(WPARAM w, LPARAM l) } } else { - TCHAR *jid = UniGetContactSettingUtf(hContact, proto, "jid", _T("")); + TCHAR *jid = UniGetContactSettingUtf(hContact, proto, "jid", L""); if (jid[0]) { if (bDebugLog) debuglog << std::string(time_str() + ": info(autoexchange): protocol looks like jabber, name: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))); @@ -950,7 +950,7 @@ int HookSendMsg(WPARAM w, LPARAM l) break; } mir_free(caps); - if (str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos) { + if (str.find(L"GPG_Key_Auto_Exchange:0") != string::npos) { if (bDebugLog) debuglog << std::string(time_str() + ": info(autoexchange, jabber): autoexchange capability found, sending key request, name: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 1a76b727f0..2b4caf0911 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -135,25 +135,25 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", "");
tmp = mir_a2t(tmp2);
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 1, (mir_tstrlen(tmp) > 1) ? tmp : _T("not set"));
+ ListView_SetItemText(hwndList, iRow, 1, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", "");
if (!toUTF16(tmp2).empty())
tmp = mir_wstrdup(toUTF16(tmp2).c_str());
else
- tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T(""));
+ tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", L"");
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 2, (mir_tstrlen(tmp) > 1) ? tmp : _T("not set"));
+ ListView_SetItemText(hwndList, iRow, 2, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", "");
if (!toUTF16(tmp2).empty())
tmp = mir_wstrdup(toUTF16(tmp2).c_str());
else
- tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T(""));
+ tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", L"");
mir_free(tmp2);
- ListView_SetItemText(hwndList, iRow, 3, (mir_tstrlen(tmp) > 1) ? tmp : _T("not set"));
+ ListView_SetItemText(hwndList, iRow, 3, (mir_tstrlen(tmp) > 1) ? tmp : L"not set");
mir_free(tmp);
if (db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0))
@@ -168,8 +168,8 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L i++;
}
}
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T(""));
- SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (mir_tstrlen(tmp) > 1) ? tmp : _T("c:\\GPGdebug.log"));
+ TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", L"");
+ SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (mir_tstrlen(tmp) > 1) ? tmp : L"c:\\GPGdebug.log");
mir_free(tmp);
CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09);
@@ -304,11 +304,11 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDC_SAVE_KEY_BUTTON:
{
- TCHAR *tmp = GetFilePath(TranslateT("Export public key"), _T("*"), TranslateT(".asc pubkey file"), true);
+ TCHAR *tmp = GetFilePath(TranslateT("Export public key"), L"*", TranslateT(".asc pubkey file"), true);
if (tmp) {
- wstring str(ptrT(UniGetContactSettingUtf(user_data[item_num + 1], szGPGModuleName, "GPGPubKey", _T(""))));
+ wstring str(ptrT(UniGetContactSettingUtf(user_data[item_num + 1], szGPGModuleName, "GPGPubKey", L"")));
wstring::size_type s = 0;
- while ((s = str.find(_T("\r"), s)) != wstring::npos)
+ while ((s = str.find(L"\r", s)) != wstring::npos)
str.erase(s, 1);
wfstream f(tmp, std::ios::out);
@@ -360,7 +360,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L break;
case IDC_LOG_FILE_SET:
- SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, ptrT(GetFilePath(TranslateT("Set log file"), _T("*"), TranslateT("LOG files"), 1)));
+ SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, ptrT(GetFilePath(TranslateT("Set log file"), L"*", TranslateT("LOG files"), 1)));
break;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -415,16 +415,16 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetDlgItemText(hwndDlg, IDC_BIN_PATH, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe"))));
- SetDlgItemText(hwndDlg, IDC_HOME_DIR, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("gpg"))));
+ SetDlgItemText(hwndDlg, IDC_BIN_PATH, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe")));
+ SetDlgItemText(hwndDlg, IDC_HOME_DIR, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"gpg")));
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_SET_BIN_PATH:
{
- GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", _T("*.exe"), TranslateT("EXE Executables"));
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe"));
+ GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", L"*.exe", TranslateT("EXE Executables"));
+ TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe");
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
bool gpg_exists = false;
{
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, gpg_exists = true;
if (gpg_exists) {
bool bad_version = false;
- TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T(""));
+ TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"");
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
@@ -460,7 +460,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("This is not GnuPG binary!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK);
}
/* if(bad_version) //looks like working fine with gpg2
- MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), _T("Warning"), MB_OK); */
+ MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), L"Warning", MB_OK); */
}
}
char mir_path[MAX_PATH];
@@ -478,7 +478,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_SET_HOME_DIR:
{
GetFolderPath(TranslateT("Set home directory"), "szHomePath");
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
+ TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
char mir_path[MAX_PATH];
char *atmp = mir_t2a(tmp);
@@ -526,16 +526,16 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CheckStateLoadDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags", 0);
CheckStateLoadDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags", 0);
{
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
+ TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", L"<GPGdec>");
SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp);
mir_free(tmp);
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", L"</GPGdec>");
SetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp);
mir_free(tmp);
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", L"<GPGenc>");
SetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp);
mir_free(tmp);
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", L"</GPGenc>");
SetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp);
mir_free(tmp);
}
@@ -679,16 +679,16 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, BST_CHECKED);
}
if (hcnt) {
- TCHAR *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));
+ TCHAR *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", L"");
wstring str = tmp;
mir_free(tmp); tmp = NULL;
if (!str.empty()) {
wstring::size_type p = 0, stop = 0;
for (;;) {
- if ((p = str.find(_T("\n"), p + 2)) != wstring::npos) {
+ if ((p = str.find(L"\n", p + 2)) != wstring::npos) {
if (p > stop) {
stop = p;
- str.insert(p, _T("\r"));
+ str.insert(p, L"\r");
}
else break;
}
@@ -736,7 +736,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
if (tmp)
mir_free(tmp);
- SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty() ? str.c_str() : _T(""));
+ SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty() ? str.c_str() : L"");
}
hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT);
return TRUE;
@@ -751,26 +751,26 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa TCHAR *begin, *end;
GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960);
key_buf.append(tmp);
- key_buf.append(_T("\n")); //no new line at end of file )
+ key_buf.append(L"\n"); //no new line at end of file )
delete[] tmp;
- while ((ws1 = key_buf.find(_T("\r"), ws1)) != wstring::npos) {
+ while ((ws1 = key_buf.find(L"\r", ws1)) != wstring::npos) {
key_buf.erase(ws1, 1); //remove windows specific trash
}
ws1 = 0;
- if (((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos)) {
- begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) + 1));
- mir_tstrcpy(begin, _T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
- end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----")) + 1));
- mir_tstrcpy(end, _T("-----END PGP PUBLIC KEY BLOCK-----"));
+ if (((ws2 = key_buf.find(L"-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && ((ws1 = key_buf.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos)) {
+ begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(L"-----BEGIN PGP PUBLIC KEY BLOCK-----") + 1));
+ mir_tstrcpy(begin, L"-----BEGIN PGP PUBLIC KEY BLOCK-----");
+ end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----") + 1));
+ mir_tstrcpy(end, L"-----END PGP PUBLIC KEY BLOCK-----");
}
- else if (((ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"))) != wstring::npos) && ((ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"))) != wstring::npos)) {
- begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) + 1));
- mir_tstrcpy(begin, _T("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
- end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(_T("-----END PGP PRIVATE KEY BLOCK-----")) + 1));
- mir_tstrcpy(end, _T("-----END PGP PRIVATE KEY BLOCK-----"));
+ else if (((ws2 = key_buf.find(L"-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && ((ws1 = key_buf.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos)) {
+ begin = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(L"-----BEGIN PGP PRIVATE KEY BLOCK-----") + 1));
+ mir_tstrcpy(begin, L"-----BEGIN PGP PRIVATE KEY BLOCK-----");
+ end = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(L"-----END PGP PRIVATE KEY BLOCK-----") + 1));
+ mir_tstrcpy(end, L"-----END PGP PRIVATE KEY BLOCK-----");
}
else {
- MessageBox(0, TranslateT("This is not public or private key"), _T("INFO"), MB_OK);
+ MessageBox(0, TranslateT("This is not public or private key"), L"INFO", MB_OK);
break;
}
ws2 += mir_tstrlen(end);
@@ -800,18 +800,18 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa DWORD exitcode;
{
MCONTACT hcnt = db_mc_tryMeta(hContact);
- ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
+ ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
_tcsncpy(tmp2, ptmp, MAX_PATH - 1);
mir_free(ptmp);
- mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
- ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));
+ ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", L"");
wstring str = ptmp;
mir_free(ptmp);
wstring::size_type s = 0;
- while ((s = str.find(_T("\r"), s)) != wstring::npos) {
+ while ((s = str.find(L"\r", s)) != wstring::npos) {
str.erase(s, 1);
}
f << str.c_str();
@@ -1004,7 +1004,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
}
if (!hContact) {
- TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", _T(""));
+ TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", L"");
{
string out;
DWORD code;
@@ -1031,7 +1031,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa }
}
tmp = mir_wstrdup(toUTF16(output).c_str());
- MessageBox(0, tmp, _T(""), MB_OK);
+ MessageBox(0, tmp, L"", MB_OK);
mir_free(tmp);
boost::filesystem::remove(tmp2);
}
@@ -1069,7 +1069,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa break;
case ID_LOAD_FROM_FILE:
{
- TCHAR *tmp = GetFilePath(TranslateT("Set file containing GPG public key"), _T("*"), TranslateT("GPG public key file"));
+ TCHAR *tmp = GetFilePath(TranslateT("Set file containing GPG public key"), L"*", TranslateT("GPG public key file"));
if (!tmp)
break;
@@ -1095,17 +1095,17 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa debuglog << std::string(time_str() + ": info: Failed to read key file");
break;
}
- ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
- ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
+ ws2 = key_buf.find(L"-----END PGP PUBLIC KEY BLOCK-----");
+ ws1 = key_buf.find(L"-----BEGIN PGP PUBLIC KEY BLOCK-----");
if (ws2 == wstring::npos || ws1 == wstring::npos) {
- ws2 = key_buf.find(_T("-----END PGP PRIVATE KEY BLOCK-----"));
- ws1 = key_buf.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
+ ws2 = key_buf.find(L"-----END PGP PRIVATE KEY BLOCK-----");
+ ws1 = key_buf.find(L"-----BEGIN PGP PRIVATE KEY BLOCK-----");
}
if (ws2 == wstring::npos || ws1 == wstring::npos) {
MessageBox(0, TranslateT("There is no public or private key."), TranslateT("Info"), MB_OK);
break;
}
- ws2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ ws2 += mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----");
SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, key_buf.substr(ws1, ws2 - ws1).c_str());
key_buf.clear();
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 97c5999500..4de5fc75a8 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -67,7 +67,7 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx pfilter[mir_tstrlen(pfilter) + 1] = '\0'; pfilter[mir_tstrlen(pfilter) + 2] = '\0'; ofn.lpstrFilter = filter; - tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T("")); + tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, L""); _tcsncpy(str, tmp, _countof(str) - 1); mir_free(tmp); if (mir_tstrlen(str) < 2) @@ -94,7 +94,7 @@ TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool sav pfilter[mir_tstrlen(pfilter) + 1] = '\0'; pfilter[mir_tstrlen(pfilter) + 2] = '\0'; ofn.lpstrFilter = filter; - mir_tstrcpy(str, _T("")); + mir_tstrcpy(str, L""); if (mir_tstrlen(str) < 2) str[0] = '\0'; ofn.lpstrFile = str; @@ -238,13 +238,13 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM) keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); } TCHAR buf[128] = { 0 }; - mir_sntprintf(buf, _T("%s: %s"), TranslateT("Send public key"), toUTF16(keyid).c_str()); + mir_sntprintf(buf, L"%s: %s", TranslateT("Send public key"), toUTF16(keyid).c_str()); mir_free(keyid); Menu_ModifyItem(hSendKey, buf); } int flags; - TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); if (!tmp[0]) { db_unset(hContact, szGPGModuleName, "GPGEncryption"); flags = CMIF_GRAYED; @@ -252,7 +252,7 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM) else flags = 0; Menu_ModifyItem(hToggleEncryption, - db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0) ? _T("Turn off GPG encryption") : _T("Turn on GPG encryption"), + db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0) ? L"Turn off GPG encryption" : L"Turn on GPG encryption", INVALID_HANDLE_VALUE, flags); mir_free(tmp); return 0; @@ -289,7 +289,7 @@ int onProtoAck(WPARAM, LPARAM l) if (!filename) return 0; } - if (_tcsstr(filename, _T(".gpg"))) //decrypt it + if (_tcsstr(filename, L".gpg")) //decrypt it { //process encrypted file if (!bFileTransfers && !bSameAction) { void ShowEncryptedFileMsgBox(); @@ -308,8 +308,8 @@ int onProtoAck(WPARAM, LPARAM l) std::vector<wstring> cmd; cmd.push_back(L"-o"); wstring file = filename; - wstring::size_type p1 = file.rfind(_T(".gpg")); - file.erase(p1, mir_tstrlen(_T(".gpg"))); + wstring::size_type p1 = file.rfind(L".gpg"); + file.erase(p1, mir_tstrlen(L".gpg")); if (boost::filesystem::exists(file)) { if (MessageBox(0, TranslateT("Target file exists, do you want to replace it?"), TranslateT("Warning"), MB_YESNO) == IDNO) return 0; @@ -324,12 +324,12 @@ int onProtoAck(WPARAM, LPARAM l) string dbsetting = "szKey_"; dbsetting += keyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); if (mir_tstrlen(pass) > 0 && bDebugLog) debuglog << std::string(time_str() + ": info: found password in database for key ID: " + keyid + ", trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0)) + " with password"); } else { - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); if (mir_tstrlen(pass) > 0 && bDebugLog) debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to decrypt message from " + toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0)) + " with password"); } @@ -438,8 +438,8 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename) name = filename; else name++; - TCHAR *file_out = new TCHAR[mir_tstrlen(name) + mir_tstrlen(_T(".gpg")) + 1]; - mir_sntprintf(file_out, mir_tstrlen(name) + mir_tstrlen(_T(".gpg")) + 1, _T("%s.gpg"), name); + TCHAR *file_out = new TCHAR[mir_tstrlen(name) + mir_tstrlen(L".gpg") + 1]; + mir_sntprintf(file_out, mir_tstrlen(name) + mir_tstrlen(L".gpg") + 1, L"%s.gpg", name); cmd.push_back(szKeyid); if (db_get_b(hcnt, szGPGModuleName, "bAlwaysTrust", 0)) { cmd.push_back(L"--trust-model"); @@ -448,10 +448,10 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename) mir_free(szKeyid); mir_free(keyid); cmd.push_back(L"-o"); - TCHAR *temp = _tgetenv(_T("TEMP")); + TCHAR *temp = _tgetenv(L"TEMP"); cmd.push_back(wstring(temp) + L"\\" + file_out); wstring path_out = temp; - path_out += _T("\\"); + path_out += L"\\"; path_out += file_out; boost::filesystem::remove(path_out); cmd.push_back(L"-e"); @@ -501,7 +501,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) } } else { - TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", _T("")); + TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L""); if (jid[0]) { extern list <JabberAccount*> Accounts; list<JabberAccount*>::iterator end = Accounts.end(); @@ -517,7 +517,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) break; } mir_free(caps); - if (str.find(_T("GPG_Encrypted_FileTransfers:0")) != string::npos) + if (str.find(L"GPG_Encrypted_FileTransfers:0") != string::npos) cap_found = true; } } @@ -538,7 +538,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) for (int i = 0; file[i]; i++) { if (!boost::filesystem::exists(file[i])) return 0; //we do not want to send file unencrypted (sometimes ack have wrong info) - if (_tcsstr(file[i], _T(".gpg"))) + if (_tcsstr(file[i], L".gpg")) continue; std::wstring path_out = encrypt_file(ccs->hContact, file[i]); mir_free(file[i]); @@ -642,7 +642,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) for (int n = 0; n <= xmlGetChildCount(node); local_node = xmlGetChild(node, n++)) { LPCTSTR str = xmlGetText(local_node); LPCTSTR nodename = xmlGetName(local_node); - LPCTSTR attr = xmlGetAttrValue(local_node, _T("to")); + LPCTSTR attr = xmlGetAttrValue(local_node, L"to"); if (attr) { MCONTACT hContact = ji->ContactFromJID(attr); if (hContact) @@ -654,39 +654,39 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) continue; // TODO: make following block more readable - if (_tcsstr(str, _T("-----BEGIN PGP MESSAGE-----")) && _tcsstr(str, _T("-----END PGP MESSAGE-----"))) { + if (_tcsstr(str, L"-----BEGIN PGP MESSAGE-----") && _tcsstr(str, L"-----END PGP MESSAGE-----")) { wstring data = str; - xmlSetText(local_node, _T("This message is encrypted.")); - wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + mir_tstrlen(_T("-----BEGIN PGP MESSAGE-----")); - while (data.find(_T("Version: "), p1) != wstring::npos) { - p1 = data.find(_T("Version: "), p1); - p1 = data.find(_T("\n"), p1); + xmlSetText(local_node, L"This message is encrypted."); + wstring::size_type p1 = data.find(L"-----BEGIN PGP MESSAGE-----") + mir_tstrlen(L"-----BEGIN PGP MESSAGE-----"); + while (data.find(L"Version: ", p1) != wstring::npos) { + p1 = data.find(L"Version: ", p1); + p1 = data.find(L"\n", p1); } - while (data.find(_T("Comment: "), p1) != wstring::npos) { - p1 = data.find(_T("Comment: "), p1); - p1 = data.find(_T("\n"), p1); + while (data.find(L"Comment: ", p1) != wstring::npos) { + p1 = data.find(L"Comment: ", p1); + p1 = data.find(L"\n", p1); } - while (data.find(_T("Encoding: "), p1) != wstring::npos) { - p1 = data.find(_T("Encoding: "), p1); - p1 = data.find(_T("\n"), p1); + while (data.find(L"Encoding: ", p1) != wstring::npos) { + p1 = data.find(L"Encoding: ", p1); + p1 = data.find(L"\n", p1); } p1 += 3; - wstring::size_type p2 = data.find(_T("-----END PGP MESSAGE-----")); + wstring::size_type p2 = data.find(L"-----END PGP MESSAGE-----"); wstring data2 = data.substr(p1, p2 - p1 - 2); strip_line_term(data2); if(bDebugLog) debuglog<<std::string(time_str() + ": jabber_api: attaching:\r\n\r\n" + toUTF8(data2) + "\n\n\t to outgoing xml"); - HXML encrypted_data = xmlAddChild(node, _T("x"), data2.c_str()); - xmlAddAttr(encrypted_data, _T("xmlns"), _T("jabber:x:encrypted")); + HXML encrypted_data = xmlAddChild(node, L"x", data2.c_str()); + xmlAddAttr(encrypted_data, L"xmlns", L"jabber:x:encrypted"); break; } - if (bPresenceSigning && nodename && _tcsstr(nodename, _T("status"))) { - TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + if (bPresenceSigning && nodename && _tcsstr(nodename, L"status")) { + TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); wstring path_out = path_c; wstring file = toUTF16(get_random(10)); mir_free(path_c); - path_out += _T("\\tmp\\"); + path_out += L"\\tmp\\"; path_out += file; boost::filesystem::remove(path_out); wfstream f(path_out.c_str(), std::ios::out); @@ -718,12 +718,12 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); if (pass[0] && bDebugLog) debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid.get() + ", trying to encrypt message from self with password"); } else { - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); if (pass[0] && bDebugLog) debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to encrypt message from self with password"); } @@ -742,7 +742,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) } cmd.push_back(L"--local-user"); - path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T("")); + path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", L""); cmd.push_back(path_c); cmd.push_back(L"--default-key"); cmd.push_back(path_c); @@ -758,7 +758,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) params.result = &result; gpg_launcher(params, boost::posix_time::seconds(15)); // TODO: handle errors boost::filesystem::remove(path_out); - path_out += _T(".asc"); + path_out += L".asc"; f.open(path_out.c_str(), std::ios::in | std::ios::ate | std::ios::binary); wstring data; if (f.is_open()) { @@ -777,24 +777,24 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) debuglog << std::string(time_str() + ": info: Failed to read prescense sign from file"); break; } - if (data.find(_T("-----BEGIN PGP SIGNATURE-----")) != wstring::npos && data.find(_T("-----END PGP SIGNATURE-----")) != wstring::npos) { - wstring::size_type p1 = data.find(_T("-----BEGIN PGP SIGNATURE-----")) + mir_tstrlen(_T("-----BEGIN PGP SIGNATURE-----")); - if (data.find(_T("Version: "), p1) != wstring::npos) { - p1 = data.find(_T("Version: "), p1); - p1 = data.find(_T("\n"), p1); - if (data.find(_T("Version: "), p1) != wstring::npos) { - p1 = data.find(_T("Version: "), p1); - p1 = data.find(_T("\n"), p1) + 1; + if (data.find(L"-----BEGIN PGP SIGNATURE-----") != wstring::npos && data.find(L"-----END PGP SIGNATURE-----") != wstring::npos) { + wstring::size_type p1 = data.find(L"-----BEGIN PGP SIGNATURE-----") + mir_tstrlen(L"-----BEGIN PGP SIGNATURE-----"); + if (data.find(L"Version: ", p1) != wstring::npos) { + p1 = data.find(L"Version: ", p1); + p1 = data.find(L"\n", p1); + if (data.find(L"Version: ", p1) != wstring::npos) { + p1 = data.find(L"Version: ", p1); + p1 = data.find(L"\n", p1) + 1; } else p1 += 1; } - if (data.find(_T("Comment: "), p1) != wstring::npos) { - p1 = data.find(_T("Comment: "), p1); - p1 = data.find(_T("\n"), p1); - if (data.find(_T("Comment: "), p1) != wstring::npos) { - p1 = data.find(_T("Comment: "), p1); - p1 = data.find(_T("\n"), p1) + 1; + if (data.find(L"Comment: ", p1) != wstring::npos) { + p1 = data.find(L"Comment: ", p1); + p1 = data.find(L"\n", p1); + if (data.find(L"Comment: ", p1) != wstring::npos) { + p1 = data.find(L"Comment: ", p1); + p1 = data.find(L"\n", p1) + 1; } else p1 += 1; @@ -802,12 +802,12 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) else p1 += 1; p1++; - wstring::size_type p2 = data.find(_T("-----END PGP SIGNATURE-----")); + wstring::size_type p2 = data.find(L"-----END PGP SIGNATURE-----"); { std::wstring tmp = data.substr(p1, p2 - p1); strip_line_term(tmp); - HXML encrypted_data = xmlAddChild(node, _T("x"), tmp.c_str()); - xmlAddAttr(encrypted_data, _T("xmlns"), _T("jabber:x:signed")); + HXML encrypted_data = xmlAddChild(node, L"x", tmp.c_str()); + xmlAddAttr(encrypted_data, L"xmlns", L"jabber:x:signed"); } } break; @@ -822,16 +822,16 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*) for (int n = 0; n <= xmlGetChildCount(node); n++) { LPCTSTR nodename = xmlGetName(local_node); if (nodename) { - if (_tcsstr(nodename, _T("x"))) { + if (_tcsstr(nodename, L"x")) { for (int i = 0; i < xmlGetAttrCount(local_node); i++) { LPCTSTR name = xmlGetAttrName(local_node, i); LPCTSTR value = xmlGetAttrValue(local_node, name); - if (_tcsstr(value, _T("jabber:x:signed"))) { + if (_tcsstr(value, L"jabber:x:signed")) { std::wstring status_str; HXML local_node2 = node; for (int k = 0; k <= xmlGetChildCount(node); k++) { LPCTSTR nodename2 = xmlGetName(local_node2); - if (_tcsstr(nodename2, _T("status"))) { + if (_tcsstr(nodename2, L"status")) { LPCTSTR status = xmlGetText(local_node2); if (status) status_str = status; @@ -840,11 +840,11 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*) local_node2 = xmlGetChild(node, k); } LPCTSTR data = xmlGetText(local_node); - wstring sign = _T("-----BEGIN PGP SIGNATURE-----\n\n"); + wstring sign = L"-----BEGIN PGP SIGNATURE-----\n\n"; wstring file = toUTF16(get_random(10)), status_file = toUTF16(get_random(10)); sign += data; - sign += _T("\n-----END PGP SIGNATURE-----\n"); - TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + sign += L"\n-----END PGP SIGNATURE-----\n"; + TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); wstring path_out = path_c, status_file_out = path_c; mir_free(path_c); path_out += L"\\tmp\\"; @@ -905,7 +905,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*) for (unsigned int m = 0; m < Accounts.size(); m++, p++) { if (!(*p)) break; - hContact = (*p)->getJabberInterface()->ContactFromJID(xmlGetAttrValue(node, _T("from"))); + hContact = (*p)->getJabberInterface()->ContactFromJID(xmlGetAttrValue(node, L"from")); if (hContact) hcontact_data[hContact].key_in_prescense = out.substr(p1, p2 - p1 - 1).c_str(); } @@ -942,12 +942,12 @@ void AddHandlers() // if((*p)->getMessageHandler() == INVALID_HANDLE_VALUE) // (*p)->setMessageHandler((*p)->getJabberInterface()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ANY ,NULL,NULL)); if (bAutoExchange) { - (*p)->getJabberInterface()->RegisterFeature(_T("GPG_Key_Auto_Exchange:0"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg plugin for Miranda IM and Miranda NG)")); - (*p)->getJabberInterface()->AddFeatures(_T("GPG_Key_Auto_Exchange:0\0\0")); + (*p)->getJabberInterface()->RegisterFeature(L"GPG_Key_Auto_Exchange:0", L"Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg plugin for Miranda IM and Miranda NG)"); + (*p)->getJabberInterface()->AddFeatures(L"GPG_Key_Auto_Exchange:0\0\0"); } if (bFileTransfers) { - (*p)->getJabberInterface()->RegisterFeature(_T("GPG_Encrypted_FileTransfers:0"), _T("Indicates that gpg installed and configured to encrypt files (currently implemented in new_gpg plugin for Miranda IM and Miranda NG)")); - (*p)->getJabberInterface()->AddFeatures(_T("GPG_Encrypted_FileTransfers:0\0\0")); + (*p)->getJabberInterface()->RegisterFeature(L"GPG_Encrypted_FileTransfers:0", L"Indicates that gpg installed and configured to encrypt files (currently implemented in new_gpg plugin for Miranda IM and Miranda NG)"); + (*p)->getJabberInterface()->AddFeatures(L"GPG_Encrypted_FileTransfers:0\0\0"); } } } @@ -961,7 +961,7 @@ bool isContactSecured(MCONTACT hContact) return false; } if (!db_mc_isMeta(hContact)) { - TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); if (!key[0]) { mir_free(key); if (bDebugLog) @@ -977,7 +977,7 @@ bool isContactSecured(MCONTACT hContact) bool isContactHaveKey(MCONTACT hContact) { - TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L""); if (mir_tstrlen(key) > 0) { mir_free(key); return true; @@ -988,7 +988,7 @@ bool isContactHaveKey(MCONTACT hContact) bool isGPGKeyExist() { - TCHAR *id = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T("")); + TCHAR *id = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", L""); char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if (id[0] && key[0]) { mir_free(id); @@ -1003,7 +1003,7 @@ bool isGPGValid() { TCHAR *tmp = NULL; bool gpg_exists = false, is_valid = true; - tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L""); boost::filesystem::path p(tmp); if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) @@ -1013,20 +1013,20 @@ bool isGPGValid() tmp = NULL; TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH); TCHAR *mir_path = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR)); - PathToAbsoluteW(_T("\\"), mir_path); + PathToAbsoluteW(L"\\", mir_path); SetCurrentDirectoryW(mir_path); tmp = mir_tstrdup(mir_path); mir_free(mir_path); //mir_realloc(path, (mir_tstrlen(path)+64)*sizeof(TCHAR)); TCHAR *gpg_path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH); mir_tstrcpy(gpg_path, tmp); - mir_tstrcat(gpg_path, _T("\\GnuPG\\gpg.exe")); + mir_tstrcat(gpg_path, L"\\GnuPG\\gpg.exe"); mir_free(tmp); tmp = NULL; p = boost::filesystem::path(gpg_path); if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) { gpg_exists = true; - mir_tstrcpy(path, _T("GnuPG\\gpg.exe")); + mir_tstrcpy(path, L"GnuPG\\gpg.exe"); } mir_free(gpg_path); tmp = mir_tstrdup(path); @@ -1059,8 +1059,8 @@ bool isGPGValid() } /* if(!gpg_exists) { - wstring path_ = _wgetenv(_T("APPDATA")); - path_ += _T("\\GnuPG"); + wstring path_ = _wgetenv(L"APPDATA"); + path_ += L"\\GnuPG"; tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", (TCHAR*)path_.c_str()); } if(tmp) @@ -1248,7 +1248,7 @@ bool isTabsrmmUsed() void ExportGpGKeysFunc(int type) { - TCHAR *p = GetFilePath(_T("Choose file to export keys"), _T("*"), _T("Any file"), true); + TCHAR *p = GetFilePath(L"Choose file to export keys", L"*", L"Any file", true); if (!p || !p[0]) { delete[] p; //TODO: handle error @@ -1430,7 +1430,7 @@ INT_PTR ExportGpGKeys(WPARAM, LPARAM) INT_PTR ImportGpGKeys(WPARAM, LPARAM) { - TCHAR *p = GetFilePath(_T("Choose file to import keys from"), _T("*"), _T("Any file")); + TCHAR *p = GetFilePath(L"Choose file to import keys from", L"*", L"Any file"); if (!p || !p[0]) { delete[] p; //TODO: handle error @@ -1616,7 +1616,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) string output; DWORD exitcode; { - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); path = ptmp; mir_free(ptmp); wstring rand = toUTF16(get_random(10)); @@ -1721,11 +1721,11 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) string output; DWORD exitcode; { - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); _tcsncpy(tmp2, ptmp, MAX_PATH - 1); mir_free(ptmp); - mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2)); boost::filesystem::remove(tmp2); wfstream f(tmp2, std::ios::out); f << toUTF16(key).c_str(); @@ -1770,15 +1770,15 @@ void fix_line_term(std::wstring &s) { if (s.empty()) return; - boost::algorithm::erase_all(s, _T("\r\r")); + boost::algorithm::erase_all(s, L"\r\r"); } void strip_line_term(std::wstring &s) { if (s.empty()) return; - boost::algorithm::erase_all(s, _T("\r")); - boost::algorithm::erase_all(s, _T("\n")); + boost::algorithm::erase_all(s, L"\r"); + boost::algorithm::erase_all(s, L"\n"); } void strip_line_term(std::string &s) @@ -1909,7 +1909,7 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf)); old_pass = toUTF8(buf); bool old_pass_match = false; - TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); + TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); if (!mir_tstrcmp(pass, buf)) old_pass_match = true; mir_free(pass); @@ -1919,7 +1919,7 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara string dbsetting = "szKey_"; dbsetting += toUTF8(key_id_global); dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); if (!mir_tstrcmp(pass, buf)) old_pass_match = true; mir_free(pass); @@ -1991,7 +1991,7 @@ void clean_temp_dir() wstring path = toUTF16(mir_path); SetCurrentDirectoryA(mir_path); delete[] mir_path; - TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L""); path += tmp; mir_free(tmp); path += L"\\tmp"; |