summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/New_GPG/src')
-rw-r--r--plugins/New_GPG/src/globals.h2
-rwxr-xr-xplugins/New_GPG/src/gpg_wrapper.cpp10
-rw-r--r--plugins/New_GPG/src/init.cpp12
-rw-r--r--plugins/New_GPG/src/jabber_account.cpp4
-rw-r--r--plugins/New_GPG/src/jabber_account.h6
-rw-r--r--plugins/New_GPG/src/log.cpp2
-rw-r--r--plugins/New_GPG/src/log.h4
-rwxr-xr-xplugins/New_GPG/src/main.cpp162
-rwxr-xr-xplugins/New_GPG/src/messages.cpp32
-rwxr-xr-xplugins/New_GPG/src/options.cpp80
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp128
-rw-r--r--plugins/New_GPG/src/utilities.h10
12 files changed, 226 insertions, 226 deletions
diff --git a/plugins/New_GPG/src/globals.h b/plugins/New_GPG/src/globals.h
index a895bfd977..4a8c6f2cb5 100644
--- a/plugins/New_GPG/src/globals.h
+++ b/plugins/New_GPG/src/globals.h
@@ -17,7 +17,7 @@
#ifndef GLOBALS_H
#define GLOBALS_H
extern bool bAppendTags, bPresenceSigning, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used, bSameAction, bFileTransfers, bDebugLog;
-extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag;
+extern wchar_t *inopentag, *inclosetag, *outopentag, *outclosetag;
extern logtofile debuglog;
extern map<int, MCONTACT> user_data;
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp
index 1e2fcfce97..ef52cbe196 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", L"");
+ wchar_t *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", L"");
+ wchar_t *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");
@@ -80,7 +80,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae
file_descriptor_sink sout(pout.sink, close_handle);
file_descriptor_sink serr(perr.sink, close_handle);
- TCHAR *mir_path = new TCHAR [MAX_PATH];
+ wchar_t *mir_path = new wchar_t [MAX_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)));
@@ -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", L"");
+ wchar_t *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", L"");
+ wchar_t *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 9a84c466ee..a2dee64295 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -18,7 +18,7 @@
//global variables
bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
-TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
+wchar_t *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
list <JabberAccount*> Accounts;
@@ -186,35 +186,35 @@ extern "C" int __declspec(dllexport) Load()
mi.position = -0x7FFFFFFF;
mi.flags = CMIF_TCHAR;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mi.name.t = LPGENT("Load GPG public key");
+ mi.name.w = LPGENW("Load GPG public key");
mi.pszService = "/LoadPubKey";
hLoadPubKey = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0xc8008193, 0x56a9, 0x414a, 0x82, 0x98, 0x78, 0xe8, 0xa8, 0x84, 0x20, 0x67);
mi.position = -0x7FFFFFFe;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mi.name.t = LPGENT("Toggle GPG encryption");
+ mi.name.w = LPGENW("Toggle GPG encryption");
mi.pszService = "/ToggleEncryption";
hToggleEncryption = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x42bb535f, 0xd58e, 0x4edb, 0xbf, 0x2c, 0xfa, 0x9a, 0xbf, 0x1e, 0xb8, 0x69);
mi.position = -0x7FFFFFFd;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mi.name.t = LPGENT("Send public key");
+ mi.name.w = LPGENW("Send public key");
mi.pszService = "/SendKey";
hSendKey = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x33a204b2, 0xe3c0, 0x413b, 0xbf, 0xd8, 0x8b, 0x2e, 0x3d, 0xa0, 0xef, 0xa4);
mi.position = -0x7FFFFFFe;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mi.name.t = LPGENT("Export GPG Public keys");
+ mi.name.w = LPGENW("Export GPG Public keys");
mi.pszService = "/ExportGPGKeys";
hExportGpgKeys = Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x627fcfc1, 0x4e60, 0x4428, 0xaf, 0x96, 0x11, 0x42, 0x24, 0xeb, 0x7, 0xea);
mi.position = -0x7FFFFFFF;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mi.name.t = LPGENT("Import GPG Public keys");
+ mi.name.w = LPGENW("Import GPG Public keys");
mi.pszService = "/ImportGPGKeys";
hImportGpgKeys = Menu_AddMainMenuItem(&mi);
diff --git a/plugins/New_GPG/src/jabber_account.cpp b/plugins/New_GPG/src/jabber_account.cpp
index 879e6c7a48..29f561d5e2 100644
--- a/plugins/New_GPG/src/jabber_account.cpp
+++ b/plugins/New_GPG/src/jabber_account.cpp
@@ -16,7 +16,7 @@
#include "stdafx.h"
-void JabberAccount::setAccountName(TCHAR *Name)
+void JabberAccount::setAccountName(wchar_t *Name)
{
AccountName = Name;
}
@@ -42,7 +42,7 @@ void JabberAccount::setMessageHandler(HJHANDLER hHandler)
}
-TCHAR *JabberAccount::getAccountName()
+wchar_t *JabberAccount::getAccountName()
{
return AccountName;
}
diff --git a/plugins/New_GPG/src/jabber_account.h b/plugins/New_GPG/src/jabber_account.h
index b643ed1636..8086c0ea6a 100644
--- a/plugins/New_GPG/src/jabber_account.h
+++ b/plugins/New_GPG/src/jabber_account.h
@@ -18,14 +18,14 @@
class JabberAccount
{
public:
- void setAccountName(TCHAR *Name);
+ void setAccountName(wchar_t *Name);
void setAccountNumber(int Number);
void setJabberInterface(IJabberInterface *JIf);
void setSendHandler(HJHANDLER hHandler);
void setPrescenseHandler(HJHANDLER hHandler);
void setMessageHandler(HJHANDLER hHandler);
- TCHAR *getAccountName();
+ wchar_t *getAccountName();
int getAccountNumber();
IJabberInterface *getJabberInterface();
HJHANDLER getSendHandler();
@@ -34,7 +34,7 @@ public:
~JabberAccount();
JabberAccount();
private:
- TCHAR *AccountName;
+ wchar_t *AccountName;
int AccountNumber;
IJabberInterface *JabberInterface;
HJHANDLER hSendHandler, hPrescenseHandler, hMessageHandler;
diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp
index 87c72605da..362344c46f 100644
--- a/plugins/New_GPG/src/log.cpp
+++ b/plugins/New_GPG/src/log.cpp
@@ -17,7 +17,7 @@
#include "stdafx.h"
-logtofile& logtofile::operator<<(TCHAR *buf)
+logtofile& logtofile::operator<<(wchar_t *buf)
{
if(_bDebugLog != bDebugLog)
init();
diff --git a/plugins/New_GPG/src/log.h b/plugins/New_GPG/src/log.h
index 9d1dcb39e6..9bb7a0dae9 100644
--- a/plugins/New_GPG/src/log.h
+++ b/plugins/New_GPG/src/log.h
@@ -19,7 +19,7 @@
class logtofile
{
public:
- logtofile& operator<<(TCHAR *buf);
+ logtofile& operator<<(wchar_t *buf);
logtofile& operator<<(char *buf);
logtofile& operator<<(string buf);
logtofile& operator<<(wstring buf);
@@ -28,7 +28,7 @@ public:
logtofile();
private:
fstream log;
- TCHAR *path;
+ wchar_t *path;
boost::mutex log_mutex;
bool _bDebugLog;
};
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 8e50ba8998..d3e7d1679b 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -30,14 +30,14 @@ int itemnum = 0;
HWND hwndList_g = NULL;
BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting);
-TCHAR key_id_global[17] = { 0 };
+wchar_t key_id_global[17] = { 0 };
static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_KEY_LIST);
hwndList_g = hwndList;
LVITEM item = { 0 };
- TCHAR fp[16] = { 0 };
+ wchar_t fp[16] = { 0 };
switch (uMsg) {
case WM_INITDIALOG:
{
@@ -124,7 +124,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
break;
stop = p;
p2 = out.find("/", p) - 1;
- TCHAR *key_len = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str()), *creation_date = NULL, *expire_date = NULL;
+ wchar_t *key_len = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str()), *creation_date = NULL, *expire_date = NULL;
p2 += 2;
p = out.find(" ", p2);
std::wstring key_id = toUTF16(out.substr(p2, p - p2));
@@ -149,19 +149,19 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
bool expired = false;
{
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
- TCHAR buf[5];
- _tcsncpy_s(buf, expire_date, _TRUNCATE);
- int year = _ttoi(buf);
+ wchar_t buf[5];
+ wcsncpy_s(buf, expire_date, _TRUNCATE);
+ int year = _wtoi(buf);
if (year < now.date().year())
expired = true;
else if (year == now.date().year()) {
- _tcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
- int month = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
+ int month = _wtoi(buf);
if (month < now.date().month())
expired = true;
else if (month == now.date().month()) {
- _tcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
- unsigned day = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
+ unsigned day = _wtoi(buf);
if (day <= now.date().day_number())
expired = true;
}
@@ -191,19 +191,19 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
ListView_SetItemText(hwndList, iRow, 5, key_len);
mir_free(key_len);
- ListView_SetItemText(hwndList, iRow, 0, (TCHAR*)key_id.c_str());
+ ListView_SetItemText(hwndList, iRow, 0, (wchar_t*)key_id.c_str());
p = out.find("uid ", p);
p2 = out.find_first_not_of(" ", p + 5);
p = out.find("<", p2);
wstring tmp = toUTF16(out.substr(p2, p - p2));
- ListView_SetItemText(hwndList, iRow, 2, (TCHAR*)tmp.c_str());
+ ListView_SetItemText(hwndList, iRow, 2, (wchar_t*)tmp.c_str());
p++;
p2 = out.find(">", p);
tmp = toUTF16(out.substr(p, p2 - p));
- ListView_SetItemText(hwndList, iRow, 1, (TCHAR*)tmp.c_str());
+ ListView_SetItemText(hwndList, iRow, 1, (wchar_t*)tmp.c_str());
// get accounts
int count = 0;
@@ -216,7 +216,7 @@ 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(), L"");
+ wchar_t *str = UniGetContactSettingUtf(NULL, szGPGModuleName, setting.c_str(), L"");
if (key_id == str) {
if (!accs.empty())
accs += L",";
@@ -224,7 +224,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
mir_free(str);
}
- ListView_SetItemText(hwndList, iRow, 6, (TCHAR*)accs.c_str());
+ ListView_SetItemText(hwndList, iRow, 6, (wchar_t*)accs.c_str());
}
i++;
@@ -274,10 +274,10 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case ID_OK:
{
ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp));
- TCHAR *name = new TCHAR[64];
+ wchar_t *name = new wchar_t[64];
ListView_GetItemText(hwndList, itemnum, 2, name, 64);
{
- if (_tcschr(name, _T('('))) {
+ if (wcschr(name, '(')) {
wstring str = name;
wstring::size_type p = str.find(L"(") - 1;
mir_tstrcpy(name, str.substr(0, p).c_str());
@@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
SetWindowText(hwndCurKey_p, keyinfo.c_str());
}
}
- TCHAR passwd[64];
+ wchar_t passwd[64];
GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, _countof(passwd));
if (passwd[0]) {
string dbsetting = "szKey_";
@@ -386,7 +386,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
break;
stop = p;
p2 = out.find("/", p) - 1;
- TCHAR *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
+ wchar_t *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
item.pszText = tmp;
iRow = ListView_InsertItem(hwndList, &item);
ListView_SetItemText(hwndList, iRow, 4, tmp);
@@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
string::size_type s = out.find("Key fingerprint = ");
s += mir_strlen("Key fingerprint = ");
string::size_type s2 = out.find("\n", s);
- TCHAR *str = NULL;
+ wchar_t *str = NULL;
{
string tmp = out.substr(s, s2 - s - 1).c_str();
string::size_type p = 0;
@@ -505,7 +505,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
wstring path;
{
// generating key file
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
path = tmp;
mir_free(tmp);
path.append(L"\\new_key");
@@ -660,7 +660,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
char *szKey = (char*)GlobalLock(hMem);
if (!szKey) {
- TCHAR msg[64];
+ wchar_t msg[64];
mir_sntprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
@@ -671,7 +671,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg, UINT uMsg, WPARAM wParam,
GlobalUnlock(hMem);
if (!SetClipboardData(CF_OEMTEXT, hMem)) {
GlobalFree(hMem);
- TCHAR msg[64];
+ wchar_t msg[64];
mir_sntprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, 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(L"Choose file to export key", L"*", L"Any file", true);
+ wchar_t *p = GetFilePath(L"Choose file to export key", L"*", L"Any file", true);
if (!p || !p[0]) {
delete[] p;
//TODO: handle error
@@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH);
+ wchar_t *path = (wchar_t*)mir_alloc(sizeof(wchar_t) * MAX_PATH);
bool gpg_exists = false, lang_exists = false;
{
ptrA mir_path((char*)mir_alloc(sizeof(char) * MAX_PATH));
@@ -817,7 +817,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!gpg_exists) {
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))
+ if (!boost::filesystem::exists((wchar_t*)tmp))
MessageBox(0, TranslateT("Wrong GPG binary location found in system.\nPlease choose another location"), TranslateT("Warning"), MB_OK);
}
else tmp = mir_wstrdup(path);
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_SET_BIN_PATH:
{
GetFilePath(L"Choose gpg.exe", "szGpgBinPath", L"*.exe", L"EXE Executables");
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe");
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
char mir_path[MAX_PATH];
char *atmp = mir_t2a(tmp);
@@ -904,7 +904,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_SET_HOME_DIR:
{
GetFolderPath(L"Set home directory", "szHomePath");
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
char mir_path[MAX_PATH];
char *atmp = mir_t2a(tmp);
@@ -920,7 +920,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case ID_OK:
{
- TCHAR tmp[512];
+ wchar_t tmp[512];
GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
if (tmp[0]) {
char *mir_path = new char[MAX_PATH];
@@ -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", L"");
+ wchar_t *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
DWORD dwFileAttr = GetFileAttributes(path);
if (dwFileAttr != INVALID_FILE_ATTRIBUTES) {
dwFileAttr &= ~FILE_ATTRIBUTE_READONLY;
@@ -991,7 +991,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case IDC_GENERATE_RANDOM:
{
- TCHAR tmp[512];
+ wchar_t tmp[512];
GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
if (tmp[0]) {
char *mir_path = new char[MAX_PATH];
@@ -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", L"");
+ wchar_t *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
DWORD dwFileAttr = GetFileAttributes(path);
if (dwFileAttr != INVALID_FILE_ATTRIBUTES) {
dwFileAttr &= ~FILE_ATTRIBUTE_READONLY;
@@ -1058,7 +1058,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
wstring path;
{ //generating key file
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
path = tmp;
mir_free(tmp);
path.append(L"\\new_key");
@@ -1190,13 +1190,13 @@ 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", L"");
+ wchar_t *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"));
mir_free(tmp);
- tmp = new TCHAR[256];
- mir_sntprintf(tmp, 255 * sizeof(TCHAR), TranslateT("Received key from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ tmp = new wchar_t[256];
+ mir_sntprintf(tmp, 255 * sizeof(wchar_t), TranslateT("Received key from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp);
delete[] tmp;
}
@@ -1267,7 +1267,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
{
wstring path;
{ //data sanity checks
- TCHAR *tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 5);
+ wchar_t *tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5);
GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5);
if (mir_tstrlen(tmp) < 3) {
mir_free(tmp); tmp = NULL;
@@ -1276,15 +1276,15 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
}
if (tmp)
mir_free(tmp);
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 6);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 6);
GetDlgItemText(hwndDlg, IDC_KEY_LENGTH, tmp, 5);
- int length = _ttoi(tmp);
+ int length = _wtoi(tmp);
mir_free(tmp);
if (length < 1024 || length > 4096) {
MessageBox(0, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK);
break;
}
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 12);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 12);
GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 11);
if (mir_tstrlen(tmp) != 10 && tmp[0] != '0') {
MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK);
@@ -1292,22 +1292,22 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
break;
}
mir_free(tmp);
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 128);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128);
GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 127);
if (mir_tstrlen(tmp) < 5) {
MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK);
mir_free(tmp);
break;
}
- else if (_tcschr(tmp, _T('(')) || _tcschr(tmp, _T(')'))) {
+ else if (wcschr(tmp, '(') || wcschr(tmp, ')')) {
MessageBox(0, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK);
mir_free(tmp);
break;
}
mir_free(tmp);
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 128);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128);
GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128);
- if ((mir_tstrlen(tmp)) < 5 || (!_tcschr(tmp, _T('@'))) || (!_tcschr(tmp, _T('.')))) {
+ if ((mir_tstrlen(tmp)) < 5 || (!wcschr(tmp, '@')) || (!wcschr(tmp, '.'))) {
MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK);
mir_free(tmp);
break;
@@ -1315,7 +1315,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
mir_free(tmp);
}
{ //generating key file
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
char *tmp2;// = mir_t2a(tmp);
path = tmp;
mir_free(tmp);
@@ -1327,7 +1327,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
break;
}
f << "Key-Type: ";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 5);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5);
GetDlgItemText(hwndDlg, IDC_KEY_TYPE, tmp, 5);
tmp2 = mir_t2a(tmp);
mir_free(tmp);
@@ -1340,9 +1340,9 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
mir_free(tmp2);
f << "\n";
f << "Key-Length: ";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 5);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 5);
GetDlgItemText(hwndDlg, IDC_KEY_LENGTH, tmp, 5);
- int length = _ttoi(tmp);
+ int length = _wtoi(tmp);
mir_free(tmp);
f << length;
f << "\n";
@@ -1353,7 +1353,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
f << subkeytype;
mir_free(subkeytype);
f << "\n";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 64); //i hope this is enough for password
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 64); //i hope this is enough for password
GetDlgItemText(hwndDlg, IDC_KEY_PASSWD, tmp, 64);
if (tmp[0]) {
f << "Passphrase: ";
@@ -1364,14 +1364,14 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
}
mir_free(tmp);
f << "Name-Real: ";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 128);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128);
GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 128);
tmp2 = mir_strdup(toUTF8(tmp).c_str());
f << tmp2;
mir_free(tmp2);
mir_free(tmp);
f << "\n";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 512);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 512);
GetDlgItemText(hwndDlg, IDC_KEY_COMMENT, tmp, 512);
if (tmp[0]) {
tmp2 = mir_strdup(toUTF8(tmp).c_str());
@@ -1382,7 +1382,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
mir_free(tmp2);
mir_free(tmp);
f << "Name-Email: ";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 128);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 128);
GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128);
tmp2 = mir_strdup(toUTF8(tmp).c_str());
f << tmp2;
@@ -1390,7 +1390,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
mir_free(tmp);
f << "\n";
f << "Expire-Date: ";
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * 12);
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * 12);
GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 12);
tmp2 = mir_strdup(toUTF8(tmp).c_str());
f << tmp2;
@@ -1462,7 +1462,7 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
break;
stop = p;
p2 = out.find("/", p) - 1;
- TCHAR *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
+ wchar_t *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
item.pszText = tmp;
iRow = ListView_InsertItem(hwndList_g, &item);
ListView_SetItemText(hwndList_g, iRow, 4, tmp);
@@ -1540,7 +1540,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP
LVCOLUMN col = { 0 };
LVITEM item = { 0 };
NMLISTVIEW * hdr = (NMLISTVIEW *)lParam;
- TCHAR id[16] = { 0 };
+ wchar_t id[16] = { 0 };
switch (msg) {
case WM_INITDIALOG:
{
@@ -1614,7 +1614,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP
break;
stop = p;
p2 = out.find("/", p) - 1;
- TCHAR *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
+ wchar_t *tmp = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
item.pszText = tmp;
iRow = ListView_InsertItem(hwndList, &item);
ListView_SetItemText(hwndList, iRow, 5, tmp);
@@ -1714,7 +1714,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg, UINT msg, WPARAM wP
if (p2 != std::string::npos) {
p2 += mir_strlen("-----END PGP PUBLIC KEY BLOCK-----");
out = out.substr(p1, p2 - p1);
- TCHAR *tmp = mir_a2t(out.c_str());
+ wchar_t *tmp = mir_a2t(out.c_str());
SetWindowText(hPubKeyEdit, tmp);
mir_free(tmp);
}
@@ -1786,7 +1786,7 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP
DWORD code;
std::vector<wstring> cmd;
cmd.push_back(L"--keyserver");
- TCHAR *server = new TCHAR[128];
+ wchar_t *server = new wchar_t[128];
GetDlgItemText(hwndDlg, IDC_KEYSERVER, server, 128);
cmd.push_back(server);
delete[] server;
@@ -1875,13 +1875,13 @@ void InitCheck()
{
{
// parse gpg output
- TCHAR *current_home = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *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", L"");
+ wchar_t *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
std::wstring test_path = home_dir;
mir_free(home_dir);
test_path += L"/";
@@ -1908,8 +1908,8 @@ void InitCheck()
boost::filesystem::remove(test_path);
}
if (!home_dir_access || !temp_access || !gpg_valid) {
- TCHAR buf[4096];
- _tcsncpy(buf, gpg_valid ? TranslateT("GPG binary is set and valid (this is good).\n") : TranslateT("GPG binary unset or invalid (plugin will not work).\n"), _countof(buf));
+ wchar_t buf[4096];
+ wcsncpy(buf, gpg_valid ? TranslateT("GPG binary is set and valid (this is good).\n") : TranslateT("GPG binary unset or invalid (plugin will not work).\n"), _countof(buf));
mir_tstrncat(buf, home_dir_access ? TranslateT("Home dir write access granted (this is good).\n") : TranslateT("Home dir has no write access (plugin most probably will not work).\n"), _countof(buf) - mir_tstrlen(buf));
mir_tstrncat(buf, temp_access ? TranslateT("Temp dir write access granted (this is good).\n") : TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_tstrlen(buf));
if (!gpg_valid)
@@ -1977,23 +1977,23 @@ void InitCheck()
p += mir_strlen("expires:");
p++;
p2 = out.find("]", p);
- TCHAR *expire_date = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
+ wchar_t *expire_date = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
bool expired = false;
{
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
- TCHAR buf[5];
- _tcsncpy_s(buf, expire_date, _TRUNCATE);
- int year = _ttoi(buf);
+ wchar_t buf[5];
+ wcsncpy_s(buf, expire_date, _TRUNCATE);
+ int year = _wtoi(buf);
if (year < now.date().year())
expired = true;
else if (year == now.date().year()) {
- _tcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
- int month = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
+ int month = _wtoi(buf);
if (month < now.date().month())
expired = true;
else if (month == now.date().month()) {
- _tcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
- unsigned day = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
+ unsigned day = _wtoi(buf);
if (day <= now.date().day_number())
expired = true;
}
@@ -2037,23 +2037,23 @@ void InitCheck()
p += mir_strlen("expires:");
p++;
p2 = out.find("]", p);
- TCHAR *expire_date = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
+ wchar_t *expire_date = mir_wstrdup(toUTF16(out.substr(p, p2 - p)).c_str());
bool expired = false;
{
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
- TCHAR buf[5];
- _tcsncpy_s(buf, expire_date, _TRUNCATE);
- int year = _ttoi(buf);
+ wchar_t buf[5];
+ wcsncpy_s(buf, expire_date, _TRUNCATE);
+ int year = _wtoi(buf);
if (year < now.date().year())
expired = true;
else if (year == now.date().year()) {
- _tcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
- int month = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 5), _TRUNCATE);
+ int month = _wtoi(buf);
if (month < now.date().month())
expired = true;
else if (month == now.date().month()) {
- _tcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
- unsigned day = _ttoi(buf);
+ wcsncpy_s(buf, (expire_date + 8), _TRUNCATE);
+ unsigned day = _wtoi(buf);
if (day <= now.date().day_number())
expired = true;
}
@@ -2072,7 +2072,7 @@ void InitCheck()
mir_free(key);
}
{
- TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
DWORD dwFileAttr = GetFileAttributes(path);
if (dwFileAttr != INVALID_FILE_ATTRIBUTES) {
dwFileAttr &= ~FILE_ATTRIBUTE_READONLY;
@@ -2135,9 +2135,9 @@ void ImportKey()
// gpg execute block
std::vector<wstring> cmd;
- TCHAR tmp2[MAX_PATH] = { 0 };
+ wchar_t tmp2[MAX_PATH] = { 0 };
{
- _tcsncpy(tmp2, ptrT(UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"")), MAX_PATH - 1);
+ wcsncpy(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);
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index de5940cb32..7ea7e6f1eb 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -105,14 +105,14 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWOR
mir_free(tmp);
f.close();
}
- extern TCHAR *password;
+ extern wchar_t *password;
string out;
DWORD code;
std::vector<wstring> cmd;
cmd.push_back(L"--batch");
{
char *inkeyid = UniGetContactSettingUtf(db_mc_isMeta(hContact) ? metaGetMostOnline(hContact) : hContact, szGPGModuleName, "InKeyID", "");
- TCHAR *pass = NULL;
+ wchar_t *pass = NULL;
if (inkeyid[0]) {
string dbsetting = "szKey_";
dbsetting += inkeyid;
@@ -422,7 +422,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1, s2 - s1).c_str());
{ //gpg execute block
std::vector<wstring> cmd;
- TCHAR tmp2[MAX_PATH] = { 0 };
+ wchar_t tmp2[MAX_PATH] = { 0 };
string output;
DWORD exitcode;
{
@@ -430,7 +430,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
mir_tstrcpy(tmp2, ptmp);
mir_free(ptmp);
mir_tstrcat(tmp2, L"\\");
- TCHAR *tmp3 = mir_a2t(get_random(5).c_str());
+ wchar_t *tmp3 = mir_a2t(get_random(5).c_str());
mir_tstrcat(tmp2, tmp3);
mir_tstrcat(tmp2, L".asc");
mir_free(tmp3);
@@ -460,7 +460,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
}
}
ptmp = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "GPGPubKey", L"");
- f << (TCHAR*)ptmp;
+ f << (wchar_t*)ptmp;
f.close();
cmd.push_back(L"--batch");
cmd.push_back(L"--import");
@@ -613,14 +613,14 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
}
else
{
- TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L"");
+ wchar_t *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L"");
if (jid[0])
{
extern list <JabberAccount*> Accounts;
list<JabberAccount*>::iterator end = Accounts.end();
for (list<JabberAccount*>::iterator p = Accounts.begin(); p != end; p++)
{
- TCHAR *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
+ wchar_t *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
if (caps)
{
wstring str1;
@@ -666,7 +666,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
std::vector<std::wstring> cmd;
extern bool bJabberAPI, bIsMiranda09;
{
- TCHAR *tmp2;
+ wchar_t *tmp2;
{
char *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", "");
if (!tmp[0]) {
@@ -695,7 +695,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
mir_free(tmp2);
}
{
- TCHAR *tmp2 = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *tmp2 = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
path = tmp2;
cmd.push_back(std::wstring(tmp2) + L"\\tmp\\" + file);
mir_free(tmp2);
@@ -813,7 +813,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
str.clear();
if (f.is_open()) {
std::wifstream::pos_type size = f.tellg();
- TCHAR *tmp = new TCHAR[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
+ wchar_t *tmp = new wchar_t[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
f.seekg(0, std::ios::beg);
f.read(tmp, size);
tmp[size] = '\0';
@@ -887,7 +887,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
return 0;
MCONTACT hContact = (MCONTACT)w;
if (dbei->flags & DBEF_SENT) {
- if (isContactSecured(hContact) && strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----")) //our service data, can be double added by metacontacts e.t.c.
+ if (isContactSecured(hContact) && strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----")) //our service data, can be double added by metacontacts e.w.c.
{
if (bDebugLog)
debuglog << std::string(time_str() + ": info(send handler): block pgp message event, name: " + toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
@@ -933,14 +933,14 @@ int HookSendMsg(WPARAM w, LPARAM l)
}
}
else {
- TCHAR *jid = UniGetContactSettingUtf(hContact, proto, "jid", L"");
+ wchar_t *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)));
extern list <JabberAccount*> Accounts;
list<JabberAccount*>::iterator end = Accounts.end();
for (list<JabberAccount*>::iterator p = Accounts.begin(); p != end; p++) {
- TCHAR *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
+ wchar_t *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
if (caps) {
wstring str;
for (int i = 0;; i++) {
@@ -1024,10 +1024,10 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
switch (LOWORD(wParam)) {
case IDOK:
{
- TCHAR tmp[64];
+ wchar_t tmp[64];
GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, _countof(tmp));
if (tmp[0]) {
- extern TCHAR *password;
+ extern wchar_t *password;
if (IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) {
inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", "");
if (inkeyid && inkeyid[0] && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) {
@@ -1040,7 +1040,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
}
if (password)
mir_free(password);
- password = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp) + 1));
+ password = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(tmp) + 1));
mir_tstrcpy(password, tmp);
}
mir_free(inkeyid);
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 2b4caf0911..68595f9ce9 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -43,25 +43,25 @@ int GpgOptInit(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG);
- odp.ptszTitle = _T(szGPGModuleName);
- odp.ptszGroup = LPGENT("Services");
- odp.ptszTab = LPGENT("Main");
+ odp.pwszTitle = _T(szGPGModuleName);
+ odp.pwszGroup = LPGENW("Services");
+ odp.pwszTab = LPGENW("Main");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcGpgOpts;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_BIN);
- odp.ptszTab = LPGENT("GnuPG Variables");
+ odp.pwszTab = LPGENW("GnuPG Variables");
odp.pfnDlgProc = DlgProcGpgBinOpts;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_MESSAGES);
- odp.ptszTab = LPGENT("Messages");
+ odp.pwszTab = LPGENW("Messages");
odp.pfnDlgProc = DlgProcGpgMsgOpts;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_ADVANCED);
- odp.ptszTab = LPGENT("Advanced");
+ odp.pwszTab = LPGENW("Advanced");
odp.pfnDlgProc = DlgProcGpgAdvOpts;
Options_AddPage(wParam, &odp);
return 0;
@@ -120,7 +120,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
int i = 1, iRow = 0;
for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
if (isContactHaveKey(hContact)) {
- TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
item.mask = LVIF_TEXT;
item.iItem = i;
item.iSubItem = 0;
@@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
iRow = ListView_InsertItem(hwndList, &item);
ListView_SetItemText(hwndList, iRow, 0, name);
- TCHAR *tmp = mir_a2t(GetContactProto(hContact));
+ wchar_t *tmp = mir_a2t(GetContactProto(hContact));
ListView_SetItemText(hwndList, iRow, 4, tmp);
mir_free(tmp);
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
i++;
}
}
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", L"");
+ wchar_t *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);
@@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
void setClistIcon(MCONTACT hContact);
void setSrmmIcon(MCONTACT hContact);
{ //gpg execute block
- TCHAR *ptmp;
+ wchar_t *ptmp;
char *tmp;
bool keep = false;
bool ismetacontact = false;
@@ -304,7 +304,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case IDC_SAVE_KEY_BUTTON:
{
- TCHAR *tmp = GetFilePath(TranslateT("Export public key"), L"*", TranslateT(".asc pubkey file"), true);
+ wchar_t *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", L"")));
wstring::size_type s = 0;
@@ -332,7 +332,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
szKey = (char*)GlobalLock(hMem);
if (!szKey) {
- TCHAR msg[64];
+ wchar_t msg[64];
mir_sntprintf(msg, TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
@@ -345,7 +345,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
GlobalUnlock(hMem);
if (!SetClipboardData(CF_OEMTEXT, hMem)) {
GlobalFree(hMem);
- TCHAR msg[64];
+ wchar_t msg[64];
mir_sntprintf(msg, TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
@@ -353,7 +353,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
}
else {
- TCHAR msg[64];
+ wchar_t msg[64];
mir_sntprintf(msg, TranslateT("Failed to open clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
@@ -397,7 +397,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0;
{
- TCHAR tmp[512];
+ wchar_t tmp[512];
GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
@@ -424,7 +424,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_SET_BIN_PATH:
{
GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", L"*.exe", TranslateT("EXE Executables"));
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"gpg.exe");
+ wchar_t *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", L"");
+ wchar_t *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"");
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
@@ -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", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
char mir_path[MAX_PATH];
char *atmp = mir_t2a(tmp);
@@ -503,7 +503,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- TCHAR tmp[512];
+ wchar_t tmp[512];
GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
@@ -526,7 +526,7 @@ 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", L"<GPGdec>");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", L"<GPGdec>");
SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp);
mir_free(tmp);
tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", L"</GPGdec>");
@@ -565,26 +565,26 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags") != 0;
bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags") != 0;
{
- TCHAR tmp[128];
+ wchar_t tmp[128];
GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
- inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp) + 1));
+ inopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
mir_tstrcpy(inopentag, tmp);
GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
- inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp) + 1));
+ inclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
mir_tstrcpy(inclosetag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
- outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp) + 1));
+ outopentag = (wchar_t*)mir_alloc(sizeof(wchar_t)* (mir_tstrlen(tmp) + 1));
mir_tstrcpy(outopentag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
- outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp) + 1));
+ outclosetag = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(tmp) + 1));
mir_tstrcpy(outclosetag, tmp);
}
return TRUE;
@@ -679,7 +679,7 @@ 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", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", L"");
wstring str = tmp;
mir_free(tmp); tmp = NULL;
if (!str.empty()) {
@@ -713,7 +713,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
if ((out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----") != string::npos) && (out.find("-----END PGP PUBLIC KEY BLOCK-----") != string::npos)) {
boost::algorithm::replace_all(out, "\n", "\r\n");
- TCHAR *tmp3 = mir_a2t(out.c_str());
+ wchar_t *tmp3 = mir_a2t(out.c_str());
str.clear();
str.append(tmp3);
mir_free(tmp3);
@@ -747,8 +747,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
switch (LOWORD(wParam)) {
case ID_OK:
{
- TCHAR *tmp = new TCHAR[40960];
- TCHAR *begin, *end;
+ wchar_t *tmp = new wchar_t[40960];
+ wchar_t *begin, *end;
GetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, tmp, 40960);
key_buf.append(tmp);
key_buf.append(L"\n"); //no new line at end of file )
@@ -758,15 +758,15 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
}
ws1 = 0;
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));
+ begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (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));
+ end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----END PGP PUBLIC KEY BLOCK-----") + 1));
mir_tstrcpy(end, L"-----END PGP PUBLIC 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));
+ begin = (wchar_t*)mir_alloc(sizeof(wchar_t) * (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));
+ end = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(L"-----END PGP PRIVATE KEY BLOCK-----") + 1));
mir_tstrcpy(end, L"-----END PGP PRIVATE KEY BLOCK-----");
}
else {
@@ -790,18 +790,18 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
}
else db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1, ws2 - ws1).c_str());
}
- tmp = (TCHAR*)mir_alloc(sizeof(TCHAR) * (key_buf.length() + 1));
+ tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * (key_buf.length() + 1));
mir_tstrcpy(tmp, key_buf.substr(ws1, ws2 - ws1).c_str());
{ //gpg execute block
std::vector<wstring> cmd;
- TCHAR tmp2[MAX_PATH] = { 0 };
- TCHAR *ptmp;
+ wchar_t tmp2[MAX_PATH] = { 0 };
+ wchar_t *ptmp;
string output;
DWORD exitcode;
{
MCONTACT hcnt = db_mc_tryMeta(hContact);
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
- _tcsncpy(tmp2, ptmp, MAX_PATH - 1);
+ wcsncpy(tmp2, ptmp, MAX_PATH - 1);
mir_free(ptmp);
mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2));
mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2));
@@ -1004,7 +1004,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
}
}
if (!hContact) {
- TCHAR *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", L"");
+ wchar_t *fp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", L"");
{
string out;
DWORD code;
@@ -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"), L"*", TranslateT("GPG public key file"));
+ wchar_t *tmp = GetFilePath(TranslateT("Set file containing GPG public key"), L"*", TranslateT("GPG public key file"));
if (!tmp)
break;
@@ -1081,7 +1081,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg, UINT uMsg, WPARAM wPa
}
if (f.is_open()) {
std::wifstream::pos_type size = f.tellg();
- TCHAR *temp = new TCHAR[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
+ wchar_t *temp = new wchar_t[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
f.seekg(0, std::ios::beg);
f.read(temp, size);
temp[size] = '\0';
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 4de5fc75a8..1a169bbcb3 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -24,10 +24,10 @@ extern HINSTANCE hInst;
extern HANDLE hLoadPublicKey;
extern HGENMENU hToggleEncryption, hSendKey;
-TCHAR* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule, const char* szSetting, TCHAR* szDef)
+wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule, const char* szSetting, wchar_t* szDef)
{
DBVARIANT dbv = { DBVT_DELETED };
- TCHAR* szRes = NULL;
+ wchar_t* szRes = NULL;
if (db_get_ts(hContact, szModule, szSetting, &dbv))
return mir_tstrdup(szDef);
else if (dbv.pszVal)
@@ -53,22 +53,22 @@ char* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,
return szRes;
}
-void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc)
+void GetFilePath(wchar_t *WindowTittle, char *szSetting, wchar_t *szExt, wchar_t *szExtDesc)
{
- TCHAR str[MAX_PATH + 2] = { 0 }, *tmp;
+ wchar_t str[MAX_PATH + 2] = { 0 }, *tmp;
OPENFILENAME ofn = { 0 };
- TCHAR filter[512], *pfilter;
+ wchar_t filter[512], *pfilter;
ofn.lStructSize = CDSIZEOF_STRUCT(OPENFILENAME, lpTemplateName);
ofn.Flags = OFN_EXPLORER;
ofn.lpstrTitle = TranslateW(WindowTittle);
- _tcsncpy(filter, TranslateW(szExtDesc), _countof(filter) - 1);
+ wcsncpy(filter, TranslateW(szExtDesc), _countof(filter) - 1);
pfilter = filter + mir_tstrlen(filter) + 1;
mir_tstrcpy(pfilter, szExt);
pfilter[mir_tstrlen(pfilter) + 1] = '\0';
pfilter[mir_tstrlen(pfilter) + 2] = '\0';
ofn.lpstrFilter = filter;
tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, L"");
- _tcsncpy(str, tmp, _countof(str) - 1);
+ wcsncpy(str, tmp, _countof(str) - 1);
mir_free(tmp);
if (mir_tstrlen(str) < 2)
str[0] = '\0';
@@ -80,11 +80,11 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx
db_set_ts(0, szGPGModuleName, szSetting, str);
}
-TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file)
+wchar_t *GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, bool save_file)
{
- TCHAR *str = new TCHAR[MAX_PATH + 2];
+ wchar_t *str = new wchar_t[MAX_PATH + 2];
OPENFILENAME ofn = { 0 };
- TCHAR filter[512], *pfilter;
+ wchar_t filter[512], *pfilter;
ofn.lStructSize = CDSIZEOF_STRUCT(OPENFILENAME, lpTemplateName);
ofn.Flags = OFN_EXPLORER;
ofn.lpstrTitle = TranslateW(WindowTittle);
@@ -115,14 +115,14 @@ TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool sav
return str;
}
-void GetFolderPath(TCHAR *WindowTittle, char*)
+void GetFolderPath(wchar_t *WindowTittle, char*)
{
BROWSEINFO pbi = { 0 };
pbi.lpszTitle = WindowTittle;
pbi.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_SHAREABLE;
LPITEMIDLIST pidl = SHBrowseForFolder(&pbi);
if (pidl != 0) {
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
if (SHGetPathFromIDList(pidl, path)) {
db_set_ts(NULL, szGPGModuleName, "szHomePath", path);
}
@@ -213,7 +213,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM)
setSrmmIcon(hContact);
setClistIcon(hContact);
- Menu_ModifyItem(hToggleEncryption, enc ? LPGENT("Turn off GPG encryption") : LPGENT("Turn on GPG encryption"));
+ Menu_ModifyItem(hToggleEncryption, enc ? LPGENW("Turn off GPG encryption") : LPGENW("Turn on GPG encryption"));
return 0;
}
@@ -237,14 +237,14 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM)
mir_free(keyid);
keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
}
- TCHAR buf[128] = { 0 };
+ wchar_t buf[128] = { 0 };
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", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L"");
if (!tmp[0]) {
db_unset(hContact, szGPGModuleName, "GPGEncryption");
flags = CMIF_GRAYED;
@@ -276,7 +276,7 @@ int onProtoAck(WPARAM, LPARAM l)
break;
PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*)ack->hProcess;
if ((f->flags & PFTS_SENDING) != PFTS_SENDING) {
- TCHAR *filename = NULL;
+ wchar_t *filename = NULL;
if (f->flags & PFTS_UNICODE) {
if (f->tszCurrentFile && f->tszCurrentFile[0])
filename = mir_wstrdup(f->tszCurrentFile);
@@ -289,7 +289,7 @@ int onProtoAck(WPARAM, LPARAM l)
if (!filename)
return 0;
}
- if (_tcsstr(filename, L".gpg")) //decrypt it
+ if (wcsstr(filename, L".gpg")) //decrypt it
{ //process encrypted file
if (!bFileTransfers && !bSameAction) {
void ShowEncryptedFileMsgBox();
@@ -316,9 +316,9 @@ int onProtoAck(WPARAM, LPARAM l)
}
cmd.push_back(file);
boost::filesystem::remove(file);
- extern TCHAR *password;
+ extern wchar_t *password;
{ // password
- TCHAR *pass = NULL;
+ wchar_t *pass = NULL;
char *keyid = UniGetContactSettingUtf(ack->hContact, szGPGModuleName, "KeyID", "");
if (mir_strlen(keyid) > 0) {
string dbsetting = "szKey_";
@@ -421,7 +421,7 @@ int onProtoAck(WPARAM, LPARAM l)
return 0;
}
-std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename)
+std::wstring encrypt_file(MCONTACT hContact, wchar_t *filename)
{
string out;
DWORD code;
@@ -432,13 +432,13 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename)
cmd.push_back(L"--tes");
cmd.push_back(L"-r");
char *keyid = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", "");
- TCHAR *szKeyid = mir_a2t(keyid);
- TCHAR *name = _tcsrchr(filename, _T('\\'));
+ wchar_t *szKeyid = mir_a2t(keyid);
+ wchar_t *name = wcsrchr(filename, '\\');
if (!name)
name = filename;
else
name++;
- TCHAR *file_out = new TCHAR[mir_tstrlen(name) + mir_tstrlen(L".gpg") + 1];
+ wchar_t *file_out = new wchar_t[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)) {
@@ -448,7 +448,7 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename)
mir_free(szKeyid);
mir_free(keyid);
cmd.push_back(L"-o");
- TCHAR *temp = _tgetenv(L"TEMP");
+ wchar_t *temp = _tgetenv(L"TEMP");
cmd.push_back(wstring(temp) + L"\\" + file_out);
wstring path_out = temp;
path_out += L"\\";
@@ -501,12 +501,12 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
}
}
else {
- TCHAR *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L"");
+ wchar_t *jid = UniGetContactSettingUtf(ccs->hContact, proto, "jid", L"");
if (jid[0]) {
extern list <JabberAccount*> Accounts;
list<JabberAccount*>::iterator end = Accounts.end();
for (list<JabberAccount*>::iterator p = Accounts.begin(); p != end; p++) {
- TCHAR *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
+ wchar_t *caps = (*p)->getJabberInterface()->GetResourceFeatures(jid);
if (caps) {
supported_proto = true;
wstring str;
@@ -534,11 +534,11 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
}
HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT));
if (StriStr(ccs->szProtoService, "/sendfilew")) {
- TCHAR **file = (TCHAR **)ccs->lParam;
+ wchar_t **file = (wchar_t **)ccs->lParam;
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], L".gpg"))
+ if (wcsstr(file[i], L".gpg"))
continue;
std::wstring path_out = encrypt_file(ccs->hContact, file[i]);
mir_free(file[i]);
@@ -553,7 +553,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
return 0; //we do not want to send file unencrypted (sometimes ack have wrong info)
if (strstr(file[i], ".gpg"))
continue;
- TCHAR *tmp = mir_utf8decodeT(file[i]);
+ wchar_t *tmp = mir_utf8decodeT(file[i]);
std::wstring path_out = encrypt_file(ccs->hContact, tmp);
mir_free(tmp);
char* tmp2 = mir_utf8encodeW(path_out.c_str());
@@ -583,14 +583,14 @@ void HistoryLog(MCONTACT hContact, db_event evt)
db_event_add(hContact, &Event);
}
-static int ControlAddStringUtf(HWND ctrl, DWORD msg, const TCHAR *szString)
+static int ControlAddStringUtf(HWND ctrl, DWORD msg, const wchar_t *szString)
{
int item = -1;
item = SendMessage(ctrl, msg, 0, (LPARAM)szString);
return item;
}
-int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data)
+int ComboBoxAddStringUtf(HWND hCombo, const wchar_t *szString, DWORD data)
{
int item = ControlAddStringUtf(hCombo, CB_ADDSTRING, szString);
SendMessage(hCombo, CB_SETITEMDATA, item, data);
@@ -618,11 +618,11 @@ int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts,
if (JIftmp) {
(*p)->setJabberInterface(JIftmp);
if (accounts[i]->tszAccountName) {
- TCHAR* tmp = mir_tstrdup(accounts[i]->tszAccountName);
+ wchar_t* tmp = mir_tstrdup(accounts[i]->tszAccountName);
(*p)->setAccountName(tmp);
}
else {
- TCHAR *tmp = mir_a2t(accounts[i]->szModuleName);
+ wchar_t *tmp = mir_a2t(accounts[i]->szModuleName);
(*p)->setAccountName(tmp);
}
(*p)->setAccountNumber(a);
@@ -654,7 +654,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*)
continue;
// TODO: make following block more readable
- if (_tcsstr(str, L"-----BEGIN PGP MESSAGE-----") && _tcsstr(str, L"-----END PGP MESSAGE-----")) {
+ if (wcsstr(str, L"-----BEGIN PGP MESSAGE-----") && wcsstr(str, L"-----END PGP MESSAGE-----")) {
wstring data = str;
xmlSetText(local_node, L"This message is encrypted.");
wstring::size_type p1 = data.find(L"-----BEGIN PGP MESSAGE-----") + mir_tstrlen(L"-----BEGIN PGP MESSAGE-----");
@@ -681,8 +681,8 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*)
break;
}
- if (bPresenceSigning && nodename && _tcsstr(nodename, L"status")) {
- TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ if (bPresenceSigning && nodename && wcsstr(nodename, L"status")) {
+ wchar_t *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
wstring path_out = path_c;
wstring file = toUTF16(get_random(10));
mir_free(path_c);
@@ -698,7 +698,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*)
break;
}
- extern TCHAR *password;
+ extern wchar_t *password;
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -763,7 +763,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*)
wstring data;
if (f.is_open()) {
std::wifstream::pos_type size = f.tellg();
- TCHAR *tmp = new TCHAR[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
+ wchar_t *tmp = new wchar_t[(std::ifstream::pos_type)size + (std::ifstream::pos_type)1];
f.seekg(0, std::ios::beg);
f.read(tmp, size);
tmp[size] = '\0';
@@ -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, L"x")) {
+ if (wcsstr(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, L"jabber:x:signed")) {
+ if (wcsstr(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, L"status")) {
+ if (wcsstr(nodename2, L"status")) {
LPCTSTR status = xmlGetText(local_node2);
if (status)
status_str = status;
@@ -844,7 +844,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*)
wstring file = toUTF16(get_random(10)), status_file = toUTF16(get_random(10));
sign += data;
sign += L"\n-----END PGP SIGNATURE-----\n";
- TCHAR *path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
+ wchar_t *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\\";
@@ -961,7 +961,7 @@ bool isContactSecured(MCONTACT hContact)
return false;
}
if (!db_mc_isMeta(hContact)) {
- TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", L"");
+ wchar_t *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", L"");
+ wchar_t *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", L"");
+ wchar_t *id = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", L"");
char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
if (id[0] && key[0]) {
mir_free(id);
@@ -1001,7 +1001,7 @@ bool isGPGKeyExist()
}
bool isGPGValid()
{
- TCHAR *tmp = NULL;
+ wchar_t *tmp = NULL;
bool gpg_exists = false, is_valid = true;
tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", L"");
boost::filesystem::path p(tmp);
@@ -1011,14 +1011,14 @@ bool isGPGValid()
else {
mir_free(tmp);
tmp = NULL;
- TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH);
- TCHAR *mir_path = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR));
+ wchar_t *path = (wchar_t*)mir_alloc(sizeof(wchar_t)*MAX_PATH);
+ wchar_t *mir_path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t));
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_realloc(path, (mir_tstrlen(path)+64)*sizeof(wchar_t));
+ wchar_t *gpg_path = (wchar_t*)mir_alloc(sizeof(wchar_t)*MAX_PATH);
mir_tstrcpy(gpg_path, tmp);
mir_tstrcat(gpg_path, L"\\GnuPG\\gpg.exe");
mir_free(tmp);
@@ -1061,7 +1061,7 @@ bool isGPGValid()
{
wstring path_ = _wgetenv(L"APPDATA");
path_ += L"\\GnuPG";
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", (TCHAR*)path_.c_str());
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", (wchar_t*)path_.c_str());
}
if(tmp)
mir_free(tmp); */
@@ -1248,7 +1248,7 @@ bool isTabsrmmUsed()
void ExportGpGKeysFunc(int type)
{
- TCHAR *p = GetFilePath(L"Choose file to export keys", L"*", L"Any file", true);
+ wchar_t *p = GetFilePath(L"Choose file to export keys", L"*", L"Any file", true);
if (!p || !p[0]) {
delete[] p;
//TODO: handle error
@@ -1412,7 +1412,7 @@ void ExportGpGKeysFunc(int type)
}
if (file.is_open())
file.close();
- TCHAR msg[512];
+ wchar_t msg[512];
if (type == 2)
mir_sntprintf(msg, TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys);
else if (type == 1)
@@ -1430,7 +1430,7 @@ INT_PTR ExportGpGKeys(WPARAM, LPARAM)
INT_PTR ImportGpGKeys(WPARAM, LPARAM)
{
- TCHAR *p = GetFilePath(L"Choose file to import keys from", L"*", L"Any file");
+ wchar_t *p = GetFilePath(L"Choose file to import keys from", L"*", L"Any file");
if (!p || !p[0]) {
delete[] p;
//TODO: handle error
@@ -1612,7 +1612,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
if (found) {
wstring path;
std::vector<std::wstring> cmd;
- TCHAR *ptmp;
+ wchar_t *ptmp;
string output;
DWORD exitcode;
{
@@ -1716,13 +1716,13 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
}
if (strstr(line, "-----END PGP PRIVATE KEY BLOCK-----")) {
std::vector<wstring> cmd;
- TCHAR tmp2[MAX_PATH] = { 0 };
- TCHAR *ptmp;
+ wchar_t tmp2[MAX_PATH] = { 0 };
+ wchar_t *ptmp;
string output;
DWORD exitcode;
{
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
- _tcsncpy(tmp2, ptmp, MAX_PATH - 1);
+ wcsncpy(tmp2, ptmp, MAX_PATH - 1);
mir_free(ptmp);
mir_tstrncat(tmp2, L"\\", _countof(tmp2) - mir_tstrlen(tmp2));
mir_tstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_tstrlen(tmp2));
@@ -1750,7 +1750,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
}
if (file.is_open())
file.close();
- TCHAR msg[512];
+ wchar_t msg[512];
if (processed_private_keys)
mir_sntprintf(msg, TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys);
else
@@ -1896,8 +1896,8 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara
//TODO: show some prgress
{
std::string old_pass, new_pass;
- extern TCHAR key_id_global[17];
- TCHAR buf[256] = { 0 };
+ extern wchar_t key_id_global[17];
+ wchar_t buf[256] = { 0 };
GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf));
new_pass = toUTF8(buf);
GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(buf));
@@ -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", L"");
+ wchar_t *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L"");
if (!mir_tstrcmp(pass, buf))
old_pass_match = true;
mir_free(pass);
@@ -1968,7 +1968,7 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case WM_DESTROY:
- extern TCHAR key_id_global[17];
+ extern wchar_t key_id_global[17];
key_id_global[0] = 0;
break;
}
@@ -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", L"");
+ wchar_t *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", L"");
path += tmp;
mir_free(tmp);
path += L"\\tmp";
diff --git a/plugins/New_GPG/src/utilities.h b/plugins/New_GPG/src/utilities.h
index 2042864468..d677ff400d 100644
--- a/plugins/New_GPG/src/utilities.h
+++ b/plugins/New_GPG/src/utilities.h
@@ -16,11 +16,11 @@
#ifndef UTILITIES_H
#define UTILITIES_H
-TCHAR* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef);
+wchar_t* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, wchar_t* szDef);
char* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, char* szDef);
-void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc);
-TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file = false);
-void GetFolderPath(TCHAR *WindowTittle, char *szSetting);
+void GetFilePath(wchar_t *WindowTittle, char *szSetting, wchar_t *szExt, wchar_t *szExtDesc);
+wchar_t *GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, bool save_file = false);
+void GetFolderPath(wchar_t *WindowTittle, char *szSetting);
void storeOutput(HANDLE ahandle, string *output);
@@ -29,7 +29,7 @@ void setClistIcon(MCONTACT);
void send_encrypted_msgs_thread(void*);
-int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data);
+int ComboBoxAddStringUtf(HWND hCombo, const wchar_t *szString, DWORD data);
bool isContactSecured(MCONTACT hContact);
bool isContactHaveKey(MCONTACT hContact);
bool isTabsrmmUsed();