diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /protocols | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
357 files changed, 4807 insertions, 4811 deletions
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index 6d595ae8e9..d9cbc9b6de 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -86,7 +86,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static PROTO_INTERFACE* protoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CAimProto *ppro = new CAimProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 52280c13e2..ec3b7c3812 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -95,11 +95,11 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c ai.hContact = contact_from_sn(sn);
if (data_len > 0) {
- const TCHAR *type;
+ const wchar_t *type;
ai.format = ProtoGetBufferFormat(data, &type);
get_avatar_filename(ai.hContact, ai.filename, _countof(ai.filename), type);
- int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _wopen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
_write(fileId, data, data_len);
_close(fileId);
@@ -116,11 +116,11 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &ai, 0);
}
-int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
+int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
- if (ext && _taccess(pszDest, 0))
+ if (ext && _waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
size_t tPathLen2 = tPathLen;
@@ -138,7 +138,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbL long hFile = _tfindfirst(pszDest, &c_file);
if (hFile > -1L) {
do {
- if (_tcsrchr(c_file.name, '.')) {
+ if (wcsrchr(c_file.name, '.')) {
mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
@@ -150,15 +150,15 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbL }
else {
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
- found = _taccess(pszDest, 0) == 0;
+ found = _waccess(pszDest, 0) == 0;
}
return found ? GAIR_SUCCESS : GAIR_WAITFOR;
}
-bool get_avatar_hash(const TCHAR* file, char* hash, char** data, unsigned short &size)
+bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned short &size)
{
- int fileId = _topen(file, _O_RDONLY | _O_BINARY, _S_IREAD);
+ int fileId = _wopen(file, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fileId == -1) return false;
long lAvatar = _filelength(fileId);
diff --git a/protocols/AimOscar/src/avatars.h b/protocols/AimOscar/src/avatars.h index 1188a1ec82..647e897f3f 100644 --- a/protocols/AimOscar/src/avatars.h +++ b/protocols/AimOscar/src/avatars.h @@ -46,7 +46,7 @@ struct avatar_up_req { mir_free(data1); mir_free(data2); }
};
-bool get_avatar_hash(const TCHAR* file, char* hash, char** data, unsigned short &size);
+bool get_avatar_hash(const wchar_t* file, char* hash, char** data, unsigned short &size);
void rescale_image(char *data, unsigned short size, char *&data1, unsigned short &size1);
#endif
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index 82508f63f0..dcc0d9449e 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -36,7 +36,7 @@ void CAimProto::chat_register(void) void CAimProto::chat_start(const char* id, unsigned short exchange)
{
- TCHAR *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2t(id);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -64,13 +64,13 @@ void CAimProto::chat_start(const char* id, unsigned short exchange) mir_free(idt);
}
-void CAimProto::chat_event(const char* id, const char* sn, int evt, const TCHAR* msg)
+void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_t* msg)
{
- TCHAR *idt = mir_a2t(id);
- TCHAR *snt = mir_a2t(sn);
+ wchar_t *idt = mir_a2t(id);
+ wchar_t *snt = mir_a2t(sn);
MCONTACT hContact = contact_from_sn(sn);
- TCHAR *nick = hContact ? (TCHAR*)pcli->pfnGetContactDisplayName(
+ wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(
WPARAM(hContact), 0) : snt;
GCDEST gcd = { m_szModuleName, idt, evt };
@@ -91,7 +91,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const TCHAR* void CAimProto::chat_leave(const char* id)
{
- TCHAR *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2t(id);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index 287aec3a84..a2e3420b2e 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -538,7 +538,7 @@ char* rtf_to_html(HWND hwndDlg, int DlgItem) isSize = 1;
else
isSize = 3;
- TCHAR text[3] = L"";
+ wchar_t text[3] = L"";
SendDlgItemMessage(hwndDlg, DlgItem, EM_GETSELTEXT, 0, (LPARAM)&text);
if (Bold != isBold) {
Bold = isBold;
@@ -724,11 +724,11 @@ char* get_fname(char *path) return pszFile;
}
-TCHAR* get_dir(TCHAR *path)
+wchar_t* get_dir(wchar_t *path)
{
- TCHAR *cpath = mir_tstrdup(path);
+ wchar_t *cpath = mir_tstrdup(path);
- TCHAR *swd = _tcsrchr(cpath, '\\');
+ wchar_t *swd = wcsrchr(cpath, '\\');
if (swd) swd[1] = 0; else cpath[0] = 0;
return cpath;
diff --git a/protocols/AimOscar/src/conv.h b/protocols/AimOscar/src/conv.h index b7490cf63e..d12506189b 100644 --- a/protocols/AimOscar/src/conv.h +++ b/protocols/AimOscar/src/conv.h @@ -32,7 +32,7 @@ char* bytes_to_string(char* bytes, int num_bytes); void string_to_bytes(char* string, char* bytes);
bool is_utf(const char* msg);
char* get_fname(char* path);
-TCHAR* get_dir(TCHAR* path);
+wchar_t* get_dir(wchar_t* path);
struct aimString
{
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 9d19984558..d2a392b9a7 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -93,10 +93,10 @@ bool send_init_oft2(file_transfer *ft, char* file) return Netlib_Send(ft->hConn, (char*)oft, len, 0) > 0;
}
-void CAimProto::report_file_error(TCHAR *fname)
+void CAimProto::report_file_error(wchar_t *fname)
{
- TCHAR errmsg[512];
- TCHAR* error = mir_a2t(_strerror(NULL));
+ wchar_t errmsg[512];
+ wchar_t* error = mir_a2t(_strerror(NULL));
mir_sntprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
@@ -104,13 +104,13 @@ void CAimProto::report_file_error(TCHAR *fname) bool setup_next_file_send(file_transfer *ft)
{
- TCHAR *file;
+ wchar_t *file;
struct _stati64 statbuf;
for (;;) {
file = ft->pfts.ptszFiles[ft->cf];
if (file == NULL) return false;
- if (_tstati64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
+ if (_wstat64(file, &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
break;
++ft->cf;
@@ -177,7 +177,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI if (type == 0x0202 || type == 0x0207) {
debugLogA("P2P: Buddy Accepts our file transfer.");
- int fid = _topen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD);
+ int fid = _wopen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fid < 0) {
report_file_error(ft->pfts.tszCurrentFile);
return 2;
@@ -309,7 +309,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET memcpy(buf, recv_ft->filename, buflen);
enc = _htons(recv_ft->encoding);
- TCHAR *name;
+ wchar_t *name;
if (enc == 2) {
wchar_t* wbuf = (wchar_t*)buf;
wcs_htons(wbuf);
@@ -323,7 +323,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET mir_free(buf);
- TCHAR fname[256];
+ wchar_t fname[256];
mir_sntprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name);
mir_free(name);
mir_free(ft->pfts.tszCurrentFile);
@@ -334,14 +334,14 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET WaitForSingleObject(ft->hResumeEvent, INFINITE);
if (ft->pfts.tszCurrentFile) {
- TCHAR* dir = get_dir(ft->pfts.tszCurrentFile);
+ wchar_t* dir = get_dir(ft->pfts.tszCurrentFile);
CreateDirectoryTreeT(dir);
mir_free(dir);
oft->type = _htons(ft->pfts.currentFileProgress ? 0x0205 : 0x0202);
const int flag = ft->pfts.currentFileProgress ? 0 : _O_TRUNC;
- fid = _topen(ft->pfts.tszCurrentFile, _O_CREAT | _O_WRONLY | _O_BINARY | flag, _S_IREAD | _S_IWRITE);
+ fid = _wopen(ft->pfts.tszCurrentFile, _O_CREAT | _O_WRONLY | _O_BINARY | flag, _S_IREAD | _S_IWRITE);
if (fid < 0) {
report_file_error(fname);
diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index 25ae226baa..ea50d67c58 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -22,7 +22,7 @@ static HANDLE hServiceParseLink; extern OBJLIST<CAimProto> g_Instances;
-static int SingleHexToDecimal(TCHAR c)
+static int SingleHexToDecimal(wchar_t c)
{
if (c >= '0' && c <= '9') return c - '0';
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
@@ -30,9 +30,9 @@ static int SingleHexToDecimal(TCHAR c) return -1;
}
-static TCHAR* url_decode(TCHAR* str)
+static wchar_t* url_decode(wchar_t* str)
{
- TCHAR* s = str, *d = str;
+ wchar_t* s = str, *d = str;
while (*s) {
if (*s == '%') {
@@ -41,7 +41,7 @@ static TCHAR* url_decode(TCHAR* str) int digit2 = SingleHexToDecimal(s[2]);
if (digit2 != -1) {
s += 3;
- *d++ = (TCHAR)((digit1 << 4) | digit2);
+ *d++ = (wchar_t)((digit1 << 4) | digit2);
continue;
}
}
@@ -57,15 +57,15 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) {
if (lParam == 0) return 1; /* sanity check */
- TCHAR *arg = (TCHAR*)lParam;
+ wchar_t *arg = (wchar_t*)lParam;
/* skip leading prefix */
- arg = _tcschr(arg, ':');
+ arg = wcschr(arg, ':');
if (arg == NULL) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg);
- arg = NEWTSTR_ALLOCA(arg);
+ arg = NEWWSTR_ALLOCA(arg);
if (g_Instances.getCount() == 0) return 0;
@@ -84,16 +84,16 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) open chatroom: aim:gochat?roomname=ROOM&exchange=NUM
*/
/* add a contact to the list */
- if (!_tcsnicmp(arg, L"addbuddy?", 9)) {
- TCHAR *tok, *tok2;
+ if (!wcsnicmp(arg, L"addbuddy?", 9)) {
+ wchar_t *tok, *tok2;
char *sn = NULL, *group = NULL;
for (tok = arg + 8; tok != NULL; tok = tok2) {
- tok2 = _tcschr(++tok, '&'); /* first token */
+ tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
- if (!_tcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
+ if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
sn = mir_t2a(url_decode(tok + 11));
- if (!_tcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
+ if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
group = mir_utf8encodeT(url_decode(tok + 10)); /* group is currently ignored */
}
if (sn == NULL) {
@@ -111,16 +111,16 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) return 0;
}
/* send a message to a contact */
- else if (!_tcsnicmp(arg, L"goim?", 5)) {
- TCHAR *tok, *tok2, *msg = NULL;
+ else if (!wcsnicmp(arg, L"goim?", 5)) {
+ wchar_t *tok, *tok2, *msg = NULL;
char *sn = NULL;
for (tok = arg + 4; tok != NULL; tok = tok2) {
- tok2 = _tcschr(++tok, '&'); /* first token */
+ tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
- if (!_tcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
+ if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
sn = mir_t2a(url_decode(tok + 11));
- if (!_tcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
+ if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
msg = url_decode(tok + 8);
}
if (sn == NULL) return 1; /* parse failed */
@@ -134,21 +134,21 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) }
/* open a chatroom */
- else if (!_tcsnicmp(arg, L"gochat?", 7)) {
- TCHAR *tok, *tok2;
+ else if (!wcsnicmp(arg, L"gochat?", 7)) {
+ wchar_t *tok, *tok2;
char *rm = NULL;
int exchange = 0;
for (tok = arg + 6; tok != NULL; tok = tok2) {
- tok2 = _tcschr(++tok, '&'); /* first token */
+ tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
- if (!_tcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
+ if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
rm = mir_t2a(url_decode(tok + 9));
for (char *ch = rm; *ch; ++ch)
if (*ch == '+') *ch = ' ';
}
- if (!_tcsnicmp(tok, L"exchange=", 9))
- exchange = _ttoi(tok + 9);
+ if (!wcsnicmp(tok, L"exchange=", 9))
+ exchange = _wtoi(tok + 9);
}
if (rm == NULL || exchange <= 0) {
mir_free(rm);
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 03b4fa8ba3..8747508724 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -71,7 +71,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
if (flags & TCHAR_POPUP)
{
- char* errmsg = mir_t2a((TCHAR*)msg);
+ char* errmsg = mir_t2a((wchar_t*)msg);
debugLogA(errmsg);
mir_free(errmsg);
}
@@ -79,8 +79,8 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) debugLogA(msg);
}
- TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg);
- _tcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE);
+ wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((wchar_t*)msg) : mir_a2t(msg);
+ wcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE);
mir_free(msgt);
if (!ServiceExists(MS_POPUP_ADDPOPUPT))
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 67e1faa684..a198c04b63 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "stdafx.h"
-CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
+CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) :
PROTO<CAimProto>(aProtoName, aUserName),
m_chat_rooms(5)
{
@@ -46,7 +46,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : offline_contacts();
- TCHAR descr[MAX_PATH];
+ wchar_t descr[MAX_PATH];
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -122,7 +122,7 @@ MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) if (m_state != 1)
return 0;
- TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t;
+ wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w;
char *sn = psr->flags & PSR_UNICODE ? mir_u2a((wchar_t*)id) : mir_strdup((char*)id);
MCONTACT hContact = contact_from_sn(sn, true, (flags & PALF_TEMPORARY) != 0);
mir_free(sn);
@@ -132,7 +132,7 @@ MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) ////////////////////////////////////////////////////////////////////////////////////////
// PSS_AUTHREQUEST
-int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const TCHAR*)
+int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const wchar_t*)
{
//Not a real authrequest- only used b/c we don't know the group until now.
if (m_state != 1)
@@ -151,7 +151,7 @@ int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const TCHAR*) ////////////////////////////////////////////////////////////////////////////////////////
// FileAllow - starts a file transfer
-HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath)
+HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *szPath)
{
file_transfer *ft = (file_transfer*)hTransfer;
if (ft && m_ft_list.find_by_ft(ft)) {
@@ -199,7 +199,7 @@ int __cdecl CAimProto::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// FileDeny - denies a file transfer
-int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szReason*/)
+int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t* /*szReason*/)
{
file_transfer *ft = (file_transfer*)hTransfer;
if (!m_ft_list.find_by_ft(ft))
@@ -214,7 +214,7 @@ int __cdecl CAimProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szRea ////////////////////////////////////////////////////////////////////////////////////////
// FileResume - processes file renaming etc
-int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
file_transfer *ft = (file_transfer*)hTransfer;
if (!m_ft_list.find_by_ft(ft))
@@ -224,7 +224,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s case FILERESUME_RESUME:
{
struct _stati64 statbuf;
- _tstati64(ft->pfts.tszCurrentFile, &statbuf);
+ _wstat64(ft->pfts.tszCurrentFile, &statbuf);
ft->pfts.currentFileProgress = statbuf.st_size;
}
break;
@@ -306,7 +306,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) else {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
- psr.id.t = (TCHAR*)sn;
+ psr.id.w = (wchar_t*)sn;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
@@ -315,7 +315,7 @@ void __cdecl CAimProto::basic_search_ack_success(void *p) mir_free(p);
}
-HANDLE __cdecl CAimProto::SearchBasic(const TCHAR *szId)
+HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId)
{
if (m_state != 1)
return 0;
@@ -328,7 +328,7 @@ HANDLE __cdecl CAimProto::SearchBasic(const TCHAR *szId) ////////////////////////////////////////////////////////////////////////////////////////
// SearchByEmail - searches the contact by its e-mail
-HANDLE __cdecl CAimProto::SearchByEmail(const TCHAR *email)
+HANDLE __cdecl CAimProto::SearchByEmail(const wchar_t *email)
{
// Maximum email size should really be 320, but the char string is limited to 255.
if (m_state != 1 || email == NULL || mir_tstrlen(email) >= 254)
@@ -363,7 +363,7 @@ int __cdecl CAimProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
if (m_state != 1)
return 0;
@@ -377,7 +377,7 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const TCHAR* szDescription int count = 0;
while (ppszFiles[count] != NULL) {
struct _stati64 statbuf;
- if (_tstati64(ppszFiles[count++], &statbuf) == 0) {
+ if (_wstat64(ppszFiles[count++], &statbuf) == 0) {
if (statbuf.st_mode & _S_IFDIR) {
if (ft->pfts.totalFiles == 0) isDir = true;
}
@@ -593,7 +593,7 @@ int __cdecl CAimProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* pre) ////////////////////////////////////////////////////////////////////////////////////////
// SetAwayMsg - sets the away m_iStatus message
-int __cdecl CAimProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg)
{
char **msgptr = get_status_msg_loc(status);
if (msgptr == NULL) return 1;
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 7afb407100..79980483eb 100755 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CAimProto : public PROTO<CAimProto>
{
- CAimProto(const char*, const TCHAR*);
+ CAimProto(const char*, const wchar_t*);
~CAimProto();
//====================================================================================
@@ -30,28 +30,28 @@ struct CAimProto : public PROTO<CAimProto> virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage );
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage );
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath );
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath );
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason );
- virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename );
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason );
+ virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const wchar_t** szFilename );
virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL );
- virtual HANDLE __cdecl SearchBasic( const TCHAR* id );
- virtual HANDLE __cdecl SearchByEmail( const TCHAR* email );
+ virtual HANDLE __cdecl SearchBasic( const wchar_t* id );
+ virtual HANDLE __cdecl SearchByEmail( const wchar_t* email );
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* );
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg );
virtual int __cdecl SetStatus( int iNewStatus );
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact );
virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt );
- virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg );
+ virtual int __cdecl SetAwayMsg( int m_iStatus, const wchar_t* msg );
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type );
@@ -196,7 +196,7 @@ struct CAimProto : public PROTO<CAimProto> void avatar_request_handler(MCONTACT hContact, char* hash, unsigned char type);
void avatar_retrieval_handler(const char* sn, const char* hash, const char* data, int data_len);
- int get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
+ int get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext);
//////////////////////////////////////////////////////////////////////////////////////
// away.cpp
@@ -217,7 +217,7 @@ struct CAimProto : public PROTO<CAimProto> void chat_register(void);
void chat_start(const char* id, unsigned short exchange);
- void chat_event(const char* id, const char* sn, int evt, const TCHAR* msg = NULL);
+ void chat_event(const char* id, const char* sn, int evt, const wchar_t* msg = NULL);
void chat_leave(const char* id);
chat_list_item* find_chat_by_cid(unsigned short cid);
@@ -321,7 +321,7 @@ struct CAimProto : public PROTO<CAimProto> int sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv);
int receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv);
- void report_file_error(TCHAR* fname);
+ void report_file_error(wchar_t* fname);
void shutdown_file_transfers(void);
//////////////////////////////////////////////////////////////////////////////////////
@@ -413,7 +413,7 @@ struct CAimProto : public PROTO<CAimProto> void offline_contact(MCONTACT hContact, bool remove_settings);
unsigned short get_default_port(void);
- int open_contact_file(const char* sn, const TCHAR* file, const char* mode, TCHAR* &path, bool contact_dir);
+ int open_contact_file(const char* sn, const wchar_t* file, const char* mode, wchar_t* &path, bool contact_dir);
void write_away_message(const char* sn, const char* msg, bool utf);
void write_profile(const char* sn, const char* msg, bool utf);
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index fa297a5664..34bc6151e2 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -487,7 +487,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 char* msg_s = process_status_msg(msg, sn);
db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
- TCHAR* tszMsg = mir_utf8decodeT(msg_s);
+ wchar_t* tszMsg = mir_utf8decodeT(msg_s);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
mir_free(tszMsg);
mir_free(msg);
@@ -1247,18 +1247,18 @@ void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned s if (!descr_included) msg_buf = NULL;
- TCHAR* filenameT = mir_utf8decodeT(filename);
+ wchar_t* filenameT = mir_utf8decodeT(filename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = mir_utf8decodeT(msg_buf);
- pre.files.t = &filenameT;
+ pre.descr.w = mir_utf8decodeT(msg_buf);
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.descr.t);
+ mir_free(pre.descr.w);
mir_free(filenameT);
char cip[20];
@@ -1659,7 +1659,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 position += TLV_HEADER_SIZE + tlv.len();
}
if (new_mail && num_msgs) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
int len = mir_sntprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs,
TranslateT("You've got mail! Checked at"));
@@ -1733,10 +1733,10 @@ void CAimProto::snac_email_search_results(SNAC &snac)//family 0x000A while (offset < snac.len()) { // Loop through all the TLVs and pull out the buddy name
TLV tlv(snac.val(offset));
offset += TLV_HEADER_SIZE;
- psr.id.t = (TCHAR*)tlv.dup();
+ psr.id.w = (wchar_t*)tlv.dup();
offset += tlv.len();
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
- mir_free(psr.nick.t);
+ mir_free(psr.nick.w);
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
@@ -1834,7 +1834,7 @@ void CAimProto::snac_chat_joined_left_users(SNAC &snac, chat_list_item* item)//f void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//family 0x000E
{
if (snac.subcmp(0x0006)) {
- TCHAR* message = NULL;
+ wchar_t* message = NULL;
char* sn = NULL;
// unsigned long cookie = snac.ulong(0);
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index c4be0f3401..c108139a3e 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -392,14 +392,14 @@ INT_PTR CAimProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
size_t size = (size_t)lParam;
if (buf == NULL || size <= 0)
return -1;
PROTO_AVATAR_INFORMATION ai = { 0 };
if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS) {
- _tcsncpy_s(buf, size, ai.filename, _TRUNCATE);
+ wcsncpy_s(buf, size, ai.filename, _TRUNCATE);
return 0;
}
@@ -408,7 +408,7 @@ INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam)
{
- TCHAR *szFileName = (TCHAR*)lParam;
+ wchar_t *szFileName = (wchar_t*)lParam;
if (m_state != 1)
return 1;
@@ -461,10 +461,10 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam) avatar_up_req *req = new avatar_up_req(data, size, data1, size1);
ForkThread(&CAimProto::avatar_upload_thread, req);
- TCHAR tFileName[MAX_PATH];
- TCHAR *ext = _tcsrchr(szFileName, '.');
+ wchar_t tFileName[MAX_PATH];
+ wchar_t *ext = wcsrchr(szFileName, '.');
get_avatar_filename(NULL, tFileName, _countof(tFileName), ext);
- int fileId = _topen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _wopen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId < 0) {
char errmsg[512];
mir_snprintf(errmsg, "Cannot store avatar. File '%s' could not be created/overwritten", tFileName);
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 134011214f..ab6c8a80ad 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -179,19 +179,19 @@ int CAimProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) switch (m_pd_mode) {
case 1:
- Menu_ModifyItem(m_hBlockContextMenuItem, LPGENT("&Block"));
+ Menu_ModifyItem(m_hBlockContextMenuItem, LPGENW("&Block"));
break;
case 2:
- Menu_ModifyItem(m_hBlockContextMenuItem, LPGENT("&Unblock"));
+ Menu_ModifyItem(m_hBlockContextMenuItem, LPGENW("&Unblock"));
break;
case 3:
- Menu_ModifyItem(m_hBlockContextMenuItem, m_allow_list.find_id(id) ? LPGENT("&Block") : LPGENT("&Unblock"));
+ Menu_ModifyItem(m_hBlockContextMenuItem, m_allow_list.find_id(id) ? LPGENW("&Block") : LPGENW("&Unblock"));
break;
case 4:
- Menu_ModifyItem(m_hBlockContextMenuItem, m_block_list.find_id(id) ? LPGENT("&Unblock") : LPGENT("&Block"));
+ Menu_ModifyItem(m_hBlockContextMenuItem, m_block_list.find_id(id) ? LPGENW("&Unblock") : LPGENW("&Block"));
break;
default:
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 2b906bc355..ee833e6eee 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -190,7 +190,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv;
if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv)) {
html_decode(dbv.pszVal);
- TCHAR *txt = mir_utf8decodeT(dbv.pszVal);
+ wchar_t *txt = mir_utf8decodeT(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_PROFILE, txt);
mir_free(txt);
db_free(&dbv);
@@ -685,15 +685,15 @@ int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.position = -1900000000;
odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR;
odp.hInstance = hInstance;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
- odp.ptszTab = LPGENT("Profile");
+ odp.pwszTab = LPGENW("Profile");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO);
odp.pfnDlgProc = userinfo_dialog;
UserInfo_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Admin");
+ odp.pwszTab = LPGENW("Admin");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADMIN);
odp.pfnDlgProc = admin_dialog;
UserInfo_AddPage(wParam, &odp);
@@ -1058,17 +1058,17 @@ int CAimProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 1003000;
odp.hInstance = hInstance;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszTab = LPGENT("Basic");
+ odp.pwszTab = LPGENW("Basic");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_AIM);
odp.pfnDlgProc = options_dialog;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Privacy");
+ odp.pwszTab = LPGENW("Privacy");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PRIVACY);
odp.pfnDlgProc = privacy_dialog;
Options_AddPage(wParam, &odp);
@@ -1267,7 +1267,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, chat_list_item int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
if (chk) {
if (IsHContactInfo(hItem)) {
- TCHAR buf[128] = L"";
+ wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
char *sn = mir_t2a(buf);
@@ -1364,7 +1364,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (LOWORD(wParam)) {
case IDC_ADDSCR:
if (param->ppro->m_state == 1) {
- TCHAR sn[64];
+ wchar_t sn[64];
GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index b5e23b21aa..247d8bd3fa 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -363,7 +363,7 @@ void create_group(const char *group) {
if (mir_strcmp(group, AIM_DEFAULT_GROUP) == 0) return;
- TCHAR* szGroupName = mir_utf8decodeT(group);
+ wchar_t* szGroupName = mir_utf8decodeT(group);
Clist_GroupCreate(0, szGroupName);
mir_free(szGroupName);
}
@@ -529,21 +529,21 @@ int CAimProto::deleteGroupId(MCONTACT hContact, int i) /////////////////////////////////////////////////////////////////////////////////////////
-int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TCHAR* &path, bool contact_dir)
+int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, wchar_t* &path, bool contact_dir)
{
- path = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR));
+ path = (wchar_t*)mir_alloc(MAX_PATH * sizeof(wchar_t));
int pos = mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_userdata%"), m_szModuleName);
if (contact_dir)
pos += mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName);
- if (_taccess(path, 0))
+ if (_waccess(path, 0))
CreateDirectoryTreeT(path);
mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%s", file);
- int fid = _topen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
+ int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
if (fid < 0) {
- TCHAR errmsg[512];
+ wchar_t errmsg[512];
mir_sntprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
@@ -552,7 +552,7 @@ int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TC void CAimProto::write_away_message(const char* sn, const char* msg, bool utf)
{
- TCHAR* path;
+ wchar_t* path;
int fid = open_contact_file(sn, L"away.html", "wb", path, 1);
if (fid >= 0) {
if (utf) _write(fid, "\xEF\xBB\xBF", 3);
@@ -570,7 +570,7 @@ void CAimProto::write_away_message(const char* sn, const char* msg, bool utf) void CAimProto::write_profile(const char* sn, const char* msg, bool utf)
{
- TCHAR* path;
+ wchar_t* path;
int fid = open_contact_file(sn, L"profile.html", "wb", path, 1);
if (fid >= 0) {
if (utf) _write(fid, "\xEF\xBB\xBF", 3);
@@ -604,10 +604,10 @@ unsigned long aim_oft_checksum_chunk(unsigned long dwChecksum, const unsigned ch return checksum << 16;
}
-unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size)
+unsigned int aim_oft_checksum_file(wchar_t *filename, unsigned __int64 size)
{
unsigned long checksum = 0xffff0000;
- int fid = _topen(filename, _O_RDONLY | _O_BINARY, _S_IREAD);
+ int fid = _wopen(filename, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fid >= 0) {
unsigned __int64 sz = _filelengthi64(fid);
if (size > sz) size = sz;
diff --git a/protocols/AimOscar/src/utility.h b/protocols/AimOscar/src/utility.h index 6b8404ea00..17d50af9e1 100755 --- a/protocols/AimOscar/src/utility.h +++ b/protocols/AimOscar/src/utility.h @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. char *normalize_name(const char *s);
char* trim_str(char* s);
void create_group(const char *group);
-unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size = -1);
+unsigned int aim_oft_checksum_file(wchar_t *filename, unsigned __int64 size = -1);
char* long_ip_to_char_ip(unsigned long host, char* ip);
unsigned long char_ip_to_long_ip(char* ip);
unsigned short get_random(void);
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 533b137199..11643b57b3 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -39,7 +39,7 @@ void CDummyProto::SearchIdAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = (TCHAR*)targ; + psr.id.w = (wchar_t*)targ; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, targ, 0); @@ -54,7 +54,7 @@ static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2) LIST<CDummyProto> dummy_Instances(1, sttCompareProtocols); -CDummyProto::CDummyProto(const char *szModuleName, const TCHAR *ptszUserName) : +CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) : PROTO<CDummyProto>(szModuleName, ptszUserName) { CreateProtoService(PS_CREATEACCMGRUI, &CDummyProto::SvcCreateAccMgrUI); @@ -142,19 +142,19 @@ int CDummyProto::SetStatus(int) return 0; } -HANDLE CDummyProto::SearchBasic(const TCHAR* id) +HANDLE CDummyProto::SearchBasic(const wchar_t* id) { if (uniqueIdSetting[0] == '\0') return 0; - TCHAR *tid = mir_tstrdup(id); + wchar_t *tid = mir_tstrdup(id); ForkThread(&CDummyProto::SearchIdAckThread, tid); return tid; } MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - if (psr->id.t == NULL) + if (psr->id.w == NULL) return NULL; MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD); @@ -173,8 +173,8 @@ MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) db_unset(hContact, "CList", "Hidden"); db_unset(hContact, "CList", "NotOnList"); } - setTString(hContact, uniqueIdSetting, psr->id.t); - setTString(hContact, "Nick", psr->id.t); + setTString(hContact, uniqueIdSetting, psr->id.w); + setTString(hContact, "Nick", psr->id.w); } return hContact; diff --git a/protocols/Dummy/src/dummy_proto.h b/protocols/Dummy/src/dummy_proto.h index d2da9b0d61..2543c949da 100644 --- a/protocols/Dummy/src/dummy_proto.h +++ b/protocols/Dummy/src/dummy_proto.h @@ -19,7 +19,7 @@ struct CDummyProto; struct CDummyProto : public PROTO<CDummyProto> { - CDummyProto(const char*, const TCHAR*); + CDummyProto(const char*, const wchar_t*); ~CDummyProto(); //==================================================================================== @@ -32,7 +32,7 @@ struct CDummyProto : public PROTO<CDummyProto> virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl SearchBasic(const TCHAR* id); + virtual HANDLE __cdecl SearchBasic(const wchar_t* id); virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index 87b112e219..8eff3f47ae 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -63,7 +63,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CDummyProto* dummyProtoInit(const char* pszProtoName, const TCHAR *tszUserName)
+static CDummyProto* dummyProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
{
CDummyProto *ppro = new CDummyProto(pszProtoName, tszUserName);
return ppro;
diff --git a/protocols/Dummy/src/stdafx.h b/protocols/Dummy/src/stdafx.h index 305d636215..a28d1fd992 100644 --- a/protocols/Dummy/src/stdafx.h +++ b/protocols/Dummy/src/stdafx.h @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdio.h> #include <malloc.h> -#include <tchar.h> #include <time.h> #include <newpluginapi.h> diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index daccd9332f..1ba95f8429 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -404,7 +404,7 @@ INT_PTR CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT *psr) bool TempAdd = flags&PALF_TEMPORARY; - MCONTACT contact = FindContact(addr, psr->nick.t, true, !TempAdd, !TempAdd, psr->stat); + MCONTACT contact = FindContact(addr, psr->nick.a, true, !TempAdd, !TempAdd, psr->stat); if (contact != NULL) { db_set_w(contact, PROTONAME, "Status", psr->stat); db_set_w(contact, PROTONAME, "RemoteVersion", psr->ver); @@ -483,10 +483,10 @@ void CMLan::SearchExt(TDataHolder* hold) size_t len = mir_tstrlen(buf); buf[len] = '@'; mir_tstrcpy(buf + len + 1, inet_ntoa(cont->m_addr)); - psr.nick.t = cont->m_nick; - psr.firstName.t = ""; - psr.lastName.t = ""; - psr.email.t = buf; + psr.nick.a = cont->m_nick; + psr.firstName.a = ""; + psr.lastName.a = ""; + psr.email.a = buf; psr.ipaddr = cont->m_addr.S_un.S_addr; psr.stat = cont->m_status; psr.ver = cont->m_ver; diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index b85699b520..c41c7026d5 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -33,19 +33,19 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai, std::string * utils::text::replace_first(url, "%s", std::string(id));
}
- std::tstring filename = GetAvatarFolder() + _T('\\') + std::tstring(_A2T(id)) + L".jpg";
+ std::wstring filename = GetAvatarFolder() + L'\\' + std::wstring(_A2T(id)) + L".jpg";
- _tcsncpy_s(pai.filename, filename.c_str(), _TRUNCATE);
+ wcsncpy_s(pai.filename, filename.c_str(), _TRUNCATE);
pai.format = ProtoGetAvatarFormat(pai.filename);
return true;
}
void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &image_url)
{
- std::tstring::size_type pos = image_url.rfind("/");
+ std::wstring::size_type pos = image_url.rfind("/");
// Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts)
- if (image_url.empty() || pos == std::tstring::npos)
+ if (image_url.empty() || pos == std::wstring::npos)
return;
// Get name of image
@@ -53,7 +53,7 @@ void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &imag // Remove eventual parameters from name
pos = image_name.rfind("?");
- if (pos != std::tstring::npos)
+ if (pos != std::wstring::npos)
image_name = image_name.substr(0, pos);
// Append our parameters to allow comparing for avatar/settings change
@@ -123,9 +123,9 @@ void FacebookProto::UpdateAvatarWorker(void *) Netlib_CloseHandle(nlc);
}
-std::tstring FacebookProto::GetAvatarFolder()
+std::wstring FacebookProto::GetAvatarFolder()
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
@@ -180,7 +180,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
if (GetDbAvatarInfo(*pai, NULL))
{
- bool fileExist = _taccess(pai->filename, 0) == 0;
+ bool fileExist = _waccess(pai->filename, 0) == 0;
bool needLoad;
if (pai->hContact)
@@ -216,13 +216,13 @@ INT_PTR FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (!wParam || !lParam)
return -3;
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
PROTO_AVATAR_INFORMATION ai = { 0 };
switch (GetAvatarInfo(0, (LPARAM)&ai)) {
case GAIR_SUCCESS:
- _tcsncpy(buf, ai.filename, size);
+ wcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
return 0;
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index a5a94c2d06..9901e6896e 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -244,7 +244,7 @@ bool FacebookProto::IsChatContact(const char *chat_id, const char *id) return (users != NULL && strstr(users, id) != NULL); } -void FacebookProto::AddChat(const char *id, const TCHAR *tname) +void FacebookProto::AddChat(const char *id, const wchar_t *tname) { ptrT tid(mir_a2t(id)); @@ -377,8 +377,8 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { static const struct gc_item Items[] = { - { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, - { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE } + { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE }, + { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; @@ -389,10 +389,10 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { /*static const struct gc_item Items[] = { - { LPGENT("User &details"), 10, MENU_ITEM, FALSE }, - { LPGENT("User &history"), 20, MENU_ITEM, FALSE }, + { LPGENW("User &details"), 10, MENU_ITEM, FALSE }, + { LPGENW("User &history"), 20, MENU_ITEM, FALSE }, { L"", 100, MENU_SEPARATOR, FALSE }, - { LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE } + { LPGENW("&Leave chat session"), 110, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items;*/ @@ -403,8 +403,8 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { static const struct gc_item Items[] = { - { LPGENT("User &details"), 10, MENU_ITEM, FALSE }, - { LPGENT("User &history"), 20, MENU_ITEM, FALSE } + { LPGENW("User &details"), 10, MENU_ITEM, FALSE }, + { LPGENW("User &history"), 20, MENU_ITEM, FALSE } }; gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; @@ -429,7 +429,7 @@ void FacebookProto::PrepareNotificationsChatRoom() { // Prepare notifications chatroom if not exists MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM); if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) { - TCHAR nameT[200]; + wchar_t nameT[200]; mir_sntprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); // Create the group chat session diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h index f065893af7..7df4d7a4d3 100644 --- a/protocols/FacebookRM/src/client.h +++ b/protocols/FacebookRM/src/client.h @@ -93,7 +93,7 @@ public: // Client vs protocol communication
- void client_notify(TCHAR* message);
+ void client_notify(wchar_t* message);
////////////////////////////////////////////////////////////
@@ -209,7 +209,7 @@ public: // HTTP communication
http::response flap(RequestType request_type, std::string *post_data = NULL, std::string *get_data = NULL);
- bool save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc);
+ bool save_url(const std::string &url,const std::wstring &filename, HANDLE &nlc);
bool notify_errors(RequestType);
std::string choose_server(RequestType);
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 486bc08696..cfbae1cbc9 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -void facebook_client::client_notify(TCHAR* message) +void facebook_client::client_notify(wchar_t* message) { parent->NotifyEvent(parent->m_tszUserName, message, NULL, FACEBOOK_EVENT_CLIENT); } @@ -723,13 +723,13 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s } } - std::tstring treaderName = _A2T(name.c_str(), CP_UTF8); - std::tstring treaders; + std::wstring treaderName = _A2T(name.c_str(), CP_UTF8); + std::wstring treaders; // Load old readers ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); if (told) - treaders = std::tstring(told) + L", "; + treaders = std::wstring(told) + L", "; // Append new reader name and remember them treaders += utils::text::prepare_name(treaderName, true); @@ -771,7 +771,7 @@ void loginError(FacebookProto *proto, std::string error_str) { proto->debugLogA("!!! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error"); - TCHAR buf[200]; + wchar_t buf[200]; mir_sntprintf(buf, TranslateT("Login error: %s"), (error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str()))); proto->facy.client_notify(buf); @@ -1664,7 +1664,7 @@ bool facebook_client::post_status(status_data *status) ////////////////////////////////////////////////////////////////////////////// -bool facebook_client::save_url(const std::string &url, const std::tstring &filename, HANDLE &nlc) +bool facebook_client::save_url(const std::string &url, const std::wstring &filename, HANDLE &nlc) { NETLIBHTTPREQUEST req = { sizeof(req) }; NETLIBHTTPREQUEST *resp; @@ -1683,17 +1683,17 @@ bool facebook_client::save_url(const std::string &url, const std::tstring &filen parent->debugLogA("@@@ Saving URL %s to file %s", url.c_str(), _T2A(filename.c_str())); // Create folder if necessary - std::tstring dir = filename.substr(0, filename.rfind('\\')); - if (_taccess(dir.c_str(), 0)) + std::wstring dir = filename.substr(0, filename.rfind('\\')); + if (_waccess(dir.c_str(), 0)) CreateDirectoryTreeT(dir.c_str()); // Write to file - FILE *f = _tfopen(filename.c_str(), L"wb"); + FILE *f = _wfopen(filename.c_str(), L"wb"); if (f != NULL) { fwrite(resp->pData, 1, resp->dataLength, f); fclose(f); - ret = _taccess(filename.c_str(), 0) == 0; + ret = _waccess(filename.c_str(), 0) == 0; } CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 92e547a4a4..028c2a918f 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -400,7 +400,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc) if (namesUsed > 0) fbc->chat_name += L", "; - std::tstring tname = _A2T(participant.c_str(), CP_UTF8); + std::wstring tname = _A2T(participant.c_str(), CP_UTF8); fbc->chat_name += utils::text::prepare_name(tname, false); if (++namesUsed >= FACEBOOK_CHATROOM_NAMES_COUNT) @@ -408,14 +408,14 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc) } if (fbc->participants.size() > namesUsed) { - TCHAR more[200]; + wchar_t more[200]; mir_sntprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); fbc->chat_name = more; } // If there are no participants to create a name from, use just thread_id if (fbc->chat_name.empty()) - fbc->chat_name = std::tstring(_A2T(fbc->thread_id.c_str())); // TODO: is this needed? Isn't it showed automatically as id if there is no name? + fbc->chat_name = std::wstring(_A2T(fbc->thread_id.c_str())); // TODO: is this needed? Isn't it showed automatically as id if there is no name? } debugLogA("*** Chat thread info processed"); diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 2f349531ff..75aa98da3b 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -272,9 +272,9 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara { data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); - TCHAR mindMessageT[FACEBOOK_MIND_LIMIT + 1]; - TCHAR urlT[1024]; - TCHAR placeT[100]; + wchar_t mindMessageT[FACEBOOK_MIND_LIMIT + 1]; + wchar_t urlT[1024]; + wchar_t placeT[100]; GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT)); GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT)); @@ -394,7 +394,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_NOTIFY: if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY) { - char str[128]; TCHAR tstr[128]; + char str[128]; wchar_t tstr[128]; GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str)); db_set_s(0, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str); diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index a70757e1c3..43c8f18f86 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -55,7 +55,7 @@ struct facebook_user this->type = CONTACT_NONE; } - TCHAR *getMirVer() + wchar_t *getMirVer() { switch (this->client) { case CLIENT_APP: @@ -87,7 +87,7 @@ struct chatroom_participant struct facebook_chatroom { std::string thread_id; - std::tstring chat_name; + std::wstring chat_name; std::map<std::string, chatroom_participant> participants; bool can_reply; bool is_archived; @@ -219,9 +219,9 @@ struct wall_data this->title = NULL; this->isPage = false; } - wall_data(std::string user_id, TCHAR *title, bool isPage = false) : user_id(user_id), title(title), isPage(isPage) {} + wall_data(std::string user_id, wchar_t *title, bool isPage = false) : user_id(user_id), title(title), isPage(isPage) {} std::string user_id; - TCHAR *title; + wchar_t *title; bool isPage; }; @@ -236,7 +236,7 @@ struct post_status_data { struct open_url { - open_url(TCHAR *browser, TCHAR *url) : browser(browser), url(url) {} - TCHAR *browser; - TCHAR *url; + open_url(wchar_t *browser, wchar_t *url) : browser(browser), url(url) {} + wchar_t *browser; + wchar_t *url; }; diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 0fc052b563..660b2424f5 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, std::string *url, std::string *notification_id, const char *icon) +HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, DWORD flags, std::string *url, std::string *notification_id, const char *icon) { if (title == NULL || info == NULL) return NULL; @@ -83,8 +83,8 @@ HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWO }*/ POPUPDATACLASS pd = { sizeof(pd) }; - pd.ptszTitle = title; - pd.ptszText = info; + pd.pwszTitle = title; + pd.pwszText = info; pd.pszClassName = name; pd.hContact = contact; if (icon != NULL) { diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 9be06826d7..68d3934e0f 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -311,7 +311,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO *message_text += "\n\n"; if (!attachments_text.empty()) { - std::tstring newText; + std::wstring newText; if (type == "sticker") newText = TranslateT("a sticker"); else if (type == "share") @@ -327,7 +327,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO else newText = _A2T(type.c_str()); - TCHAR title[200]; + wchar_t title[200]; mir_sntprintf(title, TranslateT("User sent %s:"), newText.c_str()); *message_text += T2Utf(title); @@ -760,7 +760,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo // Probably means client: guess 0 = web, 8 = messenger, 10 = something else? if (vc_) { int vc = vc_.as_int(); - TCHAR *client; + wchar_t *client; if (vc == 0) { client = _T(FACEBOOK_CLIENT_WEB); @@ -877,7 +877,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo } // Probably means client: guess 0 = web, 8 = messenger, 10 = something else? if (vc_) { - TCHAR *client = _T(FACEBOOK_CLIENT_WEB); + wchar_t *client = _T(FACEBOOK_CLIENT_WEB); /*if (vc == 0) { // means active some time ago? (on messenger or also on web) @@ -1073,7 +1073,7 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< chatrooms->erase(iter); // this is not chatroom } else { - iter->second->chat_name = std::tstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name... + iter->second->chat_name = std::wstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name... const JSONNode &participants = (*it)["participants"]; for (auto jt = participants.begin(); jt != participants.end(); ++jt) { @@ -1275,7 +1275,7 @@ int facebook_json_parser::parse_chat_info(std::string *data, facebook_chatroom* fbc->is_archived = (*it)["is_archived"].as_bool(); fbc->is_subscribed = (*it)["is_subscribed"].as_bool(); fbc->read_only = (*it)["read_only"].as_bool(); - fbc->chat_name = std::tstring(ptrT(mir_utf8decodeT(name_.as_string().c_str()))); + fbc->chat_name = std::wstring(ptrT(mir_utf8decodeT(name_.as_string().c_str()))); } return EXIT_SUCCESS; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index 8c50a507ba..bf63f1f8a7 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -74,7 +74,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
FacebookProto *proto = new FacebookProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index bfb4dd24d4..e5777e6f29 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -217,10 +217,10 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, std::string b64 = ptrA(mir_base64_encode((PBYTE)sticker.c_str(), (unsigned)sticker.length())); b64 = utils::url::encode(b64); - std::tstring filename = GetAvatarFolder() + L"\\stickers\\"; + std::wstring filename = GetAvatarFolder() + L"\\stickers\\"; ptrT dir(mir_tstrdup(filename.c_str())); - filename += (TCHAR*)_A2T(b64.c_str()); + filename += (wchar_t*)_A2T(b64.c_str()); filename += L".png"; // Check if we have this sticker already and download it it not diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 1a169b684c..6be6c3f539 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -516,9 +516,9 @@ void FacebookProto::SyncThreads(void*) } std::string truncateUtf8(std::string &text, size_t maxLength) { - // To not split some unicode character we need to transform it to TCHAR first, then split it, and then convert it back, because we want std::string as result + // To not split some unicode character we need to transform it to wchar_t first, then split it, and then convert it back, because we want std::string as result // TODO: Probably there is much simpler and nicer way - std::tstring ttext = ptrT(mir_utf8decodeT(text.c_str())); + std::wstring ttext = ptrT(mir_utf8decodeT(text.c_str())); if (ttext.length() > maxLength) { ttext = ttext.substr(0, maxLength) + L"\x2026"; // unicode ellipsis return std::string(_T2A(ttext.c_str(), CP_UTF8)); @@ -1192,7 +1192,7 @@ void FacebookProto::SearchAckThread(void *targ) int count = 0; - std::string search = utils::url::encode(T2Utf((TCHAR *)targ).str()); + std::string search = utils::url::encode(T2Utf((wchar_t *)targ).str()); std::string ssid; while (count < 50 && !isOffline()) @@ -1246,11 +1246,11 @@ void FacebookProto::SearchAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = tid; - psr.nick.t = tnick; - psr.firstName.t = tname; - psr.lastName.t = tsurname; - psr.email.t = tcommon; + psr.id.w = tid; + psr.nick.w = tnick; + psr.firstName.w = tname; + psr.lastName.w = tsurname; + psr.email.w = tcommon; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); } @@ -1271,7 +1271,7 @@ void FacebookProto::SearchIdAckThread(void *targ) { facy.handle_entry("searchIdAckThread"); - std::string search = utils::url::encode(T2Utf((TCHAR*)targ).str()) + "?"; + std::string search = utils::url::encode(T2Utf((wchar_t*)targ).str()) + "?"; if (!isOffline()) { @@ -1307,9 +1307,9 @@ void FacebookProto::SearchIdAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = tid; - psr.firstName.t = tname; - psr.lastName.t = tsurname; + psr.id.w = tid; + psr.firstName.w = tname; + psr.lastName.w = tsurname; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); } } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 0795f2ba16..a0fdcf6c52 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : +FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : PROTO<FacebookProto>(proto_name, username), m_tszDefaultGroup(getTStringA(FACEBOOK_KEY_DEF_GROUP)) { @@ -82,7 +82,7 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : InitSounds(); // Create standard network connection - TCHAR descr[512]; + wchar_t descr[512]; NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; @@ -90,7 +90,7 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { - TCHAR error[200]; + wchar_t error[200]; mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -216,7 +216,7 @@ int FacebookProto::SetStatus(int new_status) return 0; } -int FacebookProto::SetAwayMsg(int, const TCHAR *msg) +int FacebookProto::SetAwayMsg(int, const wchar_t *msg) { if (!msg) { last_status_msg_.clear(); @@ -248,38 +248,38 @@ void FacebookProto::SetAwayMsgWorker(void *p) } } -HANDLE FacebookProto::SearchBasic(const TCHAR* id) +HANDLE FacebookProto::SearchBasic(const wchar_t* id) { if (isOffline()) return 0; - TCHAR *tid = mir_tstrdup(id); + wchar_t *tid = mir_tstrdup(id); ForkThread(&FacebookProto::SearchIdAckThread, tid); return tid; } -HANDLE FacebookProto::SearchByEmail(const TCHAR* email) +HANDLE FacebookProto::SearchByEmail(const wchar_t* email) { if (isOffline()) return 0; - TCHAR *temail = mir_tstrdup(email); + wchar_t *temail = mir_tstrdup(email); ForkThread(&FacebookProto::SearchAckThread, temail); return temail; } -HANDLE FacebookProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) +HANDLE FacebookProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { - TCHAR arg[200]; + wchar_t arg[200]; mir_sntprintf(arg, L"%s %s %s", nick, firstName, lastName); return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs) } MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - ptrA id(mir_t2a_cp(psr->id.t, CP_UTF8)); - ptrA name(mir_t2a_cp(psr->firstName.t, CP_UTF8)); - ptrA surname(mir_t2a_cp(psr->lastName.t, CP_UTF8)); + ptrA id(mir_t2a_cp(psr->id.w, CP_UTF8)); + ptrA name(mir_t2a_cp(psr->firstName.w, CP_UTF8)); + ptrA surname(mir_t2a_cp(psr->lastName.w, CP_UTF8)); if (id == NULL) return NULL; @@ -310,7 +310,7 @@ MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return hContact; } -int FacebookProto::AuthRequest(MCONTACT hContact, const TCHAR *) +int FacebookProto::AuthRequest(MCONTACT hContact, const wchar_t *) { return RequestFriendship(hContact, NULL); } @@ -327,7 +327,7 @@ int FacebookProto::Authorize(MEVENT hDbEvent) return ApproveFriendship(hContact, NULL); } -int FacebookProto::AuthDeny(MEVENT hDbEvent, const TCHAR *) +int FacebookProto::AuthDeny(MEVENT hDbEvent, const wchar_t *) { if (!hDbEvent || isOffline()) return 1; @@ -499,31 +499,31 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; odp.position = 271828; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszGroup = LPGENW("Network"); + odp.pwszTab = LPGENW("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pfnDlgProc = FBOptionsProc; Options_AddPage(wParam, &odp); odp.position = 271829; - odp.ptszTab = LPGENT("Events"); + odp.pwszTab = LPGENW("Events"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_EVENTS); odp.pfnDlgProc = FBOptionsEventsProc; Options_AddPage(wParam, &odp); odp.position = 271830; - odp.ptszTab = LPGENT("Statuses"); + odp.pwszTab = LPGENW("Statuses"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_STATUSES); odp.pfnDlgProc = FBOptionsStatusesProc; Options_AddPage(wParam, &odp); odp.position = 271831; - odp.ptszTab = LPGENT("Messaging"); + odp.pwszTab = LPGENW("Messaging"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MESSAGING); odp.pfnDlgProc = FBOptionsMessagingProc; Options_AddPage(wParam, &odp); @@ -561,7 +561,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) wall->user_id = id; wall->isPage = false; if (wall->user_id == facy.self_.user_id) { - wall->title = _tcsdup(TranslateT("Own wall")); + wall->title = wcsdup(TranslateT("Own wall")); } else wall->title = getTStringA(hContact, FACEBOOK_KEY_NICK); @@ -789,7 +789,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) if (tname == NULL) return 1; - TCHAR tstr[256]; + wchar_t tstr[256]; mir_sntprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname); if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { @@ -1005,7 +1005,7 @@ void FacebookProto::InitPopups() ppc.PluginWindowProc = PopupDlgProc; ppc.lParam = APF_RETURN_HWND; - TCHAR desc[256]; + wchar_t desc[256]; char name[256]; // Client @@ -1102,15 +1102,15 @@ void FacebookProto::InitHotkeys() hkd.dwFlags = HKD_TCHAR; mir_strcpy(tDest, "/VisitProfile"); - hkd.ptszDescription = LPGENT("Visit profile"); + hkd.ptszDescription = LPGENW("Visit profile"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/VisitNotifications"); - hkd.ptszDescription = LPGENT("Visit notifications"); + hkd.ptszDescription = LPGENW("Visit notifications"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Mind"); - hkd.ptszDescription = LPGENT("Show 'Share status' window"); + hkd.ptszDescription = LPGENW("Show 'Share status' window"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_EXT, 'F'); Hotkey_Register(&hkd); } @@ -1120,12 +1120,12 @@ void FacebookProto::InitHotkeys() */ void FacebookProto::InitSounds() { - SkinAddNewSoundExT("Notification", m_tszUserName, LPGENT("Notification")); - SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENT("Newsfeed event")); - SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENT("Other event")); - SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENT("Friendship event")); - SkinAddNewSoundExT("Ticker", m_tszUserName, LPGENT("Ticker event")); - SkinAddNewSoundExT("Memories", m_tszUserName, LPGENT("Memories")); + SkinAddNewSoundExT("Notification", m_tszUserName, LPGENW("Notification")); + SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENW("Newsfeed event")); + SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENW("Other event")); + SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENW("Friendship event")); + SkinAddNewSoundExT("Ticker", m_tszUserName, LPGENW("Ticker event")); + SkinAddNewSoundExT("Memories", m_tszUserName, LPGENW("Memories")); } /** @@ -1142,8 +1142,8 @@ void FacebookProto::MessageRead(MCONTACT hContact) if (!time) return; - TCHAR ttime[64]; - _tcsftime(ttime, _countof(ttime), L"%X", localtime(&time)); + wchar_t ttime[64]; + wcsftime(ttime, _countof(ttime), L"%X", localtime(&time)); StatusTextData st = { 0 }; st.cbSize = sizeof(st); diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 92a2799b88..d7792aa029 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class FacebookProto : public PROTO<FacebookProto> { public: - FacebookProto(const char *proto_name, const TCHAR *username); + FacebookProto(const char *proto_name, const wchar_t *username); ~FacebookProto(); inline const char* ModuleName() const @@ -83,15 +83,15 @@ public: virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason); - virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason); + virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage); virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); virtual int __cdecl GetInfo(MCONTACT hContact, int infoType); - virtual HANDLE __cdecl SearchBasic(const TCHAR* id); - virtual HANDLE __cdecl SearchByEmail(const TCHAR* email); - virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName); + virtual HANDLE __cdecl SearchBasic(const wchar_t* id); + virtual HANDLE __cdecl SearchByEmail(const wchar_t* email); + virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName); virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); @@ -99,7 +99,7 @@ public: virtual int __cdecl SetStatus(int iNewStatus); virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg); + virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg); virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); @@ -208,7 +208,7 @@ public: void StopTyping(MCONTACT hContact); // Chats handling - void AddChat(const char *chat_id, const TCHAR *name); + void AddChat(const char *chat_id, const wchar_t *name); void UpdateChat(const char *chat_id, const char *id, const char *name, const char *message, DWORD timestamp = 0, bool is_old = false); void RenameChat(const char *chat_id, const char *name); bool IsChatContact(const char *chat_id, const char *id); @@ -228,7 +228,7 @@ public: facebook_client facy; // TODO: Refactor to "client" and make dynamic // Helpers - std::tstring GetAvatarFolder(); + std::wstring GetAvatarFolder(); bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url); void CheckAvatarChange(MCONTACT hContact, const std::string &image_url); void ToggleStatusMenuItems(bool bEnable); @@ -260,6 +260,6 @@ public: static void CALLBACK APC_callback(ULONG_PTR p); // Information providing - HWND NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL); + HWND NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL); void ShowNotifications(); }; diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index b0d6c61896..edd023c8d5 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -32,19 +32,19 @@ LPTSTR CreateAvaFile(HANDLE *hFile)
{
- TCHAR name[MAX_PATH + 2];
+ wchar_t name[MAX_PATH + 2];
if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)&name))
return NULL;
- TCHAR *p = _tcsrchr(name, '.');
+ wchar_t *p = wcsrchr(name, '.');
if (p)
*p = 0;
- TCHAR path[MAX_PATH + 2];
+ wchar_t path[MAX_PATH + 2];
if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)&path))
return NULL;
- TCHAR full[MAX_PATH + 2];
+ wchar_t full[MAX_PATH + 2];
mir_sntprintf(full, AVA_FILE_NAME_FORMAT, path, name);
CreateDirectoryTreeT(full);
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 1948a21dbf..5dd4cf0345 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -31,8 +31,6 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam);
-#include <tchar.h>
-
GoogleTalkAcc* isGoogle(LPARAM lParam)
{
return g_accs.find((GoogleTalkAcc*)&lParam);
@@ -42,7 +40,7 @@ GoogleTalkAcc* isGoogle(LPARAM lParam) void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid)
{
- ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
+ ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid);
size_t l = mir_tstrlen(buf);
mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
assert(l >= mir_tstrlen(buf));
@@ -50,8 +48,8 @@ void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid) void MakeUrlHex(LPTSTR url, LPCTSTR tid)
{
- ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
- LPTSTR tidInUrl = _tcsstr(url, tid);
+ ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid);
+ LPTSTR tidInUrl = wcsstr(url, tid);
LPTSTR trail = tidInUrl + mir_tstrlen(tid);
wsprintf(tidInUrl, L"%x%08x", iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!!
wmemmove(tidInUrl + mir_tstrlen(tidInUrl), trail, mir_tstrlen(trail) + 1);
@@ -59,13 +57,13 @@ void MakeUrlHex(LPTSTR url, LPCTSTR tid) LPTSTR ExtractJid(LPCTSTR jidWithRes)
{
- LPCTSTR p = _tcsrchr(jidWithRes, '/');
+ LPCTSTR p = wcsrchr(jidWithRes, '/');
if (p == NULL)
return mir_tstrdup(jidWithRes);
size_t l = size_t(p - jidWithRes);
- LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(TCHAR));
- _tcsncpy(result, jidWithRes, l);
+ LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(wchar_t));
+ wcsncpy(result, jidWithRes, l);
result[l] = 0;
return result;
}
@@ -166,7 +164,7 @@ BOOL MailListHandler(IJabberInterface *ji, HXML node, void *) __finally {
if (jidWithRes)
ji->AddTemporaryIqHandler(TimerHandler, JABBER_IQ_TYPE_RESULT, 0,
- (PVOID)_tcsdup(jidWithRes), TIMER_INTERVAL);
+ (PVOID)wcsdup(jidWithRes), TIMER_INTERVAL);
// Never get a real result stanza. Results elapsed request after WAIT_TIMER_INTERVAL ms
}
}
@@ -186,7 +184,7 @@ void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) lastMailTime(ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid)),
lastThreadId(ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid));
- TCHAR id[30];
+ wchar_t id[30];
mir_sntprintf(id, JABBER_IQID_FORMAT, uID);
xmlAddAttr(node, ATTRNAME_ID, id);
@@ -246,7 +244,7 @@ void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) ptrT jid(ExtractJid(jidWithResource));
xmlAddAttr(node, ATTRNAME_TO, jid);
- TCHAR id[30];
+ wchar_t id[30];
mir_sntprintf(id, JABBER_IQID_FORMAT, ji->SerialNext());
xmlAddAttr(node, ATTRNAME_ID, id);
@@ -293,7 +291,7 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *) if (queryNode) {
LPCTSTR ptszId = xmlGetAttrValue(node, ATTRNAME_ID);
if (ptszId)
- ji->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, _ttoi(ptszId + 4), NULL, RESPONSE_TIMEOUT, 500);
+ ji->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, _wtoi(ptszId + 4), NULL, RESPONSE_TIMEOUT, 500);
}
if (!mir_tstrcmp(xmlGetName(node), L"presence") && xmlGetAttrValue(node, ATTRNAME_TO) == 0) {
@@ -412,7 +410,7 @@ int OnExtListInit(WPARAM wParam, LPARAM lParam) {
GoogleTalkAcc *gta = isGoogle(lParam);
if (gta != NULL) {
- LIST<TCHAR> *pList = (LIST<TCHAR>*)wParam;
+ LIST<wchar_t> *pList = (LIST<wchar_t>*)wParam;
pList->insert(JABBER_EXT_GTALK_PMUC);
}
return 0;
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 5b0ab1159e..f4e6c3ee4d 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -200,12 +200,12 @@ void OpenContactInbox(LPCSTR szModuleName) if (tszJid == NULL)
return;
- LPTSTR host = _tcschr(tszJid, '@');
+ LPTSTR host = wcschr(tszJid, '@');
if (!host)
return;
*host++ = 0;
- TCHAR buf[1024];
+ wchar_t buf[1024];
if (mir_tstrcmpi(host, COMMON_GMAIL_HOST1) && mir_tstrcmpi(host, COMMON_GMAIL_HOST2))
mir_sntprintf(buf, INBOX_URL_FORMAT, L"a/", host); // hosted
else
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 6b167af949..fda2db7eb5 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -177,7 +177,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST // SetAvatar(hContact);
if (displayName == NULL) {
- TCHAR *tszTemp = (TCHAR*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
+ wchar_t *tszTemp = (wchar_t*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t));
FormatPseudocontactDisplayName(tszTemp, jid, unreadCount);
db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
}
@@ -230,8 +230,8 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP }
data->PluginWindowProc = PopupProc;
- size_t lurl = (mir_tstrlen(url) + 1) * sizeof(TCHAR);
- size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(TCHAR);
+ size_t lurl = (mir_tstrlen(url) + 1) * sizeof(wchar_t);
+ size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(wchar_t);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index d141179cc8..02394e0949 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -26,15 +26,15 @@ #define ACCOUNT_PROP_NAME L"{BF447EBA-27AE-4DB7-893C-FC42A3F74D75}"
#define DIALOG_INITIALIZED_PROP_NAME L"{5EE59FE5-679A-4A29-B0A1-03092E7AC20E}"
-#define POPUPS_OPTIONS_GROUP LPGENT("Popups")
-#define NETWORK_OPTIONS_GROUP LPGENT("Network")
+#define POPUPS_OPTIONS_GROUP LPGENW("Popups")
+#define NETWORK_OPTIONS_GROUP LPGENW("Network")
#define NOTIFY_SETTINGS_FROM_MOD_NAME SHORT_PLUGIN_NAME ".NotifySettingsFromModName"
-#define TEST_LETTER_SUBJECT LPGENT("Why C sucks")
+#define TEST_LETTER_SUBJECT LPGENW("Why C sucks")
#define TEST_LETTER_INBOX L"brickstrace@gmail.com [1]"
#define TEST_LETTER_SENDER L" bems\n"
-#define TEST_LETTER_SNIP LPGENT("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions")
+#define TEST_LETTER_SNIP LPGENW("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions")
void CheckControlsEnabled(HWND wnd)
{
@@ -159,10 +159,10 @@ void ShowTestPopup(HWND wnd) mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
int len = SendDlgItemMessage(wnd, IDC_TIMEOUTEDIT, WM_GETTEXTLENGTH, 0, 0) + 1;
- LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(TCHAR));
+ LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(wchar_t));
GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, len);
- data.iSeconds = _ttoi(timeout);
+ data.iSeconds = _wtoi(timeout);
data.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
data.colorBack = (COLORREF)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0);
@@ -176,7 +176,7 @@ void ShowTestPopup(HWND wnd) INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TCHAR timeout[20];
+ wchar_t timeout[20];
switch (msg) {
case WM_INITDIALOG:
@@ -184,7 +184,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
- _itot(db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10);
+ _itow(db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10);
SetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout);
SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE);
@@ -212,7 +212,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM db_set_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0));
GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, _countof(timeout));
- db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
+ db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _wtoi(timeout));
}
return 0;
}
@@ -223,11 +223,11 @@ int OptionsInitialization(WPARAM wParam, LPARAM) {
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = MAIL_NOTIFICATIONS;
+ odp.pwszTitle = MAIL_NOTIFICATIONS;
odp.pfnDlgProc = PopupsOptionsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS);
odp.hInstance = g_hInst;
- odp.ptszGroup = POPUPS_OPTIONS_GROUP;
+ odp.pwszGroup = POPUPS_OPTIONS_GROUP;
odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
Options_AddPage(wParam, &odp);
}
@@ -237,13 +237,13 @@ int OptionsInitialization(WPARAM wParam, LPARAM) PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa != NULL) {
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = pa->tszAccountName;
+ odp.pwszTitle = pa->tszAccountName;
odp.pfnDlgProc = AccOptionsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS);
odp.hInstance = g_hInst;
- odp.ptszGroup = NETWORK_OPTIONS_GROUP;
+ odp.pwszGroup = NETWORK_OPTIONS_GROUP;
odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
- odp.ptszTab = MAIL_NOTIFICATIONS;
+ odp.pwszTab = MAIL_NOTIFICATIONS;
odp.dwInitParam = (LPARAM)szProto;
Options_AddPage(wParam, &odp);
}
diff --git a/protocols/GTalkExt/src/options.h b/protocols/GTalkExt/src/options.h index f6de20a154..b9bb84ceea 100644 --- a/protocols/GTalkExt/src/options.h +++ b/protocols/GTalkExt/src/options.h @@ -25,9 +25,9 @@ #define JABBER_FEAT_GTALK_PMUC L"http://www.google.com/xmpp/protocol/pmuc/v1"
-#define MAIL_NOTIFICATIONS LPGENT("GMail notifications")
-#define FULL_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s\n%s\n")
-#define SHORT_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s")
+#define MAIL_NOTIFICATIONS LPGENW("GMail notifications")
+#define FULL_NOTIFICATION_FORMAT LPGENW("subject\n %s\nfrom\n%s\n%s\n")
+#define SHORT_NOTIFICATION_FORMAT LPGENW("subject\n %s\nfrom\n%s")
#define PSEUDOCONTACT_LINK "GTalkExtNotifyContact"
#define PSEUDOCONTACT_FLAG "IsNotifyContact"
diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h index 6df16f3fee..f545ff3b25 100644 --- a/protocols/GTalkExt/src/stdafx.h +++ b/protocols/GTalkExt/src/stdafx.h @@ -27,7 +27,6 @@ #include <malloc.h>
#include <time.h>
#include <stdlib.h>
-#include <tchar.h>
// Windows Header Files:
#include <windows.h>
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 3839aeb5d1..ef886b764f 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -40,7 +40,7 @@ static LPSTR TipperItemProps[] = #define TIPPER_ITEMS_MOD_NAME "Tipper_Items"
#define TIPPER_ITEM_COUNT_SETTING "DINumValues"
#define UNREAD_THREADS_RAW L"%raw:" _T(SHORT_PLUGIN_NAME) L"/UnreadThreads%"
-#define UNREAD_THREADS_LABEL LPGENT("Unread threads:")
+#define UNREAD_THREADS_LABEL LPGENW("Unread threads:")
void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
{
@@ -99,7 +99,7 @@ void AddTipperItem() for (i = itemCount; i > 0; i /= 10) l++; // var setting path
l += 30; // const setting part
- LPSTR setting = (LPSTR)_alloca(l * sizeof(TCHAR));
+ LPSTR setting = (LPSTR)_alloca(l * sizeof(wchar_t));
for (i = 0; i < itemCount; i++) {
mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 0ecdd36433..f3c8a3cc05 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -26,28 +26,28 @@ //////////////////////////////////////////////////////////
// Avatars support
//
-void GGPROTO::getAvatarFilename(MCONTACT hContact, TCHAR *pszDest, int cbLen)
+void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
- if (_taccess(pszDest, 0)) {
+ if (_waccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
if (ret == 0)
debugLog(L"getAvatarFilename(): Created new directory for avatar cache: %s.", pszDest);
else {
debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
}
- const TCHAR *avatartype = ProtoGetAvatarExtension(getByte(hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE));
+ const wchar_t *avatartype = ProtoGetAvatarExtension(getByte(hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE));
if (hContact != NULL) {
DBVARIANT dbv;
if (!getString(hContact, GG_KEY_AVATARHASH, &dbv)) {
- TCHAR* avatarHashT = mir_a2t(dbv.pszVal);
+ wchar_t* avatarHashT = mir_a2t(dbv.pszVal);
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
mir_free(avatarHashT);
db_free(&dbv);
@@ -83,11 +83,11 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) if ((strncmp(resp->pData, "<result>", 8) == 0) || (strncmp(resp->pData, "<?xml", 5) == 0)){
//if this url returned xml data (before and after 11.2013 gg convention)
- TCHAR *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2t(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
- const TCHAR *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
+ const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
if (blank != NULL && mir_tstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
*avatarts = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
@@ -262,15 +262,15 @@ void __cdecl GGPROTO::avatarrequestthread(void*) setByte(data->hContact, GG_KEY_AVATARTYPE, (BYTE)avatarType);
getAvatarFilename(ai.hContact, ai.filename, _countof(ai.filename));
- file_fd = _topen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
+ file_fd = _wopen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
if (file_fd != -1) {
_write(file_fd, resp->pData, resp->dataLength);
_close(file_fd);
result = 1;
debugLog(L"avatarrequestthread() new avatar_transfers item. Saved data to file=%s.", ai.filename);
} else {
- debugLog(L"avatarrequestthread(): _topen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno));
- TCHAR error[512];
+ debugLog(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno));
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
@@ -358,11 +358,11 @@ void __cdecl GGPROTO::setavatarthread(void *param) debugLogA("setavatarthread(): started. Trying to set user avatar.");
//read file
- TCHAR *szFilename = (TCHAR*)param;
- int file_fd = _topen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD);
+ wchar_t *szFilename = (wchar_t*)param;
+ int file_fd = _wopen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD);
if (file_fd == -1) {
debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
mir_free(szFilename);
@@ -507,7 +507,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) }
-void GGPROTO::setAvatar(const TCHAR *szFilename)
+void GGPROTO::setAvatar(const wchar_t *szFilename)
{
#ifdef DEBUGMODE
debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 2632b89d75..05e746cf8f 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -236,19 +236,19 @@ void __cdecl GGPROTO::mainthread(void *) int hostnum = 0, hostcount = 0;
GGHOST hosts[64];
// Gadu-gadu login errors
- static const struct tagReason { int type; TCHAR *str; } reason[] = {
- { GG_FAILURE_RESOLVING, LPGENT("Miranda was unable to resolve the name of the Gadu-Gadu server to its numeric address.") },
- { GG_FAILURE_CONNECTING, LPGENT("Miranda was unable to make a connection with a server. It is likely that the server is down, in which case you should wait for a while and try again later.") },
- { GG_FAILURE_INVALID, LPGENT("Received invalid server response.") },
- { GG_FAILURE_READING, LPGENT("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") },
- { GG_FAILURE_WRITING, LPGENT("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") },
- { GG_FAILURE_PASSWORD, LPGENT("Your Gadu-Gadu number and password combination was rejected by the Gadu-Gadu server. Please check login details at Options -> Network -> Gadu-Gadu and try again.") },
- { GG_FAILURE_404, LPGENT("Connecting to Gadu-Gadu hub failed.") },
- { GG_FAILURE_TLS, LPGENT("Cannot establish secure connection.") },
- { GG_FAILURE_NEED_EMAIL, LPGENT("Server disconnected asking you for changing your e-mail.") },
- { GG_FAILURE_INTRUDER, LPGENT("Too many login attempts with invalid password.") },
- { GG_FAILURE_UNAVAILABLE, LPGENT("Gadu-Gadu servers are now down. Try again later.") },
- { 0, LPGENT("Unknown") }
+ static const struct tagReason { int type; wchar_t *str; } reason[] = {
+ { GG_FAILURE_RESOLVING, LPGENW("Miranda was unable to resolve the name of the Gadu-Gadu server to its numeric address.") },
+ { GG_FAILURE_CONNECTING, LPGENW("Miranda was unable to make a connection with a server. It is likely that the server is down, in which case you should wait for a while and try again later.") },
+ { GG_FAILURE_INVALID, LPGENW("Received invalid server response.") },
+ { GG_FAILURE_READING, LPGENW("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") },
+ { GG_FAILURE_WRITING, LPGENW("The connection with the server was abortively closed during the connection attempt. You may have lost your local network connection.") },
+ { GG_FAILURE_PASSWORD, LPGENW("Your Gadu-Gadu number and password combination was rejected by the Gadu-Gadu server. Please check login details at Options -> Network -> Gadu-Gadu and try again.") },
+ { GG_FAILURE_404, LPGENW("Connecting to Gadu-Gadu hub failed.") },
+ { GG_FAILURE_TLS, LPGENW("Cannot establish secure connection.") },
+ { GG_FAILURE_NEED_EMAIL, LPGENW("Server disconnected asking you for changing your e-mail.") },
+ { GG_FAILURE_INTRUDER, LPGENW("Too many login attempts with invalid password.") },
+ { GG_FAILURE_UNAVAILABLE, LPGENW("Gadu-Gadu servers are now down. Try again later.") },
+ { 0, LPGENW("Unknown") }
};
time_t logonTime = 0;
time_t timeDeviation = getWord(GG_KEY_TIMEDEVIATION, GG_KEYDEF_TIMEDEVIATION);
@@ -359,8 +359,8 @@ void __cdecl GGPROTO::mainthread(void *) if (dcc && getByte(GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING)) {
if (!getString(GG_KEY_FORWARDHOST, &dbv)) {
if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal))) {
- TCHAR error[128];
- TCHAR* forwardHostT = mir_a2t(dbv.pszVal);
+ wchar_t error[128];
+ wchar_t* forwardHostT = mir_a2t(dbv.pszVal);
mir_sntprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
mir_free(forwardHostT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
@@ -390,8 +390,8 @@ retry: {
if (!(p.server_addr = gg_dnslookup(this, hosts[hostnum].hostname)))
{
- TCHAR error[128];
- TCHAR* hostnameT = mir_a2t(hosts[hostnum].hostname);
+ wchar_t error[128];
+ wchar_t* hostnameT = mir_a2t(hosts[hostnum].hostname);
mir_sntprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT);
mir_free(hostnameT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
@@ -414,7 +414,7 @@ retry: // Check if connection attempt wasn't cancelled by the user
if (m_iDesiredStatus != ID_STATUS_OFFLINE)
{
- TCHAR error[128], *perror = NULL;
+ wchar_t error[128], *perror = NULL;
// Lookup for error desciption
if (errno == EACCES) {
for (int i = 0; reason[i].type; i++) if (reason[i].type == gg_failno) {
@@ -480,7 +480,7 @@ retry: {
broadcastnewstatus(m_iDesiredStatus);
// Change status of the contact with our own UIN (if got yourself added to the contact list)
- TCHAR *status_descr = mir_utf8decodeT(p.status_descr);
+ wchar_t *status_descr = mir_utf8decodeT(p.status_descr);
changecontactstatus(p.uin, p.status, status_descr, 0, 0, 0, 0);
mir_free(status_descr);
}
@@ -562,7 +562,7 @@ retry: for (; n->uin; n++)
{
- TCHAR *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL;
+ wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL;
changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version);
if (descrT) mir_free(descrT);
}
@@ -575,7 +575,7 @@ retry: int i;
for(i = 0; e->event.notify60[i].uin; i++) {
if (e->event.notify60[i].uin == uin) continue;
- TCHAR *descrT = mir_utf8decodeT(e->event.notify60[i].descr);
+ wchar_t *descrT = mir_utf8decodeT(e->event.notify60[i].descr);
changecontactstatus(e->event.notify60[i].uin, e->event.notify60[i].status, descrT,
e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port,
e->event.notify60[i].version);
@@ -617,12 +617,12 @@ retry: {
// Loadup fields
const char *__fmnumber = gg_pubdir50_get(res, i, GG_PUBDIR50_UIN);
- TCHAR *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
- TCHAR *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
- TCHAR *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
- TCHAR *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
- TCHAR *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
- TCHAR *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
+ wchar_t *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
+ wchar_t *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
+ wchar_t *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
+ wchar_t *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
+ wchar_t *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
+ wchar_t *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
const char *__birthyear = gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR);
const char *__gender = gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER);
const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS);
@@ -632,10 +632,10 @@ retry: debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq);
if (res->seq == GG_SEQ_SEARCH)
{
- TCHAR strFmt1[64];
- TCHAR strFmt2[64];
+ wchar_t strFmt1[64];
+ wchar_t strFmt2[64];
- _tcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
+ wcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
if (__city) {
mir_sntprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
@@ -655,11 +655,11 @@ retry: memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.nick.t = __nickname;
- psr.firstName.t = __firstname;
- psr.lastName.t = __lastname;
- psr.email.t = strFmt2;
- psr.id.t = _ultot(uin, strFmt1, 10);
+ psr.nick.w = __nickname;
+ psr.firstName.w = __firstname;
+ psr.lastName.w = __lastname;
+ psr.email.w = strFmt2;
+ psr.id.w = _ultot(uin, strFmt1, 10);
psr.uin = uin;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM)&psr);
}
@@ -757,7 +757,7 @@ retry: // Status (deprecated)
case GG_EVENT_STATUS:
{
- TCHAR *descrT = mir_utf8decodeT(e->event.status.descr);
+ wchar_t *descrT = mir_utf8decodeT(e->event.status.descr);
changecontactstatus(e->event.status.uin, e->event.status.status, descrT, 0, 0, 0, 0);
mir_free(descrT);
}
@@ -770,7 +770,7 @@ retry: int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE);
uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0);
- TCHAR *descrT = mir_utf8decodeT(e->event.status60.descr);
+ wchar_t *descrT = mir_utf8decodeT(e->event.status60.descr);
if (e->event.status60.uin == uin)
{
@@ -822,19 +822,19 @@ retry: // Check if groupchat
if (e->event.msg.recipients_count && gc_enabled && !getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF))
{
- TCHAR *chat = gc_getchat(e->event.msg.sender, e->event.msg.recipients, e->event.msg.recipients_count);
+ wchar_t *chat = gc_getchat(e->event.msg.sender, e->event.msg.recipients, e->event.msg.recipients_count);
if (chat)
{
- TCHAR id[32];
+ wchar_t id[32];
UIN2IDT(e->event.msg.sender, id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
- TCHAR* messageT = mir_utf8decodeT(e->event.msg.message);
+ wchar_t* messageT = mir_utf8decodeT(e->event.msg.message);
gce.ptszText = messageT;
- gce.ptszNick = (TCHAR*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
+ gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gce.dwFlags = GCEF_ADDTOLOG;
debugLog(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id);
@@ -886,18 +886,18 @@ retry: case GG_EVENT_MULTILOGON_MSG:
if (e->event.multilogon_msg.recipients_count && gc_enabled && !getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF))
{
- TCHAR *chat = gc_getchat(e->event.multilogon_msg.sender, e->event.multilogon_msg.recipients, e->event.multilogon_msg.recipients_count);
+ wchar_t *chat = gc_getchat(e->event.multilogon_msg.sender, e->event.multilogon_msg.recipients, e->event.multilogon_msg.recipients_count);
if (chat)
{
- TCHAR id[32];
+ wchar_t id[32];
UIN2IDT(getDword(GG_KEY_UIN, 0), id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
- TCHAR* messageT = mir_utf8decodeT(e->event.multilogon_msg.message);
+ wchar_t* messageT = mir_utf8decodeT(e->event.multilogon_msg.message);
gce.ptszText = messageT;
- TCHAR* nickT;
+ wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
nickT = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -965,12 +965,12 @@ retry: sessions_updatedlg();
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
- const TCHAR* szText = time(NULL) - logonTime > 3
+ const wchar_t* szText = time(NULL) - logonTime > 3
? TranslateT("You have logged in at another location")
: TranslateT("You are logged in at another location");
for (i = 0; i < e->event.multilogon_info.count; i++)
{
- TCHAR szMsg[MAX_SECONDLINE];
+ wchar_t szMsg[MAX_SECONDLINE];
if (iIndexes && iIndexes[i])
continue;
@@ -1052,14 +1052,14 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
- TCHAR* filenameT = mir_a2t((char*)dcc7->filename);
+ wchar_t* filenameT = mir_a2t((char*)dcc7->filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = filenameT;
- pre.files.t = &filenameT;
+ pre.descr.w = filenameT;
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre);
@@ -1146,8 +1146,8 @@ retry: case GG_EVENT_XML_ACTION:
if (getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)) {
HXML hXml;
- TCHAR *xmlAction;
- TCHAR *tag;
+ wchar_t *xmlAction;
+ wchar_t *tag;
xmlAction = mir_a2t(e->event.xml_action.data);
tag = mir_a2t("events");
@@ -1307,7 +1307,7 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM) ////////////////////////////////////////////////////////////
// When db settings changed
-static TCHAR* sttSettingToTchar( DBVARIANT* value )
+static wchar_t* sttSettingToTchar( DBVARIANT* value )
{
switch(value->type) {
case DBVT_ASCIIZ:
@@ -1342,7 +1342,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) // Contact is being renamed
if (gc_enabled && !strcmp(cws->szModule, m_szModuleName) && !strcmp(cws->szSetting, GG_KEY_NICK)){
- TCHAR* ptszVal = sttSettingToTchar(&(cws->value));
+ wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
if(ptszVal==NULL) return 0;
// Groupchat window contact is being renamed
@@ -1375,7 +1375,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) {
// If name changed... change nick
if (!strcmp(cws->szSetting, "MyHandle")){
- TCHAR* ptszVal = sttSettingToTchar(&(cws->value));
+ wchar_t* ptszVal = sttSettingToTchar(&(cws->value));
if(ptszVal==NULL) return 0;
setTString(hContact, GG_KEY_NICK, ptszVal);
mir_free(ptszVal);
@@ -1518,7 +1518,7 @@ void GGPROTO::notifyall() ////////////////////////////////////////////////////////////
// Get contact by uin
//
-MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
+MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick)
{
#ifdef DEBUGMODE
debugLogA("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist);
@@ -1570,7 +1570,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) gg_pubdir50(sess, req);
gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1);
gg_pubdir50_free(req);
- TCHAR* uinT = mir_a2t(ditoa(uin));
+ wchar_t* uinT = mir_a2t(ditoa(uin));
setTString(hContact, GG_KEY_NICK, uinT);
mir_free(uinT);
debugLogA("getcontact(): Search for nick on uin: %d", uin);
@@ -1591,7 +1591,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) // Change status of the contact with our own UIN (if got yourself added to the contact list)
if (getDword(GG_KEY_UIN, 0) == uin) {
gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
- TCHAR *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
+ wchar_t *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
@@ -1685,7 +1685,7 @@ int GGPROTO::status_gg2m(int status) ////////////////////////////////////////////////////////////
// Called when contact status is changed
//
-void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int, uint32_t remote_ip, uint16_t remote_port, uint32_t version)
+void GGPROTO::changecontactstatus(uin_t uin, int status, const wchar_t *idescr, int, uint32_t remote_ip, uint16_t remote_port, uint32_t version)
{
#ifdef DEBUGMODE
debugLogA("changecontactstatus(): uin=%d status=%d", uin, status);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index f3c500cc79..e4a593496f 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -38,9 +38,9 @@ extern INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special, int disableIfUndef) { DBVARIANT dbv = {0}; - TCHAR str[256]; - TCHAR *ptstr = NULL; - TCHAR* valT = NULL; + wchar_t str[256]; + wchar_t *ptstr = NULL; + wchar_t* valT = NULL; int unspecified = 0; dbv.type = DBVT_DELETED; @@ -69,7 +69,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); } break; case DBVT_WORD: @@ -84,7 +84,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); } break; case DBVT_DWORD: @@ -104,7 +104,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule ptstr = str; mir_sntprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); } else { - ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); + ptstr = _itow(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } break; case DBVT_ASCIIZ: @@ -120,7 +120,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); valT = mir_utf8decodeT(dbv.pszVal); ptstr = str; - _tcscpy_s(str, _countof(str), valT); + wcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: @@ -170,7 +170,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd) // static void gg_optsdlgcheck(HWND hwndDlg) { - TCHAR text[128]; + wchar_t text[128]; GetDlgItemText(hwndDlg, IDC_UIN, text, _countof(text)); if (text[0]) { GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text)); @@ -785,7 +785,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!dat || dat->hContact || dat->disableUpdate) break; { - TCHAR text[256]; + wchar_t text[256]; GGPROTO *gg = dat->gg; if (!gg->isonline()) @@ -873,22 +873,22 @@ int GGPROTO::options_init(WPARAM wParam, LPARAM) odp.flags = ODPF_TCHAR; odp.position = 1003000; odp.hInstance = hInstance; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = m_tszUserName; + odp.pwszGroup = LPGENW("Network"); + odp.pwszTitle = m_tszUserName; odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE; - odp.ptszTab = LPGENT("General"); + odp.pwszTab = LPGENW("General"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL); odp.pfnDlgProc = gg_genoptsdlgproc; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Conference"); + odp.pwszTab = LPGENW("Conference"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_CONFERENCE); odp.pfnDlgProc = gg_confoptsdlgproc; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.pwszTab = LPGENW("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_ADVANCED); odp.pfnDlgProc = gg_advoptsdlgproc; Options_AddPage(wParam, &odp); @@ -923,7 +923,7 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = gg_detailsdlgproc; odp.position = -1900000000; odp.pszTemplate = pszTemplate; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = (LPARAM)this; UserInfo_AddPage(wParam, &odp); diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 2b65aefdb4..14a82d4b58 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,14 +381,14 @@ void __cdecl GGPROTO::dccmainthread(void*) {
// Make new ggtransfer struct
local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
- TCHAR* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename);
+ wchar_t* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = filenameT;
- pre.files.t = &filenameT;
+ pre.descr.w = filenameT;
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)local_dcc;
gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1);
@@ -659,7 +659,7 @@ void __cdecl GGPROTO::dccmainthread(void*) debugLogA("dccmainthread(): end. DCC Server Thread Ending");
}
-HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath)
+HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc *dcc = (struct gg_dcc *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
@@ -677,7 +677,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) if ((dcc->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1)
{
debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0);
@@ -699,7 +699,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) return hTransfer;
}
-HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath)
+HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
@@ -726,7 +726,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) if ((dcc7->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1)
{
debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER);
@@ -850,7 +850,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) ////////////////////////////////////////////////////////////
// File receiving allowed
//
-HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
// Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
@@ -882,7 +882,7 @@ int GGPROTO::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////
// File receiving denied
//
-int GGPROTO::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *)
+int GGPROTO::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t *)
{
// Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
@@ -906,7 +906,7 @@ int GGPROTO::RecvFile(MCONTACT hContact, PROTORECVFILET* pre) ////////////////////////////////////////////////////////////
// Called when user sends a file
//
-HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR *, TCHAR** ppszFiles)
+HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles)
{
char *bslash, *filename;
DWORD ip, ver;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 62b12b934b..11c44a47de 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -55,14 +55,14 @@ static unsigned long crc_table[256]; //////////////////////////////////////////////////////////
// Extra winsock function for error description
//
-TCHAR* ws_strerror(int code)
+wchar_t* ws_strerror(int code)
{
- static TCHAR err_desc[160];
+ static wchar_t err_desc[160];
// Not a windows error display WinSock
if (code == 0)
{
- TCHAR buff[128];
+ wchar_t buff[128];
int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
if (len == 0)
mir_sntprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
@@ -132,7 +132,7 @@ unsigned long crc_get(char *mem) // http_error_string()
//
// returns http error text
-const TCHAR *http_error_string(int h)
+const wchar_t *http_error_string(int h)
{
switch (h)
{
@@ -173,22 +173,22 @@ void GGPROTO::cleanuplastplugin(DWORD version) if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
- TCHAR avatarsPath[MAX_PATH];
+ wchar_t avatarsPath[MAX_PATH];
mir_sntprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath);
- TCHAR spec[MAX_PATH + 10];
+ wchar_t spec[MAX_PATH + 10];
mir_sntprintf(spec, L"%s\\*.(null)", avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- TCHAR filePathT [2*MAX_PATH + 10];
+ wchar_t filePathT [2*MAX_PATH + 10];
mir_sntprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
- if (!_taccess(filePathT, 0)){
+ if (!_waccess(filePathT, 0)){
debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT);
- _tremove(filePathT);
+ _wremove(filePathT);
}
} while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
@@ -238,7 +238,7 @@ static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM) if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
Menu_ShowItem(gg->hBlockMenuItem, false);
else
- Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block"));
+ Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENW("&Unblock") : LPGENW("&Block"));
return 0;
}
@@ -289,12 +289,12 @@ void GGPROTO::menus_init() mi.root = hRoot;
mi.flags = CMIF_TCHAR;
- mi.name.t = LPGENT("Conference");
+ mi.name.w = LPGENW("Conference");
mi.position = 200001;
mi.hIcolibItem = iconList[14].hIcolib;
HGENMENU hGCRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
- mi.name.t = LPGENT("Contact list");
+ mi.name.w = LPGENW("Contact list");
mi.position = 200002;
mi.hIcolibItem = iconList[7].hIcolib;
HGENMENU hCLRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);
@@ -307,7 +307,7 @@ void GGPROTO::menus_init() //////////////////////////////////////////////////////////
// Module instance initialization
//
-static GGPROTO *gg_proto_init(const char* pszProtoName, const TCHAR* tszUserName)
+static GGPROTO *gg_proto_init(const char* pszProtoName, const wchar_t* tszUserName)
{
GGPROTO *gg = new GGPROTO(pszProtoName, tszUserName);
g_Instances.insert(gg);
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index 4dc5f9bf3b..34e753122c 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -101,7 +101,7 @@ typedef struct {
uin_t *recipients;
int recipients_count;
- TCHAR id[32];
+ wchar_t id[32];
BOOL ignore;
} GGGC;
@@ -306,11 +306,11 @@ extern IconItem iconList[]; // Methods
/* Helper functions */
-const TCHAR *http_error_string(int h);
+const wchar_t *http_error_string(int h);
unsigned long crc_get(char *mem);
int gg_normalizestatus(int status);
char *gg_status2db(int status, const char *suffix);
-TCHAR *ws_strerror(int code);
+wchar_t *ws_strerror(int code);
char *as_strerror(int code);
uint32_t swap32(uint32_t x);
const char *gg_version2string(int v);
@@ -329,7 +329,7 @@ void gg_links_instancemenu_init(); void gg_links_init();
#define UIN2IDA(uin,id) _itoa(uin,id,10)
-#define UIN2IDT(uin,id) _itot(uin,id,10)
+#define UIN2IDT(uin,id) _itow(uin,id,10)
// Debug functions
const char *ggdebug_eventtype(gg_event *e);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 81eb4f0bf6..10ea01e41b 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -21,7 +21,7 @@ #include "gg.h"
-GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) :
+GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) :
PROTO<GGPROTO>(pszProtoName, tszUserName),
avatar_requests(1, NumericKeySortT),
avatar_transfers(1, NumericKeySortT)
@@ -39,7 +39,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : InitializeCriticalSection(&sessions_mutex);
// Register m_hNetlibUser user
- TCHAR name[128];
+ wchar_t name[128];
mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
@@ -67,8 +67,8 @@ GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED);
- TCHAR szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (TCHAR*)VARST(L"%miranda_userdata%"), m_tszUserName);
+ wchar_t szPath[MAX_PATH];
+ mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
DWORD dwVersion;
@@ -131,9 +131,9 @@ MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr) if (psr->cbSize == sizeof(GGSEARCHRESULT))
uin = psr->uin;
else
- uin = _ttoi(psr->id.t);
+ uin = _wtoi(psr->id.w);
- return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, psr->nick.t);
+ return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, psr->nick.w);
}
//////////////////////////////////////////////////////////
@@ -252,7 +252,7 @@ void __cdecl GGPROTO::searchthread(void *) //////////////////////////////////////////////////////////
// when basic search
//
-HANDLE GGPROTO::SearchBasic(const TCHAR *id)
+HANDLE GGPROTO::SearchBasic(const wchar_t *id)
{
if (!isonline())
return 0;
@@ -289,7 +289,7 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) //////////////////////////////////////////////////////////
// search by details
//
-HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
+HANDLE GGPROTO::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName)
{
// Check if connected and if there's a search data
if (!isonline())
@@ -377,7 +377,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) CMStringA szQuery;
// Fetch search data
- TCHAR text[64];
+ wchar_t text[64];
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
if (mir_tstrlen(text)) {
T2Utf firstName_utf8(text);
@@ -622,10 +622,10 @@ HANDLE GGPROTO::GetAwayMsg(MCONTACT hContact) // when away message is being set
// registered as ProtoService PS_SETAWAYMSGT
//
-int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg)
+int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg)
{
int status = gg_normalizestatus(iStatus);
- TCHAR **msgPtr;
+ wchar_t **msgPtr;
debugLog(L"SetAwayMsg(): PS_SETAWAYMSG(%d, \"%s\".)", iStatus, newMsg);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 6508103fef..9107c49cdd 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -24,7 +24,7 @@ struct GGPROTO : public PROTO<GGPROTO>
{
- GGPROTO( const char*, const TCHAR* );
+ GGPROTO( const char*, const wchar_t* );
~GGPROTO();
//====================================================================================
@@ -33,28 +33,28 @@ struct GGPROTO : public PROTO<GGPROTO> virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath );
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath );
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason );
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason );
virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL );
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType );
- virtual HANDLE __cdecl SearchBasic( const TCHAR* id );
- virtual HANDLE __cdecl SearchByName( const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName );
+ virtual HANDLE __cdecl SearchBasic( const wchar_t* id );
+ virtual HANDLE __cdecl SearchByName( const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName );
virtual HWND __cdecl SearchAdvanced( HWND owner );
virtual HWND __cdecl CreateExtendedSearchUI( HWND owner );
virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* );
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles );
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles );
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg );
virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode );
virtual int __cdecl SetStatus( int iNewStatus );
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact );
- virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg );
+ virtual int __cdecl SetAwayMsg( int m_iStatus, const wchar_t* msg );
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type );
@@ -97,7 +97,7 @@ struct GGPROTO : public PROTO<GGPROTO> void notifyuser(MCONTACT hContact, int refresh);
void setalloffline();
void disconnect();
- MCONTACT getcontact(uin_t uin, int create, int inlist, TCHAR *nick);
+ MCONTACT getcontact(uin_t uin, int create, int inlist, wchar_t *nick);
void __cdecl mainthread(void *empty);
int isonline();
int refreshstatus(int status);
@@ -107,8 +107,8 @@ struct GGPROTO : public PROTO<GGPROTO> int contactdeleted(WPARAM wParam, LPARAM lParam);
int dbsettingchanged(WPARAM wParam, LPARAM lParam);
void notifyall();
- void changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version);
- TCHAR *getstatusmsg(int status);
+ void changecontactstatus(uin_t uin, int status, const wchar_t *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version);
+ wchar_t *getstatusmsg(int status);
void dccstart();
void dccconnect(uin_t uin);
int gettoken(GGTOKEN *token);
@@ -117,11 +117,11 @@ struct GGPROTO : public PROTO<GGPROTO> void menus_init();
/* Avatar functions */
- void getAvatarFilename(MCONTACT hContact, TCHAR *pszDest, int cbLen);
+ void getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen);
void requestAvatarTransfer(MCONTACT hContact, char *szAvatarURL);
void requestAvatarInfo(MCONTACT hContact, int iWaitFor);
void getOwnAvatar();
- void setAvatar(const TCHAR *szFilename);
+ void setAvatar(const wchar_t *szFilename);
bool getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts);
INT_PTR __cdecl getavatarcaps(WPARAM wParam, LPARAM lParam);
@@ -136,14 +136,14 @@ struct GGPROTO : public PROTO<GGPROTO> void __cdecl setavatarthread(void*);
/* File transfer functions */
- HANDLE fileallow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath);
+ HANDLE fileallow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath);
int filecancel(MCONTACT hContact, HANDLE hTransfer);
- int filedeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason);
+ int filedeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason);
int recvfile(MCONTACT hContact, PROTORECVFILET* pre);
- HANDLE sendfile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles);
+ HANDLE sendfile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
- HANDLE dccfileallow(HANDLE hTransfer, const TCHAR* szPath);
- HANDLE dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath);
+ HANDLE dccfileallow(HANDLE hTransfer, const wchar_t* szPath);
+ HANDLE dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath);
int dccfiledeny(HANDLE hTransfer);
int dcc7filedeny(HANDLE hTransfer);
@@ -170,7 +170,7 @@ struct GGPROTO : public PROTO<GGPROTO> int img_shutdown();
int img_sendonrequest(gg_event* e);
BOOL img_opened(uin_t uin);
- void *img_loadpicture(gg_event* e, TCHAR *szFileName);
+ void *img_loadpicture(gg_event* e, wchar_t *szFileName);
int img_display(MCONTACT hContact, void *img);
int img_displayasmsg(MCONTACT hContact, void *img);
@@ -193,9 +193,9 @@ struct GGPROTO : public PROTO<GGPROTO> int gc_init();
void gc_menus_init(HGENMENU hRoot);
int gc_destroy();
- TCHAR * gc_getchat(uin_t sender, uin_t *recipients, int recipients_count);
- GGGC *gc_lookup(const TCHAR *id);
- int gc_changenick(MCONTACT hContact, TCHAR *ptszNick);
+ wchar_t * gc_getchat(uin_t sender, uin_t *recipients, int recipients_count);
+ GGGC *gc_lookup(const wchar_t *id);
+ int gc_changenick(MCONTACT hContact, wchar_t *ptszNick);
int __cdecl gc_event(WPARAM wParam, LPARAM lParam);
@@ -204,7 +204,7 @@ struct GGPROTO : public PROTO<GGPROTO> /* Popups functions */
void initpopups();
- void showpopup(const TCHAR* nickname, const TCHAR* msg, int flags);
+ void showpopup(const wchar_t* nickname, const wchar_t* msg, int flags);
/* Sessions functions */
INT_PTR __cdecl sessions_view(WPARAM wParam, LPARAM lParam);
@@ -235,12 +235,12 @@ struct GGPROTO : public PROTO<GGPROTO> UINT_PTR timer;
struct
{
- TCHAR *online;
- TCHAR *away;
- TCHAR *dnd;
- TCHAR *freechat;
- TCHAR *invisible;
- TCHAR *offline;
+ wchar_t *online;
+ wchar_t *away;
+ wchar_t *dnd;
+ wchar_t *freechat;
+ wchar_t *invisible;
+ wchar_t *offline;
} modemsg;
HGENMENU hMainMenu[7];
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 5bf54545b1..85790434eb 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -66,7 +66,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.hIcolibItem = iconList[14].hIcolib;
- mi.name.t = LPGENT("Open &conference...");
+ mi.name.w = LPGENW("Open &conference...");
hMainMenu[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Clear ignored conferences
@@ -74,7 +74,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.hIcolibItem = iconList[15].hIcolib;
- mi.name.t = LPGENT("&Clear ignored conferences");
+ mi.name.w = LPGENW("&Clear ignored conferences");
hMainMenu[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
}
@@ -94,7 +94,7 @@ int GGPROTO::gc_destroy() return 1;
}
-GGGC* GGPROTO::gc_lookup(const TCHAR *id)
+GGGC* GGPROTO::gc_lookup(const wchar_t *id)
{
GGGC *chat;
list_t l;
@@ -149,7 +149,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) // Message typed / send only if online
if (isonline() && (gch->pDest->iType == GC_USER_MESSAGE) && gch->ptszText) {
- TCHAR id[32];
+ wchar_t id[32];
UIN2IDT(uin, id);
DBVARIANT dbv;
@@ -157,7 +157,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
gce.ptszText = gch->ptszText;
- TCHAR* nickT;
+ wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
nickT = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -188,7 +188,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) if (gch->pDest->iType == GC_USER_PRIVMESS)
{
MCONTACT hContact = NULL;
- if ((uin = _ttoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
+ if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
}
debugLog(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->ptszText);
@@ -207,11 +207,11 @@ typedef struct _gg_gc_echat ////////////////////////////////////////////////////////////////////////////////
// This is main groupchat initialization routine
//
-TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count)
+wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count)
{
list_t l;
GGGC *chat;
- TCHAR id[32];
+ wchar_t id[32];
uin_t uin;
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP };
@@ -279,9 +279,9 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count (getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN) == 1 &&
unknown >= getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN))))
{
- TCHAR *senderName = unknownSender ?
+ wchar_t *senderName = unknownSender ?
TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
- TCHAR error[256];
+ wchar_t error[256];
mir_sntprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
senderName, recipients_count + 1, unknown);
chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
@@ -302,8 +302,8 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count }
// Create new chat window
- TCHAR status[256];
- TCHAR *senderName;
+ wchar_t status[256];
+ wchar_t *senderName;
if (sender)
{
senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
@@ -324,7 +324,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
- TCHAR *name = (TCHAR*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(TCHAR));
+ wchar_t *name = (wchar_t*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
*name = '#'; mir_tstrcpy(name + 1, gcwindow.ptszName);
gcwindow.ptszName = name;
@@ -352,7 +352,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count {
UIN2IDT(uin, id);
- TCHAR* nickT;
+ wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)) {
nickT = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -470,7 +470,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa else if (hwndList && (count = gg_gc_countcheckmarks(hwndList)) >= 2)
{
// Create new participiants table
- TCHAR* chat;
+ wchar_t* chat;
uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t));
gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count);
for (MCONTACT hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) {
@@ -617,7 +617,7 @@ INT_PTR GGPROTO::gc_openconf(WPARAM, LPARAM) return 1;
}
-int GGPROTO::gc_changenick(MCONTACT hContact, TCHAR *ptszNick)
+int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick)
{
list_t l;
uin_t uin = getDword(hContact, GG_KEY_UIN, 0);
@@ -632,7 +632,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, TCHAR *ptszNick) // Rename this window if it's exising in the chat
if (chat->recipients[i] == uin)
{
- TCHAR id[32];
+ wchar_t id[32];
UIN2IDT(uin, id);
GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_NICK };
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index bd6313b5b0..a883917caf 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -40,7 +40,7 @@ typedef struct _GGIMAGEENTRY
{
HBITMAP hBitmap;
- TCHAR *lpszFileName;
+ wchar_t *lpszFileName;
char *lpData;
unsigned long nSize;
struct _GGIMAGEENTRY *lpNext;
@@ -212,20 +212,20 @@ int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat) ////////////////////////////////////////////////////////////////////////////////
// Returns supported image filters
//
-TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize)
+wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize)
{
- TCHAR *szFilterName, *szFilterMask;
- TCHAR *pFilter = szFilter;
+ wchar_t *szFilterName, *szFilterMask;
+ wchar_t *pFilter = szFilter;
// Match relative to ImgDecoder presence
szFilterName = TranslateT("Image files (*.bmp,*.gif,*.jpeg,*.jpg,*.png)");
szFilterMask = L"*.bmp;*.gif;*.jpeg;*.jpg;*.png";
// Make up filter
- _tcsncpy(pFilter, szFilterName, nSize);
+ wcsncpy(pFilter, szFilterName, nSize);
pFilter += mir_tstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
- _tcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
+ wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
pFilter += mir_tstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
*pFilter = 0;
@@ -243,11 +243,11 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) GGPROTO* gg = ((GGIMAGEDLGDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->gg;
- TCHAR szFilter[128];
+ wchar_t szFilter[128];
gg_img_getfilter(szFilter, _countof(szFilter));
- TCHAR szFileName[MAX_PATH];
- _tcsncpy(szFileName, dat->lpszFileName, _countof(szFileName));
+ wchar_t szFileName[MAX_PATH];
+ wcsncpy(szFileName, dat->lpszFileName, _countof(szFileName));
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -259,7 +259,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn))
{
- FILE *fp = _tfopen(szFileName, L"w+b");
+ FILE *fp = _wfopen(szFileName, L"w+b");
if (fp)
{
fwrite(dat->lpData, dat->nSize, 1, fp);
@@ -418,7 +418,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Set main window image
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_IMAGE));
- TCHAR *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128];
+ wchar_t *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128];
if (dat->bReceiving)
mir_sntprintf(szTitle, TranslateT("Image from %s"), szName);
else
@@ -494,7 +494,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->bReceiving)
{
- TCHAR szTitle[128];
+ wchar_t szTitle[128];
mir_sntprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
SetDlgItemText(hwndDlg, IDC_IMG_NAME, szTitle);
}
@@ -660,8 +660,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_CHOOSEIMG:
{
- TCHAR szFilter[128];
- TCHAR szFileName[MAX_PATH];
+ wchar_t szFilter[128];
+ wchar_t szFileName[MAX_PATH];
OPENFILENAME ofn = {0};
gg_img_getfilter(szFilter, _countof(szFilter));
@@ -738,16 +738,16 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact) // Checks if an image is already saved to the specified path
// Returns 1 if yes, 0 if no or -1 if different image on this path is found
//
-int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat)
+int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat)
{
struct _stat st;
- if (_tstat(szPath, &st) != 0)
+ if (_wstat(szPath, &st) != 0)
return 0;
if (st.st_size == dat->nSize)
{
- FILE *fp = _tfopen(szPath, L"rb");
+ FILE *fp = _wfopen(szPath, L"rb");
if (!fp) return 0;
char *lpData = (char*)mir_alloc(dat->nSize);
if (fread(lpData, 1, dat->nSize, fp) == dat->nSize)
@@ -770,11 +770,11 @@ int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat) ////////////////////////////////////////////////////////////////////////////
// Determine if image's file name has the proper extension
//
-TCHAR *gg_img_hasextension(TCHAR *filename)
+wchar_t *gg_img_hasextension(wchar_t *filename)
{
if (filename != NULL && *filename != '\0')
{
- TCHAR *imgtype = _tcsrchr(filename, '.');
+ wchar_t *imgtype = wcsrchr(filename, '.');
if (imgtype != NULL)
{
size_t len = mir_tstrlen(imgtype);
@@ -797,12 +797,12 @@ TCHAR *gg_img_hasextension(TCHAR *filename) int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img)
{
GGIMAGEENTRY *dat = (GGIMAGEENTRY *)img;
- TCHAR szPath[MAX_PATH], path[MAX_PATH], *pImgext, imgext[6];
+ wchar_t szPath[MAX_PATH], path[MAX_PATH], *pImgext, imgext[6];
size_t tPathLen;
int i, res;
if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
- TCHAR *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%");
+ wchar_t *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%");
tPathLen = mir_sntprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
}
@@ -811,13 +811,13 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) tPathLen = mir_tstrlen(szPath);
}
- if ( _taccess(szPath, 0)){
+ if ( _waccess(szPath, 0)){
int ret = CreateDirectoryTreeT(szPath);
if (ret == 0){
debugLog(L"img_displayasmsg(): Created new directory for image cache: %s.", szPath);
} else {
debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
@@ -826,7 +826,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
if ((pImgext = gg_img_hasextension(szPath)) == NULL)
pImgext = szPath + mir_tstrlen(szPath);
- _tcsncpy_s(imgext, pImgext, _TRUNCATE);
+ wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
{
if ((res = gg_img_isexists(szPath, dat)) != -1) break;
@@ -835,13 +835,13 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res == 0) {
// Image file not found, thus create it
- FILE *fp = _tfopen(szPath, L"w+b");
+ FILE *fp = _wfopen(szPath, L"w+b");
if (fp) {
res = fwrite(dat->lpData, dat->nSize, 1, fp) > 0;
fclose(fp);
} else {
debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return 0;
@@ -849,7 +849,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) }
if (res != 0) {
- TCHAR image_msg[MAX_PATH + 11];
+ wchar_t image_msg[MAX_PATH + 11];
mir_sntprintf(image_msg, L"[img]%s[/img]", szPath);
T2Utf szMessage(image_msg);
@@ -926,7 +926,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img) ////////////////////////////////////////////////////////////////////////////
// Helper function to determine image file format and the right extension
//
-const TCHAR *gg_img_guessfileextension(const char *lpData)
+const wchar_t *gg_img_guessfileextension(const char *lpData)
{
if (lpData != NULL)
{
@@ -945,7 +945,7 @@ const TCHAR *gg_img_guessfileextension(const char *lpData) ////////////////////////////////////////////////////////////////////////////
// Image Window : Loading picture and sending for display
//
-void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName)
+void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName)
{
if (!szFileName &&
(!e || !e->event.image_reply.size || !e->event.image_reply.image || !e->event.image_reply.filename))
@@ -958,11 +958,11 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) // Copy the file name
if (szFileName)
{
- FILE *fp = _tfopen(szFileName, L"rb");
+ FILE *fp = _wfopen(szFileName, L"rb");
if (!fp) {
free(dat);
debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno));
- TCHAR error[512];
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return NULL;
@@ -996,7 +996,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) return NULL;
}
fclose(fp);
- dat->lpszFileName = _tcsdup(szFileName);
+ dat->lpszFileName = wcsdup(szFileName);
}
// Copy picture from packet
else if (e && e->event.image_reply.filename)
@@ -1008,9 +1008,9 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) ptrT tmpFileName( mir_a2t(e->event.image_reply.filename));
if (!gg_img_hasextension(tmpFileName)) {
// Add missing file extension
- const TCHAR *szImgType = gg_img_guessfileextension(dat->lpData);
+ const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
- dat->lpszFileName = (TCHAR*)calloc(sizeof(TCHAR), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
+ dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
if (dat->lpszFileName != NULL) {
mir_tstrcpy(dat->lpszFileName, tmpFileName);
mir_tstrcat(dat->lpszFileName, szImgType);
@@ -1019,7 +1019,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) }
if (dat->lpszFileName == NULL)
- dat->lpszFileName = _tcsdup( _A2T( e->event.image_reply.filename));
+ dat->lpszFileName = wcsdup( _A2T( e->event.image_reply.filename));
}
////////////////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 9b5a0cde73..08a882079e 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -223,12 +223,12 @@ void GGPROTO::parsecontacts(char *contacts) // Write misc data
if (hContact && strFirstName){
- TCHAR *tstrFirstName = mir_a2t(strFirstName);
+ wchar_t *tstrFirstName = mir_a2t(strFirstName);
setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName);
mir_free(tstrFirstName);
}
if (hContact && strLastName){
- TCHAR *tstrLastName = mir_a2t(strLastName);
+ wchar_t *tstrLastName = mir_a2t(strLastName);
setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName);
mir_free(tstrLastName);
}
@@ -276,7 +276,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "import_server", 65, "sess_mutex", 1);
if (gg_userlist_request(sess, GG_USERLIST_GET, NULL) == -1)
{
- TCHAR error[128];
+ wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
mir_sntprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -314,7 +314,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "remove_server", 66, "sess_mutex", 1);
if (gg_userlist_request(sess, GG_USERLIST_PUT, NULL) == -1)
{
- TCHAR error[128];
+ wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
mir_sntprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -330,30 +330,30 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) INT_PTR GGPROTO::import_text(WPARAM, LPARAM)
{
- TCHAR str[MAX_PATH];
- TCHAR filter[512], *pfilter;
+ wchar_t str[MAX_PATH];
+ wchar_t filter[512], *pfilter;
struct _stat st;
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ wcsncpy(filter, TranslateT("Text files"), _countof(filter));
mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
@@ -373,8 +373,8 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) #endif
if (!GetOpenFileName(&ofn)) return 0;
- FILE *f = _tfopen(str, L"r");
- _tstat(str, &st);
+ FILE *f = _wfopen(str, L"r");
+ _wstat(str, &st);
if (f && st.st_size)
{
@@ -389,7 +389,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) }
else
{
- TCHAR error[256];
+ wchar_t error[256];
mir_sntprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
@@ -401,29 +401,29 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) INT_PTR GGPROTO::export_text(WPARAM, LPARAM)
{
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
OPENFILENAME ofn = {0};
- TCHAR filter[512], *pfilter;
+ wchar_t filter[512], *pfilter;
- _tcsncpy(str, TranslateT("contacts"), _countof(str));
+ wcsncpy(str, TranslateT("contacts"), _countof(str));
mir_tstrncat(str, L".txt", _countof(str) - mir_tstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ wcsncpy(filter, TranslateT("Text files"), _countof(filter));
mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
+ wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
@@ -440,7 +440,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) #endif
if (!GetSaveFileName(&ofn)) return 0;
- FILE *f = _tfopen(str, L"w");
+ FILE *f = _wfopen(str, L"w");
if (f) {
char *contacts = gg_makecontacts(this, 0);
fwrite(contacts, sizeof(char), mir_strlen(contacts), f);
@@ -451,7 +451,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) }
else
{
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
@@ -494,7 +494,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) gg_EnterCriticalSection(&sess_mutex, "export_server", 67, "sess_mutex", 1);
if (gg_userlist_request(sess, GG_USERLIST_PUT, contacts) == -1)
{
- TCHAR error[128];
+ wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
mir_sntprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -524,7 +524,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::import_server);
mi.position = 2000500001;
mi.hIcolibItem = iconList[1].hIcolib;
- mi.name.t = LPGENT("Import List From &Server");
+ mi.name.w = LPGENW("Import List From &Server");
hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Import from textfile
@@ -533,7 +533,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::import_text);
mi.position = 2000500002;
mi.hIcolibItem = iconList[2].hIcolib;
- mi.name.t = LPGENT("Import List From &Text File...");
+ mi.name.w = LPGENW("Import List From &Text File...");
hMainMenu[3] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Remove from server
@@ -542,7 +542,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::remove_server);
mi.position = 2000500003;
mi.hIcolibItem = iconList[3].hIcolib;
- mi.name.t = LPGENT("&Remove List From Server");
+ mi.name.w = LPGENW("&Remove List From Server");
hMainMenu[4] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Export to server
@@ -551,7 +551,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::export_server);
mi.position = 2005000001;
mi.hIcolibItem = iconList[4].hIcolib;
- mi.name.t = LPGENT("Export List To &Server");
+ mi.name.w = LPGENW("Export List To &Server");
hMainMenu[5] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Export to textfile
@@ -560,6 +560,6 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::export_text);
mi.position = 2005000002;
mi.hIcolibItem = iconList[5].hIcolib;
- mi.name.t = LPGENT("Export List To &Text File...");
+ mi.name.w = LPGENW("Export List To &Text File...");
hMainMenu[6] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 7033e9749a..cc388ac8e8 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -118,7 +118,7 @@ void GGPROTO::links_instance_init() CMenuItem mi;
mi.flags = CMIF_TCHAR;
mi.position = g_Instances.getCount();
- mi.name.t = m_tszUserName;
+ mi.name.w = m_tszUserName;
hInstanceMenuItem = Menu_AddItem(hInstanceMenu, &mi, this);
}
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 2bcff16f9e..818daa2d8d 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -315,7 +315,7 @@ int GGPROTO::oauth_receivetoken() if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- TCHAR *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2t(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
@@ -384,7 +384,7 @@ int GGPROTO::oauth_receivetoken() resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- TCHAR *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2t(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 125c0da27d..7d7ebeb5cd 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -56,7 +56,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0)))
{
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno));
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index e8ca28f164..ca8ff1fa74 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -23,8 +23,8 @@ struct PopupData
{
unsigned flags;
- TCHAR* title;
- TCHAR* text;
+ wchar_t* title;
+ wchar_t* text;
GGPROTO* gg;
};
@@ -72,7 +72,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar //
void GGPROTO::initpopups()
{
- TCHAR szDescr[256];
+ wchar_t szDescr[256];
char szName[256];
POPUPCLASS puc = {0};
@@ -111,8 +111,8 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
char szName[256];
POPUPDATACLASS ppd = {sizeof(ppd)};
- ppd.ptszTitle = puData->title;
- ppd.ptszText = puData->text;
+ ppd.pwszTitle = puData->title;
+ ppd.pwszText = puData->text;
ppd.PluginData = puData;
ppd.pszClassName = szName;
@@ -149,7 +149,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) mir_free(puData);
}
-void GGPROTO::showpopup(const TCHAR* nickname, const TCHAR* msg, int flags)
+void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags)
{
if (Miranda_Terminated()) return;
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index d5c5c99217..f067ae87b7 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -49,7 +49,7 @@ char *gg_status2db(int status, const char *suffix) //////////////////////////////////////////////////////////
// gets protocol status
//
-TCHAR* GGPROTO::getstatusmsg(int status)
+wchar_t* GGPROTO::getstatusmsg(int status)
{
switch(status) {
case ID_STATUS_ONLINE:
@@ -99,7 +99,7 @@ int GGPROTO::refreshstatus(int status) }
else
{
- TCHAR *szMsg = NULL;
+ wchar_t *szMsg = NULL;
// Select proper msg
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 69, "modemsg_mutex", 1);
szMsg = getstatusmsg(status);
@@ -191,7 +191,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
- _tcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
+ wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
db_free(&dbv);
return GAIR_SUCCESS;
@@ -229,7 +229,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (AvatarHash != NULL && AvatarSavedHash != NULL) {
getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
if (!mir_strcmp(AvatarHash, AvatarSavedHash)) {
- if (_taccess(pai->filename, 0) == 0){
+ if (_waccess(pai->filename, 0) == 0){
debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin);
return GAIR_SUCCESS;
}
@@ -239,9 +239,9 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) return GAIR_WAITFOR;
}
if ((wParam & GAIF_FORCE) != 0) {
- if (_tremove(pai->filename) != 0){
- debugLog(L"getavatarinfo(): refresh. _tremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
- TCHAR error[512];
+ if (_wremove(pai->filename) != 0){
+ debugLog(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
@@ -254,9 +254,9 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) else if ((wParam & GAIF_FORCE) != 0) {
if (AvatarHash == NULL && AvatarSavedHash != NULL) {
getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
- if (_tremove(pai->filename) != 0){
- debugLog(L"getavatarinfo(): delete. _tremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
- TCHAR error[512];
+ if (_wremove(pai->filename) != 0){
+ debugLog(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
+ wchar_t error[512];
mir_sntprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
@@ -284,7 +284,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //
INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR *szFilename = (TCHAR*)wParam;
+ wchar_t *szFilename = (wchar_t*)wParam;
int len = (int)lParam;
if (szFilename == NULL || len <= 0) {
@@ -298,7 +298,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) }
getAvatarFilename(NULL, szFilename, len);
- if (_taccess(szFilename, 0) == 0){
+ if (_waccess(szFilename, 0) == 0){
debugLogA("getmyavatar(): Incoming request for self avatar information. returned ok.");
return 0;
} else {
@@ -314,7 +314,7 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) //
INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam)
{
- TCHAR *szFilename = (TCHAR*)lParam;
+ wchar_t *szFilename = (wchar_t*)lParam;
if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
return -2;
@@ -335,7 +335,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) setByte(GG_KEY_AVATARTYPEPREV, getByte(GG_KEY_AVATARTYPE, -1));
setByte(GG_KEY_AVATARTYPE, (BYTE)iAvType);
- TCHAR szMyFilename[MAX_PATH];
+ wchar_t szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
@@ -355,7 +355,7 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam) INT_PTR res = 0;
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
- TCHAR *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
+ wchar_t *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
if (isonline() && szMsg)
res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index bd68343587..13db5b1072 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -127,7 +127,7 @@ static BOOL IsOverAction(HWND hwndDlg) LVHITTESTINFO hti;
RECT rc;
HDC hdc;
- TCHAR szText[256];
+ wchar_t szText[256];
SIZE textSize;
int textPosX;
@@ -164,7 +164,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam);
{
- TCHAR oldTitle[256], newTitle[256];
+ wchar_t oldTitle[256], newTitle[256];
HANDLE hProtoAckEvent;
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
@@ -265,7 +265,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
if (nm->nmcd.hdr.idFrom == IDC_SESSIONS && nm->iSubItem == 3)
{
- TCHAR szText[256];
+ wchar_t szText[256];
szText[0] = 0;
ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText));
FillRect(nm->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
@@ -320,7 +320,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w switch (iSelection) {
case 10001:
{
- TCHAR szText[512], szClientName[256], szIP[64], szLoginTime[64];
+ wchar_t szText[512], szClientName[256], szIP[64], szLoginTime[64];
HGLOBAL hData;
if (!OpenClipboard(hwndDlg))
break;
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w mir_sntprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
{
- mir_tstrcpy((TCHAR*)GlobalLock(hData), szText);
+ mir_tstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
}
@@ -343,7 +343,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w case 10002:
{
- TCHAR szUrl[256], szIP[64];
+ wchar_t szUrl[256], szIP[64];
szIP[0] = 0;
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
mir_sntprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
@@ -424,6 +424,6 @@ void GGPROTO::sessions_menus_init(HGENMENU hRoot) CreateProtoService(mi.pszService, &GGPROTO::sessions_view);
mi.position = 200003;
mi.hIcolibItem = iconList[16].hIcolib;
- mi.name.t = LPGENT("Concurrent &sessions");
+ mi.name.w = LPGENW("Concurrent &sessions");
Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 0a76e2e3ae..da89d11331 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -113,7 +113,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_http *h = gg_token(0);
if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
@@ -122,7 +122,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_token *t = (struct gg_token *)h->data;
if (!t || !h->body) {
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 4f40b99e37..0a2e424c2f 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -39,7 +39,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) if (!gg->gettoken(&token)) return NULL;
if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Registration rejected") : ws_strerror(errno)));
@@ -85,7 +85,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
{
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Bad number or password") : ws_strerror(errno)));
@@ -137,7 +137,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
{
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Invalid data entered") : ws_strerror(errno)));
@@ -179,7 +179,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0);
if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
- TCHAR error[128];
+ wchar_t error[128];
mir_sntprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 6a15e93456..3f3676869e 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -25,18 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port)
{
MCONTACT hContact;
- TCHAR szNick[256];
+ wchar_t szNick[256];
char szService[256];
bool bFlag = false;
- CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true };
+ CONTACT usertemp = { (wchar_t*)name.c_str(), NULL, NULL, false, false, true };
MCONTACT hc = CList_FindContact(&usertemp);
if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc, "CList", "Hidden", 0) == 0)
bFlag = true;
CMString contactname = name; contactname += DCCSTRING;
- CONTACT user = { (TCHAR*)contactname.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)contactname.c_str(), NULL, NULL, false, false, true };
hContact = CList_AddContact(&user, false, false);
setByte(hContact, "DCC", 1);
@@ -165,7 +165,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) if (!user || !user->name)
return 0;
- TCHAR* lowercasename = mir_tstrdup(user->name);
+ wchar_t* lowercasename = mir_tstrdup(user->name);
CharLower(lowercasename);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -198,7 +198,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) hContact_temp = hContact;
}
}
- else if (_tcschr(user->name, ' ') == 0) {
+ else if (wcschr(user->name, ' ') == 0) {
if ((DBDefault && !mir_tstrcmpi(DBDefault, user->name) || DBNick && !mir_tstrcmpi(DBNick, user->name) ||
DBWildcard && WCCmp(DBWildcard, lowercasename))
&& (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) {
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index f72796fde8..8a10cecca7 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -69,7 +69,7 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) return;
}
- TCHAR temp2[270];
+ wchar_t temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
mir_sntprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
@@ -164,8 +164,8 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) db_free(&dbv);
DBVARIANT dbv2;
- TCHAR* DBNick = NULL;
- TCHAR* DBWildcard = NULL;
+ wchar_t* DBNick = NULL;
+ wchar_t* DBWildcard = NULL;
if (!ppro->getTString(hContact, "Nick", &dbv))
DBNick = dbv.ptszVal;
if (!ppro->getTString(hContact, "UWildcard", &dbv2))
@@ -216,7 +216,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) ppro->SetChatTimer(ppro->OnlineNotifTimer, ppro->m_onlineNotificationTime * 1000, OnlineNotifTimerProc);
}
-int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, TCHAR* msg)
+int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg)
{
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
@@ -260,7 +260,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di) bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
- TCHAR szResponse[100];
+ wchar_t szResponse[100];
mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
@@ -272,13 +272,13 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) m_info.sNick = pmsg->parameters[0];
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
- static TCHAR host[1024];
+ static wchar_t host[1024];
int i = 0;
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
- if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
+ if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) {
mir_tstrncpy(host, word.c_str(), _countof(host));
- TCHAR* p1 = _tcschr(host, '@');
+ wchar_t* p1 = wcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
}
@@ -531,7 +531,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) }
if (m_oldStyleModes) {
- TCHAR temp[256];
+ wchar_t temp[256];
mir_sntprintf(temp, TranslateT("%s sets mode %s"),
pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
@@ -545,7 +545,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) for (int i = iParametercount; i < (int)pmsg->parameters.getCount(); i++)
sParams += L" " + pmsg->parameters[i];
- TCHAR temp[4000];
+ wchar_t temp[4000];
mir_sntprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
@@ -554,7 +554,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) PostIrcMessage(L"/MODE %s", pmsg->parameters[0].c_str());
}
else {
- TCHAR temp[256];
+ wchar_t temp[256];
mir_sntprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
@@ -583,7 +583,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, host.c_str(), NULL, true, bIsMe);
DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false);
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
@@ -644,9 +644,9 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_YOURHOST(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming) {
- static const TCHAR* lpszFmt = L"Your host is %99[^ \x5b,], running version %99s";
- TCHAR szHostName[100], szVersion[100];
- if (_stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0)
+ static const wchar_t* lpszFmt = L"Your host is %99[^ \x5b,], running version %99s";
+ wchar_t szHostName[100], szVersion[100];
+ if (swscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0)
m_info.sServerName = szHostName;
if (pmsg->parameters[0] != m_info.sNick)
m_info.sNick = pmsg->parameters[0];
@@ -671,7 +671,7 @@ bool CIrcProto::OnIrc_INVITE(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->sCommand == L"PING") {
- TCHAR szResponse[100];
+ wchar_t szResponse[100];
mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -691,7 +691,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && !bIsChannel) {
mess = DoColorCodes(mess.c_str(), TRUE, FALSE);
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
if (CallService(MS_IGNORE_ISIGNORED, NULL, IGNOREEVENT_MESSAGE))
if (!CList_FindContact(&user))
@@ -742,7 +742,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // exploit???
if (mess.Find(1) != -1 || mess.Find(L"%newl") != -1) {
- TCHAR temp[4096];
+ wchar_t temp[4096];
mir_sntprintf(temp, TranslateT("CTCP ERROR: Malformed CTCP command received from %s!%s@%s. Possible attempt to take control of your IRC client registered"), pmsg->prefix.sNick.c_str(), pmsg->prefix.sUser.c_str(), pmsg->prefix.sHost.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
return true;
@@ -800,16 +800,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"finger") {
PostIrcMessage(L"/NOTICE %s \001FINGER %s (%s)\001", pmsg->prefix.sNick.c_str(), m_name, m_userID);
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
// incoming VERSION
else if (pmsg->m_bIncoming && command == L"version") {
- PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _T(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
+ PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _A2W(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -818,7 +818,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"source") {
PostIrcMessage(L"/NOTICE %s \001SOURCE Get Miranda IRC here: http://miranda-ng.org/ \001", pmsg->prefix.sNick.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -827,7 +827,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"userinfo") {
PostIrcMessage(L"/NOTICE %s \001USERINFO %s\001", pmsg->prefix.sNick.c_str(), m_userInfo);
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -836,16 +836,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"ping") {
PostIrcMessage(L"/NOTICE %s \001%s\001", pmsg->prefix.sNick.c_str(), mess.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
// incoming TIME
else if (pmsg->m_bIncoming && command == L"time") {
- TCHAR temp[300];
+ wchar_t temp[300];
time_t tim = time(NULL);
- mir_tstrncpy(temp, _tctime(&tim), 25);
+ mir_tstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
mir_sntprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
@@ -879,9 +879,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
CMString rest = mess.Mid(begin);
- dwAdr = _tcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10);
- iPort = _ttoi(GetWord(rest.c_str(), 1).c_str());
- dwSize = _ttoi64(GetWord(rest.c_str(), 2).c_str());
+ dwAdr = wcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10);
+ iPort = _wtoi(GetWord(rest.c_str(), 1).c_str());
+ dwSize = _wtoi64(GetWord(rest.c_str(), 2).c_str());
sToken = GetWord(rest.c_str(), 3);
}
}
@@ -904,7 +904,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // if all characters are number it indicates we have found the adress, port and size parameters
int ind = 0;
while (sTemp[ind] != '\0') {
- if (!_istdigit(sTemp[ind]))
+ if (!iswdigit(sTemp[ind]))
break;
ind++;
}
@@ -915,8 +915,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
if (bFlag) {
- TCHAR* p1 = _tcsdup(GetWordAddress(mess.c_str(), 2));
- TCHAR* p2 = (TCHAR*)GetWordAddress(p1, index - 5);
+ wchar_t* p1 = wcsdup(GetWordAddress(mess.c_str(), 2));
+ wchar_t* p2 = (wchar_t*)GetWordAddress(p1, index - 5);
if (type == L"send") {
if (p2 > p1) {
@@ -932,9 +932,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) free(p1);
- dwAdr = _tcstoul(GetWord(mess.c_str(), index - (bIsChat ? 2 : 3)).c_str(), NULL, 10);
- iPort = _ttoi(GetWord(mess.c_str(), index - (bIsChat ? 1 : 2)).c_str());
- dwSize = _ttoi64(GetWord(mess.c_str(), index - 1).c_str());
+ dwAdr = wcstoul(GetWord(mess.c_str(), index - (bIsChat ? 2 : 3)).c_str(), NULL, 10);
+ iPort = _wtoi(GetWord(mess.c_str(), index - (bIsChat ? 1 : 2)).c_str());
+ dwSize = _wtoi64(GetWord(mess.c_str(), index - 1).c_str());
sToken = GetWord(mess.c_str(), index);
}
}
@@ -952,8 +952,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
CMString rest = mess.Mid(begin);
- iPort = _ttoi(GetWord(rest.c_str(), 0).c_str());
- dwSize = _ttoi(GetWord(rest.c_str(), 1).c_str());
+ iPort = _wtoi(GetWord(rest.c_str(), 0).c_str());
+ dwSize = _wtoi(GetWord(rest.c_str(), 1).c_str());
sToken = GetWord(rest.c_str(), 2);
}
}
@@ -972,7 +972,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) int ind = 0;
while (sTemp[ind] != '\0') {
- if (!_istdigit(sTemp[ind]))
+ if (!iswdigit(sTemp[ind]))
break;
ind++;
}
@@ -982,8 +982,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) index++;
}
if (bFlag) {
- TCHAR* p1 = _tcsdup(GetWordAddress(mess.c_str(), 2));
- TCHAR* p2 = (TCHAR*)GetWordAddress(p1, index - 4);
+ wchar_t* p1 = wcsdup(GetWordAddress(mess.c_str(), 2));
+ wchar_t* p2 = (wchar_t*)GetWordAddress(p1, index - 4);
if (p2 > p1) {
p2--;
@@ -996,8 +996,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) free(p1);
- iPort = _ttoi(GetWord(mess.c_str(), index - 2).c_str());
- dwSize = _ttoi64(GetWord(mess.c_str(), index - 1).c_str());
+ iPort = _wtoi(GetWord(mess.c_str(), index - 2).c_str());
+ dwSize = _wtoi64(GetWord(mess.c_str(), index - 1).c_str());
sToken = GetWord(mess.c_str(), index);
}
}
@@ -1006,7 +1006,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // 2. Check for malformed dcc commands or other errors
if (bIsChat || type == L"send") {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
szTemp[0] = '\0';
unsigned long ulAdr = 0;
@@ -1040,7 +1040,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) sFile = sFileCorrected;
}
else if (type == L"accept" || type == L"resume") {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
szTemp[0] = '\0';
if (type == L"resume" && !m_DCCFileEnabled)
@@ -1066,7 +1066,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // incoming chat request
if (bIsChat) {
- CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), 0, 0, false, false, true };
+ CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), 0, 0, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
// check if it should be ignored
@@ -1078,7 +1078,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
}
else {
- TCHAR szTemp[512];
+ wchar_t szTemp[512];
mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
@@ -1090,7 +1090,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) if (sToken.IsEmpty())
dcc = FindDCCSendByPort(iPort);
else
- dcc = FindPassiveDCCSend(_ttoi(sToken.c_str())); // reverse ft
+ dcc = FindPassiveDCCSend(_wtoi(sToken.c_str())); // reverse ft
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, (long)FILERESUME_RESUME);
@@ -1128,14 +1128,14 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // a reverse filetransfer. The plugin should connect to that computer
// and start sedning the file (if the token is valid). Compare to DCC RECV
if (!sToken.IsEmpty() && iPort) {
- CDccSession* dcc = FindPassiveDCCSend(_ttoi(sToken.c_str()));
+ CDccSession* dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
if (dcc) {
dcc->SetupPassive(dwAdr, iPort);
dcc->Connect();
}
}
else {
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
if (CallService(MS_IGNORE_ISIGNORED, NULL, IGNOREEVENT_FILE))
if (!CList_FindContact(&user))
return true;
@@ -1160,13 +1160,13 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) setTString(hContact, "User", pmsg->prefix.sUser.c_str());
setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
- TCHAR* tszTemp = (TCHAR*)sFile.c_str();
+ wchar_t* tszTemp = (wchar_t*)sFile.c_str();
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = (DWORD)time(NULL);
pre.fileCount = 1;
- pre.files.t = &tszTemp;
+ pre.files.w = &tszTemp;
pre.lParam = (LPARAM)di;
ProtoChainRecvFile(hContact, &pre);
}
@@ -1175,7 +1175,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // end type == "send"
}
else if (pmsg->m_bIncoming) {
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -1183,12 +1183,12 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // handle incoming ctcp in notices. This technique is used for replying to CTCP queries
else if (pmsg->sCommand == L"NOTICE") {
- TCHAR szTemp[300];
+ wchar_t szTemp[300];
szTemp[0] = '\0';
//if we got incoming CTCP Version for contact in CList - then write its as MirVer for that contact!
if (pmsg->m_bIncoming && command == L"version") {
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
setTString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE));
@@ -1205,8 +1205,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
if (pmsg->m_bIncoming && command == L"ping") {
SetActiveWindow(m_whoisDlg->GetHwnd());
- int s = (int)time(0) - (int)_ttol(GetWordAddress(mess.c_str(), 1));
- TCHAR szTmp[30];
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
+ wchar_t szTmp[30];
if (s == 1)
mir_sntprintf(szTmp, TranslateT("%u second"), s);
else
@@ -1220,7 +1220,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) //... else show the reply in the current window
if (pmsg->m_bIncoming && command == L"ping") {
- int s = (int)time(0) - (int)_ttol(GetWordAddress(mess.c_str(), 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
mir_sntprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
@@ -1254,7 +1254,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) i++;
if (!name.IsEmpty()) {
int index = 0;
- while (_tcschr(sUserModePrefixes.c_str(), name[index]))
+ while (wcschr(sUserModePrefixes.c_str(), name[index]))
index++;
if (!mir_tstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
@@ -1265,7 +1265,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) }
if (bFlag) {
- const TCHAR* sChanName = pmsg->parameters[1].c_str();
+ const wchar_t* sChanName = pmsg->parameters[1].c_str();
if (sChanName[0] == '@' || sChanName[0] == '*' || sChanName[0] == '=')
sChanName++;
@@ -1372,7 +1372,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) sTopicTime = L"";
} }
- gcd.ptszID = (TCHAR*)sID.c_str();
+ gcd.ptszID = (wchar_t*)sID.c_str();
gcd.iType = GC_EVENT_CONTROL;
gce.cbSize = sizeof(GCEVENT);
gce.dwFlags = 0;
@@ -1454,11 +1454,11 @@ bool CIrcProto::OnIrc_INITIALTOPIC(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_INITIALTOPICNAME(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 3) {
- TCHAR tTimeBuf[128], *tStopStr;
+ wchar_t tTimeBuf[128], *tStopStr;
time_t ttTopicTime;
sTopicName = pmsg->parameters[2];
- ttTopicTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
- _tcsftime(tTimeBuf, 128, L"%#c", localtime(&ttTopicTime));
+ ttTopicTime = wcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
+ wcsftime(tTimeBuf, 128, L"%#c", localtime(&ttTopicTime));
sTopicTime = tTimeBuf;
}
ShowMessage(pmsg);
@@ -1506,20 +1506,20 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) lvItem.iItem = ListView_GetItemCount(hListView);
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
- lvItem.pszText = (TCHAR*)pmsg->parameters[1].c_str();
+ lvItem.pszText = (wchar_t*)pmsg->parameters[1].c_str();
lvItem.lParam = lvItem.iItem;
lvItem.iItem = ListView_InsertItem(hListView, &lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
- lvItem.pszText = (TCHAR*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
+ lvItem.pszText = (wchar_t*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
ListView_SetItem(hListView, &lvItem);
- TCHAR* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
- TCHAR* find = _tcsstr(temp, L"[+");
- TCHAR* find2 = _tcsstr(temp, L"]");
- TCHAR* save = temp;
+ wchar_t* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
+ wchar_t* find = wcsstr(temp, L"[+");
+ wchar_t* find2 = wcsstr(temp, L"]");
+ wchar_t* save = temp;
if (find == temp && find2 != NULL && find + 8 >= find2) {
- temp = _tcsstr(temp, L"]");
+ temp = wcsstr(temp, L"]");
if (mir_tstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
@@ -1534,7 +1534,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) lvItem.iSubItem = 3;
CMString S = DoColorCodes(temp, TRUE, FALSE);
- lvItem.pszText = (TCHAR*)S.c_str();
+ lvItem.pszText = (wchar_t*)S.c_str();
ListView_SetItem(hListView, &lvItem);
temp = save;
mir_free(temp);
@@ -1543,7 +1543,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
- TCHAR text[100];
+ wchar_t text[100];
if (percent < 100)
mir_sntprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
else
@@ -1564,7 +1564,7 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg) ListView_SetColumnWidth(GetDlgItem(m_listDlg->GetHwnd(), IDC_INFO_LISTVIEW), 3, LVSCW_AUTOSIZE);
m_listDlg->UpdateList();
- TCHAR text[100];
+ wchar_t text[100];
mir_sntprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
int percent = 100;
if (m_noOfChannels > 0)
@@ -1593,8 +1593,8 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg) S += pmsg->parameters[3];
if (pmsg->parameters.getCount() > 4) {
S += L" - ( ";
- time_t time = _ttoi(pmsg->parameters[4].c_str());
- S += _tctime(&time);
+ time_t time = _wtoi(pmsg->parameters[4].c_str());
+ S += _wctime(&time);
S.Replace(L"\n", L" ");
S += L")";
}
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_AWAY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
- TCHAR temp[1024], temp2[1024];
+ wchar_t temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
mir_tstrcat(temp, L"%s\r\n");
mir_sntprintf(temp2, temp, pmsg->parameters[2].c_str());
@@ -1689,7 +1689,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1 && m_manualWhoisCount < 1) {
- CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)WhoisAwayReply.c_str());
@@ -1705,7 +1705,7 @@ bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
- int S = _ttoi(pmsg->parameters[2].c_str());
+ int S = _wtoi(pmsg->parameters[2].c_str());
int D = S / (60 * 60 * 24);
S -= (D * 60 * 60 * 24);
int H = S / (60 * 60);
@@ -1713,7 +1713,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) int M = S / 60;
S -= (M * 60);
- TCHAR temp[100];
+ wchar_t temp[100];
if (D)
mir_sntprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
else if (H)
@@ -1725,10 +1725,10 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) else
temp[0] = 0;
- TCHAR temp3[256];
- TCHAR tTimeBuf[128], *tStopStr;
- time_t ttTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
- _tcsftime(tTimeBuf, 128, L"%c", localtime(&ttTime));
+ wchar_t temp3[256];
+ wchar_t tTimeBuf[128], *tStopStr;
+ time_t ttTime = wcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
+ wcsftime(tTimeBuf, 128, L"%c", localtime(&ttTime));
mir_sntprintf(temp3, TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
@@ -1764,10 +1764,10 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) if (m_whoisDlg)
m_whoisDlg->ShowMessageNoUser(pmsg);
- CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
- AddOutgoingMessageToDB(hContact, (TCHAR*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str());
+ AddOutgoingMessageToDB(hContact, (wchar_t*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str());
DBVARIANT dbv;
if (!getTString(hContact, "Default", &dbv)) {
@@ -1814,7 +1814,7 @@ bool CIrcProto::OnIrc_NICK_ERR(const CIrcMessage* pmsg) {
if (pmsg->m_bIncoming) {
if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_tstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
- TCHAR m[200];
+ wchar_t m[200];
mir_sntprintf(m, L"NICK %s", m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
@@ -1882,7 +1882,7 @@ bool CIrcProto::OnIrc_ENDMOTD(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_NOOFCHANNELS(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1)
- m_noOfChannels = _ttoi(pmsg->parameters[1].c_str());
+ m_noOfChannels = _wtoi(pmsg->parameters[1].c_str());
if (pmsg->m_bIncoming && !bPerformDone)
DoOnConnect(pmsg);
@@ -1905,7 +1905,7 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) else
S = TranslateT("Unknown");
- msn.tszInfo = (TCHAR*)S.c_str();
+ msn.tszInfo = (wchar_t*)S.c_str();
msn.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE;
msn.uTimeout = 15000;
CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn);
@@ -1944,9 +1944,9 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) /// if it is not a channel
ptrT UserList(mir_tstrdup(m_whoReply.c_str()));
- const TCHAR* p1 = UserList;
+ const wchar_t* p1 = UserList;
m_whoReply = L"";
- CONTACT ccUser = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false };
+ CONTACT ccUser = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false };
MCONTACT hContact = CList_FindContact(&ccUser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) {
@@ -1991,7 +1991,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) if (DBWildcard && DBNick && !WCCmp(CharLower(DBWildcard), CharLower(DBNick))) {
setTString(hContact, "Nick", DBDefault);
- DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (TCHAR*)DBWildcard);
+ DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard);
setString(hContact, "User", "");
setString(hContact, "Host", "");
@@ -2017,7 +2017,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 6 && command[0] == 'S') {
m_whoReply.AppendFormat(L"%s %s %s %s ", pmsg->parameters[5].c_str(), pmsg->parameters[2].c_str(), pmsg->parameters[3].c_str(), pmsg->parameters[6].c_str());
if (mir_tstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
- TCHAR host[1024];
+ wchar_t host[1024];
mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
@@ -2076,16 +2076,16 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) if (sTemp.IsEmpty())
break;
- TCHAR *p1 = mir_tstrdup(sTemp.c_str());
+ wchar_t *p1 = mir_tstrdup(sTemp.c_str());
// Pull out host, user and nick
- TCHAR *p2 = _tcschr(p1, '@');
+ wchar_t *p2 = wcschr(p1, '@');
if (p2) {
*p2 = '\0';
p2++;
host = p2;
}
- p2 = _tcschr(p1, '=');
+ p2 = wcschr(p1, '=');
if (p2) {
if (*(p2 - 1) == '*')
*(p2 - 1) = '\0'; // remove special char for IRCOps
@@ -2106,9 +2106,9 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) // Do command
switch (command[0]) {
case 'S': // Status check
- finduser.name = (TCHAR*)nick.c_str();
- finduser.host = (TCHAR*)host.c_str();
- finduser.user = (TCHAR*)user.c_str();
+ finduser.name = (wchar_t*)nick.c_str();
+ finduser.host = (wchar_t*)host.c_str();
+ finduser.user = (wchar_t*)user.c_str();
{
MCONTACT hContact = CList_FindContact(&finduser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 0) {
@@ -2167,7 +2167,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) // Status-check post-processing: make buddies in ckeck-list offline
if (command[0] == 'S') {
for (int i = 0; i < checklist.getCount(); i++) {
- finduser.name = (TCHAR*)checklist[i].c_str();
+ finduser.name = (wchar_t*)checklist[i].c_str();
finduser.ExactNick = true;
CList_SetOffline(&finduser);
}
@@ -2184,10 +2184,10 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
{
- static const TCHAR *lpszFmt = L"Try server %99[^ ,], port %19s";
- TCHAR szAltServer[100];
- TCHAR szAltPort[20];
- if (pmsg->parameters.getCount() > 1 && _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
+ static const wchar_t *lpszFmt = L"Try server %99[^ ,], port %19s";
+ wchar_t szAltServer[100];
+ wchar_t szAltPort[20];
+ if (pmsg->parameters.getCount() > 1 && swscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
ShowMessage(pmsg);
mir_strncpy(m_serverName, _T2A(szAltServer), 99);
mir_strncpy(m_portStart, _T2A(szAltPort), 9);
@@ -2203,22 +2203,22 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 0) {
CMString S;
for (int i = 0; i < pmsg->parameters.getCount(); i++) {
- TCHAR* temp = mir_tstrdup(pmsg->parameters[i].c_str());
- if (_tcsstr(temp, L"CHANTYPES=")) {
- TCHAR* p1 = _tcschr(temp, '=');
+ wchar_t* temp = mir_tstrdup(pmsg->parameters[i].c_str());
+ if (wcsstr(temp, L"CHANTYPES=")) {
+ wchar_t* p1 = wcschr(temp, '=');
p1++;
if (mir_tstrlen(p1) > 0)
sChannelPrefixes = p1;
}
- if (_tcsstr(temp, L"CHANMODES=")) {
- TCHAR* p1 = _tcschr(temp, '=');
+ if (wcsstr(temp, L"CHANMODES=")) {
+ wchar_t* p1 = wcschr(temp, '=');
p1++;
if (mir_tstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
- if (_tcsstr(temp, L"PREFIX=")) {
- TCHAR* p1 = _tcschr(temp, '(');
- TCHAR* p2 = _tcschr(temp, ')');
+ if (wcsstr(temp, L"PREFIX=")) {
+ wchar_t* p1 = wcschr(temp, '(');
+ wchar_t* p2 = wcschr(temp, ')');
if (p1 && p2) {
p1++;
if (p1 != p2)
@@ -2229,7 +2229,7 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg) sUserModePrefixes = p2;
}
else {
- p1 = _tcschr(temp, '=');
+ p1 = wcschr(temp, '=');
p1++;
sUserModePrefixes = p1;
for (int n = 0; n < sUserModePrefixes.GetLength() + 1; n++) {
@@ -2417,13 +2417,13 @@ int CIrcProto::IsIgnored(CMString user, char type) if (type == 0 && !mir_tstrcmpi(user.c_str(), C.mask.c_str()))
return i + 1;
- bool bUserContainsWild = (_tcschr(user.c_str(), '*') != NULL || _tcschr(user.c_str(), '?') != NULL);
+ bool bUserContainsWild = (wcschr(user.c_str(), '*') != NULL || wcschr(user.c_str(), '?') != NULL);
if (!bUserContainsWild && WCCmp(C.mask.c_str(), user.c_str()) ||
bUserContainsWild && !mir_tstrcmpi(user.c_str(), C.mask.c_str())) {
if (C.flags.IsEmpty() || C.flags[0] != '+')
continue;
- if (!_tcschr(C.flags.c_str(), type))
+ if (!wcschr(C.flags.c_str(), type))
continue;
if (C.network.IsEmpty())
@@ -2437,7 +2437,7 @@ int CIrcProto::IsIgnored(CMString user, char type) return 0;
}
-bool CIrcProto::AddIgnore(const TCHAR* mask, const TCHAR* flags, const TCHAR* network)
+bool CIrcProto::AddIgnore(const wchar_t* mask, const wchar_t* flags, const wchar_t* network)
{
RemoveIgnore(mask);
m_ignoreItems.insert(new CIrcIgnoreItem(mask, (L"+" + CMString(flags)).c_str(), network));
@@ -2448,7 +2448,7 @@ bool CIrcProto::AddIgnore(const TCHAR* mask, const TCHAR* flags, const TCHAR* ne return true;
}
-bool CIrcProto::RemoveIgnore(const TCHAR* mask)
+bool CIrcProto::RemoveIgnore(const wchar_t* mask)
{
int idx;
while ((idx = IsIgnored(mask, '\0')) != 0)
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index d8204e63dc..aef90b870e 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CIrcProto::FormatMsg(CMString& text)
{
- TCHAR temp[30];
+ wchar_t temp[30];
mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
@@ -42,7 +42,7 @@ void CIrcProto::FormatMsg(CMString& text) S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" " + GetWord(text.c_str(), 2) + L" :" + GetWordAddress(text.c_str(), 3);
}
else if (command == L"/nick") {
- if (!_tcsstr(GetWord(text.c_str(), 1).c_str(), NICKSUBSTITUTE)) {
+ if (!wcsstr(GetWord(text.c_str(), 1).c_str(), NICKSUBSTITUTE)) {
sNick4Perform = GetWord(text.c_str(), 1);
S = GetWordAddress(text.c_str(), 0);
}
@@ -72,15 +72,15 @@ static void AddCR(CMString& text) text.Replace(L"\r\r", L"\r");
}
-CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
+CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window)
{
CMString Messageout = L"";
- const TCHAR* p1 = text;
- const TCHAR* p2 = text;
+ const wchar_t* p1 = text;
+ const wchar_t* p2 = text;
bool LinebreakFlag = false, hasAlias = false;
- p2 = _tcsstr(p1, L"\r\n");
+ p2 = wcsstr(p1, L"\r\n");
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
if (p1 == p2)
return (CMString)text;
@@ -88,38 +88,38 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window) if (LinebreakFlag)
Messageout += L"\r\n";
- TCHAR* line = new TCHAR[p2 - p1 + 1];
+ wchar_t* line = new wchar_t[p2 - p1 + 1];
mir_tstrncpy(line, p1, p2 - p1 + 1);
- TCHAR* test = line;
+ wchar_t* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
- line = new TCHAR[S.GetLength() + 2];
+ line = new wchar_t[S.GetLength() + 2];
mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
- const TCHAR* p3 = _tcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
+ const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
if (p3 != alias.c_str()) {
CMString str = L"\r\n";
str += GetWord(line, 0) + L" ";
- p3 = _tcsstr(alias.c_str(), str.c_str());
+ p3 = wcsstr(alias.c_str(), str.c_str());
if (p3)
p3 += 2;
}
if (p3 != NULL) {
hasAlias = true;
- const TCHAR* p4 = _tcsstr(p3, L"\r\n");
+ const wchar_t* p4 = wcsstr(p3, L"\r\n");
if (!p4)
- p4 = _tcschr(p3, '\0');
+ p4 = wcschr(p3, '\0');
- *(TCHAR*)p4 = 0;
+ *(wchar_t*)p4 = 0;
CMString str = p3;
str.Replace(L"##", window);
str.Replace(L"$?", L"%question");
- TCHAR buf[5];
+ wchar_t buf[5];
for (int index = 1; index < 8; index++) {
mir_sntprintf(buf, L"#$%u", index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
@@ -147,9 +147,9 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window) p1 = p2;
if (*p1 == '\r')
p1 += 2;
- p2 = _tcsstr(p1, L"\r\n");
+ p2 = wcsstr(p1, L"\r\n");
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
delete[] line;
LinebreakFlag = true;
}
@@ -158,10 +158,10 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window) return hasAlias ? DoIdentifiers(Messageout, window) : Messageout;
}
-CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
+CMString CIrcProto::DoIdentifiers(CMString text, const wchar_t*)
{
SYSTEMTIME time;
- TCHAR str[2];
+ wchar_t str[2];
GetLocalTime(&time);
text.Replace(L"%mnick", m_nick);
@@ -176,8 +176,7 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*) char mirver[100];
CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(mirver), LPARAM(mirver));
text.Replace(L"%mirver", _A2T(mirver));
-
- text.Replace(L"%version", _T(__VERSION_STRING_DOTS));
+ text.Replace(L"%version", _A2T(__VERSION_STRING_DOTS));
str[0] = 3; str[1] = '\0';
text.Replace(L"%color", str);
@@ -210,7 +209,7 @@ static void __stdcall sttSetTimerOff(void* _pro) ppro->KillChatTimer(ppro->OnlineNotifTimer3);
}
-BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hContact)
+BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact)
{
CMString command(GetWord(text, 0)); command.MakeLower();
CMString one = GetWord(text, 1);
@@ -230,7 +229,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta else if (command == L"/sleep" || command == L"/wait") {
if (!one.IsEmpty()) {
int ms;
- if (_stscanf(one.c_str(), L"%d", &ms) == 1 && ms > 0 && ms <= 4000)
+ if (swscanf(one.c_str(), L"%d", &ms) == 1 && ms > 0 && ms <= 4000)
Sleep(ms);
else
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Incorrect parameters. Usage: /sleep [ms], ms should be greater than 0 and less than 4000."), NULL, NULL, NULL, true, false);
@@ -260,7 +259,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (command == L"/ignore") {
if (IsConnected()) {
CMString IgnoreFlags;
- TCHAR temp[500];
+ wchar_t temp[500];
if (one.IsEmpty()) {
if (m_ignore)
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
@@ -278,21 +277,21 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!_tcschr(one.c_str(), '!') && !_tcschr(one.c_str(), '@'))
+ if (!wcschr(one.c_str(), '!') && !wcschr(one.c_str(), '@'))
one += L"!*@*";
if (!two.IsEmpty() && two[0] == '+') {
- if (_tcschr(two.c_str(), 'q'))
+ if (wcschr(two.c_str(), 'q'))
IgnoreFlags += 'q';
- if (_tcschr(two.c_str(), 'n'))
+ if (wcschr(two.c_str(), 'n'))
IgnoreFlags += 'n';
- if (_tcschr(two.c_str(), 'i'))
+ if (wcschr(two.c_str(), 'i'))
IgnoreFlags += 'i';
- if (_tcschr(two.c_str(), 'd'))
+ if (wcschr(two.c_str(), 'd'))
IgnoreFlags += 'd';
- if (_tcschr(two.c_str(), 'c'))
+ if (wcschr(two.c_str(), 'c'))
IgnoreFlags += 'c';
- if (_tcschr(two.c_str(), 'm'))
+ if (wcschr(two.c_str(), 'm'))
IgnoreFlags += 'm';
}
else IgnoreFlags = L"qnidc";
@@ -312,10 +311,10 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta }
if (command == L"/unignore") {
- if (!_tcschr(one.c_str(), '!') && !_tcschr(one.c_str(), '@'))
+ if (!wcschr(one.c_str(), '!') && !wcschr(one.c_str(), '@'))
one += L"!*@*";
- TCHAR temp[500];
+ wchar_t temp[500];
if (RemoveIgnore(one.c_str()))
mir_sntprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
else
@@ -363,7 +362,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta }
if (command == L"/nusers") {
- TCHAR szTemp[40];
+ wchar_t szTemp[40];
CMString S = MakeWndID(window);
GC_INFO gci = { 0 };
gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT;
@@ -412,14 +411,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta CallFunctionAsync(sttSetTimerOff, this);
}
if (!mir_tstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
- m_iTempCheckTime = _ttoi(two.c_str());
+ m_iTempCheckTime = _wtoi(two.c_str());
if (m_iTempCheckTime < 10 && m_iTempCheckTime != 0)
m_iTempCheckTime = 10;
if (m_iTempCheckTime == 0)
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The time interval for the buddy check function is now at default setting"), NULL, NULL, NULL, true, false);
else {
- TCHAR temp[200];
+ wchar_t temp[200];
mir_sntprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
@@ -507,7 +506,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (one.IsEmpty())
return true;
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
@@ -537,7 +536,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (one.IsEmpty() || two.IsEmpty())
return true;
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
@@ -548,7 +547,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (one.IsEmpty() || IsChannel(one.c_str()))
return true;
- CONTACT user = { (TCHAR*)one.c_str(), NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)one.c_str(), NULL, NULL, false, false, false };
MCONTACT hContact2 = CList_AddContact(&user, false, false);
if (hContact2) {
if (getByte(hContact, "AdvancedMode", 0) == 0)
@@ -572,7 +571,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta }
if (!two.IsEmpty()) {
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
}
@@ -583,7 +582,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (one.IsEmpty() || two.IsEmpty())
return true;
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
ulAdr = ConvertIPToInteger(m_mySpecifiedHostIP);
@@ -612,7 +611,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta return true;
if (mir_tstrcmpi(one.c_str(), L"send") == 0) {
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
@@ -621,7 +620,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (ulAdr) {
- CONTACT user = { (TCHAR*)two.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)two.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
if (ccNew) {
CMString s;
@@ -646,8 +645,8 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta CallService(MS_FILE_SENDFILE, ccNew, 0);
else {
CMString temp = GetWordAddress(text.c_str(), 3);
- TCHAR* pp[2];
- TCHAR* p = (TCHAR*)temp.c_str();
+ wchar_t* pp[2];
+ wchar_t* p = (wchar_t*)temp.c_str();
pp[0] = p;
pp[1] = NULL;
CallService(MS_FILE_SENDSPECIFICFILEST, ccNew, (LPARAM)pp);
@@ -662,7 +661,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta }
if (mir_tstrcmpi(one.c_str(), L"chat") == 0) {
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
@@ -672,7 +671,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta if (ulAdr) {
CMString contact = two; contact += DCCSTRING;
- CONTACT user = { (TCHAR*)contact.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)contact.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
setByte(ccNew, "DCC", 1);
@@ -716,43 +715,43 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta struct DoInputRequestParam
{
- DoInputRequestParam(CIrcProto* _pro, const TCHAR* _str) :
+ DoInputRequestParam(CIrcProto* _pro, const wchar_t* _str) :
ppro(_pro),
str(mir_tstrdup(_str))
{}
CIrcProto *ppro;
- TCHAR* str;
+ wchar_t* str;
};
static void __stdcall DoInputRequestAliasApcStub(void* _par)
{
DoInputRequestParam* param = (DoInputRequestParam*)_par;
CIrcProto *ppro = param->ppro;
- TCHAR* str = param->str;
+ wchar_t* str = param->str;
- TCHAR* infotext = NULL;
- TCHAR* title = NULL;
- TCHAR* defaulttext = NULL;
- CMString command = (TCHAR*)str;
- TCHAR* p = _tcsstr((TCHAR*)str, L"%question");
+ wchar_t* infotext = NULL;
+ wchar_t* title = NULL;
+ wchar_t* defaulttext = NULL;
+ CMString command = (wchar_t*)str;
+ wchar_t* p = wcsstr((wchar_t*)str, L"%question");
if (p[9] == '=' && p[10] == '\"') {
infotext = &p[11];
- p = _tcschr(infotext, '\"');
+ p = wcschr(infotext, '\"');
if (p) {
*p = '\0';
p++;
if (*p == ',' && p[1] == '\"') {
p++; p++;
title = p;
- p = _tcschr(title, '\"');
+ p = wcschr(title, '\"');
if (p) {
*p = '\0';
p++;
if (*p == ',' && p[1] == '\"') {
p++; p++;
defaulttext = p;
- p = _tcschr(defaulttext, '\"');
+ p = wcschr(defaulttext, '\"');
if (p)
*p = '\0';
}
@@ -785,24 +784,24 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) delete param;
}
-bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
+bool CIrcProto::PostIrcMessage(const wchar_t* fmt, ...)
{
if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
return 0;
va_list marker;
va_start(marker, fmt);
- static TCHAR szBuf[4 * 1024];
+ static wchar_t szBuf[4 * 1024];
mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
}
-bool CIrcProto::PostIrcMessageWnd(TCHAR *window, MCONTACT hContact, const TCHAR *szBuf)
+bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wchar_t *szBuf)
{
DBVARIANT dbv;
- TCHAR windowname[256];
+ wchar_t windowname[256];
BYTE bDCC = 0;
if (hContact)
@@ -821,7 +820,7 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR *window, MCONTACT hContact, const TCHAR mir_tstrncpy(windowname, SERVERWINDOW, 255);
if (mir_tstrcmpi(window, SERVERWINDOW) != 0) {
- TCHAR* p1 = _tcschr(windowname, ' ');
+ wchar_t* p1 = wcschr(windowname, ' ');
if (p1)
*p1 = '\0';
}
diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h index 327130838f..a9610a97f3 100644 --- a/protocols/IRCG/src/irc_dlg.h +++ b/protocols/IRCG/src/irc_dlg.h @@ -165,7 +165,7 @@ struct CManagerDlg : public CCoolIrcDlg void ApplyQuestion();
void CloseQuestion();
- void InitManager(int mode, const TCHAR* window);
+ void InitManager(int mode, const wchar_t* window);
};
struct CQuestionDlg : public CCoolIrcDlg
@@ -302,9 +302,9 @@ struct CAddIgnoreDlg : public CProtoDlgBase < CIrcProto > CCtrlButton m_Ok;
CIgnorePrefsDlg* m_owner;
- TCHAR szOldMask[500];
+ wchar_t szOldMask[500];
- CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* parent);
+ CAddIgnoreDlg(CIrcProto* _pro, const wchar_t* mask, CIgnorePrefsDlg* parent);
virtual void OnInitDialog();
virtual void OnClose();
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index bac5fd2d2b..3828a45f5f 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -36,7 +36,7 @@ OBJLIST<CIrcHandler> CIrcProto::m_handlers( 30, CompareHandlers ); //////////////////////////////////////////////////////////////////// -CIrcMessage::CIrcMessage( CIrcProto* _pro, const TCHAR* lpszCmdLine, int codepage, bool bIncoming, bool bNotify ) : +CIrcMessage::CIrcMessage( CIrcProto* _pro, const wchar_t* lpszCmdLine, int codepage, bool bIncoming, bool bNotify ) : m_proto( _pro ), m_bIncoming( bIncoming ), m_bNotify( bNotify ), @@ -89,29 +89,29 @@ CIrcMessage& CIrcMessage::operator = (const CIrcMessage& m) return *this; } -CIrcMessage& CIrcMessage::operator = (const TCHAR* lpszCmdLine) +CIrcMessage& CIrcMessage::operator = (const wchar_t* lpszCmdLine) { Reset(); ParseIrcCommand(lpszCmdLine); return *this; } -void CIrcMessage::ParseIrcCommand(const TCHAR* lpszCmdLine) +void CIrcMessage::ParseIrcCommand(const wchar_t* lpszCmdLine) { - const TCHAR* p1 = lpszCmdLine; - const TCHAR* p2 = lpszCmdLine; + const wchar_t* p1 = lpszCmdLine; + const wchar_t* p2 = lpszCmdLine; // prefix exists ? if (*p1 == ':') { // break prefix into its components (nick!user@host) p2 = ++p1; - while (*p2 && !_tcschr(L" !", *p2)) + while (*p2 && !wcschr(L" !", *p2)) ++p2; prefix.sNick.SetString(p1, p2 - p1); if (*p2 != '!') goto end_of_prefix; p1 = ++p2; - while (*p2 && !_tcschr(L" @", *p2)) + while (*p2 && !wcschr(L" @", *p2)) ++p2; prefix.sUser.SetString(p1, p2 - p1); if (*p2 != '@') @@ -168,7 +168,7 @@ int CIrcProto::getCodepage() const return (con != NULL) ? codepage : CP_ACP; } -void CIrcProto::SendIrcMessage(const TCHAR* msg, bool bNotify, int cp) +void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) { if (cp == -1) cp = getCodepage(); @@ -200,7 +200,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) ncon.wPort = info.iPort; con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon); if (con == NULL) { - TCHAR szTemp[300]; + wchar_t szTemp[300]; mir_sntprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).", TranslateT("Failed to connect to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort); DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false); @@ -233,7 +233,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) NLSend(L"NICK %s\r\n", info.sNick.c_str()); CMString userID = GetWord(info.sUserID.c_str(), 0); - TCHAR szHostName[MAX_PATH]; + wchar_t szHostName[MAX_PATH]; DWORD cbHostName = _countof(szHostName); GetComputerName(szHostName, &cbHostName); CMString HostName = GetWord(szHostName, 0); @@ -283,12 +283,12 @@ int CIrcProto::NLSend(const unsigned char* buf, int cbBuf) return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT); } -int CIrcProto::NLSend(const TCHAR* fmt, ...) +int CIrcProto::NLSend(const wchar_t* fmt, ...) { va_list marker; va_start(marker, fmt); - TCHAR szBuf[1024 * 4]; + wchar_t szBuf[1024 * 4]; mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker); va_end(marker); @@ -332,7 +332,7 @@ void CIrcProto::KillIdent() } } -void CIrcProto::InsertIncomingEvent(TCHAR* pszRaw) +void CIrcProto::InsertIncomingEvent(wchar_t* pszRaw) { CIrcMessage msg(this, pszRaw, true); Notify(&msg); @@ -341,7 +341,7 @@ void CIrcProto::InsertIncomingEvent(TCHAR* pszRaw) void CIrcProto::createMessageFromPchar(const char* p) { - TCHAR* ptszMsg; + wchar_t* ptszMsg; if (codepage != CP_UTF8 && m_utfAutodetect) { if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == NULL) ptszMsg = mir_a2t_cp(p, codepage); @@ -518,7 +518,7 @@ CDccSession* CIrcProto::FindDCCSendByPort(int iPort) return 0; } -CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const TCHAR* szName) +CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szName) { mir_cslock lck(m_dcc); @@ -589,7 +589,7 @@ void CIrcProto::CheckDCCTimeout(void) //////////////////////////////////////////////////////////////////// -CIrcIgnoreItem::CIrcIgnoreItem(const TCHAR* _mask, const TCHAR* _flags, const TCHAR* _network) : +CIrcIgnoreItem::CIrcIgnoreItem(const wchar_t* _mask, const wchar_t* _flags, const wchar_t* _network) : mask(_mask), flags(_flags), network(_network) @@ -597,9 +597,9 @@ CIrcIgnoreItem::CIrcIgnoreItem(const TCHAR* _mask, const TCHAR* _flags, const TC } CIrcIgnoreItem::CIrcIgnoreItem(int codepage, const char* _mask, const char* _flags, const char* _network) : - mask((TCHAR*)_A2T(_mask, codepage)), - flags((TCHAR*)_A2T(_flags, codepage)), - network((TCHAR*)_A2T(_network, codepage)) + mask((wchar_t*)_A2T(_mask, codepage)), + flags((wchar_t*)_A2T(_flags, codepage)), + network((wchar_t*)_A2T(_network, codepage)) { } @@ -673,7 +673,7 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) else OnIrcDisconnected(); } -PfnIrcMessageHandler CIrcProto::FindMethod(const TCHAR* lpszName) +PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t* lpszName) { CIrcHandler temp(lpszName, NULL); CIrcHandler* p = m_handlers.find(&temp); @@ -814,7 +814,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf) return n; } -int CDccSession::SendStuff(const TCHAR* fmt) +int CDccSession::SendStuff(const wchar_t* fmt) { CMStringA buf = _T2A(fmt, m_proto->getCodepage()); return NLSend((const unsigned char*)buf.c_str(), buf.GetLength()); @@ -861,11 +861,11 @@ int CDccSession::SetupConnection() // Set up stuff needed for the filetransfer dialog (if it is a filetransfer) if (di->iType == DCC_SEND) { - file[0] = (TCHAR*)di->sFileAndPath.c_str(); + file[0] = (wchar_t*)di->sFileAndPath.c_str(); file[1] = 0; - pfts.tszCurrentFile = (TCHAR*)di->sFileAndPath.c_str(); - pfts.tszWorkingDir = (TCHAR*)di->sPath.c_str(); + pfts.tszCurrentFile = (wchar_t*)di->sFileAndPath.c_str(); + pfts.tszWorkingDir = (wchar_t*)di->sPath.c_str(); pfts.hContact = di->hContact; pfts.flags = PFTS_TCHAR + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); pfts.totalFiles = 1; @@ -967,7 +967,7 @@ int CDccSession::SetupConnection() hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_proto->hNetlibDCC, (LPARAM)&nb); if (hBindPort == NULL) { - m_proto->DoEvent(GC_EVENT_INFORMATION, 0, m_proto->m_info.sNick.c_str(), LPGENT("DCC ERROR: Unable to bind local port for passive file transfer"), NULL, NULL, NULL, true, false); + m_proto->DoEvent(GC_EVENT_INFORMATION, 0, m_proto->m_info.sNick.c_str(), LPGENW("DCC ERROR: Unable to bind local port for passive file transfer"), NULL, NULL, NULL, true, false); delete this; // dcc objects destroy themselves when the connection has been closed or failed for some reasson. return 0; } @@ -1083,7 +1083,7 @@ void CDccSession::DoSendFile() // is there a connection? if (con) { // open the file for reading - int hFile = _topen(di->sFileAndPath.c_str(), _O_RDONLY | _O_BINARY, _S_IREAD); + int hFile = _wopen(di->sFileAndPath.c_str(), _O_RDONLY | _O_BINARY, _S_IREAD); if (hFile >= 0) { unsigned __int64 dwLastAck = 0; @@ -1226,7 +1226,7 @@ void CDccSession::DoReceiveFile() ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (void *)di, 0); // open the file for writing (and reading in case it is a resume) - int hFile = _topen(di->sFileAndPath.c_str(), + int hFile = _wopen(di->sFileAndPath.c_str(), (dwWhatNeedsDoing == FILERESUME_RESUME ? _O_APPEND : _O_TRUNC | _O_CREAT) | _O_RDWR | _O_BINARY, _S_IREAD | _S_IWRITE); if (hFile >= 0) { diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 043a83ca76..069c545a12 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -69,17 +69,17 @@ public : int m_codePage;
//CIrcMessage( CIrcProto* ); // default constructor
- CIrcMessage( CIrcProto*, const TCHAR* lpszCmdLine, int codepage, bool bIncoming=false, bool bNotify = true); // parser constructor
+ CIrcMessage( CIrcProto*, const wchar_t* lpszCmdLine, int codepage, bool bIncoming=false, bool bNotify = true); // parser constructor
CIrcMessage( const CIrcMessage& m ); // copy constructor
~CIrcMessage();
void Reset();
CIrcMessage& operator = (const CIrcMessage& m);
- CIrcMessage& operator = (const TCHAR* lpszCmdLine);
+ CIrcMessage& operator = (const wchar_t* lpszCmdLine);
private :
- void ParseIrcCommand(const TCHAR* lpszCmdLine);
+ void ParseIrcCommand(const wchar_t* lpszCmdLine);
};
////////////////////////////////////////////////////////////////////
@@ -110,7 +110,7 @@ struct CIrcSessionInfo struct CIrcIgnoreItem
{
- CIrcIgnoreItem( const TCHAR*, const TCHAR*, const TCHAR* );
+ CIrcIgnoreItem( const wchar_t*, const wchar_t*, const wchar_t* );
CIrcIgnoreItem( int codepage, const char*, const char*, const char* );
~CIrcIgnoreItem();
@@ -132,7 +132,7 @@ protected: int iGlobalToken;
PROTOFILETRANSFERSTATUS pfts; // structure used to setup and update the filetransfer dialogs of miranda
- TCHAR* file[2];
+ wchar_t* file[2];
int SetupConnection();
void DoSendFile();
@@ -154,7 +154,7 @@ public: HANDLE hEvent; // Manual object
long dwWhatNeedsDoing; // Set to indicate what FILERESUME_ action is chosen by the user
- TCHAR* NewFileName; // contains new file name if FILERESUME_RENAME chosen
+ wchar_t* NewFileName; // contains new file name if FILERESUME_RENAME chosen
unsigned __int64 dwResumePos; // position to resume from if FILERESUME_RESUME
int iToken; // used to identify (find) objects in reverse dcc filetransfers
@@ -163,7 +163,7 @@ public: int Connect();
void SetupPassive( DWORD adr, DWORD port );
- int SendStuff(const TCHAR* fmt);
+ int SendStuff(const wchar_t* fmt);
int IncomingConnection(HANDLE hConnection, DWORD dwIP);
int Disconnect();
};
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index eaa7f8541b..dc17feab0a 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -31,7 +31,7 @@ static int CompareSessions(const CDccSession* p1, const CDccSession* p2) return INT_PTR(p1->di->hContact) - INT_PTR(p2->di->hContact);
}
-CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) :
+CIrcProto::CIrcProto(const char* szModuleName, const wchar_t* tszUserName) :
PROTO<CIrcProto>(szModuleName, tszUserName),
m_dcc_chats(10, CompareSessions),
m_dcc_xfers(10, CompareSessions),
@@ -174,7 +174,7 @@ static int sttCheckPerform(const char *szSetting, LPARAM lParam) int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
{
NETLIBUSER nlu = { 0 };
- TCHAR name[128];
+ wchar_t name[128];
db_unset(NULL, m_szModuleName, "JTemp");
@@ -208,7 +208,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) gcw.iType = GCW_SERVER;
gcw.ptszID = SERVERWINDOW;
gcw.pszModule = m_szModuleName;
- gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network));
+ gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
@@ -218,9 +218,9 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) else
CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
- TCHAR szTemp[MAX_PATH];
+ wchar_t szTemp[MAX_PATH];
mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
- TCHAR *szLoadFileName = Utils_ReplaceVarsT(szTemp);
+ wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszPerformData = IrcLoadFile(szLoadFileName);
if (pszPerformData != NULL) {
char *p1 = pszPerformData, *p2 = pszPerformData;
@@ -240,7 +240,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) setString(("PERFORM:" + sNetwork).c_str(), rtrim(p1));
}
delete[] pszPerformData;
- ::_tremove(szLoadFileName);
+ ::_wremove(szLoadFileName);
}
mir_free(szLoadFileName);
@@ -272,7 +272,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_OPT_INITIALISE, &CIrcProto::OnInitOptionsPages);
if (m_nick[0]) {
- TCHAR szBuf[40];
+ wchar_t szBuf[40];
if (mir_tstrlen(m_alternativeNick) == 0) {
mir_sntprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
@@ -297,7 +297,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
- TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t;
+ wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w;
id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)id) : mir_a2t((char*)id);
CONTACT user = { id, NULL, NULL, true, false, false };
@@ -341,7 +341,7 @@ int __cdecl CIrcProto::Authorize(MEVENT) ////////////////////////////////////////////////////////////////////////////////////////
// AuthDeny - handles the unsuccessful authorization
-int __cdecl CIrcProto::AuthDeny(MEVENT, const TCHAR*)
+int __cdecl CIrcProto::AuthDeny(MEVENT, const wchar_t*)
{
return 0;
}
@@ -349,7 +349,7 @@ int __cdecl CIrcProto::AuthDeny(MEVENT, const TCHAR*) ////////////////////////////////////////////////////////////////////////////////////////
// FileAllow - starts a file transfer
-HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -386,7 +386,7 @@ int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// FileDeny - denies a file transfer
-int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*)
+int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
{
DCCINFO* di = (DCCINFO*)hTransfer;
delete di;
@@ -396,7 +396,7 @@ int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*) ////////////////////////////////////////////////////////////////////////////////////////
// FileResume - processes file renaming etc
-int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -406,7 +406,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, i);
if (*action == FILERESUME_RENAME) {
- TCHAR* szTemp = _tcsdup(*szFilename);
+ wchar_t* szTemp = wcsdup(*szFilename);
InterlockedExchangePointer((PVOID*)&dcc->NewFileName, szTemp);
}
@@ -414,7 +414,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s unsigned __int64 dwPos = 0;
struct _stati64 statbuf;
- if (_tstati64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
+ if (_wstat64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
dwPos = statbuf.st_size;
CMString sFileWithQuotes = di->sFile;
@@ -475,7 +475,7 @@ DWORD_PTR __cdecl CIrcProto::GetCaps(int type, MCONTACT) struct AckBasicSearchParam
{
- TCHAR buf[50];
+ wchar_t buf[50];
};
void __cdecl CIrcProto::AckBasicSearch(void *arg)
@@ -485,13 +485,13 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg) AckBasicSearchParam *param = (AckBasicSearchParam*)arg;
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id.t = psr.nick.t = param->buf;
+ psr.id.w = psr.nick.w = param->buf;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
delete param;
}
-HANDLE __cdecl CIrcProto::SearchBasic(const TCHAR* szId)
+HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId)
{
if (szId) {
if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
@@ -509,7 +509,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const TCHAR* szId) ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppszFiles)
+HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
{
DCCINFO* dci = NULL;
int iPort = 0;
@@ -537,7 +537,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz //get file size
while (ppszFiles[index]) {
struct _stati64 statbuf;
- if (_tstati64(ppszFiles[index], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
+ if (_wstat64(ppszFiles[index], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
size = statbuf.st_size;
break;
}
@@ -588,7 +588,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz // is it an reverse filetransfer (receiver acts as server)
if (dci->bReverse) {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
PostIrcMessage(L"/CTCP %s DCC SEND %s 200 0 %I64u %u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), dci->dwSize, dcc->iToken);
@@ -607,7 +607,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz else { // ... normal filetransfer.
iPort = dcc->Connect();
if (iPort) {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
PostIrcMessage(L"/CTCP %s DCC SEND %s %u %u %I64u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), ulAdr, iPort, dci->dwSize);
@@ -619,7 +619,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz if (m_sendNotice) {
mir_sntprintf(szTemp,
L"/NOTICE %s I am sending the file '\002%s\002' (%I64u kB) to you, please accept it. [IP: %s]",
- dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024, (TCHAR*)_A2T(ConvertIntegerToIP(ulAdr)));
+ dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024, (wchar_t*)_A2T(ConvertIntegerToIP(ulAdr)));
PostIrcMessage(szTemp);
}
}
@@ -630,7 +630,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz // fix for sending multiple files
index++;
while (ppszFiles[index]) {
- if (_taccess(ppszFiles[index], 0) == 0) {
+ if (_waccess(ppszFiles[index], 0) == 0) {
PostIrcMessage(L"/DCC SEND %s %S", dci->sContactName.c_str(), ppszFiles[index]);
}
index++;
@@ -692,7 +692,7 @@ int __cdecl CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) return 0;
}
- TCHAR *result;
+ wchar_t *result;
mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &result);
PostIrcMessageWnd(NULL, hContact, result);
mir_free(result);
@@ -806,7 +806,7 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact) ////////////////////////////////////////////////////////////////////////////////////////
// SetAwayMsg - sets the away status message
-int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg)
{
switch (status) {
case ID_STATUS_ONLINE: case ID_STATUS_INVISIBLE: case ID_STATUS_FREECHAT:
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 549e9dc8ed..d82a0e9b6c 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -73,7 +73,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
-static CIrcProto* ircProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static CIrcProto* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 608cd844bb..3dee470d0d 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -63,10 +63,10 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) if (!getTString(p->name, &dbv)) {
if (p->size != -1) {
size_t len = min(p->size - 1, mir_tstrlen(dbv.ptszVal));
- memcpy(ptr, dbv.pszVal, len*sizeof(TCHAR));
- *(TCHAR*)&ptr[len*sizeof(TCHAR)] = 0;
+ memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t));
+ *(wchar_t*)&ptr[len*sizeof(wchar_t)] = 0;
}
- else *(TCHAR**)ptr = mir_tstrdup(dbv.ptszVal);
+ else *(wchar_t**)ptr = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
else {
@@ -74,9 +74,9 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) if (p->defStr == NULL)
*ptr = 0;
else
- mir_tstrncpy((TCHAR*)ptr, p->defStr, (int)p->size);
+ mir_tstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
}
- else *(TCHAR**)ptr = mir_tstrdup(p->defStr);
+ else *(wchar_t**)ptr = mir_tstrdup(p->defStr);
}
break;
} } }
@@ -102,9 +102,9 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count ) case DBVT_TCHAR:
if (p->size == -1)
- setTString(p->name, *(TCHAR**)ptr);
+ setTString(p->name, *(wchar_t**)ptr);
else
- setTString(p->name, (TCHAR*)ptr);
+ setTString(p->name, (wchar_t*)ptr);
break;
} } }
@@ -173,11 +173,11 @@ void RereadServers() /////////////////////////////////////////////////////////////////////////////////////////
-static void removeSpaces(TCHAR* p)
+static void removeSpaces(wchar_t* p)
{
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(TCHAR)*mir_tstrlen(p));
+ memmove(p, p + 1, sizeof(wchar_t)*mir_tstrlen(p));
p++;
}
}
@@ -231,36 +231,36 @@ HANDLE GetIconHandle(int iconId) /////////////////////////////////////////////////////////////////////////////////////////
// code page handler
-struct { UINT cpId; TCHAR *cpName; } static cpTable[] =
-{
- { 874, LPGENT("Thai") },
- { 932, LPGENT("Japanese") },
- { 936, LPGENT("Simplified Chinese") },
- { 949, LPGENT("Korean") },
- { 950, LPGENT("Traditional Chinese") },
- { 1250, LPGENT("Central European") },
- { 1251, LPGENT("Cyrillic (Windows)") },
- { 20866, LPGENT("Cyrillic (KOI8R)") },
- { 1252, LPGENT("Latin I") },
- { 1253, LPGENT("Greek") },
- { 1254, LPGENT("Turkish") },
- { 1255, LPGENT("Hebrew") },
- { 1256, LPGENT("Arabic") },
- { 1257, LPGENT("Baltic") },
- { 1258, LPGENT("Vietnamese") },
- { 1361, LPGENT("Korean (Johab)") }
+struct { UINT cpId; wchar_t *cpName; } static cpTable[] =
+{
+ { 874, LPGENW("Thai") },
+ { 932, LPGENW("Japanese") },
+ { 936, LPGENW("Simplified Chinese") },
+ { 949, LPGENW("Korean") },
+ { 950, LPGENW("Traditional Chinese") },
+ { 1250, LPGENW("Central European") },
+ { 1251, LPGENW("Cyrillic (Windows)") },
+ { 20866, LPGENW("Cyrillic (KOI8R)") },
+ { 1252, LPGENW("Latin I") },
+ { 1253, LPGENW("Greek") },
+ { 1254, LPGENW("Turkish") },
+ { 1255, LPGENW("Hebrew") },
+ { 1256, LPGENW("Arabic") },
+ { 1257, LPGENW("Baltic") },
+ { 1258, LPGENW("Vietnamese") },
+ { 1361, LPGENW("Korean (Johab)") }
};
static CCtrlCombo* sttCombo;
-static BOOL CALLBACK sttLangAddCallback(TCHAR *str)
+static BOOL CALLBACK sttLangAddCallback(wchar_t *str)
{
- UINT cp = _ttoi(str);
+ UINT cp = _wtoi(str);
CPINFOEX cpinfo;
if (GetCPInfoEx(cp, 0, &cpinfo)) {
- TCHAR* b = _tcschr(cpinfo.CodePageName, '(');
+ wchar_t* b = wcschr(cpinfo.CodePageName, '(');
if (b) {
- TCHAR* e = _tcsrchr(cpinfo.CodePageName, ')');
+ wchar_t* e = wcsrchr(cpinfo.CodePageName, ')');
if (e) {
*e = 0;
sttCombo->AddString(b + 1, cp);
@@ -601,8 +601,8 @@ void CConnectPrefsDlg::OnDeleteServer(CCtrlButton*) m_del.Disable();
SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
- TCHAR temp[200];
- mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (TCHAR*)_A2T(pData->m_name));
+ wchar_t temp[200];
+ mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (wchar_t*)_A2T(pData->m_name));
if (MessageBox(m_hwnd, temp, TranslateT("Delete server"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
g_servers.remove(pData);
@@ -693,7 +693,7 @@ void CConnectPrefsDlg::OnApply() m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
+ wcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
@@ -827,7 +827,7 @@ void CCtcpPrefsDlg::OnInitDialog() m_combo.AddStringA("4096");
m_combo.AddStringA("8192");
- TCHAR szTemp[10];
+ wchar_t szTemp[10];
mir_sntprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
int i = m_combo.SelectString(szTemp);
if (i == CB_ERR)
@@ -849,14 +849,14 @@ void CCtcpPrefsDlg::OnInitDialog() else {
if (m_proto->m_IPFromServer) {
if (m_proto->m_myHost[0]) {
- CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + L">";
+ CMString s = (CMString)TranslateT("<Resolved IP: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
if (m_proto->m_myLocalHost[0]) {
- CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMString s = (CMString)TranslateT("<Local IP: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
@@ -874,14 +874,14 @@ void CCtcpPrefsDlg::OnClicked(CCtrlData*) else {
if (m_fromServer.GetState()) {
if (m_proto->m_myHost[0]) {
- CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + L">";
+ CMString s = (CMString)TranslateT("<Resolved IP: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
if (m_proto->m_myLocalHost[0]) {
- CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMString s = (CMString)TranslateT("<Local IP: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
@@ -1089,7 +1089,7 @@ void COtherPrefsDlg::OnPerform(CCtrlData*) void COtherPrefsDlg::OnAdd(CCtrlButton*)
{
- TCHAR* temp = m_pertormEdit.GetText();
+ wchar_t* temp = m_pertormEdit.GetText();
if (my_strstri(temp, L"/away"))
MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
@@ -1186,7 +1186,7 @@ void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName) /////////////////////////////////////////////////////////////////////////////////////////
// 'add ignore' preferences dialog
-CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner)
+CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const wchar_t* mask, CIgnorePrefsDlg* _owner)
: CProtoDlgBase<CIrcProto>(_pro, IDD_ADDIGNORE, false),
m_Ok(this, IDOK),
m_owner(_owner)
@@ -1196,7 +1196,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg if (mask == NULL)
szOldMask[0] = 0;
else
- _tcsncpy(szOldMask, mask, _countof(szOldMask));
+ wcsncpy(szOldMask, mask, _countof(szOldMask));
m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk);
}
@@ -1216,8 +1216,8 @@ void CAddIgnoreDlg::OnInitDialog() void CAddIgnoreDlg::OnOk(CCtrlButton*)
{
- TCHAR szMask[500];
- TCHAR szNetwork[500];
+ wchar_t szMask[500];
+ wchar_t szNetwork[500];
CMString flags;
if (IsDlgButtonChecked(m_hwnd, IDC_Q) == BST_CHECKED) flags += 'q';
if (IsDlgButtonChecked(m_hwnd, IDC_N) == BST_CHECKED) flags += 'n';
@@ -1231,7 +1231,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*) CMString Mask = GetWord(szMask, 0);
if (Mask.GetLength() != 0) {
- if (!_tcschr(Mask.c_str(), '!') && !_tcschr(Mask.c_str(), '@'))
+ if (!wcschr(Mask.c_str(), '!') && !wcschr(Mask.c_str(), '@'))
Mask += L"!*@*";
if (!flags.IsEmpty()) {
@@ -1265,8 +1265,8 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam if (!hwndDlg->GetHwnd())
return 1;
- TCHAR temp1[512];
- TCHAR temp2[512];
+ wchar_t temp1[512];
+ wchar_t temp2[512];
LVITEM lvm;
lvm.mask = LVIF_TEXT;
@@ -1315,9 +1315,9 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, void CIrcProto::InitIgnore(void)
{
- TCHAR szTemp[MAX_PATH];
+ wchar_t szTemp[MAX_PATH];
mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
- TCHAR *szLoadFileName = Utils_ReplaceVarsT(szTemp);
+ wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
if (pszIgnoreData != NULL) {
char *p1 = pszIgnoreData;
@@ -1347,7 +1347,7 @@ void CIrcProto::InitIgnore(void) RewriteIgnoreSettings();
delete[] pszIgnoreData;
- ::_tremove(szLoadFileName);
+ ::_wremove(szLoadFileName);
}
mir_free(szLoadFileName);
@@ -1432,7 +1432,7 @@ void CIgnorePrefsDlg::OnInitDialog() lvC.iSubItem = index;
lvC.cx = COLUMNS_SIZES[index];
- TCHAR* text = NULL;
+ wchar_t* text = NULL;
switch (index) {
case 0: text = TranslateT("Ignore mask"); break;
case 1: text = TranslateT("Flags"); break;
@@ -1492,9 +1492,9 @@ void CIgnorePrefsDlg::OnEdit(CCtrlButton*) if (!m_add.Enabled())
return;
- TCHAR szMask[512];
- TCHAR szFlags[512];
- TCHAR szNetwork[512];
+ wchar_t szMask[512];
+ wchar_t szFlags[512];
+ wchar_t szNetwork[512];
int i = m_list.GetSelectionMark();
m_list.GetItemText(i, 0, szMask, 511);
m_list.GetItemText(i, 1, szFlags, 511);
@@ -1504,17 +1504,17 @@ void CIgnorePrefsDlg::OnEdit(CCtrlButton*) HWND hWnd = dlg->GetHwnd();
SetWindowText(hWnd, TranslateT("Edit ignore"));
if (szFlags[0]) {
- if (_tcschr(szFlags, 'q'))
+ if (wcschr(szFlags, 'q'))
CheckDlgButton(hWnd, IDC_Q, BST_CHECKED);
- if (_tcschr(szFlags, 'n'))
+ if (wcschr(szFlags, 'n'))
CheckDlgButton(hWnd, IDC_N, BST_CHECKED);
- if (_tcschr(szFlags, 'i'))
+ if (wcschr(szFlags, 'i'))
CheckDlgButton(hWnd, IDC_I, BST_CHECKED);
- if (_tcschr(szFlags, 'd'))
+ if (wcschr(szFlags, 'd'))
CheckDlgButton(hWnd, IDC_D, BST_CHECKED);
- if (_tcschr(szFlags, 'c'))
+ if (wcschr(szFlags, 'c'))
CheckDlgButton(hWnd, IDC_C, BST_CHECKED);
- if (_tcschr(szFlags, 'm'))
+ if (wcschr(szFlags, 'm'))
CheckDlgButton(hWnd, IDC_M, BST_CHECKED);
}
SetDlgItemText(hWnd, IDC_MASK, szMask);
@@ -1529,7 +1529,7 @@ void CIgnorePrefsDlg::OnDelete(CCtrlButton*) if (!m_del.Enabled())
return;
- TCHAR szMask[512];
+ wchar_t szMask[512];
int i = m_list.GetSelectionMark();
m_list.GetItemText(i, 0, szMask, _countof(szMask));
m_proto->RemoveIgnore(szMask);
@@ -1558,7 +1558,7 @@ void CIgnorePrefsDlg::OnDestroy() int i = m_list.GetItemCount();
for (int j = 0; j < i; j++) {
- TCHAR szMask[512], szFlags[40], szNetwork[100];
+ wchar_t szMask[512], szFlags[40], szNetwork[100];
m_list.GetItemText(j, 0, szMask, _countof(szMask));
m_list.GetItemText(j, 1, szFlags, _countof(szFlags));
m_list.GetItemText(j, 2, szNetwork, _countof(szNetwork));
@@ -1595,17 +1595,17 @@ void CIgnorePrefsDlg::RebuildList() lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.lParam = lvItem.iItem;
- lvItem.pszText = (TCHAR*)C.mask.c_str();
+ lvItem.pszText = (wchar_t*)C.mask.c_str();
lvItem.iItem = m_list.InsertItem(&lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
- lvItem.pszText = (TCHAR*)C.flags.c_str();
+ lvItem.pszText = (wchar_t*)C.flags.c_str();
m_list.SetItem(&lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 2;
- lvItem.pszText = (TCHAR*)C.network.c_str();
+ lvItem.pszText = (wchar_t*)C.network.c_str();
m_list.SetItem(&lvItem);
}
@@ -1636,23 +1636,23 @@ void CIgnorePrefsDlg::UpdateList() int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = new CConnectPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("DCC and CTCP");
+ odp.pwszTab = LPGENW("DCC and CTCP");
odp.pDialog = new CCtcpPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Advanced");
+ odp.pwszTab = LPGENW("Advanced");
odp.pDialog = new COtherPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Ignore");
+ odp.pwszTab = LPGENW("Ignore");
odp.pDialog = new CIgnorePrefsDlg(this);
Options_AddPage(wParam, &odp);
return 0;
@@ -1782,7 +1782,7 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto> m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
+ wcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
@@ -1819,9 +1819,9 @@ INT_PTR CIrcProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Initialize servers list
-static void sttImportIni(const TCHAR* szIniFile)
+static void sttImportIni(const wchar_t* szIniFile)
{
- FILE* serverFile = _tfopen(szIniFile, L"r");
+ FILE* serverFile = _wfopen(szIniFile, L"r");
if (serverFile == NULL)
return;
@@ -1842,20 +1842,20 @@ static void sttImportIni(const TCHAR* szIniFile) db_set_s(NULL, SERVERSMODULE, buf2, p1);
}
fclose(serverFile);
- ::_tremove(szIniFile);
+ ::_wremove(szIniFile);
}
void InitServers()
{
- TCHAR *szTemp = Utils_ReplaceVarsT(L"%miranda_path%\\Plugins\\IRC_servers.ini");
+ wchar_t *szTemp = Utils_ReplaceVarsT(L"%miranda_path%\\Plugins\\IRC_servers.ini");
sttImportIni(szTemp);
mir_free(szTemp);
RereadServers();
if (g_servers.getCount() == 0) {
- TCHAR *szIniFile = Utils_ReplaceVarsT(L"%temp%\\default_servers.ini");
- FILE *serverFile = _tfopen(szIniFile, L"a");
+ wchar_t *szIniFile = Utils_ReplaceVarsT(L"%temp%\\default_servers.ini");
+ FILE *serverFile = _wfopen(szIniFile, L"a");
if (serverFile) {
char* pszSvrs = (char*)LockResource(LoadResource(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), L"TEXT")));
if (pszSvrs)
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index 8ff9d2a7b8..711b164e22 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -27,7 +27,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) if (pmsg->m_bIncoming) { // Is it an incoming message?
if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) {
- TCHAR temp[200]; *temp = '\0';
+ wchar_t temp[200]; *temp = '\0';
mir_sntprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
sMessage = temp;
for (int i = 0; i < (int)pmsg->parameters.getCount(); i++) {
@@ -39,7 +39,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) }
if (pmsg->sCommand == L"INVITE" && pmsg->parameters.getCount() > 1) {
- TCHAR temp[256]; *temp = '\0';
+ wchar_t temp[256]; *temp = '\0';
mir_sntprintf(temp, TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
@@ -50,9 +50,9 @@ static CMString FormatOutput(const CIrcMessage* pmsg) goto THE_END;
}
- int index = _ttoi(pmsg->sCommand.c_str());
+ int index = _wtoi(pmsg->sCommand.c_str());
if (index == 301 && pmsg->parameters.getCount() > 0) {
- TCHAR temp[500]; *temp = '\0';
+ wchar_t temp[500]; *temp = '\0';
mir_sntprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
@@ -80,7 +80,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) return pmsg->parameters[2] + L": " + pmsg->parameters[1];
}
else if (pmsg->sCommand == L"NOTICE" && pmsg->parameters.getCount() > 1) {
- TCHAR temp[500]; *temp = '\0';
+ wchar_t temp[500]; *temp = '\0';
int l = pmsg->parameters[1].GetLength();
if (l > 3 && pmsg->parameters[1][0] == 1 && pmsg->parameters[1][l - 1] == 1) {
@@ -136,13 +136,13 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg) if (!pmsg->m_bIncoming)
mess.Replace(L"%%", L"%");
- int iTemp = _ttoi(pmsg->sCommand.c_str());
+ int iTemp = _wtoi(pmsg->sCommand.c_str());
//To active window
if ((iTemp > 400 || iTemp < 500) && pmsg->sCommand[0] == '4' //all error messages
|| pmsg->sCommand == L"303" //ISON command
|| pmsg->sCommand == L"INVITE"
- || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (_tcsstr(pmsg->parameters[1].c_str(), L"\001") == NULL) : false)) // CTCP answers should go to m_network Log window!
+ || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (wcsstr(pmsg->parameters[1].c_str(), L"\001") == NULL) : false)) // CTCP answers should go to m_network Log window!
|| pmsg->sCommand == L"515") //chanserv error
{
DoEvent(GC_EVENT_INFORMATION, NULL, pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index ef968fb631..1620b46e24 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -26,7 +26,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) char* pszRaw = (char*)lParam;
if (m_scriptingEnabled && pszRaw && IsConnected()) {
- TCHAR* p = mir_a2t(pszRaw);
+ wchar_t* p = mir_a2t(pszRaw);
InsertIncomingEvent(p);
mir_free(p);
return 0;
@@ -83,17 +83,17 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) gchook->dwData = gch->dwData;
gchook->pDest->iType = gch->pDest->iType;
if (gch->ptszText)
- gchook->ptszText = _tcsdup(gch->ptszText);
+ gchook->ptszText = wcsdup(gch->ptszText);
else gchook->ptszText = NULL;
if (gch->ptszUID)
- gchook->ptszUID = _tcsdup(gch->ptszUID);
+ gchook->ptszUID = wcsdup(gch->ptszUID);
else
gchook->ptszUID = NULL;
if (gch->pDest->ptszID) {
CMString S = MakeWndID(gch->pDest->ptszID);
- gchook->pDest->ptszID = _tcsdup(S.c_str());
+ gchook->pDest->ptszID = wcsdup(S.c_str());
}
else gchook->pDest->ptszID = NULL;
@@ -117,7 +117,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) int i = sString.Find("|");
if (i != -1) {
sRequest = sString.Mid(0, i);
- TCHAR* p = mir_a2t(sString.Mid(i + 1));
+ wchar_t* p = mir_a2t(sString.Mid(i + 1));
sChannel = p;
mir_free(p);
}
@@ -148,7 +148,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- TCHAR szTemp[40];
+ wchar_t szTemp[40];
mir_sntprintf(szTemp, L"%u", gci.iCount);
sOutput = szTemp;
}
@@ -186,7 +186,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) }
if (!S.IsEmpty())
- sOutput = (TCHAR*)S.c_str();
+ sOutput = (wchar_t*)S.c_str();
}
// send it to mbot
if (!sOutput.IsEmpty())
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 559e3bf29d..2f7e814455 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -181,7 +181,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) CMessageBoxDlg* dlg = new CMessageBoxDlg(this, pdci);
dlg->Show();
HWND hWnd = dlg->GetHwnd();
- TCHAR szTemp[500];
+ wchar_t szTemp[500];
mir_sntprintf(szTemp, TranslateT("%s (%s) is requesting a client-to-client chat connection."),
pdci->sContactName.c_str(), pdci->sHostmask.c_str());
SetDlgItemText(hWnd, IDC_TEXT, szTemp);
@@ -389,12 +389,12 @@ INT_PTR __cdecl CIrcProto::OnChangeNickMenuCommand(WPARAM, LPARAM) return 0;
}
-static void DoChatFormatting(TCHAR* pszText)
+static void DoChatFormatting(wchar_t* pszText)
{
- TCHAR* p1 = pszText;
+ wchar_t* p1 = pszText;
int iFG = -1;
int iRemoveChars;
- TCHAR InsertThis[50];
+ wchar_t InsertThis[50];
while (*p1 != '\0') {
iRemoveChars = 0;
@@ -422,9 +422,9 @@ static void DoChatFormatting(TCHAR* pszText) mir_tstrcpy(InsertThis, L"\003");
iRemoveChars = 2;
- TCHAR szTemp[3];
+ wchar_t szTemp[3];
mir_tstrncpy(szTemp, p1 + 2, 3);
- iFG = _ttoi(szTemp);
+ iFG = _wtoi(szTemp);
}
break;
case 'C':
@@ -467,8 +467,8 @@ static void DoChatFormatting(TCHAR* pszText) break;
}
- memmove(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(mir_tstrlen(p1) - iRemoveChars + 1));
- memcpy(p1, InsertThis, sizeof(TCHAR)*mir_tstrlen(InsertThis));
+ memmove(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(wchar_t)*(mir_tstrlen(p1) - iRemoveChars + 1));
+ memcpy(p1, InsertThis, sizeof(wchar_t)*mir_tstrlen(InsertThis));
if (iRemoveChars || mir_tstrlen(InsertThis))
p1 += mir_tstrlen(InsertThis);
else
@@ -488,8 +488,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) // handle the hook
if (gch) {
if (!mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) {
- TCHAR *p1 = mir_tstrdup(gch->pDest->ptszID);
- TCHAR *p2 = _tcsstr(p1, L" - ");
+ wchar_t *p1 = mir_tstrdup(gch->pDest->ptszID);
+ wchar_t *p2 = wcsstr(p1, L" - ");
if (p2)
*p2 = '\0';
@@ -500,7 +500,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- TCHAR* pszText = new TCHAR[mir_tstrlen(gch->ptszText) + 1000];
+ wchar_t* pszText = new wchar_t[mir_tstrlen(gch->ptszText) + 1000];
mir_tstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
@@ -514,7 +514,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/QUERY %s", gch->ptszUID);
PostIrcMessageWnd(p1, NULL, szTemp);
}
@@ -566,7 +566,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\"");
SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
(LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
- SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0);
+ SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
SetFocus(hEditCtrl);
dlg->Activate();
}
@@ -727,8 +727,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = gch->ptszUID;
- psr.nick.t = gch->ptszUID;
+ psr.id.w = gch->ptszUID;
+ psr.nick.w = gch->ptszUID;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
@@ -759,74 +759,74 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
static gc_item logItems[] = {
- { LPGENT("&Change your nickname"), 1, MENU_ITEM, FALSE },
- { LPGENT("Channel &settings"), 2, MENU_ITEM, FALSE },
+ { LPGENW("&Change your nickname"), 1, MENU_ITEM, FALSE },
+ { LPGENW("Channel &settings"), 2, MENU_ITEM, FALSE },
{ L"", 0, MENU_SEPARATOR, FALSE },
- { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Register nick"), 5, MENU_POPUPITEM, TRUE },
- { LPGENT("Auth nick"), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("Delete nick"), 7, MENU_POPUPITEM, FALSE },
- { LPGENT("Identify nick"), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Remind password"), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("Set new password"), 10, MENU_POPUPITEM, TRUE },
- { LPGENT("Set language"), 11, MENU_POPUPITEM, FALSE },
- { LPGENT("Set homepage"), 12, MENU_POPUPITEM, FALSE },
- { LPGENT("Set e-mail"), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Set info"), 14, MENU_POPUPITEM, FALSE },
+ { LPGENW("NickServ"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Register nick"), 5, MENU_POPUPITEM, TRUE },
+ { LPGENW("Auth nick"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENW("Delete nick"), 7, MENU_POPUPITEM, FALSE },
+ { LPGENW("Identify nick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENW("Remind password"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set new password"), 10, MENU_POPUPITEM, TRUE },
+ { LPGENW("Set language"), 11, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set homepage"), 12, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set e-mail"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set info"), 14, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE },
+ { LPGENW("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Set security for nick"), 22, MENU_POPUPITEM, FALSE },
- { LPGENT("Remove security for nick"), 23, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set security for nick"), 22, MENU_POPUPITEM, FALSE },
+ { LPGENW("Remove security for nick"), 23, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Link nick to current"), 24, MENU_POPUPITEM, FALSE },
- { LPGENT("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE },
- { LPGENT("Set main nick"), 26, MENU_POPUPITEM, FALSE },
- { LPGENT("List all your nicks"), 27, MENU_POPUPITEM, FALSE },
- { LPGENT("List your channels"), 28, MENU_POPUPITEM, FALSE },
+ { LPGENW("Link nick to current"), 24, MENU_POPUPITEM, FALSE },
+ { LPGENW("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set main nick"), 26, MENU_POPUPITEM, FALSE },
+ { LPGENW("List all your nicks"), 27, MENU_POPUPITEM, FALSE },
+ { LPGENW("List your channels"), 28, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide nick from list"), 18, MENU_POPUPITEM, FALSE },
- { LPGENT("Show nick to list"), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Show the server &window"), 4, MENU_ITEM, FALSE },
+ { LPGENW("Hide nick from list"), 18, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show nick to list"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show the server &window"), 4, MENU_ITEM, FALSE },
{ L"", 0, MENU_SEPARATOR, FALSE },
- { LPGENT("&Leave the channel"), 3, MENU_ITEM, FALSE }
+ { LPGENW("&Leave the channel"), 3, MENU_ITEM, FALSE }
};
static gc_item nickItems[] = {
- { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
- { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE },
- { LPGENT("Send ¬ice"), 22, MENU_ITEM, FALSE },
- { LPGENT("&Slap"), 31, MENU_ITEM, FALSE },
- { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE },
- { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
- { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
- { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
- { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE },
- { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
- { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
+ { LPGENW("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
+ { LPGENW("&Invite to channel"), 23, MENU_ITEM, FALSE },
+ { LPGENW("Send ¬ice"), 22, MENU_ITEM, FALSE },
+ { LPGENW("&Slap"), 31, MENU_ITEM, FALSE },
+ { LPGENW("Nickserv info"), 32, MENU_ITEM, FALSE },
+ { LPGENW("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
+ { LPGENW("&Control"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
+ { LPGENW("Take Owner"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give Admin"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
+ { LPGENW("Give &Op"), 1, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take O&p"), 2, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
+ { LPGENW("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE },
- { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
- { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
- { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE },
+ { LPGENW("&Kick"), 5, MENU_POPUPITEM, FALSE },
+ { LPGENW("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENW("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
+ { LPGENW("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENW("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENW("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENW("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
+ { LPGENW("Add to &ignore list"), 15, MENU_ITEM, FALSE },
{ L"", 12, MENU_SEPARATOR, FALSE },
- { LPGENT("&Add User"), 30, MENU_ITEM, FALSE }
+ { LPGENW("&Add User"), 30, MENU_ITEM, FALSE }
};
int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
@@ -843,7 +843,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) }
if (gcmi->Type == MENU_ON_NICKLIST) {
- CONTACT user = { (TCHAR*)gcmi->pszUID, NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)gcmi->pszUID, NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
gcmi->nItems = _countof(nickItems);
@@ -858,8 +858,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; //DCC submenu
- TCHAR stzChanName[100];
- const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
+ wchar_t stzChanName[100];
+ const wchar_t* temp = wcschr(gcmi->pszID, ' ');
size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_tstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
@@ -1036,7 +1036,7 @@ void CIrcProto::ConnectToServer(void) si.sFullName = m_name;
si.sPassword = m_password;
si.bIdentServer = ((m_ident) ? (true) : (false));
- si.iIdentServerPort = _ttoi(m_identPort);
+ si.iIdentServerPort = _wtoi(m_identPort);
si.sIdentServerType = m_identSystem;
si.m_iSSL = m_iSSL;
si.sNetwork = m_network;
@@ -1055,7 +1055,7 @@ void CIrcProto::ConnectToServer(void) else if (m_bConnectRequested < 1)
InterlockedIncrement((long *)&m_bConnectRequested);
- TCHAR szTemp[300];
+ wchar_t szTemp[300];
mir_sntprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
TranslateT("Connecting to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
@@ -1080,7 +1080,7 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) if ((int)wParam != m_iStatus)
return 0;
- const TCHAR* p = m_statusMessage.c_str();
+ const wchar_t* p = m_statusMessage.c_str();
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(p) : (INT_PTR)mir_t2a(p);
}
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 2fa3ab877b..460b5a54f2 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -120,10 +120,10 @@ struct IPRESOLVE // Contains info about the channels struct CHANNELINFO // Contains info about the channels
{
- TCHAR* pszTopic;
- TCHAR* pszMode;
- TCHAR* pszPassword;
- TCHAR* pszLimit;
+ wchar_t* pszTopic;
+ wchar_t* pszMode;
+ wchar_t* pszPassword;
+ wchar_t* pszLimit;
BYTE OwnMode; /* own mode on the channel. Bitmask:
0: voice
1: halfop
@@ -143,7 +143,7 @@ struct SERVER_INFO // Contains info about different servers struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
{
- PERFORM_INFO( const char* szSetting, const TCHAR* value ) :
+ PERFORM_INFO( const char* szSetting, const wchar_t* value ) :
mSetting( szSetting ),
mText( value )
{}
@@ -157,9 +157,9 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks struct CONTACT // Contains info about users
{
- TCHAR* name;
- TCHAR* user;
- TCHAR* host;
+ wchar_t* name;
+ wchar_t* user;
+ wchar_t* host;
bool ExactOnly;
bool ExactWCOnly;
bool ExactNick;
@@ -174,7 +174,7 @@ struct TDbSetting union
{
int defValue;
- TCHAR* defStr;
+ wchar_t* defStr;
};
};
@@ -189,18 +189,18 @@ typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage* pmsg); struct CIrcHandler
{
- CIrcHandler( const TCHAR* _name, PfnIrcMessageHandler _handler ) :
+ CIrcHandler( const wchar_t* _name, PfnIrcMessageHandler _handler ) :
m_name( _name ),
m_handler( _handler )
{}
- const TCHAR* m_name;
+ const wchar_t* m_name;
PfnIrcMessageHandler m_handler;
};
struct CIrcProto : public PROTO<CIrcProto>
{
- CIrcProto(const char*, const TCHAR*);
+ CIrcProto(const char*, const wchar_t*);
~CIrcProto();
// Protocol interface
@@ -208,24 +208,24 @@ struct CIrcProto : public PROTO<CIrcProto> virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason);
- virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const TCHAR **szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
+ virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const wchar_t **szFilename);
virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
@@ -262,24 +262,24 @@ struct CIrcProto : public PROTO<CIrcProto> char m_serverName[100];
char m_password [500];
- TCHAR m_identSystem[10];
+ wchar_t m_identSystem[10];
char m_network[30];
char m_portStart[10];
char m_portEnd[10];
int m_iSSL;
- TCHAR m_identPort[10];
- TCHAR m_nick[30], m_pNick[30];
- TCHAR m_alternativeNick[30];
- TCHAR m_name[200];
- TCHAR m_userID[200];
- TCHAR m_quitMessage[400];
- TCHAR m_userInfo[500];
+ wchar_t m_identPort[10];
+ wchar_t m_nick[30], m_pNick[30];
+ wchar_t m_alternativeNick[30];
+ wchar_t m_name[200];
+ wchar_t m_userID[200];
+ wchar_t m_quitMessage[400];
+ wchar_t m_userInfo[500];
char m_myHost[50];
char m_mySpecifiedHost[500];
char m_mySpecifiedHostIP[50];
char m_myLocalHost[50];
WORD m_myLocalPort;
- TCHAR* m_alias;
+ wchar_t* m_alias;
int m_serverComboSelection;
int m_quickComboSelection;
int m_onlineNotificationTime;
@@ -368,27 +368,27 @@ struct CIrcProto : public PROTO<CIrcProto> //commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
- int AddOutgoingMessageToDB(MCONTACT hContact, TCHAR *msg);
+ int AddOutgoingMessageToDB(MCONTACT hContact, wchar_t *msg);
bool DoOnConnect(const CIrcMessage *pmsg);
int DoPerform(const char *event);
void __cdecl ResolveIPThread(void *di);
- bool AddIgnore(const TCHAR *mask, const TCHAR *mode, const TCHAR *network) ;
+ bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network) ;
int IsIgnored(const CMString &nick, const CMString &address, const CMString &host, char type) ;
int IsIgnored(CMString user, char type);
- bool RemoveIgnore(const TCHAR *mask) ;
+ bool RemoveIgnore(const wchar_t *mask) ;
//input.cpp
- CMString DoAlias( const TCHAR *text, TCHAR *window);
- BOOL DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hContact);
- CMString DoIdentifiers(CMString text, const TCHAR *window);
+ CMString DoAlias( const wchar_t *text, wchar_t *window);
+ BOOL DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact);
+ CMString DoIdentifiers(CMString text, const wchar_t *window);
void FormatMsg(CMString &text);
- bool PostIrcMessageWnd(TCHAR *pszWindow, MCONTACT hContact, const TCHAR *szBuf);
- bool PostIrcMessage(const TCHAR *fmt, ...);
+ bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
+ bool PostIrcMessage(const wchar_t *fmt, ...);
// irclib.cpp
UINT_PTR DCCTimer;
- void SendIrcMessage(const TCHAR*, bool bNotify = true, int codepage = -1);
+ void SendIrcMessage(const wchar_t*, bool bNotify = true, int codepage = -1);
// ircproto.cpp
void __cdecl AckBasicSearch(void* param);
@@ -439,16 +439,16 @@ struct CIrcProto : public PROTO<CIrcProto> void __cdecl DisconnectServerThread( void* );
//tools.cpp
- void AddToJTemp(TCHAR op, CMString& sCommand);
- bool AddWindowItemData(CMString window, const TCHAR* pszLimit, const TCHAR* pszMode, const TCHAR* pszPassword, const TCHAR* pszTopic);
+ void AddToJTemp(wchar_t op, CMString& sCommand);
+ bool AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic);
INT_PTR CallChatEvent(WPARAM wParam, LPARAM lParam);
- INT_PTR DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick, const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
+ INT_PTR DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick, const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
void FindLocalIP(HANDLE con);
bool FreeWindowItemData(CMString window, CHANNELINFO* wis);
bool IsChannel(const char* sName);
- bool IsChannel(const TCHAR* sName);
+ bool IsChannel(const wchar_t* sName);
void KillChatTimer(UINT_PTR &nIDEvent);
- CMString MakeWndID(const TCHAR* sWindow);
+ CMString MakeWndID(const wchar_t* sWindow);
CMString ModeToStatus(int sMode);
CMString PrefixToStatus(int cPrefix);
int SetChannelSBText(CMString sWindow, CHANNELINFO * wi);
@@ -473,7 +473,7 @@ struct CIrcProto : public PROTO<CIrcProto> CDccSession* FindDCCSession(MCONTACT hContact);
CDccSession* FindDCCSession(DCCINFO* pdci);
CDccSession* FindDCCSendByPort(int iPort);
- CDccSession* FindDCCRecvByPortAndName(int iPort, const TCHAR* szName);
+ CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName);
CDccSession* FindPassiveDCCSend(int iToken);
CDccSession* FindPassiveDCCRecv(CMString sName, CMString sToken);
@@ -484,12 +484,12 @@ struct CIrcProto : public PROTO<CIrcProto> void Disconnect(void);
void KillIdent(void);
- int NLSend(const TCHAR* fmt, ...);
+ int NLSend(const wchar_t* fmt, ...);
int NLSend(const char* fmt, ...);
int NLSend(const unsigned char* buf, int cbBuf);
int NLSendNoScript( const unsigned char* buf, int cbBuf);
int NLReceive(unsigned char* buf, int cbBuf);
- void InsertIncomingEvent(TCHAR* pszRaw);
+ void InsertIncomingEvent(wchar_t* pszRaw);
__inline bool IsConnected() const { return con != NULL; }
@@ -572,7 +572,7 @@ private : static OBJLIST<CIrcHandler> m_handlers;
- PfnIrcMessageHandler FindMethod(const TCHAR* lpszName);
+ PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
void OnIrcMessage(const CIrcMessage* pmsg);
CMString sNick4Perform;
@@ -581,7 +581,7 @@ private : // map actual member functions to their associated IRC command.
// put any number of this macro in the class's constructor.
#define IRC_MAP_ENTRY(name, member) \
- m_handlers.insert( new CIrcHandler( _T(name), &CIrcProto::OnIrc_##member ));
+ m_handlers.insert( new CIrcHandler( L##name, &CIrcProto::OnIrc_##member ));
/////////////////////////////////////////////////////////////////////////////////////////
// Functions
@@ -617,13 +617,13 @@ HICON LoadIconEx(int iIndex, bool big = false); HANDLE GetIconHandle(int iconId);
//tools.cpp
-int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string);
-char* __stdcall IrcLoadFile(TCHAR * szPath);
-CMString __stdcall GetWord(const TCHAR* text, int index);
-const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index);
+int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
+char* __stdcall IrcLoadFile(wchar_t * szPath);
+CMString __stdcall GetWord(const wchar_t* text, int index);
+const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
void __stdcall RemoveLinebreaks( CMString& Message );
-TCHAR* __stdcall my_strstri(const TCHAR *s1, const TCHAR *s2) ;
-TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent);
+wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2) ;
+wchar_t* __stdcall DoColorCodes (const wchar_t* text, bool bStrip, bool bReplacePercent);
CMStringA __stdcall GetWord(const char* text, int index);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index cfae12a301..6a2af3446e 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
+void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand)
{
CMString res;
@@ -49,20 +49,20 @@ void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand) setTString("JTemp", res.c_str());
}
-CMString __stdcall GetWord(const TCHAR* text, int index)
+CMString __stdcall GetWord(const wchar_t* text, int index)
{
if (text && *text) {
- TCHAR* p1 = (TCHAR*)text;
- TCHAR* p2 = NULL;
+ wchar_t* p1 = (wchar_t*)text;
+ wchar_t* p2 = NULL;
while (*p1 == ' ')
p1++;
if (*p1 != '\0') {
for (int i = 0; i < index; i++) {
- p2 = _tcschr(p1, ' ');
+ p2 = wcschr(p1, ' ');
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
else
while (*p2 == ' ')
p2++;
@@ -70,9 +70,9 @@ CMString __stdcall GetWord(const TCHAR* text, int index) p1 = p2;
}
- p2 = _tcschr(p1, ' ');
+ p2 = wcschr(p1, ' ');
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
if (p1 != p2)
return CMString(p1, p2 - p1);
@@ -82,12 +82,12 @@ CMString __stdcall GetWord(const TCHAR* text, int index) return CMString();
}
-const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
+const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index)
{
if (!text || !mir_tstrlen(text))
return text;
- const TCHAR* temp = text;
+ const wchar_t* temp = text;
while (*temp == ' ')
temp++;
@@ -96,9 +96,9 @@ const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index) return temp;
for (int i = 0; i < index; i++) {
- temp = _tcschr(temp, ' ');
+ temp = wcschr(temp, ' ');
if (!temp)
- temp = (TCHAR*)_tcschr(text, '\0');
+ temp = (wchar_t*)wcschr(text, '\0');
else
while (*temp == ' ')
temp++;
@@ -120,11 +120,11 @@ void __stdcall RemoveLinebreaks(CMString &Message) Message.Delete(Message.GetLength() - 2, 2);
}
-char* __stdcall IrcLoadFile(TCHAR* szPath)
+char* __stdcall IrcLoadFile(wchar_t* szPath)
{
char * szContainer = NULL;
DWORD dwSiz = 0;
- FILE *hFile = _tfopen(szPath, L"rb");
+ FILE *hFile = _wfopen(szPath, L"rb");
if (hFile != NULL) {
fseek(hFile, 0, SEEK_END); // seek to end
dwSiz = ftell(hFile); // size
@@ -139,12 +139,12 @@ char* __stdcall IrcLoadFile(TCHAR* szPath) return 0;
}
-int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
+int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string)
{
if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
return 1;
- const TCHAR *cp = NULL, *mp = NULL;
+ const wchar_t *cp = NULL, *mp = NULL;
while ((*string) && (*wild != '*')) {
if ((*wild != *string) && (*wild != '?'))
return 0;
@@ -177,7 +177,7 @@ int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string) return !*wild;
}
-bool CIrcProto::IsChannel(const TCHAR* sName)
+bool CIrcProto::IsChannel(const wchar_t* sName)
{
return (sChannelPrefixes.Find(sName[0]) != -1);
}
@@ -220,21 +220,21 @@ bool CIrcProto::IsChannel(const char* sName) return (sChannelPrefixes.Find(sName[0]) != -1);
}
-TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2)
+wchar_t* __stdcall my_strstri(const wchar_t* s1, const wchar_t* s2)
{
int i, j, k;
for (i = 0; s1[i]; i++)
- for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ for (j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++)
if (!s2[k + 1])
- return (TCHAR*)(s1 + i);
+ return (wchar_t*)(s1 + i);
return NULL;
}
-TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePercent)
+wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent)
{
- static TCHAR szTemp[4000]; szTemp[0] = '\0';
- TCHAR* p = szTemp;
+ static wchar_t szTemp[4000]; szTemp[0] = '\0';
+ wchar_t* p = szTemp;
bool bBold = false;
bool bUnderline = false;
bool bItalics = false;
@@ -305,7 +305,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce break;
}
else { // some colors should be set... need to find out who
- TCHAR buf[3];
+ wchar_t buf[3];
// fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
@@ -313,7 +313,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce else
mir_tstrncpy(buf, text, 2);
text += mir_tstrlen(buf);
- iFG = _ttoi(buf);
+ iFG = _wtoi(buf);
// fix background color
if (*text == ',' && text[1] > 47 && text[1] < 58 && text[1] != '\0') {
@@ -324,7 +324,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce else
mir_tstrncpy(buf, text, 2);
text += mir_tstrlen(buf);
- iBG = _ttoi(buf);
+ iBG = _wtoi(buf);
}
}
@@ -337,7 +337,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce // create tag for chat.dll
if (!bStrip) {
- TCHAR buf[10];
+ wchar_t buf[10];
if (iFG >= 0 && iFG != 99) {
*p++ = '%';
*p++ = 'c';
@@ -381,8 +381,8 @@ INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, LPARAM lParam) return CallServiceSync(MS_GC_EVENT, wParam, (LPARAM)lParam);
}
-INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick,
- const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo,
+INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick,
+ const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
GCDEST gcd = { m_szModuleName, NULL, iEvent };
@@ -404,7 +404,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszN sID = pszWindow + (CMString)L" - " + m_info.sNetwork;
else
sID = pszWindow;
- gcd.ptszID = (TCHAR*)sID.c_str();
+ gcd.ptszID = (wchar_t*)sID.c_str();
}
else gcd.ptszID = NULL;
@@ -454,7 +454,7 @@ CMString CIrcProto::ModeToStatus(int sMode) CMString CIrcProto::PrefixToStatus(int cPrefix)
{
- const TCHAR* p = _tcschr(sUserModePrefixes.c_str(), cPrefix);
+ const wchar_t* p = wcschr(sUserModePrefixes.c_str(), cPrefix);
if (p) {
int index = int(p - sUserModePrefixes.c_str());
return ModeToStatus(sUserModes[index]);
@@ -545,9 +545,9 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi) return DoEvent(GC_EVENT_SETSBTEXT, sWindow.c_str(), NULL, sTemp.c_str(), NULL, NULL, NULL, FALSE, FALSE, 0);
}
-CMString CIrcProto::MakeWndID(const TCHAR* sWindow)
+CMString CIrcProto::MakeWndID(const wchar_t* sWindow)
{
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
return CMString(buf);
}
@@ -570,24 +570,24 @@ bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis) return false;
}
-bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const TCHAR* pszMode, const TCHAR* pszPassword, const TCHAR* pszTopic)
+bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic)
{
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(mir_tstrlen(pszLimit) + 1));
+ wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_tstrlen(pszLimit) + 1));
mir_tstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(mir_tstrlen(pszMode) + 1));
+ wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_tstrlen(pszMode) + 1));
mir_tstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(mir_tstrlen(pszPassword) + 1));
+ wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_tstrlen(pszPassword) + 1));
mir_tstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(mir_tstrlen(pszTopic) + 1));
+ wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_tstrlen(pszTopic) + 1));
mir_tstrcpy(wi->pszTopic, pszTopic);
}
@@ -612,7 +612,7 @@ void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...)
{
- TCHAR temp[4096];
+ wchar_t temp[4096];
CMString S = L"";
switch (type) {
case 1:
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index dd557e25d1..6237ceaa31 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -35,10 +35,10 @@ struct UserDetailsDlgProcParam MCONTACT hContact;
};
-#define STR_BASIC LPGEN("Faster! Searches the network for an exact match of the nickname only. The hostmask is optional and provides further security if used. Wildcards (? and *) are allowed.")
-#define STR_ADVANCED LPGEN("Slower! Searches the network for nicknames matching a wildcard string. The hostmask is mandatory and a minimum of 4 characters is necessary in the \"Nick\" field. Wildcards (? and *) are allowed.")
-#define STR_ERROR LPGEN("Settings could not be saved!\n\nThe \"Nick\" field must contain at least four characters including wildcards,\n and it must also match the default nickname for this contact.")
-#define STR_ERROR2 LPGEN("Settings could not be saved!\n\nA full hostmask must be set for this online detection mode to work.")
+const wchar_t *STR_BASIC = LPGENW("Faster! Searches the network for an exact match of the nickname only. The hostmask is optional and provides further security if used. Wildcards (? and *) are allowed.");
+const wchar_t *STR_ADVANCED = LPGENW("Slower! Searches the network for nicknames matching a wildcard string. The hostmask is mandatory and a minimum of 4 characters is necessary in the \"Nick\" field. Wildcards (? and *) are allowed.");
+const wchar_t *STR_ERROR = LPGENW("Settings could not be saved!\n\nThe \"Nick\" field must contain at least four characters including wildcards,\n and it must also match the default nickname for this contact.");
+const wchar_t *STR_ERROR2 = LPGENW("Settings could not be saved!\n\nA full hostmask must be set for this online detection mode to work.");
INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -63,14 +63,14 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), bAdvanced);
if (!bAdvanced) {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC));
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
}
else {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED));
if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
@@ -99,7 +99,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON2), true);
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON) {
- TCHAR temp[500];
+ wchar_t temp[500];
GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
BYTE bAdvanced = IsDlgButtonChecked(m_hwnd, IDC_RADIO1) ? 0 : 1;
@@ -107,13 +107,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_WILDCARD)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_USER)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HOST)) == 0) {
- MessageBox(NULL, TranslateT(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(NULL, TranslateTS(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return FALSE;
}
DBVARIANT dbv;
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
- CMString S = _T(STR_ERROR);
+ CMString S = STR_ERROR;
S += L" (";
S += dbv.ptszVal;
S += L")";
@@ -162,7 +162,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM }
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO1) {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC));
DBVARIANT dbv;
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
@@ -174,7 +174,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO2) {
DBVARIANT dbv;
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED));
if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index e41020e7d1..de14672a0a 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -109,21 +109,21 @@ void CWhoisDlg::OnDestroy() void CWhoisDlg::OnGo(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/WHOIS %s %s", szTemp, szTemp);
}
void CWhoisDlg::OnQuery(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/QUERY %s", szTemp);
}
void CWhoisDlg::OnPing(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(0));
@@ -131,7 +131,7 @@ void CWhoisDlg::OnPing(CCtrlButton*) void CWhoisDlg::OnUserInfo(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001USERINFO\001", szTemp);
@@ -139,7 +139,7 @@ void CWhoisDlg::OnUserInfo(CCtrlButton*) void CWhoisDlg::OnTime(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001TIME\001", szTemp);
@@ -147,7 +147,7 @@ void CWhoisDlg::OnTime(CCtrlButton*) void CWhoisDlg::OnVersion(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", szTemp);
@@ -228,7 +228,7 @@ void CNickDlg::OnDestroy() void CNickDlg::OnOk(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_Enick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/NICK %s", szTemp);
@@ -269,7 +269,7 @@ void CListDlg::OnInitDialog() SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0);
LVCOLUMN lvC;
int COLUMNS_SIZES[4] = { 200, 50, 50, 2000 };
- TCHAR szBuffer[32];
+ wchar_t szBuffer[32];
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.fmt = LVCFMT_LEFT;
@@ -302,8 +302,8 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ::KillTimer(m_hwnd, m_timer); m_timer = 0;
// Retrieve the input text
- TCHAR strFilterText[255];
- TCHAR newTitle[255];
+ wchar_t strFilterText[255];
+ wchar_t newTitle[255];
m_filter.GetText(strFilterText, _countof(strFilterText));
if (strFilterText[0]) {
@@ -316,7 +316,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_list2.DeleteAllItems();
LVITEM lvm;
- TCHAR text[255];
+ wchar_t text[255];
lvm.pszText = text; // Set buffer for texts
lvm.cchTextMax = _countof(text);
lvm.mask = LVIF_TEXT;
@@ -326,12 +326,12 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_list.GetItem(&lvm);
// Match the text?
- TCHAR* t = _tcsstr(lvm.pszText, strFilterText);
+ wchar_t* t = wcsstr(lvm.pszText, strFilterText);
if (t == NULL) { // If no, then Check if in the topics
m_list.GetItem(&lvm);
// Match the text?
- t = _tcsstr(lvm.pszText, strFilterText);
+ t = wcsstr(lvm.pszText, strFilterText);
}
if (t) {
@@ -416,8 +416,8 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo if (!param->pList->GetHwnd())
return 0;
- TCHAR temp1[512];
- TCHAR temp2[512];
+ wchar_t temp1[512];
+ wchar_t temp2[512];
LVITEM lvm;
lvm.mask = LVIF_TEXT;
lvm.iItem = lParam1;
@@ -435,7 +435,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo return (*temp1 == 0) ? 1 : -1;
}
- return (_ttoi(temp1) < _ttoi(temp2)) ? 1 : -1;
+ return (_wtoi(temp1) < _wtoi(temp2)) ? 1 : -1;
}
int CListDlg::Resizer(UTILRESIZECONTROL *urc)
@@ -463,7 +463,7 @@ void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo *ev) void CListDlg::OnJoin(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_filter.GetText(szTemp, _countof(szTemp));
if (szTemp[0])
@@ -523,7 +523,7 @@ void CJoinDlg::OnDestroy() void CJoinDlg::OnOk(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, _countof(szTemp));
if (m_proto->IsChannel(szTemp))
m_proto->PostIrcMessage(L"/JOIN %s", szTemp);
@@ -631,7 +631,7 @@ void CQuickDlg::OnOk(CCtrlButton*) m_proto->m_iSSL = pData->m_iSSL;
}
- TCHAR windowname[20];
+ wchar_t windowname[20];
GetWindowText(m_hwnd, windowname, _countof(windowname));
if (mir_tstrcmpi(windowname, L"Miranda IRC") == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
@@ -727,22 +727,22 @@ void CQuestionDlg::OnOk(CCtrlButton*) {
int i = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_EDIT));
if (i > 0) {
- TCHAR* l = new TCHAR[i + 2];
+ wchar_t* l = new wchar_t[i + 2];
GetDlgItemText(m_hwnd, IDC_EDIT, l, i + 1);
int j = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HIDDENEDIT));
- TCHAR *m = new TCHAR[j + 2];
+ wchar_t *m = new wchar_t[j + 2];
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, m, j + 1);
- TCHAR *text = _tcsstr(m, L"%question");
- TCHAR *p1 = text;
- TCHAR *p2 = NULL;
+ wchar_t *text = wcsstr(m, L"%question");
+ wchar_t *p1 = text;
+ wchar_t *p2 = NULL;
if (p1) {
p1 += 9;
if (*p1 == '=' && p1[1] == '\"') {
p1 += 2;
for (int k = 0; k < 3; k++) {
- p2 = _tcschr(p1, '\"');
+ p2 = wcschr(p1, '\"');
if (p2) {
p2++;
if (k == 2 || (*p2 != ',' || (*p2 == ',' && p2[1] != '\"')))
@@ -756,7 +756,7 @@ void CQuestionDlg::OnOk(CCtrlButton*) else *p1 = '\0';
}
- CMString S(_T('\0'), j + 2);
+ CMString S('\0', j + 2);
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1);
S.Replace(text, l);
m_proto->PostIrcMessageWnd(NULL, NULL, S);
@@ -907,10 +907,10 @@ void CManagerDlg::OnClose() }
}
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CMString S = L"";
- TCHAR temp[1000];
+ wchar_t temp[1000];
for (int i = 0; i < 5; i++) {
if (m_topic.SendMsg(CB_GETLBTEXT, i, (LPARAM)temp) != LB_ERR) {
CMString S1 = temp;
@@ -939,8 +939,8 @@ void CManagerDlg::OnDestroy() void CManagerDlg::OnAdd(CCtrlButton*)
{
- TCHAR temp[100];
- TCHAR mode[3];
+ wchar_t temp[100];
+ wchar_t mode[3];
if (m_radio1.GetState()) {
mir_tstrcpy(mode, L"+b");
mir_tstrncpy(temp, TranslateT("Add ban"), 100);
@@ -964,8 +964,8 @@ void CManagerDlg::OnAdd(CCtrlButton*) SetDlgItemText(addban_hWnd, IDC_CAPTION, temp);
SetDlgItemText(addban_hWnd, IDC_TEXT, TranslateT("Please enter the hostmask (nick!user@host)"));
- TCHAR temp2[450];
- TCHAR window[256];
+ wchar_t temp2[450];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
mir_sntprintf(temp2, L"/MODE %s %s %s", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
@@ -977,12 +977,12 @@ void CManagerDlg::OnEdit(CCtrlButton*) if (BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_NOTOP)) {
int i = m_list.GetCurSel();
if (i != LB_ERR) {
- TCHAR* m = m_list.GetItemText(i);
+ wchar_t* m = m_list.GetItemText(i);
CMString user = GetWord(m, 0);
mir_free(m);
- TCHAR temp[100];
- TCHAR mode[3];
+ wchar_t temp[100];
+ wchar_t mode[3];
if (m_radio1.GetState()) {
mir_tstrcpy(mode, L"b");
mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
@@ -1007,8 +1007,8 @@ void CManagerDlg::OnEdit(CCtrlButton*) m_edit.Disable();
m_remove.Disable();
- TCHAR temp2[450];
- TCHAR window[256];
+ wchar_t temp2[450];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
mir_sntprintf(temp2, L"/MODE %s -%s %s%s/MODE %s +%s %s", window, mode, user.c_str(), L"%newl", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
@@ -1025,8 +1025,8 @@ void CManagerDlg::OnRemove(CCtrlButton*) m_edit.Disable();
m_remove.Disable();
- TCHAR temp[100], mode[3];
- TCHAR* m = m_list.GetItemText(i, temp, _countof(temp));
+ wchar_t temp[100], mode[3];
+ wchar_t* m = m_list.GetItemText(i, temp, _countof(temp));
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
@@ -1042,7 +1042,7 @@ void CManagerDlg::OnRemove(CCtrlButton*) mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
}
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
if (MessageBox(m_hwnd, user.c_str(), temp, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
m_proto->PostIrcMessage(L"/MODE %s %s %s", window, mode, user.c_str());
@@ -1077,57 +1077,57 @@ void CManagerDlg::OnChangeTopic(CCtrlData*) void CManagerDlg::OnApplyModes(CCtrlButton*)
{
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
- TCHAR toadd[10]; *toadd = '\0';
- TCHAR toremove[10]; *toremove = '\0';
+ wchar_t toadd[10]; *toadd = '\0';
+ wchar_t toremove[10]; *toremove = '\0';
CMString appendixadd = L"";
CMString appendixremove = L"";
- if (wi->pszMode && _tcschr(wi->pszMode, 't')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
mir_tstrcat(toremove, L"t");
}
else if (m_check1.GetState())
mir_tstrcat(toadd, L"t");
- if (wi->pszMode && _tcschr(wi->pszMode, 'n')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
mir_tstrcat(toremove, L"n");
}
else if (m_check2.GetState())
mir_tstrcat(toadd, L"n");
- if (wi->pszMode && _tcschr(wi->pszMode, 'i')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
mir_tstrcat(toremove, L"i");
}
else if (m_check3.GetState())
mir_tstrcat(toadd, L"i");
- if (wi->pszMode && _tcschr(wi->pszMode, 'm')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
mir_tstrcat(toremove, L"m");
}
else if (m_check4.GetState())
mir_tstrcat(toadd, L"m");
- if (wi->pszMode && _tcschr(wi->pszMode, 'p')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
mir_tstrcat(toremove, L"p");
}
else if (m_check7.GetState())
mir_tstrcat(toadd, L"p");
- if (wi->pszMode && _tcschr(wi->pszMode, 's')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
mir_tstrcat(toremove, L"s");
}
else if (m_check8.GetState())
mir_tstrcat(toadd, L"s");
- if (wi->pszMode && _tcschr(wi->pszMode, 'c')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
mir_tstrcat(toremove, L"c");
}
@@ -1136,13 +1136,13 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) CMString Key = L"";
CMString Limit = L"";
- if (wi->pszMode && wi->pszPassword && _tcschr(wi->pszMode, 'k')) {
+ if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
mir_tstrcat(toremove, L"k");
appendixremove += L" " + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
- TCHAR temp[400];
+ wchar_t temp[400];
m_key.GetText(temp, 14);
if (Key != temp) {
@@ -1157,16 +1157,16 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) mir_tstrcat(toadd, L"k");
appendixadd += L" ";
- TCHAR temp[400];
+ wchar_t temp[400];
m_key.GetText(temp, _countof(temp));
appendixadd += temp;
}
- if (_tcschr(wi->pszMode, 'l')) {
+ if (wcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
mir_tstrcat(toremove, L"l");
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
- TCHAR temp[15];
+ wchar_t temp[15];
GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
if (wi->pszLimit && mir_tstrcmpi(wi->pszLimit, temp)) {
mir_tstrcat(toadd, L"l");
@@ -1178,13 +1178,13 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) mir_tstrcat(toadd, L"l");
appendixadd += L" ";
- TCHAR temp[15];
+ wchar_t temp[15];
m_limit.GetText(temp, _countof(temp));
appendixadd += temp;
}
if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
- TCHAR temp[500];
+ wchar_t temp[500];
mir_tstrcpy(temp, L"/mode ");
mir_tstrcat(temp, window);
mir_tstrcat(temp, L" ");
@@ -1205,8 +1205,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) void CManagerDlg::OnApplyTopic(CCtrlButton*)
{
- TCHAR temp[470];
- TCHAR window[256];
+ wchar_t temp[470];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
m_topic.GetText(temp, _countof(temp));
m_proto->PostIrcMessage(L"/TOPIC %s %s", window, temp);
@@ -1242,10 +1242,10 @@ void CManagerDlg::OnRadio(CCtrlData*) void CManagerDlg::ApplyQuestion()
{
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- TCHAR mode[3];
+ wchar_t mode[3];
mir_tstrcpy(mode, L"+b");
if (m_radio2.GetState())
mir_tstrcpy(mode, L"+I");
@@ -1270,14 +1270,14 @@ void CManagerDlg::CloseQuestion() }
}
-void CManagerDlg::InitManager(int mode, const TCHAR* window)
+void CManagerDlg::InitManager(int mode, const wchar_t* window)
{
SetDlgItemText(m_hwnd, IDC_CAPTION, window);
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (m_proto->IsConnected()) {
- TCHAR temp[1000];
+ wchar_t temp[1000];
mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
char* p = mir_t2a(temp);
@@ -1306,7 +1306,7 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window) m_add.Enable();
bool add = false;
- TCHAR* p1 = wi->pszMode;
+ wchar_t* p1 = wi->pszMode;
if (p1) {
while (*p1 != '\0' && *p1 != ' ') {
if (*p1 == '+')
diff --git a/protocols/IcqOscarJ/src/cookies.h b/protocols/IcqOscarJ/src/cookies.h index 843cc404ad..37f85c214c 100644 --- a/protocols/IcqOscarJ/src/cookies.h +++ b/protocols/IcqOscarJ/src/cookies.h @@ -109,7 +109,7 @@ struct cookie_avatar size_t hashlen;
BYTE *hash;
size_t cbData;
- TCHAR *szFile;
+ wchar_t *szFile;
};
struct cookie_reverse_connect : public cookie_message_data
diff --git a/protocols/IcqOscarJ/src/db.cpp b/protocols/IcqOscarJ/src/db.cpp index b241e970ec..8cc0736bc0 100644 --- a/protocols/IcqOscarJ/src/db.cpp +++ b/protocols/IcqOscarJ/src/db.cpp @@ -83,7 +83,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) }
char buf[MAX_PATH];
- TCHAR tbuf[MAX_PATH];
+ wchar_t tbuf[MAX_PATH];
if (utf8_to_tchar_static(GetItemSettingText(i, buf, _countof(buf)), tbuf, _countof(tbuf)))
ListView_SetItemText(hwndList, i, 1, tbuf);
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index d6cb25f816..9a99841d22 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -201,7 +201,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM LV_ITEM lvi = { 0 };
lvi.mask = LVIF_PARAM | LVIF_TEXT;
for (lvi.iItem = 0; lvi.iItem < settingCount; lvi.iItem++) {
- TCHAR text[MAX_PATH];
+ wchar_t text[MAX_PATH];
lvi.lParam = lvi.iItem;
lvi.pszText = text;
utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, _countof(text));
@@ -464,7 +464,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dat->hUpload[i] = NULL;
for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
- TCHAR buf[MAX_PATH];
+ wchar_t buf[MAX_PATH];
mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
SetDlgItemText(hwndDlg, IDC_UPLOADING, buf);
if (done < _countof(dat->hUpload)) break;
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp index df0840385a..90b24c5daa 100644 --- a/protocols/IcqOscarJ/src/editlist.cpp +++ b/protocols/IcqOscarJ/src/editlist.cpp @@ -174,7 +174,7 @@ void ChangeInfoData::EndListEdit(int save) if (sid.changed) {
char buf[MAX_PATH];
- TCHAR tbuf[MAX_PATH];
+ wchar_t tbuf[MAX_PATH];
if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, _countof(buf)), tbuf, _countof(buf)))
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp index 94b41836ee..0db3f3db60 100644 --- a/protocols/IcqOscarJ/src/editstring.cpp +++ b/protocols/IcqOscarJ/src/editstring.cpp @@ -323,7 +323,7 @@ void ChangeInfoData::EndStringEdit(int save) }
if (sid.changed) {
- TCHAR tbuf[MAX_PATH];
+ wchar_t tbuf[MAX_PATH];
GetWindowText(hwndEdit, tbuf, _countof(tbuf));
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 25610a5bf7..faec561278 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -405,7 +405,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade if (m_bAvatarsEnabled && !info->bMyAvatarInited) { // signal the server after login
// this refreshes avatar state - it used to work automatically, but now it does not
if (getByte("ForceOurAvatar", 0)) { // keep our avatar
- TCHAR *file = GetOwnAvatarFileName();
+ wchar_t *file = GetOwnAvatarFileName();
SetMyAvatar(0, (LPARAM)file);
SAFE_FREE(&file);
}
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 36b3abd116..4a86609b9e 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -692,7 +692,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) {
setStatusMsgVar(hContact, szStatusNote, false);
- TCHAR *tszNote = mir_utf8decodeT(szStatusNote);
+ wchar_t *tszNote = mir_utf8decodeT(szStatusNote);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
mir_free(tszNote);
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index da09e845dd..104c7c8652 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -948,8 +948,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c contacts[iContact] = (ICQSEARCHRESULT*)SAFE_MALLOC(sizeof(ICQSEARCHRESULT));
contacts[iContact]->hdr.cbSize = sizeof(ICQSEARCHRESULT);
contacts[iContact]->hdr.flags = PSR_TCHAR;
- contacts[iContact]->hdr.nick.t = null_strdup(L"");
- contacts[iContact]->hdr.id.t = ansi_to_tchar(szUid);
+ contacts[iContact]->hdr.nick.w = null_strdup(L"");
+ contacts[iContact]->hdr.id.w = ansi_to_tchar(szUid);
if (IsStringUIN(szUid)) { // icq contact
contacts[iContact]->uin = atoi(szUid);
@@ -976,8 +976,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c debugLogA("Malformed '%s' message", "contacts");
disposeChain(&chain);
for (int i = 0; i < iContact; i++) {
- SAFE_FREE(&contacts[i]->hdr.id.t);
- SAFE_FREE(&contacts[i]->hdr.nick.t);
+ SAFE_FREE(&contacts[i]->hdr.id.w);
+ SAFE_FREE(&contacts[i]->hdr.nick.w);
SAFE_FREE((void**)&contacts[i]);
}
SAFE_FREE((void**)&contacts);
@@ -1015,8 +1015,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c unpackTypedTLV(pBuffer, wNickLen, 0x01, &wNickTLV, &wNickTLVLen, (LPBYTE*)&pNick);
if (wNickTLV == 0x01) {
- SAFE_FREE(&contacts[iContact]->hdr.nick.t);
- contacts[iContact]->hdr.nick.t = utf8_to_tchar(pNick);
+ SAFE_FREE(&contacts[iContact]->hdr.nick.w);
+ contacts[iContact]->hdr.nick.w = utf8_to_tchar(pNick);
}
else
SAFE_FREE(&pNick);
@@ -1051,8 +1051,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c }
for (int i = 0; i < iContact; i++) {
- SAFE_FREE(&contacts[i]->hdr.id.t);
- SAFE_FREE(&contacts[i]->hdr.nick.t);
+ SAFE_FREE(&contacts[i]->hdr.id.w);
+ SAFE_FREE(&contacts[i]->hdr.nick.w);
SAFE_FREE((void**)&contacts[i]);
}
SAFE_FREE((void**)&contacts);
@@ -1692,8 +1692,8 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if (!mir_strlen(pszMsgField[1 + i * 2]))
valid = 0;
}
- isrList[i]->hdr.id.t = ansi_to_tchar(pszMsgField[1 + i * 2]);
- isrList[i]->hdr.nick.t = ansi_to_tchar(pszMsgField[2 + i * 2]);
+ isrList[i]->hdr.id.w = ansi_to_tchar(pszMsgField[1 + i * 2]);
+ isrList[i]->hdr.nick.w = ansi_to_tchar(pszMsgField[2 + i * 2]);
}
if (!valid)
@@ -1710,8 +1710,8 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, }
for (int i = 0; i < nContacts; i++) {
- SAFE_FREE(&isrList[i]->hdr.id.t);
- SAFE_FREE(&isrList[i]->hdr.nick.t);
+ SAFE_FREE(&isrList[i]->hdr.id.w);
+ SAFE_FREE(&isrList[i]->hdr.nick.w);
SAFE_FREE((void**)&isrList[i]);
}
}
diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index 49a18401a1..bb37764957 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -93,26 +93,26 @@ void CIcqProto::handleLookupEmailReply(BYTE* buf, size_t wLen, DWORD dwCookie) sr.hdr.cbSize = sizeof(sr);
sr.hdr.flags = PSR_TCHAR;
- sr.hdr.email.t = ansi_to_tchar(pCookie->szObject);
+ sr.hdr.email.w = ansi_to_tchar(pCookie->szObject);
// Syntax check, read chain
if (wLen >= 4 && (pChain = readIntoTLVChain(&buf, wLen, 0))) {
for (WORD i = 1; TRUE; i++) { // collect the results
char *szUid = pChain->getString(0x01, i);
if (!szUid) break;
- sr.hdr.id.t = ansi_to_tchar(szUid);
- sr.hdr.nick.t = sr.hdr.id.t;
+ sr.hdr.id.w = ansi_to_tchar(szUid);
+ sr.hdr.nick.w = sr.hdr.id.w;
// broadcast the result
if (pCookie->dwMainId)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)pCookie->dwMainId, (LPARAM)&sr);
else
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)dwCookie, (LPARAM)&sr);
- SAFE_FREE(&sr.hdr.id.t);
+ SAFE_FREE(&sr.hdr.id.w);
SAFE_FREE(&szUid);
}
disposeChain(&pChain);
}
- SAFE_FREE(&sr.hdr.email.t);
+ SAFE_FREE(&sr.hdr.email.w);
ReleaseLookupCookie(dwCookie, pCookie);
}
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 654bfa7f2e..b3b5a981d8 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -340,7 +340,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO wPacketLen -= 4;
sr.uin = dwUin;
_itoa(dwUin, szUin, 10);
- sr.hdr.id.t = (TCHAR*)szUin;
+ sr.hdr.id.w = (wchar_t*)szUin;
// Nick
if (wPacketLen < 2)
@@ -350,11 +350,11 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.nick.t = (TCHAR*)databuf;
+ sr.hdr.nick.w = (wchar_t*)databuf;
databuf += wLen;
}
else {
- sr.hdr.nick.t = NULL;
+ sr.hdr.nick.w = NULL;
}
// First name
@@ -365,10 +365,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.firstName.t = (TCHAR*)databuf;
+ sr.hdr.firstName.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.firstName.t = NULL;
+ else sr.hdr.firstName.w = NULL;
// Last name
if (wPacketLen < 2)
@@ -378,10 +378,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.lastName.t = (TCHAR*)databuf;
+ sr.hdr.lastName.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.lastName.t = NULL;
+ else sr.hdr.lastName.w = NULL;
// E-mail name
if (wPacketLen < 2)
@@ -391,10 +391,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.email.t = (TCHAR*)databuf;
+ sr.hdr.email.w = (wchar_t*)databuf;
databuf += wLen;
}
- else sr.hdr.email.t = NULL;
+ else sr.hdr.email.w = NULL;
// Authentication needed flag
if (wPacketLen < 1)
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 130f8796c7..3d03ed6f43 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -54,28 +54,28 @@ avatars_request::~avatars_request() }
}
-TCHAR* CIcqProto::GetOwnAvatarFileName()
+wchar_t* CIcqProto::GetOwnAvatarFileName()
{
DBVARIANT dbvFile = {DBVT_DELETED};
if (getTString(NULL, "AvatarFile", &dbvFile))
return NULL;
- TCHAR tmp[MAX_PATH * 2];
+ wchar_t tmp[MAX_PATH * 2];
PathToAbsoluteT(dbvFile.ptszVal, tmp);
db_free(&dbvFile);
return null_strdup(tmp);
}
-void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat, TCHAR *pszDest, size_t cbLen)
+void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat, wchar_t *pszDest, size_t cbLen)
{
GetAvatarFileName(dwUin, szUid, pszDest, cbLen);
AddAvatarExt(dwFormat, pszDest);
}
-void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, size_t cbLen)
+void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest, size_t cbLen)
{
- TCHAR szPath[MAX_PATH * 2];
+ wchar_t szPath[MAX_PATH * 2];
mir_sntprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName);
FOLDERSGETDATA fgd = { sizeof(fgd) };
@@ -91,18 +91,18 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, CreateDirectoryTreeT(szPath);
if (dwUin != 0)
- _ltot(dwUin, pszDest + tPathLen, 10);
+ _ltow(dwUin, pszDest + tPathLen, 10);
else if (szUid) {
- TCHAR* p = mir_a2t(szUid);
+ wchar_t* p = mir_a2t(szUid);
mir_tstrcpy(pszDest + tPathLen, p);
mir_free(p);
}
else {
- TCHAR szBuf[MAX_PATH];
+ wchar_t szBuf[MAX_PATH];
if (CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)szBuf))
mir_tstrcpy(pszDest + tPathLen, L"avatar");
else {
- TCHAR *szLastDot = _tcsrchr(szBuf, '.');
+ wchar_t *szLastDot = wcsrchr(szBuf, '.');
if (szLastDot)
szLastDot[0] = '\0';
@@ -112,15 +112,15 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, }
}
-void AddAvatarExt(int dwFormat, TCHAR *pszDest)
+void AddAvatarExt(int dwFormat, wchar_t *pszDest)
{
- const TCHAR *ext = ProtoGetAvatarExtension(dwFormat);
+ const wchar_t *ext = ProtoGetAvatarExtension(dwFormat);
mir_tstrcat(pszDest, (*ext == 0) ? L".dat" : ext);
}
#define MD5_BLOCK_SIZE 1024*1024 /* use 1MB blocks */
-BYTE* calcMD5HashOfFile(const TCHAR *tszFile)
+BYTE* calcMD5HashOfFile(const wchar_t *tszFile)
{
BYTE *res = NULL;
@@ -244,11 +244,11 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) setUserInfo();
{
// here we need to find a file, check its hash, if invalid get avatar from server
- TCHAR *file = GetOwnAvatarFileName();
+ wchar_t *file = GetOwnAvatarFileName();
if (!file) { // we have no avatar file, download from server
debugLogA("We have no avatar, requesting from server.");
- TCHAR szFile[MAX_PATH * 2 + 4];
+ wchar_t szFile[MAX_PATH * 2 + 4];
GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
}
@@ -258,7 +258,7 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) if (!hash) { // hash could not be calculated - probably missing file, get avatar from server
debugLogA("We have no avatar, requesting from server.");
- TCHAR szFile[MAX_PATH * 2 + 4];
+ wchar_t szFile[MAX_PATH * 2 + 4];
GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
}
@@ -280,7 +280,7 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) else { // get avatar from server
debugLogA("We have different avatar, requesting new from server.");
- TCHAR tszFile[MAX_PATH * 2 + 4];
+ wchar_t tszFile[MAX_PATH * 2 + 4];
GetAvatarFileName(0, NULL, tszFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, tszFile);
}
@@ -295,7 +295,7 @@ void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) case 0x81:
// request to re-upload avatar data
if (m_bSsiEnabled) { // we could not change serv-list if it is disabled...
- TCHAR *file = GetOwnAvatarFileName();
+ wchar_t *file = GetOwnAvatarFileName();
if (!file) { // we have no file to upload, remove hash from server
debugLogA("We do not have avatar, removing hash.");
SetMyAvatar(0, 0);
@@ -414,7 +414,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont if (avatarType != -1) { // check settings, should we request avatar immediatelly?
DBVARIANT dbv = { DBVT_DELETED };
- TCHAR tszAvatar[MAX_PATH * 2 + 4];
+ wchar_t tszAvatar[MAX_PATH * 2 + 4];
BYTE bAutoLoad = getByte("AvatarsAutoLoad", DEFAULT_LOAD_AVATARS);
if ((avatarType == AVATAR_HASH_STATIC || avatarType == AVATAR_HASH_MINI) && cbAvatarHash == 0x09 && !memcmp(pAvatarHash + 4, hashEmptyAvatar + 4, 0x05)) { // empty avatar - unlink image, clear hash
@@ -437,7 +437,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont int dwPaFormat = getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN);
GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszAvatar, MAX_PATH * 2);
- if (_taccess(tszAvatar, 0) == 0) { // the file is there, link to contactphoto, save hash
+ if (_waccess(tszAvatar, 0) == 0) { // the file is there, link to contactphoto, save hash
debugLogA("%s has published Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
setSettingBlob(hContact, "AvatarHash", pAvatarHash, cbAvatarHash);
@@ -470,7 +470,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont }
else {
GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszAvatar, MAX_PATH * 2);
- if (_taccess(tszAvatar, 0) != 0) { // the file was lost, get it again
+ if (_waccess(tszAvatar, 0) != 0) { // the file was lost, get it again
debugLogA("%s has Avatar. Image is missing.", strUID(dwUIN, szUID));
bJob = 2;
}
@@ -523,7 +523,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont }
// request avatar data from server
-int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const TCHAR *file)
+int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file)
{
uid_str szUidData;
char *pszUid = NULL;
@@ -725,7 +725,7 @@ void avatars_server_connection::shutdownConnection() Netlib_Shutdown(hConnection);
}
-DWORD avatars_server_connection::sendGetAvatarRequest(MCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, size_t hashlen, const TCHAR *file)
+DWORD avatars_server_connection::sendGetAvatarRequest(MCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file)
{
int i;
DWORD dwNow = GetTickCount();
@@ -1209,22 +1209,22 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen if (aValid) {
ppro->debugLogA("Received user avatar, storing (%d bytes).", datalen);
- const TCHAR *ptszExt;
+ const wchar_t *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
- TCHAR tszImageFile[MAX_PATH];
+ wchar_t tszImageFile[MAX_PATH];
mir_sntprintf(tszImageFile, L"%s%s", pCookieData->szFile, ptszExt);
ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat);
ai.format = dwPaFormat; // set the format
mir_tstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
- int out = _topen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
+ int out = _wopen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
if (out != -1) {
_write(out, pBuffer, (int)datalen);
_close(out);
if (!pCookieData->hContact) { // our avatar, set filename
- TCHAR tmp[MAX_PATH * 2];
+ wchar_t tmp[MAX_PATH * 2];
PathToRelativeT(tszImageFile, tmp);
ppro->setTString(NULL, "AvatarFile", tmp);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index 5ba1e03c79..d0346b229b 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -84,7 +84,7 @@ public: __inline BOOL isPending() { return !isLoggedIn; };
__inline BOOL isReady() { return isLoggedIn && isActive && !stopThread; };
- DWORD sendGetAvatarRequest(MCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, size_t hashlen, const TCHAR *file);
+ DWORD sendGetAvatarRequest(MCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file);
DWORD sendUploadAvatarRequest(MCONTACT hContact, WORD wRef, const BYTE *data, size_t datalen);
};
@@ -96,7 +96,7 @@ struct avatars_request : public MZeroedObject uid_str szUid;
BYTE *hash;
size_t hashlen;
- TCHAR *szFile;
+ wchar_t *szFile;
BYTE *pData;
size_t cbData;
WORD wRef;
@@ -111,8 +111,8 @@ public: #define ART_UPLOAD 2
#define ART_BLOCK 4
-void AddAvatarExt(int dwFormat, TCHAR *pszDest);
+void AddAvatarExt(int dwFormat, wchar_t *pszDest);
-BYTE* calcMD5HashOfFile(const TCHAR *szFile);
+BYTE* calcMD5HashOfFile(const wchar_t *szFile);
#endif /* __ICQ_AVATAR_H */
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index 6dd10110d6..e993445c08 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -152,18 +152,18 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD ft->bEmptyDesc = bEmptyDesc;
// Send chain event
- TCHAR* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = mir_utf8decodeT(pszDescription);
- pre.files.t = &ptszFileName;
+ pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
- mir_free(pre.descr.t);
+ mir_free(pre.descr.w);
mir_free(ptszFileName);
}
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 36c1c1bfb0..a767d5987a 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -29,12 +29,12 @@ extern BOOL bPopupService;
-static const TCHAR* szLogLevelDescr[] = {
- LPGENT("Display all problems"),
- LPGENT("Display problems causing possible loss of data"),
- LPGENT("Display explanations for disconnection"),
- LPGENT("Display problems requiring user intervention"),
- LPGENT("Do not display any problems (not recommended)")
+static const wchar_t* szLogLevelDescr[] = {
+ LPGENW("Display all problems"),
+ LPGENW("Display problems causing possible loss of data"),
+ LPGENW("Display explanations for disconnection"),
+ LPGENW("Display problems requiring user intervention"),
+ LPGENW("Do not display any problems (not recommended)")
};
static void LoadDBCheckState(CIcqProto* ppro, HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef)
@@ -511,27 +511,27 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -800000000;
odp.hInstance = hInst;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszGroup = LPGENW("Network");
odp.dwInitParam = LPARAM(this);
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQ);
odp.pfnDlgProc = DlgProcIcqOpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Contacts");
+ odp.pwszTab = LPGENW("Contacts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQCONTACTS);
odp.pfnDlgProc = DlgProcIcqContactsOpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Features");
+ odp.pwszTab = LPGENW("Features");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQFEATURES);
odp.pfnDlgProc = DlgProcIcqFeaturesOpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Privacy");
+ odp.pwszTab = LPGENW("Privacy");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICQPRIVACY);
odp.pfnDlgProc = DlgProcIcqPrivacyOpts;
Options_AddPage(wParam, &odp);
@@ -541,8 +541,8 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
odp.groupPosition = 900000000;
odp.pfnDlgProc = DlgProcIcqPopupOpts;
- odp.ptszGroup = LPGENT("Popups");
- odp.ptszTab = NULL;
+ odp.pwszGroup = LPGENW("Popups");
+ odp.pwszTab = NULL;
Options_AddPage(wParam, &odp);
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 12694a3763..7843f50a10 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -70,7 +70,7 @@ static int CompareContactsCache(const icq_contacts_cache *p1, const icq_contacts return mir_strcmpi(p1->szUid, p2->szUid);
}
-CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) :
+CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) :
PROTO<CIcqProto>(aProtoName, aUserName),
cookies(10, CompareCookies),
directConns(10, CompareConns),
@@ -157,7 +157,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) : // Register netlib users
NETLIBUSER nlu = { 0 };
- TCHAR szBuffer[MAX_PATH + 64];
+ wchar_t szBuffer[MAX_PATH + 64];
mir_sntprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName);
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -292,17 +292,17 @@ MCONTACT CIcqProto::AddToList(int flags, PROTOSEARCHRESULT *psr) // aim contact
if (isr->hdr.flags & PSR_UNICODE)
- unicode_to_ansi_static((WCHAR*)isr->hdr.id.t, szUid, MAX_PATH);
+ unicode_to_ansi_static((WCHAR*)isr->hdr.id.w, szUid, MAX_PATH);
else
- null_strcpy(szUid, (char*)isr->hdr.id.t, MAX_PATH);
+ null_strcpy(szUid, (char*)isr->hdr.id.w, MAX_PATH);
return (szUid[0] == 0) ? 0 : AddToListByUID(szUid, flags);
}
if (psr->flags & PSR_UNICODE)
- unicode_to_ansi_static((WCHAR*)psr->id.t, szUid, MAX_PATH);
+ unicode_to_ansi_static((WCHAR*)psr->id.w, szUid, MAX_PATH);
else
- null_strcpy(szUid, (char*)psr->id.t, MAX_PATH);
+ null_strcpy(szUid, (char*)psr->id.w, MAX_PATH);
if (szUid[0] == 0)
return 0;
@@ -400,7 +400,7 @@ int CIcqProto::Authorize(MEVENT hDbEvent) ////////////////////////////////////////////////////////////////////////////////////////
// PS_AuthDeny - handles the unsuccessful authorization
-int CIcqProto::AuthDeny(MEVENT hDbEvent, const TCHAR* szReason)
+int CIcqProto::AuthDeny(MEVENT hDbEvent, const wchar_t* szReason)
{
if (icqOnline() && hDbEvent) {
MCONTACT hContact = HContactFromAuthEvent(hDbEvent);
@@ -437,7 +437,7 @@ int __cdecl CIcqProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT* pre) ////////////////////////////////////////////////////////////////////////////////////////
// PSS_AUTHREQUEST
-int __cdecl CIcqProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
+int __cdecl CIcqProto::AuthRequest(MCONTACT hContact, const wchar_t* szMessage)
{
if (!icqOnline())
return 1;
@@ -463,7 +463,7 @@ int __cdecl CIcqProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage) ////////////////////////////////////////////////////////////////////////////////////////
// PS_FileAllow - starts a file transfer
-HANDLE __cdecl CIcqProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE __cdecl CIcqProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath)
{
DWORD dwUin;
uid_str szUid;
@@ -533,7 +533,7 @@ int __cdecl CIcqProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// PS_FileDeny - denies a file transfer
-int __cdecl CIcqProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason)
+int __cdecl CIcqProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason)
{
int nReturnValue = 1;
basic_filetransfer *bft = (basic_filetransfer*)hTransfer;
@@ -573,7 +573,7 @@ int __cdecl CIcqProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR ////////////////////////////////////////////////////////////////////////////////////////
// PS_FileResume - processes file renaming etc
-int __cdecl CIcqProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CIcqProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
if (icqOnline() && hTransfer) {
basic_filetransfer *ft = (basic_filetransfer *)hTransfer;
@@ -720,10 +720,10 @@ void CIcqProto::CheekySearchThread(void*) if (cheekySearchUin) {
_itoa(cheekySearchUin, szUin, 10);
- isr.hdr.id.t = (TCHAR*)szUin;
+ isr.hdr.id.w = (wchar_t*)szUin;
}
else {
- isr.hdr.id.t = (TCHAR*)cheekySearchUid;
+ isr.hdr.id.w = (wchar_t*)cheekySearchUid;
}
isr.uin = cheekySearchUin;
@@ -733,7 +733,7 @@ void CIcqProto::CheekySearchThread(void*) }
-HANDLE __cdecl CIcqProto::SearchBasic(const TCHAR *pszSearch)
+HANDLE __cdecl CIcqProto::SearchBasic(const wchar_t *pszSearch)
{
if (mir_wstrlen(pszSearch) == 0)
return 0;
@@ -791,7 +791,7 @@ HANDLE __cdecl CIcqProto::SearchBasic(const TCHAR *pszSearch) ////////////////////////////////////////////////////////////////////////////////////////
// SearchByEmail - searches the contact by its e-mail
-HANDLE __cdecl CIcqProto::SearchByEmail(const TCHAR *email)
+HANDLE __cdecl CIcqProto::SearchByEmail(const wchar_t *email)
{
if (email && icqOnline() && mir_wstrlen(email) > 0) {
char *szEmail = tchar_to_ansi(email);
@@ -814,7 +814,7 @@ HANDLE __cdecl CIcqProto::SearchByEmail(const TCHAR *email) ////////////////////////////////////////////////////////////////////////////////////////
// PS_SearchByName - searches the contact by its first or last name, or by a nickname
-HANDLE __cdecl CIcqProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
+HANDLE __cdecl CIcqProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName)
{
if (icqOnline()) {
if (nick || firstName || lastName) {
@@ -873,15 +873,15 @@ int __cdecl CIcqProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) DWORD flags = DBEF_UTF;
for (i = 0; i < pre->lParam; i++) {
- cbBlob += mir_strlen((char*)isrList[i]->hdr.nick.t) + 2; // both trailing zeros
+ cbBlob += mir_strlen((char*)isrList[i]->hdr.nick.w) + 2; // both trailing zeros
if (isrList[i]->uin)
cbBlob += getUINLen(isrList[i]->uin);
else
- cbBlob += mir_strlen((char*)isrList[i]->hdr.id.t);
+ cbBlob += mir_strlen((char*)isrList[i]->hdr.id.w);
}
PBYTE pBlob = (PBYTE)_alloca(cbBlob), pCurBlob;
for (i = 0, pCurBlob = pBlob; i < pre->lParam; i++) {
- mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.nick.t);
+ mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.nick.w);
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
if (isrList[i]->uin) {
char szUin[UINMAXLEN];
@@ -889,7 +889,7 @@ int __cdecl CIcqProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) mir_strcpy((char*)pCurBlob, szUin);
}
else // aim contact
- mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.id.t);
+ mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.id.w);
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
}
@@ -1157,7 +1157,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
if (!icqOnline())
return 0;
@@ -1191,7 +1191,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription for (i = 0; i < (int)ft->dwFileCount; i++) {
ft->pszFiles[i] = (ppszFiles[i]) ? tchar_to_utf8(ppszFiles[i]) : NULL;
- if (_tstat(ppszFiles[i], &statbuf))
+ if (_wstat(ppszFiles[i], &statbuf))
debugLogA("IcqSendFile() was passed invalid filename(s)");
else
ft->dwTotalSize += statbuf.st_size;
@@ -1644,7 +1644,7 @@ void __cdecl CIcqProto::GetAwayMsgThread(void *pStatusData) setStatusMsgVar(pThreadData->hContact, pThreadData->szMessage, false);
- TCHAR *tszMsg = mir_utf8decodeT(pThreadData->szMessage);
+ wchar_t *tszMsg = mir_utf8decodeT(pThreadData->szMessage);
ProtoBroadcastAck(pThreadData->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, pThreadData->hProcess, (LPARAM)tszMsg);
mir_free(tszMsg);
@@ -1743,7 +1743,7 @@ int __cdecl CIcqProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* evt) {
setStatusMsgVar(hContact, evt->szMessage, false);
- TCHAR* pszMsg = mir_utf8decodeT(evt->szMessage);
+ wchar_t* pszMsg = mir_utf8decodeT(evt->szMessage);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)pszMsg);
mir_free(pszMsg);
return 0;
@@ -1753,7 +1753,7 @@ int __cdecl CIcqProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* evt) ////////////////////////////////////////////////////////////////////////////////////////
// PS_SetAwayMsg - sets the away status message
-int __cdecl CIcqProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CIcqProto::SetAwayMsg(int status, const wchar_t* msg)
{
mir_cslock l(m_modeMsgsMutex);
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 97ca496006..3c5da05d35 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -47,7 +47,7 @@ struct userinfo struct CIcqProto : public PROTO<CIcqProto>
{
- CIcqProto(const char*, const TCHAR*);
+ CIcqProto(const char*, const wchar_t*);
~CIcqProto();
//====================================================================================
@@ -58,21 +58,21 @@ struct CIcqProto : public PROTO<CIcqProto> virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason);
- virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const TCHAR **szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
+ virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const wchar_t **szFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR *email);
- virtual HANDLE __cdecl SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t *email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
@@ -80,7 +80,7 @@ struct CIcqProto : public PROTO<CIcqProto> virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg);
virtual int __cdecl SendUrl(MCONTACT hContact, int flags, const char *url);
@@ -89,7 +89,7 @@ struct CIcqProto : public PROTO<CIcqProto> virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT *evt);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -392,12 +392,12 @@ struct CIcqProto : public PROTO<CIcqProto> void handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen);
void handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *pHash, size_t nHashLen);
- TCHAR* GetOwnAvatarFileName();
- void GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat, TCHAR *pszDest, size_t cbLen);
- void GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, size_t cbLen);
+ wchar_t* GetOwnAvatarFileName();
+ void GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat, wchar_t *pszDest, size_t cbLen);
+ void GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest, size_t cbLen);
int IsAvatarChanged(MCONTACT hContact, const BYTE *pHash, size_t nHashLen);
- int GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const TCHAR *file);
+ int GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file);
int SetAvatarData(MCONTACT hContact, WORD wRef, const BYTE *data, size_t datalen);
void StartAvatarThread(HANDLE hConn, char* cookie, size_t cookieLen);
@@ -715,7 +715,7 @@ struct CIcqProto : public PROTO<CIcqProto> void icq_sendRevokeAuthServ(DWORD dwUin, char *szUid);
void icq_sendGrantAuthServ(DWORD dwUin, const char *szUid, const char *szMsg);
void icq_sendAuthReqServ(DWORD dwUin, char* szUid, const char *szMsg);
- void icq_sendAuthResponseServ(DWORD dwUin, char* szUid,int auth,const TCHAR *szReason);
+ void icq_sendAuthResponseServ(DWORD dwUin, char* szUid,int auth,const wchar_t *szReason);
void icq_sendYouWereAddedServ(DWORD,DWORD);
DWORD sendDirectorySearchPacket(const BYTE *pSearchData, size_t wDataLen, WORD wPage, BOOL bOnlineUsersOnly);
@@ -823,11 +823,11 @@ struct CIcqProto : public PROTO<CIcqProto> void handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand);
void handleRecvServResponseOFT(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, void* ft);
- HANDLE oftInitTransfer(MCONTACT hContact, DWORD dwUin, char *szUid, const TCHAR **pszFiles, const TCHAR *szDescription);
- HANDLE oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath);
- DWORD oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason);
+ HANDLE oftInitTransfer(MCONTACT hContact, DWORD dwUin, char *szUid, const wchar_t **pszFiles, const wchar_t *szDescription);
+ HANDLE oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
+ DWORD oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
DWORD oftFileCancel(MCONTACT hContact, HANDLE hTransfer);
- void oftFileResume(oscar_filetransfer *ft, int action, const TCHAR *szFilename);
+ void oftFileResume(oscar_filetransfer *ft, int action, const wchar_t *szFilename);
void sendOscarPacket(oscar_connection *oc, icq_packet *packet);
void handleOFT2FramePacket(oscar_connection *oc, WORD datatype, BYTE *pBuffer, size_t wLen);
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 0769d7b69c..4c91d239ac 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -1377,11 +1377,11 @@ int CIcqProto::getCListGroupExists(const char *szGroup) return 0;
size_t size = mir_strlen(szGroup) + 2;
- TCHAR *tszGroup = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *tszGroup = (wchar_t*)_alloca(size * sizeof(wchar_t));
if (utf8_to_tchar_static(szGroup, tszGroup, size))
for (int i = 1; TRUE; i++) {
- TCHAR *tszGroupName = (TCHAR*)Clist_GroupGetName(i, NULL);
+ wchar_t *tszGroupName = (wchar_t*)Clist_GroupGetName(i, NULL);
if (!tszGroupName)
break;
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index fa1dbf5f52..b99b17b95e 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -826,7 +826,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX;
- cii.pszText = TranslateT(LPGEN("** All contacts **"));
+ cii.pszText = TranslateT("** All contacts **");
hItemAll = (HANDLE)SendMessage(hClist, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 3168d290ec..ecc192ac4d 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -120,9 +120,9 @@ DWORD CIcqProto::requestXStatusDetails(MCONTACT hContact, BOOL bAllowDelay) return -1; // delayed
}
-static HANDLE LoadXStatusIconLibrary(TCHAR *path, const TCHAR *sub)
+static HANDLE LoadXStatusIconLibrary(wchar_t *path, const wchar_t *sub)
{
- TCHAR* p = _tcsrchr(path, '\\');
+ wchar_t* p = wcsrchr(path, '\\');
HANDLE hLib;
mir_tstrcpy(p, sub);
@@ -137,9 +137,9 @@ static HANDLE LoadXStatusIconLibrary(TCHAR *path, const TCHAR *sub) return hLib;
}
-static TCHAR* InitXStatusIconLibrary(TCHAR *buf, size_t buf_size)
+static wchar_t* InitXStatusIconLibrary(wchar_t *buf, size_t buf_size)
{
- TCHAR path[2 * MAX_PATH];
+ wchar_t path[2 * MAX_PATH];
HMODULE hXStatusIconsDLL;
// get miranda's exe path
@@ -851,12 +851,12 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) HGENMENU hRoot;
{
- TCHAR szItem[MAX_PATH + 64];
+ wchar_t szItem[MAX_PATH + 64];
mir_sntprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
- mi.name.t = szItem;
+ mi.name.w = szItem;
mi.position = 10001;
hRoot = Menu_AddStatusMenuItem(&mi, m_szModuleName);
}
@@ -889,12 +889,12 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) void InitXStatusIcons()
{
- TCHAR lib[2 * MAX_PATH] = { 0 };
+ wchar_t lib[2 * MAX_PATH] = { 0 };
SKINICONDESC sid = { 0 };
sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/" LPGEN("Custom Status");
sid.flags = SIDF_PATH_TCHAR;
- sid.defaultFile.t = InitXStatusIconLibrary(lib, _countof(lib));
+ sid.defaultFile.w = InitXStatusIconLibrary(lib, _countof(lib));
for (int i = 0; i < XSTATUS_COUNT; i++) {
char szTemp[100];
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 268904a0a1..a2c40d3b83 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -66,7 +66,7 @@ static int LookupDatabaseSetting(const FieldNamesItem* table, int code, DBVARIAN }
else if (type == DBVT_WCHAR) {
WCHAR* wtext = make_unicode_string(text);
- dbv->pwszVal = mir_wstrdup(TranslateW(wtext));
+ dbv->pwszVal = mir_wstrdup(TranslateTS(wtext));
dbv->type = DBVT_WCHAR;
SAFE_FREE((void**)&wtext);
}
@@ -348,7 +348,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) int dwPaFormat = getByte(pai->hContact, "AvatarType", PA_FORMAT_UNKNOWN);
if (dwPaFormat != PA_FORMAT_UNKNOWN) { // we know the format, test file
- TCHAR tszFile[MAX_PATH * 2 + 4];
+ wchar_t tszFile[MAX_PATH * 2 + 4];
GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2);
@@ -356,7 +356,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) pai->format = dwPaFormat;
if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same
- if (_taccess(tszFile, 0) == 0) {
+ if (_waccess(tszFile, 0) == 0) {
db_free(&dbv);
return GAIR_SUCCESS; // we have found the avatar file, whoala
@@ -366,7 +366,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // we didn't received the avatar before - this ensures we will not request avatar again and again
if ((wParam & GAIF_FORCE) != 0 && pai->hContact != 0) { // request avatar data
- TCHAR tszFile[MAX_PATH * 2 + 4];
+ wchar_t tszFile[MAX_PATH * 2 + 4];
GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2);
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
@@ -389,9 +389,9 @@ INT_PTR CIcqProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (!wParam) return -3;
- TCHAR *tszFile = GetOwnAvatarFileName();
- if (tszFile && !_taccess(tszFile, 0)) {
- _tcsncpy((TCHAR*)wParam, tszFile, (int)lParam);
+ wchar_t *tszFile = GetOwnAvatarFileName();
+ if (tszFile && !_waccess(tszFile, 0)) {
+ wcsncpy((wchar_t*)wParam, tszFile, (int)lParam);
SAFE_FREE(&tszFile);
return 0;
}
@@ -485,7 +485,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) if (!m_bAvatarsEnabled || !m_bSsiEnabled)
return -2;
- TCHAR *tszFile = (TCHAR*)lParam;
+ wchar_t *tszFile = (wchar_t*)lParam;
if (tszFile) { // set file for avatar
int dwPaFormat = ::ProtoGetAvatarFileFormat(tszFile);
if (dwPaFormat != PA_FORMAT_XML) {
@@ -497,7 +497,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) DeleteObject(avt);
}
- TCHAR tszMyFile[MAX_PATH + 1];
+ wchar_t tszMyFile[MAX_PATH + 1];
GetFullAvatarFileName(0, NULL, dwPaFormat, tszMyFile, MAX_PATH);
// if not in our storage, copy
@@ -522,7 +522,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) if (setSettingBlob(NULL, "AvatarHash", ihash, 0x14))
debugLogA("Failed to save avatar hash.");
- TCHAR tmp[MAX_PATH];
+ wchar_t tmp[MAX_PATH];
PathToRelativeT(tszMyFile, tmp);
setTString(NULL, "AvatarFile", tmp);
SAFE_FREE((void**)&hash);
@@ -668,7 +668,7 @@ INT_PTR icq_getEventTextMissedMessage(WPARAM, LPARAM lParam) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszText, (int)mir_strlen(pszText), pwszText, wchars);
- nRetVal = (INT_PTR)mir_wstrdup(TranslateW(pwszText));
+ nRetVal = (INT_PTR)mir_wstrdup(TranslateTS(pwszText));
}
else if (pEvent->datatype == DBVT_ASCIIZ)
nRetVal = (INT_PTR)mir_strdup(Translate(pszText));
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 59794f946a..f45334019b 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -65,7 +65,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) /////////////////////////////////////////////////////////////////////////////////////////
-static PROTO_INTERFACE* icqProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static PROTO_INTERFACE* icqProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CIcqProto *ppro = new CIcqProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index ee39798610..2556a1aa64 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -119,7 +119,7 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs break;
default:
- TCHAR err[512];
+ wchar_t err[512];
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, _countof(err), NULL)) {
pszErrorMsg = make_utf8_string(err);
bNeedFree = TRUE;
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 02cfbbd7eb..253bb1b843 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -40,7 +40,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
DWORD dwUin = ppro->getContactUin(NULL);
- TCHAR pszUIN[MAX_PATH];
+ wchar_t pszUIN[MAX_PATH];
mir_sntprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 143a1e715e..be3dae1b0d 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -497,18 +497,18 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * mir_strcpy(szBlob + sizeof(DWORD), pszFileName);
mir_strcpy(szBlob + sizeof(DWORD) + mir_strlen(pszFileName) + 1, pszDescription);
- TCHAR* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = mir_utf8decodeT(pszDescription);
- pre.files.t = &ptszFileName;
+ pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
- mir_free(pre.descr.t);
+ mir_free(pre.descr.w);
mir_free(ptszFileName);
}
else if (wAckType == 2) { // First attempt failed, reverse requested
@@ -713,7 +713,7 @@ static char* oftGetFileContainer(oscar_filetransfer* oft, const char** files, in }
-HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, const TCHAR** files, const TCHAR* pszDesc)
+HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, const wchar_t** files, const wchar_t* pszDesc)
{
int i, filesCount;
struct _stati64 statbuf;
@@ -728,7 +728,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c for (filesCount = 0; files[filesCount]; filesCount++);
ft->files = (oft_file_record *)SAFE_MALLOC(sizeof(oft_file_record) * filesCount);
- ft->files_list = (char**)SAFE_MALLOC(sizeof(TCHAR *) * filesCount);
+ ft->files_list = (char**)SAFE_MALLOC(sizeof(wchar_t *) * filesCount);
ft->qwTotalSize = 0;
char **filesUtf = (char**)SAFE_MALLOC(sizeof(char *) * filesCount);
@@ -736,7 +736,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c // Prepare files arrays
for (i = 0; i < filesCount; i++) {
- if (_tstati64(files[i], &statbuf))
+ if (_wstat64(files[i], &statbuf))
debugLogA("IcqSendFile() was passed invalid filename \"%s\"", files[i]);
else {
if (!(statbuf.st_mode & _S_IFDIR)) { // take only files
@@ -854,7 +854,7 @@ HANDLE CIcqProto::oftInitTransfer(MCONTACT hContact, DWORD dwUin, char* szUid, c }
-HANDLE CIcqProto::oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath)
+HANDLE CIcqProto::oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath)
{
oscar_filetransfer *ft = (oscar_filetransfer*)hTransfer;
@@ -884,7 +884,7 @@ HANDLE CIcqProto::oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR return hTransfer; // Success
}
-DWORD CIcqProto::oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR*)
+DWORD CIcqProto::oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t*)
{
oscar_filetransfer *ft = (oscar_filetransfer*)hTransfer;
@@ -935,7 +935,7 @@ DWORD CIcqProto::oftFileCancel(MCONTACT hContact, HANDLE hTransfer) return 0; // Success
}
-void CIcqProto::oftFileResume(oscar_filetransfer *ft, int action, const TCHAR *szFilename)
+void CIcqProto::oftFileResume(oscar_filetransfer *ft, int action, const wchar_t *szFilename)
{
int openFlags;
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 108c482721..8a66eeb085 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -1547,7 +1547,7 @@ void CIcqProto::icq_sendAuthReqServ(DWORD dwUin, char *szUid, const char *szMsg) sendServPacket(&packet);
}
-void CIcqProto::icq_sendAuthResponseServ(DWORD dwUin, char* szUid, int auth, const TCHAR *szReason)
+void CIcqProto::icq_sendAuthResponseServ(DWORD dwUin, char* szUid, int auth, const wchar_t *szReason)
{
BYTE nUinLen = getUIDLen(dwUin, szUid);
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 75d2c8c054..207ff0fe32 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -273,14 +273,14 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.dwInitParam = LPARAM(this);
odp.pfnDlgProc = IcqDlgProc;
odp.position = -1900000000;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_ICQ);
UserInfo_AddPage(wParam, &odp);
if (!lParam) {
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, TranslateT("%s Details"), m_tszUserName);
- odp.ptszTitle = buf;
+ odp.pwszTitle = buf;
odp.position = -1899999999;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO);
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 85a3c36114..3e13e9efe1 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -570,7 +570,7 @@ char* NickFromHandleUtf(MCONTACT hContact) if (hContact == INVALID_CONTACT_ID)
return ICQTranslateUtf(LPGEN("<invalid>"));
- return tchar_to_utf8((TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0));
+ return tchar_to_utf8((wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0));
}
char* strUID(DWORD dwUIN, char *pszUID)
@@ -1443,7 +1443,7 @@ char* __fastcall ICQTranslateUtf(const char *src) { // we can use unicode translate (0.5+)
WCHAR* usrc = make_unicode_string(src);
- szRes = make_utf8_string(TranslateW(usrc));
+ szRes = make_utf8_string(TranslateTS(usrc));
SAFE_FREE((void**)&usrc);
}
@@ -1455,7 +1455,7 @@ char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsiz if (mir_strlen(src)) { // we can use unicode translate (0.5+)
WCHAR *usrc = make_unicode_string(src);
- make_utf8_string_static(TranslateW(usrc), buf, bufsize);
+ make_utf8_string_static(TranslateTS(usrc), buf, bufsize);
SAFE_FREE((void**)&usrc);
}
@@ -1541,7 +1541,7 @@ const char* ExtractFileName(const char *fullname) }
-char* FileNameToUtf(const TCHAR *filename)
+char* FileNameToUtf(const wchar_t *filename)
{
WCHAR *usFileName = NULL;
int wchars = GetLongPathName(filename, usFileName, 0);
@@ -1555,10 +1555,10 @@ char* FileNameToUtf(const TCHAR *filename) int FileAccessUtf(const char *path, int mode)
{
size_t size = mir_strlen(path) + 2;
- TCHAR *szPath = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *szPath = (wchar_t*)_alloca(size * sizeof(wchar_t));
if (utf8_to_tchar_static(path, szPath, size))
- return _taccess(szPath, mode);
+ return _waccess(szPath, mode);
return -1;
}
@@ -1567,10 +1567,10 @@ int FileAccessUtf(const char *path, int mode) int FileStatUtf(const char *path, struct _stati64 *buffer)
{
size_t size = mir_strlen(path) + 2;
- TCHAR *szPath = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *szPath = (wchar_t*)_alloca(size * sizeof(wchar_t));
if (utf8_to_tchar_static(path, szPath, size))
- return _tstati64(szPath, buffer);
+ return _wstat64(szPath, buffer);
return -1;
}
@@ -1580,10 +1580,10 @@ int MakeDirUtf(const char *dir) {
int wRes = -1;
size_t size = mir_strlen(dir) + 2;
- TCHAR *szDir = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *szDir = (wchar_t*)_alloca(size * sizeof(wchar_t));
- if (utf8_to_tchar_static(dir, szDir, size)) { // _tmkdir can created only one dir at once
- wRes = _tmkdir(szDir);
+ if (utf8_to_tchar_static(dir, szDir, size)) { // _wmkdir can created only one dir at once
+ wRes = _wmkdir(szDir);
// check if dir not already existed - return success if yes
if (wRes == -1 && errno == 17 /* EEXIST */)
wRes = 0;
@@ -1595,7 +1595,7 @@ int MakeDirUtf(const char *dir) *szLast = '\0';
if (!MakeDirUtf(dir))
- wRes = _tmkdir(szDir);
+ wRes = _wmkdir(szDir);
*szLast = cOld;
}
@@ -1609,10 +1609,10 @@ int MakeDirUtf(const char *dir) int OpenFileUtf(const char *filename, int oflag, int pmode)
{
size_t size = mir_strlen(filename) + 2;
- TCHAR *szFile = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *szFile = (wchar_t*)_alloca(size * sizeof(wchar_t));
if (utf8_to_tchar_static(filename, szFile, size))
- return _topen(szFile, oflag, pmode);
+ return _wopen(szFile, oflag, pmode);
return -1;
}
@@ -1636,7 +1636,7 @@ void SetWindowTextUcs(HWND hWnd, WCHAR *text) char* GetWindowTextUtf(HWND hWnd)
{
int nLen = GetWindowTextLength(hWnd);
- TCHAR *szText = (TCHAR*)_alloca((nLen + 2) * sizeof(TCHAR));
+ wchar_t *szText = (wchar_t*)_alloca((nLen + 2) * sizeof(wchar_t));
GetWindowText(hWnd, szText, nLen + 1);
@@ -1653,7 +1653,7 @@ char* GetDlgItemTextUtf(HWND hwndDlg, int iItem) void SetWindowTextUtf(HWND hWnd, const char *szText)
{
size_t size = mir_strlen(szText) + 2;
- TCHAR *tszText = (TCHAR*)_alloca(size * sizeof(TCHAR));
+ wchar_t *tszText = (wchar_t*)_alloca(size * sizeof(wchar_t));
if (utf8_to_tchar_static(szText, tszText, size))
SetWindowText(hWnd, tszText);
diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index 783ff2fea7..119ebe79eb 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -108,7 +108,7 @@ WORD GetMyStatusFlags(); int IsValidRelativePath(const char *filename);
LPCSTR ExtractFileName(const char *fullname);
-char* FileNameToUtf(const TCHAR *filename);
+char* FileNameToUtf(const wchar_t *filename);
int FileAccessUtf(const char *path, int mode);
int FileStatUtf(const char *path, struct _stati64 *buffer);
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 3c5f4e165a..75c4f3dfab 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -44,7 +44,7 @@ CHAT_MANAGER *pci; int g_cbCountries;
CountryListEntry *g_countries;
-TCHAR szCoreVersion[100];
+wchar_t szCoreVersion[100];
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -126,10 +126,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) // init fontservice for info frame
FontIDT fontid = { 0 };
fontid.cbSize = sizeof(fontid);
- _tcsncpy_s(fontid.group, LPGENT("Jabber"), _TRUNCATE);
+ wcsncpy_s(fontid.group, LPGENW("Jabber"), _TRUNCATE);
strncpy_s(fontid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE);
- _tcsncpy_s(fontid.backgroundGroup, L"Jabber", _TRUNCATE);
- _tcsncpy_s(fontid.backgroundName, L"Background", _TRUNCATE);
+ wcsncpy_s(fontid.backgroundGroup, L"Jabber", _TRUNCATE);
+ wcsncpy_s(fontid.backgroundName, L"Background", _TRUNCATE);
fontid.flags = FIDF_DEFAULTVALID;
fontid.deffontsettings.charset = DEFAULT_CHARSET;
@@ -138,22 +138,22 @@ static int OnModulesLoaded(WPARAM, LPARAM) mir_tstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
- _tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE);
strncpy_s(fontid.prefix, "fntFrameTitle", _TRUNCATE);
fontid.deffontsettings.style = DBFONTF_BOLD;
FontRegisterT(&fontid);
- _tcsncpy_s(fontid.name, LPGENT("Frame text"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Frame text"), _TRUNCATE);
strncpy_s(fontid.prefix, "fntFrameClock", _TRUNCATE);
fontid.deffontsettings.style = 0;
FontRegisterT(&fontid);
ColourIDT colourid = {0};
colourid.cbSize = sizeof(colourid);
- _tcsncpy_s(colourid.group, L"Jabber", _TRUNCATE);
+ wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE);
strncpy_s(colourid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE);
- _tcsncpy_s(colourid.name, L"Background", _TRUNCATE);
+ wcsncpy_s(colourid.name, L"Background", _TRUNCATE);
strncpy_s(colourid.setting, "clFrameBack", _TRUNCATE);
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
@@ -164,7 +164,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CJabberProto* jabberProtoInit(const char* pszProtoName, const TCHAR *tszUserName)
+static CJabberProto* jabberProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
{
CJabberProto *ppro = new CJabberProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
@@ -233,7 +233,7 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyHookableEvent(hDiscoInfoResult);
if (g_nTempFileId != 0) {
- TCHAR tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
+ wchar_t tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
mir_sntprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 045c72c092..ea2d3c6748 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -106,13 +106,13 @@ void CJabberProto::OnIqResult_CommandExecution(HXML iqNode, CJabberIqInfo *pInfo SendMessage(GetWindowFromIq(pInfo), JAHM_PROCESSRESULT, (WPARAM)xmlCopyNode(iqNode), 0);
}
-void CJabberProto::AdHoc_RequestListOfCommands(TCHAR * szResponder, HWND hwndDlg)
+void CJabberProto::AdHoc_RequestListOfCommands(wchar_t * szResponder, HWND hwndDlg)
{
m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_ListOfCommands, JABBER_IQ_TYPE_GET, szResponder, 0, -1, hwndDlg))
<< XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(L"node", JABBER_FEAT_COMMANDS));
}
-int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* dat)
+int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, wchar_t*, JabberAdHocData* dat)
{
for (int i = 1;; i++) {
HXML itemNode = XmlGetNthChild(dat->CommandsNode, L"item", i);
@@ -122,9 +122,9 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* da if (BST_UNCHECKED == IsDlgButtonChecked(GetDlgItem(hwndDlg, IDC_FRAME), i))
continue;
- const TCHAR *node = XmlGetAttrValue(itemNode, L"node");
+ const wchar_t *node = XmlGetAttrValue(itemNode, L"node");
if (node) {
- const TCHAR *jid2 = XmlGetAttrValue(itemNode, L"jid");
+ const wchar_t *jid2 = XmlGetAttrValue(itemNode, L"jid");
m_ThreadInfo->send(
XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg))
<< XCHILDNS(L"command", JABBER_FEAT_COMMANDS) << XATTR(L"node", node) << XATTR(L"action", L"execute"));
@@ -142,12 +142,12 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* da int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat)
{
int nodeIdx = 0;
- const TCHAR * type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t * type = XmlGetAttrValue(iqNode, L"type");
if (!type || !mir_tstrcmp(type, L"error")) {
// error occurred here
- TCHAR buff[255];
- const TCHAR *code = NULL;
- const TCHAR *description = NULL;
+ wchar_t buff[255];
+ const wchar_t *code = NULL;
+ const wchar_t *description = NULL;
HXML errorNode = XmlGetChild(iqNode, "error");
if (errorNode) {
@@ -165,8 +165,8 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode) {
- const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
- const TCHAR *node = XmlGetAttrValue(queryNode, L"node");
+ const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *node = XmlGetAttrValue(queryNode, L"node");
if (xmlns && node && !mir_tstrcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_tstrcmp(node, JABBER_FEAT_COMMANDS))
validResponse = TRUE;
}
@@ -179,7 +179,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe if (!itemNode)
break;
- const TCHAR *name = XmlGetAttrValue(itemNode, L"name");
+ const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
if (!name) name = XmlGetAttrValue(itemNode, L"node");
ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), TranslateTS(name), nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0);
dat->CurrentHeight = ypos;
@@ -211,7 +211,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA dat->AdHocNode = xmlCopyNode(workNode);
- const TCHAR *type;
+ const wchar_t *type;
if ((type = XmlGetAttrValue(workNode, L"type")) == NULL) return TRUE;
if (!mir_tstrcmp(type, L"result")) {
// wParam = <iq/> node from responder as a result of command execution
@@ -219,7 +219,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA if ((commandNode = XmlGetChild(dat->AdHocNode, L"command")) == NULL)
return TRUE;
- const TCHAR *status = XmlGetAttrValue(commandNode, L"status");
+ const wchar_t *status = XmlGetAttrValue(commandNode, L"status");
if (!status)
status = L"completed";
@@ -274,9 +274,9 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0};
sttShowControls(hwndDlg, FALSE, toHide);
- const TCHAR *code=NULL;
- const TCHAR *description=NULL;
- TCHAR buff[255];
+ const wchar_t *code=NULL;
+ const wchar_t *description=NULL;
+ wchar_t buff[255];
HXML errorNode = XmlGetChild(workNode , "error");
if (errorNode) {
code = XmlGetAttrValue(errorNode, L"code");
@@ -289,7 +289,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA return TRUE;
}
-int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TCHAR* action)
+int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, wchar_t* action)
{
HXML commandNode = XmlGetChild(dat->AdHocNode, "command");
HXML xNode = XmlGetChild(commandNode, "x");
@@ -299,11 +299,11 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TC XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg));
HXML command = iq << XCHILDNS(L"command", JABBER_FEAT_COMMANDS);
- const TCHAR *sessionId = XmlGetAttrValue(commandNode, L"sessionid");
+ const wchar_t *sessionId = XmlGetAttrValue(commandNode, L"sessionid");
if (sessionId)
command << XATTR(L"sessionid", sessionId);
- const TCHAR *node = XmlGetAttrValue(commandNode, L"node");
+ const wchar_t *node = XmlGetAttrValue(commandNode, L"node");
if (node)
command << XATTR(L"node", node);
@@ -322,7 +322,7 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TC return TRUE;
}
-int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, int ypos, int value)
+int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, wchar_t * labelStr, int id, int ypos, int value)
{
RECT strRect = { 0 };
int verticalStep = 4;
@@ -384,7 +384,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA if (!pStartupParams->m_szNode) {
dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
- TCHAR Caption[512];
+ wchar_t Caption[512];
mir_sntprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -397,7 +397,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE);
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
- TCHAR Caption[512];
+ wchar_t Caption[512];
mir_sntprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -517,8 +517,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (hContact && szJid != NULL) {
JABBER_LIST_ITEM *item = NULL;
int selected = 0;
- TCHAR jid[JABBER_MAX_JID_LEN];
- _tcsncpy_s(jid, szJid, _TRUNCATE);
+ wchar_t jid[JABBER_MAX_JID_LEN];
+ wcsncpy_s(jid, szJid, _TRUNCATE);
{
mir_cslock lck(m_csLists);
item = ListGetItemPtr(LIST_ROSTER, jid);
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index f7c2b64a45..a09ad50983 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -52,10 +52,10 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_JABBER_REGDLG_UPDATE) {
- if ((TCHAR*)lParam == NULL)
+ if ((wchar_t*)lParam == NULL)
SetDlgItemText(m_hwnd, IDC_REG_STATUS, TranslateT("No message"));
else
- SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam);
+ SetDlgItemText(m_hwnd, IDC_REG_STATUS, (wchar_t*)lParam);
SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0);
@@ -82,12 +82,12 @@ class CAgentRegDlg : public CJabberDlgBase int m_formHeight, m_frameHeight;
RECT m_frameRect;
HXML m_agentRegIqNode;
- TCHAR *m_jid;
+ wchar_t *m_jid;
CCtrlButton m_submit;
public:
- CAgentRegDlg(CJabberProto *_ppro, TCHAR *_jid) :
+ CAgentRegDlg(CJabberProto *_ppro, wchar_t *_jid) :
CJabberDlgBase(_ppro, IDD_FORM, false),
m_submit(this, IDC_SUBMIT),
m_jid(_jid),
@@ -226,14 +226,14 @@ public: void OnSubmit(CCtrlButton*)
{
HXML queryNode, xNode;
- const TCHAR *from;
+ const wchar_t *from;
if (m_agentRegIqNode == NULL) return;
if ((from = XmlGetAttrValue(m_agentRegIqNode, L"from")) == NULL) return;
if ((queryNode = XmlGetChild(m_agentRegIqNode , "query")) == NULL) return;
HWND hFrame = GetDlgItem(m_hwnd, IDC_FRAME);
- TCHAR *str2 = (TCHAR*)alloca(sizeof(TCHAR) * 128);
+ wchar_t *str2 = (wchar_t*)alloca(sizeof(wchar_t) * 128);
int id = 0;
XmlNodeIq iq( m_proto->AddIQ(&CJabberProto::OnIqResultSetRegister, JABBER_IQ_TYPE_SET, from));
@@ -277,7 +277,7 @@ public: }
};
-void CJabberProto::RegisterAgent(HWND /*hwndDlg*/, TCHAR* jid)
+void CJabberProto::RegisterAgent(HWND /*hwndDlg*/, wchar_t* jid)
{
(new CAgentRegDlg(this, jid))->Show();
}
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 97850e9336..a144c1324d 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -64,7 +64,7 @@ LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) {
if (jid == NULL)
return NULL;
- LPCTSTR p = _tcschr(jid, '/');
+ LPCTSTR p = wcschr(jid, '/');
if (p == NULL) {
mir_cslock lck(m_csLists);
return mir_tstrdup(ListGetBestClientResourceNamePtr(jid));
@@ -240,7 +240,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) LPTSTR szExt = mir_tstrdup(szFeature);
LPTSTR pSrc, pDst;
for (pSrc = szExt, pDst = szExt; *pSrc; pSrc++)
- if (_tcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc))
+ if (wcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc))
*pDst++ = *pSrc;
*pDst = 0;
m_clientCapsManager.SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szExt, jcb);
@@ -335,7 +335,7 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) iLen += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
// allocate memory and fill it
- LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(TCHAR));
+ LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(wchar_t));
LPTSTR p = str;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 5d9d101ee6..d0718ab3ca 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -49,7 +49,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p time_t tmLast = getDword(hContact, "LastCollection", 0);
if (tmLast) {
- TCHAR buf[40];
+ wchar_t buf[40];
list << XATTR(L"start", time2str(tmLast, buf, _countof(buf)));
}
m_ThreadInfo->send(iq);
@@ -57,7 +57,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*)
{
- const TCHAR *to = XmlGetAttrValue(iqNode, L"to");
+ const wchar_t *to = XmlGetAttrValue(iqNode, L"to");
if (to == NULL || mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
return;
@@ -70,8 +70,8 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) if (!itemNode)
break;
- const TCHAR* start = XmlGetAttrValue(itemNode, L"start");
- const TCHAR* with = XmlGetAttrValue(itemNode, L"with");
+ const wchar_t* start = XmlGetAttrValue(itemNode, L"start");
+ const wchar_t* with = XmlGetAttrValue(itemNode, L"with");
if (!start || !with)
continue;
@@ -228,8 +228,8 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) if (!chatNode || mir_tstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE))
return;
- const TCHAR* start = XmlGetAttrValue(chatNode, L"start");
- const TCHAR* with = XmlGetAttrValue(chatNode, L"with");
+ const wchar_t* start = XmlGetAttrValue(chatNode, L"start");
+ const wchar_t* with = XmlGetAttrValue(chatNode, L"with");
if (!start || !with)
return;
@@ -248,7 +248,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) break;
int from;
- const TCHAR *itemName = XmlGetName(itemNode);
+ const wchar_t *itemName = XmlGetName(itemNode);
if (!mir_tstrcmp(itemName, L"to"))
from = DBEF_SENT;
else if (!mir_tstrcmp(itemName, L"from"))
@@ -260,8 +260,8 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) if (!body)
continue;
- const TCHAR *tszBody = XmlGetText(body);
- const TCHAR *tszSecs = XmlGetAttrValue(itemNode, L"secs");
+ const wchar_t *tszBody = XmlGetText(body);
+ const wchar_t *tszSecs = XmlGetAttrValue(itemNode, L"secs");
if (!tszBody || !tszSecs)
continue;
@@ -273,7 +273,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) dbei.cbBlob = (DWORD)mir_strlen(szEventText)+1;
dbei.flags = DBEF_READ + DBEF_UTF + from;
dbei.pBlob = szEventText;
- dbei.timestamp = tmStart + _ttol(tszSecs);
+ dbei.timestamp = tmStart + _wtol(tszSecs);
if (!IsDuplicateEvent(hContact, dbei))
db_event_add(hContact, &dbei);
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 362e300e89..f7915fe86b 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -36,7 +36,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM {
JabberAddBookmarkDlgParam* param = (JabberAddBookmarkDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- TCHAR text[512];
+ wchar_t text[512];
JABBER_LIST_ITEM *item;
switch (msg) {
@@ -48,7 +48,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM TranslateDialogDefault(hwndDlg);
if (item = param->m_item) {
if (!mir_tstrcmp(item->type, L"conference")) {
- if (!_tcschr(item->jid, _T('@'))) { //no room name - consider it is transport
+ if (!wcschr(item->jid, '@')) { //no room name - consider it is transport
CheckDlgButton(hwndDlg, IDC_AGENT_RADIO, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
@@ -110,7 +110,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM case IDOK:
{
GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text));
- TCHAR *roomJID = NEWTSTR_ALLOCA(text);
+ wchar_t *roomJID = NEWWSTR_ALLOCA(text);
if (param->m_item)
param->ppro->ListRemove(LIST_BOOKMARK, param->m_item->jid);
@@ -207,7 +207,7 @@ private: int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED);
if (iItem < 0) return;
- TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem);
+ wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem);
if (address == NULL) return;
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
@@ -226,7 +226,7 @@ private: int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED);
if (iItem < 0) return;
- TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem);
+ wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem);
if (address == NULL) return;
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
@@ -323,7 +323,7 @@ void CJabberDlgBookmarks::OpenBookmark() int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED);
if (iItem < 0) return;
- TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem);
+ wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem);
if (address == NULL) return;
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
@@ -333,12 +333,12 @@ void CJabberDlgBookmarks::OpenBookmark() m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item
/* some hack for using bookmark to transport not under XEP-0048 */
- if (!_tcschr(item->jid, _T('@')))
+ if (!wcschr(item->jid, '@'))
//the room name is not provided let consider that it is transport and send request to registration
m_proto->RegisterAgent(NULL, item->jid);
else {
- TCHAR *room = NEWTSTR_ALLOCA(item->jid);
- TCHAR *server = _tcschr(room, _T('@'));
+ wchar_t *room = NEWWSTR_ALLOCA(item->jid);
+ wchar_t *server = wcschr(room, '@');
*(server++) = 0;
if (item->nick && *item->nick)
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 8059f3a1bd..c889f7099f 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -60,13 +60,13 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
- const TCHAR *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost");
if (streamHostNode) {
- const TCHAR *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
- const TCHAR *streamHost = XmlGetAttrValue(streamHostNode, L"host");
- const TCHAR *streamPort = XmlGetAttrValue(streamHostNode, L"port");
+ const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
+ const wchar_t *streamHost = XmlGetAttrValue(streamHostNode, L"host");
+ const wchar_t *streamPort = XmlGetAttrValue(streamHostNode, L"port");
if (streamJid && streamHost && streamPort) {
jbt->szProxyHost = mir_tstrdup(streamHost);
jbt->szProxyJid = mir_tstrdup(streamJid);
@@ -83,7 +83,7 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
{
CJabberProto *ppro = (CJabberProto*)extra;
- TCHAR szPort[8];
+ wchar_t szPort[8];
JABBER_BYTE_TRANSFER *jbt;
int recvResult, bytesParsed;
HANDLE hListen;
@@ -142,7 +142,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
{
- TCHAR szPort[8];
+ wchar_t szPort[8];
HANDLE hEvent = NULL;
CJabberIqInfo *pInfo = NULL;
int nIqId = 0;
@@ -299,11 +299,11 @@ void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
- const TCHAR *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost-used");
if (streamHostNode) {
- const TCHAR *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
+ const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
if (streamJid)
jbt->szStreamhostUsed = mir_tstrdup(streamJid);
} } } }
@@ -360,10 +360,10 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b // 04-07 bnd.addr server bound address
// 08-09 bnd.port server bound port
if (datalen == 47 && *((DWORD*)buffer)==0x03000105 && buffer[4]==40 && *((WORD*)(buffer+45))==0) {
- TCHAR text[256];
+ wchar_t text[256];
- TCHAR *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
- TCHAR *szTargetJid = JabberPrepareJid(jbt->dstJID);
+ wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
+ wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) {
int id = JabberGetPacketID(iqNode);
- TCHAR listJid[JABBER_MAX_JID_LEN];
+ wchar_t listJid[JABBER_MAX_JID_LEN];
mir_sntprintf(listJid, L"ftproxy_%d", id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
@@ -423,7 +423,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt)
{
- TCHAR *szHost, *szPort;
+ wchar_t *szHost, *szPort;
WORD port;
HANDLE hConn;
char data[3];
@@ -444,7 +444,7 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) szPort = jbt->szProxyPort;
szHost = jbt->szProxyHost;
- port = (WORD)_ttoi(szPort);
+ port = (WORD)_wtoi(szPort);
replaceStrT(jbt->streamhostJID, jbt->szProxyJid);
NETLIBOPENCONNECTION nloc = { 0 };
@@ -509,10 +509,10 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch *((DWORD*)data) = 0x03000105;
data[4] = 40;
- TCHAR text[256];
+ wchar_t text[256];
- TCHAR *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
- TCHAR *szTargetJid = JabberPrepareJid(jbt->dstJID);
+ wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
+ wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext();
- TCHAR listJid[256];
+ wchar_t listJid[256];
mir_sntprintf(listJid, L"ftproxy_%d", iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
@@ -587,7 +587,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
{
HXML iqNode, queryNode = NULL, n;
- const TCHAR *sid = NULL, *from = NULL, *to = NULL, *szId = NULL, *szHost, *szPort, *str;
+ const wchar_t *sid = NULL, *from = NULL, *to = NULL, *szId = NULL, *szHost, *szPort, *str;
int i;
WORD port;
HANDLE hConn;
@@ -623,7 +623,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) (szPort = XmlGetAttrValue(n, L"port")) != NULL &&
(str = XmlGetAttrValue(n, L"jid")) != NULL) {
- port = (WORD)_ttoi(szPort);
+ port = (WORD)_wtoi(szPort);
replaceStrT(jbt->streamhostJID, str);
debugLog(L"bytestream_recv connecting to %s:%d", szHost, port);
@@ -705,7 +705,7 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char *((DWORD*)data) = 0x03000105;
data[4] = 40;
- TCHAR text[JABBER_MAX_JID_LEN * 2];
+ wchar_t text[JABBER_MAX_JID_LEN * 2];
{
ptrT szInitiatorJid(JabberPrepareJid(jbt->srcJID));
ptrT szTargetJid(JabberPrepareJid(jbt->dstJID));
diff --git a/protocols/JabberG/src/jabber_byte.h b/protocols/JabberG/src/jabber_byte.h index 604f9702f9..3c705533f8 100644 --- a/protocols/JabberG/src/jabber_byte.h +++ b/protocols/JabberG/src/jabber_byte.h @@ -35,11 +35,11 @@ struct JABBER_BYTE_TRANSFER {
~JABBER_BYTE_TRANSFER();
- TCHAR *sid;
- TCHAR *srcJID;
- TCHAR *dstJID;
- TCHAR *streamhostJID;
- TCHAR *iqId;
+ wchar_t *sid;
+ wchar_t *srcJID;
+ wchar_t *dstJID;
+ wchar_t *streamhostJID;
+ wchar_t *iqId;
JABBER_BYTE_STATE state;
HANDLE hConn;
HANDLE hEvent;
@@ -52,10 +52,10 @@ struct JABBER_BYTE_TRANSFER // XEP-0065 proxy support
BOOL bProxyDiscovered;
HANDLE hProxyEvent;
- TCHAR *szProxyHost;
- TCHAR *szProxyPort;
- TCHAR *szProxyJid;
- TCHAR *szStreamhostUsed;
+ wchar_t *szProxyHost;
+ wchar_t *szProxyPort;
+ wchar_t *szProxyJid;
+ wchar_t *szStreamhostUsed;
BOOL bStreamActivated;
HANDLE hSendEvent;
};
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index eb859e524b..275e869901 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -29,52 +29,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h"
const JabberFeatCapPair g_JabberFeatCapPairs[] = {
- { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENT("Supports Service Discovery info") },
- { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENT("Supports Service Discovery items list") },
- { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENT("Can inform about its Jabber capabilities") },
- { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENT("Supports stream initiation (e.g., for filetransfers)") },
- { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENT("Supports stream initiation for file transfers") },
- { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENT("Supports file transfers via SOCKS5 Bytestreams") },
- { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENT("Supports file transfers via In-Band Bytestreams") },
- { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENT("Supports execution of Ad-Hoc commands") },
- { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENT("Supports in-band registration") },
- { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENT("Supports multi-user chat") },
- { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENT("Can report chat state in a chat session") },
- { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENT("Can report information about the last activity of the user") },
- { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENT("Can report own version information") },
- { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENT("Can report local time of the user") },
- { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENT("Can send and receive ping requests") },
- { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENT("Supports data forms") },
- { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENT("Can request and respond to events relating to the delivery, display, and composition of messages") },
- { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENT("Supports vCard") },
- { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENT("Supports iq-based avatars") },
- { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENT("Supports XHTML formatting of chat messages") },
- { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENT("Supports Jabber Browsing") },
- { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENT("Supports Jabber Browsing") },
- { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENT("Can negotiate options for specific features") },
- { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENT("Can request advanced processing of message stanzas") },
- { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENT("Can report information about user moods") },
- { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENT("Receives information about user moods") },
- { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENT("Supports generic publish-subscribe functionality") },
- { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENT("Supports SecureIM plugin for Miranda NG") },
- { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENT("Supports OTR (Off-the-Record Messaging)") },
- { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENT("Supports New_GPG plugin for Miranda NG") },
- { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENT("Blocks packets from other users/group chats using Privacy lists") },
- { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENT("Supports Message Receipts") },
- { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENT("Can report information about the music to which a user is listening") },
- { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENT("Receives information about the music to which a user is listening") },
- { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENT("Supports private XML Storage (for bookmarks and other)") },
- { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENT("Supports attention requests ('nudge')") },
- { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENT("Supports chat history retrieving") },
- { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENT("Supports chat history management") },
- { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENT("Can report information about user activity") },
- { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENT("Receives information about user activity") },
- { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENT("Supports Miranda NG notes extension") },
- { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENT("Supports Jingle") },
- { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENT("Supports Roster Exchange") },
- { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENT("Supports direct chat invitations (XEP-0249)") },
+ { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENW("Supports Service Discovery info") },
+ { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENW("Supports Service Discovery items list") },
+ { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENW("Can inform about its Jabber capabilities") },
+ { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENW("Supports stream initiation (e.g., for filetransfers)") },
+ { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENW("Supports stream initiation for file transfers") },
+ { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENW("Supports file transfers via SOCKS5 Bytestreams") },
+ { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENW("Supports file transfers via In-Band Bytestreams") },
+ { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENW("Supports execution of Ad-Hoc commands") },
+ { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENW("Supports in-band registration") },
+ { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENW("Supports multi-user chat") },
+ { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENW("Can report chat state in a chat session") },
+ { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENW("Can report information about the last activity of the user") },
+ { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENW("Can report own version information") },
+ { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENW("Can report local time of the user") },
+ { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENW("Can send and receive ping requests") },
+ { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENW("Supports data forms") },
+ { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENW("Can request and respond to events relating to the delivery, display, and composition of messages") },
+ { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENW("Supports vCard") },
+ { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENW("Supports iq-based avatars") },
+ { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENW("Supports XHTML formatting of chat messages") },
+ { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENW("Supports Jabber Browsing") },
+ { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENW("Supports Jabber Browsing") },
+ { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENW("Can negotiate options for specific features") },
+ { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENW("Can request advanced processing of message stanzas") },
+ { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENW("Can report information about user moods") },
+ { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENW("Receives information about user moods") },
+ { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENW("Supports generic publish-subscribe functionality") },
+ { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENW("Supports SecureIM plugin for Miranda NG") },
+ { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENW("Supports OTR (Off-the-Record Messaging)") },
+ { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENW("Supports New_GPG plugin for Miranda NG") },
+ { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENW("Blocks packets from other users/group chats using Privacy lists") },
+ { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENW("Supports Message Receipts") },
+ { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENW("Can report information about the music to which a user is listening") },
+ { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENW("Receives information about the music to which a user is listening") },
+ { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENW("Supports private XML Storage (for bookmarks and other)") },
+ { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENW("Supports attention requests ('nudge')") },
+ { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENW("Supports chat history retrieving") },
+ { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENW("Supports chat history management") },
+ { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENW("Can report information about user activity") },
+ { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENW("Receives information about user activity") },
+ { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENW("Supports Miranda NG notes extension") },
+ { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") },
+ { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") },
+ { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") },
{ NULL }
};
@@ -110,9 +110,9 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo) // XEP-0232 support
HXML xform;
for (int i = 1; (xform = XmlGetNthChild(query, L"x", i)) != NULL; i++) {
- TCHAR *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value");
+ wchar_t *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value");
if (szFormTypeValue && !mir_tstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) {
- TCHAR *szTmp = XPath(xform, L"field[@var='os']/value");
+ wchar_t *szTmp = XPath(xform, L"field[@var='os']/value");
if (szTmp)
r->m_tszOs = mir_tstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='os_version']/value");
@@ -143,7 +143,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) JabberCapsBits jcbCaps = 0;
HXML feature;
for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) {
- const TCHAR *featureName = XmlGetAttrValue(feature, L"var");
+ const wchar_t *featureName = XmlGetAttrValue(feature, L"var");
if (!featureName)
continue;
@@ -177,12 +177,12 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) }
}
-JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
+JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid)
{
if (jid == NULL)
return JABBER_RESOURCE_CAPS_NONE;
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(jid, szBareJid, _countof(szBareJid));
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szBareJid);
@@ -200,7 +200,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
- TCHAR szFullJid[JABBER_MAX_JID_LEN];
+ wchar_t szFullJid[JABBER_MAX_JID_LEN];
mir_sntprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
@@ -210,13 +210,13 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) return jcbToReturn;
}
-JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appendBestResource)
+JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL appendBestResource)
{
- TCHAR fullJid[JABBER_MAX_JID_LEN];
+ wchar_t fullJid[JABBER_MAX_JID_LEN];
if (appendBestResource)
GetClientJID(jid, fullJid, _countof(fullJid));
else
- _tcsncpy_s(fullJid, jid, _TRUNCATE);
+ wcsncpy_s(fullJid, jid, _TRUNCATE);
pResourceStatus r(ResourceInfoFromJID(fullJid));
if (r == NULL)
@@ -239,7 +239,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen m_clientCapsManager.SetClientCaps(r->m_tszCapsNode, r->m_tszCapsVer, JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId());
r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
- TCHAR queryNode[512];
+ wchar_t queryNode[512];
mir_sntprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", queryNode));
@@ -251,9 +251,9 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen jcbCaps |= jcbMainCaps;
if (jcbMainCaps != JABBER_RESOURCE_CAPS_TIMEOUT && r->m_tszCapsExt) {
- TCHAR *caps = mir_tstrdup(r->m_tszCapsExt);
+ wchar_t *caps = mir_tstrdup(r->m_tszCapsExt);
- TCHAR *token = _tcstok(caps, L" ");
+ wchar_t *token = wcstok(caps, L" ");
while (token) {
switch (jcbExtCaps = m_clientCapsManager.GetClientCaps(r->m_tszCapsNode, token)) {
case JABBER_RESOURCE_CAPS_ERROR:
@@ -282,7 +282,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen jcbCaps |= jcbExtCaps;
}
- token = _tcstok(NULL, L" ");
+ token = wcstok(NULL, L" ");
}
mir_free(caps);
@@ -388,7 +388,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen /////////////////////////////////////////////////////////////////////////////////////////
// CJabberClientPartialCaps class
-CJabberClientPartialCaps::CJabberClientPartialCaps(const TCHAR *szVer)
+CJabberClientPartialCaps::CJabberClientPartialCaps(const wchar_t *szVer)
{
m_szVer = mir_tstrdup(szVer);
m_jcbCaps = JABBER_RESOURCE_CAPS_UNINIT;
@@ -430,7 +430,7 @@ JabberCapsBits CJabberClientPartialCaps::GetCaps() return m_jcbCaps;
}
-CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const TCHAR *szVer)
+CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const wchar_t *szVer)
{
if (!m_pCaps || !szVer)
return NULL;
@@ -461,7 +461,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindById(int nIqId) /////////////////////////////////////////////////////////////////////////////////////////
// CJabberClientCaps class
-CJabberClientCaps::CJabberClientCaps(const TCHAR *szNode)
+CJabberClientCaps::CJabberClientCaps(const wchar_t *szNode)
{
m_szNode = mir_tstrdup(szNode);
m_pCaps = NULL;
@@ -483,13 +483,13 @@ CJabberClientCaps* CJabberClientCaps::SetNext(CJabberClientCaps *pClient) return pRetVal;
}
-JabberCapsBits CJabberClientCaps::GetPartialCaps(TCHAR *szVer)
+JabberCapsBits CJabberClientCaps::GetPartialCaps(wchar_t *szVer)
{
CJabberClientPartialCaps *pCaps = FindByVersion(szVer);
return (pCaps) ? pCaps->GetCaps() : JABBER_RESOURCE_CAPS_UNINIT;
}
-BOOL CJabberClientCaps::SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
+BOOL CJabberClientCaps::SetPartialCaps(const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
{
CJabberClientPartialCaps *pCaps = FindByVersion(szVer);
if (!pCaps) {
@@ -529,7 +529,7 @@ CJabberClientCapsManager::~CJabberClientCapsManager() delete m_pClients;
}
-CJabberClientCaps * CJabberClientCapsManager::FindClient(const TCHAR *szNode)
+CJabberClientCaps * CJabberClientCapsManager::FindClient(const wchar_t *szNode)
{
if (!m_pClients || !szNode)
return NULL;
@@ -552,7 +552,7 @@ void CJabberClientCapsManager::AddDefaultCaps() SetClientCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap);
}
-JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szVer)
+JabberCapsBits CJabberClientCapsManager::GetClientCaps(wchar_t *szNode, wchar_t *szVer)
{
mir_cslockfull lck(m_cs);
CJabberClientCaps *pClient = FindClient(szNode);
@@ -567,7 +567,7 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szV return jcbCaps;
}
-BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
+BOOL CJabberClientCapsManager::SetClientCaps(const wchar_t *szNode, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
{
mir_cslockfull lck(m_cs);
CJabberClientCaps *pClient = FindClient(szNode);
@@ -604,7 +604,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps) return bOk;
}
-BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
+BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
int i;
JabberCapsBits jcb = 0;
@@ -614,7 +614,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con if (!g_JabberFeatCapPairsExt[i].Valid())
continue;
- TCHAR szExtCap[ 512 ];
+ wchar_t szExtCap[ 512 ];
mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
@@ -624,7 +624,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con // check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
- TCHAR szExtCap[ 512 ];
+ wchar_t szExtCap[ 512 ];
mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
@@ -663,16 +663,16 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con query << XCHILD(L"feature") << XATTR(L"var", ppro->m_lstJabberFeatCapPairsDynamic[i]->szFeature);
if (ppro->m_options.AllowVersionRequests && !szNode) {
- TCHAR szOsBuffer[256] = {0};
- TCHAR *os = szOsBuffer;
+ wchar_t szOsBuffer[256] = {0};
+ wchar_t *os = szOsBuffer;
if (ppro->m_options.ShowOSVersion) {
if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
mir_tstrncpy(szOsBuffer, L"", _countof(szOsBuffer));
else {
- TCHAR *szOsWindows = L"Microsoft Windows";
+ wchar_t *szOsWindows = L"Microsoft Windows";
size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
- if (!_tcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
+ if (!wcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
os += nOsWindowsLength + 1;
}
}
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index d9ed0422c4..b4b9e78ec2 100644 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -207,14 +207,14 @@ class CJabberClientPartialCaps {
protected:
- TCHAR *m_szVer;
+ wchar_t *m_szVer;
JabberCapsBits m_jcbCaps;
CJabberClientPartialCaps *m_pNext;
int m_nIqId;
DWORD m_dwRequestTime;
public:
- CJabberClientPartialCaps(const TCHAR *szVer);
+ CJabberClientPartialCaps(const wchar_t *szVer);
~CJabberClientPartialCaps();
CJabberClientPartialCaps* SetNext(CJabberClientPartialCaps *pCaps);
@@ -225,7 +225,7 @@ public: void SetCaps(JabberCapsBits jcbCaps, int nIqId = -1);
JabberCapsBits GetCaps();
- __inline TCHAR* GetVersion()
+ __inline wchar_t* GetVersion()
{ return m_szVer;
}
@@ -238,16 +238,16 @@ class CJabberClientCaps {
protected:
- TCHAR *m_szNode;
+ wchar_t *m_szNode;
CJabberClientPartialCaps *m_pCaps;
CJabberClientCaps *m_pNext;
protected:
- CJabberClientPartialCaps* FindByVersion(const TCHAR *szVer);
+ CJabberClientPartialCaps* FindByVersion(const wchar_t *szVer);
CJabberClientPartialCaps* FindById(int nIqId);
public:
- CJabberClientCaps(const TCHAR *szNode);
+ CJabberClientCaps(const wchar_t *szNode);
~CJabberClientCaps();
CJabberClientCaps* SetNext(CJabberClientCaps *pClient);
@@ -255,11 +255,11 @@ public: { return m_pNext;
}
- JabberCapsBits GetPartialCaps(TCHAR *szVer);
- BOOL SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
+ JabberCapsBits GetPartialCaps(wchar_t *szVer);
+ BOOL SetPartialCaps(const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
BOOL SetPartialCaps(int nIqId, JabberCapsBits jcbCaps);
- __inline TCHAR* GetNode()
+ __inline wchar_t* GetNode()
{ return m_szNode;
}
};
@@ -273,7 +273,7 @@ protected: CJabberProto *ppro;
protected:
- CJabberClientCaps *FindClient(const TCHAR *szNode);
+ CJabberClientCaps *FindClient(const wchar_t *szNode);
public:
CJabberClientCapsManager(CJabberProto *proto);
@@ -281,11 +281,11 @@ public: void AddDefaultCaps();
- JabberCapsBits GetClientCaps(TCHAR *szNode, TCHAR *szVer);
- BOOL SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
+ JabberCapsBits GetClientCaps(wchar_t *szNode, wchar_t *szVer);
+ BOOL SetClientCaps(const wchar_t *szNode, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
BOOL SetClientCaps(int nIqId, JabberCapsBits jcbCaps);
- BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
+ BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode);
};
struct JabberFeatCapPair
@@ -308,10 +308,10 @@ struct JabberFeatCapPairExt struct JabberFeatCapPairDynamic
{
- TCHAR *szExt;
- TCHAR *szFeature;
+ wchar_t *szExt;
+ wchar_t *szFeature;
JabberCapsBits jcbCap;
- TCHAR *szDescription;
+ wchar_t *szDescription;
};
extern const JabberFeatCapPair g_JabberFeatCapPairs[];
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 53edb29bbf..159b9c15a0 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -35,7 +35,7 @@ struct CAPTCHA_FORM_PARAMS LPCTSTR hint;
HBITMAP bmp;
int w,h;
- TCHAR Result[MAX_PATH];
+ wchar_t Result[MAX_PATH];
};
INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -165,7 +165,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) return true;
}
-void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid)
+void CJabberProto::sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid)
{
XmlNodeIq iq(L"set", SerialNext());
HXML query= iq <<XATTR(L"to", from) << XCHILD(L"captcha") << XATTR(L"xmlns", L"urn:xmpp:captcha") << XCHILD (L"x") << XATTR(L"xmlns", JABBER_FEAT_DATA_FORMS) << XATTR(L"type", L"submit");
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 40cdb9168c..c260b23348 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -57,11 +57,11 @@ struct TRoleOrAffiliationInfo {
int value;
int id;
- TCHAR *title_en;
+ wchar_t *title_en;
int min_role;
int min_affiliation;
- TCHAR *title;
+ wchar_t *title;
BOOL check(JABBER_RESOURCE_STATUS *me, JABBER_RESOURCE_STATUS *him)
{
@@ -80,23 +80,23 @@ struct TRoleOrAffiliationInfo static TRoleOrAffiliationInfo sttAffiliationItems[] =
{
- { AFFILIATION_NONE, IDM_SET_NONE, LPGENT("None"), ROLE_NONE, AFFILIATION_ADMIN },
- { AFFILIATION_MEMBER, IDM_SET_MEMBER, LPGENT("Member"), ROLE_NONE, AFFILIATION_ADMIN },
- { AFFILIATION_ADMIN, IDM_SET_ADMIN, LPGENT("Admin"), ROLE_NONE, AFFILIATION_OWNER },
- { AFFILIATION_OWNER, IDM_SET_OWNER, LPGENT("Owner"), ROLE_NONE, AFFILIATION_OWNER },
+ { AFFILIATION_NONE, IDM_SET_NONE, LPGENW("None"), ROLE_NONE, AFFILIATION_ADMIN },
+ { AFFILIATION_MEMBER, IDM_SET_MEMBER, LPGENW("Member"), ROLE_NONE, AFFILIATION_ADMIN },
+ { AFFILIATION_ADMIN, IDM_SET_ADMIN, LPGENW("Admin"), ROLE_NONE, AFFILIATION_OWNER },
+ { AFFILIATION_OWNER, IDM_SET_OWNER, LPGENW("Owner"), ROLE_NONE, AFFILIATION_OWNER },
};
static TRoleOrAffiliationInfo sttRoleItems[] =
{
- { ROLE_VISITOR, IDM_SET_VISITOR, LPGENT("Visitor"), ROLE_MODERATOR, AFFILIATION_NONE },
- { ROLE_PARTICIPANT, IDM_SET_PARTICIPANT, LPGENT("Participant"), ROLE_MODERATOR, AFFILIATION_NONE },
- { ROLE_MODERATOR, IDM_SET_MODERATOR, LPGENT("Moderator"), ROLE_MODERATOR, AFFILIATION_ADMIN },
+ { ROLE_VISITOR, IDM_SET_VISITOR, LPGENW("Visitor"), ROLE_MODERATOR, AFFILIATION_NONE },
+ { ROLE_PARTICIPANT, IDM_SET_PARTICIPANT, LPGENW("Participant"), ROLE_MODERATOR, AFFILIATION_NONE },
+ { ROLE_MODERATOR, IDM_SET_MODERATOR, LPGENW("Moderator"), ROLE_MODERATOR, AFFILIATION_ADMIN },
};
/////////////////////////////////////////////////////////////////////////////////////////
// JabberGcInit - initializes the new chat
-static const TCHAR *sttStatuses[] = { LPGENT("Visitors"), LPGENT("Participants"), LPGENT("Moderators"), LPGENT("Owners") };
+static const wchar_t *sttStatuses[] = { LPGENW("Visitors"), LPGENW("Participants"), LPGENW("Moderators"), LPGENW("Owners") };
int JabberGcGetStatus(JABBER_GC_AFFILIATION a, JABBER_GC_ROLE r)
{
@@ -194,7 +194,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case INFO_STATUS:
if (m_options.GcLogStatuses) {
- TCHAR *ptszDescr = pcli->pfnGetStatusModeDescription(user->m_iStatus, 0);
+ wchar_t *ptszDescr = pcli->pfnGetStatusModeDescription(user->m_iStatus, 0);
if (user->m_tszStatusMessage)
buf.Format(TranslateT("User %s changed status to %s with message: %s"),
user->m_tszResourceName, ptszDescr, user->m_tszStatusMessage);
@@ -210,7 +210,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case INFO_AFFILIATION:
if (m_options.GcLogAffiliations) {
- TCHAR *name = NULL;
+ wchar_t *name = NULL;
switch (user->m_affiliation) {
case AFFILIATION_NONE: name = TranslateT("None"); break;
case AFFILIATION_MEMBER: name = TranslateT("Member"); break;
@@ -225,7 +225,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case INFO_ROLE:
if (m_options.GcLogRoles) {
- TCHAR *name = NULL;
+ wchar_t *name = NULL;
switch (user->m_role) {
case ROLE_NONE: name = TranslateT("None"); break;
case ROLE_VISITOR: name = TranslateT("Visitor"); break;
@@ -253,11 +253,11 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus }
}
-void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode)
+void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t *resource, const wchar_t *nick, const wchar_t *jid, int action, HXML reason, int nStatusCode)
{
int statusToSet = 0;
- const TCHAR *szReason = XmlGetText(reason);
+ const wchar_t *szReason = XmlGetText(reason);
if (szReason == NULL) {
if (nStatusCode == 322)
szReason = TranslateT("because room is now members-only");
@@ -328,12 +328,12 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR * void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
{
- TCHAR *szMessage = NULL;
+ wchar_t *szMessage = NULL;
if (code != 307 && code != 301) {
ptrT tszMessage(getTStringA("GcMsgQuit"));
if (tszMessage != NULL)
- szMessage = NEWTSTR_ALLOCA(tszMessage);
+ szMessage = NEWWSTR_ALLOCA(tszMessage);
else
szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
@@ -352,7 +352,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) item->bChatActive = false;
if (m_bJabberOnline) {
- TCHAR szPresenceTo[JABBER_MAX_JID_LEN];
+ wchar_t szPresenceTo[JABBER_MAX_JID_LEN];
mir_sntprintf(szPresenceTo, L"%s/%s", item->jid, item->nick);
m_ThreadInfo->send(
@@ -402,30 +402,30 @@ static void sttShowGcMenuItems(GCMENUITEMS *items, DWORD *ids, int type) static gc_item sttLogListItems[] =
{
- { LPGENT("Change &nickname"), IDM_NICK, MENU_ITEM },
- { LPGENT("&Invite a user"), IDM_INVITE, MENU_ITEM },
+ { LPGENW("Change &nickname"), IDM_NICK, MENU_ITEM },
+ { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Roles"), IDM_ROLE, MENU_NEWPOPUP },
- { LPGENT("&Participant list"), IDM_LST_PARTICIPANT, MENU_POPUPITEM },
- { LPGENT("&Moderator list"), IDM_LST_MODERATOR, MENU_POPUPITEM },
+ { LPGENW("&Roles"), IDM_ROLE, MENU_NEWPOPUP },
+ { LPGENW("&Participant list"), IDM_LST_PARTICIPANT, MENU_POPUPITEM },
+ { LPGENW("&Moderator list"), IDM_LST_MODERATOR, MENU_POPUPITEM },
- { LPGENT("&Affiliations"), IDM_AFFLTN, MENU_NEWPOPUP },
- { LPGENT("&Member list"), IDM_LST_MEMBER, MENU_POPUPITEM },
- { LPGENT("&Admin list"), IDM_LST_ADMIN, MENU_POPUPITEM },
- { LPGENT("&Owner list"), IDM_LST_OWNER, MENU_POPUPITEM },
+ { LPGENW("&Affiliations"), IDM_AFFLTN, MENU_NEWPOPUP },
+ { LPGENW("&Member list"), IDM_LST_MEMBER, MENU_POPUPITEM },
+ { LPGENW("&Admin list"), IDM_LST_ADMIN, MENU_POPUPITEM },
+ { LPGENW("&Owner list"), IDM_LST_OWNER, MENU_POPUPITEM },
{ NULL, 0, MENU_POPUPSEPARATOR },
- { LPGENT("Outcast list (&ban)"), IDM_LST_BAN, MENU_POPUPITEM },
+ { LPGENW("Outcast list (&ban)"), IDM_LST_BAN, MENU_POPUPITEM },
- { LPGENT("&Room options"), 0, MENU_NEWPOPUP },
- { LPGENT("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM },
- { LPGENT("Add to &bookmarks"), IDM_BOOKMARKS, MENU_POPUPITEM },
- { LPGENT("&Configure..."), IDM_CONFIG, MENU_POPUPITEM },
- { LPGENT("&Destroy room"), IDM_DESTROY, MENU_POPUPITEM },
+ { LPGENW("&Room options"), 0, MENU_NEWPOPUP },
+ { LPGENW("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM },
+ { LPGENW("Add to &bookmarks"), IDM_BOOKMARKS, MENU_POPUPITEM },
+ { LPGENW("&Configure..."), IDM_CONFIG, MENU_POPUPITEM },
+ { LPGENW("&Destroy room"), IDM_DESTROY, MENU_POPUPITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("Lin&ks"), 0, MENU_NEWPOPUP },
+ { LPGENW("Lin&ks"), 0, MENU_NEWPOPUP },
{ NULL, IDM_LINK0, 0 },
{ NULL, IDM_LINK1, 0 },
{ NULL, IDM_LINK2, 0 },
@@ -437,33 +437,33 @@ static gc_item sttLogListItems[] = { NULL, IDM_LINK8, 0 },
{ NULL, IDM_LINK9, 0 },
- { LPGENT("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM },
- { LPGENT("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM },
+ { LPGENW("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM },
+ { LPGENW("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Send presence"), 0, MENU_NEWPOPUP },
- { LPGENT("Online"), IDM_PRESENCE_ONLINE, MENU_POPUPITEM },
- { LPGENT("Away"), IDM_PRESENCE_AWAY, MENU_POPUPITEM },
- { LPGENT("Not available"), IDM_PRESENCE_NA, MENU_POPUPITEM },
- { LPGENT("Do not disturb"), IDM_PRESENCE_DND, MENU_POPUPITEM },
- { LPGENT("Free for chat"), IDM_PRESENCE_FREE4CHAT, MENU_POPUPITEM },
+ { LPGENW("&Send presence"), 0, MENU_NEWPOPUP },
+ { LPGENW("Online"), IDM_PRESENCE_ONLINE, MENU_POPUPITEM },
+ { LPGENW("Away"), IDM_PRESENCE_AWAY, MENU_POPUPITEM },
+ { LPGENW("Not available"), IDM_PRESENCE_NA, MENU_POPUPITEM },
+ { LPGENW("Do not disturb"), IDM_PRESENCE_DND, MENU_POPUPITEM },
+ { LPGENW("Free for chat"), IDM_PRESENCE_FREE4CHAT, MENU_POPUPITEM },
- { LPGENT("&Leave chat session"), IDM_LEAVE, MENU_ITEM }
+ { LPGENW("&Leave chat session"), IDM_LEAVE, MENU_ITEM }
};
-static TCHAR sttRJidBuf[JABBER_MAX_JID_LEN] = { 0 };
+static wchar_t sttRJidBuf[JABBER_MAX_JID_LEN] = { 0 };
static gc_item sttListItems[] =
{
- { LPGENT("&Slap"), IDM_SLAP, MENU_ITEM }, // 0
- { LPGENT("&User details"), IDM_VCARD, MENU_ITEM }, // 1
- { LPGENT("Member &info"), IDM_INFO, MENU_ITEM }, // 2
+ { LPGENW("&Slap"), IDM_SLAP, MENU_ITEM }, // 0
+ { LPGENW("&User details"), IDM_VCARD, MENU_ITEM }, // 1
+ { LPGENW("Member &info"), IDM_INFO, MENU_ITEM }, // 2
{ sttRJidBuf, 0, MENU_NEWPOPUP }, // 3 -> accessed explicitly by index!!!
- { LPGENT("User &details"), IDM_RJID_VCARD, MENU_POPUPITEM },
- { LPGENT("&Add to roster"), IDM_RJID_ADD, MENU_POPUPITEM },
- { LPGENT("&Copy to clipboard"), IDM_RJID_COPY, MENU_POPUPITEM },
+ { LPGENW("User &details"), IDM_RJID_VCARD, MENU_POPUPITEM },
+ { LPGENW("&Add to roster"), IDM_RJID_ADD, MENU_POPUPITEM },
+ { LPGENW("&Copy to clipboard"), IDM_RJID_COPY, MENU_POPUPITEM },
- { LPGENT("Invite to room"), 0, MENU_NEWPOPUP },
+ { LPGENW("Invite to room"), 0, MENU_NEWPOPUP },
{ NULL, IDM_LINK0, 0 },
{ NULL, IDM_LINK1, 0 },
{ NULL, IDM_LINK2, 0 },
@@ -477,24 +477,24 @@ static gc_item sttListItems[] = { NULL, 0, MENU_SEPARATOR },
- { LPGENT("Set &role"), IDM_ROLE, MENU_NEWPOPUP },
- { LPGENT("&Visitor"), IDM_SET_VISITOR, MENU_POPUPITEM },
- { LPGENT("&Participant"), IDM_SET_PARTICIPANT, MENU_POPUPITEM },
- { LPGENT("&Moderator"), IDM_SET_MODERATOR, MENU_POPUPITEM },
+ { LPGENW("Set &role"), IDM_ROLE, MENU_NEWPOPUP },
+ { LPGENW("&Visitor"), IDM_SET_VISITOR, MENU_POPUPITEM },
+ { LPGENW("&Participant"), IDM_SET_PARTICIPANT, MENU_POPUPITEM },
+ { LPGENW("&Moderator"), IDM_SET_MODERATOR, MENU_POPUPITEM },
- { LPGENT("Set &affiliation"), IDM_AFFLTN, MENU_NEWPOPUP },
- { LPGENT("&None"), IDM_SET_NONE, MENU_POPUPITEM },
- { LPGENT("&Member"), IDM_SET_MEMBER, MENU_POPUPITEM },
- { LPGENT("&Admin"), IDM_SET_ADMIN, MENU_POPUPITEM },
- { LPGENT("&Owner"), IDM_SET_OWNER, MENU_POPUPITEM },
+ { LPGENW("Set &affiliation"), IDM_AFFLTN, MENU_NEWPOPUP },
+ { LPGENW("&None"), IDM_SET_NONE, MENU_POPUPITEM },
+ { LPGENW("&Member"), IDM_SET_MEMBER, MENU_POPUPITEM },
+ { LPGENW("&Admin"), IDM_SET_ADMIN, MENU_POPUPITEM },
+ { LPGENW("&Owner"), IDM_SET_OWNER, MENU_POPUPITEM },
{ NULL, 0, MENU_POPUPSEPARATOR },
- { LPGENT("Outcast (&ban)"), IDM_SET_BAN, MENU_POPUPITEM },
+ { LPGENW("Outcast (&ban)"), IDM_SET_BAN, MENU_POPUPITEM },
- { LPGENT("&Kick"), IDM_KICK, MENU_ITEM },
+ { LPGENW("&Kick"), IDM_KICK, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM },
- { LPGENT("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM },
- { LPGENT("Copy in-room JID"), IDM_CPY_INROOMJID, MENU_ITEM }
+ { LPGENW("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM },
+ { LPGENW("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM },
+ { LPGENW("Copy in-room JID"), IDM_CPY_INROOMJID, MENU_ITEM }
};
int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
@@ -520,7 +520,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) }
if (gcmi->Type == MENU_ON_LOG) {
- static TCHAR url_buf[1024] = { 0 };
+ static wchar_t url_buf[1024] = { 0 };
gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
@@ -532,16 +532,16 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) sttSetupGcMenuItem(gcmi, 0, FALSE);
int idx = IDM_LINK0;
- TCHAR *ptszStatusMsg = item->getTemp()->m_tszStatusMessage;
+ wchar_t *ptszStatusMsg = item->getTemp()->m_tszStatusMessage;
if (ptszStatusMsg && *ptszStatusMsg) {
- TCHAR *bufPtr = url_buf;
- for (TCHAR *p = _tcsstr(ptszStatusMsg, L"http"); p && *p; p = _tcsstr(p + 1, L"http")) {
- if (!_tcsncmp(p, L"http://", 7) || !_tcsncmp(p, L"https://", 8)) {
+ wchar_t *bufPtr = url_buf;
+ for (wchar_t *p = wcsstr(ptszStatusMsg, L"http"); p && *p; p = wcsstr(p + 1, L"http")) {
+ if (!wcsncmp(p, L"http://", 7) || !wcsncmp(p, L"https://", 8)) {
mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
- for (; *bufPtr && !_istspace(*bufPtr); ++bufPtr);
+ for (; *bufPtr && !iswspace(*bufPtr); ++bufPtr);
*bufPtr++ = 0;
if (++idx > IDM_LINK9)
@@ -603,7 +603,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) if (him->m_tszRealJid && *him->m_tszRealJid) {
mir_sntprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
- if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0;
+ if (wchar_t *tmp = wcschr(sttRJidBuf, '/')) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
gcmi->Item[3].uType = MENU_HMENU;
@@ -653,11 +653,11 @@ class CGroupchatInviteDlg : public CJabberDlgBase struct JabberGcLogInviteDlgJidData
{
int hItem;
- TCHAR jid[JABBER_MAX_JID_LEN];
+ wchar_t jid[JABBER_MAX_JID_LEN];
};
LIST<JabberGcLogInviteDlgJidData> m_newJids;
- TCHAR *m_room;
+ wchar_t *m_room;
CCtrlButton m_btnInvite;
CCtrlEdit m_txtNewJid;
@@ -688,7 +688,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase m_clc.SetTextColor(i, GetSysColor(COLOR_WINDOWTEXT));
}
- void InviteUser(TCHAR *pUser, TCHAR *text)
+ void InviteUser(wchar_t *pUser, wchar_t *text)
{
XmlNode msg(L"message");
HXML invite = msg << XATTR(L"to", m_room) << XATTRID(m_proto->SerialNext())
@@ -701,7 +701,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase }
public:
- CGroupchatInviteDlg(CJabberProto *ppro, const TCHAR *room) :
+ CGroupchatInviteDlg(CJabberProto *ppro, const wchar_t *room) :
CSuper(ppro, IDD_GROUPCHAT_INVITE, NULL),
m_newJids(1),
m_btnInvite(this, IDC_INVITE),
@@ -741,7 +741,7 @@ public: void OnCommand_AddJid(CCtrlButton*)
{
- TCHAR buf[JABBER_MAX_JID_LEN];
+ wchar_t buf[JABBER_MAX_JID_LEN];
m_txtNewJid.GetText(buf, _countof(buf));
m_txtNewJid.SetTextA("");
@@ -805,17 +805,17 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
// Context menu processing
-void CJabberProto::AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal)
+void CJabberProto::AdminSet(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal)
{
m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), to) << XQUERY(ns) << XCHILD(L"item") << XATTR(szItem, itemVal) << XATTR(var, varVal));
}
-void CJabberProto::AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn)
+void CJabberProto::AdminSetReason(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal, const wchar_t *rsn)
{
m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), to) << XQUERY(ns) << XCHILD(L"item") << XATTR(szItem, itemVal) << XATTR(var, varVal) << XCHILD(L"reason", rsn));
}
-void CJabberProto::AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo)
+void CJabberProto::AdminGet(const wchar_t *to, const wchar_t *ns, const wchar_t *var, const wchar_t *varVal, JABBER_IQ_HANDLER foo)
{
m_ThreadInfo->send(XmlNodeIq(AddIQ(foo, JABBER_IQ_TYPE_GET, to))
<< XQUERY(ns) << XCHILD(L"item") << XATTR(var, varVal));
@@ -859,7 +859,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)Skin_LoadProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0);
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf);
@@ -913,7 +913,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam if (dat->him->m_affiliation == value)
break;
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(dat->him->m_tszRealJid, szBareJid, _countof(szBareJid));
switch (value) {
@@ -1014,9 +1014,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (szMessage == NULL)
szMessage = mir_tstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
- TCHAR buf[256];
+ wchar_t buf[256];
// do not use snprintf to avoid possible problems with % symbol
- if (TCHAR *p = _tcsstr(szMessage, L"%s")) {
+ if (wchar_t *p = wcsstr(szMessage, L"%s")) {
*p = 0;
mir_sntprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
}
@@ -1060,7 +1060,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* dwLastBanKickTime = GetTickCount();
szBuffer.Format(L"%s: ", me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to kick %s"), him->m_tszResourceName);
- TCHAR *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
+ wchar_t *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(L"set", ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
@@ -1090,7 +1090,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_NONE:
if (him->m_affiliation != AFFILIATION_NONE) {
if (him->m_tszRealJid) {
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"none");
}
@@ -1101,7 +1101,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_MEMBER:
if (him->m_affiliation != AFFILIATION_MEMBER) {
if (him->m_tszRealJid) {
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"member");
}
@@ -1112,7 +1112,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_ADMIN:
if (him->m_affiliation != AFFILIATION_ADMIN) {
if (him->m_tszRealJid) {
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"admin");
}
@@ -1123,7 +1123,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_OWNER:
if (him->m_affiliation != AFFILIATION_OWNER) {
if (him->m_tszRealJid) {
- TCHAR szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"owner");
}
@@ -1134,7 +1134,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_BAN:
if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
if (him->m_tszRealJid && *him->m_tszRealJid) {
- TCHAR szVictimBareJid[JABBER_MAX_JID_LEN];
+ wchar_t szVictimBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szVictimBareJid, _countof(szVictimBareJid));
szBuffer.Format(L"%s: ", me->m_tszResourceName);
@@ -1153,9 +1153,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_LINK0: case IDM_LINK1: case IDM_LINK2: case IDM_LINK3: case IDM_LINK4:
case IDM_LINK5: case IDM_LINK6: case IDM_LINK7: case IDM_LINK8: case IDM_LINK9:
if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
- TCHAR *resourceName_copy = NEWTSTR_ALLOCA(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
+ wchar_t *resourceName_copy = NEWWSTR_ALLOCA(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
- TCHAR *szInviteTo = 0;
+ wchar_t *szInviteTo = 0;
int idx = gch->dwData - IDM_LINK0;
LISTFOREACH(i, ppro, LIST_CHATROOM)
{
@@ -1201,8 +1201,8 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_VCARD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
- TCHAR *jid = NEWTSTR_ALLOCA(him->m_tszRealJid);
- if (TCHAR *tmp = _tcschr(jid, _T('/')))
+ wchar_t *jid = NEWWSTR_ALLOCA(him->m_tszRealJid);
+ if (wchar_t *tmp = wcschr(jid, '/'))
*tmp = 0;
MCONTACT hContact = ppro->AddToListByJID(jid, PALF_TEMPORARY);
@@ -1218,10 +1218,10 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = NEWTSTR_ALLOCA(him->m_tszRealJid);
- if (TCHAR *tmp = _tcschr(psr.id.t, _T('/')))
+ psr.id.w = NEWWSTR_ALLOCA(him->m_tszRealJid);
+ if (wchar_t *tmp = wcschr(psr.id.w, '/'))
*tmp = 0;
- psr.nick.t = psr.id.t;
+ psr.nick.w = psr.id.w;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
@@ -1278,7 +1278,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g szBuffer = item->nick;
if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != NULL) {
- TCHAR text[1024];
+ wchar_t text[1024];
mir_sntprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer);
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, NULL);
}
@@ -1333,7 +1333,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_LINK5: case IDM_LINK6: case IDM_LINK7: case IDM_LINK8: case IDM_LINK9:
{
int idx = IDM_LINK0;
- for (TCHAR *p = _tcsstr(item->getTemp()->m_tszStatusMessage, L"http://"); p && *p; p = _tcsstr(p + 1, L"http://")) {
+ for (wchar_t *p = wcsstr(item->getTemp()->m_tszStatusMessage, L"http://"); p && *p; p = wcsstr(p + 1, L"http://")) {
if (idx == gch->dwData) {
char *bufPtr, *url = mir_t2a(p);
for (bufPtr = url; *bufPtr && !isspace(*bufPtr); ++bufPtr);
@@ -1361,9 +1361,9 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g /////////////////////////////////////////////////////////////////////////////////////////
// Sends a private message to a chat user
-static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick)
+static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const wchar_t *nick)
{
- TCHAR szFullJid[JABBER_MAX_JID_LEN];
+ wchar_t szFullJid[JABBER_MAX_JID_LEN];
mir_sntprintf(szFullJid, L"%s/%s", item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, true, false);
if (hContact != NULL) {
@@ -1400,10 +1400,10 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) rtrimt(gch->ptszText);
if (m_bJabberOnline) {
- TCHAR tszID[100];
+ wchar_t tszID[100];
int64_t id = (_time64(0) << 16) + (GetTickCount() & 0xFFFF);
- TCHAR *buf = NEWTSTR_ALLOCA(gch->ptszText);
+ wchar_t *buf = NEWWSTR_ALLOCA(gch->ptszText);
UnEscapeChatTags(buf);
m_ThreadInfo->send(
XmlNode(L"message") << XATTR(L"id", _i64tot(id, tszID, 36)) << XATTR(L"to", item->jid) << XATTR(L"type", L"groupchat")
@@ -1436,20 +1436,20 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////////////
-void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn)
+void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str, const wchar_t* rsn)
{
- const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? L"jid" : L"nick";
- TCHAR *roomJid = jidListInfo->roomJid;
+ const wchar_t *field = (jidListInfo->type == MUC_BANLIST || wcschr(str, '@')) ? L"jid" : L"nick";
+ wchar_t *roomJid = jidListInfo->roomJid;
if (jidListInfo->type == MUC_BANLIST) {
AdminSetReason(roomJid, JABBER_FEAT_MUC_ADMIN, field, str, L"affiliation", L"outcast", rsn);
AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList);
}
}
-void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str)
+void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str)
{
- const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? L"jid" : L"nick";
- TCHAR *roomJid = jidListInfo->roomJid;
+ const wchar_t *field = (jidListInfo->type == MUC_BANLIST || wcschr(str, '@')) ? L"jid" : L"nick";
+ wchar_t *roomJid = jidListInfo->roomJid;
switch (jidListInfo->type) {
case MUC_VOICELIST:
@@ -1479,9 +1479,9 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TC }
}
-void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO *jidListInfo, const TCHAR *jid)
+void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO *jidListInfo, const wchar_t *jid)
{
- TCHAR *roomJid = jidListInfo->roomJid;
+ wchar_t *roomJid = jidListInfo->roomJid;
switch (jidListInfo->type) {
case MUC_VOICELIST: // change role to visitor (from participant)
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 2d1250eb88..3070d0b223 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -123,7 +123,7 @@ bool CJabberProto::FilterXml(HXML node, DWORD flags) mir_cslock lck(m_filterInfo.csPatternLock);
- const TCHAR *attrValue;
+ const wchar_t *attrValue;
switch (m_filterInfo.type) {
case TFilterInfo::T_JID:
attrValue = XmlGetAttrValue(node, (flags & JCPF_OUT) ? L"to" : L"from");
@@ -202,18 +202,18 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) if (flags&JCPF_OUT) sttAppendBufRaw(buf, "\\highlight4 ");
sttAppendBufRaw(buf, "<");
sttAppendBufRaw(buf, RTF_BEGINTAGNAME);
- sttAppendBufW(buf, (TCHAR*)XmlGetName(node));
+ sttAppendBufW(buf, (wchar_t*)XmlGetName(node));
sttAppendBufRaw(buf, RTF_ENDTAGNAME);
for (int i = 0; i < XmlGetAttrCount(node); i++) {
- TCHAR *attr = (TCHAR*)xmlGetAttrName(node, i);
+ wchar_t *attr = (wchar_t*)xmlGetAttrName(node, i);
sttAppendBufRaw(buf, " ");
sttAppendBufRaw(buf, RTF_BEGINATTRNAME);
sttAppendBufW(buf, attr);
sttAppendBufRaw(buf, RTF_ENDATTRNAME);
sttAppendBufRaw(buf, "=\"");
sttAppendBufRaw(buf, RTF_BEGINATTRVAL);
- sttAppendBufT(buf, (TCHAR*)XmlGetAttr(node, i));
+ sttAppendBufT(buf, (wchar_t*)XmlGetAttr(node, i));
sttAppendBufRaw(buf, "\"");
sttAppendBufRaw(buf, RTF_ENDATTRVAL);
}
@@ -274,7 +274,7 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) JABBER_LIST_ITEM *item = NULL;
int len = GetWindowTextLength(hwndCombo) + 1;
- TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
+ wchar_t *buf = (wchar_t *)_alloca(len * sizeof(wchar_t));
GetWindowText(hwndCombo, buf, len);
SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0);
@@ -300,7 +300,7 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) struct
{
int type;
- TCHAR *title;
+ wchar_t *title;
char *icon;
}
static filter_modes[] =
@@ -501,7 +501,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) MessageBox(m_hwnd, TranslateT("Can't send data while you are offline."), TranslateT("Jabber Error"), MB_ICONSTOP | MB_OK);
else {
int length = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_CONSOLEIN)) + 1;
- TCHAR *textToSend = (TCHAR *)mir_alloc(length * sizeof(TCHAR));
+ wchar_t *textToSend = (wchar_t *)mir_alloc(length * sizeof(wchar_t));
GetDlgItemText(m_hwnd, IDC_CONSOLEIN, textToSend, length);
int bytesProcessed = 0;
@@ -550,7 +550,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
if (len > _countof(m_proto->m_filterInfo.pattern)) {
- TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
+ wchar_t *buf = (wchar_t *)_alloca(len * sizeof(wchar_t));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 7d49935abc..e93545ca06 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -54,9 +54,9 @@ enum { SD_OVERLAY_NONE, SD_OVERLAY_FAIL, SD_OVERLAY_PROGRESS, SD_OVERLAY_REGISTE static struct
{
- TCHAR *feature;
- TCHAR *category;
- TCHAR *type;
+ wchar_t *feature;
+ wchar_t *category;
+ wchar_t *type;
char *iconName;
int iconIndex;
int listIndex;
@@ -194,7 +194,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pI else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
pNode->SetInfoRequestErrorText(str);
mir_free(str);
}
@@ -234,7 +234,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p else {
if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
pNode->SetItemsRequestErrorText(str);
mir_free(str);
}
@@ -262,7 +262,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo if (query) {
HXML feature;
for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(feature, L"var"), (TCHAR *)pInfo->m_pUserData)) {
+ if (!mir_tstrcmp(XmlGetAttrValue(feature, L"var"), (wchar_t *)pInfo->m_pUserData)) {
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), XmlGetAttrValue(iqNode, L"node"), NULL);
SendBothRequests(pNode, NULL);
break;
@@ -287,8 +287,8 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf if (query) {
HXML item;
for (int i = 1; (item = XmlGetNthChild(query, L"item", i)) != NULL; i++) {
- const TCHAR *szJid = XmlGetAttrValue(item, L"jid");
- const TCHAR *szNode = XmlGetAttrValue(item, L"node");
+ const wchar_t *szJid = XmlGetAttrValue(item, L"jid");
+ const wchar_t *szNode = XmlGetAttrValue(item, L"node");
CJabberIqInfo *pNewInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid);
pNewInfo->m_pUserData = pInfo->m_pUserData;
pNewInfo->SetTimeout(30000);
@@ -384,8 +384,8 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent) void CJabberProto::PerformBrowse(HWND hwndDlg)
{
- TCHAR szJid[JABBER_MAX_JID_LEN];
- TCHAR szNode[512];
+ wchar_t szJid[JABBER_MAX_JID_LEN];
+ wchar_t szNode[512];
if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid)))
szJid[0] = 0;
if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode)))
@@ -408,7 +408,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) LISTFOREACH(i, this, LIST_ROSTER)
{
if ((item = ListGetItemPtrFromIndex(i)) != NULL) {
- if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) {
+ if (wcschr(item->jid, '@') == NULL && wcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) {
MCONTACT hContact = HContactFromJID(item->jid);
if (hContact != NULL)
setByte(hContact, "IsTransport", TRUE);
@@ -424,7 +424,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) }
else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
- TCHAR *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)JABBER_FEAT_MUC;
pInfo->SetTimeout(30000);
@@ -435,7 +435,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) }
else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
sttBrowseMode = SD_BROWSE_AGENTS;
- TCHAR *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)L"jabber:iq:gateway";
pInfo->SetTimeout(30000);
@@ -577,7 +577,7 @@ class CJabberDlgDiscovery : public CJabberDlgBase typedef CJabberDlgBase CSuper;
public:
- CJabberDlgDiscovery(CJabberProto *proto, TCHAR *jid);
+ CJabberDlgDiscovery(CJabberProto *proto, wchar_t *jid);
protected:
void OnInitDialog();
@@ -587,7 +587,7 @@ protected: int Resizer(UTILRESIZECONTROL *urc);
private:
- TCHAR *m_jid;
+ wchar_t *m_jid;
bool m_focusEditAfterBrowse;
CCtrlMButton m_btnViewAsTree;
@@ -607,7 +607,7 @@ private: void lstDiscoTree_OnFilter(CCtrlFilterListView *);
};
-CJabberDlgDiscovery::CJabberDlgDiscovery(CJabberProto *proto, TCHAR *jid) :
+CJabberDlgDiscovery::CJabberDlgDiscovery(CJabberProto *proto, wchar_t *jid) :
CJabberDlgBase(proto, IDD_SERVICE_DISCOVERY, NULL),
m_jid(jid),
m_btnViewAsTree(this, IDC_BTN_VIEWTREE, proto->LoadIconEx("sd_view_tree"), "View as tree"),
@@ -1139,7 +1139,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) }
// extern references to used functions:
-void SearchAddToRecent(TCHAR* szAddr, HWND hwndDialog = NULL);
+void SearchAddToRecent(wchar_t* szAddr, HWND hwndDialog = NULL);
void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM hItem, POINT pt)
{
@@ -1172,36 +1172,36 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM struct
{
- TCHAR *feature;
- TCHAR *title;
+ wchar_t *feature;
+ wchar_t *title;
int action;
DWORD flags;
}
static items[] =
{
- { NULL, LPGENT("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE},
- { NULL, LPGENT("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE},
- { JABBER_FEAT_MUC, LPGENT("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE},
+ { NULL, LPGENW("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE},
+ { NULL, LPGENW("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE},
+ { JABBER_FEAT_MUC, LPGENW("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE},
{0},
- { NULL, LPGENT("Refresh Info"), SD_ACT_REFRESH},
- { NULL, LPGENT("Refresh Children"), SD_ACT_REFRESHCHILDREN},
+ { NULL, LPGENW("Refresh Info"), SD_ACT_REFRESH},
+ { NULL, LPGENW("Refresh Children"), SD_ACT_REFRESHCHILDREN},
{0},
- { NULL, LPGENT("Add to favorites"), SD_ACT_FAVORITE},
- { NULL, LPGENT("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER},
- { JABBER_FEAT_MUC, LPGENT("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER},
- { L"jabber:iq:search", LPGENT("Add search directory"), SD_ACT_ADDDIRECTORY},
- { JABBER_FEAT_BYTESTREAMS, LPGENT("Use this proxy"), SD_ACT_PROXY},
+ { NULL, LPGENW("Add to favorites"), SD_ACT_FAVORITE},
+ { NULL, LPGENW("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER},
+ { JABBER_FEAT_MUC, LPGENW("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER},
+ { L"jabber:iq:search", LPGENW("Add search directory"), SD_ACT_ADDDIRECTORY},
+ { JABBER_FEAT_BYTESTREAMS, LPGENW("Use this proxy"), SD_ACT_PROXY},
{0},
- { JABBER_FEAT_REGISTER, LPGENT("Register"), SD_ACT_REGISTER},
- { L"jabber:iq:gateway", LPGENT("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED},
- { JABBER_FEAT_COMMANDS, LPGENT("Commands..."), SD_ACT_ADHOC},
+ { JABBER_FEAT_REGISTER, LPGENW("Register"), SD_ACT_REGISTER},
+ { L"jabber:iq:gateway", LPGENW("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED},
+ { JABBER_FEAT_COMMANDS, LPGENW("Commands..."), SD_ACT_ADHOC},
{0},
- { L"jabber:iq:gateway", LPGENT("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE},
- { L"jabber:iq:gateway", LPGENT("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE},
+ { L"jabber:iq:gateway", LPGENW("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE},
+ { L"jabber:iq:gateway", LPGENW("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE},
{0},
- { NULL, LPGENT("Copy JID"), SD_ACT_COPYJID},
- { NULL, LPGENT("Copy node name"), SD_ACT_COPYNODE},
- { NULL, LPGENT("Copy node information"), SD_ACT_COPYINFO},
+ { NULL, LPGENW("Copy JID"), SD_ACT_COPYJID},
+ { NULL, LPGENW("Copy node name"), SD_ACT_COPYNODE},
+ { NULL, LPGENW("Copy node information"), SD_ACT_COPYINFO},
};
HMENU hMenu = CreatePopupMenu();
@@ -1224,9 +1224,9 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM continue;
if ((items[i].flags & SD_FLG_NOTONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus == ID_STATUS_OFFLINE))
continue;
- if ((items[i].flags & SD_FLG_NORESOURCE) && _tcschr(pNode->GetJid(), _T('/')))
+ if ((items[i].flags & SD_FLG_NORESOURCE) && wcschr(pNode->GetJid(), '/'))
continue;
- if ((items[i].flags & SD_FLG_HASUSER) && !_tcschr(pNode->GetJid(), _T('@')))
+ if ((items[i].flags & SD_FLG_HASUSER) && !wcschr(pNode->GetJid(), '@'))
continue;
}
@@ -1330,7 +1330,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_COPYINFO:
{
- TCHAR buf[8192];
+ wchar_t buf[8192];
pNode->GetTooltipText(buf, _countof(buf));
JabberCopyText(m_pDlgServiceDiscovery->GetHwnd(), buf);
}
@@ -1407,7 +1407,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_VCARD:
{
- TCHAR *jid = pNode->GetJid();
+ wchar_t *jid = pNode->GetJid();
MCONTACT hContact = HContactFromJID(pNode->GetJid());
if (!hContact)
hContact = AddToListByJID(jid, PALF_TEMPORARY);
@@ -1453,7 +1453,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM }
}
-void CJabberProto::LaunchServiceDiscovery(TCHAR *jid)
+void CJabberProto::LaunchServiceDiscovery(wchar_t *jid)
{
if (m_pDlgServiceDiscovery) {
SetForegroundWindow(m_pDlgServiceDiscovery->GetHwnd());
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index 9c327a60f4..486d4c7289 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -36,12 +36,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CJabberSDIdentity
{
protected:
- TCHAR *m_szCategory;
- TCHAR *m_szType;
- TCHAR *m_szName;
+ wchar_t *m_szCategory;
+ wchar_t *m_szType;
+ wchar_t *m_szName;
CJabberSDIdentity *m_pNext;
public:
- CJabberSDIdentity(const TCHAR *szCategory, const TCHAR *szType, const TCHAR *szName)
+ CJabberSDIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName)
{
m_szCategory = mir_tstrdup(szCategory);
m_szType = mir_tstrdup(szType);
@@ -56,15 +56,15 @@ public: if (m_pNext)
delete m_pNext;
}
- TCHAR *GetCategory()
+ wchar_t *GetCategory()
{
return m_szCategory;
}
- TCHAR *GetType()
+ wchar_t *GetType()
{
return m_szType;
}
- TCHAR *GetName()
+ wchar_t *GetName()
{
return m_szName;
}
@@ -84,10 +84,10 @@ class CJabberSDFeature; class CJabberSDFeature
{
protected:
- TCHAR *m_szVar;
+ wchar_t *m_szVar;
CJabberSDFeature *m_pNext;
public:
- CJabberSDFeature(const TCHAR *szVar)
+ CJabberSDFeature(const wchar_t *szVar)
{
m_szVar = szVar ? mir_tstrdup(szVar) : NULL;
m_pNext = NULL;
@@ -98,7 +98,7 @@ public: if (m_pNext)
delete m_pNext;
}
- TCHAR *GetVar()
+ wchar_t *GetVar()
{
return m_szVar;
}
@@ -117,9 +117,9 @@ public: class CJabberSDNode
{
protected:
- TCHAR *m_szJid;
- TCHAR *m_szNode;
- TCHAR *m_szName;
+ wchar_t *m_szJid;
+ wchar_t *m_szNode;
+ wchar_t *m_szName;
CJabberSDIdentity *m_pIdentities;
CJabberSDFeature *m_pFeatures;
CJabberSDNode *m_pNext;
@@ -129,10 +129,10 @@ protected: int m_nInfoRequestId;
int m_nItemsRequestId;
HTREELISTITEM m_hTreeItem;
- TCHAR *m_szInfoError;
- TCHAR *m_szItemsError;
+ wchar_t *m_szInfoError;
+ wchar_t *m_szItemsError;
public:
- CJabberSDNode(const TCHAR *szJid = NULL, const TCHAR *szNode = NULL, const TCHAR *szName = NULL)
+ CJabberSDNode(const wchar_t *szJid = NULL, const wchar_t *szNode = NULL, const wchar_t *szName = NULL)
{
m_szJid = mir_tstrdup(szJid);
m_szNode = mir_tstrdup(szNode);
@@ -227,25 +227,25 @@ public: {
return m_nItemsRequestId;
}
- BOOL SetJid(TCHAR *szJid)
+ BOOL SetJid(wchar_t *szJid)
{
replaceStrT(m_szJid, szJid);
return TRUE;
}
- TCHAR *GetJid()
+ wchar_t *GetJid()
{
return m_szJid;
}
- BOOL SetNode(TCHAR *szNode)
+ BOOL SetNode(wchar_t *szNode)
{
replaceStrT(m_szNode, szNode);
return TRUE;
}
- TCHAR *GetNode()
+ wchar_t *GetNode()
{
return m_szNode;
}
- TCHAR *GetName()
+ wchar_t *GetName()
{
return m_szName;
}
@@ -291,7 +291,7 @@ public: }
return NULL;
}
- BOOL AddFeature(const TCHAR *szFeature)
+ BOOL AddFeature(const wchar_t *szFeature)
{
if (!szFeature)
return FALSE;
@@ -305,7 +305,7 @@ public: return TRUE;
}
- BOOL AddIdentity(const TCHAR *szCategory, const TCHAR *szType, const TCHAR *szName)
+ BOOL AddIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName)
{
if (!szCategory || !szType)
return FALSE;
@@ -319,7 +319,7 @@ public: return TRUE;
}
- BOOL AddChildNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName)
+ BOOL AddChildNode(const wchar_t *szJid, const wchar_t *szNode, const wchar_t *szName)
{
if (!szJid)
return FALSE;
@@ -333,19 +333,19 @@ public: return TRUE;
}
- BOOL SetItemsRequestErrorText(TCHAR *szError)
+ BOOL SetItemsRequestErrorText(wchar_t *szError)
{
replaceStrT(m_szItemsError, szError);
return TRUE;
}
- BOOL SetInfoRequestErrorText(TCHAR *szError)
+ BOOL SetInfoRequestErrorText(wchar_t *szError)
{
replaceStrT(m_szInfoError, szError);
return TRUE;
}
- BOOL GetTooltipText(TCHAR *szText, int nMaxLength)
+ BOOL GetTooltipText(wchar_t *szText, int nMaxLength)
{
CMString tszTmp;
@@ -388,7 +388,7 @@ public: tszTmp.AppendFormat(L"\r\n%s: %s\r\n", TranslateT("Items request error"), m_szItemsError);
tszTmp.TrimRight();
- _tcsncpy_s(szText, nMaxLength, tszTmp, _TRUNCATE);
+ wcsncpy_s(szText, nMaxLength, tszTmp, _TRUNCATE);
return TRUE;
}
};
@@ -423,7 +423,7 @@ public: return m_pPrimaryNodes;
}
- CJabberSDNode* AddPrimaryNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName)
+ CJabberSDNode* AddPrimaryNode(const wchar_t *szJid, const wchar_t *szNode, const wchar_t *szName)
{
if (!szJid)
return NULL;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index b78c31f4c0..24580a5207 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -41,10 +41,10 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) return 0;
if (ListGetItemPtr(LIST_ROSTER, jid)) {
- if (!_tcschr(jid, _T('@'))) {
- TCHAR szStrippedJid[JABBER_MAX_JID_LEN];
+ if (!wcschr(jid, '@')) {
+ wchar_t szStrippedJid[JABBER_MAX_JID_LEN];
JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
- TCHAR *szDog = _tcschr(szStrippedJid, _T('@'));
+ wchar_t *szDog = wcschr(szStrippedJid, '@');
if (szDog && mir_tstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(L"remove"));
}
@@ -59,7 +59,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// JabberDbSettingChanged - process database changes
-static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING *cws)
+static wchar_t* sttSettingToTchar(DBCONTACTWRITESETTING *cws)
{
switch (cws->value.type) {
case DBVT_ASCIIZ:
@@ -95,7 +95,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC }
}
else {
- TCHAR *p = sttSettingToTchar(cws);
+ wchar_t *p = sttSettingToTchar(cws);
if (cws->value.pszVal != NULL && mir_tstrcmp(p, item->group)) {
debugLog(L"Group set to %s", p);
if (p)
@@ -112,7 +112,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT return;
if (cws->value.type == DBVT_DELETED) {
- TCHAR *nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE);
+ wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE);
AddContactToRoster(item->jid, nick, item->group);
mir_free(nick);
return;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index aef5167c73..a3e2c0776f 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -113,8 +113,8 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) }
else { // FT_INITIALIZING
if (str[0] == '\0') {
- TCHAR *s;
- if ((s = _tcsrchr(ft->httpPath, '/')) != NULL)
+ wchar_t *s;
+ if ((s = wcsrchr(ft->httpPath, '/')) != NULL)
s++;
else
s = ft->httpPath;
@@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
- TCHAR szPort[10];
+ wchar_t szPort[10];
mir_sntprintf(szPort, L"%d", connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
@@ -259,12 +259,12 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
ft->hFileEvent = hEvent;
- TCHAR szPort[20];
+ wchar_t szPort[20];
mir_sntprintf(szPort, L"%d", nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
- TCHAR *ptszResource = ListGetBestClientResourceNamePtr(ft->jid);
+ wchar_t *ptszResource = ListGetBestClientResourceNamePtr(ft->jid);
if (ptszResource != NULL) {
ft->state = FT_CONNECTING;
for (int i = 0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) {
@@ -273,8 +273,8 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) if (ft->httpPath) mir_free(ft->httpPath);
ft->httpPath = NULL;
- TCHAR *p;
- if ((p = _tcschr(ft->std.ptszFiles[i], '\\')) != NULL)
+ wchar_t *p;
+ if ((p = wcschr(ft->std.ptszFiles[i], '\\')) != NULL)
p++;
else
p = ft->std.ptszFiles[i];
@@ -293,7 +293,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) mir_snprintf(szAddr, "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
- TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
+ wchar_t *fulljid = (wchar_t *)alloca(sizeof(wchar_t) * len);
mir_sntprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource);
XmlNodeIq iq(L"set", ft->szId, fulljid);
@@ -380,7 +380,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, num += 2;
currentFile = ft->std.currentFileNumber;
- TCHAR *t = _tcsrchr(ft->std.ptszFiles[currentFile], '\\');
+ wchar_t *t = wcsrchr(ft->std.ptszFiles[currentFile], '\\');
if (t != NULL)
t++;
else
@@ -395,8 +395,8 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, break;
}
debugLog(L"Sending [%s]", ft->std.ptszFiles[currentFile]);
- _tstati64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size
- if ((fileId = _topen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) {
+ _wstat64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size
+ if ((fileId = _wopen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) {
debugLogA("File cannot be opened");
ft->state = FT_ERROR;
mir_free(ft->httpPath);
@@ -500,7 +500,7 @@ int filetransfer::create() if (fileId != -1)
return fileId;
- TCHAR filefull[MAX_PATH];
+ wchar_t filefull[MAX_PATH];
mir_sntprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
replaceStrT(std.tszCurrentFile, filefull);
@@ -513,7 +513,7 @@ int filetransfer::create() if (fileId == -1) {
ppro->debugLog(L"Saving to [%s]", std.tszCurrentFile);
- fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
+ fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
}
if (fileId == -1)
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp index f03bf49ee1..1f86f9705f 100644 --- a/protocols/JabberG/src/jabber_filterlist.cpp +++ b/protocols/JabberG/src/jabber_filterlist.cpp @@ -35,7 +35,7 @@ struct CFilterData : public MZeroedObject HFONT m_hfntNormal;
HFONT m_hfntEmpty;
COLORREF m_clGray;
- TCHAR *m_filterText;
+ wchar_t *m_filterText;
RECT m_rcButtonClear;
RECT m_rcEditBox;
@@ -69,7 +69,7 @@ CCtrlFilterListView::~CCtrlFilterListView() delete fdat;
}
-TCHAR *CCtrlFilterListView::GetFilterText()
+wchar_t *CCtrlFilterListView::GetFilterText()
{
return fdat->m_filterText;
}
@@ -100,7 +100,7 @@ static LRESULT CALLBACK sttEditBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (length == 1)
fdat->m_filterText = 0;
else {
- fdat->m_filterText = (TCHAR *)mir_alloc(sizeof(TCHAR) * length);
+ fdat->m_filterText = (wchar_t *)mir_alloc(sizeof(wchar_t) * length);
GetWindowText(hwnd, fdat->m_filterText, length);
}
@@ -127,9 +127,9 @@ static LRESULT CALLBACK sttEditBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return CallWindowProc(fdat->m_oldWndProc, hwnd, msg, wParam, lParam);
}
-void CCtrlFilterListView::FilterHighlight(TCHAR *str)
+void CCtrlFilterListView::FilterHighlight(wchar_t *str)
{
- TCHAR buf[256];
+ wchar_t buf[256];
int count = GetItemCount();
for (int i=0; i < count; i++) {
bool found = false;
@@ -139,7 +139,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str) if (!*buf)
break;
- if (_tcsstr(buf, str)) {
+ if (wcsstr(buf, str)) {
found = true;
break;
}
@@ -165,12 +165,12 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara case 1:
if (m_trackFilter && fdat->m_hwndEditBox) {
- TCHAR *str = 0;
+ wchar_t *str = 0;
int length = GetWindowTextLength(fdat->m_hwndEditBox) + 1;
if (length == 1)
str = 0;
else {
- str = (TCHAR *)mir_alloc(sizeof(TCHAR) * length);
+ str = (wchar_t *)mir_alloc(sizeof(wchar_t) * length);
GetWindowText(fdat->m_hwndEditBox, str, length);
}
FilterHighlight(str);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 6965e989da..a74abfae40 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -73,7 +73,7 @@ void JabberFormCenterContent(HWND hwndStatic) if ((style & SS_RIGHT) && !(style & WS_TABSTOP)) {
RECT calcRect = rc;
int len = GetWindowTextLength(hWndChild);
- TCHAR *text = (TCHAR*)_alloca(sizeof(TCHAR)*(len + 1));
+ wchar_t *text = (wchar_t*)_alloca(sizeof(wchar_t)*(len + 1));
GetWindowText(hWndChild, text, len + 1);
HDC hdc = GetDC(hWndChild);
HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hWndChild, WM_GETFONT, 0, 0));
@@ -106,25 +106,25 @@ void JabberFormCenterContent(HWND hwndStatic) }
}
-void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
+void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text)
{
if (!text) text = L"";
size_t len = mir_tstrlen(text);
size_t fixedLen = len;
for (int i = 1; i < len; i++)
- if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r')))
+ if ((text[i - 1] == '\n') && (text[i] != '\r'))
++fixedLen;
- TCHAR *fixedText = NULL;
+ wchar_t *fixedText = NULL;
if (fixedLen != len) {
- fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen + 1));
- TCHAR *p = fixedText;
+ fixedText = (wchar_t *)mir_alloc(sizeof(wchar_t) * (fixedLen + 1));
+ wchar_t *p = fixedText;
for (int i = 0; i < len; i++) {
*p = text[i];
- if (i && (text[i] == _T('\n')) && (text[i] != _T('\r'))) {
- *p++ = _T('\r');
- *p = _T('\n');
+ if (i && (text[i] == '\n') && (text[i] != '\r')) {
+ *p++ = '\r';
+ *p = '\n';
}
++p;
}
@@ -142,7 +142,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) SetRect(&rcText, 0, 0, rcText.right - rcText.left, 0);
HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION));
HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0));
- DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
+ DrawTextEx(hdcEdit, (wchar_t *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
@@ -203,7 +203,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) if (fixedText) mir_free(fixedText);
}
-static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type)
+static TJabberFormControlType JabberFormTypeNameToId(const wchar_t *type)
{
if (!mir_tstrcmp(type, L"text-private"))
return JFORM_CTYPE_TEXT_PRIVATE;
@@ -223,7 +223,7 @@ static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type) return JFORM_CTYPE_TEXT_SINGLE;
}
-void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayoutInfo *layout_info, const TCHAR *labelStr, const TCHAR *valueStr)
+void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayoutInfo *layout_info, const wchar_t *labelStr, const wchar_t *valueStr)
{
RECT rcLabel = { 0 }, rcCtrl = { 0 };
if (item->hLabel) {
@@ -286,7 +286,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo CreateWindow(L"static", labelStr, WS_CHILD|WS_VISIBLE|SS_CENTERIMAGE, \
0, 0, 0, 0, hwndStatic, (HMENU)-1, hInst, NULL)
-TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr)
+TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const wchar_t *labelStr, const wchar_t *valueStr)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
if (!controls) {
@@ -376,7 +376,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo return item;
}
-static void JabberFormAddListItem(TJabberFormControlInfo *item, const TCHAR *text, bool selected)
+static void JabberFormAddListItem(TJabberFormControlInfo *item, const wchar_t *text, bool selected)
{
DWORD dwIndex;
switch (item->type) {
@@ -436,8 +436,8 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp HXML v, vs;
- const TCHAR *label, *typeName, *varStr, *str, *valueText;
- TCHAR *labelStr, *valueStr;
+ const wchar_t *label, *typeName, *varStr, *str, *valueText;
+ wchar_t *labelStr, *valueStr;
RECT frameRect;
if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
@@ -487,7 +487,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v))
size += mir_tstrlen(XmlGetText(v)) + 2;
}
- valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
+ valueStr = (wchar_t*)mir_alloc(sizeof(wchar_t)*size);
valueStr[0] = '\0';
for (int j = 0;; j++) {
v = XmlGetChild(n, j);
@@ -576,8 +576,8 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) HWND hFrame, hCtrl;
HXML n, v, o;
int id, j, k, len;
- const TCHAR *varName, *type, *fieldStr, *labelText, *str2;
- TCHAR *p, *q, *str;
+ const wchar_t *varName, *type, *fieldStr, *labelText, *str2;
+ wchar_t *p, *q, *str;
if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
return NULL;
@@ -604,11 +604,11 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
p = str;
while (p != NULL) {
- if ((q = _tcsstr(p, L"\r\n")) != NULL)
+ if ((q = wcsstr(p, L"\r\n")) != NULL)
*q = '\0';
field << XCHILD(L"value", p);
p = q ? q + 2 : NULL;
@@ -617,14 +617,14 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) id++;
}
else if (!mir_tstrcmp(type, L"boolean")) {
- TCHAR buf[10];
- _itot(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10);
+ wchar_t buf[10];
+ _itow(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10);
field << XCHILD(L"value", buf);
id++;
}
else if (!mir_tstrcmp(type, L"list-single")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
v = NULL;
for (j = 0;; j++) {
@@ -654,7 +654,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
// an entry is selected
len = SendMessage(hCtrl, LB_GETTEXTLEN, j, 0);
- if ((str = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR))) != NULL) {
+ if ((str = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t))) != NULL) {
SendMessage(hCtrl, LB_GETTEXT, j, (LPARAM)str);
for (k = 0;; k++) {
o = XmlGetChild(n, k);
@@ -684,7 +684,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) }
else { // everything else is considered "text-single" or "text-private"
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
field << XCHILD(L"value", str);
mir_free(str);
@@ -701,7 +701,7 @@ struct JABBER_FORM_INFO CJabberProto *ppro;
HXML xNode;
- TCHAR defTitle[128]; // Default title if no <title/> in xNode
+ wchar_t defTitle[128]; // Default title if no <title/> in xNode
RECT frameRect; // Clipping region of the frame to scroll
int frameHeight; // Height of the frame (can be eliminated, redundant to frameRect)
int formHeight; // Actual height of the form
@@ -854,14 +854,14 @@ static VOID CALLBACK JabberFormCreateDialogApcProc(void* param) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FORM), NULL, JabberFormDlgProc, (LPARAM)param);
}
-void CJabberProto::FormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata)
+void CJabberProto::FormCreateDialog(HXML xNode, wchar_t* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata)
{
JABBER_FORM_INFO *jfi = new JABBER_FORM_INFO;
memset(jfi, 0, sizeof(JABBER_FORM_INFO));
jfi->ppro = this;
jfi->xNode = xmlCopyNode(xNode);
if (defTitle)
- _tcsncpy_s(jfi->defTitle, defTitle, _TRUNCATE);
+ wcsncpy_s(jfi->defTitle, defTitle, _TRUNCATE);
jfi->pfnSubmit = pfnSubmit;
jfi->userdata = userdata;
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 86faff30b5..c41f958c7b 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -34,7 +34,7 @@ class CJabberInfoFrameItem : public MZeroedObject public:
char *m_pszName;
HANDLE m_hIcolibIcon;
- TCHAR *m_pszText;
+ wchar_t *m_pszText;
LPARAM m_pUserData;
bool m_bCompact;
bool m_bShow;
@@ -56,7 +56,7 @@ public: mir_free(m_pszText);
}
- void SetInfo(HANDLE hIcolibIcon, TCHAR *pszText)
+ void SetInfo(HANDLE hIcolibIcon, wchar_t *pszText)
{
mir_free(m_pszText);
m_pszText = pszText ? mir_tstrdup(pszText) : NULL;
@@ -242,21 +242,21 @@ void CJabberInfoFrame::ReloadFonts() FontIDT fontid = {0};
fontid.cbSize = sizeof(fontid);
- _tcsncpy_s(fontid.group, L"Jabber", _TRUNCATE);
- _tcsncpy_s(fontid.name, L"Frame title", _TRUNCATE);
+ wcsncpy_s(fontid.group, L"Jabber", _TRUNCATE);
+ wcsncpy_s(fontid.name, L"Frame title", _TRUNCATE);
m_clTitle = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntTitle);
m_hfntTitle = CreateFontIndirect(&lfFont);
- _tcsncpy_s(fontid.name, L"Frame text", _TRUNCATE);
+ wcsncpy_s(fontid.name, L"Frame text", _TRUNCATE);
m_clText = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont);
DeleteObject(m_hfntText);
m_hfntText = CreateFontIndirect(&lfFont);
ColourIDT colourid = {0};
colourid.cbSize = sizeof(colourid);
- _tcsncpy_s(colourid.group, L"Jabber", _TRUNCATE);
- _tcsncpy_s(colourid.name, L"Background", _TRUNCATE);
+ wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE);
+ wcsncpy_s(colourid.name, L"Background", _TRUNCATE);
m_clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0);
UpdateSize();
@@ -295,7 +295,7 @@ void CJabberInfoFrame::RemoveTooltip(int id) SendMessage(m_hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
}
-void CJabberInfoFrame::SetToolTip(int id, RECT *rc, TCHAR *pszText)
+void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText)
{
TOOLINFO ti = {0};
ti.cbSize = sizeof(TOOLINFO);
@@ -459,7 +459,7 @@ void CJabberInfoFrame::SetInfoItemCallback(char *pszName, void (CJabberProto::*o pItem->m_onEvent = onEvent;
}
-void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, TCHAR *pszText)
+void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, wchar_t *pszText)
{
if (CJabberInfoFrameItem *pItem = m_pItems.find((CJabberInfoFrameItem*)&pszName))
pItem->SetInfo(hIcolibIcon, pszText);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 0666d4d96c..a7142148d4 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -75,12 +75,12 @@ void CJabberProto::FtCancel(filetransfer *ft) ///////////////// File sending using stream initiation /////////////////////////
-void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft)
+void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft)
{
- TCHAR *rs;
- TCHAR *filename, *p;
+ wchar_t *rs;
+ wchar_t *filename, *p;
int i;
- TCHAR sid[9];
+ wchar_t sid[9];
if (jid == NULL || ft == NULL || !m_bJabberOnline || (rs = ListGetBestClientResourceNamePtr(jid)) == NULL) {
if (ft) {
@@ -96,10 +96,10 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) if (ft->sid != NULL) mir_free(ft->sid);
ft->sid = mir_tstrdup(sid);
filename = ft->std.ptszFiles[ft->std.currentFileNumber];
- if ((p = _tcsrchr(filename, '\\')) != NULL)
+ if ((p = wcsrchr(filename, '\\')) != NULL)
filename = p + 1;
- TCHAR tszJid[512];
+ wchar_t tszJid[512];
mir_sntprintf(tszJid, L"%s/%s", jid, rs);
XmlNodeIq iq(AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
@@ -188,8 +188,8 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft) int numRead;
debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
- _tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
- if ((fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
+ _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
+ if ((fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
debugLog(L"File cannot be opened");
return FALSE;
}
@@ -220,9 +220,9 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft) debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
struct _stati64 statbuf;
- _tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
+ _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
- int fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY);
+ int fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY);
if (fd < 0) {
debugLogA("File cannot be opened");
return FALSE;
@@ -300,7 +300,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft) void CJabberProto::FtHandleSiRequest(HXML iqNode)
{
- const TCHAR *from, *sid, *str, *szId, *filename;
+ const wchar_t *from, *sid, *str, *szId, *filename;
HXML siNode, fileNode, featureNode, xNode, fieldNode, n;
int i;
unsigned __int64 filesize;
@@ -317,7 +317,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) (filename = XmlGetAttrValue(fileNode, L"name")) != NULL &&
(str = XmlGetAttrValue(fileNode, L"size")) != NULL) {
- filesize = _ttoi64(str);
+ filesize = _wtoi64(str);
if ((featureNode = XmlGetChildByTag(siNode, "feature", "xmlns", JABBER_FEAT_FEATURE_NEG)) != NULL &&
(xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL &&
(fieldNode = XmlGetChildByTag(xNode, "field", "var", L"stream-method")) != NULL) {
@@ -378,10 +378,10 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.files.t = (TCHAR**)&filename;
+ pre.files.w = (wchar_t**)&filename;
pre.lParam = (LPARAM)ft;
if ((n = XmlGetChild(fileNode, "desc")) != NULL)
- pre.descr.t = (TCHAR*)XmlGetText(n);
+ pre.descr.w = (wchar_t*)XmlGetText(n);
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
@@ -446,7 +446,7 @@ BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo) {
HXML queryNode = pInfo->GetChildNode();
- const TCHAR *sid;
+ const wchar_t *sid;
JABBER_LIST_ITEM *item;
if ((sid = XmlGetAttrValue(queryNode, L"sid")) != NULL && (item = ListGetItemPtr(LIST_FTRECV, sid)) != NULL) {
@@ -471,15 +471,15 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen) {
if (iqNode == NULL) return FALSE;
- const TCHAR *id = XmlGetAttrValue(iqNode, L"id");
- const TCHAR *from = XmlGetAttrValue(iqNode, L"from");
- const TCHAR *to = XmlGetAttrValue(iqNode, L"to");
+ const wchar_t *id = XmlGetAttrValue(iqNode, L"id");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *to = XmlGetAttrValue(iqNode, L"to");
if (!id || !from || !to) return FALSE;
HXML ibbNode = XmlGetChildByTag(iqNode, bOpen ? "open" : "close", "xmlns", JABBER_FEAT_IBB);
if (!ibbNode) return FALSE;
- const TCHAR *sid = XmlGetAttrValue(ibbNode, L"sid");
+ const wchar_t *sid = XmlGetAttrValue(ibbNode, L"sid");
if (!sid) return FALSE;
// already closed?
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 6394f8a022..9188846f5e 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -40,12 +40,12 @@ struct JabberGcRecentInfo {
ppro = proto;
}
- JabberGcRecentInfo(CJabberProto *proto, const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
+ JabberGcRecentInfo(CJabberProto *proto, const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL)
{
ppro = proto;
fillData(room, server, nick, password);
}
- JabberGcRecentInfo(CJabberProto *proto, const TCHAR *jid)
+ JabberGcRecentInfo(CJabberProto *proto, const wchar_t *jid)
{
ppro = proto;
fillData(jid);
@@ -65,7 +65,7 @@ struct JabberGcRecentInfo m_room = m_server = m_nick = m_password = NULL;
}
- BOOL equals(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
+ BOOL equals(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL)
{
return
null_strequals(m_room, room) &&
@@ -74,7 +74,7 @@ struct JabberGcRecentInfo null_strequals(m_password, password);
}
- BOOL equalsnp(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL)
+ BOOL equalsnp(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL)
{
return
null_strequals(m_room, room) &&
@@ -90,7 +90,7 @@ struct JabberGcRecentInfo SetDlgItemText(hwndDlg, IDC_PASSWORD, m_password ? m_password : L"");
}
- void fillData(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL)
+ void fillData(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL)
{
m_room = mir_tstrdup(room);
m_server = mir_tstrdup(server);
@@ -98,14 +98,14 @@ struct JabberGcRecentInfo m_password = mir_tstrdup(password);
}
- void fillData(const TCHAR *jid)
+ void fillData(const wchar_t *jid)
{
- TCHAR *room, *server, *nick = NULL;
- room = NEWTSTR_ALLOCA(jid);
- server = _tcschr(room, _T('@'));
+ wchar_t *room, *server, *nick = NULL;
+ room = NEWWSTR_ALLOCA(jid);
+ server = wcschr(room, '@');
if (server) {
*server++ = 0;
- nick = _tcschr(server, _T('/'));
+ nick = wcschr(server, '/');
if (nick) *nick++ = 0;
}
else {
@@ -164,7 +164,7 @@ struct JabberGcRecentInfo }
private:
- BOOL null_strequals(const TCHAR *str1, const TCHAR *str2)
+ BOOL null_strequals(const wchar_t *str1, const wchar_t *str2)
{
if (!str1 && !str2) return TRUE;
if (!str1 && str2 && !*str2) return TRUE;
@@ -197,7 +197,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) ptrT password(getTStringA(hContact, "Password"));
if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) {
- TCHAR *p = _tcschr(jid, '@');
+ wchar_t *p = wcschr(jid, '@');
if (p != NULL) {
*p++ = 0;
GroupchatJoinRoom(p, jid, nick, password);
@@ -220,7 +220,7 @@ INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM hContact, LPARAM) return 0;
}
-void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, const TCHAR *nick, const TCHAR *password, bool autojoin)
+void CJabberProto::GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, const wchar_t *nick, const wchar_t *password, bool autojoin)
{
JabberGcRecentInfo info(this);
@@ -245,7 +245,7 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con info.saveRecent(0);
}
- TCHAR text[JABBER_MAX_JID_LEN + 1];
+ wchar_t text[JABBER_MAX_JID_LEN + 1];
mir_sntprintf(text, L"%s@%s/%s", room, server, nick);
JABBER_LIST_ITEM *item = ListAdd(LIST_CHATROOM, text);
@@ -270,10 +270,10 @@ struct RoomInfo {
enum Overlay { ROOM_WAIT, ROOM_FAIL, ROOM_BOOKMARK, ROOM_DEFAULT };
Overlay overlay;
- TCHAR *line1, *line2;
+ wchar_t *line1, *line2;
};
-static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const TCHAR *line1, const TCHAR *line2, const TCHAR *name)
+static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const wchar_t *line1, const wchar_t *line2, const wchar_t *name)
{
RoomInfo *info = (RoomInfo *)mir_alloc(sizeof(RoomInfo));
info->overlay = overlay;
@@ -307,10 +307,10 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) bool found = false;
HXML item;
for (int i = 1; item = XmlGetNthChild(query, L"item", i); i++) {
- const TCHAR *jid = XmlGetAttrValue(item, L"jid");
- TCHAR *name = NEWTSTR_ALLOCA(jid);
+ const wchar_t *jid = XmlGetAttrValue(item, L"jid");
+ wchar_t *name = NEWWSTR_ALLOCA(jid);
if (name) {
- if (TCHAR *p = _tcschr(name, _T('@')))
+ if (wchar_t *p = wcschr(name, '@'))
*p = 0;
}
else name = L"";
@@ -333,7 +333,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) }
else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL,
TranslateT("Jabber Error"),
str,
@@ -386,11 +386,11 @@ class CJabberDlgGcJoin : public CJabberDlgBase CCtrlButton btnOk;
public:
- CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid);
+ CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid);
~CJabberDlgGcJoin();
protected:
- TCHAR *m_jid;
+ wchar_t *m_jid;
void OnInitDialog();
void OnDestroy();
@@ -400,7 +400,7 @@ protected: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
};
-CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid) :
+CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid) :
CSuper(proto, IDD_GROUPCHAT_JOIN, NULL),
btnOk(this, IDOK),
m_jid(mir_tstrdup(jid))
@@ -426,8 +426,8 @@ void CJabberDlgGcJoin::OnInitDialog() HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData) {
- TCHAR *buf = (TCHAR *)GlobalLock(hData);
- if (buf && _tcschr(buf, _T('@')) && !_tcschr(buf, _T(' ')))
+ wchar_t *buf = (wchar_t *)GlobalLock(hData);
+ if (buf && wcschr(buf, '@') && !wcschr(buf, ' '))
pInfo = new JabberGcRecentInfo(m_proto, buf);
GlobalUnlock(hData);
}
@@ -466,7 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog() int i;
for (i = 0; i < 5; i++) {
- TCHAR jid[JABBER_MAX_JID_LEN];
+ wchar_t jid[JABBER_MAX_JID_LEN];
JabberGcRecentInfo info(m_proto);
if (!info.loadRecent(i))
break;
@@ -490,20 +490,20 @@ void CJabberDlgGcJoin::OnDestroy() void CJabberDlgGcJoin::OnBtnOk(CCtrlButton*)
{
- TCHAR text[128];
+ wchar_t text[128];
GetDlgItemText(m_hwnd, IDC_SERVER, text, _countof(text));
- TCHAR *server = NEWTSTR_ALLOCA(text), *room;
+ wchar_t *server = NEWWSTR_ALLOCA(text), *room;
m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server);
GetDlgItemText(m_hwnd, IDC_ROOM, text, _countof(text));
- room = NEWTSTR_ALLOCA(text);
+ room = NEWWSTR_ALLOCA(text);
GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
- TCHAR *nick = NEWTSTR_ALLOCA(text);
+ wchar_t *nick = NEWWSTR_ALLOCA(text);
GetDlgItemText(m_hwnd, IDC_PASSWORD, text, _countof(text));
- TCHAR *password = NEWTSTR_ALLOCA(text);
+ wchar_t *password = NEWWSTR_ALLOCA(text);
m_proto->GroupchatJoinRoom(server, room, nick, password);
}
@@ -620,7 +620,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_RESETCONTENT, 0, 0);
int len = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_SERVER)) + 1;
- TCHAR *server = (TCHAR*)_alloca(len * sizeof(TCHAR));
+ wchar_t *server = (wchar_t*)_alloca(len * sizeof(wchar_t));
GetDlgItemText(m_hwnd, IDC_SERVER, server, len);
if (*server) {
@@ -669,9 +669,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_proto->OnMenuHandleBookmarks(0, 0);
else if (res) {
JABBER_LIST_ITEM *item = (JABBER_LIST_ITEM *)res;
- TCHAR *room = NEWTSTR_ALLOCA(item->jid);
+ wchar_t *room = NEWWSTR_ALLOCA(item->jid);
if (room) {
- TCHAR *server = _tcschr(room, _T('@'));
+ wchar_t *server = wcschr(room, '@');
if (server) {
*server++ = 0;
@@ -711,7 +711,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return CSuper::DlgProc(msg, wParam, lParam);
}
-void CJabberProto::GroupchatJoinRoomByJid(HWND, TCHAR *jid)
+void CJabberProto::GroupchatJoinRoomByJid(HWND, wchar_t *jid)
{
if (m_pDlgJabberJoinGroupchat)
SetForegroundWindow(m_pDlgJabberJoinGroupchat->GetHwnd());
@@ -726,7 +726,7 @@ void CJabberProto::GroupchatJoinRoomByJid(HWND, TCHAR *jid) struct JabberGroupchatChangeNicknameParam
{
- JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const TCHAR *jid_) :
+ JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const wchar_t *jid_) :
ppro(ppro_),
jid(mir_tstrdup(jid_))
{}
@@ -736,7 +736,7 @@ struct JabberGroupchatChangeNicknameParam }
CJabberProto *ppro;
- TCHAR *jid;
+ wchar_t *jid;
};
static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
@@ -767,17 +767,17 @@ static int sttGetStatusCode(HXML node) if (statusNode == NULL)
return -1;
- const TCHAR *statusCode = XmlGetAttrValue(statusNode, L"code");
+ const wchar_t *statusCode = XmlGetAttrValue(statusNode, L"code");
if (statusCode == NULL)
return -1;
- return _ttol(statusCode);
+ return _wtol(statusCode);
}
-void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *oldNick, HXML itemNode)
+void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *oldNick, HXML itemNode)
{
- const TCHAR *jid = XmlGetAttrValue(itemNode, L"jid");
- const TCHAR *newNick = XmlGetAttrValue(itemNode, L"nick");
+ const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid");
+ const wchar_t *newNick = XmlGetAttrValue(itemNode, L"nick");
if (newNick == NULL)
return;
@@ -813,12 +813,12 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *ol void CJabberProto::GroupchatProcessPresence(HXML node)
{
- const TCHAR *from;
+ const wchar_t *from;
if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence")) return;
if ((from = XmlGetAttrValue(node, L"from")) == NULL) return;
- const TCHAR *resource = _tcschr(from, '/');
+ const wchar_t *resource = wcschr(from, '/');
if (resource == NULL || *++resource == '\0')
return;
@@ -829,8 +829,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) pResourceStatus r(item->findResource(resource));
HXML nNode = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
- const TCHAR *cnick = XmlGetText(nNode);
- const TCHAR *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource);
+ const wchar_t *cnick = XmlGetText(nNode);
+ const wchar_t *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource);
// process custom nick change
if (cnick && r && r->m_tszNick && mir_tstrcmp(cnick, r->m_tszNick))
@@ -839,7 +839,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) HXML xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
HXML itemNode = XmlGetChild(xNode, "item");
- const TCHAR *type = XmlGetAttrValue(node, L"type");
+ const wchar_t *type = XmlGetAttrValue(node, L"type");
// entering room or a usual room presence
if (type == NULL || !mir_tstrcmp(type, L"available")) {
@@ -863,7 +863,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) char priority = 0;
if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
- priority = (char)_ttoi(ptszPriority);
+ priority = (char)_wtoi(ptszPriority);
bool bStatusChanged = false, bRoomCreated = false, bAffiliationChanged = false, bRoleChanged = false;
int newRes = ListAddResource(LIST_CHATROOM, from, status, str, priority, cnick) ? GC_EVENT_JOIN : 0;
@@ -947,7 +947,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // leaving room
else if (!mir_tstrcmp(type, L"unavailable")) {
- const TCHAR *str = 0;
+ const wchar_t *str = 0;
if (xNode != NULL && item->nick != NULL) {
HXML reasonNode = XmlGetChild(itemNode, "reason");
str = XmlGetAttrValue(itemNode, L"jid");
@@ -1003,7 +1003,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) ptrT newNick(getTStringA("GcAltNick"));
if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) {
replaceStrT(item->nick, newNick);
- TCHAR text[1024] = { 0 };
+ wchar_t text[1024] = { 0 };
mir_sntprintf(text, L"%s/%s", item->jid, newNick);
SendPresenceTo(m_iStatus, text, NULL);
}
@@ -1024,7 +1024,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) void CJabberProto::GroupchatProcessMessage(HXML node)
{
HXML n, m;
- const TCHAR *from, *type, *p, *nick, *resource;
+ const wchar_t *from, *type, *p, *nick, *resource;
JABBER_LIST_ITEM *item;
CMString imgLink;
@@ -1038,9 +1038,9 @@ void CJabberProto::GroupchatProcessMessage(HXML node) GCDEST gcd = { m_szModuleName, item->jid, 0 };
- const TCHAR *msgText = NULL;
+ const wchar_t *msgText = NULL;
- resource = _tcschr(from, '/');
+ resource = wcschr(from, '/');
if (resource != NULL && *++resource == '\0')
resource = NULL;
@@ -1052,15 +1052,15 @@ void CJabberProto::GroupchatProcessMessage(HXML node) gcd.iType = GC_EVENT_TOPIC;
if (resource == NULL && (m = XmlGetChild(node, "body")) != NULL) {
- const TCHAR *tmpnick = XmlGetText(m);
+ const wchar_t *tmpnick = XmlGetText(m);
if (tmpnick == NULL || *tmpnick == 0)
return;
- const TCHAR *tmptr = _tcsstr(tmpnick, L"has set the subject to:"); //ejabberd
+ const wchar_t *tmptr = wcsstr(tmpnick, L"has set the subject to:"); //ejabberd
if (tmptr == NULL)
- tmptr = _tcsstr(tmpnick, TranslateT("has set the subject to:")); //ejabberd
+ tmptr = wcsstr(tmpnick, TranslateT("has set the subject to:")); //ejabberd
if (tmptr != NULL && *tmptr != 0) {
- *(TCHAR*)(--tmptr) = 0;
+ *(wchar_t*)(--tmptr) = 0;
resource = tmpnick;
}
}
@@ -1079,7 +1079,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource == NULL)
gcd.iType = GC_EVENT_INFORMATION;
- else if (_tcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) {
+ else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) {
msgText += 4;
gcd.iType = GC_EVENT_ACTION;
}
@@ -1144,7 +1144,7 @@ class CGroupchatInviteAcceptDlg : public CJabberDlgBase CMString m_roomJid, m_from, m_reason, m_password;
public:
- CGroupchatInviteAcceptDlg(CJabberProto *ppro, const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password) :
+ CGroupchatInviteAcceptDlg(CJabberProto *ppro, const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password) :
CSuper(ppro, IDD_GROUPCHAT_INVITE_ACCEPT, NULL),
m_roomJid(roomJid), m_from(from), m_reason(reason), m_password(password),
m_accept(this, IDC_ACCEPT)
@@ -1156,7 +1156,7 @@ public: {
CSuper::OnInitDialog();
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
@@ -1171,7 +1171,7 @@ public: void OnCommand_Accept(CCtrlButton*)
{
- TCHAR text[128];
+ wchar_t text[128];
GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
m_proto->AcceptGroupchatInvite(m_roomJid, text, m_password);
EndDialog(m_hwnd, 0);
@@ -1184,7 +1184,7 @@ static void __stdcall sttShowDialog(void *pArg) pDlg->Show();
}
-void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password)
+void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password)
{
if (roomJid == NULL)
return;
@@ -1203,11 +1203,11 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro else CallFunctionAsync(sttShowDialog, new CGroupchatInviteAcceptDlg(this, roomJid, from, reason, password));
}
-void CJabberProto::AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password)
+void CJabberProto::AcceptGroupchatInvite(const wchar_t *roomJid, const wchar_t *reason, const wchar_t *password)
{
- TCHAR room[256], *server, *p;
- _tcsncpy_s(room, roomJid, _TRUNCATE);
- p = _tcstok(room, L"@");
- server = _tcstok(NULL, L"@");
+ wchar_t room[256], *server, *p;
+ wcsncpy_s(room, roomJid, _TRUNCATE);
+ p = wcstok(room, L"@");
+ server = wcstok(NULL, L"@");
GroupchatJoinRoom(server, p, reason, password);
}
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index bec32266dd..f15b3f4776 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -52,8 +52,8 @@ BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo) FtHandleIbbRequest(iqNode, FALSE);
else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"data")) {
BOOL bOk = FALSE;
- const TCHAR *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
- const TCHAR *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
+ const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
+ const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
if (sid && seq && XmlGetText(pInfo->GetChildNode()))
bOk = OnIbbRecvdData(XmlGetText(pInfo->GetChildNode()), sid, seq);
@@ -164,12 +164,12 @@ void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb) JabberIbbFreeJibb(jibb);
}
-BOOL CJabberProto::OnIbbRecvdData(const TCHAR *data, const TCHAR *sid, const TCHAR *seq)
+BOOL CJabberProto::OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const wchar_t *seq)
{
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTRECV, sid);
if (item == NULL) return FALSE;
- WORD wSeq = (WORD)_ttoi(seq);
+ WORD wSeq = (WORD)_wtoi(seq);
if (wSeq != item->jibb->wPacketId) {
if (item->jibb->hEvent)
SetEvent(item->jibb->hEvent);
diff --git a/protocols/JabberG/src/jabber_ibb.h b/protocols/JabberG/src/jabber_ibb.h index 097c14083a..803eff2bbc 100644 --- a/protocols/JabberG/src/jabber_ibb.h +++ b/protocols/JabberG/src/jabber_ibb.h @@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { JIBB_INIT, JIBB_CONNECT, JIBB_SENDING, JIBB_RECVING, JIBB_DONE, JIBB_ERROR } JABBER_IBB_STATE;
typedef struct {
- TCHAR *sid;
- TCHAR *srcJID;
- TCHAR *dstJID;
+ wchar_t *sid;
+ wchar_t *srcJID;
+ wchar_t *dstJID;
unsigned __int64 dwTransferredSize;
JABBER_IBB_STATE state;
HANDLE hEvent;
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index f3739cdece..6d85d38886 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -41,7 +41,7 @@ HIMAGELIST hAdvancedStatusIcon = NULL; struct CTransportProtoTableItem
{
- TCHAR *mask;
+ wchar_t *mask;
char* proto;
};
@@ -110,7 +110,7 @@ CIconPool::~CIconPool() {
}
-void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription)
+void CIconPool::RegisterIcon(const char *name, wchar_t *filename, int iconid, wchar_t *szSection, wchar_t *szDescription)
{
char szSettingName[128];
mir_snprintf(szSettingName, "jabber_%s", name);
@@ -120,10 +120,10 @@ void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHA item->m_szIcolibName = mir_strdup(szSettingName);
SKINICONDESC sid = { 0 };
- sid.defaultFile.t = filename;
+ sid.defaultFile.w = filename;
sid.pszName = szSettingName;
- sid.section.t = szSection;
- sid.description.t = szDescription;
+ sid.section.w = szSection;
+ sid.description.w = szDescription;
sid.flags = SIDF_ALL_TCHAR;
sid.iDefaultIndex = iconid;
item->m_hIcolibItem = IcoLib_AddIcon(&sid);
@@ -194,14 +194,14 @@ HICON CJabberProto::LoadIconEx(const char* name, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// internal functions
-static inline TCHAR qtoupper(TCHAR c)
+static inline wchar_t qtoupper(wchar_t c)
{
return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c;
}
-static BOOL WildComparei(const TCHAR *name, const TCHAR *mask)
+static BOOL WildComparei(const wchar_t *name, const wchar_t *mask)
{
- const TCHAR *last = '\0';
+ const wchar_t *last = '\0';
for (;; mask++, name++) {
if (*mask != '?' && qtoupper(*mask) != qtoupper(*name))
break;
@@ -226,7 +226,7 @@ static BOOL WildComparei(const TCHAR *name, const TCHAR *mask) }
}
-static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
+static BOOL MatchMask(const wchar_t *name, const wchar_t *mask)
{
if (!mask || !name)
return mask == name;
@@ -234,7 +234,7 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask) if (*mask != '|')
return WildComparei(name, mask);
- TCHAR *temp = NEWTSTR_ALLOCA(mask);
+ wchar_t *temp = NEWWSTR_ALLOCA(mask);
for (int e = 1; mask[e] != '\0'; e++) {
int s = e;
while (mask[e] != '\0' && mask[e] != '|')
@@ -270,7 +270,7 @@ static HICON ExtractIconFromPath(const char *path, BOOL * needFree) return hIcon;
}
-static HICON LoadTransportIcon(char *filename, int i, char *IconName, TCHAR *SectName, TCHAR *Description, int internalidx, BOOL *needFree)
+static HICON LoadTransportIcon(char *filename, int i, char *IconName, wchar_t *SectName, wchar_t *Description, int internalidx, BOOL *needFree)
{
char szPath[MAX_PATH], szMyPath[MAX_PATH], szFullPath[MAX_PATH], *str;
BOOL has_proto_icon = FALSE;
@@ -287,9 +287,9 @@ static HICON LoadTransportIcon(char *filename, int i, char *IconName, TCHAR *Sec if (IconName != NULL && SectName != NULL) {
SKINICONDESC sid = { 0 };
sid.hDefaultIcon = (has_proto_icon) ? NULL : Skin_LoadProtoIcon(0, -internalidx);
- sid.section.t = SectName;
+ sid.section.w = SectName;
sid.pszName = IconName;
- sid.description.t = Description;
+ sid.description.w = Description;
sid.defaultFile.a = szMyPath;
sid.iDefaultIndex = i;
sid.flags = SIDF_TCHAR;
@@ -302,12 +302,12 @@ int CJabberProto::LoadAdvancedIcons(int iID) {
char *proto = TransportProtoTable[iID].proto;
char defFile[MAX_PATH] = { 0 };
- TCHAR Group[255];
+ wchar_t Group[255];
char Uname[255];
int first = -1;
HICON empty = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mir_sntprintf(Group, LPGENT("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport"));
+ mir_sntprintf(Group, LPGENW("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport"));
mir_snprintf(defFile, "proto_%s.dll", proto);
if (!hAdvancedStatusIcon)
hAdvancedStatusIcon = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
@@ -316,7 +316,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) for (int i = 0; i < ID_STATUS_ONTHEPHONE - ID_STATUS_OFFLINE; i++) {
BOOL needFree;
int n = skinStatusToJabberStatus[i];
- TCHAR *descr = pcli->pfnGetStatusModeDescription(n + ID_STATUS_OFFLINE, 0);
+ wchar_t *descr = pcli->pfnGetStatusModeDescription(n + ID_STATUS_OFFLINE, 0);
mir_snprintf(Uname, "%s_Transport_%s_%d", m_szModuleName, proto, n);
HICON hicon = LoadTransportIcon(defFile, -skinIconStatusToResourceId[i], Uname, Group, descr, -(n + ID_STATUS_OFFLINE), &needFree);
int index = (m_transportProtoTableStartIndex[iID] == -1) ? -1 : m_transportProtoTableStartIndex[iID] + n;
@@ -332,7 +332,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) return 0;
}
-int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
+int CJabberProto::GetTransportProtoID(wchar_t* TransportDomain)
{
for (int i = 0; i < _countof(TransportProtoTable); i++)
if (MatchMask(TransportDomain, TransportProtoTable[i].mask))
@@ -404,22 +404,22 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// Transport check functions
-BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hContact)
+BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hContact)
{
// check if transport is already set
if (!jid || !hContact)
return FALSE;
// strip domain part from jid
- TCHAR *domain = _tcschr((TCHAR*)jid, '@');
+ wchar_t *domain = wcschr((wchar_t*)jid, '@');
BOOL isAgent = (domain == NULL) ? TRUE : FALSE;
BOOL isTransported = FALSE;
if (domain != NULL)
- domain = NEWTSTR_ALLOCA(domain + 1);
+ domain = NEWWSTR_ALLOCA(domain + 1);
else
- domain = NEWTSTR_ALLOCA(jid);
+ domain = NEWWSTR_ALLOCA(jid);
- TCHAR *resourcepos = _tcschr(domain, '/');
+ wchar_t *resourcepos = wcschr(domain, '/');
if (resourcepos != NULL)
*resourcepos = '\0';
diff --git a/protocols/JabberG/src/jabber_icolib.h b/protocols/JabberG/src/jabber_icolib.h index a512a71677..e91d393eb0 100644 --- a/protocols/JabberG/src/jabber_icolib.h +++ b/protocols/JabberG/src/jabber_icolib.h @@ -35,7 +35,7 @@ public: CIconPool();
~CIconPool();
- void RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription);
+ void RegisterIcon(const char *name, wchar_t *filename, int iconid, wchar_t *szSection, wchar_t *szDescription);
HANDLE GetIcolibHandle(const char *name);
char *GetIcolibName(const char *name);
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index ca7020a25e..60040145af 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -201,7 +201,7 @@ void CJabberIqManager::ExpireAll() ExpireInfo(pInfo);
}
-CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const TCHAR *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority)
+CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const wchar_t *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority)
{
CJabberIqInfo *pInfo = new CJabberIqInfo();
pInfo->m_pHandler = pHandler;
@@ -243,7 +243,7 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) if (nIqId == -1 || pNode == NULL)
return false;
- const TCHAR *szType = XmlGetAttrValue(pNode, L"type");
+ const wchar_t *szType = XmlGetAttrValue(pNode, L"type");
if (!szType)
return false;
@@ -266,21 +266,21 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) pInfo->m_pChildNode = XmlGetChild(pNode , 0);
if (pInfo->m_pChildNode && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_NAME))
- pInfo->m_szChildTagName = (TCHAR*)XmlGetName(pInfo->m_pChildNode);
+ pInfo->m_szChildTagName = (wchar_t*)XmlGetName(pInfo->m_pChildNode);
if (pInfo->m_pChildNode && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_XMLNS))
- pInfo->m_szChildTagXmlns = (TCHAR*)XmlGetAttrValue(pNode, L"xmlns");
+ pInfo->m_szChildTagXmlns = (wchar_t*)XmlGetAttrValue(pNode, L"xmlns");
}
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_TO)
- pInfo->m_szTo = (TCHAR*)XmlGetAttrValue(pNode, L"to");
+ pInfo->m_szTo = (wchar_t*)XmlGetAttrValue(pNode, L"to");
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_FROM)
- pInfo->m_szFrom = (TCHAR*)XmlGetAttrValue(pNode, L"from");
+ pInfo->m_szFrom = (wchar_t*)XmlGetAttrValue(pNode, L"from");
if (pInfo->m_szFrom && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT))
pInfo->m_hContact = ppro->HContactFromJID(pInfo->m_szFrom);
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_ID_STR)
- pInfo->m_szId = (TCHAR*)XmlGetAttrValue(pNode, L"id");
+ pInfo->m_szId = (wchar_t*)XmlGetAttrValue(pNode, L"id");
(ppro->*(pInfo->m_pHandler))(pNode, pInfo);
delete pInfo;
@@ -294,7 +294,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) for (int i = 0; i < m_arHandlers.getCount(); i++) {
CJabberIqPermanentInfo &pInfo = m_arHandlers[i];
// have to get all data here, in the loop, because there's always possibility that previous handler modified it
- const TCHAR *szType = XmlGetAttrValue(pNode, L"type");
+ const wchar_t *szType = XmlGetAttrValue(pNode, L"type");
if (!szType)
return FALSE;
@@ -314,24 +314,24 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) if (!pFirstChild || !XmlGetName(pFirstChild))
return FALSE;
- const TCHAR *szTagName = XmlGetName(pFirstChild);
- const TCHAR *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns");
+ const wchar_t *szTagName = XmlGetName(pFirstChild);
+ const wchar_t *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns");
if ((!pInfo.m_szXmlns || (szXmlns && !mir_tstrcmp(pInfo.m_szXmlns, szXmlns))) &&
(!pInfo.m_szTag || !mir_tstrcmp(pInfo.m_szTag, szTagName)))
{
// node suits handler criteria, call the handler
iqInfo.m_pChildNode = pFirstChild;
- iqInfo.m_szChildTagName = (TCHAR*)szTagName;
- iqInfo.m_szChildTagXmlns = (TCHAR*)szXmlns;
- iqInfo.m_szId = (TCHAR*)XmlGetAttrValue(pNode, L"id");
+ iqInfo.m_szChildTagName = (wchar_t*)szTagName;
+ iqInfo.m_szChildTagXmlns = (wchar_t*)szXmlns;
+ iqInfo.m_szId = (wchar_t*)XmlGetAttrValue(pNode, L"id");
iqInfo.m_pUserData = pInfo.m_pUserData;
if (pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_TO)
- iqInfo.m_szTo = (TCHAR*)XmlGetAttrValue(pNode, L"to");
+ iqInfo.m_szTo = (wchar_t*)XmlGetAttrValue(pNode, L"to");
if (pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_FROM)
- iqInfo.m_szFrom = (TCHAR*)XmlGetAttrValue(pNode, L"from");
+ iqInfo.m_szFrom = (wchar_t*)XmlGetAttrValue(pNode, L"from");
if ((pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (iqInfo.m_szFrom))
iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom);
@@ -406,9 +406,9 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler( JABBER_PERMANENT_IQ_HANDLER pHandler,
int nIqTypes,
DWORD dwParamsToParse,
- const TCHAR *szXmlns,
+ const wchar_t *szXmlns,
BOOL bAllowPartialNs,
- const TCHAR *szTag,
+ const wchar_t *szTag,
void *pUserData,
IQ_USER_DATA_FREE_FUNC pUserDataFree,
int iPriority)
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index a985701c30..6d5b75d68a 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -59,19 +59,19 @@ protected: DWORD m_dwParamsToParse;
DWORD m_dwRequestTime;
DWORD m_dwTimeout;
- TCHAR *m_szReceiver;
+ wchar_t *m_szReceiver;
int m_iPriority;
public:
void *m_pUserData;
int m_nIqType;
- TCHAR *m_szFrom;
- TCHAR *m_szChildTagXmlns;
- TCHAR *m_szChildTagName;
+ wchar_t *m_szFrom;
+ wchar_t *m_szChildTagXmlns;
+ wchar_t *m_szChildTagName;
HXML m_pChildNode;
MCONTACT m_hContact;
- TCHAR *m_szTo;
- TCHAR *m_szId;
+ wchar_t *m_szTo;
+ wchar_t *m_szId;
public:
__forceinline CJabberIqInfo()
@@ -81,7 +81,7 @@ public: { mir_free(m_szReceiver);
}
- __forceinline void SetReceiver(const TCHAR *szReceiver) { replaceStrT(m_szReceiver, szReceiver); }
+ __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrT(m_szReceiver, szReceiver); }
__forceinline void SetParamsToParse(DWORD dwParamsToParse) { m_dwParamsToParse = dwParamsToParse; }
__forceinline void SetTimeout(DWORD dwTimeout) { m_dwTimeout = dwTimeout; }
@@ -89,13 +89,13 @@ public: __forceinline DWORD GetRequestTime() const { return m_dwRequestTime; }
__forceinline int GetIqType() const { return m_nIqType; }
__forceinline void* GetUserData() const { return m_pUserData; }
- __forceinline TCHAR* GetFrom() const { return m_szFrom; }
- __forceinline TCHAR* GetTo() const { return m_szTo; }
- __forceinline TCHAR* GetIdStr() const { return m_szId; }
+ __forceinline wchar_t* GetFrom() const { return m_szFrom; }
+ __forceinline wchar_t* GetTo() const { return m_szTo; }
+ __forceinline wchar_t* GetIdStr() const { return m_szId; }
__forceinline MCONTACT GetHContact() const { return m_hContact; }
__forceinline HXML GetChildNode() const { return m_pChildNode; }
- __forceinline TCHAR* GetChildNodeName() const { return m_szChildTagName; }
- __forceinline TCHAR* GetReceiver() const { return m_szReceiver; }
+ __forceinline wchar_t* GetChildNodeName() const { return m_szChildTagName; }
+ __forceinline wchar_t* GetReceiver() const { return m_szReceiver; }
__forceinline int GetPriority() const { return m_iPriority; }
char* GetCharIqType()
@@ -117,8 +117,8 @@ class CJabberIqPermanentInfo : public MZeroedObject JABBER_PERMANENT_IQ_HANDLER m_pHandler;
DWORD m_dwParamsToParse;
int m_nIqTypes;
- TCHAR *m_szXmlns;
- TCHAR *m_szTag;
+ wchar_t *m_szXmlns;
+ wchar_t *m_szTag;
BOOL m_bAllowPartialNs;
void *m_pUserData;
IQ_USER_DATA_FREE_FUNC m_pUserDataFree;
@@ -165,8 +165,8 @@ public: void Shutdown();
// fucking params, maybe just return CJabberIqRequestInfo pointer ?
- CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const TCHAR *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority);
- CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
+ CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const wchar_t *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority);
+ CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const wchar_t *szXmlns, BOOL bAllowPartialNs, const wchar_t *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
// returns TRUE when pInfo found, or FALSE otherwise
bool DeletePermanentHandler(CJabberIqPermanentInfo *pInfo);
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index a8f4f31e8f..9a87819646 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -42,7 +42,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) query << XCHILD(L"version", szCoreVersion);
if (m_options.ShowOSVersion) {
- TCHAR os[256] = { 0 };
+ wchar_t os[256] = { 0 };
if (!GetOSDisplayString(os, _countof(os)))
mir_tstrncpy(os, L"Microsoft Windows", _countof(os));
query << XCHILD(L"os", os);
@@ -98,8 +98,8 @@ int GetGMTOffset(void) // entity time (XEP-0202) support
BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo)
{
- TCHAR stime[100];
- TCHAR szTZ[10];
+ wchar_t stime[100];
+ wchar_t szTZ[10];
TimeZone_PrintDateTime(UTC_TIME_HANDLE, L"I", stime, _countof(stime), 0);
@@ -120,7 +120,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) {
struct tm *gmt;
time_t ltime;
- TCHAR stime[100], *dtime;
+ wchar_t stime[100], *dtime;
_tzset();
time(<ime);
@@ -128,7 +128,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) mir_sntprintf(stime, L"%.4i%.2i%.2iT%.2i:%.2i:%.2i",
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
- dtime = _tctime(<ime);
+ dtime = _wctime(<ime);
dtime[24] = 0;
XmlNodeIq iq(L"result", pInfo);
@@ -151,7 +151,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) if (pictureType == PA_FORMAT_UNKNOWN)
return TRUE;
- TCHAR *szMimeType;
+ wchar_t *szMimeType;
switch (pictureType) {
case PA_FORMAT_JPEG: szMimeType = L"image/jpeg"; break;
case PA_FORMAT_GIF: szMimeType = L"image/gif"; break;
@@ -160,10 +160,10 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) default: return TRUE;
}
- TCHAR szFileName[MAX_PATH];
+ wchar_t szFileName[MAX_PATH];
GetAvatarFileName(NULL, szFileName, _countof(szFileName));
- FILE* in = _tfopen(szFileName, L"rb");
+ FILE* in = _wfopen(szFileName, L"rb");
if (in == NULL)
return TRUE;
@@ -184,7 +184,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) BOOL CJabberProto::OnSiRequest(HXML node, CJabberIqInfo *pInfo)
{
- const TCHAR *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile");
+ const wchar_t *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile");
if (szProfile && !mir_tstrcmp(szProfile, JABBER_FEAT_SI_FT))
FtHandleSiRequest(node);
@@ -204,20 +204,20 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // RFC 3921 #7.2 Business Rules
if (pInfo->GetFrom()) {
- TCHAR *szFrom = JabberPrepareJid(pInfo->GetFrom());
+ wchar_t *szFrom = JabberPrepareJid(pInfo->GetFrom());
if (!szFrom)
return TRUE;
- TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
+ wchar_t *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
if (!szTo) {
mir_free(szFrom);
return TRUE;
}
- TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
+ wchar_t *pDelimiter = wcschr(szFrom, '/');
if (pDelimiter) *pDelimiter = 0;
- pDelimiter = _tcschr(szTo, _T('/'));
+ pDelimiter = wcschr(szTo, '/');
if (pDelimiter) *pDelimiter = 0;
BOOL bRetVal = mir_tstrcmp(szFrom, szTo) == 0;
@@ -232,7 +232,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) }
}
- const TCHAR *jid, *str;
+ const wchar_t *jid, *str;
debugLogA("<iq/> Got roster push, query has %d children", XmlGetChildCount(queryNode));
for (int i = 0;; i++) {
@@ -249,7 +249,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // we will not add new account when subscription=remove
if (!mir_tstrcmp(str, L"to") || !mir_tstrcmp(str, L"both") || !mir_tstrcmp(str, L"from") || !mir_tstrcmp(str, L"none")) {
- const TCHAR *name = XmlGetAttrValue(itemNode, L"name");
+ const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
ptrT nick((name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid));
if (nick != NULL) {
MCONTACT hContact = HContactFromJID(jid, false);
@@ -343,16 +343,16 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->httpPath = NULL;
// Parse the URL
- TCHAR *str = (TCHAR*)XmlGetText(n); // URL of the file to get
- if (!_tcsnicmp(str, L"http://", 7)) {
- TCHAR *p = str + 7, *q;
- if ((q = _tcschr(p, '/')) != NULL) {
- TCHAR text[1024];
+ wchar_t *str = (wchar_t*)XmlGetText(n); // URL of the file to get
+ if (!wcsnicmp(str, L"http://", 7)) {
+ wchar_t *p = str + 7, *q;
+ if ((q = wcschr(p, '/')) != NULL) {
+ wchar_t text[1024];
if (q - p < _countof(text)) {
- _tcsncpy_s(text, p, q - p);
+ wcsncpy_s(text, p, q - p);
text[q - p] = '\0';
- if ((p = _tcschr(text, ':')) != NULL) {
- ft->httpPort = (WORD)_ttoi(p + 1);
+ if ((p = wcschr(text, ':')) != NULL) {
+ ft->httpPort = (WORD)_wtoi(p + 1);
*p = '\0';
}
ft->httpHostName = mir_t2a(text);
@@ -364,15 +364,15 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->szId = JabberId2string(pInfo->GetIqId());
if (ft->httpHostName && ft->httpPath) {
- TCHAR *desc = NULL;
+ wchar_t *desc = NULL;
debugLogA("Host=%s Port=%d Path=%s", ft->httpHostName, ft->httpPort, ft->httpPath);
if ((n = XmlGetChild(pInfo->GetChildNode(), "desc")) != NULL)
- desc = (TCHAR*)XmlGetText(n);
+ desc = (wchar_t*)XmlGetText(n);
- TCHAR *str2;
+ wchar_t *str2;
debugLog(L"description = %s", desc);
- if ((str2 = _tcsrchr(ft->httpPath, '/')) != NULL)
+ if ((str2 = wcsrchr(ft->httpPath, '/')) != NULL)
str2++;
else
str2 = ft->httpPath;
@@ -382,8 +382,8 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) PROTORECVFILET pre;
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = time(NULL);
- pre.descr.t = desc;
- pre.files.t = &str2;
+ pre.descr.w = desc;
+ pre.files.w = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
@@ -404,7 +404,7 @@ BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo) if (!pInfo->GetChildNode())
return TRUE;
- const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
+ const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
// caps hack
if (m_clientCapsManager.HandleInfoRequest(iqNode, pInfo, szNode))
return TRUE;
@@ -427,7 +427,7 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo) return TRUE;
// ad-hoc commands check:
- const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
+ const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
if (szNode && m_adhocManager.HandleItemsRequest(iqNode, pInfo, szNode))
return TRUE;
@@ -473,9 +473,9 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo) if (!pConfirm)
return TRUE;
- const TCHAR *szId = XmlGetAttrValue(pConfirm, L"id");
- const TCHAR *szMethod = XmlGetAttrValue(pConfirm, L"method");
- const TCHAR *szUrl = XmlGetAttrValue(pConfirm, L"url");
+ const wchar_t *szId = XmlGetAttrValue(pConfirm, L"id");
+ const wchar_t *szMethod = XmlGetAttrValue(pConfirm, L"method");
+ const wchar_t *szUrl = XmlGetAttrValue(pConfirm, L"url");
if (!szId || !szMethod || !szUrl)
return TRUE;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 61fe3f353d..de177c797d 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -34,7 +34,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (iqNode == NULL)
return;
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (mir_tstrcmp(type, L"result"))
return;
@@ -63,7 +63,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (m_ThreadInfo) {
HXML feature;
for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) {
- const TCHAR *featureName = XmlGetAttrValue(feature, L"var");
+ const wchar_t *featureName = XmlGetAttrValue(feature, L"var");
if (!featureName)
continue;
@@ -81,7 +81,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInfo)
{
- const TCHAR *szGroupDelimeter = NULL;
+ const wchar_t *szGroupDelimeter = NULL;
bool bPrivateStorageSupport = false;
if (iqNode && pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
@@ -102,7 +102,7 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInf << XCHILD(L"roster", L"\\") << XATTR(L"xmlns", JABBER_FEAT_NESTED_ROSTER_GROUPS));
// roster request
- TCHAR *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\");
+ wchar_t *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\");
m_ThreadInfo->send(
XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetRoster, JABBER_IQ_TYPE_GET, NULL, 0, -1, (void*)szUserData))
<< XCHILDNS(L"query", JABBER_FEAT_IQ_ROSTER));
@@ -141,11 +141,11 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) for (int j=0; j < ll.getCount(); j++) {
JABBER_LIST_ITEM *item = ll[j];
- TCHAR room[256], text[128];
- _tcsncpy_s(text, item->jid, _TRUNCATE);
- _tcsncpy_s(room, text, _TRUNCATE);
- TCHAR *p = _tcstok(room, L"@");
- TCHAR *server = _tcstok(NULL, L"@");
+ wchar_t room[256], text[128];
+ wcsncpy_s(text, item->jid, _TRUNCATE);
+ wcsncpy_s(room, text, _TRUNCATE);
+ wchar_t *p = wcstok(room, L"@");
+ wchar_t *server = wcstok(NULL, L"@");
if (item->nick && item->nick[0])
GroupchatJoinRoom(server, p, item->nick, item->password, true);
else {
@@ -215,7 +215,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdGetAuth");
HXML queryNode;
- const TCHAR *type;
+ const wchar_t *type;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
@@ -246,7 +246,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) {
m_ThreadInfo->send("</stream:stream>");
- TCHAR text[128];
+ wchar_t text[128];
mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
@@ -256,7 +256,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*)
{
- const TCHAR *type;
+ const wchar_t *type;
// RECVED: authentication result
// ACTION: if successfully logged in, continue by requesting roster list and set my initial status
@@ -272,7 +272,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) }
// What to do if password error? etc...
else if (!mir_tstrcmp(type, L"error")) {
- TCHAR text[128];
+ wchar_t text[128];
m_ThreadInfo->send("</stream:stream>");
mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
@@ -289,11 +289,11 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
- if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
+ if (!wcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
debugLog(L"Result Bind: %s confirmed ", m_ThreadInfo->fullJID);
else {
debugLog(L"Result Bind: %s changed to %s", m_ThreadInfo->fullJID, szJid);
- _tcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE);
+ wcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE);
}
}
if (m_ThreadInfo->bIsSessionAvailable)
@@ -322,8 +322,8 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) if (roomjid == NULL)
return;
- TCHAR *room = roomjid;
- TCHAR *server = _tcschr(roomjid, '@');
+ wchar_t *room = roomjid;
+ wchar_t *server = wcschr(roomjid, '@');
if (!server)
return;
@@ -345,7 +345,7 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
{
debugLogA("<iq/> iqIdGetRoster");
- TCHAR *szGroupDelimeter = (TCHAR *)pInfo->GetUserData();
+ wchar_t *szGroupDelimeter = (wchar_t *)pInfo->GetUserData();
if (pInfo->GetIqType() != JABBER_IQ_TYPE_RESULT) {
mir_free(szGroupDelimeter);
return;
@@ -380,7 +380,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (mir_tstrcmp(XmlGetName(itemNode), L"item"))
continue;
- const TCHAR *str = XmlGetAttrValue(itemNode, L"subscription");
+ const wchar_t *str = XmlGetAttrValue(itemNode, L"subscription");
JABBER_SUBSCRIPTION sub;
if (str == NULL) sub = SUB_NONE;
@@ -389,14 +389,14 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) else if (!mir_tstrcmp(str, L"from")) sub = SUB_FROM;
else sub = SUB_NONE;
- const TCHAR *jid = XmlGetAttrValue(itemNode, L"jid");
+ const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid");
if (jid == NULL)
continue;
- if (_tcschr(jid, '@') == NULL)
+ if (wcschr(jid, '@') == NULL)
bIsTransport = true;
- const TCHAR *name = XmlGetAttrValue(itemNode, L"name");
- TCHAR *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid);
+ const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
+ wchar_t *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid);
if (nick == NULL)
continue;
@@ -414,10 +414,10 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) // check group delimiters:
if (item->group && szGroupDelimeter) {
- while (TCHAR *szPos = _tcsstr(item->group, szGroupDelimeter)) {
+ while (wchar_t *szPos = wcsstr(item->group, szGroupDelimeter)) {
*szPos = 0;
szPos += mir_tstrlen(szGroupDelimeter);
- TCHAR *szNewGroup = (TCHAR *)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2));
+ wchar_t *szNewGroup = (wchar_t *)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2));
mir_tstrcpy(szNewGroup, item->group);
mir_tstrcat(szNewGroup, L"\\");
mir_tstrcat(szNewGroup, szPos);
@@ -443,9 +443,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszID = jid;
- gcw.ptszName = NEWTSTR_ALLOCA(jid);
+ gcw.ptszName = NEWWSTR_ALLOCA(jid);
- TCHAR *p = (TCHAR*)_tcschr(gcw.ptszName, '@');
+ wchar_t *p = (wchar_t*)wcschr(gcw.ptszName, '@');
if (p)
*p = 0;
@@ -478,7 +478,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) setByte(hContact, "IsTransport", false);
}
- const TCHAR *imagepath = XmlGetAttrValue(itemNode, L"vz:img");
+ const wchar_t *imagepath = XmlGetAttrValue(itemNode, L"vz:img");
if (imagepath)
httpavatars->insert(new JABBER_HTTP_AVATARS(imagepath, hContact));
}
@@ -529,7 +529,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdGetRegister");
HXML queryNode;
- const TCHAR *type;
+ const wchar_t *type;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
@@ -540,7 +540,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) {
if (m_hwndAgentRegInput) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 0 /*error*/, (LPARAM)str);
mir_free(str);
}
@@ -553,7 +553,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) // ACTION: notify of successful agent registration
debugLogA("<iq/> iqIdSetRegister");
- const TCHAR *type, *from;
+ const wchar_t *type, *from;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((from = XmlGetAttrValue(iqNode, L"from")) == NULL) return;
@@ -568,7 +568,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) {
if (m_hwndRegProgress) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
}
@@ -594,11 +594,11 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP if (buffer == NULL)
return;
- const TCHAR *szPicType = JabberGetPictureType(n, buffer);
+ const wchar_t *szPicType = JabberGetPictureType(n, buffer);
if (szPicType == NULL)
return;
- TCHAR szAvatarFileName[MAX_PATH];
+ wchar_t szAvatarFileName[MAX_PATH];
GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName));
debugLog(L"Picture file name set to %s", szAvatarFileName);
@@ -644,19 +644,19 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP DeleteFile(szAvatarFileName);
}
-static TCHAR* sttGetText(HXML node, char* tag)
+static wchar_t* sttGetText(HXML node, char* tag)
{
HXML n = XmlGetChild(node, tag);
if (n == NULL)
return NULL;
- return (TCHAR*)XmlGetText(n);
+ return (wchar_t*)XmlGetText(n);
}
void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
{
HXML vCardNode, m, n, o;
- const TCHAR *type, *jid;
+ const wchar_t *type, *jid;
MCONTACT hContact;
DBVARIANT dbv;
@@ -673,11 +673,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.nick.t = sttGetText(vCardNode, "NICKNAME");
- psr.firstName.t = sttGetText(vCardNode, "FN");
- psr.lastName.t = L"";
- psr.email.t = sttGetText(vCardNode, "EMAIL");
- psr.id.t = NEWTSTR_ALLOCA(jid);
+ psr.nick.w = sttGetText(vCardNode, "NICKNAME");
+ psr.firstName.w = sttGetText(vCardNode, "FN");
+ psr.lastName.w = L"";
+ psr.email.w = sttGetText(vCardNode, "EMAIL");
+ psr.id.w = NEWWSTR_ALLOCA(jid);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -689,7 +689,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
size_t len = mir_tstrlen(m_szJabberJID);
- if (!_tcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) {
+ if (!wcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) {
hContact = NULL;
debugLogA("Vcard for myself");
}
@@ -783,7 +783,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) // Birthday
if (!hasBday && XmlGetText(n) != NULL) {
if (hContact != NULL) {
- if (_stscanf(XmlGetText(n), L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) {
+ if (swscanf(XmlGetText(n), L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) {
hasBday = true;
setWord(hContact, "BirthYear", (WORD)nYear);
setByte(hContact, "BirthMonth", (BYTE)nMonth);
@@ -822,7 +822,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(XmlGetName(n), L"ADR")) {
if (!hasHome && XmlGetChild(n, "HOME") != NULL) {
// Home address
- TCHAR text[128];
+ wchar_t text[128];
hasHome = true;
if ((m = XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) {
hasHomeStreet = true;
@@ -832,7 +832,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
- _tcsncpy_s(text, XmlGetText(m), _TRUNCATE);
+ wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
setTString(hContact, "Street", text);
}
@@ -871,7 +871,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) // Work address
hasWork = true;
if ((m = XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) {
- TCHAR text[128];
+ wchar_t text[128];
hasWorkStreet = true;
if (hContact != NULL) {
if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
@@ -879,7 +879,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
- _tcsncpy_s(text, XmlGetText(m), _TRUNCATE);
+ wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
setTString(hContact, "CompanyStreet", text);
}
@@ -1132,7 +1132,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
if (id == m_ThreadInfo->resolveID) {
- const TCHAR *p = _tcschr(jid, '@');
+ const wchar_t *p = wcschr(jid, '@');
ResolveTransportNicks((p != NULL) ? p + 1 : jid);
}
else {
@@ -1152,7 +1152,7 @@ void CJabberProto::OnIqResultSetVcard(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*)
{
HXML queryNode, n;
- const TCHAR *type, *jid;
+ const wchar_t *type, *jid;
int id;
debugLogA("<iq/> iqIdGetSearch");
@@ -1172,24 +1172,24 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(XmlGetName(itemNode), L"item")) {
if ((jid = XmlGetAttrValue(itemNode, L"jid")) != NULL) {
- psr.id.t = (TCHAR*)jid;
+ psr.id.w = (wchar_t*)jid;
debugLog(L"Result jid = %s", jid);
if ((n = XmlGetChild(itemNode, "nick")) != NULL && XmlGetText(n) != NULL)
- psr.nick.t = (TCHAR*)XmlGetText(n);
+ psr.nick.w = (wchar_t*)XmlGetText(n);
else
- psr.nick.t = L"";
+ psr.nick.w = L"";
if ((n = XmlGetChild(itemNode, "first")) != NULL && XmlGetText(n) != NULL)
- psr.firstName.t = (TCHAR*)XmlGetText(n);
+ psr.firstName.w = (wchar_t*)XmlGetText(n);
else
- psr.firstName.t = L"";
+ psr.firstName.w = L"";
if ((n = XmlGetChild(itemNode, "last")) != NULL && XmlGetText(n) != NULL)
- psr.lastName.t = (TCHAR*)XmlGetText(n);
+ psr.lastName.w = (wchar_t*)XmlGetText(n);
else
- psr.lastName.t = L"";
+ psr.lastName.w = L"";
if ((n = XmlGetChild(itemNode, "email")) != NULL && XmlGetText(n) != NULL)
- psr.email.t = (TCHAR*)XmlGetText(n);
+ psr.email.w = (wchar_t*)XmlGetText(n);
else
- psr.email.t = L"";
+ psr.email.w = L"";
psr.flags = PSR_TCHAR;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
}
@@ -1207,7 +1207,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) HXML queryNode;
debugLogA("<iq/> iqIdGetExtSearch");
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
@@ -1237,7 +1237,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (mir_tstrcmp(XmlGetName(fieldNode), L"field"))
continue;
- const TCHAR *fieldName = XmlGetAttrValue(fieldNode, L"var");
+ const wchar_t *fieldName = XmlGetAttrValue(fieldNode, L"var");
if (fieldName == NULL)
continue;
@@ -1246,19 +1246,19 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) continue;
if (!mir_tstrcmp(fieldName, L"jid")) {
- psr.id.t = (TCHAR*)XmlGetText(n);
- debugLog(L"Result jid = %s", psr.id.t);
+ psr.id.w = (wchar_t*)XmlGetText(n);
+ debugLog(L"Result jid = %s", psr.id.w);
}
else if (!mir_tstrcmp(fieldName, L"nickname"))
- psr.nick.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L"";
+ psr.nick.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
else if (!mir_tstrcmp(fieldName, L"fn"))
- psr.firstName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L"";
+ psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
else if (!mir_tstrcmp(fieldName, L"given"))
- psr.firstName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L"";
+ psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
else if (!mir_tstrcmp(fieldName, L"family"))
- psr.lastName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L"";
+ psr.lastName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
else if (!mir_tstrcmp(fieldName, L"email"))
- psr.email.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L"";
+ psr.email.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
@@ -1274,12 +1274,12 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo*) {
debugLogA("<iq/> iqIdSetPassword");
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
if (!mir_tstrcmp(type, L"result")) {
- _tcsncpy_s(m_ThreadInfo->conn.password, m_ThreadInfo->tszNewPassword, _TRUNCATE);
+ wcsncpy_s(m_ThreadInfo->conn.password, m_ThreadInfo->tszNewPassword, _TRUNCATE);
MessageBox(NULL, TranslateT("Password is successfully changed. Don't forget to update your password in the Jabber protocol option."), TranslateT("Change Password"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND);
}
else if (!mir_tstrcmp(type, L"error"))
@@ -1290,7 +1290,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) {
debugLogA("<iq/> OnIqResultGetVCardAvatar");
- const TCHAR *from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from == NULL)
return;
@@ -1298,7 +1298,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (hContact == NULL)
return;
- const TCHAR *type;
+ const wchar_t *type;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if (mir_tstrcmp(type, L"result")) return;
@@ -1316,7 +1316,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) return;
}
- const TCHAR *mimeType = XmlGetText(XmlGetChild(vCard, "TYPE"));
+ const wchar_t *mimeType = XmlGetText(XmlGetChild(vCard, "TYPE"));
HXML n = XmlGetChild(vCard, "BINVAL");
if (n == NULL)
return;
@@ -1327,11 +1327,11 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*)
{
- const TCHAR *type;
+ const wchar_t *type;
debugLogA("<iq/> iqIdResultGetClientAvatar");
- const TCHAR *from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from == NULL)
return;
MCONTACT hContact = HContactFromJID(from);
@@ -1342,7 +1342,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_tstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
- const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
if (!mir_tstrcmp(xmlns, JABBER_FEAT_AVATAR))
n = XmlGetChild(queryNode, "data");
}
@@ -1353,9 +1353,9 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) return;
}
- TCHAR szJid[JABBER_MAX_JID_LEN];
+ wchar_t szJid[JABBER_MAX_JID_LEN];
mir_tstrncpy(szJid, from, _countof(szJid));
- TCHAR *res = _tcschr(szJid, _T('/'));
+ wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1369,7 +1369,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) {
debugLogA("<iq/> iqIdResultGetServerAvatar");
- const TCHAR *from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from == NULL)
return;
@@ -1378,11 +1378,11 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) return;
HXML n = NULL;
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (!mir_tstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
- const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
if (!mir_tstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR))
n = XmlGetChild(queryNode, "data");
}
@@ -1393,9 +1393,9 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) return;
}
- TCHAR szJid[JABBER_MAX_JID_LEN];
+ wchar_t szJid[JABBER_MAX_JID_LEN];
mir_tstrncpy(szJid, from, _countof(szJid));
- TCHAR *res = _tcschr(szJid, _T('/'));
+ wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1405,7 +1405,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) }
-void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const TCHAR *mimeType)
+void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t *mimeType)
{
unsigned resultLen;
ptrA body((char*)mir_base64_decode(_T2A(XmlGetText(n)), &resultLen));
@@ -1431,7 +1431,7 @@ LBL_ErrFormat: ai.format = pictureType;
ai.hContact = hContact;
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
@@ -1446,9 +1446,9 @@ LBL_ErrFormat: mir_sha1_finish(&sha, digest);
GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
- _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
+ wcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
- FILE *out = _tfopen(tszFileName, L"wb");
+ FILE *out = _wfopen(tszFileName, L"wb");
if (out != NULL) {
fwrite(body, resultLen, 1, out);
fclose(out);
@@ -1469,11 +1469,11 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) // RECVED: list of bookmarks
// ACTION: refresh bookmarks dialog
debugLogA("<iq/> iqIdGetBookmarks");
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
- const TCHAR *jid;
+ const wchar_t *jid;
if (!mir_tstrcmp(type, L"result")) {
if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) {
m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE;
@@ -1494,7 +1494,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) item->nick = mir_tstrdup(XPathT(itemNode, "nick"));
item->password = mir_tstrdup(XPathT(itemNode, "password"));
- const TCHAR *autoJ = XmlGetAttrValue(itemNode, L"autojoin");
+ const wchar_t *autoJ = XmlGetAttrValue(itemNode, L"autojoin");
if (autoJ != NULL)
item->bAutoJoin = !mir_tstrcmp(autoJ, L"true") || !mir_tstrcmp(autoJ, L"1");
}
@@ -1559,7 +1559,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdSetBookmarks");
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
@@ -1568,7 +1568,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) }
else if (!mir_tstrcmp(type, L"error")) {
HXML errorNode = XmlGetChild(iqNode, "error");
- TCHAR *str = JabberErrorMsg(errorNode);
+ wchar_t *str = JabberErrorMsg(errorNode);
MessageBox(NULL, str, TranslateT("Jabber Bookmarks Error"), MB_OK | MB_SETFOREGROUND);
mir_free(str);
UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE);
@@ -1586,7 +1586,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szSeconds = XPathT(iqNode, "query[@xmlns='jabber:iq:last']/@seconds");
if (szSeconds) {
- int nSeconds = _ttoi(szSeconds);
+ int nSeconds = _wtoi(szSeconds);
if (nSeconds > 0)
lastActivity = time(0) - nSeconds;
}
@@ -1610,9 +1610,9 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo) if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szTzo = XPathFmt(pIqNode, L"time[@xmlns='%s']/tzo", JABBER_FEAT_ENTITY_TIME);
if (szTzo && szTzo[0]) {
- LPCTSTR szMin = _tcschr(szTzo, ':');
- int nTz = _ttoi(szTzo) * -2;
- nTz += (nTz < 0 ? -1 : 1) * (szMin ? _ttoi(szMin + 1) / 30 : 0);
+ LPCTSTR szMin = wcschr(szTzo, ':');
+ int nTz = _wtoi(szTzo) * -2;
+ nTz += (nTz < 0 ? -1 : 1) * (szMin ? _wtoi(szMin + 1) / 30 : 0);
TIME_ZONE_INFORMATION tzinfo;
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT)
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 576080d884..1795ccbcfb 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CJabberProto::SetMucConfig(HXML node, void *from)
{
if (m_ThreadInfo && from) {
- XmlNodeIq iq(L"set", SerialNext(), (TCHAR*)from);
+ XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from);
HXML query = iq << XQUERY(JABBER_FEAT_MUC_OWNER);
XmlAddChild(query, node);
m_ThreadInfo->send(iq);
@@ -68,10 +68,10 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo*) static void sttFillJidList(HWND hwndDlg)
{
- TCHAR *filter = NULL;
+ wchar_t *filter = NULL;
if (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA)) {
int filterLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILTER)) + 1;
- filter = (TCHAR *)_alloca(filterLength * sizeof(TCHAR));
+ filter = (wchar_t *)_alloca(filterLength * sizeof(wchar_t));
GetDlgItemText(hwndDlg, IDC_FILTER, filter, filterLength);
}
@@ -95,7 +95,7 @@ static void sttFillJidList(HWND hwndDlg) ListView_DeleteAllItems(hwndList);
// Populate displayed list from iqNode
- TCHAR tszItemText[JABBER_MAX_JID_LEN + 256];
+ wchar_t tszItemText[JABBER_MAX_JID_LEN + 256];
HXML iqNode = jidListInfo->iqNode;
if (iqNode != NULL) {
LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
@@ -112,7 +112,7 @@ static void sttFillJidList(HWND hwndDlg) LPCTSTR jid = XmlGetAttrValue(itemNode, L"jid");
if (jid != NULL) {
- lvi.pszText = (TCHAR*)jid;
+ lvi.pszText = (wchar_t*)jid;
if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = XmlGetText(XmlGetChild(itemNode, L"reason"));
if (reason != NULL) {
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w {
JABBER_MUC_JIDLIST_INFO *dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- TCHAR title[256];
+ wchar_t title[256];
switch (msg) {
case WM_INITDIALOG:
@@ -244,7 +244,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w dat->roomJid = mir_tstrdup(from);
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != NULL) {
- TCHAR *localFrom = mir_tstrdup(from);
+ wchar_t *localFrom = mir_tstrdup(from);
mir_sntprintf(title, TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
@@ -301,7 +301,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w NMLISTVIEW *nm = (NMLISTVIEW *)lParam;
LVITEM lvi;
LVHITTESTINFO hti;
- TCHAR text[128];
+ wchar_t text[128];
if (nm->iSubItem < 1)
break;
@@ -343,11 +343,11 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w }
else {
//delete
- TCHAR msgText[128];
+ wchar_t msgText[128];
mir_sntprintf(msgText, TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO | MB_SETFOREGROUND) == IDYES) {
- dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
+ dat->ppro->DeleteMucListItem(dat, (wchar_t*)lvi.lParam);
mir_free((void *)lvi.lParam);
ListView_DeleteItem(nm->hdr.hwndFrom, hti.iItem);
}
@@ -542,7 +542,7 @@ JABBER_MUC_JIDLIST_INFO::~JABBER_MUC_JIDLIST_INFO() mir_free(roomJid);
}
-TCHAR* JABBER_MUC_JIDLIST_INFO::type2str() const
+wchar_t* JABBER_MUC_JIDLIST_INFO::type2str() const
{
switch (type) {
case MUC_VOICELIST: return TranslateT("Voice List");
diff --git a/protocols/JabberG/src/jabber_libstr.cpp b/protocols/JabberG/src/jabber_libstr.cpp index 3b85b3e4c0..24b13f8478 100644 --- a/protocols/JabberG/src/jabber_libstr.cpp +++ b/protocols/JabberG/src/jabber_libstr.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-int lstrcmp_null(const TCHAR *s1, const TCHAR *s2)
+int lstrcmp_null(const wchar_t *s1, const wchar_t *s2)
{
if (!s1 && !s2) return 0;
if (!s1) return -1;
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index b12aeef4d4..434bdd1028 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -115,7 +115,7 @@ void CJabberProto::ListWipe(void) /////////////////////////////////////////////////////////////////////////////////////////
// Adding & removing items
-JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCONTACT hContact)
+JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const wchar_t *jid, MCONTACT hContact)
{
bool bUseResource = false;
mir_cslockfull lck(m_csLists);
@@ -127,15 +127,15 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCON return item;
}
- TCHAR *s = mir_tstrdup(jid);
- TCHAR *q = NULL;
+ wchar_t *s = mir_tstrdup(jid);
+ wchar_t *q = NULL;
// strip resource name if any
//fyr
if (!((list == LIST_ROSTER) && ListGetItemPtr(LIST_CHATROOM, jid))) { // but only if it is not chat room contact
if (list != LIST_VCARD_TEMP) {
- TCHAR *p;
- if ((p = _tcschr(s, '@')) != NULL)
- if ((q = _tcschr(p, '/')) != NULL)
+ wchar_t *p;
+ if ((p = wcschr(s, '@')) != NULL)
+ if ((q = wcschr(p, '/')) != NULL)
*q = '\0';
}
}
@@ -163,7 +163,7 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCON return item;
}
-void CJabberProto::ListRemove(JABBER_LIST list, const TCHAR *jid)
+void CJabberProto::ListRemove(JABBER_LIST list, const wchar_t *jid)
{
mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid);
@@ -192,14 +192,14 @@ void CJabberProto::ListRemoveByIndex(int index) /////////////////////////////////////////////////////////////////////////////////////////
// Getting & finding items
-JABBER_LIST_ITEM* CJabberProto::ListGetItemPtr(JABBER_LIST list, const TCHAR *jid)
+JABBER_LIST_ITEM* CJabberProto::ListGetItemPtr(JABBER_LIST list, const wchar_t *jid)
{
if (jid == NULL)
return NULL;
JABBER_LIST_ITEM *tmp = (JABBER_LIST_ITEM*)_alloca(sizeof(JABBER_LIST_ITEM));
tmp->list = list;
- tmp->jid = (TCHAR*)jid;
+ tmp->jid = (wchar_t*)jid;
tmp->bUseResource = false;
mir_cslock lck(m_csLists);
@@ -237,7 +237,7 @@ int CJabberProto::ListFindNext(JABBER_LIST list, int fromOffset) /////////////////////////////////////////////////////////////////////////////////////////
// Resource related code
-pResourceStatus JABBER_LIST_ITEM::findResource(const TCHAR *resourceName) const
+pResourceStatus JABBER_LIST_ITEM::findResource(const wchar_t *resourceName) const
{
if (arResources.getCount() == 0 || resourceName == NULL || *resourceName == 0)
return NULL;
@@ -251,19 +251,19 @@ pResourceStatus JABBER_LIST_ITEM::findResource(const TCHAR *resourceName) const return NULL;
}
-pResourceStatus CJabberProto::ListFindResource(JABBER_LIST list, const TCHAR *jid)
+pResourceStatus CJabberProto::ListFindResource(JABBER_LIST list, const wchar_t *jid)
{
mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid);
if (LI == NULL)
return NULL;
- const TCHAR *p = _tcschr(jid, '@');
- const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/');
+ const wchar_t *p = wcschr(jid, '@');
+ const wchar_t *q = wcschr((p == NULL) ? jid : p, '/');
return (q == NULL) ? NULL : LI->findResource(q + 1);
}
-bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int status, const TCHAR *statusMessage, char priority, const TCHAR *nick)
+bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int status, const wchar_t *statusMessage, char priority, const wchar_t *nick)
{
mir_cslockfull lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid);
@@ -272,10 +272,10 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int statu bool bIsNewResource = false;
- const TCHAR *p = _tcschr(jid, '@');
- const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/');
+ const wchar_t *p = wcschr(jid, '@');
+ const wchar_t *q = wcschr((p == NULL) ? jid : p, '/');
if (q) {
- const TCHAR *resource = q + 1;
+ const wchar_t *resource = q + 1;
if (*resource == 0)
return 0;
@@ -312,15 +312,15 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int statu return bIsNewResource;
}
-void CJabberProto::ListRemoveResource(JABBER_LIST list, const TCHAR *jid)
+void CJabberProto::ListRemoveResource(JABBER_LIST list, const wchar_t *jid)
{
mir_cslockfull lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid);
if (LI == NULL)
return;
- const TCHAR *p = _tcschr(jid, '@');
- const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/');
+ const wchar_t *p = wcschr(jid, '@');
+ const wchar_t *q = wcschr((p == NULL) ? jid : p, '/');
if (q == NULL)
return;
@@ -382,7 +382,7 @@ JABBER_RESOURCE_STATUS* JABBER_LIST_ITEM::getTemp() return m_pItemResource;
}
-TCHAR* CJabberProto::ListGetBestClientResourceNamePtr(const TCHAR *jid)
+wchar_t* CJabberProto::ListGetBestClientResourceNamePtr(const wchar_t *jid)
{
mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid);
@@ -394,7 +394,7 @@ TCHAR* CJabberProto::ListGetBestClientResourceNamePtr(const TCHAR *jid) return r->m_tszResourceName;
int status = ID_STATUS_OFFLINE;
- TCHAR *res = NULL;
+ wchar_t *res = NULL;
for (int i = 0; i < LI->arResources.getCount(); i++) {
r = LI->arResources[i];
bool foundBetter = false;
diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 6537179c50..29f145422c 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -150,14 +150,14 @@ struct JABBER_LIST_ITEM : public MZeroedObject ~JABBER_LIST_ITEM();
JABBER_LIST list;
- TCHAR* jid;
+ wchar_t* jid;
MCONTACT hContact;
// LIST_ROSTER
// jid = jid of the contact
- TCHAR* nick;
+ wchar_t* nick;
- pResourceStatus findResource(const TCHAR *resourceName) const;
+ pResourceStatus findResource(const wchar_t *resourceName) const;
pResourceStatus getBestResource() const;
JABBER_RESOURCE_MODE resourceMode;
LIST<JABBER_RESOURCE_STATUS> arResources; // array of resources
@@ -168,18 +168,18 @@ struct JABBER_LIST_ITEM : public MZeroedObject *getTemp(); // allocates m_pItemResource if needed
JABBER_SUBSCRIPTION subscription;
- TCHAR* group;
- TCHAR* photoFileName;
- TCHAR* messageEventIdStr;
+ wchar_t* group;
+ wchar_t* photoFileName;
+ wchar_t* messageEventIdStr;
// LIST_AGENT
// jid = jid of the agent
- TCHAR* name;
- TCHAR* service;
+ wchar_t* name;
+ wchar_t* service;
// LIST_ROOM
// jid = room JID
- TCHAR* type; // room type
+ wchar_t* type; // room type
// LIST_CHATROOM
// jid = room JID
@@ -206,7 +206,7 @@ struct JABBER_LIST_ITEM : public MZeroedObject //LIST_BOOKMARK
// jid = room JID
- TCHAR* password; // password for room
+ wchar_t* password; // password for room
bool bAutoJoin;
bool bUseResource;
@@ -220,7 +220,7 @@ struct JABBER_HTTP_AVATARS char * Url;
MCONTACT hContact;
- JABBER_HTTP_AVATARS(const TCHAR *tUrl, MCONTACT thContact)
+ JABBER_HTTP_AVATARS(const wchar_t *tUrl, MCONTACT thContact)
: Url(mir_t2a(tUrl)), hContact(thContact) {}
~JABBER_HTTP_AVATARS() { mir_free(Url); }
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index c82c57eedd..3df1e3989d 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -309,7 +309,7 @@ void g_MenuInit(void) char buf[] = "Jabber/DirectPresenceX";
buf[_countof(buf) - 2] = '0' + i;
mi.pszService = buf;
- mi.name.t = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
+ mi.name.w = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
mi.position = -1999901000;
mi.hIcolibItem = Skin_LoadIcon(PresenceModeArray[i].icon);
g_hMenuDirectPresence[i + 1] = Menu_AddContactMenuItem(&mi);
@@ -376,7 +376,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
if (ptrT(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
Menu_ShowItem(g_hMenuConvert, TRUE);
- Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENT("&Convert to Contact") : LPGENT("&Convert to Chat Room"));
+ Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENW("&Convert to Contact") : LPGENW("&Convert to Chat Room"));
}
}
@@ -701,10 +701,10 @@ void CJabberProto::MenuInit() mi.flags = CMIF_UNMOVABLE | CMIF_HIDDEN;
m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi);
- TCHAR szName[128];
+ wchar_t szName[128];
char srvFce[MAX_PATH + 64];
mi.pszService = srvFce;
- mi.name.t = szName;
+ mi.name.w = szName;
mi.position = 2000040000;
mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.root = m_hMenuPriorityRoot;
@@ -770,7 +770,7 @@ void CJabberProto::UpdatePriorityMenu(int priority) if (!m_hMenuPriorityRoot || (m_priorityMenuValSet && priority == m_priorityMenuVal))
return;
- TCHAR szName[128];
+ wchar_t szName[128];
mir_sntprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
Menu_ModifyItem(m_hMenuPriorityRoot, szName);
@@ -788,7 +788,7 @@ void CJabberProto::GlobalMenuInit() CMenuItem mi;
mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.position = iChooserMenuPos++;
- mi.name.t = m_tszUserName;
+ mi.name.w = m_tszUserName;
m_hChooseMenuItem = Menu_AddItem(hChooserMenu, &mi, this);
//////////////////////////////////////////////////////////////////////////////////////
@@ -805,19 +805,19 @@ void CJabberProto::GlobalMenuInit() hkd.dwFlags = HKD_TCHAR;
mir_strcpy(tDest, "/Groupchat");
- hkd.ptszDescription = LPGENT("Join conference");
+ hkd.ptszDescription = LPGENW("Join conference");
Hotkey_Register(&hkd);
mir_strcpy(tDest, "/Bookmarks");
- hkd.ptszDescription = LPGENT("Open bookmarks");
+ hkd.ptszDescription = LPGENW("Open bookmarks");
Hotkey_Register(&hkd);
mir_strcpy(tDest, "/PrivacyLists");
- hkd.ptszDescription = LPGENT("Privacy lists");
+ hkd.ptszDescription = LPGENW("Privacy lists");
Hotkey_Register(&hkd);
mir_strcpy(tDest, "/ServiceDiscovery");
- hkd.ptszDescription = LPGENT("Service discovery");
+ hkd.ptszDescription = LPGENW("Service discovery");
Hotkey_Register(&hkd);
}
@@ -965,7 +965,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) if (!bSupportTyping || !m_bJabberOnline)
return 0;
- TCHAR jid[JABBER_MAX_JID_LEN];
+ wchar_t jid[JABBER_MAX_JID_LEN];
if (GetClientJID(event->hContact, jid, _countof(jid))) {
pResourceStatus r(ResourceInfoFromJID(jid));
if (r && r->m_bMessageSessionActive) {
@@ -996,7 +996,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) return 0;
HMENU hMenu = CreatePopupMenu();
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("Last active (%s)"),
LI->m_pLastSeenResource ? LI->m_pLastSeenResource->m_tszResourceName : TranslateT("No activity yet, use server's choice"));
@@ -1072,7 +1072,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM if (!m_bJabberOnline || !hContact)
return 0;
- TCHAR *jid, text[1024];
+ wchar_t *jid, text[1024];
ptrT tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL) {
ptrT roomid(getTStringA(hContact, "ChatRoomID"));
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index dc7e7f6026..cb17a7fa13 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -34,14 +34,14 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI if (item == NULL)
item = ListGetItemPtr(LIST_CHATROOM, pInfo->GetFrom());
if (item != NULL) { // yes, it is
- TCHAR *szErrText = JabberErrorMsg(pInfo->GetChildNode());
+ wchar_t *szErrText = JabberErrorMsg(pInfo->GetChildNode());
if (id != -1) {
char *errText = mir_t2a(szErrText);
ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText);
mir_free(errText);
}
else {
- TCHAR buf[512];
+ wchar_t buf[512];
HXML bodyNode = XmlGetChild(node, "body");
if (bodyNode)
mir_sntprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), XmlGetText(bodyNode), szErrText);
@@ -58,8 +58,8 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI BOOL CJabberProto::OnMessageIbb(HXML, ThreadData*, CJabberMessageInfo* pInfo)
{
BOOL bOk = FALSE;
- const TCHAR *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
- const TCHAR *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
+ const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
+ const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
if (sid && seq && XmlGetText(pInfo->GetChildNode()))
bOk = OnIbbRecvdData(XmlGetText(pInfo->GetChildNode()), sid, seq);
@@ -80,8 +80,8 @@ BOOL CJabberProto::OnMessageGroupchat(HXML node, ThreadData*, CJabberMessageInfo // got message from unknown conference... let's leave it :)
else {
-// TCHAR *conference = NEWTSTR_ALLOCA(from);
-// if (TCHAR *s = _tcschr(conference, _T('/'))) *s = 0;
+// wchar_t *conference = NEWWSTR_ALLOCA(from);
+// if (wchar_t *s = wcschr(conference, '/')) *s = 0;
// XmlNode p("presence"); XmlAddAttr(p, "to", conference); XmlAddAttr(p, "type", "unavailable");
// info->send(p);
}
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index 47a683a23e..c6253582ae 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -115,9 +115,9 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler( JABBER_PERMANENT_MESSAGE_HANDLER pHandler,
int nMessageTypes,
DWORD dwParamsToParse,
- const TCHAR *szXmlns,
+ const wchar_t *szXmlns,
BOOL bAllowPartialNs,
- const TCHAR *szTag,
+ const wchar_t *szTag,
void *pUserData,
MESSAGE_USER_DATA_FREE_FUNC pUserDataFree,
int iPriority)
diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h index 17d5e3ded6..48db4c2c83 100644 --- a/protocols/JabberG/src/jabber_message_manager.h +++ b/protocols/JabberG/src/jabber_message_manager.h @@ -125,7 +125,7 @@ public: CJabberMessageManager(CJabberProto *proto);
~CJabberMessageManager();
- CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
+ CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const wchar_t *szXmlns, BOOL bAllowPartialNs, const wchar_t *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
bool DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo);
bool HandleMessagePermanent(HXML node, ThreadData *pThreadData);
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index de15d1102b..36d7eda517 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////
// JabberAddContactToRoster() - adds a contact to the roster
-void CJabberProto::AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName)
+void CJabberProto::AddContactToRoster(const wchar_t *jid, const wchar_t *nick, const wchar_t *grpName)
{
XmlNodeIq iq(L"set", SerialNext());
HXML query = iq << XQUERY(JABBER_FEAT_IQ_ROSTER)
@@ -53,7 +53,7 @@ void JabberChatDllError() ///////////////////////////////////////////////////////////////////////////////
// JabberDBAddAuthRequest()
-void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick)
+void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick)
{
MCONTACT hContact = DBCreateContact(jid, nick, true, true);
delSetting(hContact, "Hidden");
@@ -85,7 +85,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) ///////////////////////////////////////////////////////////////////////////////
// JabberDBCreateContact()
-MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool temporary, bool stripResource)
+MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, bool temporary, bool stripResource)
{
if (jid == NULL || jid[0] == '\0')
return NULL;
@@ -95,11 +95,11 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool return hContact;
// strip resource if present
- TCHAR szJid[JABBER_MAX_JID_LEN];
+ wchar_t szJid[JABBER_MAX_JID_LEN];
if (stripResource)
JabberStripJid(jid, szJid, _countof(szJid));
else
- _tcsncpy_s(szJid, jid, _TRUNCATE);
+ wcsncpy_s(szJid, jid, _TRUNCATE);
MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
Proto_AddToContact(hNewContact, m_szModuleName);
@@ -112,7 +112,7 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool SendGetVcard(szJid);
if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact))
- pItem->bUseResource = _tcschr(szJid, '/') != 0;
+ pItem->bUseResource = wcschr(szJid, '/') != 0;
debugLog(L"Create Jabber contact jid=%s, nick=%s", szJid, nick);
DBCheckIsTransportedContact(szJid, hNewContact);
@@ -154,7 +154,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) ///////////////////////////////////////////////////////////////////////////////
// JabberGetAvatarFileName() - gets a file name for the avatar image
-void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen)
+void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
@@ -164,7 +164,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c pszDest[tPathLen++] = '\\';
- const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_PNG));
+ const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_PNG));
if (hContact != NULL) {
char str[256];
@@ -192,7 +192,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c ///////////////////////////////////////////////////////////////////////////////
// JabberResolveTransportNicks - massive vcard update
-void CJabberProto::ResolveTransportNicks(const TCHAR *jid)
+void CJabberProto::ResolveTransportNicks(const wchar_t *jid)
{
// Set all contacts to offline
MCONTACT hContact = m_ThreadInfo->resolveContact;
@@ -206,7 +206,7 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid) ptrT dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
ptrT dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
- TCHAR *p = _tcschr(dbJid, '@');
+ wchar_t *p = wcschr(dbJid, '@');
if (p == NULL)
continue;
@@ -264,9 +264,9 @@ void CJabberProto::SetServerStatus(int iNewStatus) // Process a string, and double all % characters, according to chat.dll's restrictions
// Returns a pointer to the new string (old one is not freed)
-TCHAR* UnEscapeChatTags(TCHAR* str_in)
+wchar_t* UnEscapeChatTags(wchar_t* str_in)
{
- TCHAR *s = str_in, *d = str_in;
+ wchar_t *s = str_in, *d = str_in;
while (*s) {
if (*s == '%' && s[1] == '%')
s++;
@@ -281,8 +281,8 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in) struct
{
- TCHAR *node;
- TCHAR *name;
+ wchar_t *node;
+ wchar_t *name;
}
static sttCapsNodeToName_Map[] =
{
@@ -321,7 +321,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) // jabber:iq:version info requested and exists?
if (resource->m_dwVersionRequestTime && resource->m_tszSoftware) {
debugLog(L"JabberUpdateMirVer: for iq:version rc %s: %s", resource->m_tszResourceName, resource->m_tszSoftware);
- if (!resource->m_tszSoftwareVersion || _tcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion))
+ if (!resource->m_tszSoftwareVersion || wcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion))
res = resource->m_tszSoftware;
else
res.Format(L"%s %s", resource->m_tszSoftware, resource->m_tszSoftwareVersion);
@@ -340,7 +340,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) // search through known software list
for (i = 0; i < _countof(sttCapsNodeToName_Map); i++)
- if (_tcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) {
+ if (wcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) {
res.Format(L"%s %s", sttCapsNodeToName_Map[i].name, resource->m_tszCapsVer);
break;
}
@@ -351,23 +351,23 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) }
// attach additional info for fingerprint plguin
- if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX86) && !_tcsstr(res, L"x86"))
+ if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX86) && !wcsstr(res, L"x86"))
res.Append(L" x86");
- if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX64) && !_tcsstr(res, L"x64"))
+ if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX64) && !wcsstr(res, L"x64"))
res.Append(L" x64");
- if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_SECUREIM) && !_tcsstr(res, L"(SecureIM)"))
+ if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_SECUREIM) && !wcsstr(res, L"(SecureIM)"))
res.Append(L" (SecureIM)");
- if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_MIROTR) && !_tcsstr(res, L"(MirOTR)"))
+ if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_MIROTR) && !wcsstr(res, L"(MirOTR)"))
res.Append(L" (MirOTR)");
- if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_NEWGPG) && !_tcsstr(res, L"(New_GPG)"))
+ if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_NEWGPG) && !wcsstr(res, L"(New_GPG)"))
res.Append(L" (New_GPG)");
- if (resource->m_tszResourceName && !_tcsstr(res, resource->m_tszResourceName))
- if (_tcsstr(res, L"Miranda IM") || _tcsstr(res, L"Miranda NG") || m_options.ShowForeignResourceInMirVer)
+ if (resource->m_tszResourceName && !wcsstr(res, resource->m_tszResourceName))
+ if (wcsstr(res, L"Miranda IM") || wcsstr(res, L"Miranda NG") || m_options.ShowForeignResourceInMirVer)
res.AppendFormat(L" [%s]", resource->m_tszResourceName);
}
@@ -383,8 +383,8 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) if (jid == NULL)
return;
- TCHAR szFullJid[JABBER_MAX_JID_LEN];
- if (resource->m_tszResourceName && !_tcschr(jid, '/'))
+ wchar_t szFullJid[JABBER_MAX_JID_LEN];
+ if (resource->m_tszResourceName && !wcschr(jid, '/'))
mir_sntprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName);
else
mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
@@ -437,7 +437,7 @@ void CJabberProto::SetContactOfflineStatus(MCONTACT hContact) void CJabberProto::InitPopups(void)
{
- TCHAR desc[256];
+ wchar_t desc[256];
mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
char name[256];
@@ -456,14 +456,14 @@ void CJabberProto::InitPopups(void) IcoLib_ReleaseIcon(ppc.hIcon);
}
-void CJabberProto::MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle)
+void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle)
{
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.ptszTitle = szTitle;
- ppd.ptszText = szMsg;
+ ppd.pwszTitle = szTitle;
+ ppd.pwszText = szMsg;
ppd.pszClassName = name;
ppd.hContact = hContact;
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
@@ -499,11 +499,11 @@ CMString CJabberProto::ExtractImage(HXML node) image.Replace(L"%2F", L"/");
image.Replace(L"%3D", L"=");
- TCHAR tszTempPath[MAX_PATH], tszTempFile[MAX_PATH];
+ wchar_t tszTempPath[MAX_PATH], tszTempFile[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
GetTempFileName(tszTempPath, L"jab", InterlockedIncrement(&g_nTempFileId), tszTempFile);
- _tcsncat_s(tszTempFile, L".", 1);
- _tcsncat_s(tszTempFile, ext, ext.GetLength());
+ wcsncat_s(tszTempFile, L".", 1);
+ wcsncat_s(tszTempFile, ext, ext.GetLength());
HANDLE h = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index aa46e14e58..3c2aa50911 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -31,15 +31,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_privacy.h"
#include "jabber_notes.h"
-static TCHAR* StrTrimCopy(TCHAR *str)
+static wchar_t* StrTrimCopy(wchar_t *str)
{
if (!str) return 0;
- while (*str && _istspace(*str)) ++str;
+ while (*str && iswspace(*str)) ++str;
if (!*str) return mir_tstrdup(str);
- TCHAR *res = mir_tstrdup(str);
- for (TCHAR *p = res + mir_tstrlen(res) - 1; p >= res; --p) {
- if (_istspace(*p))
+ wchar_t *res = mir_tstrdup(str);
+ for (wchar_t *p = res + mir_tstrlen(res) - 1; p >= res; --p) {
+ if (iswspace(*p))
*p = 0;
else
break;
@@ -53,7 +53,7 @@ CNoteItem::CNoteItem() m_szTitle = m_szFrom = m_szText = m_szTags = m_szTagsStr = NULL;
}
-CNoteItem::CNoteItem(HXML hXml, TCHAR *szFrom)
+CNoteItem::CNoteItem(HXML hXml, wchar_t *szFrom)
{
m_szTitle = m_szFrom = m_szText = m_szTags = m_szTagsStr = NULL;
SetData(
@@ -72,7 +72,7 @@ CNoteItem::~CNoteItem() mir_free(m_szTagsStr);
}
-void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags)
+void CNoteItem::SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *tags)
{
mir_free(m_szTitle);
mir_free(m_szFrom);
@@ -84,15 +84,15 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags) m_szText = JabberStrFixLines(text);
m_szFrom = StrTrimCopy(from);
- const TCHAR *szTags = tags;
- TCHAR *p = m_szTags = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(TCHAR));
- TCHAR *q = m_szTagsStr = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(TCHAR));
+ const wchar_t *szTags = tags;
+ wchar_t *p = m_szTags = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(wchar_t));
+ wchar_t *q = m_szTagsStr = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(wchar_t));
for (; szTags && *szTags; ++szTags) {
- if (_istspace(*szTags))
+ if (iswspace(*szTags))
continue;
- if (*szTags == _T(',')) {
- *q++ = _T(',');
+ if (*szTags == ',') {
+ *q++ = ',';
*p++ = 0;
continue;
}
@@ -103,12 +103,12 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags) q[0] = p[0] = p[1] = 0;
}
-bool CNoteItem::HasTag(const TCHAR *szTag)
+bool CNoteItem::HasTag(const wchar_t *szTag)
{
if (!szTag || !*szTag)
return true;
- for (TCHAR *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1)
+ for (wchar_t *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1)
if (!mir_tstrcmp(p, szTag))
return true;
@@ -126,7 +126,7 @@ int CNoteItem::cmp(const CNoteItem *p1, const CNoteItem *p2) return 0;
}
-void CNoteList::AddNote(HXML hXml, TCHAR *szFrom)
+void CNoteList::AddNote(HXML hXml, wchar_t *szFrom)
{
m_bIsModified = true;
insert(new CNoteItem(hXml, szFrom));
@@ -187,10 +187,10 @@ private: void btnOk_OnClick(CCtrlButton *)
{
- TCHAR *szTitle = m_txtTitle.GetText();
- TCHAR *szText = m_txtText.GetText();
- TCHAR *szTags = m_txtTags.GetText();
- TCHAR *szFrom = mir_tstrdup(m_pNote->GetFrom());
+ wchar_t *szTitle = m_txtTitle.GetText();
+ wchar_t *szText = m_txtText.GetText();
+ wchar_t *szTags = m_txtTags.GetText();
+ wchar_t *szFrom = mir_tstrdup(m_pNote->GetFrom());
m_pNote->SetData(szTitle, szFrom, szText, szTags);
mir_free(szTitle);
mir_free(szText);
@@ -297,7 +297,7 @@ public: m_hfntBold = hfntBold;
}
- int AddString(TCHAR *text, LPARAM data = 0)
+ int AddString(wchar_t *text, LPARAM data = 0)
{
m_adding = true;
int idx = CCtrlListBox::AddString(text, data);
@@ -374,7 +374,7 @@ public: rc.top += DrawText(hdc, pNote->GetTitle(), -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rc.top += DrawText(hdc, buf, -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
@@ -409,7 +409,7 @@ public: lps->itemHeight += rcTmp.bottom;
SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rcTmp = rc;
DrawText(hdc, buf, -1, &rcTmp, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT);
@@ -466,24 +466,24 @@ private: m_btnRemove.Enable(m_lstNotes.GetCurSel() != LB_ERR);
}
- void InsertTag(HTREEITEM htiRoot, const TCHAR *tag, bool bSelect)
+ void InsertTag(HTREEITEM htiRoot, const wchar_t *tag, bool bSelect)
{
TVINSERTSTRUCT tvi = { 0 };
tvi.hParent = htiRoot;
tvi.hInsertAfter = TVI_LAST;
tvi.itemex.mask = TVIF_TEXT | TVIF_PARAM;
- tvi.itemex.pszText = (TCHAR *)tag;
+ tvi.itemex.pszText = (wchar_t *)tag;
tvi.itemex.lParam = (LPARAM)mir_tstrdup(tag);
HTREEITEM hti = m_tvFilter.InsertItem(&tvi);
if (bSelect) m_tvFilter.SelectItem(hti);
}
- void PopulateTags(HTREEITEM htiRoot, TCHAR *szActiveTag)
+ void PopulateTags(HTREEITEM htiRoot, wchar_t *szActiveTag)
{
- LIST<TCHAR> tagSet(5, _tcscmp);
+ LIST<wchar_t> tagSet(5, _tcscmp);
for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
- TCHAR *tags = m_proto->m_notes[i].GetTags();
- for (TCHAR *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
+ wchar_t *tags = m_proto->m_notes[i].GetTags();
+ for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
if (!tagSet.find(tag))
tagSet.insert(tag);
}
@@ -505,7 +505,7 @@ private: tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = m_tvFilter.GetSelection();
m_tvFilter.GetItem(&tvi);
- TCHAR *szActiveTag = mir_tstrdup((TCHAR *)tvi.lParam);
+ wchar_t *szActiveTag = mir_tstrdup((wchar_t *)tvi.lParam);
m_tvFilter.DeleteAllItems();
@@ -521,11 +521,11 @@ private: void InsertItem(CNoteItem &item)
{
- m_lstNotes.AddString((TCHAR *)item.GetTitle(), (LPARAM)&item);
+ m_lstNotes.AddString((wchar_t *)item.GetTitle(), (LPARAM)&item);
EnableControls();
}
- void ListItems(const TCHAR *tag)
+ void ListItems(const wchar_t *tag)
{
m_lstNotes.ResetContent();
for (int i = 0; i < m_proto->m_notes.getCount(); i++)
@@ -587,14 +587,14 @@ private: void tvFilter_OnDeleteItem(CCtrlTreeView::TEventInfo *e)
{
- TCHAR *szText = (TCHAR *)e->nmtv->itemOld.lParam;
+ wchar_t *szText = (wchar_t *)e->nmtv->itemOld.lParam;
mir_free(szText);
EnableControls();
}
void tvFilter_OnSelChanged(CCtrlTreeView::TEventInfo *e)
{
- TCHAR *szText = (TCHAR *)e->nmtv->itemNew.lParam;
+ wchar_t *szText = (wchar_t *)e->nmtv->itemNew.lParam;
ListItems(szText);
EnableControls();
}
@@ -726,7 +726,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) return;
}
- TCHAR buf[1024];
+ wchar_t buf[1024];
mir_sntprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
pNote->GetTitle(), pNote->GetText(), pNote->GetTagsStr());
@@ -759,13 +759,13 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) delete pNote;
}
-bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml)
+bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml)
{
if (!m_options.AcceptNotes)
return false;
if (!szFrom || !hXml) return true;
- CNoteItem *pItem = new CNoteItem(hXml, (TCHAR *)szFrom);
+ CNoteItem *pItem = new CNoteItem(hXml, (wchar_t *)szFrom);
if (!pItem->IsNotEmpty()) {
delete pItem;
return true;
diff --git a/protocols/JabberG/src/jabber_notes.h b/protocols/JabberG/src/jabber_notes.h index f8541d4aef..8c55e7ad0b 100644 --- a/protocols/JabberG/src/jabber_notes.h +++ b/protocols/JabberG/src/jabber_notes.h @@ -30,26 +30,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CNoteItem
{
private:
- TCHAR *m_szTitle;
- TCHAR *m_szFrom;
- TCHAR *m_szText;
- TCHAR *m_szTags;
- TCHAR *m_szTagsStr;
+ wchar_t *m_szTitle;
+ wchar_t *m_szFrom;
+ wchar_t *m_szText;
+ wchar_t *m_szTags;
+ wchar_t *m_szTagsStr;
public:
CNoteItem();
- CNoteItem(HXML hXml, TCHAR *szFrom = 0);
+ CNoteItem(HXML hXml, wchar_t *szFrom = 0);
~CNoteItem();
- void SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags);
+ void SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *tags);
- TCHAR *GetTitle() const { return m_szTitle; }
- TCHAR *GetFrom() const { return m_szFrom; }
- TCHAR *GetText() const { return m_szText; }
- TCHAR *GetTags() const { return m_szTags; }
- TCHAR *GetTagsStr() const { return m_szTagsStr; }
+ wchar_t *GetTitle() const { return m_szTitle; }
+ wchar_t *GetFrom() const { return m_szFrom; }
+ wchar_t *GetText() const { return m_szText; }
+ wchar_t *GetTags() const { return m_szTags; }
+ wchar_t *GetTagsStr() const { return m_szTagsStr; }
- bool HasTag(const TCHAR *szTag);
+ bool HasTag(const wchar_t *szTag);
bool IsNotEmpty()
{
@@ -76,7 +76,7 @@ public: OBJLIST<CNoteItem>::remove(p);
}
- void AddNote(HXML hXml, TCHAR *szFrom = 0);
+ void AddNote(HXML hXml, wchar_t *szFrom = 0);
void LoadXml(HXML hXml);
void SaveXml(HXML hXmlParent);
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 9c165d1ce8..828b0a9648 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -35,192 +35,192 @@ static BOOL(WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0; #define STR_FORMAT L"%s %s@%S:%d?"
-struct { TCHAR *szCode; TCHAR *szDescription; } g_LanguageCodes[] = {
- { L"aa", LPGENT("Afar") },
- { L"ab", LPGENT("Abkhazian") },
- { L"af", LPGENT("Afrikaans") },
- { L"ak", LPGENT("Akan") },
- { L"sq", LPGENT("Albanian") },
- { L"am", LPGENT("Amharic") },
- { L"ar", LPGENT("Arabic") },
- { L"an", LPGENT("Aragonese") },
- { L"hy", LPGENT("Armenian") },
- { L"as", LPGENT("Assamese") },
- { L"av", LPGENT("Avaric") },
- { L"ae", LPGENT("Avestan") },
- { L"ay", LPGENT("Aymara") },
- { L"az", LPGENT("Azerbaijani") },
- { L"ba", LPGENT("Bashkir") },
- { L"bm", LPGENT("Bambara") },
- { L"eu", LPGENT("Basque") },
- { L"be", LPGENT("Belarusian") },
- { L"bn", LPGENT("Bengali") },
- { L"bh", LPGENT("Bihari") },
- { L"bi", LPGENT("Bislama") },
- { L"bs", LPGENT("Bosnian") },
- { L"br", LPGENT("Breton") },
- { L"bg", LPGENT("Bulgarian") },
- { L"my", LPGENT("Burmese") },
- { L"ca", LPGENT("Catalan; Valencian") },
- { L"ch", LPGENT("Chamorro") },
- { L"ce", LPGENT("Chechen") },
- { L"zh", LPGENT("Chinese") },
- { L"cu", LPGENT("Church Slavic; Old Slavonic") },
- { L"cv", LPGENT("Chuvash") },
- { L"kw", LPGENT("Cornish") },
- { L"co", LPGENT("Corsican") },
- { L"cr", LPGENT("Cree") },
- { L"cs", LPGENT("Czech") },
- { L"da", LPGENT("Danish") },
- { L"dv", LPGENT("Divehi; Dhivehi; Maldivian") },
- { L"nl", LPGENT("Dutch; Flemish") },
- { L"dz", LPGENT("Dzongkha") },
- { L"en", LPGENT("English") },
- { L"eo", LPGENT("Esperanto") },
- { L"et", LPGENT("Estonian") },
- { L"ee", LPGENT("Ewe") },
- { L"fo", LPGENT("Faroese") },
- { L"fj", LPGENT("Fijian") },
- { L"fi", LPGENT("Finnish") },
- { L"fr", LPGENT("French") },
- { L"fy", LPGENT("Western Frisian") },
- { L"ff", LPGENT("Fulah") },
- { L"ka", LPGENT("Georgian") },
- { L"de", LPGENT("German") },
- { L"gd", LPGENT("Gaelic; Scottish Gaelic") },
- { L"ga", LPGENT("Irish") },
- { L"gl", LPGENT("Galician") },
- { L"gv", LPGENT("Manx") },
- { L"el", LPGENT("Greek, Modern (1453-)") },
- { L"gn", LPGENT("Guarani") },
- { L"gu", LPGENT("Gujarati") },
- { L"ht", LPGENT("Haitian; Haitian Creole") },
- { L"ha", LPGENT("Hausa") },
- { L"he", LPGENT("Hebrew") },
- { L"hz", LPGENT("Herero") },
- { L"hi", LPGENT("Hindi") },
- { L"ho", LPGENT("Hiri Motu") },
- { L"hu", LPGENT("Hungarian") },
- { L"ig", LPGENT("Igbo") },
- { L"is", LPGENT("Icelandic") },
- { L"io", LPGENT("Ido") },
- { L"ii", LPGENT("Sichuan Yi") },
- { L"iu", LPGENT("Inuktitut") },
- { L"ie", LPGENT("Interlingue") },
- { L"ia", LPGENT("Interlingua (International Auxiliary Language Association)") },
- { L"id", LPGENT("Indonesian") },
- { L"ik", LPGENT("Inupiaq") },
- { L"it", LPGENT("Italian") },
- { L"jv", LPGENT("Javanese") },
- { L"ja", LPGENT("Japanese") },
- { L"kl", LPGENT("Kalaallisut; Greenlandic") },
- { L"kn", LPGENT("Kannada") },
- { L"ks", LPGENT("Kashmiri") },
- { L"kr", LPGENT("Kanuri") },
- { L"kk", LPGENT("Kazakh") },
- { L"km", LPGENT("Central Khmer") },
- { L"ki", LPGENT("Kikuyu; Gikuyu") },
- { L"rw", LPGENT("Kinyarwanda") },
- { L"ky", LPGENT("Kirghiz; Kyrgyz") },
- { L"kv", LPGENT("Komi") },
- { L"kg", LPGENT("Kongo") },
- { L"ko", LPGENT("Korean") },
- { L"kj", LPGENT("Kuanyama; Kwanyama") },
- { L"ku", LPGENT("Kurdish") },
- { L"lo", LPGENT("Lao") },
- { L"la", LPGENT("Latin") },
- { L"lv", LPGENT("Latvian") },
- { L"li", LPGENT("Limburgan; Limburger; Limburgish") },
- { L"ln", LPGENT("Lingala") },
- { L"lt", LPGENT("Lithuanian") },
- { L"lb", LPGENT("Luxembourgish; Letzeburgesch") },
- { L"lu", LPGENT("Luba-Katanga") },
- { L"lg", LPGENT("Ganda") },
- { L"mk", LPGENT("Macedonian") },
- { L"mh", LPGENT("Marshallese") },
- { L"ml", LPGENT("Malayalam") },
- { L"mi", LPGENT("Maori") },
- { L"mr", LPGENT("Marathi") },
- { L"ms", LPGENT("Malay") },
- { L"mg", LPGENT("Malagasy") },
- { L"mt", LPGENT("Maltese") },
- { L"mo", LPGENT("Moldavian") },
- { L"mn", LPGENT("Mongolian") },
- { L"na", LPGENT("Nauru") },
- { L"nv", LPGENT("Navajo; Navaho") },
- { L"nr", LPGENT("Ndebele, South; South Ndebele") },
- { L"nd", LPGENT("Ndebele, North; North Ndebele") },
- { L"ng", LPGENT("Ndonga") },
- { L"ne", LPGENT("Nepali") },
- { L"nn", LPGENT("Norwegian Nynorsk; Nynorsk, Norwegian") },
- { L"nb", LPGENT("Bokmaal, Norwegian; Norwegian Bokmaal") },
- { L"no", LPGENT("Norwegian") },
- { L"ny", LPGENT("Chichewa; Chewa; Nyanja") },
- { L"oc", LPGENT("Occitan (post 1500); Provencal") },
- { L"oj", LPGENT("Ojibwa") },
- { L"or", LPGENT("Oriya") },
- { L"om", LPGENT("Oromo") },
- { L"os", LPGENT("Ossetian; Ossetic") },
- { L"pa", LPGENT("Panjabi; Punjabi") },
- { L"fa", LPGENT("Persian") },
- { L"pi", LPGENT("Pali") },
- { L"pl", LPGENT("Polish") },
- { L"pt", LPGENT("Portuguese") },
- { L"ps", LPGENT("Pushto") },
- { L"qu", LPGENT("Quechua") },
- { L"rm", LPGENT("Romansh") },
- { L"ro", LPGENT("Romanian") },
- { L"rn", LPGENT("Rundi") },
- { L"ru", LPGENT("Russian") },
- { L"sg", LPGENT("Sango") },
- { L"sa", LPGENT("Sanskrit") },
- { L"sr", LPGENT("Serbian") },
- { L"hr", LPGENT("Croatian") },
- { L"si", LPGENT("Sinhala; Sinhalese") },
- { L"sk", LPGENT("Slovak") },
- { L"sl", LPGENT("Slovenian") },
- { L"se", LPGENT("Northern Sami") },
- { L"sm", LPGENT("Samoan") },
- { L"sn", LPGENT("Shona") },
- { L"sd", LPGENT("Sindhi") },
- { L"so", LPGENT("Somali") },
- { L"st", LPGENT("Sotho, Southern") },
- { L"es", LPGENT("Spanish; Castilian") },
- { L"sc", LPGENT("Sardinian") },
- { L"ss", LPGENT("Swati") },
- { L"su", LPGENT("Sundanese") },
- { L"sw", LPGENT("Swahili") },
- { L"sv", LPGENT("Swedish") },
- { L"ty", LPGENT("Tahitian") },
- { L"ta", LPGENT("Tamil") },
- { L"tt", LPGENT("Tatar") },
- { L"te", LPGENT("Telugu") },
- { L"tg", LPGENT("Tajik") },
- { L"tl", LPGENT("Tagalog") },
- { L"th", LPGENT("Thai") },
- { L"bo", LPGENT("Tibetan") },
- { L"ti", LPGENT("Tigrinya") },
- { L"to", LPGENT("Tonga (Tonga Islands)") },
- { L"tn", LPGENT("Tswana") },
- { L"ts", LPGENT("Tsonga") },
- { L"tk", LPGENT("Turkmen") },
- { L"tr", LPGENT("Turkish") },
- { L"tw", LPGENT("Twi") },
- { L"ug", LPGENT("Uighur; Uyghur") },
- { L"uk", LPGENT("Ukrainian") },
- { L"ur", LPGENT("Urdu") },
- { L"uz", LPGENT("Uzbek") },
- { L"ve", LPGENT("Venda") },
- { L"vi", LPGENT("Vietnamese") },
- { L"vo", LPGENT("Volapuk") },
- { L"cy", LPGENT("Welsh") },
- { L"wa", LPGENT("Walloon") },
- { L"wo", LPGENT("Wolof") },
- { L"xh", LPGENT("Xhosa") },
- { L"yi", LPGENT("Yiddish") },
- { L"yo", LPGENT("Yoruba") },
- { L"za", LPGENT("Zhuang; Chuang") },
- { L"zu", LPGENT("Zulu") },
+struct { wchar_t *szCode; wchar_t *szDescription; } g_LanguageCodes[] = {
+ { L"aa", LPGENW("Afar") },
+ { L"ab", LPGENW("Abkhazian") },
+ { L"af", LPGENW("Afrikaans") },
+ { L"ak", LPGENW("Akan") },
+ { L"sq", LPGENW("Albanian") },
+ { L"am", LPGENW("Amharic") },
+ { L"ar", LPGENW("Arabic") },
+ { L"an", LPGENW("Aragonese") },
+ { L"hy", LPGENW("Armenian") },
+ { L"as", LPGENW("Assamese") },
+ { L"av", LPGENW("Avaric") },
+ { L"ae", LPGENW("Avestan") },
+ { L"ay", LPGENW("Aymara") },
+ { L"az", LPGENW("Azerbaijani") },
+ { L"ba", LPGENW("Bashkir") },
+ { L"bm", LPGENW("Bambara") },
+ { L"eu", LPGENW("Basque") },
+ { L"be", LPGENW("Belarusian") },
+ { L"bn", LPGENW("Bengali") },
+ { L"bh", LPGENW("Bihari") },
+ { L"bi", LPGENW("Bislama") },
+ { L"bs", LPGENW("Bosnian") },
+ { L"br", LPGENW("Breton") },
+ { L"bg", LPGENW("Bulgarian") },
+ { L"my", LPGENW("Burmese") },
+ { L"ca", LPGENW("Catalan; Valencian") },
+ { L"ch", LPGENW("Chamorro") },
+ { L"ce", LPGENW("Chechen") },
+ { L"zh", LPGENW("Chinese") },
+ { L"cu", LPGENW("Church Slavic; Old Slavonic") },
+ { L"cv", LPGENW("Chuvash") },
+ { L"kw", LPGENW("Cornish") },
+ { L"co", LPGENW("Corsican") },
+ { L"cr", LPGENW("Cree") },
+ { L"cs", LPGENW("Czech") },
+ { L"da", LPGENW("Danish") },
+ { L"dv", LPGENW("Divehi; Dhivehi; Maldivian") },
+ { L"nl", LPGENW("Dutch; Flemish") },
+ { L"dz", LPGENW("Dzongkha") },
+ { L"en", LPGENW("English") },
+ { L"eo", LPGENW("Esperanto") },
+ { L"et", LPGENW("Estonian") },
+ { L"ee", LPGENW("Ewe") },
+ { L"fo", LPGENW("Faroese") },
+ { L"fj", LPGENW("Fijian") },
+ { L"fi", LPGENW("Finnish") },
+ { L"fr", LPGENW("French") },
+ { L"fy", LPGENW("Western Frisian") },
+ { L"ff", LPGENW("Fulah") },
+ { L"ka", LPGENW("Georgian") },
+ { L"de", LPGENW("German") },
+ { L"gd", LPGENW("Gaelic; Scottish Gaelic") },
+ { L"ga", LPGENW("Irish") },
+ { L"gl", LPGENW("Galician") },
+ { L"gv", LPGENW("Manx") },
+ { L"el", LPGENW("Greek, Modern (1453-)") },
+ { L"gn", LPGENW("Guarani") },
+ { L"gu", LPGENW("Gujarati") },
+ { L"ht", LPGENW("Haitian; Haitian Creole") },
+ { L"ha", LPGENW("Hausa") },
+ { L"he", LPGENW("Hebrew") },
+ { L"hz", LPGENW("Herero") },
+ { L"hi", LPGENW("Hindi") },
+ { L"ho", LPGENW("Hiri Motu") },
+ { L"hu", LPGENW("Hungarian") },
+ { L"ig", LPGENW("Igbo") },
+ { L"is", LPGENW("Icelandic") },
+ { L"io", LPGENW("Ido") },
+ { L"ii", LPGENW("Sichuan Yi") },
+ { L"iu", LPGENW("Inuktitut") },
+ { L"ie", LPGENW("Interlingue") },
+ { L"ia", LPGENW("Interlingua (International Auxiliary Language Association)") },
+ { L"id", LPGENW("Indonesian") },
+ { L"ik", LPGENW("Inupiaq") },
+ { L"it", LPGENW("Italian") },
+ { L"jv", LPGENW("Javanese") },
+ { L"ja", LPGENW("Japanese") },
+ { L"kl", LPGENW("Kalaallisut; Greenlandic") },
+ { L"kn", LPGENW("Kannada") },
+ { L"ks", LPGENW("Kashmiri") },
+ { L"kr", LPGENW("Kanuri") },
+ { L"kk", LPGENW("Kazakh") },
+ { L"km", LPGENW("Central Khmer") },
+ { L"ki", LPGENW("Kikuyu; Gikuyu") },
+ { L"rw", LPGENW("Kinyarwanda") },
+ { L"ky", LPGENW("Kirghiz; Kyrgyz") },
+ { L"kv", LPGENW("Komi") },
+ { L"kg", LPGENW("Kongo") },
+ { L"ko", LPGENW("Korean") },
+ { L"kj", LPGENW("Kuanyama; Kwanyama") },
+ { L"ku", LPGENW("Kurdish") },
+ { L"lo", LPGENW("Lao") },
+ { L"la", LPGENW("Latin") },
+ { L"lv", LPGENW("Latvian") },
+ { L"li", LPGENW("Limburgan; Limburger; Limburgish") },
+ { L"ln", LPGENW("Lingala") },
+ { L"lt", LPGENW("Lithuanian") },
+ { L"lb", LPGENW("Luxembourgish; Letzeburgesch") },
+ { L"lu", LPGENW("Luba-Katanga") },
+ { L"lg", LPGENW("Ganda") },
+ { L"mk", LPGENW("Macedonian") },
+ { L"mh", LPGENW("Marshallese") },
+ { L"ml", LPGENW("Malayalam") },
+ { L"mi", LPGENW("Maori") },
+ { L"mr", LPGENW("Marathi") },
+ { L"ms", LPGENW("Malay") },
+ { L"mg", LPGENW("Malagasy") },
+ { L"mt", LPGENW("Maltese") },
+ { L"mo", LPGENW("Moldavian") },
+ { L"mn", LPGENW("Mongolian") },
+ { L"na", LPGENW("Nauru") },
+ { L"nv", LPGENW("Navajo; Navaho") },
+ { L"nr", LPGENW("Ndebele, South; South Ndebele") },
+ { L"nd", LPGENW("Ndebele, North; North Ndebele") },
+ { L"ng", LPGENW("Ndonga") },
+ { L"ne", LPGENW("Nepali") },
+ { L"nn", LPGENW("Norwegian Nynorsk; Nynorsk, Norwegian") },
+ { L"nb", LPGENW("Bokmaal, Norwegian; Norwegian Bokmaal") },
+ { L"no", LPGENW("Norwegian") },
+ { L"ny", LPGENW("Chichewa; Chewa; Nyanja") },
+ { L"oc", LPGENW("Occitan (post 1500); Provencal") },
+ { L"oj", LPGENW("Ojibwa") },
+ { L"or", LPGENW("Oriya") },
+ { L"om", LPGENW("Oromo") },
+ { L"os", LPGENW("Ossetian; Ossetic") },
+ { L"pa", LPGENW("Panjabi; Punjabi") },
+ { L"fa", LPGENW("Persian") },
+ { L"pi", LPGENW("Pali") },
+ { L"pl", LPGENW("Polish") },
+ { L"pt", LPGENW("Portuguese") },
+ { L"ps", LPGENW("Pushto") },
+ { L"qu", LPGENW("Quechua") },
+ { L"rm", LPGENW("Romansh") },
+ { L"ro", LPGENW("Romanian") },
+ { L"rn", LPGENW("Rundi") },
+ { L"ru", LPGENW("Russian") },
+ { L"sg", LPGENW("Sango") },
+ { L"sa", LPGENW("Sanskrit") },
+ { L"sr", LPGENW("Serbian") },
+ { L"hr", LPGENW("Croatian") },
+ { L"si", LPGENW("Sinhala; Sinhalese") },
+ { L"sk", LPGENW("Slovak") },
+ { L"sl", LPGENW("Slovenian") },
+ { L"se", LPGENW("Northern Sami") },
+ { L"sm", LPGENW("Samoan") },
+ { L"sn", LPGENW("Shona") },
+ { L"sd", LPGENW("Sindhi") },
+ { L"so", LPGENW("Somali") },
+ { L"st", LPGENW("Sotho, Southern") },
+ { L"es", LPGENW("Spanish; Castilian") },
+ { L"sc", LPGENW("Sardinian") },
+ { L"ss", LPGENW("Swati") },
+ { L"su", LPGENW("Sundanese") },
+ { L"sw", LPGENW("Swahili") },
+ { L"sv", LPGENW("Swedish") },
+ { L"ty", LPGENW("Tahitian") },
+ { L"ta", LPGENW("Tamil") },
+ { L"tt", LPGENW("Tatar") },
+ { L"te", LPGENW("Telugu") },
+ { L"tg", LPGENW("Tajik") },
+ { L"tl", LPGENW("Tagalog") },
+ { L"th", LPGENW("Thai") },
+ { L"bo", LPGENW("Tibetan") },
+ { L"ti", LPGENW("Tigrinya") },
+ { L"to", LPGENW("Tonga (Tonga Islands)") },
+ { L"tn", LPGENW("Tswana") },
+ { L"ts", LPGENW("Tsonga") },
+ { L"tk", LPGENW("Turkmen") },
+ { L"tr", LPGENW("Turkish") },
+ { L"tw", LPGENW("Twi") },
+ { L"ug", LPGENW("Uighur; Uyghur") },
+ { L"uk", LPGENW("Ukrainian") },
+ { L"ur", LPGENW("Urdu") },
+ { L"uz", LPGENW("Uzbek") },
+ { L"ve", LPGENW("Venda") },
+ { L"vi", LPGENW("Vietnamese") },
+ { L"vo", LPGENW("Volapuk") },
+ { L"cy", LPGENW("Welsh") },
+ { L"wa", LPGENW("Walloon") },
+ { L"wo", LPGENW("Wolof") },
+ { L"xh", LPGENW("Xhosa") },
+ { L"yi", LPGENW("Yiddish") },
+ { L"yo", LPGENW("Yoruba") },
+ { L"za", LPGENW("Zhuang; Chuang") },
+ { L"zu", LPGENW("Zulu") },
{ NULL, NULL }
};
@@ -242,7 +242,7 @@ public: protected:
void OnInitDialog()
{
- TCHAR text[256];
+ wchar_t text[256];
mir_sntprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port);
SetDlgItemText(m_hwnd, IDC_REG_STATUS, text);
}
@@ -251,10 +251,10 @@ protected: {
switch (msg) {
case WM_JABBER_REGDLG_UPDATE: // wParam=progress (0-100), lparam=status string
- if ((TCHAR*)lParam == NULL)
+ if ((wchar_t*)lParam == NULL)
SetDlgItemText(m_hwnd, IDC_REG_STATUS, TranslateT("No message"));
else
- SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam);
+ SetDlgItemText(m_hwnd, IDC_REG_STATUS, (wchar_t*)lParam);
SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0);
if (wParam >= 100)
@@ -425,7 +425,7 @@ protected: SendDlgItemMessage(m_hwnd, IDC_PRIORITY_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(127, -128));
- TCHAR *passw = m_proto->getTStringA(NULL, "Password");
+ wchar_t *passw = m_proto->getTStringA(NULL, "Password");
if (passw) {
m_txtPassword.SetText(passw);
mir_free(passw);
@@ -434,12 +434,12 @@ protected: m_cbServer.AddString(TranslateT("Loading..."));
// fill predefined resources
- TCHAR *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
+ wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
for (int i = 0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
- TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
@@ -489,7 +489,7 @@ protected: int index = m_cbLocale.GetCurSel();
if (index >= 0) {
- TCHAR *szLanguageCode = (TCHAR *)m_cbLocale.GetItemData(index);
+ wchar_t *szLanguageCode = (wchar_t *)m_cbLocale.GetItemData(index);
if (szLanguageCode) {
m_proto->setTString("XmlLang", szLanguageCode);
@@ -615,7 +615,7 @@ private: m_cbResource.Enable(chk->GetState() != BST_CHECKED);
if (chk->GetState() == BST_CHECKED) {
- TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.SetText(szCompName);
@@ -686,7 +686,7 @@ private: {
m_gotservers = node != NULL;
- TCHAR *server = m_cbServer.GetText();
+ wchar_t *server = m_cbServer.GetText();
bool bDropdown = m_cbServer.GetDroppedState();
if (bDropdown) m_cbServer.ShowDropdown(false);
@@ -698,7 +698,7 @@ private: break;
if (!mir_tstrcmp(XmlGetName(n), L"item"))
- if (const TCHAR *jid = XmlGetAttrValue(n, L"jid"))
+ if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
m_cbServer.AddString(jid);
}
@@ -729,7 +729,7 @@ private: NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result) {
if (result->resultCode == 200 && result->dataLength && result->pData) {
- TCHAR *buf = mir_a2t(result->pData);
+ wchar_t *buf = mir_a2t(result->pData);
XmlNode node(buf, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
@@ -783,34 +783,34 @@ public: m_chkDirectManual.OnChange = Callback(this, &CDlgOptAdvanced::chkDirect_OnChange);
m_chkProxy.OnChange = Callback(this, &CDlgOptAdvanced::chkProxy_OnChange);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Send messages slower, but with full acknowledgment"), m_proto->m_options.MsgAck);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable avatars"), m_proto->m_options.EnableAvatars);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log chat state changes"), m_proto->m_options.LogChatstates);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log presence subscription state changes"), m_proto->m_options.LogPresence);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log presence errors"), m_proto->m_options.LogPresenceErrors);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user moods receiving"), m_proto->m_options.EnableUserMood);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user tunes receiving"), m_proto->m_options.EnableUserTune);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user activity receiving"), m_proto->m_options.EnableUserActivity);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Receive notes"), m_proto->m_options.AcceptNotes);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Automatically save received notes"), m_proto->m_options.AutosaveNotes);
- m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable server-side history"), m_proto->m_options.EnableMsgArchive);
-
- m_otvOptions.AddOption(LPGENT("Server options") L"/" LPGENT("Disable SASL authentication (for old servers)"), m_proto->m_options.Disable3920auth);
- m_otvOptions.AddOption(LPGENT("Server options") L"/" LPGENT("Enable stream compression (if possible)"), m_proto->m_options.EnableZlib);
-
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Enable remote controlling (from another resource of same JID only)"), m_proto->m_options.EnableRemoteControl);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Show transport agents on contact list"), m_proto->m_options.ShowTransport);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Automatically add contact when accept authorization"), m_proto->m_options.AutoAdd);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Automatically accept authorization requests"), m_proto->m_options.AutoAcceptAuthorization);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Fix incorrect timestamps in incoming messages"), m_proto->m_options.FixIncorrectTimestamps);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Disable frame"), m_proto->m_options.DisableFrame);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_options.ProcessXMPPLinks);
- m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Keep contacts assigned to local groups (ignore roster group)"), m_proto->m_options.IgnoreRosterGroups);
-
- m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Allow servers to request version (XEP-0092)"), m_proto->m_options.AllowVersionRequests);
- m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Show information about operating system in version replies"), m_proto->m_options.ShowOSVersion);
- m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_options.BsOnlyIBB);
- m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_options.AcceptHttpAuth);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Send messages slower, but with full acknowledgment"), m_proto->m_options.MsgAck);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable avatars"), m_proto->m_options.EnableAvatars);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log chat state changes"), m_proto->m_options.LogChatstates);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence subscription state changes"), m_proto->m_options.LogPresence);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence errors"), m_proto->m_options.LogPresenceErrors);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user moods receiving"), m_proto->m_options.EnableUserMood);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user tunes receiving"), m_proto->m_options.EnableUserTune);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user activity receiving"), m_proto->m_options.EnableUserActivity);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_options.AcceptNotes);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_options.AutosaveNotes);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history"), m_proto->m_options.EnableMsgArchive);
+
+ m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_options.Disable3920auth);
+ m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Enable stream compression (if possible)"), m_proto->m_options.EnableZlib);
+
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable remote controlling (from another resource of same JID only)"), m_proto->m_options.EnableRemoteControl);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Show transport agents on contact list"), m_proto->m_options.ShowTransport);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically add contact when accept authorization"), m_proto->m_options.AutoAdd);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically accept authorization requests"), m_proto->m_options.AutoAcceptAuthorization);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_options.FixIncorrectTimestamps);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Disable frame"), m_proto->m_options.DisableFrame);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_options.ProcessXMPPLinks);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Keep contacts assigned to local groups (ignore roster group)"), m_proto->m_options.IgnoreRosterGroups);
+
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Allow servers to request version (XEP-0092)"), m_proto->m_options.AllowVersionRequests);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Show information about operating system in version replies"), m_proto->m_options.ShowOSVersion);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_options.BsOnlyIBB);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_options.AcceptHttpAuth);
}
void OnInitDialog()
@@ -833,7 +833,7 @@ public: {
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtrFromIndex(index);
if (item != NULL) {
- if (_tcschr(item->jid, '@') == NULL) {
+ if (wcschr(item->jid, '@') == NULL) {
MCONTACT hContact = m_proto->HContactFromJID(item->jid);
if (hContact != NULL) {
if (bChecked) {
@@ -900,17 +900,17 @@ public: CreateLink(m_txtSlap, "GcMsgSlap", TranslateTS(JABBER_GC_MSG_SLAP));
CreateLink(m_txtQuit, "GcMsgQuit", TranslateTS(JABBER_GC_MSG_QUIT));
- m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Autoaccept multiuser chat invitations"), m_proto->m_options.AutoAcceptMUC);
- m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Automatically join bookmarks on login"), m_proto->m_options.AutoJoinBookmarks);
- m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Automatically join conferences on login"), m_proto->m_options.AutoJoinConferences);
- m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Hide conference windows at startup"), m_proto->m_options.AutoJoinHidden);
- m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Do not show multiuser chat invitations"), m_proto->m_options.IgnoreMUCInvites);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Ban notifications"), m_proto->m_options.GcLogBans);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Room configuration changes"), m_proto->m_options.GcLogConfig);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Affiliation changes"), m_proto->m_options.GcLogAffiliations);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Role changes"), m_proto->m_options.GcLogRoles);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Status changes"), m_proto->m_options.GcLogStatuses);
- m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_options.AutoAcceptMUC);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join bookmarks on login"), m_proto->m_options.AutoJoinBookmarks);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join conferences on login"), m_proto->m_options.AutoJoinConferences);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Hide conference windows at startup"), m_proto->m_options.AutoJoinHidden);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Do not show multiuser chat invitations"), m_proto->m_options.IgnoreMUCInvites);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Ban notifications"), m_proto->m_options.GcLogBans);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Room configuration changes"), m_proto->m_options.GcLogConfig);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Affiliation changes"), m_proto->m_options.GcLogAffiliations);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Role changes"), m_proto->m_options.GcLogRoles);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Status changes"), m_proto->m_options.GcLogStatuses);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Don't notify history messages"), m_proto->m_options.GcLogChatHistory);
}
};
@@ -936,12 +936,12 @@ struct ROSTEREDITDAT int subindex;
};
-static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * nick, const TCHAR * group, const TCHAR * subscr, BOOL bChecked)
+static int _RosterInsertListItem(HWND hList, const wchar_t * jid, const wchar_t * nick, const wchar_t * group, const wchar_t * subscr, BOOL bChecked)
{
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_STATE;
item.iItem = ListView_GetItemCount(hList);
- item.pszText = (TCHAR*)jid;
+ item.pszText = (wchar_t*)jid;
int index = ListView_InsertItem(hList, &item);
if (index < 0)
@@ -949,9 +949,9 @@ static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * ni ListView_SetCheckState(hList, index, bChecked);
- ListView_SetItemText(hList, index, 0, (TCHAR*)jid);
- ListView_SetItemText(hList, index, 1, (TCHAR*)nick);
- ListView_SetItemText(hList, index, 2, (TCHAR*)group);
+ ListView_SetItemText(hList, index, 0, (wchar_t*)jid);
+ ListView_SetItemText(hList, index, 1, (wchar_t*)nick);
+ ListView_SetItemText(hList, index, 2, (wchar_t*)group);
ListView_SetItemText(hList, index, 3, TranslateTS(subscr));
return index;
}
@@ -1004,13 +1004,13 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) if (item == NULL)
break;
- const TCHAR *jid = XmlGetAttrValue(item, L"jid");
+ const wchar_t *jid = XmlGetAttrValue(item, L"jid");
if (jid == NULL)
continue;
- const TCHAR *name = XmlGetAttrValue(item, L"name");
- const TCHAR *subscription = XmlGetAttrValue(item, L"subscription");
- const TCHAR *group = XmlGetText(XmlGetChild(item, "group"));
+ const wchar_t *name = XmlGetAttrValue(item, L"name");
+ const wchar_t *subscription = XmlGetAttrValue(item, L"subscription");
+ const wchar_t *group = XmlGetText(XmlGetChild(item, "group"));
_RosterInsertListItem(hList, jid, name, group, subscription, TRUE);
}
@@ -1023,9 +1023,9 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) LVFINDINFO lvfi = { 0 };
lvfi.flags = LVFI_STRING;
lvfi.psz = tszJid;
- TCHAR *p = _tcschr(tszJid, _T('@'));
+ wchar_t *p = wcschr(tszJid, '@');
if (p) {
- p = _tcschr(tszJid, _T('/'));
+ p = wcschr(tszJid, '/');
if (p) *p = 0;
}
if (ListView_FindItem(hList, -1, &lvfi) == -1) {
@@ -1055,10 +1055,10 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) int itemCount = 0;
int ListItemCount = ListView_GetItemCount(hList);
for (int index = 0; index < ListItemCount; index++) {
- TCHAR jid[JABBER_MAX_JID_LEN] = L"";
- TCHAR name[260] = L"";
- TCHAR group[260] = L"";
- TCHAR subscr[260] = L"";
+ wchar_t jid[JABBER_MAX_JID_LEN] = L"";
+ wchar_t name[260] = L"";
+ wchar_t group[260] = L"";
+ wchar_t subscr[260] = L"";
ListView_GetItemText(hList, index, 0, jid, _countof(jid));
ListView_GetItemText(hList, index, 1, name, _countof(name));
ListView_GetItemText(hList, index, 2, group, _countof(group));
@@ -1073,7 +1073,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) else if (!bRemove) {
BOOL bPushed = itemRoster ? TRUE : FALSE;
if (!bPushed) {
- const TCHAR *rosterName = XmlGetAttrValue(itemRoster, L"name");
+ const wchar_t *rosterName = XmlGetAttrValue(itemRoster, L"name");
if ((rosterName != NULL || name[0] != 0) && mir_tstrcmpi(rosterName, name))
bPushed = TRUE;
if (!bPushed) {
@@ -1082,7 +1082,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) bPushed = TRUE;
}
if (!bPushed) {
- const TCHAR *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group"));
+ const wchar_t *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group"));
if ((rosterGroup != NULL || group[0] != 0) && mir_tstrcmpi(rosterGroup, group))
bPushed = TRUE;
}
@@ -1127,7 +1127,7 @@ static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel) {
if (!bCancel) {
int len = GetWindowTextLength(hEditor) + 1;
- TCHAR *buff = (TCHAR*)mir_alloc(len*sizeof(TCHAR));
+ wchar_t *buff = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
if (buff) {
GetWindowText(hEditor, buff, len);
ListView_SetItemText(edat->hList, edat->index, edat->subindex, buff);
@@ -1176,9 +1176,9 @@ static LRESULT CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wP void CJabberProto::_RosterExportToFile(HWND hwndDlg)
{
- TCHAR filename[MAX_PATH] = { 0 };
+ wchar_t filename[MAX_PATH] = { 0 };
- TCHAR filter[MAX_PATH];
+ wchar_t filter[MAX_PATH];
mir_sntprintf(filter, L"%s (*.xml)%c*.xml%c%c", TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -1209,10 +1209,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) << XCHILD(L"Table");
for (int index = 0; index < ListItemCount; index++) {
- TCHAR jid[JABBER_MAX_JID_LEN] = L"";
- TCHAR name[260] = L"";
- TCHAR group[260] = L"";
- TCHAR subscr[260] = L"";
+ wchar_t jid[JABBER_MAX_JID_LEN] = L"";
+ wchar_t name[260] = L"";
+ wchar_t group[260] = L"";
+ wchar_t subscr[260] = L"";
ListView_GetItemText(hList, index, 0, jid, _countof(jid));
ListView_GetItemText(hList, index, 1, name, _countof(name));
ListView_GetItemText(hList, index, 2, group, _countof(group));
@@ -1230,7 +1230,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) char header[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?mso-application progid=\"Excel.Sheet\"?>\n";
fwrite(header, 1, sizeof(header) - 1 /* for zero terminator */, fp);
- TCHAR *xtmp = xmlToString(root, NULL);
+ wchar_t *xtmp = xmlToString(root, NULL);
fputs(T2Utf(xtmp), fp);
xmlFree(xtmp);
fclose(fp);
@@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) fclose(fp);
_RosterListClear(hwndDlg);
- TCHAR *newBuf = mir_utf8decodeT(buffer);
+ wchar_t *newBuf = mir_utf8decodeT(buffer);
mir_free(buffer);
int nBytesProcessed = 0;
@@ -1288,10 +1288,10 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) break;
BOOL bAdd = FALSE;
- const TCHAR *jid = NULL;
- const TCHAR *name = NULL;
- const TCHAR *group = NULL;
- const TCHAR *subscr = NULL;
+ const wchar_t *jid = NULL;
+ const wchar_t *name = NULL;
+ const wchar_t *group = NULL;
+ const wchar_t *subscr = NULL;
HXML Cell = XmlGetNthChild(Row, L"Cell", 1);
HXML Data = (Cell) ? XmlGetChild(Cell, "Data") : XmlNode();
if (Data) {
@@ -1347,7 +1347,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, ListView_SubItemHitTest(hList, &lvhti);
if (lvhti.flags&LVHT_ONITEM && lvhti.iSubItem != 0) {
RECT rc;
- TCHAR buff[260];
+ wchar_t buff[260];
ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS, &rc);
ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff));
HWND hEditor = CreateWindow(TEXT("EDIT"), buff, WS_CHILD | ES_AUTOHSCROLL, rc.left + 3, rc.top + 2, rc.right - rc.left - 3, rc.bottom - rc.top - 3, hList, NULL, hInst, NULL);
@@ -1490,19 +1490,19 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRosterControl(WPARAM, LPARAM) int CJabberProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = new CDlgOptAccount(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Conferences");
+ odp.pwszTab = LPGENW("Conferences");
odp.pDialog = new CDlgOptGc(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Advanced");
+ odp.pwszTab = LPGENW("Advanced");
odp.pDialog = new CDlgOptAdvanced(this);
Options_AddPage(wParam, &odp);
return 0;
@@ -1569,7 +1569,7 @@ protected: m_gotservers = false;
- TCHAR *passw = m_proto->getTStringA(NULL, "Password");
+ wchar_t *passw = m_proto->getTStringA(NULL, "Password");
if (passw) {
m_txtPassword.SetText(passw);
mir_free(passw);
@@ -1578,12 +1578,12 @@ protected: m_cbServer.AddString(TranslateT("Loading..."));
// fill predefined resources
- TCHAR *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
+ wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" };
for (int i = 0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
- TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
@@ -1704,7 +1704,7 @@ protected: m_proto->m_savedPassword = NULL;
BOOL bUseHostnameAsResource = FALSE;
- TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
m_cbResource.GetText(szResource, _countof(szResource));
@@ -1714,7 +1714,7 @@ protected: m_proto->m_options.HostNameAsResource = bUseHostnameAsResource;
if (m_chkSavePassword.GetState() == BST_CHECKED) {
- TCHAR *text = m_txtPassword.GetText();
+ wchar_t *text = m_txtPassword.GetText();
m_proto->setTString("Password", text);
mir_free(text);
}
@@ -2160,7 +2160,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) {
m_gotservers = node != NULL;
- TCHAR *server = m_cbServer.GetText();
+ wchar_t *server = m_cbServer.GetText();
bool bDropdown = m_cbServer.GetDroppedState();
if (bDropdown) m_cbServer.ShowDropdown(false);
@@ -2172,7 +2172,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) break;
if (!mir_tstrcmp(XmlGetName(n), L"item"))
- if (const TCHAR *jid = XmlGetAttrValue(n, L"jid"))
+ if (const wchar_t *jid = XmlGetAttrValue(n, L"jid"))
if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
m_cbServer.AddString(jid);
}
@@ -2199,7 +2199,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
if (result && IsWindow(hwnd)) {
if ((result->resultCode == 200) && result->dataLength && result->pData) {
- TCHAR *ptszText = mir_a2t(result->pData);
+ wchar_t *ptszText = mir_a2t(result->pData);
XmlNode node(ptszText, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index bf3e791698..e1b800afa2 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -41,7 +41,7 @@ CCtrlTreeOpts::~CCtrlTreeOpts() delete m_options[i];
}
-void CCtrlTreeOpts::AddOption(TCHAR *szOption, CMOption<BYTE> &option)
+void CCtrlTreeOpts::AddOption(wchar_t *szOption, CMOption<BYTE> &option)
{
m_options.insert(new COptionsItem(szOption, option), m_options.getCount());
}
@@ -90,7 +90,7 @@ void CCtrlTreeOpts::OnInit() {
CCtrlTreeView::OnInit();
- TCHAR itemName[1024];
+ wchar_t itemName[1024];
HIMAGELIST hImgLst;
SelectItem(NULL);
@@ -108,7 +108,7 @@ void CCtrlTreeOpts::OnInit() /* build options tree. based on code from IcoLib */
for (int i = 0; i < m_options.getCount(); i++) {
- TCHAR *sectionName;
+ wchar_t *sectionName;
int sectionLevel = 0;
HTREEITEM hSection = NULL;
@@ -117,10 +117,10 @@ void CCtrlTreeOpts::OnInit() while (sectionName) {
// allow multi-level tree
- TCHAR *pItemName = sectionName;
+ wchar_t *pItemName = sectionName;
HTREEITEM hItem;
- if (sectionName = _tcschr(sectionName, '/')) {
+ if (sectionName = wcschr(sectionName, '/')) {
// one level deeper
*sectionName = 0;
sectionName++;
@@ -225,7 +225,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) SetItem(&tvi);
}
-CCtrlTreeOpts::COptionsItem::COptionsItem(TCHAR *szOption, CMOption<BYTE> &option) :
+CCtrlTreeOpts::COptionsItem::COptionsItem(wchar_t *szOption, CMOption<BYTE> &option) :
m_option(&option), m_groupId(OPTTREE_CHECK), m_hItem(NULL)
{
m_szOptionName = mir_tstrdup(szOption);
diff --git a/protocols/JabberG/src/jabber_opttree.h b/protocols/JabberG/src/jabber_opttree.h index 5949b8acc5..66e33b4a3d 100644 --- a/protocols/JabberG/src/jabber_opttree.h +++ b/protocols/JabberG/src/jabber_opttree.h @@ -37,7 +37,7 @@ public: CCtrlTreeOpts(CDlgBase* dlg, int ctrlId);
~CCtrlTreeOpts();
- void AddOption(TCHAR *szOption, CMOption<BYTE> &option);
+ void AddOption(wchar_t *szOption, CMOption<BYTE> &option);
BOOL OnNotify(int idCtrl, NMHDR *pnmh);
void OnDestroy();
@@ -47,14 +47,14 @@ public: protected:
struct COptionsItem
{
- TCHAR *m_szOptionName;
+ wchar_t *m_szOptionName;
int m_groupId;
CMOption<BYTE> *m_option;
HTREEITEM m_hItem;
- COptionsItem(TCHAR *szOption, CMOption<BYTE> &option);
+ COptionsItem(wchar_t *szOption, CMOption<BYTE> &option);
~COptionsItem();
};
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index f81d00a074..54d1b74bdd 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -49,7 +49,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_KEYS));
TranslateDialogDefault(hwndDlg);
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
- TCHAR text[1024];
+ wchar_t text[1024];
mir_sntprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server);
SetWindowText(hwndDlg, text);
}
@@ -58,7 +58,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR switch (LOWORD(wParam)) {
case IDOK:
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
- TCHAR newPasswd[512], text[512];
+ wchar_t newPasswd[512], text[512];
GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd));
GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text));
if (mir_tstrcmp(newPasswd, text)) {
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 4e0fac80ed..ba3df4a5b0 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_iq.h"
#include "jabber_privacy.h"
-#define JABBER_PL_BUSY_MSG LPGEN("Sending request, please wait...")
+const wchar_t JABBER_PL_BUSY_MSG[] = LPGENW("Sending request, please wait...");
BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo *pInfo)
{
@@ -56,7 +56,7 @@ void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo) InterlockedDecrement(&pParam->m_dwCount);
if (!pParam->m_dwCount) {
- TCHAR szText[ 512 ];
+ wchar_t szText[ 512 ];
if (!pParam->m_bAllOk)
mir_sntprintf(szText, TranslateT("Error occurred while applying changes"));
else
@@ -73,7 +73,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) if (iqNode == NULL)
return;
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
@@ -86,7 +86,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) HXML list = XmlGetChild(query, "list");
if (list == NULL)
return;
- TCHAR *szListName = (TCHAR*)XmlGetAttrValue(list, L"name");
+ wchar_t *szListName = (wchar_t*)XmlGetAttrValue(list, L"name");
if (!szListName)
return;
@@ -101,7 +101,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) HXML item;
for (int i = 1; (item = XmlGetNthChild(list, L"item", i)) != NULL; i++) {
- const TCHAR *itemType = XmlGetAttrValue(item, L"type");
+ const wchar_t *itemType = XmlGetAttrValue(item, L"type");
PrivacyListRuleType nItemType = Else;
if (itemType) {
if (!mir_tstrcmpi(itemType, L"jid"))
@@ -112,17 +112,17 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) nItemType = Subscription;
}
- const TCHAR *itemValue = XmlGetAttrValue(item, L"value");
+ const wchar_t *itemValue = XmlGetAttrValue(item, L"value");
- const TCHAR *itemAction = XmlGetAttrValue(item, L"action");
+ const wchar_t *itemAction = XmlGetAttrValue(item, L"action");
BOOL bAllow = TRUE;
if (itemAction && !mir_tstrcmpi(itemAction, L"deny"))
bAllow = FALSE;
- const TCHAR *itemOrder = XmlGetAttrValue(item, L"order");
+ const wchar_t *itemOrder = XmlGetAttrValue(item, L"order");
DWORD dwOrder = 0;
if (itemOrder)
- dwOrder = _ttoi(itemOrder);
+ dwOrder = _wtoi(itemOrder);
DWORD dwPackets = 0;
if (XmlGetChild(item , "message"))
@@ -179,7 +179,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo if (iqNode == NULL)
return;
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
@@ -214,11 +214,11 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInf if (iqNode == NULL)
return;
- const TCHAR *type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == NULL)
return;
- TCHAR szText[ 512 ];
+ wchar_t szText[ 512 ];
szText[0] = 0;
{
mir_cslock lck(m_privacyListManager.m_cs);
@@ -262,9 +262,9 @@ void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo) if (list == NULL)
break;
- const TCHAR *listName = XmlGetAttrValue(list, L"name");
+ const wchar_t *listName = XmlGetAttrValue(list, L"name");
if (listName) {
- m_privacyListManager.AddList((TCHAR*)listName);
+ m_privacyListManager.AddList((wchar_t*)listName);
// Query contents only if list editior is visible!
if (m_pDlgPrivacyLists)
@@ -274,7 +274,7 @@ void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo) }
}
- const TCHAR *szName = NULL;
+ const wchar_t *szName = NULL;
HXML node = XmlGetChild(query , "active");
if (node)
szName = XmlGetAttrValue(node, L"name");
@@ -298,7 +298,7 @@ class CJabberDlgPrivacyAddList: public CJabberDlgBase typedef CJabberDlgBase CSuper;
public:
- TCHAR szLine[512];
+ wchar_t szLine[512];
CJabberDlgPrivacyAddList(CJabberProto *proto, HWND hwndParent):
CJabberDlgBase(proto, IDD_PRIVACY_ADD_LIST, false),
@@ -367,7 +367,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prin_allow"), 0);
SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prout_allow"), 0);
- TCHAR *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" };
+ wchar_t *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" };
int i, nTypes[] = { Jid, Group, Subscription, Else };
for (i=0; i < _countof(szTypes); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i]));
@@ -377,7 +377,7 @@ public: }
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
- TCHAR *szSubscriptions[] = { L"none", L"from", L"to", L"both" };
+ wchar_t *szSubscriptions[] = { L"none", L"from", L"to", L"both" };
for (i=0; i < _countof(szSubscriptions); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]);
@@ -452,7 +452,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0);
{
- TCHAR *grpName;
+ wchar_t *grpName;
for (int i=1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++)
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)grpName);
}
@@ -496,7 +496,7 @@ public: case Jid:
case Group:
{
- TCHAR szText[ 512 ];
+ wchar_t szText[ 512 ];
GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, _countof(szText));
m_pRule->SetValue(szText);
}
@@ -505,7 +505,7 @@ public: case Subscription:
nCurSel = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETCURSEL, 0, 0);
if (nCurSel != CB_ERR)
- m_pRule->SetValue((TCHAR*)SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETITEMDATA, nCurSel, 0));
+ m_pRule->SetValue((wchar_t*)SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETITEMDATA, nCurSel, 0));
else
m_pRule->SetValue(L"none");
break;
@@ -606,7 +606,7 @@ protected: void OnCommand_Close(HWND hwndCtrl, WORD idCtrl, WORD idCode);
void ShowAdvancedList(CPrivacyList *pList);
- void DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc);
+ void DrawNextRulePart(HDC hdc, COLORREF color, const wchar_t *text, RECT *rc);
void DrawRuleAction(HDC hdc, COLORREF clLine1, COLORREF clLine2, CPrivacyListRule *pRule, RECT *rc);
void DrawRulesList(LPDRAWITEMSTRUCT lpdis);
void DrawLists(LPDRAWITEMSTRUCT lpdis);
@@ -615,7 +615,7 @@ protected: void CListFilter(HWND hwndList);
void CListResetIcons(HWND hwndList, HANDLE hItem, bool hide=false);
void CListSetupIcons(HWND hwndList, HANDLE hItem, int iSlot, DWORD dwProcess, BOOL bAction);
- HANDLE CListAddContact(HWND hwndList, TCHAR *jid);
+ HANDLE CListAddContact(HWND hwndList, wchar_t *jid);
void CListApplyList(HWND hwndList, CPrivacyList *pList = NULL);
DWORD CListGetPackets(HWND hwndList, HANDLE hItem, bool bAction);
void CListBuildList(HWND hwndList, CPrivacyList *pList);
@@ -631,7 +631,7 @@ protected: struct TJidData
{
HANDLE hItem;
- TCHAR *jid;
+ wchar_t *jid;
static int cmp(const TJidData *p1, const TJidData *p2) { return mir_tstrcmp(p1->jid, p2->jid); }
};
@@ -657,7 +657,7 @@ protected: }
}
- void addJid(HANDLE hItem, TCHAR *jid)
+ void addJid(HANDLE hItem, wchar_t *jid)
{
TJidData *data = (TJidData *)mir_alloc(sizeof(TJidData));
data->hItem = hItem;
@@ -665,7 +665,7 @@ protected: newJids.insert(data);
}
- HANDLE findJid(TCHAR *jid)
+ HANDLE findJid(wchar_t *jid)
{
TJidData data = {0};
data.jid = jid;
@@ -866,10 +866,10 @@ void CJabberDlgPrivacyLists::OnDestroy() void CJabberDlgPrivacyLists::OnProtoRefresh(WPARAM, LPARAM)
{
LRESULT sel = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETCURSEL, 0, 0);
- TCHAR *szCurrentSelectedList = NULL;
+ wchar_t *szCurrentSelectedList = NULL;
if (sel != LB_ERR) {
LRESULT len = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETTEXTLEN, sel, 0) + 1;
- szCurrentSelectedList = (TCHAR *)mir_alloc(len * sizeof(TCHAR));
+ szCurrentSelectedList = (wchar_t *)mir_alloc(len * sizeof(wchar_t));
SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETTEXT, sel, (LPARAM)szCurrentSelectedList);
}
@@ -924,16 +924,16 @@ BOOL CJabberDlgPrivacyLists::OnWmMeasureItem(UINT, WPARAM, LPARAM lParam) struct
{
- TCHAR *textEng;
+ wchar_t *textEng;
char *icon;
- TCHAR *text;
+ wchar_t *text;
}
static drawItems[] =
{
- { LPGENT("Message"), "pl_msg_allow" },
- { LPGENT("Presence (in)"), "pl_prin_allow" },
- { LPGENT("Presence (out)"), "pl_prout_allow" },
- { LPGENT("Query"), "pl_iq_allow" }
+ { LPGENW("Message"), "pl_msg_allow" },
+ { LPGENW("Presence (in)"), "pl_prin_allow" },
+ { LPGENW("Presence (out)"), "pl_prout_allow" },
+ { LPGENW("Query"), "pl_iq_allow" }
};
BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
@@ -988,7 +988,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) CPrivacyListRule* pRule = pList->GetFirstRule();
while (pRule) {
bListEmpty = FALSE;
- TCHAR szTypeValue[ 512 ];
+ wchar_t szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
mir_sntprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue());
@@ -1004,7 +1004,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) break;
}
- TCHAR szPackets[ 512 ];
+ wchar_t szPackets[ 512 ];
szPackets[ 0 ] = '\0';
DWORD dwPackets = pRule->GetPackets();
@@ -1032,7 +1032,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) }
}
- TCHAR szListItem[ 512 ];
+ wchar_t szListItem[ 512 ];
mir_sntprintf(szListItem, L"%s %s %s", szTypeValue, pRule->GetAction() ? L"allow" : L"deny", szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
@@ -1050,7 +1050,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_PL_RULES_LIST, LBN_SELCHANGE), 0);
}
-void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc)
+void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const wchar_t *text, RECT *rc)
{
SetTextColor(hdc, color);
DrawText(hdc, text, -1, rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
@@ -1134,7 +1134,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis) rc.left += 25;
int len = SendDlgItemMessage(m_hwnd, lpdis->CtlID, LB_GETTEXTLEN, lpdis->itemID, 0) + 1;
- TCHAR *str = (TCHAR *)_alloca(len * sizeof(TCHAR));
+ wchar_t *str = (wchar_t *)_alloca(len * sizeof(wchar_t));
SendDlgItemMessage(m_hwnd, lpdis->CtlID, LB_GETTEXT, lpdis->itemID, (LPARAM)str);
DrawNextRulePart(lpdis->hDC, clLine1, str, &rc);
}
@@ -1158,7 +1158,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis) DrawNextRulePart(lpdis->hDC, clLine2, TranslateT("'"), &rc);
if (MCONTACT hContact = m_proto->HContactFromJID(pRule->GetValue())) {
- TCHAR *szName = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *szName = pcli->pfnGetContactDisplayName(hContact, 0);
if (szName) {
DrawNextRulePart(lpdis->hDC, clLine2, TranslateT(" (nickname: "), &rc);
DrawNextRulePart(lpdis->hDC, clLine1, szName, &rc);
@@ -1228,10 +1228,10 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) SetBkMode(lpdis->hDC, TRANSPARENT);
- TCHAR *szDefault, *szActive;
+ wchar_t *szDefault, *szActive;
{ mir_cslock lck(m_proto->m_privacyListManager.m_cs);
- szDefault = NEWTSTR_ALLOCA(m_proto->m_privacyListManager.GetDefaultListName());
- szActive = NEWTSTR_ALLOCA(m_proto->m_privacyListManager.GetActiveListName());
+ szDefault = NEWWSTR_ALLOCA(m_proto->m_privacyListManager.GetDefaultListName());
+ szActive = NEWWSTR_ALLOCA(m_proto->m_privacyListManager.GetActiveListName());
}
RECT rc;
@@ -1240,7 +1240,7 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) bool bActive = false;
bool bDefault = false;
- TCHAR *szName;
+ wchar_t *szName;
if (!pList) {
if (!szActive) bActive = true;
@@ -1324,7 +1324,7 @@ void CJabberDlgPrivacyLists::CListSetupIcons(HWND, HANDLE hItem, int iSlot, DWOR m_clcClist.SetExtraImage(hItem, iSlot, iSlot*2 + (bAction?1:2));
}
-HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, TCHAR *jid)
+HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, wchar_t *jid)
{
MCONTACT hContact = m_proto->HContactFromJID(jid);
if (hContact)
@@ -1445,7 +1445,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) DWORD dwPackets = 0;
HANDLE hItem;
- TCHAR *szJid = NULL;
+ wchar_t *szJid = NULL;
pList->RemoveAllRules();
@@ -1474,7 +1474,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) }
// group handles start with 1 (0 is "root")
- TCHAR *grpName;
+ wchar_t *grpName;
for (MGROUP iGroup = 1; (grpName = Clist_GroupGetName(iGroup, NULL)) != NULL; iGroup++) {
hItem = m_clcClist.FindGroup(iGroup);
if (dwPackets = CListGetPackets(hwndList, hItem, true))
@@ -1635,7 +1635,7 @@ void CJabberDlgPrivacyLists::btnAdvanced_OnClick(CCtrlButton *) void CJabberDlgPrivacyLists::btnAddJid_OnClick(CCtrlButton *)
{
int len = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_NEWJID))+1;
- TCHAR *buf = (TCHAR *)_alloca(sizeof(TCHAR) * len);
+ wchar_t *buf = (wchar_t *)_alloca(sizeof(wchar_t) * len);
GetDlgItemText(m_hwnd, IDC_NEWJID, buf, len);
SetDlgItemText(m_hwnd, IDC_NEWJID, L"");
CListAddContact(GetDlgItem(m_hwnd, IDC_CLIST), buf);
@@ -1663,7 +1663,7 @@ void CJabberDlgPrivacyLists::btnActivate_OnClick(CCtrlButton *) active << XATTR(L"name", pList->GetListName());
lck.unlock();
- SetStatusText(TranslateT(JABBER_PL_BUSY_MSG));
+ SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG));
m_proto->m_ThreadInfo->send(iq);
}
@@ -1690,7 +1690,7 @@ void CJabberDlgPrivacyLists::btnSetDefault_OnClick(CCtrlButton *) XmlAddAttr(defaultTag, L"name", pList->GetListName());
lck.unlock();
- SetStatusText(TranslateT(JABBER_PL_BUSY_MSG));
+ SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG));
m_proto->m_ThreadInfo->send(iq);
}
@@ -1869,7 +1869,7 @@ void CJabberDlgPrivacyLists::btnRemoveList_OnClick(CCtrlButton *) CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList) {
- TCHAR *szListName = pList->GetListName();
+ wchar_t *szListName = pList->GetListName();
if ((m_proto->m_privacyListManager.GetActiveListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetActiveListName())) ||
(m_proto->m_privacyListManager.GetDefaultListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetDefaultListName())))
{
@@ -1958,7 +1958,7 @@ void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *) pList = pList->GetNext();
} }
- SetStatusText(TranslateT(JABBER_PL_BUSY_MSG));
+ SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG));
PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0);
}
@@ -2103,7 +2103,7 @@ void CJabberProto::BuildPrivacyMenu() mi.position = 3000040000;
mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR;
mi.hIcolibItem = GetIconHandle(IDI_PRIVACY_LISTS);
- mi.name.t = LPGENT("List Editor...");
+ mi.name.w = LPGENW("List Editor...");
mi.root = m_hPrivacyMenuRoot;
Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
@@ -2134,7 +2134,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) }
mi.position++;
mi.hIcolibItem = Skin_GetIconHandle(m_privacyListManager.GetActiveListName() ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
- mi.name.t = LPGENT("<none>");
+ mi.name.w = LPGENW("<none>");
m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
@@ -2149,7 +2149,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.position++;
mi.hIcolibItem = Skin_GetIconHandle(
mir_tstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
- mi.name.t = pList->GetListName();
+ mi.name.w = pList->GetListName();
m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName));
}
}
diff --git a/protocols/JabberG/src/jabber_privacy.h b/protocols/JabberG/src/jabber_privacy.h index 6f48cebd11..67b8ce7e33 100644 --- a/protocols/JabberG/src/jabber_privacy.h +++ b/protocols/JabberG/src/jabber_privacy.h @@ -58,7 +58,7 @@ class CPrivacyListRule protected:
friend class CPrivacyList;
public:
- CPrivacyListRule(CJabberProto *ppro, PrivacyListRuleType type = Else, const TCHAR *szValue = L"", BOOL bAction = TRUE, DWORD dwOrder = 90, DWORD dwPackets = 0)
+ CPrivacyListRule(CJabberProto *ppro, PrivacyListRuleType type = Else, const wchar_t *szValue = L"", BOOL bAction = TRUE, DWORD dwOrder = 90, DWORD dwPackets = 0)
{
m_proto = ppro;
m_szValue = mir_tstrdup(szValue);
@@ -103,11 +103,11 @@ public: m_nType = type;
return TRUE;
}
- __inline TCHAR* GetValue()
+ __inline wchar_t* GetValue()
{
return m_szValue;
}
- __inline BOOL SetValue(TCHAR *szValue)
+ __inline BOOL SetValue(wchar_t *szValue)
{
replaceStrT(m_szValue, szValue);
return TRUE;
@@ -133,7 +133,7 @@ public: CJabberProto* m_proto;
protected:
PrivacyListRuleType m_nType;
- TCHAR *m_szValue;
+ wchar_t *m_szValue;
BOOL m_bAction;
DWORD m_dwOrder;
DWORD m_dwPackets;
@@ -145,7 +145,7 @@ class CPrivacyList {
protected:
CPrivacyListRule *m_pRules;
- TCHAR *m_szListName;
+ wchar_t *m_szListName;
CPrivacyList *m_pNext;
BOOL m_bLoaded;
BOOL m_bModified;
@@ -153,7 +153,7 @@ protected: public:
CJabberProto* m_proto;
- CPrivacyList(CJabberProto *ppro, TCHAR *szListName)
+ CPrivacyList(CJabberProto *ppro, wchar_t *szListName)
{
m_proto = ppro;
m_szListName = mir_tstrdup(szListName);
@@ -177,7 +177,7 @@ public: m_pRules = NULL;
return TRUE;
}
- __inline TCHAR* GetListName()
+ __inline wchar_t* GetListName()
{
return m_szListName;
}
@@ -195,7 +195,7 @@ public: m_pNext = pNext;
return pRetVal;
}
- BOOL AddRule(PrivacyListRuleType type, const TCHAR *szValue, BOOL bAction, DWORD dwOrder, DWORD dwPackets)
+ BOOL AddRule(PrivacyListRuleType type, const wchar_t *szValue, BOOL bAction, DWORD dwOrder, DWORD dwPackets)
{
CPrivacyListRule *pRule = new CPrivacyListRule(m_proto, type, szValue, bAction, dwOrder, dwPackets);
if (!pRule)
@@ -319,8 +319,8 @@ public: class CPrivacyListManager
{
protected:
- TCHAR *m_szActiveListName;
- TCHAR *m_szDefaultListName;
+ wchar_t *m_szActiveListName;
+ wchar_t *m_szDefaultListName;
CPrivacyList *m_pLists;
BOOL m_bModified;
@@ -342,19 +342,19 @@ public: mir_free(m_szDefaultListName);
RemoveAllLists();
};
- void SetActiveListName(const TCHAR *szListName)
+ void SetActiveListName(const wchar_t *szListName)
{
replaceStrT(m_szActiveListName, szListName);
}
- void SetDefaultListName(const TCHAR *szListName)
+ void SetDefaultListName(const wchar_t *szListName)
{
replaceStrT(m_szDefaultListName, szListName);
}
- TCHAR* GetDefaultListName()
+ wchar_t* GetDefaultListName()
{
return m_szDefaultListName;
}
- TCHAR* GetActiveListName()
+ wchar_t* GetActiveListName()
{
return m_szActiveListName;
}
@@ -365,7 +365,7 @@ public: m_pLists = NULL;
return TRUE;
}
- CPrivacyList* FindList(const TCHAR *szListName)
+ CPrivacyList* FindList(const wchar_t *szListName)
{
CPrivacyList *pList = m_pLists;
while (pList) {
@@ -379,7 +379,7 @@ public: {
return m_pLists;
}
- BOOL AddList(TCHAR *szListName)
+ BOOL AddList(wchar_t *szListName)
{
if (FindList(szListName))
return FALSE;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 96bbe0c424..2f847dd408 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(disable:4355)
-static int compareTransports(const TCHAR *p1, const TCHAR *p2)
+static int compareTransports(const wchar_t *p1, const wchar_t *p2)
{
return mir_tstrcmpi(p1, p2);
}
@@ -46,13 +46,13 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * || (p1->list == LIST_BOOKMARK) || (p1->list == LIST_VCARD_TEMP))
return mir_tstrcmpi(p1->jid, p2->jid);
- TCHAR szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
+ wchar_t szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
JabberStripJid(p1->jid, szp1, _countof(szp1));
JabberStripJid(p2->jid, szp2, _countof(szp2));
return mir_tstrcmpi(szp1, szp2);
}
-CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) :
+CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
PROTO<CJabberProto>(aProtoName, aUserName),
m_options(this),
m_lstTransports(50, compareTransports),
@@ -246,7 +246,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) if (jid == NULL)
continue;
- TCHAR *resourcepos = _tcschr(jid, '/');
+ wchar_t *resourcepos = wcschr(jid, '/');
if (resourcepos != NULL)
*resourcepos = '\0';
@@ -295,7 +295,7 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) ////////////////////////////////////////////////////////////////////////////////////////
// JabberAddToList - adds a contact to the contact list
-MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
+MCONTACT CJabberProto::AddToListByJID(const wchar_t *newJid, DWORD flags)
{
debugLog(L"AddToListByJID jid = %s", newJid);
@@ -308,10 +308,10 @@ MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) MCONTACT CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id.t == NULL)
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id.w == NULL)
return NULL;
- return AddToListByJID(psr->id.t, flags);
+ return AddToListByJID(psr->id.w, flags);
}
MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbEvent)
@@ -340,7 +340,7 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV char *lastName = firstName + mir_strlen(firstName) + 1;
char *jid = lastName + mir_strlen(lastName) + 1;
- TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
MCONTACT hContact = (MCONTACT)AddToListByJID(newJid, flags);
mir_free(newJid);
return hContact;
@@ -373,7 +373,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) debugLog(L"Send 'authorization allowed' to %s", jid);
- TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed"));
@@ -398,7 +398,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) ////////////////////////////////////////////////////////////////////////////////////////
// JabberAuthDeny - handles the unsuccessful authorization
-int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)
+int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
if (!m_bJabberOnline)
return 1;
@@ -437,7 +437,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) ////////////////////////////////////////////////////////////////////////////////////////
// JabberFileAllow - starts a file transfer
-HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, const TCHAR *szPath)
+HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, const wchar_t *szPath)
{
if (!m_bJabberOnline)
return 0;
@@ -493,7 +493,7 @@ int __cdecl CJabberProto::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// JabberFileDeny - denies a file transfer
-int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *)
+int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t *)
{
if (!m_bJabberOnline)
return 1;
@@ -521,7 +521,7 @@ int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *) ////////////////////////////////////////////////////////////////////////////////////////
// JabberFileResume - processes file renaming etc
-int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename)
+int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename)
{
filetransfer *ft = (filetransfer*)hTransfer;
if (!m_bJabberOnline || ft == NULL)
@@ -553,7 +553,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) case PFLAG_UNIQUEIDSETTING:
return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
- TCHAR szClientJid[JABBER_MAX_JID_LEN];
+ wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
@@ -570,7 +570,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) if (!m_bJabberOnline || isChatRoom(hContact))
return 1;
- TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
+ wchar_t jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
if (!GetClientJID(hContact, jid, _countof(jid)))
return 1;
@@ -609,7 +609,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) if (item->arResources.getCount()) {
for (int i = 0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
- TCHAR tmp[JABBER_MAX_JID_LEN];
+ wchar_t tmp[JABBER_MAX_JID_LEN];
mir_sntprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
@@ -649,7 +649,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) struct JABBER_SEARCH_BASIC
{
int hSearch;
- TCHAR jid[128];
+ wchar_t jid[128];
};
void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb)
@@ -660,17 +660,17 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.nick.t = jsb->jid;
- psr.firstName.t = L"";
- psr.lastName.t = L"";
- psr.id.t = jsb->jid;
+ psr.nick.w = jsb->jid;
+ psr.firstName.w = L"";
+ psr.lastName.w = L"";
+ psr.id.w = jsb->jid;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)jsb->hSearch, 0);
mir_free(jsb);
}
-HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
+HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid)
{
debugLog(L"JabberBasicSearch called with lParam = '%s'", szJid);
@@ -678,12 +678,12 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) if (!m_bJabberOnline || (jsb = (JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
return 0;
- if (_tcschr(szJid, '@') == NULL) {
- TCHAR *szServer = mir_a2t(m_ThreadInfo->conn.server);
- const TCHAR *p = _tcsstr(szJid, szServer);
+ if (wcschr(szJid, '@') == NULL) {
+ wchar_t *szServer = mir_a2t(m_ThreadInfo->conn.server);
+ const wchar_t *p = wcsstr(szJid, szServer);
if (p == NULL) {
bool numericjid = true;
- for (const TCHAR *i = szJid; *i && numericjid; i++)
+ for (const wchar_t *i = szJid; *i && numericjid; i++)
numericjid = (*i >= '0') && (*i <= '9');
mir_free(szServer);
@@ -696,10 +696,10 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) }
mir_sntprintf(jsb->jid, L"%s@%s", szJid, szServer);
}
- else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
+ else wcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
}
- else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
+ else wcsncpy_s(jsb->jid, szJid, _TRUNCATE);
debugLog(L"Adding '%s' without validation", jsb->jid);
jsb->hSearch = SerialNext();
@@ -710,7 +710,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) ////////////////////////////////////////////////////////////////////////////////////////
// SearchByEmail - searches the contact by its e-mail
-HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email)
+HANDLE __cdecl CJabberProto::SearchByEmail(const wchar_t *email)
{
if (!m_bJabberOnline || email == NULL)
return 0;
@@ -726,7 +726,7 @@ HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email) ////////////////////////////////////////////////////////////////////////////////////////
// JabberSearchByName - searches the contact by its first or last name, or by a nickname
-HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
+HANDLE __cdecl CJabberProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName)
{
if (!m_bJabberOnline)
return NULL;
@@ -790,7 +790,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC if (!m_bJabberOnline)
return 0;
- TCHAR szClientJid[JABBER_MAX_JID_LEN];
+ wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
@@ -815,7 +815,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR** ppszFiles)
+HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t** ppszFiles)
{
if (!m_bJabberOnline) return 0;
@@ -867,12 +867,12 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript while (ppszFiles[ft->std.totalFiles] != NULL)
ft->std.totalFiles++;
- ft->std.ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)* ft->std.totalFiles);
+ ft->std.ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)* ft->std.totalFiles);
ft->fileSize = (unsigned __int64*)mir_calloc(sizeof(unsigned __int64)* ft->std.totalFiles);
int i, j;
for (i = j = 0; i < ft->std.totalFiles; i++) {
- if (_tstati64(ppszFiles[i], &statbuf))
+ if (_wstat64(ppszFiles[i], &statbuf))
debugLog(L"'%s' is an invalid filename", ppszFiles[i]);
else {
ft->std.ptszFiles[j] = mir_tstrdup(ppszFiles[i]);
@@ -928,7 +928,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
- TCHAR szClientJid[JABBER_MAX_JID_LEN];
+ wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID"));
ForkThread(&CJabberProto::SendMessageAckThread, param);
@@ -947,13 +947,13 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) }
else isEncrypted = 0;
- TCHAR *msg;
+ wchar_t *msg;
mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &msg);
if (msg == NULL)
return 0;
- TCHAR *msgType;
- if (ListGetItemPtr(LIST_CHATROOM, szClientJid) && _tcschr(szClientJid, '/') == NULL)
+ wchar_t *msgType;
+ if (ListGetItemPtr(LIST_CHATROOM, szClientJid) && wcschr(szClientJid, '/') == NULL)
msgType = L"groupchat";
else
msgType = L"chat";
@@ -1119,7 +1119,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) }
}
- TCHAR *str = (TCHAR*)alloca(sizeof(TCHAR)*(len + 1));
+ wchar_t *str = (wchar_t*)alloca(sizeof(wchar_t)*(len + 1));
str[0] = str[len] = '\0';
for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = item->arResources[i];
@@ -1138,7 +1138,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) return;
}
- TCHAR *tszStatusMsg = item->getTemp()->m_tszStatusMessage;
+ wchar_t *tszStatusMsg = item->getTemp()->m_tszStatusMessage;
if (tszStatusMsg != NULL) {
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)tszStatusMsg);
return;
@@ -1160,11 +1160,11 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(MCONTACT hContact) ////////////////////////////////////////////////////////////////////////////////////////
// JabberSetAwayMsg - sets the away status message
-int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg)
+int __cdecl CJabberProto::SetAwayMsg(int status, const wchar_t *msg)
{
debugLog(L"SetAwayMsg called, wParam=%d lParam=%s", status, msg);
- TCHAR **szMsg;
+ wchar_t **szMsg;
mir_cslockfull lck(m_csModeMsgMutex);
switch (status) {
@@ -1217,7 +1217,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type) {
if (!m_bJabberOnline) return 0;
- TCHAR szClientJid[JABBER_MAX_JID_LEN];
+ wchar_t szClientJid[JABBER_MAX_JID_LEN];
if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index a594a451a4..d1ee6abe76 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -42,7 +42,7 @@ struct CJabberProto; enum TJabberGcLogInfoType { INFO_BAN, INFO_STATUS, INFO_CONFIG, INFO_AFFILIATION, INFO_ROLE };
-typedef UNIQUE_MAP<TCHAR,TCharKeyCmp> U_TCHAR_MAP;
+typedef UNIQUE_MAP<wchar_t,TCharKeyCmp> U_TCHAR_MAP;
#define JABBER_DEFAULT_RECENT_COUNT 10
@@ -62,12 +62,12 @@ struct TFilterInfo volatile Type type;
mir_cs csPatternLock;
- TCHAR pattern[256];
+ wchar_t pattern[256];
};
struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
{
- CJabberProto(const char*, const TCHAR*);
+ CJabberProto(const char*, const wchar_t*);
~CJabberProto();
//====================================================================================
@@ -78,33 +78,33 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR *email);
- virtual HANDLE __cdecl SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t *email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg);
virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -144,12 +144,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE m_hThreadHandle;
- TCHAR *m_szJabberJID;
+ wchar_t *m_szJabberJID;
int m_nJabberSearchID;
time_t m_tmJabberLoggedInTime;
time_t m_tmJabberIdleStartTime;
UINT m_nJabberCodePage;
- TCHAR *m_tszSelectedLang;
+ wchar_t *m_tszSelectedLang;
mir_cs m_csModeMsgMutex;
JABBER_MODEMSGS m_modeMsgs;
@@ -183,7 +183,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE m_hEventXStatusChanged;
// Transports list
- LIST<TCHAR> m_lstTransports;
+ LIST<wchar_t> m_lstTransports;
CJabberIqManager m_iqManager;
CJabberMessageManager m_messageManager;
@@ -261,10 +261,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResult_ListOfCommands(HXML iqNode, CJabberIqInfo*);
void OnIqResult_CommandExecution(HXML iqNode, CJabberIqInfo*);
- void AdHoc_RequestListOfCommands(TCHAR * szResponder, HWND hwndDlg);
- int AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR * jid, struct JabberAdHocData* dat);
- int AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData * dat, TCHAR* action);
- int AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, int ypos, int value);
+ void AdHoc_RequestListOfCommands(wchar_t * szResponder, HWND hwndDlg);
+ int AdHoc_ExecuteCommand(HWND hwndDlg, wchar_t * jid, struct JabberAdHocData* dat);
+ int AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData * dat, wchar_t* action);
+ int AdHoc_AddCommandRadio(HWND hFrame, wchar_t * labelStr, int id, int ypos, int value);
int AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat);
int AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberAdHocData* dat);
@@ -289,7 +289,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void CJabberProto::ProcessIncomingNote(CNoteItem *pNote, bool ok);
void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok);
- bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml);
+ bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml);
INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM, LPARAM);
INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM);
@@ -310,31 +310,31 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_caps.cpp ---------------------------------------------------------------
- JabberCapsBits GetTotalJidCapabilites(const TCHAR *jid);
- JabberCapsBits GetResourceCapabilites(const TCHAR *jid, BOOL appendBestResource);
+ JabberCapsBits GetTotalJidCapabilites(const wchar_t *jid);
+ JabberCapsBits GetResourceCapabilites(const wchar_t *jid, BOOL appendBestResource);
//---- jabber_captcha.cpp ------------------------------------------------------------
- void sendCaptchaResult(TCHAR* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid);
+ void sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid);
void sendCaptchaError(ThreadData *info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge);
//---- jabber_chat.cpp ---------------------------------------------------------------
int GcInit(JABBER_LIST_ITEM *item);
- void GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode = -1);
+ void GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t *resource, const wchar_t *nick, const wchar_t *jid, int action, HXML reason, int nStatusCode = -1);
void GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus &user, TJabberGcLogInfoType type);
void GcQuit(JABBER_LIST_ITEM* jid, int code, HXML reason);
void FilterList(HWND hwndList);
void ResetListOptions(HWND hwndList);
- void InviteUser(TCHAR *room, TCHAR *pUser, TCHAR *text);
+ void InviteUser(wchar_t *room, wchar_t *pUser, wchar_t *text);
- void AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal);
- void AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo);
- void AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn);
- void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str);
- void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn);
- void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* jid);
+ void AdminSet(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal);
+ void AdminGet(const wchar_t *to, const wchar_t *ns, const wchar_t *var, const wchar_t *varVal, JABBER_IQ_HANDLER foo);
+ void AdminSetReason(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal, const wchar_t *rsn);
+ void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str);
+ void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str, const wchar_t* rsn);
+ void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* jid);
//---- jabber_console.cpp ------------------------------------------------------------
@@ -349,7 +349,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_disco.cpp --------------------------------------------------------------
- void LaunchServiceDiscovery(TCHAR *jid);
+ void LaunchServiceDiscovery(wchar_t *jid);
INT_PTR __cdecl OnMenuHandleServiceDiscovery(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnMenuHandleServiceDiscoveryMyTransports(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam);
@@ -368,12 +368,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface BOOL SyncTree(HTREELISTITEM hIndex, CJabberSDNode *pNode);
void ServiceDiscoveryShowMenu(CJabberSDNode *node, HTREELISTITEM hItem, POINT pt);
- int SetupServiceDiscoveryDlg(TCHAR* jid);
+ int SetupServiceDiscoveryDlg(wchar_t* jid);
void OnIqResultCapsDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultCapsDiscoInfoSI(HXML iqNode, CJabberIqInfo *pInfo);
- void RegisterAgent(HWND hwndDlg, TCHAR* jid);
+ void RegisterAgent(HWND hwndDlg, wchar_t* jid);
//---- jabber_file.cpp ---------------------------------------------------------------
@@ -382,14 +382,14 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void UpdateChatUserStatus(wchar_t* chat_jid, wchar_t* jid, wchar_t* nick, int role, int affil, int status, BOOL update_nick);
- void GroupchatJoinRoomByJid(HWND hwndParent, TCHAR *jid);
+ void GroupchatJoinRoomByJid(HWND hwndParent, wchar_t *jid);
- void RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *oldNick, HXML itemNode);
- void AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password);
+ void RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *oldNick, HXML itemNode);
+ void AcceptGroupchatInvite(const wchar_t *roomJid, const wchar_t *reason, const wchar_t *password);
//---- jabber_form.c -----------------------------------------------------------------
- void FormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata);
+ void FormCreateDialog(HXML xNode, wchar_t* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata);
//---- jabber_ft.c -------------------------------------------------------------------
@@ -397,7 +397,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void __cdecl FileServerThread(filetransfer *ft);
void FtCancel(filetransfer *ft);
- void FtInitiate(TCHAR* jid, filetransfer *ft);
+ void FtInitiate(wchar_t* jid, filetransfer *ft);
void FtHandleSiRequest(HXML iqNode);
void FtAcceptSiRequest(filetransfer *ft);
void FtAcceptIbbRequest(filetransfer *ft);
@@ -415,7 +415,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void GroupchatProcessPresence(HXML node);
void GroupchatProcessMessage(HXML node);
void GroupchatProcessInvite(LPCTSTR roomJid, LPCTSTR from, LPCTSTR reason, LPCTSTR password);
- void GroupchatJoinDlg(TCHAR* roomJid);
+ void GroupchatJoinDlg(wchar_t* roomJid);
void OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo);
//---- jabber_icolib.cpp -------------------------------------------------------------
@@ -426,15 +426,15 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE GetIconHandle(int iconId);
HICON LoadIconEx(const char* name, bool big = false);
int LoadAdvancedIcons(int iID);
- int GetTransportProtoID(TCHAR* TransportDomain);
+ int GetTransportProtoID(wchar_t* TransportDomain);
int GetTransportStatusIconIndex(int iID, int Status);
- BOOL DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hContact);
+ BOOL DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hContact);
void CheckAllContactsAreTransported(void);
INT_PTR __cdecl JGetAdvancedStatusIcon(WPARAM wParam, LPARAM lParam);
//---- jabber_iq.c -------------------------------------------------------------------
- __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const TCHAR *szReceiver = NULL, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT)
+ __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const wchar_t *szReceiver = NULL, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT)
{
return m_iqManager.AddHandler(pHandler, nIqType, szReceiver, dwParamsToParse, nIqId, pUserData, iPriority);
}
@@ -449,7 +449,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo);
- void OnIqResultGotAvatar(MCONTACT hContact, HXML n, const TCHAR *mimeType);
+ void OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t *mimeType);
void OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetRegister(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo);
@@ -494,7 +494,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIbbInitiateResult(HXML iqNode, CJabberIqInfo *pInfo);
void OnIbbCloseResult(HXML iqNode, CJabberIqInfo *pInfo);
BOOL OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo);
- BOOL OnIbbRecvdData(const TCHAR *data, const TCHAR *sid, const TCHAR *seq);
+ BOOL OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const wchar_t *seq);
void OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo);
BOOL FtIbbSend(int blocksize, filetransfer *ft);
@@ -516,23 +516,23 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_list.cpp ---------------------------------------------------------------
- JABBER_LIST_ITEM* ListAdd(JABBER_LIST list, const TCHAR *jid, MCONTACT hContact = 0);
- JABBER_LIST_ITEM* ListGetItemPtr(JABBER_LIST list, const TCHAR *jid);
+ JABBER_LIST_ITEM* ListAdd(JABBER_LIST list, const wchar_t *jid, MCONTACT hContact = 0);
+ JABBER_LIST_ITEM* ListGetItemPtr(JABBER_LIST list, const wchar_t *jid);
JABBER_LIST_ITEM* ListGetItemPtrFromIndex(int index);
void ListInit(void);
void ListWipe(void);
- void ListRemove(JABBER_LIST list, const TCHAR *jid);
+ void ListRemove(JABBER_LIST list, const wchar_t *jid);
void ListRemoveList(JABBER_LIST list);
void ListRemoveByIndex(int index);
int ListFindNext(JABBER_LIST list, int fromOffset);
- pResourceStatus ListFindResource(JABBER_LIST list, const TCHAR *jid);
+ pResourceStatus ListFindResource(JABBER_LIST list, const wchar_t *jid);
- bool ListAddResource(JABBER_LIST list, const TCHAR *jid, int status, const TCHAR *statusMessage, char priority = 0, const TCHAR *nick = NULL);
- void ListRemoveResource(JABBER_LIST list, const TCHAR *jid);
- TCHAR* ListGetBestClientResourceNamePtr(const TCHAR *jid);
+ bool ListAddResource(JABBER_LIST list, const wchar_t *jid, int status, const wchar_t *statusMessage, char priority = 0, const wchar_t *nick = NULL);
+ void ListRemoveResource(JABBER_LIST list, const wchar_t *jid);
+ wchar_t* ListGetBestClientResourceNamePtr(const wchar_t *jid);
void SetMucConfig(HXML node, void *from);
void OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType);
@@ -575,12 +575,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface INT_PTR __cdecl OnGetEventTextChatStates(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnGetEventTextPresence(WPARAM wParam, LPARAM lParam);
- void AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName);
- void DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick);
+ void AddContactToRoster(const wchar_t *jid, const wchar_t *nick, const wchar_t *grpName);
+ void DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick);
BOOL AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType);
- MCONTACT DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool temporary, bool stripResource);
- void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen);
- void ResolveTransportNicks(const TCHAR *jid);
+ MCONTACT DBCreateContact(const wchar_t *jid, const wchar_t *nick, bool temporary, bool stripResource);
+ void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen);
+ void ResolveTransportNicks(const wchar_t *jid);
void SetServerStatus(int iNewStatus);
void FormatMirVer(pResourceStatus &resource, CMString&);
void UpdateMirVer(JABBER_LIST_ITEM *item);
@@ -588,7 +588,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item);
void SetContactOfflineStatus(MCONTACT hContact);
void InitPopups(void);
- void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle);
+ void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle);
CMString ExtractImage(HXML node);
//---- jabber_opt.cpp ----------------------------------------------------------------
@@ -627,7 +627,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void __cdecl GetAwayMsgThread(void* hContact);
void __cdecl SendMessageAckThread(void* hContact);
- MCONTACT AddToListByJID(const TCHAR *newJid, DWORD flags);
+ MCONTACT AddToListByJID(const wchar_t *newJid, DWORD flags);
void InfoFrame_OnSetup(CJabberInfoFrame_Event *evt);
void InfoFrame_OnTransport(CJabberInfoFrame_Event *evt);
@@ -642,8 +642,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo);
int SearchRenewFields(HWND hwndDlg, JabberSearchData * dat);
- void SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB);
- void SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog = NULL);
+ void SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLastFromDB);
+ void SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog = NULL);
//---- jabber_std.cpp ----------------------------------------------
void JLoginFailed(int errorCode);
@@ -687,7 +687,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface bool isKerberosAvailable;
bool isAuthAvailable;
bool isSessionAvailable;
- TCHAR *m_gssapiHostName;
+ wchar_t *m_gssapiHostName;
} AUTHMECHS;
AUTHMECHS m_AuthMechs;
@@ -708,8 +708,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnProcessStreamOpening(HXML node, ThreadData *info);
void OnProcessProtocol(HXML node, ThreadData *info);
- void UpdateJidDbSettings(const TCHAR *jid);
- MCONTACT CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem);
+ void UpdateJidDbSettings(const wchar_t *jid);
+ MCONTACT CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem);
void PerformRegistration(ThreadData *info);
void PerformIqAuth(ThreadData *info);
@@ -728,12 +728,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface bool ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info);
//---- jabber_util.c -----------------------------------------------------------------
- pResourceStatus ResourceInfoFromJID(const TCHAR *jid);
+ pResourceStatus ResourceInfoFromJID(const wchar_t *jid);
- MCONTACT HContactFromJID(const TCHAR *jid, bool bStripResource = true);
- MCONTACT ChatRoomHContactFromJID(const TCHAR *jid);
+ MCONTACT HContactFromJID(const wchar_t *jid, bool bStripResource = true);
+ MCONTACT ChatRoomHContactFromJID(const wchar_t *jid);
void SendVisibleInvisiblePresence(BOOL invisible);
- void SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg = NULL);
+ void SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg = NULL);
void SendPresence(int m_iStatus, bool bSendToAll);
void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...);
@@ -741,11 +741,11 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void InitInfoFrame(void);
// returns buf or NULL on error
- TCHAR* GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen);
- TCHAR* GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen);
+ wchar_t* GetClientJID(MCONTACT hContact, wchar_t *dest, size_t destLen);
+ wchar_t* GetClientJID(const wchar_t *jid, wchar_t *dest, size_t destLen);
void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
- void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
+ void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
BOOL EnterString(CMString &result, LPCTSTR caption, int type, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0);
bool IsMyOwnJID(LPCTSTR szJID);
@@ -755,12 +755,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface int m_vCardUpdates;
bool m_bPhotoChanged;
- TCHAR m_szPhotoFileName[MAX_PATH];
+ wchar_t m_szPhotoFileName[MAX_PATH];
void OnUserInfoInit_VCard(WPARAM, LPARAM);
- int SendGetVcard(const TCHAR *jid);
+ int SendGetVcard(const wchar_t *jid);
void AppendVcardFromDB(HXML n, char* tag, char* key);
- void SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName);
+ void SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName);
void SaveVcardToDB(HWND hwndPage, int iPage);
//---- jabber_ws.c -------------------------------------------------
@@ -793,11 +793,11 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void RegisterAdvStatusSlot(const char *pszSlot);
void ResetAdvStatus(MCONTACT hContact, const char *pszSlot);
- void WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText);
+ void WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const wchar_t *pszMode, const char *pszIcon, const wchar_t *pszTitle, const wchar_t *pszText);
char* ReadAdvStatusA(MCONTACT hContact, const char *pszSlot, const char *pszValue);
- TCHAR* ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue);
+ wchar_t* ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue);
- BOOL SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri);
+ BOOL SendPepTune(wchar_t* szArtist, wchar_t* szLength, wchar_t* szSource, wchar_t* szTitle, wchar_t* szTrack, wchar_t* szUri);
void XStatusInit(void);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index c851f55959..c4bd0161b9 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -58,15 +58,15 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo) return TRUE;
}
- const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
+ const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node");
if (!szNode)
return TRUE;
- m_adhocManager.HandleCommandRequest(iqNode, pInfo, (TCHAR*)szNode);
+ m_adhocManager.HandleCommandRequest(iqNode, pInfo, (wchar_t*)szNode);
return TRUE;
}
-BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
@@ -79,7 +79,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T CJabberAdhocNode* pNode = GetFirstNode();
while (pNode) {
- TCHAR *szJid = pNode->GetJid();
+ wchar_t *szJid = pNode->GetJid();
if (!szJid)
szJid = m_pProto->m_ThreadInfo->fullJID;
@@ -96,7 +96,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T return FALSE;
}
-BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
@@ -135,7 +135,7 @@ BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TC return TRUE;
}
-BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
// ATTN: ACL and db settings checked in calling function
@@ -154,7 +154,7 @@ BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo return FALSE;
}
- const TCHAR *szSessionId = XmlGetAttrValue(commandNode, L"sessionid");
+ const wchar_t *szSessionId = XmlGetAttrValue(commandNode, L"sessionid");
CJabberAdhocSession* pSession = NULL;
if (szSessionId) {
@@ -309,7 +309,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode << XCHILD(L"option") << XATTR(L"label", TranslateT("Offline")) << XCHILD(L"value", L"offline");
// priority
- TCHAR szPriority[ 256 ];
+ wchar_t szPriority[ 256 ];
mir_sntprintf(szPriority, L"%d", (int)getDword("Priority", 5));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Priority")) << XATTR(L"type", L"text-single")
<< XATTR(L"var", L"status-priority") << XCHILD(L"value", szPriority);
@@ -322,7 +322,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Change global status"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"status-global");
- ptrT tszStatusMsg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
+ ptrT tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
if (tszStatusMsg)
fieldNode << XCHILD(L"value", tszStatusMsg);
@@ -361,12 +361,12 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-priority");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
if (ptszValue = XmlGetText(valueNode))
- priority = _ttoi(ptszValue);
+ priority = _wtoi(ptszValue);
if (priority >= -128 && priority <= 127)
setDword("Priority", priority);
- const TCHAR *szStatusMessage = NULL;
+ const wchar_t *szStatusMessage = NULL;
fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-message");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
szStatusMessage = XmlGetText(valueNode);
@@ -379,7 +379,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-global");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) {
- if ((ptszValue = XmlGetText(valueNode)) != NULL && _ttoi(ptszValue))
+ if ((ptszValue = XmlGetText(valueNode)) != NULL && _wtoi(ptszValue))
CallService(MS_CLIST_SETSTATUSMODE, status, NULL);
else
CallProtoService(m_szModuleName, PS_SETSTATUS, status, NULL);
@@ -413,7 +413,7 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe << XATTR(L"value", JABBER_FEAT_RC);
// Automatically Accept File Transfers
- TCHAR szTmpBuff[ 1024 ];
+ wchar_t szTmpBuff[ 1024 ];
mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Automatically Accept File Transfers"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"auto-files") << XCHILD(L"value", szTmpBuff);
@@ -442,18 +442,18 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe HXML fieldNode = XmlGetChildByTag(xNode, "field", "var", L"auto-files"), valueNode;
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
if (XmlGetText(valueNode))
- db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)_ttoi(XmlGetText(valueNode)));
+ db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)_wtoi(XmlGetText(valueNode)));
// Use sounds
fieldNode = XmlGetChildByTag(xNode, "field", "var", L"sounds");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
if (XmlGetText(valueNode))
- db_set_b(NULL, "Skin", "UseSound", (BYTE)_ttoi(XmlGetText(valueNode)));
+ db_set_b(NULL, "Skin", "UseSound", (BYTE)_wtoi(XmlGetText(valueNode)));
// Disable remote controlling
fieldNode = XmlGetChildByTag(xNode, "field", "var", L"enable-rc");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
- if (XmlGetText(valueNode) && _ttoi(XmlGetText(valueNode)))
+ if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode)))
m_options.EnableRemoteControl = 0;
return JABBER_ADHOC_HANDLER_STATUS_COMPLETED;
@@ -477,7 +477,7 @@ int CJabberProto::RcGetUnreadEventsCount() dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
int nGetTextResult = db_event_get(hDbEvent, &dbei);
if (!nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
- TCHAR *szEventText = DbGetEventTextT(&dbei, CP_ACP);
+ wchar_t *szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
nEventsSent++;
mir_free(szEventText);
@@ -491,7 +491,7 @@ int CJabberProto::RcGetUnreadEventsCount() int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
- TCHAR szMsg[ 1024 ];
+ wchar_t szMsg[ 1024 ];
if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
@@ -544,7 +544,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // remove clist events
HXML fieldNode = XmlGetChildByTag(xNode,"field", "var", L"remove-clist-events"), valueNode;
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
- if (XmlGetText(valueNode) && !_ttoi(XmlGetText(valueNode)))
+ if (XmlGetText(valueNode) && !_wtoi(XmlGetText(valueNode)))
bRemoveCListEvents = FALSE;
m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0;
@@ -578,21 +578,21 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe << XCHILD(L"body", szEventText);
HXML addressesNode = msg << XCHILDNS(L"addresses", JABBER_FEAT_EXT_ADDRESSING);
- TCHAR szOFrom[JABBER_MAX_JID_LEN];
+ wchar_t szOFrom[JABBER_MAX_JID_LEN];
size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
mir_sntprintf(szOFrom, L"%s/%s", tszJid, szOResource);
} else
- _tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
+ wcsncpy_s(szOFrom, tszJid, _TRUNCATE);
addressesNode << XCHILD(L"address") << XATTR(L"type", L"ofrom") << XATTR(L"jid", szOFrom);
addressesNode << XCHILD(L"address") << XATTR(L"type", L"oto") << XATTR(L"jid", m_ThreadInfo->fullJID);
time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
- TCHAR stime[512];
+ wchar_t stime[512];
mir_sntprintf(stime, L"%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(L"delay", L"urn:xmpp:delay") << XATTR(L"stamp", stime);
@@ -625,7 +625,7 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes {
BOOL bOk = LockWorkStation();
- TCHAR szMsg[ 1024 ];
+ wchar_t szMsg[ 1024 ];
if (bOk)
mir_sntprintf(szMsg, TranslateT("Workstation successfully locked"));
else
@@ -683,7 +683,7 @@ int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo *pInfo, CJabberAdh // I Agree checkbox
fieldNode = XmlGetChildByTag(xNode,"field", "var", L"allow-shutdown");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
- if (XmlGetText(valueNode) && _ttoi(XmlGetText(valueNode)))
+ if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode)))
CallFunctionAsync(JabberQuitMirandaIMThread, 0);
return JABBER_ADHOC_HANDLER_STATUS_COMPLETED;
@@ -708,7 +708,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe }
if (!nChatsCount) {
- TCHAR szMsg[ 1024 ];
+ wchar_t szMsg[ 1024 ];
mir_sntprintf(szMsg, TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index 73fa177f71..aa5306e381 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -102,14 +102,14 @@ class CJabberAdhocNode; class CJabberAdhocNode
{
protected:
- TCHAR *m_szJid;
- TCHAR *m_szNode;
- TCHAR *m_szName;
+ wchar_t *m_szJid;
+ wchar_t *m_szNode;
+ wchar_t *m_szName;
CJabberAdhocNode* m_pNext;
JABBER_ADHOC_HANDLER m_pHandler;
CJabberProto *m_pProto;
public:
- CJabberAdhocNode(CJabberProto* pProto, TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler)
+ CJabberAdhocNode(CJabberProto* pProto, wchar_t* szJid, wchar_t* szNode, wchar_t* szName, JABBER_ADHOC_HANDLER pHandler)
{
memset(this, 0, sizeof(CJabberAdhocNode));
replaceStrT(m_szJid, szJid);
@@ -137,15 +137,15 @@ public: m_pNext = pNext;
return pRetVal;
}
- TCHAR* GetJid()
+ wchar_t* GetJid()
{
return m_szJid;
}
- TCHAR* GetNode()
+ wchar_t* GetNode()
{
return m_szNode;
}
- TCHAR* GetName()
+ wchar_t* GetName()
{
return m_szName;
}
@@ -165,7 +165,7 @@ protected: CJabberAdhocSession* m_pSessions;
mir_cs m_cs;
- CJabberAdhocSession* FindSession(const TCHAR *szSession)
+ CJabberAdhocSession* FindSession(const wchar_t *szSession)
{
CJabberAdhocSession* pSession = m_pSessions;
while (pSession) {
@@ -188,7 +188,7 @@ protected: return pSession;
}
- CJabberAdhocNode* FindNode(const TCHAR *szNode)
+ CJabberAdhocNode* FindNode(const wchar_t *szNode)
{
CJabberAdhocNode* pNode = m_pNodes;
while (pNode) {
@@ -264,7 +264,7 @@ public: }
BOOL FillDefaultNodes();
- BOOL AddNode(TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler)
+ BOOL AddNode(wchar_t* szJid, wchar_t* szNode, wchar_t* szName, JABBER_ADHOC_HANDLER pHandler)
{
CJabberAdhocNode* pNode = new CJabberAdhocNode(m_pProto, szJid, szNode, szName, pHandler);
if (!pNode)
@@ -287,9 +287,9 @@ public: return m_pNodes;
}
- BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
- BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
- BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
+ BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode);
+ BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode);
+ BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode);
BOOL ExpireSessions()
{
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 3c033d178c..c1d3795688 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -122,8 +122,8 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) dat->pJSInf = (JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount + 1)); dat->pJSInf[dat->nJSInfCount].hwndCaptionItem = hwndLabel; dat->pJSInf[dat->nJSInfCount].hwndValueItem = hwndVar; - dat->pJSInf[dat->nJSInfCount].szFieldCaption = _tcsdup(FieldDat->Label); - dat->pJSInf[dat->nJSInfCount].szFieldName = _tcsdup(FieldDat->Var); + dat->pJSInf[dat->nJSInfCount].szFieldCaption = wcsdup(FieldDat->Label); + dat->pJSInf[dat->nJSInfCount].szFieldName = wcsdup(FieldDat->Var); dat->nJSInfCount++; } return CornerY + Order * 40 + 14 + 20; @@ -177,16 +177,16 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) } } - const TCHAR *szFrom = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *szFrom = XmlGetAttrValue(iqNode, L"from"); if (szFrom) SearchAddToRecent(szFrom, searchHandleDlg); PostMessage(searchHandleDlg, WM_USER + 10, 0, 0); ShowWindow(searchHandleDlg, SW_SHOW); } else if (!mir_tstrcmp(type, L"error")) { - const TCHAR *code = NULL; - const TCHAR *description = NULL; - TCHAR buff[255]; + const wchar_t *code = NULL; + const wchar_t *description = NULL; + wchar_t buff[255]; HXML errorNode = XmlGetChild(iqNode, "error"); if (errorNode) { code = XmlGetAttrValue(errorNode, L"code"); @@ -203,12 +203,12 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) // The pmFields is the pointer to map of <field Name, field Label> Not unical but ordered // This can help to made result parser routines more simple -static TCHAR *nickfields[] = { L"nick", L"nickname", L"fullname", L"name", L"given", L"first", L"jid", NULL }; +static wchar_t *nickfields[] = { L"nick", L"nickname", L"fullname", L"name", L"given", L"first", L"jid", NULL }; void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields) { - LIST<TCHAR> ListOfNonEmptyFields(20, (LIST<TCHAR>::FTSortFunc)TCharKeyCmp); - LIST<TCHAR> ListOfFields(20); + LIST<wchar_t> ListOfNonEmptyFields(20, (LIST<wchar_t>::FTSortFunc)TCharKeyCmp); + LIST<wchar_t> ListOfFields(20); LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo; int i, nUsersFound = plUsersInfo->getCount(); @@ -217,7 +217,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i); int nUserFields = pmUserData->getCount(); for (int j = 0; j < nUserFields; j++) { - TCHAR *var = pmUserData->getKeyName(j); + wchar_t *var = pmUserData->getKeyName(j); if (var && ListOfNonEmptyFields.getIndex(var) < 0) ListOfNonEmptyFields.insert(var); } @@ -226,7 +226,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M // now fill the ListOfFields but order is from pmAllFields int nAllCount = pmAllFields->getCount(); for (i = 0; i < nAllCount; i++) { - TCHAR *var = pmAllFields->getUnOrderedKeyName(i); + wchar_t *var = pmAllFields->getUnOrderedKeyName(i); if (var && ListOfNonEmptyFields.getIndex(var) < 0) continue; ListOfFields.insert(var); @@ -237,12 +237,12 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M CUSTOMSEARCHRESULTS Results = { 0 }; Results.nSize = sizeof(Results); - Results.pszFields = (TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount); + Results.pszFields = (wchar_t**)mir_alloc(sizeof(wchar_t*)*nFieldCount); Results.nFieldCount = nFieldCount; /* Sending Columns Titles */ for (i = 0; i < nFieldCount; i++) { - TCHAR *var = ListOfFields[i]; + wchar_t *var = ListOfFields[i]; if (var) Results.pszFields[i] = pmAllFields->operator [](var); } @@ -254,44 +254,44 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.psr.cbSize = sizeof(Results.psr); // sending user data for (i = 0; i < nUsersFound; i++) { - TCHAR buff[200]; + wchar_t buff[200]; buff[0] = 0; U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *)plUsersInfo->operator [](i); for (int j = 0; j < nFieldCount; j++) { - TCHAR *var = ListOfFields[j]; - TCHAR *value = pmUserData->operator [](var); - Results.pszFields[j] = value ? value : (TCHAR *)L" "; + wchar_t *var = ListOfFields[j]; + wchar_t *value = pmUserData->operator [](var); + Results.pszFields[j] = value ? value : (wchar_t *)L" "; if (!mir_tstrcmpi(var, L"jid") && value) - Results.psr.id.t = value; + Results.psr.id.w = value; } - TCHAR *nick = NULL; + wchar_t *nick = NULL; for (int k = 0; k < _countof(nickfields) && !nick; k++) nick = pmUserData->operator [](nickfields[k]); if (nick) { - if (mir_tstrcmpi(nick, Results.psr.id.t)) - mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.t); + if (mir_tstrcmpi(nick, Results.psr.id.w)) + mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.w); else - _tcsncpy_s(buff, nick, _TRUNCATE); + wcsncpy_s(buff, nick, _TRUNCATE); nick = buff; } - Results.psr.nick.t = nick; + Results.psr.nick.w = nick; Results.psr.flags = PSR_TCHAR; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results); - Results.psr.nick.t = NULL; + Results.psr.nick.w = NULL; } mir_free(Results.pszFields); } -void DestroyKey(TCHAR* key) +void DestroyKey(wchar_t* key) { mir_free(key); } -TCHAR* CopyKey(TCHAR* key) +wchar_t* CopyKey(wchar_t* key) { return mir_tstrdup(key); } @@ -301,7 +301,7 @@ TCHAR* CopyKey(TCHAR* key) void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) { - const TCHAR *type; + const wchar_t *type; int id; U_TCHAR_MAP mColumnsNames(10); @@ -321,9 +321,9 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (reportNode) { int i = 1; while (HXML fieldNode = XmlGetNthChild(reportNode, L"field", i++)) { - TCHAR *var = (TCHAR*)XmlGetAttrValue(fieldNode, L"var"); + wchar_t *var = (wchar_t*)XmlGetAttrValue(fieldNode, L"var"); if (var) { - TCHAR *Label = (TCHAR*)XmlGetAttrValue(fieldNode, L"label"); + wchar_t *Label = (wchar_t*)XmlGetAttrValue(fieldNode, L"label"); mColumnsNames.insert(var, (Label != NULL) ? Label : var); } } @@ -335,8 +335,8 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); int j = 1; while (HXML fieldNode = XmlGetNthChild(itemNode, L"field", j++)) { - if (TCHAR* var = (TCHAR*)XmlGetAttrValue(fieldNode, L"var")) { - if (TCHAR* Text = (TCHAR*)XmlGetText(XmlGetChild(fieldNode, L"value"))) { + if (wchar_t* var = (wchar_t*)XmlGetAttrValue(fieldNode, L"var")) { + if (wchar_t* Text = (wchar_t*)XmlGetText(XmlGetChild(fieldNode, L"value"))) { if (!mColumnsNames[var]) mColumnsNames.insert(var, var); pUserColumn->insert(var, Text); @@ -353,8 +353,8 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) while (HXML itemNode = XmlGetNthChild(queryNode, L"item", i++)) { U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); - TCHAR *jid = (TCHAR*)XmlGetAttrValue(itemNode, L"jid"); - TCHAR *keyReturned; + wchar_t *jid = (wchar_t*)XmlGetAttrValue(itemNode, L"jid"); + wchar_t *keyReturned; mColumnsNames.insertCopyKey(L"jid", L"jid", &keyReturned, CopyKey, DestroyKey); mColumnsNames.insert(L"jid", keyReturned); pUserColumn->insertCopyKey(L"jid", jid, NULL, CopyKey, DestroyKey); @@ -364,13 +364,13 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (!child) break; - const TCHAR *szColumnName = XmlGetName(child); + const wchar_t *szColumnName = XmlGetName(child); if (szColumnName) { LPCTSTR ptszChild = XmlGetText(child); if (ptszChild && *ptszChild) { - mColumnsNames.insertCopyKey((TCHAR*)szColumnName, L"", &keyReturned, CopyKey, DestroyKey); - mColumnsNames.insert((TCHAR*)szColumnName, keyReturned); - pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)ptszChild, NULL, CopyKey, DestroyKey); + mColumnsNames.insertCopyKey((wchar_t*)szColumnName, L"", &keyReturned, CopyKey, DestroyKey); + mColumnsNames.insert((wchar_t*)szColumnName, keyReturned); + pUserColumn->insertCopyKey((wchar_t*)szColumnName, (wchar_t*)ptszChild, NULL, CopyKey, DestroyKey); } } } @@ -380,9 +380,9 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) } } else if (!mir_tstrcmp(type, L"error")) { - const TCHAR *code = NULL; - const TCHAR *description = NULL; - TCHAR buff[255]; + const wchar_t *code = NULL; + const wchar_t *description = NULL; + wchar_t buff[255]; HXML errorNode = XmlGetChild(iqNode, "error"); if (errorNode) { code = XmlGetAttrValue(errorNode, L"code"); @@ -459,7 +459,7 @@ static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData *dat) int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) { - TCHAR szServerName[100]; + wchar_t szServerName[100]; EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE); GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); dat->CurrentHeight = 0; @@ -481,14 +481,14 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) return pInfo->GetIqId(); } -static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr) +static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const wchar_t *szAddr) { int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT)CB_FINDSTRING, 0, (LPARAM)szAddr); if (lResult == -1) SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szAddr); } -void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB) +void CJabberProto::SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLastFromDB) { // search in recent for (int i = 0; i < 10; i++) { @@ -517,7 +517,7 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFr } } -void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) +void CJabberProto::SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog) { char key[30]; SearchDeleteFromRecent(szAddr, true); @@ -556,7 +556,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR //TO DO: Add Transports here int i, transpCount = dat->ppro->m_lstTransports.getCount(); for (i = 0; i < transpCount; i++) { - TCHAR *szTransp = dat->ppro->m_lstTransports[i]; + wchar_t *szTransp = dat->ppro->m_lstTransports[i]; if (szTransp) JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp); } @@ -742,7 +742,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) BOOL fRequestNotEmpty = FALSE; // get server name - TCHAR szServerName[100]; + wchar_t szServerName[100]; GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); // formating query @@ -763,7 +763,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) } else { //and Simple fields: XEP-0055 Example 3 for (int i = 0; i < dat->nJSInfCount; i++) { - TCHAR szFieldValue[100]; + wchar_t szFieldValue[100]; GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, _countof(szFieldValue)); if (szFieldValue[0] != 0) { XmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue); diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h index ef96830e7b..cf3f053728 100644 --- a/protocols/JabberG/src/jabber_search.h +++ b/protocols/JabberG/src/jabber_search.h @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _tagJabberSearchFieldsInfo
{
- TCHAR * szFieldName;
- TCHAR * szFieldCaption;
+ wchar_t * szFieldName;
+ wchar_t * szFieldCaption;
HWND hwndCaptionItem;
HWND hwndValueItem;
} JabberSearchFieldsInfo;
@@ -51,9 +51,9 @@ typedef struct _tagJabberSearchData typedef struct tag_Data
{
- TCHAR *Label;
- TCHAR * Var;
- TCHAR * defValue;
+ wchar_t *Label;
+ wchar_t * Var;
+ wchar_t * defValue;
BOOL bHidden;
BOOL bReadOnly;
int Order;
@@ -69,8 +69,8 @@ static void JabberIqResultGetSearchFields(HXML iqNode, void *userdata); static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat);
static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData * dat);
static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static void JabberSearchDeleteFromRecent(TCHAR * szAddr,BOOL deleteLastFromDB);
-void SearchAddToRecent(TCHAR * szAddr, HWND hwnd);
+static void JabberSearchDeleteFromRecent(wchar_t * szAddr,BOOL deleteLastFromDB);
+void SearchAddToRecent(wchar_t * szAddr, HWND hwnd);
// Implementation of MAP class (the list
template <typename _KEYTYPE , int (*COMPARATOR)(_KEYTYPE*, _KEYTYPE*) >
@@ -84,7 +84,7 @@ public: private:
typedef struct _tagRECORD
{
- _tagRECORD(_KEYTYPE * key, TCHAR * value=NULL) { _key=key; _value=value; _order=0; _destroyKeyProc=NULL; }
+ _tagRECORD(_KEYTYPE * key, wchar_t * value=NULL) { _key=key; _value=value; _order=0; _destroyKeyProc=NULL; }
~_tagRECORD()
{
if (_key && _destroyKeyProc)
@@ -93,7 +93,7 @@ private: _destroyKeyProc=NULL;
}
_KEYTYPE *_key;
- TCHAR * _value;
+ wchar_t * _value;
int _order;
DESTROYKEYPROC _destroyKeyProc;
} _RECORD;
@@ -148,7 +148,7 @@ public: while (record=_Records[i++]) delete record;
}
- int insert(_KEYTYPE* Key, TCHAR *Value)
+ int insert(_KEYTYPE* Key, wchar_t *Value)
{
_RECORD * rec= new _RECORD(Key,Value);
int index=_Records.getIndex(rec);
@@ -168,7 +168,7 @@ public: }
return index;
}
- int insertCopyKey(_KEYTYPE* Key, TCHAR *Value, _KEYTYPE** _KeyReturn, COPYKEYPROC CopyProc, DESTROYKEYPROC DestroyProc)
+ int insertCopyKey(_KEYTYPE* Key, wchar_t *Value, _KEYTYPE** _KeyReturn, COPYKEYPROC CopyProc, DESTROYKEYPROC DestroyProc)
{
_RECORD * rec= new _RECORD(Key,Value);
int index=_Records.getIndex(rec);
@@ -198,7 +198,7 @@ public: }
return index;
}
- inline TCHAR* operator[](_KEYTYPE* _KEY) const
+ inline wchar_t* operator[](_KEYTYPE* _KEY) const
{
_RECORD rec(_KEY);
int index=_Records.getIndex(&rec);
@@ -213,7 +213,7 @@ public: else
return NULL;
}
- inline TCHAR* operator[](int index) const
+ inline wchar_t* operator[](int index) const
{
_RECORD * rv=_Records[index];
if (rv) return rv->_value;
@@ -225,7 +225,7 @@ public: if (rv) return rv->_key;
else return NULL;
}
- inline TCHAR * getUnOrdered(int index)
+ inline wchar_t * getUnOrdered(int index)
{
_RECORD * rec=_getUnorderedRec(index);
if (rec) return rec->_value;
@@ -260,7 +260,7 @@ public: }
};
-inline int TCharKeyCmp(TCHAR* a, TCHAR* b)
+inline int TCharKeyCmp(wchar_t* a, wchar_t* b)
{
return (int)(mir_tstrcmpi(a,b));
}
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 1308ba8a40..447e15edd1 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -28,13 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
// ntlm auth - LanServer based authorization
-TNtlmAuth::TNtlmAuth(ThreadData *info, const char* mechanism, const TCHAR *hostname) :
+TNtlmAuth::TNtlmAuth(ThreadData *info, const char* mechanism, const wchar_t *hostname) :
TJabberAuth(info)
{
szName = mechanism;
szHostName = hostname;
- const TCHAR *szProvider;
+ const wchar_t *szProvider;
if (!mir_strcmp(mechanism, "GSS-SPNEGO"))
szProvider = L"Negotiate";
else if (!mir_strcmp(mechanism, "GSSAPI"))
@@ -48,7 +48,7 @@ LBL_Invalid: return;
}
- TCHAR szSpn[1024] = L"";
+ wchar_t szSpn[1024] = L"";
if (mir_strcmp(mechanism, "NTLM"))
if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
goto LBL_Invalid;
@@ -63,9 +63,9 @@ TNtlmAuth::~TNtlmAuth() Netlib_DestroySecurityProvider(NULL, hProvider);
}
-bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
+bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen)
{
- TCHAR szFullUserName[128] = L"";
+ wchar_t szFullUserName[128] = L"";
ULONG szFullUserNameLen = _countof(szFullUserName);
if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[0] = 0;
@@ -73,12 +73,12 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
}
- TCHAR *name = _tcsrchr(szFullUserName, '\\');
+ wchar_t *name = wcsrchr(szFullUserName, '\\');
if (name) *name = 0;
else return false;
if (szHostName && szHostName[0]) {
- TCHAR *szFullUserNameU = _tcsupr(mir_tstrdup(szFullUserName));
+ wchar_t *szFullUserNameU = wcsupr(mir_tstrdup(szFullUserName));
mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU);
mir_free(szFullUserNameU);
}
@@ -90,8 +90,8 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) if (host && host->h_name)
connectHost = host->h_name;
- TCHAR *connectHostT = mir_a2t(connectHost);
- mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, _tcsupr(szFullUserName));
+ wchar_t *connectHostT = mir_a2t(connectHost);
+ mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName));
mir_free(connectHostT);
}
@@ -111,7 +111,7 @@ char* TNtlmAuth::getInitialRequest() return Netlib_NtlmCreateResponse2(hProvider, "", NULL, NULL, &complete);
}
-char* TNtlmAuth::getChallenge(const TCHAR *challenge)
+char* TNtlmAuth::getChallenge(const wchar_t *challenge)
{
if (!hProvider)
return NULL;
@@ -137,7 +137,7 @@ TMD5Auth::~TMD5Auth() {
}
-char* TMD5Auth::getChallenge(const TCHAR *challenge)
+char* TMD5Auth::getChallenge(const wchar_t *challenge)
{
if (iCallCount > 0)
return NULL;
@@ -238,7 +238,7 @@ void TScramAuth::Hi(BYTE* res, char* passw, size_t passwLen, char* salt, size_t }
}
-char* TScramAuth::getChallenge(const TCHAR *challenge)
+char* TScramAuth::getChallenge(const wchar_t *challenge)
{
unsigned chlLen, saltLen = 0;
ptrA snonce, salt;
@@ -315,7 +315,7 @@ char* TScramAuth::getInitialRequest() return mir_base64_encode((PBYTE)buf, cbLen);
}
-bool TScramAuth::validateLogin(const TCHAR *challenge)
+bool TScramAuth::validateLogin(const wchar_t *challenge)
{
unsigned chlLen;
ptrA chl((char*)mir_base64_decode(_T2A(challenge), &chlLen));
@@ -370,12 +370,12 @@ char* TJabberAuth::getInitialRequest() return NULL;
}
-char* TJabberAuth::getChallenge(const TCHAR*)
+char* TJabberAuth::getChallenge(const wchar_t*)
{
return NULL;
}
-bool TJabberAuth::validateLogin(const TCHAR*)
+bool TJabberAuth::validateLogin(const wchar_t*)
{
return true;
}
diff --git a/protocols/JabberG/src/jabber_secur.h b/protocols/JabberG/src/jabber_secur.h index 90a3535c6a..f0099560d4 100644 --- a/protocols/JabberG/src/jabber_secur.h +++ b/protocols/JabberG/src/jabber_secur.h @@ -37,8 +37,8 @@ public: virtual ~TJabberAuth();
virtual char* getInitialRequest();
- virtual char* getChallenge(const TCHAR *challenge);
- virtual bool validateLogin(const TCHAR *challenge);
+ virtual char* getChallenge(const wchar_t *challenge);
+ virtual bool validateLogin(const wchar_t *challenge);
inline const char* getName() const
{ return szName;
@@ -75,7 +75,7 @@ public: TMD5Auth(ThreadData*);
virtual ~TMD5Auth();
- virtual char* getChallenge(const TCHAR *challenge);
+ virtual char* getChallenge(const wchar_t *challenge);
};
class TScramAuth : public TJabberAuth
@@ -88,8 +88,8 @@ public: virtual ~TScramAuth();
virtual char* getInitialRequest();
- virtual char* getChallenge(const TCHAR *challenge);
- virtual bool validateLogin(const TCHAR *challenge);
+ virtual char* getChallenge(const wchar_t *challenge);
+ virtual bool validateLogin(const wchar_t *challenge);
void Hi(BYTE* res , char* passw, size_t passwLen, char* salt, size_t saltLen, int ind);
};
@@ -101,13 +101,13 @@ class TNtlmAuth : public TJabberAuth typedef TJabberAuth CSuper;
HANDLE hProvider;
- const TCHAR *szHostName;
+ const wchar_t *szHostName;
public:
- TNtlmAuth(ThreadData*, const char* mechanism, const TCHAR *hostname = NULL);
+ TNtlmAuth(ThreadData*, const char* mechanism, const wchar_t *hostname = NULL);
virtual ~TNtlmAuth();
virtual char* getInitialRequest();
- virtual char* getChallenge(const TCHAR *challenge);
+ virtual char* getChallenge(const wchar_t *challenge);
- bool getSpn(TCHAR* szSpn, size_t dwSpnLen);
+ bool getSpn(wchar_t* szSpn, size_t dwSpnLen);
};
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index bfdee3d9c7..521d4eaa08 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam)
{
- TCHAR *szStatus = NULL;
+ wchar_t *szStatus = NULL;
mir_cslock lck(m_csModeMsgMutex);
switch (wParam ? (int)wParam : m_iStatus) {
@@ -74,7 +74,7 @@ INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberGetAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR *buf = (TCHAR*)wParam;
+ wchar_t *buf = (wchar_t*)wParam;
int size = (int)lParam;
if (buf == NULL || size <= 0)
@@ -129,13 +129,13 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR;
}
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
- _tcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
+ wcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0);
- if (::_taccess(pai->filename, 0) == 0) {
+ if (::_waccess(pai->filename, 0) == 0) {
ptrA szSavedHash( getStringA(pai->hContact, "AvatarSaved"));
if (szSavedHash != NULL && !mir_strcmp(szSavedHash, szHashValue)) {
debugLogA("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
@@ -150,13 +150,13 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (item != NULL) {
BOOL isXVcard = getByte(pai->hContact, "AvatarXVcard", 0);
- TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
+ wchar_t szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
- if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid))
+ if (wchar_t *bestResName = ListGetBestClientResourceNamePtr(tszJid))
mir_sntprintf(szJid, L"%s/%s", tszJid, bestResName);
if (szJid[0] == 0)
- _tcsncpy_s(szJid, tszJid, _TRUNCATE);
+ wcsncpy_s(szJid, tszJid, _TRUNCATE);
debugLog(L"Rereading %s for %s", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid);
@@ -250,7 +250,7 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextPresence(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam)
{
- TCHAR *tszFileName = (TCHAR*)lParam;
+ wchar_t *tszFileName = (wchar_t*)lParam;
if (m_bJabberOnline) {
SetServerVcard(TRUE, tszFileName);
@@ -258,7 +258,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) }
else if (tszFileName == NULL || tszFileName[0] == 0) {
// Remove avatar
- TCHAR tFileName[ MAX_PATH ];
+ wchar_t tFileName[ MAX_PATH ];
GetAvatarFileName(NULL, tFileName, MAX_PATH);
DeleteFile(tFileName);
@@ -266,7 +266,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) delSetting("AvatarHash");
}
else {
- int fileIn = _topen(tszFileName, O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
+ int fileIn = _wopen(tszFileName, O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
if (fileIn == -1) {
mir_free(tszFileName);
return 1;
@@ -289,7 +289,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) mir_sha1_append(&sha1ctx, (BYTE*)pResult, dwPngSize);
mir_sha1_finish(&sha1ctx, digest);
- TCHAR tFileName[MAX_PATH];
+ wchar_t tFileName[MAX_PATH];
GetAvatarFileName(NULL, tFileName, MAX_PATH);
DeleteFile(tFileName);
@@ -299,7 +299,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) m_options.AvatarType = ProtoGetBufferFormat(pResult);
GetAvatarFileName(NULL, tFileName, MAX_PATH);
- FILE *out = _tfopen(tFileName, L"wb");
+ FILE *out = _wfopen(tFileName, L"wb");
if (out != NULL) {
fwrite(pResult, dwPngSize, 1, out);
fclose(out);
@@ -317,7 +317,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam)
{
- TCHAR *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam);
+ wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam);
setTString("Nick", nickname);
SetServerVcard(FALSE, L"");
@@ -335,10 +335,10 @@ INT_PTR __cdecl CJabberProto::ServiceSendXML(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// "/GCGetToolTipText" - gets tooltip text
-static const TCHAR *JabberEnum2AffilationStr[] = { LPGENT("None"), LPGENT("Outcast"), LPGENT("Member"), LPGENT("Admin"), LPGENT("Owner") },
- *JabberEnum2RoleStr[] = { LPGENT("None"), LPGENT("Visitor"), LPGENT("Participant"), LPGENT("Moderator") };
+static const wchar_t *JabberEnum2AffilationStr[] = { LPGENW("None"), LPGENW("Outcast"), LPGENW("Member"), LPGENW("Admin"), LPGENW("Owner") },
+ *JabberEnum2RoleStr[] = { LPGENW("None"), LPGENW("Visitor"), LPGENW("Participant"), LPGENW("Moderator") };
-static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tszValue, CMString &out)
+static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t *tszValue, CMString &out)
{
if (!out.IsEmpty())
out.Append(bIsTipper ? L"\n" : L"\r\n");
@@ -346,7 +346,7 @@ static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tsz if (bIsTipper)
out.AppendFormat(L"<b>%s</b>\t%s", TranslateTS(tszTitle), tszValue);
else {
- TCHAR *p = TranslateTS(tszTitle);
+ wchar_t *p = TranslateTS(tszTitle);
out.AppendFormat(L"%s%s\t%s", p, mir_tstrlen(p) <= 7 ? L"\t" : L"", tszValue);
}
}
@@ -356,11 +356,11 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara if (!wParam || !lParam)
return 0; //room global tooltip not supported yet
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, (TCHAR*)wParam);
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, (wchar_t*)wParam);
if (item == NULL)
return 0; //no room found
- pResourceStatus info( item->findResource((TCHAR*)lParam));
+ pResourceStatus info( item->findResource((wchar_t*)lParam));
if (info == NULL)
return 0; //no info found
@@ -375,28 +375,28 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara //JID:
CMString outBuf;
- if (_tcschr(info->m_tszResourceName, _T('@')) != NULL)
- appendString(bIsTipper, LPGENT("JID:"), info->m_tszResourceName, outBuf);
+ if (wcschr(info->m_tszResourceName, '@') != NULL)
+ appendString(bIsTipper, LPGENW("JID:"), info->m_tszResourceName, outBuf);
else if (lParam) //or simple nick
- appendString(bIsTipper, LPGENT("Nick:"), (TCHAR*)lParam, outBuf);
+ appendString(bIsTipper, LPGENW("Nick:"), (wchar_t*)lParam, outBuf);
// status
if (info->m_iStatus >= ID_STATUS_OFFLINE && info->m_iStatus <= ID_STATUS_IDLE )
- appendString(bIsTipper, LPGENT("Status:"), pcli->pfnGetStatusModeDescription(info->m_iStatus, 0), outBuf);
+ appendString(bIsTipper, LPGENW("Status:"), pcli->pfnGetStatusModeDescription(info->m_iStatus, 0), outBuf);
// status text
if (info->m_tszStatusMessage)
- appendString(bIsTipper, LPGENT("Status message:"), info->m_tszStatusMessage, outBuf);
+ appendString(bIsTipper, LPGENW("Status message:"), info->m_tszStatusMessage, outBuf);
// Role
- appendString(bIsTipper, LPGENT("Role:"), TranslateTS(JabberEnum2RoleStr[info->m_role]), outBuf);
+ appendString(bIsTipper, LPGENW("Role:"), TranslateTS(JabberEnum2RoleStr[info->m_role]), outBuf);
// Affiliation
- appendString(bIsTipper, LPGENT("Affiliation:"), TranslateTS(JabberEnum2AffilationStr[info->m_affiliation]), outBuf);
+ appendString(bIsTipper, LPGENW("Affiliation:"), TranslateTS(JabberEnum2AffilationStr[info->m_affiliation]), outBuf);
// real jid
if (info->m_tszRealJid)
- appendString(bIsTipper, LPGENT("Real JID:"), info->m_tszRealJid, outBuf);
+ appendString(bIsTipper, LPGENW("Real JID:"), info->m_tszRealJid, outBuf);
return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_tstrdup(outBuf));
}
@@ -404,32 +404,32 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara // File Association Manager plugin support
INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
{
- TCHAR *arg = (TCHAR *)lParam;
+ wchar_t *arg = (wchar_t *)lParam;
if (arg == NULL)
return 1;
// skip leading prefix
- TCHAR szUri[ 1024 ];
- _tcsncpy_s(szUri, arg, _TRUNCATE);
- TCHAR *szJid = _tcschr(szUri, _T(':'));
+ wchar_t szUri[ 1024 ];
+ wcsncpy_s(szUri, arg, _TRUNCATE);
+ wchar_t *szJid = wcschr(szUri, ':');
if (szJid == NULL)
return 1;
// skip //
- for (++szJid; *szJid == _T('/'); ++szJid);
+ for (++szJid; *szJid == '/'; ++szJid);
// empty jid?
if (!*szJid)
return 1;
// command code
- TCHAR *szCommand = szJid;
- szCommand = _tcschr(szCommand, _T('?'));
+ wchar_t *szCommand = szJid;
+ szCommand = wcschr(szCommand, '?');
if (szCommand)
*(szCommand++) = 0;
// parameters
- TCHAR *szSecondParam = szCommand ? _tcschr(szCommand, _T(';')) : NULL;
+ wchar_t *szSecondParam = szCommand ? wcschr(szCommand, ';') : NULL;
if (szSecondParam)
*(szSecondParam++) = 0;
@@ -439,7 +439,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) if (!ServiceExists(MS_MSG_SENDMESSAGEW))
return 1;
- TCHAR *szMsgBody = NULL;
+ wchar_t *szMsgBody = NULL;
MCONTACT hContact = HContactFromJID(szJid, false);
if (hContact == NULL)
hContact = DBCreateContact(szJid, szJid, true, true);
@@ -447,10 +447,10 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) return 1;
if (szSecondParam) { //there are parameters to message
- szMsgBody = _tcsstr(szSecondParam, L"body=");
+ szMsgBody = wcsstr(szSecondParam, L"body=");
if (szMsgBody) {
szMsgBody += 5;
- TCHAR *szDelim = _tcschr(szMsgBody, _T(';'));
+ wchar_t *szDelim = wcschr(szMsgBody, ';');
if (szDelim)
szDelim = 0;
JabberHttpUrlDecode(szMsgBody);
@@ -466,8 +466,8 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.nick.t = szJid;
- psr.id.t = szJid;
+ psr.nick.w = szJid;
+ psr.id.w = szJid;
ADDCONTACTSTRUCT acs;
acs.handleType = HANDLE_SEARCHRESULT;
@@ -493,7 +493,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) // ad-hoc commands
if (!mir_tstrcmpi(szCommand, L"command")) {
if (szSecondParam) {
- if (!_tcsnicmp(szSecondParam, L"node=", 5)) {
+ if (!wcsnicmp(szSecondParam, L"node=", 5)) {
szSecondParam += 5;
if (!*szSecondParam)
szSecondParam = NULL;
@@ -529,12 +529,12 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (jid == NULL)
return 0;
- TCHAR tszJid[JABBER_MAX_JID_LEN];
- TCHAR *szResource = ListGetBestClientResourceNamePtr(jid);
+ wchar_t tszJid[JABBER_MAX_JID_LEN];
+ wchar_t *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
mir_sntprintf(tszJid, L"%s/%s", jid, szResource);
else
- _tcsncpy_s(tszJid, jid, _TRUNCATE);
+ wcsncpy_s(tszJid, jid, _TRUNCATE);
m_ThreadInfo->send(
XmlNode(L"message") << XATTR(L"type", L"headline") << XATTR(L"to", tszJid)
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 328ada850e..074476651f 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -60,9 +60,9 @@ struct JabberPasswordDlgParam BOOL saveOnlinePassword;
WORD dlgResult;
- TCHAR onlinePassword[128];
+ wchar_t onlinePassword[128];
HANDLE hEventPasswdDlg;
- TCHAR *ptszJid;
+ wchar_t *ptszJid;
};
static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -76,7 +76,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa param = (JabberPasswordDlgParam*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- TCHAR text[512];
+ wchar_t text[512];
mir_sntprintf(text, TranslateT("Enter password for %s"), param->ptszJid);
SetDlgItemText(hwndDlg, IDC_JID, text);
@@ -246,7 +246,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) m_ThreadInfo = &info;
if ((tszValue = getTStringA("LoginName")) != NULL)
- _tcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
+ wcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
if (*rtrimt(info.conn.username) == '\0') {
DWORD dwSize = _countof(info.conn.username);
@@ -283,20 +283,20 @@ LBL_FatalError: }
else {
if ((tszValue = getTStringA("Resource")) != NULL)
- _tcsncpy_s(info.resource, tszValue, _TRUNCATE);
+ wcsncpy_s(info.resource, tszValue, _TRUNCATE);
else
mir_tstrcpy(info.resource, L"Miranda");
}
- TCHAR jidStr[512];
+ wchar_t jidStr[512];
mir_sntprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
- _tcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
+ wcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
info.conn.password[0] = 0;
else if (!m_options.SavePassword) { // we have to enter a password manually. have we done it before?
if (m_savedPassword != NULL)
- _tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
+ wcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
mir_sntprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server);
@@ -315,7 +315,7 @@ LBL_FatalError: }
m_savedPassword = (param.saveOnlinePassword) ? mir_tstrdup(param.onlinePassword) : NULL;
- _tcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE);
+ wcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE);
}
}
else {
@@ -325,7 +325,7 @@ LBL_FatalError: debugLogA("Thread ended, password is not configured");
goto LBL_FatalError;
}
- _tcsncpy_s(info.conn.password, tszPassw, _TRUNCATE);
+ wcsncpy_s(info.conn.password, tszPassw, _TRUNCATE);
}
}
else {
@@ -391,7 +391,7 @@ LBL_FatalError: if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) {
if (!info.bIsReg) {
size_t len = mir_tstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1;
- m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
+ m_szJabberJID = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
mir_sntprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server);
m_bSendKeepAlive = m_options.KeepAlive != 0;
setTString("jid", m_szJabberJID); // store jid in database
@@ -400,7 +400,7 @@ LBL_FatalError: }
xmlStreamInitializeNow(&info);
- const TCHAR *tag = L"stream:stream";
+ const wchar_t *tag = L"stream:stream";
debugLogA("Entering main recv loop");
int datalen = 0;
@@ -573,7 +573,7 @@ void CJabberProto::OnProcessStreamOpening(HXML node, ThreadData *info) return;
if (!info->bIsReg) {
- const TCHAR *sid = XmlGetAttrValue(node, L"id");
+ const wchar_t *sid = XmlGetAttrValue(node, L"id");
if (sid != NULL)
info->szStreamId = mir_t2a(sid);
}
@@ -653,7 +653,7 @@ void CJabberProto::PerformAuthentication(ThreadData *info) return;
}
- TCHAR text[1024];
+ wchar_t text[1024];
mir_sntprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
@@ -731,7 +731,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) else if (!mir_tstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true;
}
else if (!mir_tstrcmp(XmlGetName(c), L"hostname")) {
- const TCHAR *mech = XmlGetAttrValue(c, L"mechanism");
+ const wchar_t *mech = XmlGetAttrValue(c, L"mechanism");
if (mech && mir_tstrcmpi(mech, L"GSSAPI") == 0) {
m_AuthMechs.m_gssapiHostName = mir_tstrdup(XmlGetText(c));
}
@@ -770,7 +770,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) void CJabberProto::OnProcessFailure(HXML node, ThreadData *info)
{
- const TCHAR *type;
+ const wchar_t *type;
//failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\"
if ((type = XmlGetAttrValue(node, L"xmlns")) == NULL) return;
if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
@@ -780,7 +780,7 @@ void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) void CJabberProto::OnProcessError(HXML node, ThreadData *info)
{
- TCHAR *buff;
+ wchar_t *buff;
int i;
int pos;
bool skipMsg = false;
@@ -789,15 +789,15 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) if (!XmlGetChild(node, 0))
return;
- buff = (TCHAR *)mir_alloc(1024 * sizeof(TCHAR));
+ buff = (wchar_t *)mir_alloc(1024 * sizeof(wchar_t));
pos = 0;
for (i = 0;; i++) {
HXML n = XmlGetChild(node, i);
if (!n)
break;
- const TCHAR *name = XmlGetName(n);
- const TCHAR *desc = XmlGetText(n);
+ const wchar_t *name = XmlGetName(n);
+ const wchar_t *desc = XmlGetText(n);
if (desc)
pos += mir_sntprintf(buff + pos, 1024 - pos, L"%s: %s\r\n", name, desc);
else
@@ -816,7 +816,7 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) void CJabberProto::OnProcessSuccess(HXML node, ThreadData *info)
{
- const TCHAR *type;
+ const wchar_t *type;
// int iqId;
// RECVED: <success ...
// ACTION: if successfully logged in, continue by requesting roster list and set my initial status
@@ -894,7 +894,7 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) void CJabberProto::OnProcessProceed(HXML node, ThreadData *info)
{
- const TCHAR *type;
+ const wchar_t *type;
if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_tstrcmp(type, L"error"))
return;
@@ -922,7 +922,7 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) {
debugLogA("Compression confirmed");
- const TCHAR *type = XmlGetAttrValue(node, L"xmlns");
+ const wchar_t *type = XmlGetAttrValue(node, L"xmlns");
if (type != NULL && !mir_tstrcmp(type, L"error"))
return;
if (mir_tstrcmp(type, L"http://jabber.org/protocol/compress"))
@@ -938,7 +938,7 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) void CJabberProto::OnProcessPubsubEvent(HXML node)
{
- const TCHAR *from = XmlGetAttrValue(node, L"from");
+ const wchar_t *from = XmlGetAttrValue(node, L"from");
if (!from)
return;
@@ -964,16 +964,16 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) if (!tuneNode)
return;
- const TCHAR *szArtist = XPathT(tuneNode, "artist");
- const TCHAR *szLength = XPathT(tuneNode, "length");
- const TCHAR *szSource = XPathT(tuneNode, "source");
- const TCHAR *szTitle = XPathT(tuneNode, "title");
- const TCHAR *szTrack = XPathT(tuneNode, "track");
+ const wchar_t *szArtist = XPathT(tuneNode, "artist");
+ const wchar_t *szLength = XPathT(tuneNode, "length");
+ const wchar_t *szSource = XPathT(tuneNode, "source");
+ const wchar_t *szTitle = XPathT(tuneNode, "title");
+ const wchar_t *szTrack = XPathT(tuneNode, "track");
- TCHAR szLengthInTime[32];
+ wchar_t szLengthInTime[32];
szLengthInTime[0] = 0;
if (szLength) {
- int nLength = _ttoi(szLength);
+ int nLength = _wtoi(szLength);
mir_sntprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
@@ -1003,12 +1003,12 @@ DWORD JabberGetLastContactMessageTime(MCONTACT hContact) return dwTime;
}
-MCONTACT CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem)
+MCONTACT CJabberProto::CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem)
{
if (chatItem == NULL)
return DBCreateContact(szJid, ptrT(JabberNickFromJID(szJid)), true, true);
- const TCHAR *p = _tcschr(szJid, '/');
+ const wchar_t *p = wcschr(szJid, '/');
if (p != NULL && p[1] != '\0')
p++;
else
@@ -1058,7 +1058,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) return;
}
- const TCHAR *szMessage = NULL;
+ const wchar_t *szMessage = NULL;
HXML bodyNode = XmlGetChildByTag(node, "body", "xml:lang", m_tszSelectedLang);
if (bodyNode == NULL)
bodyNode = XmlGetChild(node, "body");
@@ -1068,7 +1068,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszSubject = XmlGetText(XmlGetChild(node, "subject"));
if (ptszSubject && *ptszSubject) {
size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszSubject) + 128;
- TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
+ wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t) * cbLen);
szTmp[0] = 0;
if (szMessage)
mir_tstrcat(szTmp, L"Subject: ");
@@ -1083,10 +1083,10 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (szMessage && (n = XmlGetChildByTag(node, "addresses", "xmlns", JABBER_FEAT_EXT_ADDRESSING))) {
HXML addressNode = XmlGetChildByTag(n, "address", "type", L"ofrom");
if (addressNode) {
- const TCHAR *szJid = XmlGetAttrValue(addressNode, L"jid");
+ const wchar_t *szJid = XmlGetAttrValue(addressNode, L"jid");
if (szJid) {
size_t cbLen = mir_tstrlen(szMessage) + 1000;
- TCHAR *p = (TCHAR*)alloca(sizeof(TCHAR) * cbLen);
+ wchar_t *p = (wchar_t*)alloca(sizeof(wchar_t) * cbLen);
mir_sntprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage);
szMessage = p;
from = szJid;
@@ -1103,10 +1103,10 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) time_t msgTime = 0;
bool isChatRoomInvitation = false;
- const TCHAR *inviteRoomJid = NULL;
- const TCHAR *inviteFromJid = NULL;
- const TCHAR *inviteReason = NULL;
- const TCHAR *invitePassword = NULL;
+ const wchar_t *inviteRoomJid = NULL;
+ const wchar_t *inviteFromJid = NULL;
+ const wchar_t *inviteReason = NULL;
+ const wchar_t *invitePassword = NULL;
bool isDelivered = false;
// check chatstates availability
@@ -1161,9 +1161,9 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
if ((n = XmlGetChildByTag(node, "confirm", "xmlns", JABBER_FEAT_HTTP_AUTH)) && m_options.AcceptHttpAuth) {
- const TCHAR *szId = XmlGetAttrValue(n, L"id");
- const TCHAR *szMethod = XmlGetAttrValue(n, L"method");
- const TCHAR *szUrl = XmlGetAttrValue(n, L"url");
+ const wchar_t *szId = XmlGetAttrValue(n, L"id");
+ const wchar_t *szMethod = XmlGetAttrValue(n, L"method");
+ const wchar_t *szUrl = XmlGetAttrValue(n, L"url");
if (!szId || !szMethod || !szUrl)
return;
@@ -1190,7 +1190,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if ((xNode = XmlGetNthChild(node, L"x", i + 1)) == NULL)
continue;
- const TCHAR *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns");
+ const wchar_t *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns");
if (ptszXmlns == NULL)
continue;
@@ -1205,29 +1205,29 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) //XEP-0027 is not strict enough, different clients have different implementations
//additional validation is required
- TCHAR *prolog = L"-----BEGIN PGP MESSAGE-----";
- TCHAR *prolog_newline = L"\r\n\r\n";
- TCHAR *epilog = L"\r\n-----END PGP MESSAGE-----\r\n";
+ wchar_t *prolog = L"-----BEGIN PGP MESSAGE-----";
+ wchar_t *prolog_newline = L"\r\n\r\n";
+ wchar_t *epilog = L"\r\n-----END PGP MESSAGE-----\r\n";
size_t len = 0;
- TCHAR *tempstring = nullptr;
- if(!_tcsstr(ptszText, prolog))
+ wchar_t *tempstring = nullptr;
+ if(!wcsstr(ptszText, prolog))
{
len = mir_tstrlen(prolog) + mir_tstrlen(prolog_newline) + mir_tstrlen(ptszText) + mir_tstrlen(epilog) + 3;
- tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len);
+ tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
mir_sntprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
}
else
{
len = mir_tstrlen(ptszText) + 3;
- tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len);
+ tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
mir_sntprintf(tempstring, len, L"%s", ptszText);
}
szMessage = tempstring;
}
else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
- const TCHAR *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp");
+ const wchar_t *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp");
if (ptszTimeStamp != NULL)
msgTime = JabberIsoToUnixTime(ptszTimeStamp);
}
@@ -1246,8 +1246,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (XmlGetChild(xNode, "delivered") != NULL || XmlGetChild(xNode, "offline") != NULL) {
int id = -1;
if (idNode != NULL && XmlGetText(idNode) != NULL)
- if (!_tcsncmp(XmlGetText(idNode), _T(JABBER_IQID), mir_strlen(JABBER_IQID)))
- id = _ttoi((XmlGetText(idNode)) + mir_strlen(JABBER_IQID));
+ if (!wcsncmp(XmlGetText(idNode), _T(JABBER_IQID), mir_strlen(JABBER_IQID)))
+ id = _wtoi((XmlGetText(idNode)) + mir_strlen(JABBER_IQID));
if (id != -1)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0);
@@ -1283,7 +1283,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszUrl = XmlGetText(XmlGetChild(xNode, "url"));
if (ptszUrl != NULL && *ptszUrl) {
size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszUrl) + 32;
- TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR)* cbLen);
+ wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t)* cbLen);
mir_tstrcpy(szTmp, ptszUrl);
if (szMessage) {
mir_tstrcat(szTmp, L"\r\n");
@@ -1306,18 +1306,18 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
- TCHAR chkJID[JABBER_MAX_JID_LEN] = L"@";
+ wchar_t chkJID[JABBER_MAX_JID_LEN] = L"@";
JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
for (int j = 1;; j++) {
HXML iNode = XmlGetNthChild(xNode, L"item", j);
if (iNode == NULL)
break;
- const TCHAR *action = XmlGetAttrValue(iNode, L"action");
- const TCHAR *jid = XmlGetAttrValue(iNode, L"jid");
- const TCHAR *nick = XmlGetAttrValue(iNode, L"name");
- const TCHAR *group = XmlGetText(XmlGetChild(iNode, L"group"));
- if (action && jid && _tcsstr(jid, chkJID)) {
+ const wchar_t *action = XmlGetAttrValue(iNode, L"action");
+ const wchar_t *jid = XmlGetAttrValue(iNode, L"jid");
+ const wchar_t *nick = XmlGetAttrValue(iNode, L"name");
+ const wchar_t *group = XmlGetText(XmlGetChild(iNode, L"group"));
+ if (action && jid && wcsstr(jid, chkJID)) {
if (!mir_tstrcmp(action, L"add")) {
MCONTACT cc = DBCreateContact(jid, nick, false, false);
if (group)
@@ -1403,7 +1403,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) // XEP-0115: Entity Capabilities
void CJabberProto::OnProcessPresenceCapabilites(HXML node)
{
- const TCHAR *from = XmlGetAttrValue(node, L"from");
+ const wchar_t *from = XmlGetAttrValue(node, L"from");
if (from == NULL)
return;
@@ -1418,9 +1418,9 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) if ((n = XmlGetChildByTag(node, "c", "xmlns", JABBER_FEAT_ENTITY_CAPS)) != NULL ||
(n = XmlGetChild(node, "c")) != NULL)
{
- const TCHAR *szNode = XmlGetAttrValue(n, L"node");
- const TCHAR *szVer = XmlGetAttrValue(n, L"ver");
- const TCHAR *szExt = XmlGetAttrValue(n, L"ext");
+ const wchar_t *szNode = XmlGetAttrValue(n, L"node");
+ const wchar_t *szVer = XmlGetAttrValue(n, L"ver");
+ const wchar_t *szExt = XmlGetAttrValue(n, L"ext");
if (szNode && szVer) {
r->m_tszCapsNode = mir_tstrdup(szNode);
r->m_tszCapsVer = mir_tstrdup(szVer);
@@ -1435,7 +1435,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) // JabberCapsBits jcbCaps = GetResourceCapabilites(from, TRUE);
}
-void CJabberProto::UpdateJidDbSettings(const TCHAR *jid)
+void CJabberProto::UpdateJidDbSettings(const wchar_t *jid)
{
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) return;
@@ -1446,7 +1446,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) int status = ID_STATUS_OFFLINE;
if (!item->arResources.getCount()) {
// set offline only if jid has resources
- if (_tcschr(jid, '/') == NULL)
+ if (wcschr(jid, '/') == NULL)
status = item->getTemp()->m_iStatus;
if (item->getTemp()->m_tszStatusMessage)
db_set_ts(hContact, "CList", "StatusMsg", item->getTemp()->m_tszStatusMessage);
@@ -1481,7 +1481,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) }
else delSetting(hContact, DBSETTING_DISPLAY_UID);
- if (_tcschr(jid, '@') != NULL || m_options.ShowTransport == TRUE)
+ if (wcschr(jid, '@') != NULL || m_options.ShowTransport == TRUE)
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != status)
setWord(hContact, "Status", (WORD)status);
@@ -1514,9 +1514,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) MCONTACT hContact;
bool bSelfPresence = false;
- TCHAR szBareFrom[JABBER_MAX_JID_LEN];
+ wchar_t szBareFrom[JABBER_MAX_JID_LEN];
JabberStripJid(from, szBareFrom, _countof(szBareFrom));
- TCHAR szBareOurJid[JABBER_MAX_JID_LEN];
+ wchar_t szBareOurJid[JABBER_MAX_JID_LEN];
JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
@@ -1552,7 +1552,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) char priority = 0;
if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
- priority = (char)_ttoi(ptszPriority);
+ priority = (char)_wtoi(ptszPriority);
ListAddResource(LIST_ROSTER, from, status, XmlGetText(XmlGetChild(node, "status")), priority);
@@ -1561,7 +1561,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) UpdateJidDbSettings(from);
- if (_tcschr(from, '@') == NULL) {
+ if (wcschr(from, '@') == NULL) {
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
}
debugLog(L"%s (%s) online, set contact status to %s", nick, from, pcli->pfnGetStatusModeDescription(status, 0));
@@ -1643,7 +1643,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) UpdateJidDbSettings(from);
- if (_tcschr(from, '@') == NULL)
+ if (wcschr(from, '@') == NULL)
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
DBCheckIsTransportedContact(from, hContact);
@@ -1665,7 +1665,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) }
// automatically send authorization allowed to agent/transport
- if (_tcschr(from, '@') == NULL || m_options.AutoAcceptAuthorization) {
+ if (wcschr(from, '@') == NULL || m_options.AutoAcceptAuthorization) {
ListAdd(LIST_ROSTER, from, hContact);
info->send(XmlNode(L"presence") << XATTR(L"to", from) << XATTR(L"type", L"subscribed"));
@@ -1710,7 +1710,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (item->subscription == SUB_FROM) item->subscription = SUB_BOTH;
else if (item->subscription == SUB_NONE) {
item->subscription = SUB_TO;
- if (_tcschr(from, '@') == NULL) {
+ if (wcschr(from, '@') == NULL) {
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
}
}
@@ -1799,7 +1799,7 @@ BOOL CJabberProto::OnProcessJingle(HXML node) void CJabberProto::OnProcessIq(HXML node)
{
HXML queryNode;
- const TCHAR *type, *xmlns;
+ const wchar_t *type, *xmlns;
if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return;
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return;
@@ -1823,8 +1823,8 @@ void CJabberProto::OnProcessIq(HXML node) // RECVED: <iq type='error'> ...
if (!mir_tstrcmp(type, L"error")) {
- TCHAR tszBuf[20];
- _itot(id, tszBuf, 10);
+ wchar_t tszBuf[20];
+ _itow(id, tszBuf, 10);
debugLogA("XXX on entry");
// Check for file transfer deny by comparing idStr with ft->iqId
@@ -1856,9 +1856,9 @@ ThreadData *m_regInfo; void CJabberProto::SetRegConfig(HXML node, void *from)
{
if (m_regInfo && from) {
- TCHAR text[MAX_PATH];
+ wchar_t text[MAX_PATH];
mir_sntprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
- XmlNodeIq iq(L"set", SerialNext(), (TCHAR*)from);
+ XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from);
iq << XATTR(L"from", text);
HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
XmlAddChild(query, node);
@@ -1918,7 +1918,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) }
else if (!mir_tstrcmp(type, L"error")) {
- TCHAR *str = JabberErrorMsg(XmlGetChild(node, "error"));
+ wchar_t *str = JabberErrorMsg(XmlGetChild(node, "error"));
SendMessage(info->conn.reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
info->reg_done = TRUE;
@@ -2025,11 +2025,11 @@ int ThreadData::send(HXML node) proto->OnConsoleProcessXml(node, JCPF_OUT);
- TCHAR *str = xmlToString(node, NULL);
+ wchar_t *str = xmlToString(node, NULL);
// strip forbidden control characters from outgoing XML stream
- TCHAR *q = str;
- for (TCHAR *p = str; *p; ++p) {
+ wchar_t *q = str;
+ for (wchar_t *p = str; *p; ++p) {
WCHAR c = *p;
if (c < 32 && c != '\t' && c != '\n' && c != '\r')
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index 33d0acf232..c3d2bdb878 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -41,7 +41,7 @@ struct TTreeList_ItemInfo struct TTreeList_ItemInfo *parent;
int iIcon, iOverlay;
- LIST<TCHAR> text;
+ LIST<wchar_t> text;
LPARAM data;
LIST<TTreeList_ItemInfo> subItems;
@@ -61,7 +61,7 @@ struct TTreeList_ItemInfo struct TTreeList_Data
{
int mode, sortMode;
- TCHAR *filter;
+ wchar_t *filter;
HTREELISTITEM hItemSelected;
TTreeList_ItemInfo *root;
@@ -178,7 +178,7 @@ void TreeList_SetSortMode(HWND hwnd, int col, BOOL descending) TreeList_Update(hwnd);
}
-void TreeList_SetFilter(HWND hwnd, TCHAR *filter)
+void TreeList_SetFilter(HWND hwnd, wchar_t *filter)
{
TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
if (data->filter) mir_free(data->filter);
@@ -199,7 +199,7 @@ HTREELISTITEM TreeList_GetActiveItem(HWND hwnd) return (HTREELISTITEM)lvi.lParam;
}
-HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, TCHAR *text, LPARAM nodeDdata)
+HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, LPARAM nodeDdata)
{
TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
if (!hParent) hParent = data->root;
@@ -239,7 +239,7 @@ void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag) hItem->flags |= TLIF_MODIFIED;
}
-void TreeList_AppendColumn(HTREELISTITEM hItem, TCHAR *text)
+void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text)
{
hItem->text.insert(mir_tstrdup(text));
hItem->flags |= TLIF_MODIFIED;
@@ -509,7 +509,7 @@ static void sttTreeList_FilterItems(HTREELISTITEM hItem, LPARAM data) {
int i = 0;
for (i=0; i < hItem->text.getCount(); i++)
- if (JabberStrIStr(hItem->text[i], (TCHAR *)data))
+ if (JabberStrIStr(hItem->text[i], (wchar_t *)data))
break;
if (i < hItem->text.getCount()) {
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index a4f11912b4..6b0907a7b3 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -37,28 +37,28 @@ struct UserInfoStringBuf { enum { STRINGBUF_INCREMENT = 1024 }; - TCHAR *buf; + wchar_t *buf; size_t size, offset; UserInfoStringBuf() { buf = 0; size = 0; offset = 0; } ~UserInfoStringBuf() { mir_free(buf); } - void append(TCHAR *str) { + void append(wchar_t *str) { if (!str) return; size_t length = mir_tstrlen(str); if (size - offset < length + 1) { size += (length + STRINGBUF_INCREMENT); - buf = (TCHAR *)mir_realloc(buf, size * sizeof(TCHAR)); + buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } mir_tstrcpy(buf + offset, str); offset += length; } - TCHAR* allocate(int length) { + wchar_t* allocate(int length) { if (size - offset < length) { size += (length + STRINGBUF_INCREMENT); - buf = (TCHAR *)mir_realloc(buf, size * sizeof(TCHAR)); + buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } return buf + offset; } @@ -168,11 +168,11 @@ void sttCleanupInfo(HWND hwndTree, int stage) } } -static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, TCHAR *title, TCHAR *value, LPARAM id=INFOLINE_BAD_ID, bool expand=false) +static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, wchar_t *title, wchar_t *value, LPARAM id=INFOLINE_BAD_ID, bool expand=false) { HTREEITEM hti = sttFindInfoLine(hwndTree, htiRoot, id); - TCHAR buf[256]; + wchar_t buf[256]; if (title) mir_sntprintf(buf, L"%s: %s", title, value); else @@ -210,7 +210,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, JABBER_LIST_ITEM *item, int resource) { - TCHAR buf[256]; + wchar_t buf[256]; HTREEITEM htiResource = htiRoot; pResourceStatus r = resource ? item->arResources[resource-1] : item->getTemp(); @@ -250,13 +250,13 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttInfoLineId(resource, INFOLINE_SYSTEM)); // Resource priority - TCHAR szPriority[128]; + wchar_t szPriority[128]; mir_sntprintf(szPriority, L"%d", (int)r->m_iPriority); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY)); // Idle if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); + mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; @@ -277,21 +277,21 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti int i; for (i=0; g_JabberFeatCapPairs[i].szFeature; i++) if (jcb & g_JabberFeatCapPairs[i].jcbCap) { - TCHAR szDescription[ 1024 ]; + wchar_t szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else - _tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); + wcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } for (int j = 0; j < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); j++, i++) if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { - TCHAR szDescription[ 1024 ]; + wchar_t szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else - _tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); + wcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } } @@ -311,18 +311,18 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Miranda core version"), r->m_tszXMirandaCoreVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); } -static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, MCONTACT hContact, TCHAR *szTitle, char *pszSlot) +static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, MCONTACT hContact, wchar_t *szTitle, char *pszSlot) { char *szAdvStatusIcon = ppro->ReadAdvStatusA(hContact, pszSlot, ADVSTATUS_VAL_ICON); - TCHAR *szAdvStatusTitle = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TITLE); - TCHAR *szAdvStatusText = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TEXT); + wchar_t *szAdvStatusTitle = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TITLE); + wchar_t *szAdvStatusText = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TEXT); if (szAdvStatusIcon && szAdvStatusTitle && *szAdvStatusTitle) { - TCHAR szText[2048]; + wchar_t szText[2048]; if (szAdvStatusText && *szAdvStatusText) mir_sntprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); else - _tcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); + wcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, IcoLib_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); } @@ -338,7 +338,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM sttCleanupInfo(hwndTree, 0); HTREEITEM htiRoot = sttFillInfoLine(hwndTree, NULL, ppro->LoadIconEx("main"), L"JID", item->jid, sttInfoLineId(0, INFOLINE_NAME), true); - TCHAR buf[256]; + wchar_t buf[256]; if (MCONTACT hContact = ppro->HContactFromJID(item->jid)) { sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_MOOD), hContact, TranslateT("Mood"), ADVSTATUS_MOOD); @@ -365,7 +365,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // logoff JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); + mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; @@ -376,7 +376,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, - (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, + (item->jid && wcschr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, sttInfoLineId(0, INFOLINE_LOGOFF)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Logoff message"), @@ -396,7 +396,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM for (int i=0; i < item->arResources.getCount(); i++) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, i+1); } - else if (!_tcschr(item->jid, _T('@')) || (r->m_iStatus != ID_STATUS_OFFLINE)) + else if (!wcschr(item->jid, '@') || (r->m_iStatus != ID_STATUS_OFFLINE)) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, 0); sttCleanupInfo(hwndTree, 1); @@ -532,14 +532,14 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa JabberCopyText(hwndDlg, buf.buf); } else if (nReturnCmd == 2) { - TCHAR szBuffer[1024]; + wchar_t szBuffer[1024]; TVITEMEX tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; tvi.hItem = hItem; tvi.cchTextMax = _countof(szBuffer); tvi.pszText = szBuffer; if (TreeView_GetItem(hwndTree, &tvi)) { - if (TCHAR *str = _tcsstr(szBuffer, L": ")) + if (wchar_t *str = wcsstr(szBuffer, L": ")) JabberCopyText(hwndDlg, str + 2); else JabberCopyText(hwndDlg, szBuffer); @@ -664,7 +664,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_SAVE: - static TCHAR szFilter[512]; + static wchar_t szFilter[512]; ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid == NULL) @@ -692,7 +692,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP mir_sntprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); } - TCHAR szFileName[MAX_PATH]; szFileName[0] = '\0'; + wchar_t szFileName[MAX_PATH]; szFileName[0] = '\0'; OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index e4da6b2df3..610790fe63 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -34,7 +34,7 @@ int CJabberProto::SerialNext(void) ///////////////////////////////////////////////////////////////////////////////
// JabberChatRoomHContactFromJID - looks for the char room MCONTACT with required JID
-MCONTACT CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid)
+MCONTACT CJabberProto::ChatRoomHContactFromJID(const wchar_t *jid)
{
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid);
if (item != NULL && item->hContact)
@@ -46,7 +46,7 @@ MCONTACT CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) ///////////////////////////////////////////////////////////////////////////////
// JabberHContactFromJID - looks for the MCONTACT with required JID
-MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource)
+MCONTACT CJabberProto::HContactFromJID(const wchar_t *jid, bool bStripResource)
{
if (jid == NULL)
return NULL;
@@ -56,7 +56,7 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource) return item->hContact;
if (bStripResource) {
- TCHAR szJid[JABBER_MAX_JID_LEN];
+ wchar_t szJid[JABBER_MAX_JID_LEN];
JabberStripJid(jid, szJid, _countof(szJid));
item = ListGetItemPtr(LIST_ROSTER, szJid);
if (item != NULL && item->hContact)
@@ -66,19 +66,19 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource) return NULL;
}
-TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid)
+wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid)
{
if (jid == NULL)
return mir_tstrdup(L"");
- const TCHAR *p = _tcschr(jid, '@');
+ const wchar_t *p = wcschr(jid, '@');
if (p == NULL)
- p = _tcschr(jid, '/');
+ p = wcschr(jid, '/');
return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid);
}
-pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid)
+pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid)
{
if (jid == NULL)
return NULL;
@@ -89,22 +89,22 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid) if (item == NULL)
return NULL;
- const TCHAR *p = _tcschr(jid, '/');
+ const wchar_t *p = wcschr(jid, '/');
if (p == NULL)
return item->getTemp();
return item->findResource(p + 1);
}
-TCHAR* JabberPrepareJid(LPCTSTR jid)
+wchar_t* JabberPrepareJid(LPCTSTR jid)
{
if (jid == NULL) return NULL;
- TCHAR *szNewJid = mir_tstrdup(jid);
+ wchar_t *szNewJid = mir_tstrdup(jid);
if (!szNewJid) return NULL;
- TCHAR *pDelimiter = _tcschr(szNewJid, _T('/'));
+ wchar_t *pDelimiter = wcschr(szNewJid, '/');
if (pDelimiter) *pDelimiter = 0;
CharLower(szNewJid);
- if (pDelimiter) *pDelimiter = _T('/');
+ if (pDelimiter) *pDelimiter = '/';
return szNewJid;
}
@@ -142,46 +142,46 @@ char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf) return buf;
}
-TCHAR* __stdcall JabberStrFixLines(const TCHAR *str)
+wchar_t* __stdcall JabberStrFixLines(const wchar_t *str)
{
if (str == NULL)
return NULL;
- const TCHAR *p;
+ const wchar_t *p;
int add = 0;
bool prev_r = false;
bool prev_n = false;
for (p = str; p && *p; ++p)
- if (*p == _T('\r') || *p == _T('\n'))
+ if (*p == '\r' || *p == '\n')
++add;
- TCHAR *buf = (TCHAR *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(TCHAR));
- TCHAR *res = buf;
+ wchar_t *buf = (wchar_t *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(wchar_t));
+ wchar_t *res = buf;
for (p = str; p && *p; ++p) {
- if (*p == _T('\n') && !prev_r)
- *res++ = _T('\r');
- if (*p != _T('\r') && *p != _T('\n') && prev_r)
- *res++ = _T('\n');
+ if (*p == '\n' && !prev_r)
+ *res++ = '\r';
+ if (*p != '\r' && *p != '\n' && prev_r)
+ *res++ = '\n';
*res++ = *p;
- prev_r = *p == _T('\r');
- prev_n = *p == _T('\n');
+ prev_r = *p == '\r';
+ prev_n = *p == '\n';
}
*res = 0;
return buf;
}
-void __stdcall JabberHttpUrlDecode(TCHAR *str)
+void __stdcall JabberHttpUrlDecode(wchar_t *str)
{
- TCHAR *p, *q;
+ wchar_t *p, *q;
unsigned int code;
if (str == NULL) return;
- for (p = q = (TCHAR*)str; *p != '\0'; p++, q++) {
+ for (p = q = (wchar_t*)str; *p != '\0'; p++, q++) {
if (*p == '%' && *(p + 1) != '\0' && isxdigit(*(p + 1)) && *(p + 2) != '\0' && isxdigit(*(p + 2))) {
- _stscanf((TCHAR*)p + 1, L"%2x", &code);
+ swscanf((wchar_t*)p + 1, L"%2x", &code);
*q = (unsigned char)code;
p += 2;
}
@@ -222,29 +222,29 @@ int __stdcall JabberCombineStatus(int status1, int status2) struct tagErrorCodeToStr
{
int code;
- TCHAR *str;
+ wchar_t *str;
}
static JabberErrorCodeToStrMapping[] = {
- { JABBER_ERROR_REDIRECT, LPGENT("Redirect") },
- { JABBER_ERROR_BAD_REQUEST, LPGENT("Bad request") },
- { JABBER_ERROR_UNAUTHORIZED, LPGENT("Unauthorized") },
- { JABBER_ERROR_PAYMENT_REQUIRED, LPGENT("Payment required") },
- { JABBER_ERROR_FORBIDDEN, LPGENT("Forbidden") },
- { JABBER_ERROR_NOT_FOUND, LPGENT("Not found") },
- { JABBER_ERROR_NOT_ALLOWED, LPGENT("Not allowed") },
- { JABBER_ERROR_NOT_ACCEPTABLE, LPGENT("Not acceptable") },
- { JABBER_ERROR_REGISTRATION_REQUIRED, LPGENT("Registration required") },
- { JABBER_ERROR_REQUEST_TIMEOUT, LPGENT("Request timeout") },
- { JABBER_ERROR_CONFLICT, LPGENT("Conflict") },
- { JABBER_ERROR_INTERNAL_SERVER_ERROR, LPGENT("Internal server error") },
- { JABBER_ERROR_NOT_IMPLEMENTED, LPGENT("Not implemented") },
- { JABBER_ERROR_REMOTE_SERVER_ERROR, LPGENT("Remote server error") },
- { JABBER_ERROR_SERVICE_UNAVAILABLE, LPGENT("Service unavailable") },
- { JABBER_ERROR_REMOTE_SERVER_TIMEOUT, LPGENT("Remote server timeout") },
- { -1, LPGENT("Unknown error") }
+ { JABBER_ERROR_REDIRECT, LPGENW("Redirect") },
+ { JABBER_ERROR_BAD_REQUEST, LPGENW("Bad request") },
+ { JABBER_ERROR_UNAUTHORIZED, LPGENW("Unauthorized") },
+ { JABBER_ERROR_PAYMENT_REQUIRED, LPGENW("Payment required") },
+ { JABBER_ERROR_FORBIDDEN, LPGENW("Forbidden") },
+ { JABBER_ERROR_NOT_FOUND, LPGENW("Not found") },
+ { JABBER_ERROR_NOT_ALLOWED, LPGENW("Not allowed") },
+ { JABBER_ERROR_NOT_ACCEPTABLE, LPGENW("Not acceptable") },
+ { JABBER_ERROR_REGISTRATION_REQUIRED, LPGENW("Registration required") },
+ { JABBER_ERROR_REQUEST_TIMEOUT, LPGENW("Request timeout") },
+ { JABBER_ERROR_CONFLICT, LPGENW("Conflict") },
+ { JABBER_ERROR_INTERNAL_SERVER_ERROR, LPGENW("Internal server error") },
+ { JABBER_ERROR_NOT_IMPLEMENTED, LPGENW("Not implemented") },
+ { JABBER_ERROR_REMOTE_SERVER_ERROR, LPGENW("Remote server error") },
+ { JABBER_ERROR_SERVICE_UNAVAILABLE, LPGENW("Service unavailable") },
+ { JABBER_ERROR_REMOTE_SERVER_TIMEOUT, LPGENW("Remote server timeout") },
+ { -1, LPGENW("Unknown error") }
};
-TCHAR* __stdcall JabberErrorStr(int errorCode)
+wchar_t* __stdcall JabberErrorStr(int errorCode)
{
int i;
@@ -252,9 +252,9 @@ TCHAR* __stdcall JabberErrorStr(int errorCode) return JabberErrorCodeToStrMapping[i].str;
}
-TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode)
+wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode)
{
- TCHAR *errorStr = (TCHAR*)mir_alloc(256 * sizeof(TCHAR));
+ wchar_t *errorStr = (wchar_t*)mir_alloc(256 * sizeof(wchar_t));
if (errorNode == NULL) {
if (pErrorCode)
*pErrorCode = -1;
@@ -263,9 +263,9 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) }
int errorCode = -1;
- const TCHAR *str = XmlGetAttrValue(errorNode, L"code");
+ const wchar_t *str = XmlGetAttrValue(errorNode, L"code");
if (str != NULL)
- errorCode = _ttoi(str);
+ errorCode = _wtoi(str);
str = XmlGetText(errorNode);
if (str == NULL)
@@ -274,7 +274,7 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) for (int i = 0;; i++) {
HXML c = XmlGetChild(errorNode, i);
if (c == NULL) break;
- const TCHAR *attr = XmlGetAttrValue(c, L"xmlns");
+ const wchar_t *attr = XmlGetAttrValue(c, L"xmlns");
if (attr && !mir_tstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) {
str = XmlGetName(c);
break;
@@ -314,15 +314,15 @@ void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible) }
}
-time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp)
+time_t __stdcall JabberIsoToUnixTime(const wchar_t *stamp)
{
- TCHAR date[9];
+ wchar_t date[9];
int i, y;
if (stamp == NULL)
return 0;
- const TCHAR *p = stamp;
+ const wchar_t *p = stamp;
// Get the date part
for (i = 0; *p != '\0' && i < 8 && isdigit(*p); p++, i++)
@@ -354,7 +354,7 @@ time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp) for (; *p != '\0' && !isdigit(*p); p++);
// Parse time
- if (_stscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3)
+ if (swscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3)
return (time_t)0;
timestamp.tm_isdst = 0; // DST is already present in _timezone below
@@ -365,7 +365,7 @@ time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp) return (t >= 0) ? t : 0;
}
-void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg)
+void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg)
{
if (!m_bJabberOnline) return;
@@ -373,8 +373,8 @@ void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const int iPriority = getDword("Priority", 0);
UpdatePriorityMenu(iPriority);
- TCHAR szPriority[40];
- _itot(iPriority, szPriority, 10);
+ wchar_t szPriority[40];
+ _itow(iPriority, szPriority, 10);
XmlNode p(L"presence"); p << XCHILD(L"priority", szPriority);
if (to != NULL)
@@ -387,7 +387,7 @@ void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const HXML c = p << XCHILDNS(L"c", JABBER_FEAT_ENTITY_CAPS) << XATTR(L"node", JABBER_CAPS_MIRANDA_NODE)
<< XATTR(L"ver", szCoreVersion);
- LIST<TCHAR> arrExtCaps(5);
+ LIST<wchar_t> arrExtCaps(5);
if (bSecureIM)
arrExtCaps.insert(JABBER_EXT_SECUREIM);
@@ -492,7 +492,7 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) {
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item != NULL && item->nick != NULL) {
- TCHAR text[1024];
+ wchar_t text[1024];
mir_sntprintf(text, L"%s/%s", item->jid, item->nick);
SendPresenceTo(status == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : status, text, NULL);
}
@@ -505,17 +505,17 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) int __stdcall JabberGetPacketID(HXML n)
{
- const TCHAR *str = XmlGetAttrValue(n, L"id");
+ const wchar_t *str = XmlGetAttrValue(n, L"id");
if (str)
- if (!_tcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1))
- return _ttoi(str + _countof(JABBER_IQID) - 1);
+ if (!wcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1))
+ return _wtoi(str + _countof(JABBER_IQID) - 1);
return -1;
}
-TCHAR* __stdcall JabberId2string(int id)
+wchar_t* __stdcall JabberId2string(int id)
{
- TCHAR text[100];
+ wchar_t text[100];
mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
return mir_tstrdup(text);
}
@@ -523,7 +523,7 @@ TCHAR* __stdcall JabberId2string(int id) ///////////////////////////////////////////////////////////////////////////////
// JabberGetClientJID - adds a resource postfix to a JID
-TCHAR* CJabberProto::GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen)
+wchar_t* CJabberProto::GetClientJID(MCONTACT hContact, wchar_t *dest, size_t destLen)
{
if (hContact == NULL)
return NULL;
@@ -532,13 +532,13 @@ TCHAR* CJabberProto::GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen return GetClientJID(jid, dest, destLen);
}
-TCHAR* CJabberProto::GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen)
+wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t destLen)
{
if (jid == NULL)
return NULL;
- _tcsncpy_s(dest, destLen, jid, _TRUNCATE);
- TCHAR *p = _tcschr(dest, '/');
+ wcsncpy_s(dest, destLen, jid, _TRUNCATE);
+ wchar_t *p = wcschr(dest, '/');
mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid);
@@ -561,14 +561,14 @@ TCHAR* CJabberProto::GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen) ///////////////////////////////////////////////////////////////////////////////
// JabberStripJid - strips a resource postfix from a JID
-TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen)
+wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t destLen)
{
if (jid == NULL)
*dest = 0;
else {
- _tcsncpy_s(dest, destLen, jid, _TRUNCATE);
+ wcsncpy_s(dest, destLen, jid, _TRUNCATE);
- TCHAR *p = _tcschr(dest, '/');
+ wchar_t *p = wcschr(dest, '/');
if (p != NULL)
*p = 0;
}
@@ -667,7 +667,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, (LPARAM)L"");
}
-void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount)
+void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount)
{
if (!string || !*string)
return;
@@ -728,7 +728,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) LISTFOREACH(i, ppro, LIST_ROSTER)
{
if ((item = ppro->ListGetItemPtrFromIndex(i)) != NULL) {
- if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) {
+ if (wcschr(item->jid, '@') == NULL && wcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) {
MCONTACT hContact = ppro->HContactFromJID(item->jid);
if (hContact == NULL) continue;
@@ -736,7 +736,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) char *jid_copy = mir_t2a(item->jid);
mir_snprintf(name, "$/Transports/%s", jid_copy);
ppro->m_pInfoFrame->CreateInfoItem(name, true, hContact);
- ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (TCHAR *)item->jid);
+ ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid);
ppro->m_pInfoFrame->SetInfoItemCallback(name, &CJabberProto::InfoFrame_OnTransport);
mir_free(jid_copy);
}
@@ -755,7 +755,7 @@ void CJabberProto::RebuildInfoFrame() ////////////////////////////////////////////////////////////////////////
// time2str & str2time
-TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen)
+wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen)
{
struct tm* T = gmtime(&_time);
mir_sntprintf(buf, bufLen, L"%04d-%02d-%02dT%02d:%02d:%02dZ",
@@ -763,12 +763,12 @@ TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen) return buf;
}
-time_t str2time(const TCHAR *buf)
+time_t str2time(const wchar_t *buf)
{
struct tm T = { 0 };
- if (_stscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec) != 6) {
+ if (swscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec) != 6) {
int boo;
- if (_stscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02d.%dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7)
+ if (swscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02d.%dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7)
return 0;
}
@@ -778,30 +778,30 @@ time_t str2time(const TCHAR *buf) }
////////////////////////////////////////////////////////////////////////
-// case-insensitive _tcsstr
-const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr)
+// case-insensitive wcsstr
+const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr)
{
- TCHAR *str_up = NEWTSTR_ALLOCA(str);
- TCHAR *substr_up = NEWTSTR_ALLOCA(substr);
+ wchar_t *str_up = NEWWSTR_ALLOCA(str);
+ wchar_t *substr_up = NEWWSTR_ALLOCA(substr);
CharUpperBuff(str_up, (DWORD)mir_tstrlen(str_up));
CharUpperBuff(substr_up, (DWORD)mir_tstrlen(substr_up));
- TCHAR *p = _tcsstr(str_up, substr_up);
+ wchar_t *p = wcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
}
////////////////////////////////////////////////////////////////////////
// clipboard processing
-void JabberCopyText(HWND hwnd, const TCHAR *text)
+void JabberCopyText(HWND hwnd, const wchar_t *text)
{
if (!hwnd || !text) return;
if (OpenClipboard(hwnd)) {
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
- TCHAR *s = (TCHAR *)GlobalLock(hMem);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
+ wchar_t *s = (wchar_t *)GlobalLock(hMem);
mir_tstrcpy(s, text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
@@ -812,7 +812,7 @@ void JabberCopyText(HWND hwnd, const TCHAR *text) BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
{
if (caption == NULL) {
- caption = NEWTSTR_ALLOCA(result.GetString());
+ caption = NEWWSTR_ALLOCA(result.GetString());
result.Empty();
}
@@ -841,15 +841,15 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime) if (n == NULL)
return false;
- const TCHAR *ptszTimeStamp = XmlGetAttrValue(n, L"stamp");
+ const wchar_t *ptszTimeStamp = XmlGetAttrValue(n, L"stamp");
if (ptszTimeStamp == NULL)
return false;
// skip '-' chars
- TCHAR *szStamp = NEWTSTR_ALLOCA(ptszTimeStamp);
+ wchar_t *szStamp = NEWWSTR_ALLOCA(ptszTimeStamp);
int si = 0, sj = 0;
while (true) {
- if (szStamp[si] == _T('-'))
+ if (szStamp[si] == '-')
si++;
else if (!(szStamp[sj++] = szStamp[si++]))
break;
@@ -871,11 +871,11 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (szTo == NULL)
return false;
- TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
+ wchar_t *pDelimiter = wcschr(szFrom, '/');
if (pDelimiter)
*pDelimiter = 0;
- pDelimiter = _tcschr(szTo, _T('/'));
+ pDelimiter = wcschr(szTo, '/');
if (pDelimiter)
*pDelimiter = 0;
@@ -907,7 +907,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ai.hContact = avs[i].hContact;
if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -924,10 +924,10 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
- _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
- FILE* out = _tfopen(tszFileName, L"wb");
+ wcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
+ FILE* out = _wfopen(tszFileName, L"wb");
if (out != NULL) {
fwrite(res->pData, res->dataLength, 1, out);
fclose(out);
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index ad0f752bb2..6d1ae5d239 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-int CJabberProto::SendGetVcard(const TCHAR *jid)
+int CJabberProto::SendGetVcard(const wchar_t *jid)
{
if (!m_bJabberOnline) return 0;
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK HomeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- TCHAR *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2t(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
@@ -190,7 +190,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- TCHAR *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2t(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
@@ -257,7 +257,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR {
const unsigned long iPageId = 3;
- TCHAR szAvatarFileName[MAX_PATH], szTempPath[MAX_PATH], szTempFileName[MAX_PATH];
+ wchar_t szAvatarFileName[MAX_PATH], szTempPath[MAX_PATH], szTempFileName[MAX_PATH];
PhotoDlgProcData* dat = (PhotoDlgProcData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -289,7 +289,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
- if (_taccess(szAvatarFileName, 0) == 0) {
+ if (_waccess(szAvatarFileName, 0) == 0) {
if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, L".\\");
if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) {
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
case IDC_LOAD:
- TCHAR szFilter[512], szFileName[MAX_PATH];
+ wchar_t szFilter[512], szFileName[MAX_PATH];
Bitmap_GetFilter(szFilter, _countof(szFilter));
OPENFILENAME ofn = { 0 };
@@ -350,7 +350,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HBITMAP hNewBitmap;
dat->ppro->debugLog(L"File selected is %s", szFileName);
- if (_tstat(szFileName, &st) < 0 || st.st_size > 40 * 1024) {
+ if (_wstat(szFileName, &st) < 0 || st.st_size > 40 * 1024) {
MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND);
break;
}
@@ -578,7 +578,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- TCHAR text[128];
+ wchar_t text[128];
GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text));
mir_snprintf(idstr, "e-mail%d", dat->id);
dat->ppro->setTString(idstr, text);
@@ -719,7 +719,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP {
int i;
char idstr[33];
- TCHAR number[20];
+ wchar_t number[20];
//e-mails
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS));
@@ -916,7 +916,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage)
{
- TCHAR text[2048];
+ wchar_t text[2048];
// Page 0: Personal
switch (iPage) {
@@ -958,7 +958,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- TCHAR *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
setTString("Country", country);
mir_free(country);
}
@@ -984,7 +984,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("CompanyZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- TCHAR *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
setTString("CompanyCountry", country);
mir_free(country);
}
@@ -1010,7 +1010,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) n << XCHILD(_A2T(tag), tszValue);
}
-void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
+void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName)
{
if (!m_bJabberOnline) return;
@@ -1104,7 +1104,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) if (nFlag & JABBER_VCTEL_PCS) n << XCHILD(L"PCS");
}
- TCHAR szAvatarName[MAX_PATH], *szFileName;
+ wchar_t szAvatarName[MAX_PATH], *szFileName;
GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
if (bPhotoChanged)
szFileName = szPhotoFileName;
@@ -1123,7 +1123,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) debugLog(L"Saving picture from %s", szFileName);
struct _stat st;
- if (_tstat(szFileName, &st) >= 0) {
+ if (_wstat(szFileName, &st) >= 0) {
// Note the FILE_SHARE_READ attribute so that the CopyFile can succeed
HANDLE hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
@@ -1134,7 +1134,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) ptrA str(mir_base64_encode((PBYTE)(LPSTR)buffer, nRead));
if (str != NULL) {
n = v << XCHILD(L"PHOTO");
- TCHAR *szFileType;
+ wchar_t *szFileType;
switch (ProtoGetBufferFormat(buffer)) {
case PA_FORMAT_PNG: szFileType = L"image/png"; break;
case PA_FORMAT_GIF: szFileType = L"image/gif"; break;
@@ -1188,36 +1188,36 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM) odp.hInstance = hInst;
odp.dwInitParam = (LPARAM)this;
odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.pfnDlgProc = PersonalDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PERSONAL);
- odp.ptszTab = LPGENT("General");
+ odp.pwszTab = LPGENW("General");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = ContactDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_CONTACT);
- odp.ptszTab = LPGENT("Contacts");
+ odp.pwszTab = LPGENW("Contacts");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = HomeDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_HOME);
- odp.ptszTab = LPGENT("Home");
+ odp.pwszTab = LPGENW("Home");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = WorkDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_WORK);
- odp.ptszTab = LPGENT("Work");
+ odp.pwszTab = LPGENW("Work");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = PhotoDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PHOTO);
- odp.ptszTab = LPGENT("Photo");
+ odp.pwszTab = LPGENW("Photo");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = NoteDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_NOTE);
- odp.ptszTab = LPGENT("Note");
+ odp.pwszTab = LPGENW("Note");
UserInfo_AddPage(wParam, &odp);
SendGetVcard(m_szJabberJID);
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 17460ea992..201b1fbbd4 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -28,7 +28,7 @@ BOOL CJabberProto::WsInit(void) {
m_lastTicks = ::GetTickCount();
- TCHAR name[128];
+ wchar_t name[128];
mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index f4626e8921..32b1b6194e 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
// XmlNodeIq class members
-XmlNodeIq::XmlNodeIq(const TCHAR *type, int id, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, int id, LPCTSTR to) :
XmlNode(L"iq")
{
if (type != NULL) *this << XATTR(L"type", type);
@@ -41,7 +41,7 @@ XmlNodeIq::XmlNodeIq(const TCHAR *type, int id, LPCTSTR to) : if (id != -1 ) *this << XATTRID(id);
}
-XmlNodeIq::XmlNodeIq(const TCHAR *type, LPCTSTR idStr, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, LPCTSTR idStr, LPCTSTR to) :
XmlNode(L"iq")
{
if (type != NULL) *this << XATTR(L"type", type );
@@ -49,13 +49,13 @@ XmlNodeIq::XmlNodeIq(const TCHAR *type, LPCTSTR idStr, LPCTSTR to) : if (idStr != NULL) *this << XATTR(L"id", idStr);
}
-XmlNodeIq::XmlNodeIq(const TCHAR *type, HXML node, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, HXML node, LPCTSTR to) :
XmlNode(L"iq")
{
if (type != NULL) *this << XATTR(L"type", type );
if (to != NULL) *this << XATTR(L"to", to );
if (node != NULL) {
- const TCHAR *iqId = XmlGetAttrValue(*this, L"id");
+ const wchar_t *iqId = XmlGetAttrValue(*this, L"id");
if (iqId != NULL) *this << XATTR(L"id", iqId);
}
}
@@ -70,7 +70,7 @@ XmlNodeIq::XmlNodeIq(CJabberIqInfo *pInfo) : }
}
-XmlNodeIq::XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, CJabberIqInfo *pInfo) :
XmlNode(L"iq")
{
if (type != NULL) *this << XATTR(L"type", type);
@@ -145,7 +145,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, int value) void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value)
{
- TCHAR buf[60];
+ wchar_t buf[60];
_ui64tot(value, buf, 10);
xmlAddAttr(hXml, T2UTF(pszName), T2UTF(buf));
@@ -153,7 +153,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) void __fastcall XmlAddAttrID(HXML hXml, int id)
{
- TCHAR text[100];
+ wchar_t text[100];
mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
XmlAddAttr(hXml, L"id", text);
}
@@ -194,8 +194,8 @@ HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, LPCTSTR value) HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, int value)
{
- TCHAR buf[40];
- _itot(value, buf, 10);
+ wchar_t buf[40];
+ _itow(value, buf, 10);
return xmlAddChild(hXml, T2UTF(name), buf);
}
@@ -280,20 +280,20 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate) {
if (!info.nodeName) return;
- TCHAR *nodeName = (TCHAR *)alloca(sizeof(TCHAR) * (info.nodeName.length+1));
+ wchar_t *nodeName = (wchar_t *)alloca(sizeof(wchar_t) * (info.nodeName.length+1));
mir_tstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
if (info.attrName && info.attrValue) {
- TCHAR *attrName = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrName.length + 1));
+ wchar_t *attrName = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrName.length + 1));
mir_tstrncpy(attrName, info.attrName.p, info.attrName.length + 1);
- TCHAR *attrValue = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrValue.length + 1));
+ wchar_t *attrValue = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrValue.length + 1));
mir_tstrncpy(attrValue, info.attrValue.p, info.attrValue.length + 1);
HXML hXml = XmlGetChildByTag(m_hXml, nodeName, attrName, attrValue);
m_hXml = (hXml || !bCreate) ? hXml : (m_hXml << XCHILD(nodeName) << XATTR(attrName, attrValue));
}
else if (info.nodeIndex) {
- int idx = _ttoi(info.nodeIndex.p);
+ int idx = _wtoi(info.nodeIndex.p);
m_hXml = mir_tstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1);
}
else {
@@ -322,11 +322,11 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T('@'):
+ case '@':
info.attrName.Begin(p + 1);
state = S_ATTR_STEP;
break;
- case _T('/'):
+ case '/':
break;
default:
info.nodeName.Begin(p);
@@ -352,11 +352,11 @@ XPath::PathType XPath::LookupImpl(bool bCreate) info.nodeName.End(p);
state = S_FINAL_NODESET;
break;
- case _T('['):
+ case '[':
info.nodeName.End(p);
state = S_NODE_OPENBRACKET;
break;
- case _T('/'):
+ case '/':
info.nodeName.End(p);
state = S_START;
break;
@@ -370,12 +370,12 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T('@'):
+ case '@':
info.attrName.Begin(p + 1);
state = S_NODE_ATTRNAME;
break;
- case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'):
- case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'):
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
info.nodeIndex.Begin(p);
state = S_NODE_INDEX;
break;
@@ -390,12 +390,12 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T(']'):
+ case ']':
info.nodeIndex.End(p);
state = S_NODE_CLOSEBRACKET;
break;
- case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'):
- case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'):
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
break;
default:
state = S_FINAL_ERROR;
@@ -408,7 +408,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T('='):
+ case '=':
info.attrName.End(p);
state = S_NODE_ATTREQUALS;
break;
@@ -422,7 +422,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T('\''):
+ case '\'':
info.attrValue.Begin(p + 1);
state = S_NODE_ATTRVALUE;
break;
@@ -437,7 +437,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T('\''):
+ case '\'':
info.attrValue.End(p);
state = S_NODE_ATTRCLOSEVALUE;
break;
@@ -451,7 +451,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_ERROR;
break;
- case _T(']'):
+ case ']':
state = S_NODE_CLOSEBRACKET;
break;
default:
@@ -465,7 +465,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0:
state = S_FINAL_NODE;
break;
- case _T('/'):
+ case '/':
state = S_START;
break;
default:
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 685336b35c..739ba708db 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -83,13 +83,13 @@ class CJabberIqInfo; struct XmlNodeIq : public XmlNode
{
- XmlNodeIq(const TCHAR *type, int id = -1, const TCHAR *to = NULL);
- XmlNodeIq(const TCHAR *type, const TCHAR *idStr, const TCHAR *to);
- XmlNodeIq(const TCHAR *type, HXML node, const TCHAR *to);
+ XmlNodeIq(const wchar_t *type, int id = -1, const wchar_t *to = NULL);
+ XmlNodeIq(const wchar_t *type, const wchar_t *idStr, const wchar_t *to);
+ XmlNodeIq(const wchar_t *type, HXML node, const wchar_t *to);
// new request
XmlNodeIq(CJabberIqInfo *pInfo);
// answer to request
- XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo);
+ XmlNodeIq(const wchar_t *type, CJabberIqInfo *pInfo);
};
typedef void (*JABBER_XML_CALLBACK)(HXML, void*);
@@ -224,7 +224,7 @@ HXML __fastcall operator<<(HXML node, const XQUERY& child); class XPath
{
public:
- __forceinline XPath(HXML hXml, TCHAR *path):
+ __forceinline XPath(HXML hXml, wchar_t *path):
m_type(T_UNKNOWN),
m_hXml(hXml),
m_szPath(path),
@@ -245,22 +245,22 @@ public: {
switch (Lookup())
{
- case T_ATTRIBUTE: return (TCHAR *)XmlGetAttrValue(m_hXml, m_szParam);
- case T_NODE: return (TCHAR *)XmlGetText(m_hXml);
- case T_NODESET: return (TCHAR *)XmlGetText(XmlGetNthChild(m_hXml, m_szParam, 1));
+ case T_ATTRIBUTE: return (wchar_t *)XmlGetAttrValue(m_hXml, m_szParam);
+ case T_NODE: return (wchar_t *)XmlGetText(m_hXml);
+ case T_NODESET: return (wchar_t *)XmlGetText(XmlGetNthChild(m_hXml, m_szParam, 1));
}
return NULL;
}
operator int()
{
- if (TCHAR *s = *this) return _ttoi(s);
+ if (wchar_t *s = *this) return _wtoi(s);
return 0;
}
- __forceinline bool operator== (TCHAR *str)
+ __forceinline bool operator== (wchar_t *str)
{
return !mir_tstrcmp((LPCTSTR)*this, str);
}
- __forceinline bool operator!= (TCHAR *str)
+ __forceinline bool operator!= (wchar_t *str)
{
return mir_tstrcmp((LPCTSTR)*this, str) ? true : false;
}
@@ -280,8 +280,8 @@ public: }
void operator= (int value)
{
- TCHAR buf[16];
- _itot(value, buf, 10);
+ wchar_t buf[16];
+ _itow(value, buf, 10);
*this = buf;
}
@@ -322,11 +322,11 @@ private: struct LookupString
{
- void Begin(const TCHAR *p_) { p = p_; }
- void End(const TCHAR *p_) { length = p_ - p; }
+ void Begin(const wchar_t *p_) { p = p_; }
+ void End(const wchar_t *p_) { length = p_ - p; }
operator bool() { return p ? true : false; }
- const TCHAR *p;
+ const wchar_t *p;
int length;
};
@@ -353,7 +353,7 @@ class XPathFmt: public XPath {
public:
enum { BUFSIZE = 512 };
- XPathFmt(HXML hXml, TCHAR *path, ...): XPath(hXml, m_buf)
+ XPathFmt(HXML hXml, wchar_t *path, ...): XPath(hXml, m_buf)
{
*m_buf = 0;
@@ -378,7 +378,7 @@ public: }
private:
- TCHAR m_buf[BUFSIZE];
+ wchar_t m_buf[BUFSIZE];
};
#endif
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index e9bacc1e5d..4e0b3b521b 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -67,7 +67,7 @@ void CJabberDlgPepBase::OnInitDialog() SetTimer(m_hwnd, 1, 1000, NULL);
- TCHAR buf[128];
+ wchar_t buf[128];
mir_sntprintf(buf, TranslateT("OK (%d)"), m_time);
m_btnOk.SetText(buf);
}
@@ -88,7 +88,7 @@ INT_PTR CJabberDlgPepBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) {
case WM_TIMER:
if (wParam == 1) {
- TCHAR buf[128];
+ wchar_t buf[128];
mir_sntprintf(buf, TranslateT("OK (%d)"), --m_time);
m_btnOk.SetText(buf);
@@ -119,14 +119,14 @@ class CJabberDlgPepSimple: public CJabberDlgPepBase {
typedef CJabberDlgPepBase CSuper;
public:
- CJabberDlgPepSimple(CJabberProto *proto, TCHAR *title);
+ CJabberDlgPepSimple(CJabberProto *proto, wchar_t *title);
~CJabberDlgPepSimple();
bool OkClicked() { return m_bOkClicked; }
- void AddStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem = false);
- void SetActiveStatus(LPARAM id, TCHAR *text);
+ void AddStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem = false);
+ void SetActiveStatus(LPARAM id, wchar_t *text);
LPARAM GetStatusMode();
- TCHAR *GetStatusText();
+ wchar_t *GetStatusText();
protected:
CCtrlCombo m_cbModes;
@@ -151,30 +151,30 @@ private: LPARAM m_id;
char *m_name;
HICON m_hIcon;
- TCHAR *m_title;
+ wchar_t *m_title;
bool m_subitem;
- CStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem): m_id(id), m_name(name), m_hIcon(hIcon), m_title(title), m_subitem(subitem) {}
+ CStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem): m_id(id), m_name(name), m_hIcon(hIcon), m_title(title), m_subitem(subitem) {}
~CStatusMode() { IcoLib_ReleaseIcon(m_hIcon); }
};
OBJLIST<CStatusMode> m_modes;
- TCHAR *m_text;
- TCHAR *m_title;
+ wchar_t *m_text;
+ wchar_t *m_title;
int m_time;
int m_prevSelected;
int m_selected;
bool m_bOkClicked;
LPARAM m_active;
- TCHAR *m_activeText;
+ wchar_t *m_activeText;
void btnOk_OnClick(CCtrlButton *btn);
void global_OnChange(CCtrlData *);
void cbModes_OnChange(CCtrlData *);
};
-CJabberDlgPepSimple::CJabberDlgPepSimple(CJabberProto *proto, TCHAR *title):
+CJabberDlgPepSimple::CJabberDlgPepSimple(CJabberProto *proto, wchar_t *title):
CJabberDlgPepBase(proto, IDD_PEP_SIMPLE),
m_cbModes(this, IDC_CB_MODES),
m_txtDescription(this, IDC_TXT_DESCRIPTION),
@@ -199,12 +199,12 @@ CJabberDlgPepSimple::~CJabberDlgPepSimple() mir_free(m_text);
}
-void CJabberDlgPepSimple::AddStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem)
+void CJabberDlgPepSimple::AddStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem)
{
m_modes.insert(new CStatusMode(id, name, hIcon, title, subitem));
}
-void CJabberDlgPepSimple::SetActiveStatus(LPARAM id, TCHAR *text)
+void CJabberDlgPepSimple::SetActiveStatus(LPARAM id, wchar_t *text)
{
m_active = id;
m_activeText = text;
@@ -215,7 +215,7 @@ LPARAM CJabberDlgPepSimple::GetStatusMode() return m_modes[m_selected].m_id;
}
-TCHAR *CJabberDlgPepSimple::GetStatusText()
+wchar_t *CJabberDlgPepSimple::GetStatusText()
{
return m_text;
}
@@ -275,7 +275,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) char szSetting[128];
if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) {
- TCHAR *txt = m_txtDescription.GetText();
+ wchar_t *txt = m_txtDescription.GetText();
mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name);
m_proto->setTString(szSetting, txt);
mir_free(txt);
@@ -337,7 +337,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) }
if (!mode->m_subitem || (lpdis->itemState & ODS_COMBOBOXEDIT)) {
- TCHAR text[128];
+ wchar_t text[128];
if (mode->m_subitem) {
for (int i = lpdis->itemData; i >= 0; --i)
if (!m_modes[i].m_subitem) {
@@ -351,7 +351,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
}
else {
- TCHAR text[128];
+ wchar_t text[128];
mir_sntprintf(text, L"...%s", mode->m_title);
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
@@ -371,7 +371,7 @@ BOOL CJabberDlgPepSimple::OnWmGetMinMaxInfo(UINT, WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////
// CPepService base class
-CPepService::CPepService(CJabberProto *proto, char *name, TCHAR *node):
+CPepService::CPepService(CJabberProto *proto, char *name, wchar_t *node):
m_proto(proto),
m_name(name),
m_node(node),
@@ -398,8 +398,8 @@ void CPepService::Publish() void CPepService::Retract()
{
- TCHAR *tempName = mir_a2t(m_name);
- _tcslwr(tempName);
+ wchar_t *tempName = mir_a2t(m_name);
+ wcslwr(tempName);
m_proto->m_ThreadInfo->send(
XmlNodeIq(L"set", m_proto->SerialNext())
@@ -425,7 +425,7 @@ void CPepService::ForceRepublishOnLogin() ///////////////////////////////////////////////////////////////////////////////
// CPepGuiService base class
-CPepGuiService::CPepGuiService(CJabberProto *proto, char *name, TCHAR *node):
+CPepGuiService::CPepGuiService(CJabberProto *proto, char *name, wchar_t *node):
CPepService(proto, name, node),
m_bGuiOpen(false),
m_hIcolibItem(NULL),
@@ -471,7 +471,7 @@ void CPepGuiService::RebuildMenu() mi.position = 200010;
mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_HIDDEN;
mi.hIcolibItem = m_hIcolibItem;
- mi.name.t = m_szText ? m_szText : LPGENT("<advanced status slot>");
+ mi.name.w = m_szText ? m_szText : LPGENW("<advanced status slot>");
m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName);
}
@@ -486,7 +486,7 @@ bool CPepGuiService::LaunchSetGui(BYTE bQuiet) return true;
}
-void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text)
+void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text)
{
m_hIcolibItem = hIcolibIcon;
replaceStrT(m_szText, text);
@@ -506,96 +506,96 @@ int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM) struct
{
- TCHAR *szName;
+ wchar_t *szName;
char* szTag;
}
static g_arrMoods[] =
{
- { LPGENT("None"), NULL },
- { LPGENT("Afraid"), "afraid" },
- { LPGENT("Amazed"), "amazed" },
- { LPGENT("Amorous"), "amorous" },
- { LPGENT("Angry"), "angry" },
- { LPGENT("Annoyed"), "annoyed" },
- { LPGENT("Anxious"), "anxious" },
- { LPGENT("Aroused"), "aroused" },
- { LPGENT("Ashamed"), "ashamed" },
- { LPGENT("Bored"), "bored" },
- { LPGENT("Brave"), "brave" },
- { LPGENT("Calm"), "calm" },
- { LPGENT("Cautious"), "cautious" },
- { LPGENT("Cold"), "cold" },
- { LPGENT("Confident"), "confident" },
- { LPGENT("Confused"), "confused" },
- { LPGENT("Contemplative"),"contemplative" },
- { LPGENT("Contented"), "contented" },
- { LPGENT("Cranky"), "cranky" },
- { LPGENT("Crazy"), "crazy" },
- { LPGENT("Creative"), "creative" },
- { LPGENT("Curious"), "curious" },
- { LPGENT("Dejected"), "dejected" },
- { LPGENT("Depressed"), "depressed" },
- { LPGENT("Disappointed"), "disappointed" },
- { LPGENT("Disgusted"), "disgusted" },
- { LPGENT("Dismayed"), "dismayed" },
- { LPGENT("Distracted"), "distracted" },
- { LPGENT("Embarrassed"), "embarrassed" },
- { LPGENT("Envious"), "envious" },
- { LPGENT("Excited"), "excited" },
- { LPGENT("Flirtatious"), "flirtatious" },
- { LPGENT("Frustrated"), "frustrated" },
- { LPGENT("Grateful"), "grateful" },
- { LPGENT("Grieving"), "grieving" },
- { LPGENT("Grumpy"), "grumpy" },
- { LPGENT("Guilty"), "guilty" },
- { LPGENT("Happy"), "happy" },
- { LPGENT("Hopeful"), "hopeful" },
- { LPGENT("Hot"), "hot" },
- { LPGENT("Humbled"), "humbled" },
- { LPGENT("Humiliated"), "humiliated" },
- { LPGENT("Hungry"), "hungry" },
- { LPGENT("Hurt"), "hurt" },
- { LPGENT("Impressed"), "impressed" },
- { LPGENT("In awe"), "in_awe" },
- { LPGENT("In love"), "in_love" },
- { LPGENT("Indignant"), "indignant" },
- { LPGENT("Interested"), "interested" },
- { LPGENT("Intoxicated"), "intoxicated" },
- { LPGENT("Invincible"), "invincible" },
- { LPGENT("Jealous"), "jealous" },
- { LPGENT("Lonely"), "lonely" },
- { LPGENT("Lost"), "lost" },
- { LPGENT("Lucky"), "lucky" },
- { LPGENT("Mean"), "mean" },
- { LPGENT("Moody"), "moody" },
- { LPGENT("Nervous"), "nervous" },
- { LPGENT("Neutral"), "neutral" },
- { LPGENT("Offended"), "offended" },
- { LPGENT("Outraged"), "outraged" },
- { LPGENT("Playful"), "playful" },
- { LPGENT("Proud"), "proud" },
- { LPGENT("Relaxed"), "relaxed" },
- { LPGENT("Relieved"), "relieved" },
- { LPGENT("Remorseful"), "remorseful" },
- { LPGENT("Restless"), "restless" },
- { LPGENT("Sad"), "sad" },
- { LPGENT("Sarcastic"), "sarcastic" },
- { LPGENT("Satisfied"), "satisfied" },
- { LPGENT("Serious"), "serious" },
- { LPGENT("Shocked"), "shocked" },
- { LPGENT("Shy"), "shy" },
- { LPGENT("Sick"), "sick" },
- { LPGENT("Sleepy"), "sleepy" },
- { LPGENT("Spontaneous"), "spontaneous" },
- { LPGENT("Stressed"), "stressed" },
- { LPGENT("Strong"), "strong" },
- { LPGENT("Surprised"), "surprised" },
- { LPGENT("Thankful"), "thankful" },
- { LPGENT("Thirsty"), "thirsty" },
- { LPGENT("Tired"), "tired" },
- { LPGENT("Undefined"), "undefined" },
- { LPGENT("Weak"), "weak" },
- { LPGENT("Worried"), "worried" },
+ { LPGENW("None"), NULL },
+ { LPGENW("Afraid"), "afraid" },
+ { LPGENW("Amazed"), "amazed" },
+ { LPGENW("Amorous"), "amorous" },
+ { LPGENW("Angry"), "angry" },
+ { LPGENW("Annoyed"), "annoyed" },
+ { LPGENW("Anxious"), "anxious" },
+ { LPGENW("Aroused"), "aroused" },
+ { LPGENW("Ashamed"), "ashamed" },
+ { LPGENW("Bored"), "bored" },
+ { LPGENW("Brave"), "brave" },
+ { LPGENW("Calm"), "calm" },
+ { LPGENW("Cautious"), "cautious" },
+ { LPGENW("Cold"), "cold" },
+ { LPGENW("Confident"), "confident" },
+ { LPGENW("Confused"), "confused" },
+ { LPGENW("Contemplative"),"contemplative" },
+ { LPGENW("Contented"), "contented" },
+ { LPGENW("Cranky"), "cranky" },
+ { LPGENW("Crazy"), "crazy" },
+ { LPGENW("Creative"), "creative" },
+ { LPGENW("Curious"), "curious" },
+ { LPGENW("Dejected"), "dejected" },
+ { LPGENW("Depressed"), "depressed" },
+ { LPGENW("Disappointed"), "disappointed" },
+ { LPGENW("Disgusted"), "disgusted" },
+ { LPGENW("Dismayed"), "dismayed" },
+ { LPGENW("Distracted"), "distracted" },
+ { LPGENW("Embarrassed"), "embarrassed" },
+ { LPGENW("Envious"), "envious" },
+ { LPGENW("Excited"), "excited" },
+ { LPGENW("Flirtatious"), "flirtatious" },
+ { LPGENW("Frustrated"), "frustrated" },
+ { LPGENW("Grateful"), "grateful" },
+ { LPGENW("Grieving"), "grieving" },
+ { LPGENW("Grumpy"), "grumpy" },
+ { LPGENW("Guilty"), "guilty" },
+ { LPGENW("Happy"), "happy" },
+ { LPGENW("Hopeful"), "hopeful" },
+ { LPGENW("Hot"), "hot" },
+ { LPGENW("Humbled"), "humbled" },
+ { LPGENW("Humiliated"), "humiliated" },
+ { LPGENW("Hungry"), "hungry" },
+ { LPGENW("Hurt"), "hurt" },
+ { LPGENW("Impressed"), "impressed" },
+ { LPGENW("In awe"), "in_awe" },
+ { LPGENW("In love"), "in_love" },
+ { LPGENW("Indignant"), "indignant" },
+ { LPGENW("Interested"), "interested" },
+ { LPGENW("Intoxicated"), "intoxicated" },
+ { LPGENW("Invincible"), "invincible" },
+ { LPGENW("Jealous"), "jealous" },
+ { LPGENW("Lonely"), "lonely" },
+ { LPGENW("Lost"), "lost" },
+ { LPGENW("Lucky"), "lucky" },
+ { LPGENW("Mean"), "mean" },
+ { LPGENW("Moody"), "moody" },
+ { LPGENW("Nervous"), "nervous" },
+ { LPGENW("Neutral"), "neutral" },
+ { LPGENW("Offended"), "offended" },
+ { LPGENW("Outraged"), "outraged" },
+ { LPGENW("Playful"), "playful" },
+ { LPGENW("Proud"), "proud" },
+ { LPGENW("Relaxed"), "relaxed" },
+ { LPGENW("Relieved"), "relieved" },
+ { LPGENW("Remorseful"), "remorseful" },
+ { LPGENW("Restless"), "restless" },
+ { LPGENW("Sad"), "sad" },
+ { LPGENW("Sarcastic"), "sarcastic" },
+ { LPGENW("Satisfied"), "satisfied" },
+ { LPGENW("Serious"), "serious" },
+ { LPGENW("Shocked"), "shocked" },
+ { LPGENW("Shy"), "shy" },
+ { LPGENW("Sick"), "sick" },
+ { LPGENW("Sleepy"), "sleepy" },
+ { LPGENW("Spontaneous"), "spontaneous" },
+ { LPGENW("Stressed"), "stressed" },
+ { LPGENW("Strong"), "strong" },
+ { LPGENW("Surprised"), "surprised" },
+ { LPGENW("Thankful"), "thankful" },
+ { LPGENW("Thirsty"), "thirsty" },
+ { LPGENW("Tired"), "tired" },
+ { LPGENW("Undefined"), "undefined" },
+ { LPGENW("Weak"), "weak" },
+ { LPGENW("Worried"), "worried" },
};
CPepMood::CPepMood(CJabberProto *proto) :
@@ -603,7 +603,7 @@ CPepMood::CPepMood(CJabberProto *proto) : m_text(NULL),
m_mode(-1)
{
- UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set mood..."));
+ UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set mood..."));
}
CPepMood::~CPepMood()
@@ -611,7 +611,7 @@ CPepMood::~CPepMood() mir_free(m_text);
}
-void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode)
+void CPepMood::ProcessItems(const wchar_t *from, HXML itemsNode)
{
MCONTACT hContact = NULL, hSelfContact = NULL;
if (!m_proto->IsMyOwnJID(from)) {
@@ -638,7 +638,7 @@ void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode) moodType = XmlGetName(n);
}
- TCHAR *fixedText = JabberStrFixLines(moodText);
+ wchar_t *fixedText = JabberStrFixLines(moodText);
if (hSelfContact)
SetMood(hSelfContact, moodType, fixedText);
SetMood(hContact, moodType, fixedText);
@@ -668,7 +668,7 @@ void CPepMood::SetExtraIcon(MCONTACT hContact, char *szMood) ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : g_MoodIcons.GetIcolibHandle(szMood));
}
-void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szText)
+void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *szText)
{
int mood = -1;
if (szMood) {
@@ -691,7 +691,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe replaceStrT(m_text, szText);
HANDLE hIcon;
- TCHAR title[128];
+ wchar_t title[128];
if (mood >= 0) {
mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag);
@@ -745,7 +745,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) }
HANDLE hIcon;
- TCHAR *ptszTitle;
+ wchar_t *ptszTitle;
if (m_mode >= 0) {
Publish();
hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[m_mode].szTag); ptszTitle = TranslateTS(g_arrMoods[m_mode].szName);
@@ -769,89 +769,89 @@ struct {
char *szFirst;
char *szSecond;
- TCHAR *szTitle;
+ wchar_t *szTitle;
int iconid;
}
static g_arrActivities[] =
{
- { "doing_chores", NULL, LPGENT("Doing chores"), ACTIVITY_ICON(0, 0) },
- { NULL, "buying_groceries", LPGENT("buying groceries"), ACTIVITY_ICON(0, 1) },
- { NULL, "cleaning", LPGENT("cleaning"), ACTIVITY_ICON(0, 2) },
- { NULL, "cooking", LPGENT("cooking"), ACTIVITY_ICON(0, 3) },
- { NULL, "doing_maintenance", LPGENT("doing maintenance"), ACTIVITY_ICON(0, 4) },
- { NULL, "doing_the_dishes", LPGENT("doing the dishes"), ACTIVITY_ICON(0, 5) },
- { NULL, "doing_the_laundry", LPGENT("doing the laundry"), ACTIVITY_ICON(0, 6) },
- { NULL, "gardening", LPGENT("gardening"), ACTIVITY_ICON(0, 7) },
- { NULL, "running_an_errand", LPGENT("running an errand"), ACTIVITY_ICON(0, 8) },
- { NULL, "walking_the_dog", LPGENT("walking the dog"), ACTIVITY_ICON(0, 9) },
- { "drinking", NULL, LPGENT("Drinking"), ACTIVITY_ICON(1, 0) },
- { NULL, "having_a_beer", LPGENT("having a beer"), ACTIVITY_ICON(1, 1) },
- { NULL, "having_coffee", LPGENT("having coffee"), ACTIVITY_ICON(1, 2) },
- { NULL, "having_tea", LPGENT("having tea"), ACTIVITY_ICON(1, 3) },
- { "eating", NULL, LPGENT("Eating"), ACTIVITY_ICON(2, 0) },
- { NULL, "having_a_snack", LPGENT("having a snack"), ACTIVITY_ICON(2, 1) },
- { NULL, "having_breakfast", LPGENT("having breakfast"), ACTIVITY_ICON(2, 2) },
- { NULL, "having_dinner", LPGENT("having dinner"), ACTIVITY_ICON(2, 3) },
- { NULL, "having_lunch", LPGENT("having lunch"), ACTIVITY_ICON(2, 4) },
- { "exercising", NULL, LPGENT("Exercising"), ACTIVITY_ICON(3, 0) },
- { NULL, "cycling", LPGENT("cycling"), ACTIVITY_ICON(3, 1) },
- { NULL, "dancing", LPGENT("dancing"), ACTIVITY_ICON(3, 2) },
- { NULL, "hiking", LPGENT("hiking"), ACTIVITY_ICON(3, 3) },
- { NULL, "jogging", LPGENT("jogging"), ACTIVITY_ICON(3, 4) },
- { NULL, "playing_sports", LPGENT("playing sports"), ACTIVITY_ICON(3, 5) },
- { NULL, "running", LPGENT("running"), ACTIVITY_ICON(3, 6) },
- { NULL, "skiing", LPGENT("skiing"), ACTIVITY_ICON(3, 7) },
- { NULL, "swimming", LPGENT("swimming"), ACTIVITY_ICON(3, 8) },
- { NULL, "working_out", LPGENT("working out"), ACTIVITY_ICON(3, 9) },
- { "grooming", NULL, LPGENT("Grooming"), ACTIVITY_ICON(4, 0) },
- { NULL, "at_the_spa", LPGENT("at the spa"), ACTIVITY_ICON(4, 1) },
- { NULL, "brushing_teeth", LPGENT("brushing teeth"), ACTIVITY_ICON(4, 2) },
- { NULL, "getting_a_haircut", LPGENT("getting a haircut"), ACTIVITY_ICON(4, 3) },
- { NULL, "shaving", LPGENT("shaving"), ACTIVITY_ICON(4, 4) },
- { NULL, "taking_a_bath", LPGENT("taking a bath"), ACTIVITY_ICON(4, 5) },
- { NULL, "taking_a_shower", LPGENT("taking a shower"), ACTIVITY_ICON(4, 6) },
- { "having_appointment", NULL, LPGENT("Having appointment"), ACTIVITY_ICON(5, 0) },
- { "inactive", NULL, LPGENT("Inactive"), ACTIVITY_ICON(6, 0) },
- { NULL, "day_off", LPGENT("day off"), ACTIVITY_ICON(6, 1) },
- { NULL, "hanging_out", LPGENT("hanging out"), ACTIVITY_ICON(6, 2) },
- { NULL, "hiding", LPGENT("hiding"), ACTIVITY_ICON(6, 3) },
- { NULL, "on_vacation", LPGENT("on vacation"), ACTIVITY_ICON(6, 4) },
- { NULL, "praying", LPGENT("praying"), ACTIVITY_ICON(6, 5) },
- { NULL, "scheduled_holiday", LPGENT("scheduled holiday"), ACTIVITY_ICON(6, 6) },
- { NULL, "sleeping", LPGENT("sleeping"), ACTIVITY_ICON(6, 7) },
- { NULL, "thinking", LPGENT("thinking"), ACTIVITY_ICON(6, 8) },
- { "relaxing", NULL, LPGENT("Relaxing"), ACTIVITY_ICON(7, 0) },
- { NULL, "fishing", LPGENT("fishing"), ACTIVITY_ICON(7, 1) },
- { NULL, "gaming", LPGENT("gaming"), ACTIVITY_ICON(7, 2) },
- { NULL, "going_out", LPGENT("going out"), ACTIVITY_ICON(7, 3) },
- { NULL, "partying", LPGENT("partying"), ACTIVITY_ICON(7, 4) },
- { NULL, "reading", LPGENT("reading"), ACTIVITY_ICON(7, 5) },
- { NULL, "rehearsing", LPGENT("rehearsing"), ACTIVITY_ICON(7, 6) },
- { NULL, "shopping", LPGENT("shopping"), ACTIVITY_ICON(7, 7) },
- { NULL, "smoking", LPGENT("smoking"), ACTIVITY_ICON(7, 8) },
- { NULL, "socializing", LPGENT("socializing"), ACTIVITY_ICON(7, 9) },
- { NULL, "sunbathing", LPGENT("sunbathing"), ACTIVITY_ICON(7, 10) },
- { NULL, "watching_tv", LPGENT("watching TV"), ACTIVITY_ICON(7, 11) },
- { NULL, "watching_a_movie", LPGENT("watching a movie"), ACTIVITY_ICON(7, 12) },
- { "talking", NULL, LPGENT("Talking"), ACTIVITY_ICON(8, 0) },
- { NULL, "in_real_life", LPGENT("in real life"), ACTIVITY_ICON(8, 1) },
- { NULL, "on_the_phone", LPGENT("on the phone"), ACTIVITY_ICON(8, 2) },
- { NULL, "on_video_phone", LPGENT("on video phone"), ACTIVITY_ICON(8, 3) },
- { "traveling", NULL, LPGENT("Traveling"), ACTIVITY_ICON(9, 0) },
- { NULL, "commuting", LPGENT("commuting"), ACTIVITY_ICON(9, 1) },
- { NULL, "cycling", LPGENT("cycling"), ACTIVITY_ICON(9, 2) },
- { NULL, "driving", LPGENT("driving"), ACTIVITY_ICON(9, 3) },
- { NULL, "in_a_car", LPGENT("in a car"), ACTIVITY_ICON(9, 4) },
- { NULL, "on_a_bus", LPGENT("on a bus"), ACTIVITY_ICON(9, 5) },
- { NULL, "on_a_plane", LPGENT("on a plane"), ACTIVITY_ICON(9, 6) },
- { NULL, "on_a_train", LPGENT("on a train"), ACTIVITY_ICON(9, 7) },
- { NULL, "on_a_trip", LPGENT("on a trip"), ACTIVITY_ICON(9, 8) },
- { NULL, "walking", LPGENT("walking"), ACTIVITY_ICON(9, 9) },
- { "working", NULL, LPGENT("Working"), ACTIVITY_ICON(10, 0) },
- { NULL, "coding", LPGENT("coding"), ACTIVITY_ICON(10, 1) },
- { NULL, "in_a_meeting", LPGENT("in a meeting"), ACTIVITY_ICON(10, 2) },
- { NULL, "studying", LPGENT("studying"), ACTIVITY_ICON(10, 3) },
- { NULL, "writing", LPGENT("writing"), ACTIVITY_ICON(10, 4) },
+ { "doing_chores", NULL, LPGENW("Doing chores"), ACTIVITY_ICON(0, 0) },
+ { NULL, "buying_groceries", LPGENW("buying groceries"), ACTIVITY_ICON(0, 1) },
+ { NULL, "cleaning", LPGENW("cleaning"), ACTIVITY_ICON(0, 2) },
+ { NULL, "cooking", LPGENW("cooking"), ACTIVITY_ICON(0, 3) },
+ { NULL, "doing_maintenance", LPGENW("doing maintenance"), ACTIVITY_ICON(0, 4) },
+ { NULL, "doing_the_dishes", LPGENW("doing the dishes"), ACTIVITY_ICON(0, 5) },
+ { NULL, "doing_the_laundry", LPGENW("doing the laundry"), ACTIVITY_ICON(0, 6) },
+ { NULL, "gardening", LPGENW("gardening"), ACTIVITY_ICON(0, 7) },
+ { NULL, "running_an_errand", LPGENW("running an errand"), ACTIVITY_ICON(0, 8) },
+ { NULL, "walking_the_dog", LPGENW("walking the dog"), ACTIVITY_ICON(0, 9) },
+ { "drinking", NULL, LPGENW("Drinking"), ACTIVITY_ICON(1, 0) },
+ { NULL, "having_a_beer", LPGENW("having a beer"), ACTIVITY_ICON(1, 1) },
+ { NULL, "having_coffee", LPGENW("having coffee"), ACTIVITY_ICON(1, 2) },
+ { NULL, "having_tea", LPGENW("having tea"), ACTIVITY_ICON(1, 3) },
+ { "eating", NULL, LPGENW("Eating"), ACTIVITY_ICON(2, 0) },
+ { NULL, "having_a_snack", LPGENW("having a snack"), ACTIVITY_ICON(2, 1) },
+ { NULL, "having_breakfast", LPGENW("having breakfast"), ACTIVITY_ICON(2, 2) },
+ { NULL, "having_dinner", LPGENW("having dinner"), ACTIVITY_ICON(2, 3) },
+ { NULL, "having_lunch", LPGENW("having lunch"), ACTIVITY_ICON(2, 4) },
+ { "exercising", NULL, LPGENW("Exercising"), ACTIVITY_ICON(3, 0) },
+ { NULL, "cycling", LPGENW("cycling"), ACTIVITY_ICON(3, 1) },
+ { NULL, "dancing", LPGENW("dancing"), ACTIVITY_ICON(3, 2) },
+ { NULL, "hiking", LPGENW("hiking"), ACTIVITY_ICON(3, 3) },
+ { NULL, "jogging", LPGENW("jogging"), ACTIVITY_ICON(3, 4) },
+ { NULL, "playing_sports", LPGENW("playing sports"), ACTIVITY_ICON(3, 5) },
+ { NULL, "running", LPGENW("running"), ACTIVITY_ICON(3, 6) },
+ { NULL, "skiing", LPGENW("skiing"), ACTIVITY_ICON(3, 7) },
+ { NULL, "swimming", LPGENW("swimming"), ACTIVITY_ICON(3, 8) },
+ { NULL, "working_out", LPGENW("working out"), ACTIVITY_ICON(3, 9) },
+ { "grooming", NULL, LPGENW("Grooming"), ACTIVITY_ICON(4, 0) },
+ { NULL, "at_the_spa", LPGENW("at the spa"), ACTIVITY_ICON(4, 1) },
+ { NULL, "brushing_teeth", LPGENW("brushing teeth"), ACTIVITY_ICON(4, 2) },
+ { NULL, "getting_a_haircut", LPGENW("getting a haircut"), ACTIVITY_ICON(4, 3) },
+ { NULL, "shaving", LPGENW("shaving"), ACTIVITY_ICON(4, 4) },
+ { NULL, "taking_a_bath", LPGENW("taking a bath"), ACTIVITY_ICON(4, 5) },
+ { NULL, "taking_a_shower", LPGENW("taking a shower"), ACTIVITY_ICON(4, 6) },
+ { "having_appointment", NULL, LPGENW("Having appointment"), ACTIVITY_ICON(5, 0) },
+ { "inactive", NULL, LPGENW("Inactive"), ACTIVITY_ICON(6, 0) },
+ { NULL, "day_off", LPGENW("day off"), ACTIVITY_ICON(6, 1) },
+ { NULL, "hanging_out", LPGENW("hanging out"), ACTIVITY_ICON(6, 2) },
+ { NULL, "hiding", LPGENW("hiding"), ACTIVITY_ICON(6, 3) },
+ { NULL, "on_vacation", LPGENW("on vacation"), ACTIVITY_ICON(6, 4) },
+ { NULL, "praying", LPGENW("praying"), ACTIVITY_ICON(6, 5) },
+ { NULL, "scheduled_holiday", LPGENW("scheduled holiday"), ACTIVITY_ICON(6, 6) },
+ { NULL, "sleeping", LPGENW("sleeping"), ACTIVITY_ICON(6, 7) },
+ { NULL, "thinking", LPGENW("thinking"), ACTIVITY_ICON(6, 8) },
+ { "relaxing", NULL, LPGENW("Relaxing"), ACTIVITY_ICON(7, 0) },
+ { NULL, "fishing", LPGENW("fishing"), ACTIVITY_ICON(7, 1) },
+ { NULL, "gaming", LPGENW("gaming"), ACTIVITY_ICON(7, 2) },
+ { NULL, "going_out", LPGENW("going out"), ACTIVITY_ICON(7, 3) },
+ { NULL, "partying", LPGENW("partying"), ACTIVITY_ICON(7, 4) },
+ { NULL, "reading", LPGENW("reading"), ACTIVITY_ICON(7, 5) },
+ { NULL, "rehearsing", LPGENW("rehearsing"), ACTIVITY_ICON(7, 6) },
+ { NULL, "shopping", LPGENW("shopping"), ACTIVITY_ICON(7, 7) },
+ { NULL, "smoking", LPGENW("smoking"), ACTIVITY_ICON(7, 8) },
+ { NULL, "socializing", LPGENW("socializing"), ACTIVITY_ICON(7, 9) },
+ { NULL, "sunbathing", LPGENW("sunbathing"), ACTIVITY_ICON(7, 10) },
+ { NULL, "watching_tv", LPGENW("watching TV"), ACTIVITY_ICON(7, 11) },
+ { NULL, "watching_a_movie", LPGENW("watching a movie"), ACTIVITY_ICON(7, 12) },
+ { "talking", NULL, LPGENW("Talking"), ACTIVITY_ICON(8, 0) },
+ { NULL, "in_real_life", LPGENW("in real life"), ACTIVITY_ICON(8, 1) },
+ { NULL, "on_the_phone", LPGENW("on the phone"), ACTIVITY_ICON(8, 2) },
+ { NULL, "on_video_phone", LPGENW("on video phone"), ACTIVITY_ICON(8, 3) },
+ { "traveling", NULL, LPGENW("Traveling"), ACTIVITY_ICON(9, 0) },
+ { NULL, "commuting", LPGENW("commuting"), ACTIVITY_ICON(9, 1) },
+ { NULL, "cycling", LPGENW("cycling"), ACTIVITY_ICON(9, 2) },
+ { NULL, "driving", LPGENW("driving"), ACTIVITY_ICON(9, 3) },
+ { NULL, "in_a_car", LPGENW("in a car"), ACTIVITY_ICON(9, 4) },
+ { NULL, "on_a_bus", LPGENW("on a bus"), ACTIVITY_ICON(9, 5) },
+ { NULL, "on_a_plane", LPGENW("on a plane"), ACTIVITY_ICON(9, 6) },
+ { NULL, "on_a_train", LPGENW("on a train"), ACTIVITY_ICON(9, 7) },
+ { NULL, "on_a_trip", LPGENW("on a trip"), ACTIVITY_ICON(9, 8) },
+ { NULL, "walking", LPGENW("walking"), ACTIVITY_ICON(9, 9) },
+ { "working", NULL, LPGENW("Working"), ACTIVITY_ICON(10, 0) },
+ { NULL, "coding", LPGENW("coding"), ACTIVITY_ICON(10, 1) },
+ { NULL, "in_a_meeting", LPGENW("in a meeting"), ACTIVITY_ICON(10, 2) },
+ { NULL, "studying", LPGENW("studying"), ACTIVITY_ICON(10, 3) },
+ { NULL, "writing", LPGENW("writing"), ACTIVITY_ICON(10, 4) },
{ NULL, NULL, NULL } // the end, don't delete this
};
@@ -945,7 +945,7 @@ char *ActivityGetSecond(int id) return (id >= 0) ? g_arrActivities[id].szSecond : NULL;
}
-TCHAR *ActivityGetFirstTitle(int id)
+wchar_t *ActivityGetFirstTitle(int id)
{
if (id >= _countof(g_arrActivities) - 1)
return NULL;
@@ -959,15 +959,15 @@ TCHAR *ActivityGetFirstTitle(int id) return NULL;
}
-TCHAR *ActivityGetSecondTitle(int id)
+wchar_t *ActivityGetSecondTitle(int id)
{
return ((id >= 0) && g_arrActivities[id].szSecond) ? g_arrActivities[id].szTitle : NULL;
}
-void ActivityBuildTitle(int id, TCHAR *buf, int size)
+void ActivityBuildTitle(int id, wchar_t *buf, int size)
{
- TCHAR *szFirst = ActivityGetFirstTitle(id);
- TCHAR *szSecond = ActivityGetSecondTitle(id);
+ wchar_t *szFirst = ActivityGetFirstTitle(id);
+ wchar_t *szSecond = ActivityGetSecondTitle(id);
if (szFirst) {
if (szSecond)
@@ -983,7 +983,7 @@ CPepActivity::CPepActivity(CJabberProto *proto): m_text(NULL),
m_mode(-1)
{
- UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set activity..."));
+ UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set activity..."));
}
CPepActivity::~CPepActivity()
@@ -991,7 +991,7 @@ CPepActivity::~CPepActivity() mir_free(m_text);
}
-void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode)
+void CPepActivity::ProcessItems(const wchar_t *from, HXML itemsNode)
{
MCONTACT hContact = NULL, hSelfContact = NULL;
if (!m_proto->IsMyOwnJID(from)) {
@@ -1025,7 +1025,7 @@ void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode) }
}
- TCHAR *fixedText = JabberStrFixLines(szText);
+ wchar_t *fixedText = JabberStrFixLines(szText);
if (hSelfContact)
SetActivity(hSelfContact, szFirstNode, szSecondNode, fixedText);
SetActivity(hContact, szFirstNode, szSecondNode, fixedText);
@@ -1071,7 +1071,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec return;
}
- TCHAR activityTitle[128];
+ wchar_t activityTitle[128];
ActivityBuildTitle(activity, activityTitle, _countof(activityTitle));
if (!hContact) {
@@ -1079,7 +1079,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec replaceStrT(m_text, szText);
HANDLE hIcon;
- TCHAR title[128];
+ wchar_t title[128];
if (activity >= 0) {
mir_sntprintf(title, TranslateT("Activity: %s"), activityTitle);
@@ -1097,7 +1097,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec else SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity));
if (activity >= 0) {
- TCHAR *p = mir_a2t(ActivityGetId(activity));
+ wchar_t *p = mir_a2t(ActivityGetId(activity));
m_proto->WriteAdvStatus(hContact, ADVSTATUS_ACTIVITY, p, g_ActivityIcons.GetIcolibName(returnActivity(activity)), activityTitle, szText);
mir_free(p);
}
@@ -1127,7 +1127,7 @@ void CPepActivity::ShowSetDialog(BYTE) }
else {
Retract();
- UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set activity..."));
+ UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set activity..."));
if (m_proto->m_pInfoFrame)
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity..."));
}
@@ -1169,7 +1169,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// SendPepMood - sends mood
-BOOL CJabberProto::SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri)
+BOOL CJabberProto::SendPepTune(wchar_t* szArtist, wchar_t* szLength, wchar_t* szSource, wchar_t* szTitle, wchar_t* szTrack, wchar_t* szUri)
{
if (!m_bJabberOnline || !m_bPepSupported)
return FALSE;
@@ -1200,21 +1200,21 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s return;
}
- TCHAR *szListeningTo;
+ wchar_t *szListeningTo;
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)) {
LISTENINGTOINFO li;
memset(&li, 0, sizeof(li));
li.cbSize = sizeof(li);
li.dwFlags = LTI_TCHAR;
- li.ptszArtist = (TCHAR*)szArtist;
- li.ptszLength = (TCHAR*)szLength;
- li.ptszAlbum = (TCHAR*)szSource;
- li.ptszTitle = (TCHAR*)szTitle;
- li.ptszTrack = (TCHAR*)szTrack;
- szListeningTo = (TCHAR*)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&li);
+ li.ptszArtist = (wchar_t*)szArtist;
+ li.ptszLength = (wchar_t*)szLength;
+ li.ptszAlbum = (wchar_t*)szSource;
+ li.ptszTitle = (wchar_t*)szTitle;
+ li.ptszTrack = (wchar_t*)szTrack;
+ szListeningTo = (wchar_t*)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&li);
}
else {
- szListeningTo = (TCHAR*)mir_alloc(2048 * sizeof(TCHAR));
+ szListeningTo = (wchar_t*)mir_alloc(2048 * sizeof(wchar_t));
mir_sntprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L"");
}
@@ -1227,7 +1227,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s mir_free(szListeningTo);
}
-TCHAR* a2tf(const TCHAR *str, BOOL unicode)
+wchar_t* a2tf(const wchar_t *str, BOOL unicode)
{
if (str == NULL)
return NULL;
@@ -1235,7 +1235,7 @@ TCHAR* a2tf(const TCHAR *str, BOOL unicode) return (unicode) ? mir_tstrdup(str) : mir_a2t((char*)str);
}
-void overrideStr(TCHAR*& dest, const TCHAR *src, BOOL unicode, const TCHAR *def = NULL)
+void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t *def = NULL)
{
if (dest != NULL) {
mir_free(dest);
@@ -1256,8 +1256,8 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) delSetting("ListeningTo");
}
else {
- TCHAR *szArtist = NULL, *szLength = NULL, *szSource = NULL;
- TCHAR *szTitle = NULL, *szTrack = NULL;
+ wchar_t *szArtist = NULL, *szLength = NULL, *szSource = NULL;
+ wchar_t *szTitle = NULL, *szTrack = NULL;
BOOL unicode = cm->dwFlags & LTI_UNICODE;
@@ -1267,20 +1267,20 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) overrideStr(szTrack, cm->ptszTrack, unicode);
overrideStr(szLength, cm->ptszLength, unicode);
- TCHAR szLengthInSec[ 32 ];
+ wchar_t szLengthInSec[ 32 ];
szLengthInSec[ 0 ] = 0;
if (szLength) {
unsigned int multiplier = 1, result = 0;
- for (TCHAR *p = szLength; *p; p++)
- if (*p == _T(':'))
+ for (wchar_t *p = szLength; *p; p++)
+ if (*p == ':')
multiplier *= 60;
if (multiplier <= 3600) {
- TCHAR *szTmp = szLength;
+ wchar_t *szTmp = szLength;
while (szTmp[0]) {
- result += (_ttoi(szTmp) * multiplier);
+ result += (_wtoi(szTmp) * multiplier);
multiplier /= 60;
- szTmp = _tcschr(szTmp, _T(':'));
+ szTmp = wcschr(szTmp, ':');
if (!szTmp)
break;
szTmp++;
@@ -1367,7 +1367,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_UNICODE) {
ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
if (title)
- _tcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE);
+ wcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE);
}
else {
ptrA title(ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
@@ -1383,7 +1383,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_UNICODE) {
ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
if (title)
- _tcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE);
+ wcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE);
}
else {
ptrA title(ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
@@ -1463,7 +1463,7 @@ void CJabberProto::ResetAdvStatus(MCONTACT hContact, const char *pszSlot) db_unset(hContact, "AdvStatus", szSetting);
}
-void CJabberProto::WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText)
+void CJabberProto::WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const wchar_t *pszMode, const char *pszIcon, const wchar_t *pszTitle, const wchar_t *pszText)
{
char szSetting[128];
@@ -1490,7 +1490,7 @@ char* CJabberProto::ReadAdvStatusA(MCONTACT hContact, const char *pszSlot, const return db_get_sa(hContact, "AdvStatus", szSetting);
}
-TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue)
+wchar_t* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue)
{
char szSetting[128];
mir_snprintf(szSetting, "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
@@ -1502,18 +1502,18 @@ TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, cons void g_XstatusIconsInit()
{
- TCHAR szFile[MAX_PATH];
+ wchar_t szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, _countof(szFile));
- if (TCHAR *p = _tcsrchr(szFile, '\\'))
+ if (wchar_t *p = wcsrchr(szFile, '\\'))
mir_tstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
- TCHAR szSection[100];
- mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENT("Moods"));
+ wchar_t szSection[100];
+ mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods"));
for (int i = 1; i < _countof(g_arrMoods); i++)
g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName));
- mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENT("Activities"));
+ mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities"));
for (int k = 0; k < _countof(g_arrActivities); k++) {
if (g_arrActivities[k].szFirst)
g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle));
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index 194a4c71de..ccda5b0886 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -32,12 +32,12 @@ struct CJabberProto; class CPepService
{
public:
- CPepService(CJabberProto *proto, char *name, TCHAR *node);
+ CPepService(CJabberProto *proto, char *name, wchar_t *node);
virtual ~CPepService();
HGENMENU GetMenu() { return m_hMenuItem; }
- TCHAR *GetNode() { return m_node; }
- virtual void ProcessItems(const TCHAR *from, HXML items) = 0;
+ wchar_t *GetNode() { return m_node; }
+ virtual void ProcessItems(const wchar_t *from, HXML items) = 0;
void Publish();
void Retract();
@@ -52,7 +52,7 @@ protected: CJabberProto *m_proto;
bool m_wasPublished;
char *m_name;
- TCHAR *m_node;
+ wchar_t *m_node;
HGENMENU m_hMenuItem;
virtual void CreateData(HXML) = 0;
@@ -64,7 +64,7 @@ class CPepServiceList: public OBJLIST<CPepService> public:
CPepServiceList(): OBJLIST<CPepService>(1) {}
- void ProcessEvent(const TCHAR *from, HXML eventNode)
+ void ProcessEvent(const wchar_t *from, HXML eventNode)
{
for (int i=0; i < getCount(); i++)
{
@@ -111,7 +111,7 @@ public: (*this)[i].ResetPublish();
}
- CPepService *Find(TCHAR *node)
+ CPepService *Find(wchar_t *node)
{
for (int i=0; i < getCount(); i++)
if (!mir_tstrcmp((*this)[i].GetNode(), node))
@@ -124,20 +124,20 @@ class CPepGuiService: public CPepService {
typedef CPepService CSuper;
public:
- CPepGuiService(CJabberProto *proto, char *name, TCHAR *node);
+ CPepGuiService(CJabberProto *proto, char *name, wchar_t *node);
~CPepGuiService();
void InitGui();
void RebuildMenu();
bool LaunchSetGui(BYTE bQuiet);
protected:
- void UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text);
+ void UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text);
virtual void ShowSetDialog(BYTE bQuiet) = 0;
private:
HANDLE m_hMenuService;
HANDLE m_hIcolibItem;
- TCHAR *m_szText;
+ wchar_t *m_szText;
bool m_bGuiOpen;
@@ -150,11 +150,11 @@ class CPepMood: public CPepGuiService public:
CPepMood(CJabberProto *proto);
~CPepMood();
- void ProcessItems(const TCHAR *from, HXML items);
+ void ProcessItems(const wchar_t *from, HXML items);
void ResetExtraIcon(MCONTACT hContact);
public:
- TCHAR *m_text;
+ wchar_t *m_text;
int m_mode;
protected:
@@ -162,7 +162,7 @@ protected: void ShowSetDialog(BYTE bQuiet);
void SetExtraIcon(MCONTACT hContact, char *szMood);
- void SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szText);
+ void SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *szText);
};
class CPepActivity: public CPepGuiService
@@ -171,11 +171,11 @@ class CPepActivity: public CPepGuiService public:
CPepActivity(CJabberProto *proto);
~CPepActivity();
- void ProcessItems(const TCHAR *from, HXML items);
+ void ProcessItems(const wchar_t *from, HXML items);
void ResetExtraIcon(MCONTACT hContact);
protected:
- TCHAR *m_text;
+ wchar_t *m_text;
int m_mode;
void CreateData(HXML);
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 805b83eb23..56f199f509 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -149,7 +149,7 @@ public: CCtrlFilterListView(CDlgBase* dlg, int ctrlId, bool trackFilter, bool keepHiglight);
~CCtrlFilterListView();
- TCHAR *GetFilterText();
+ wchar_t *GetFilterText();
CCallback<CCtrlFilterListView> OnFilterChanged;
protected:
@@ -159,7 +159,7 @@ protected: void OnInit();
LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam);
- void FilterHighlight(TCHAR *filter);
+ void FilterHighlight(wchar_t *filter);
};
#if !defined(OPENFILENAME_SIZE_VERSION_400)
@@ -177,8 +177,8 @@ protected: #define JABBER_IQID "mir_"
#define JABBER_MAX_JID_LEN 1024
-#define JABBER_GC_MSG_QUIT LPGENT("I'm happy Miranda NG user. Get it at http://miranda-ng.org/.")
-#define JABBER_GC_MSG_SLAP LPGENT("/me slaps %s around a bit with a large trout")
+#define JABBER_GC_MSG_QUIT LPGENW("I'm happy Miranda NG user. Get it at http://miranda-ng.org/.")
+#define JABBER_GC_MSG_SLAP LPGENW("/me slaps %s around a bit with a large trout")
#define JABBER_SERVER_URL "https://xmpp.net/services.php"
// registered db event types
@@ -307,12 +307,12 @@ enum { struct CJabberHttpAuthParams
{
enum {IQ = 1, MSG = 2} m_nType;
- TCHAR *m_szFrom;
- TCHAR *m_szIqId;
- TCHAR *m_szThreadId;
- TCHAR *m_szId;
- TCHAR *m_szMethod;
- TCHAR *m_szUrl;
+ wchar_t *m_szFrom;
+ wchar_t *m_szIqId;
+ wchar_t *m_szThreadId;
+ wchar_t *m_szId;
+ wchar_t *m_szMethod;
+ wchar_t *m_szUrl;
CJabberHttpAuthParams()
{
memset(this, 0, sizeof(CJabberHttpAuthParams));
@@ -352,8 +352,8 @@ typedef HANDLE JABBER_SOCKET; struct JABBER_CONN_DATA : public MZeroedObject
{
- TCHAR username[512];
- TCHAR password[512];
+ wchar_t username[512];
+ wchar_t password[512];
char server[128];
char manualHost[128];
int port;
@@ -401,8 +401,8 @@ struct ThreadData // connection & login data
JABBER_CONN_DATA conn;
- TCHAR resource[128];
- TCHAR fullJID[JABBER_MAX_JID_LEN];
+ wchar_t resource[128];
+ wchar_t fullJID[JABBER_MAX_JID_LEN];
ptrT tszNewPassword;
class TJabberAuth *auth;
@@ -420,11 +420,11 @@ struct ThreadData struct JABBER_MODEMSGS
{
- TCHAR *szOnline;
- TCHAR *szAway;
- TCHAR *szNa;
- TCHAR *szDnd;
- TCHAR *szFreechat;
+ wchar_t *szOnline;
+ wchar_t *szAway;
+ wchar_t *szNa;
+ wchar_t *szDnd;
+ wchar_t *szFreechat;
};
typedef enum { FT_SI, FT_OOB, FT_BYTESTREAM, FT_IBB } JABBER_FT_TYPE;
@@ -444,10 +444,10 @@ struct filetransfer JABBER_FT_TYPE type;
JABBER_SOCKET s;
JABBER_FILE_STATE state;
- TCHAR *jid;
+ wchar_t *jid;
int fileId;
- TCHAR* szId;
- TCHAR *sid;
+ wchar_t* szId;
+ wchar_t *sid;
int bCompleted;
HANDLE hWaitEvent;
@@ -459,13 +459,13 @@ struct filetransfer // Used by file receiving only
char* httpHostName;
WORD httpPort;
- TCHAR *httpPath;
+ wchar_t *httpPath;
unsigned __int64 dwExpectedRecvFileSize;
// Used by file sending only
HANDLE hFileEvent;
unsigned __int64 *fileSize;
- TCHAR *szDescription;
+ wchar_t *szDescription;
CJabberProto *ppro;
};
@@ -500,11 +500,11 @@ struct JABBER_MUC_JIDLIST_INFO ~JABBER_MUC_JIDLIST_INFO();
JABBER_MUC_JIDLIST_TYPE type;
- TCHAR *roomJid; // filled-in by the WM_JABBER_REFRESH code
+ wchar_t *roomJid; // filled-in by the WM_JABBER_REFRESH code
HXML iqNode;
CJabberProto *ppro;
- TCHAR *type2str(void) const;
+ wchar_t *type2str(void) const;
};
typedef void (CJabberProto::*JABBER_FORM_SUBMIT_FUNC)(HXML values, void *userdata);
@@ -533,7 +533,7 @@ public: void CreateInfoItem(char *pszName, bool bCompact=false, LPARAM pUserData=0);
void SetInfoItemCallback(char *pszName, void (CJabberProto::*onEvent)(CJabberInfoFrame_Event *));
- void UpdateInfoItem(char *pszName, HANDLE hIcolibItem, TCHAR *pszText);
+ void UpdateInfoItem(char *pszName, HANDLE hIcolibItem, wchar_t *pszText);
void ShowInfoItem(char *pszName, bool bShow);
void RemoveInfoItem(char *pszName);
@@ -564,7 +564,7 @@ private: void UpdateSize();
void RemoveTooltip(int id);
- void SetToolTip(int id, RECT *rc, TCHAR *pszText);
+ void SetToolTip(int id, RECT *rc, wchar_t *pszText);
void PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF fallback);
void PaintCompact(HDC hdc);
@@ -590,7 +590,7 @@ extern HINSTANCE hInst; extern HANDLE hExtraMood;
extern HANDLE hExtraActivity;
-extern TCHAR szCoreVersion[];
+extern wchar_t szCoreVersion[];
extern unsigned int g_nTempFileId;
extern int g_cbCountries;
@@ -613,11 +613,11 @@ void TreeList_Reset(HWND hwnd); void TreeList_SetMode(HWND hwnd, int mode);
HTREELISTITEM TreeList_GetActiveItem(HWND hwnd);
void TreeList_SetSortMode(HWND hwnd, int col, BOOL descending);
-void TreeList_SetFilter(HWND hwnd, TCHAR *filter);
-HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, TCHAR *text, LPARAM data);
+void TreeList_SetFilter(HWND hwnd, wchar_t *filter);
+HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, LPARAM data);
void TreeList_ResetItem(HWND hwnd, HTREELISTITEM hParent);
void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag);
-void TreeList_AppendColumn(HTREELISTITEM hItem, TCHAR *text);
+void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text);
int TreeList_AddIcon(HWND hwnd, HICON hIcon, int iOverlay);
void TreeList_SetIcon(HTREELISTITEM hItem, int iIcon, int iOverlay);
LPARAM TreeList_GetData(HTREELISTITEM hItem);
@@ -641,9 +641,9 @@ typedef struct TJabberFormLayoutInfo *HJFORMLAYOUT; void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bCompact = FALSE);
void JabberFormDestroyUI(HWND hwndStatic);
-void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text);
+void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text);
HJFORMLAYOUT JabberFormCreateLayout(HWND hwndStatic); // use mir_free to destroy
-HJFORMCTRL JabberFormAppendControl(HWND hwndStatic, HJFORMLAYOUT layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr);
+HJFORMCTRL JabberFormAppendControl(HWND hwndStatic, HJFORMLAYOUT layout_info, TJabberFormControlType type, const wchar_t *labelStr, const wchar_t *valueStr);
void JabberFormLayoutControls(HWND hwndStatic, HJFORMLAYOUT layout_info, int *formHeight);
HXML JabberFormGetData(HWND hwndStatic, HXML xNode);
@@ -659,7 +659,7 @@ void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon); //---- jabber_libstr.c ----------------------------------------------
-int lstrcmp_null(const TCHAR *s1, const TCHAR *s2);
+int lstrcmp_null(const wchar_t *s1, const wchar_t *s2);
//---- jabber_menu.c ------------------------------------------------
@@ -670,17 +670,17 @@ int g_OnToolbarInit(WPARAM, LPARAM); //---- jabber_misc.c ------------------------------------------------
void JabberChatDllError(void);
-TCHAR* UnEscapeChatTags(TCHAR* str_in);
+wchar_t* UnEscapeChatTags(wchar_t* str_in);
//---- jabber_adhoc.cpp ---------------------------------------------
struct CJabberAdhocStartupParams
{
- TCHAR *m_szJid;
- TCHAR *m_szNode;
+ wchar_t *m_szJid;
+ wchar_t *m_szNode;
CJabberProto *m_pProto;
- CJabberAdhocStartupParams(CJabberProto *proto, TCHAR* szJid, TCHAR* szNode = NULL)
+ CJabberAdhocStartupParams(CJabberProto *proto, wchar_t* szJid, wchar_t* szNode = NULL)
{
m_pProto = proto;
m_szJid = mir_tstrdup(szJid);
@@ -702,7 +702,7 @@ struct JabberAdHocData RECT frameRect;
HXML AdHocNode;
HXML CommandsNode;
- TCHAR *ResponderJID;
+ wchar_t *ResponderJID;
};
//---- jabber_util.cpp ------------------------------------------------------------------
@@ -725,27 +725,27 @@ struct TStringPairs typedef char JabberShaStrBuf[2*MIR_SHA1_HASH_SIZE + 1];
-TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid);
-TCHAR* JabberPrepareJid(LPCTSTR jid);
+wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid);
+wchar_t* JabberPrepareJid(LPCTSTR jid);
void __stdcall JabberUrlDecodeW(WCHAR *str);
char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf);
-TCHAR* __stdcall JabberStrFixLines(const TCHAR *str);
-void __stdcall JabberHttpUrlDecode(TCHAR *str);
+wchar_t* __stdcall JabberStrFixLines(const wchar_t *str);
+void __stdcall JabberHttpUrlDecode(wchar_t *str);
int __stdcall JabberCombineStatus(int status1, int status2);
-TCHAR* __stdcall JabberErrorStr(int errorCode);
-TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int *errorCode = NULL);
-time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp);
-TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen);
+wchar_t* __stdcall JabberErrorStr(int errorCode);
+wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int *errorCode = NULL);
+time_t __stdcall JabberIsoToUnixTime(const wchar_t *stamp);
+wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t destLen);
int __stdcall JabberGetPacketID(HXML n);
-TCHAR* __stdcall JabberId2string(int id);
+wchar_t* __stdcall JabberId2string(int id);
LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf);
-TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen);
-time_t str2time(const TCHAR*);
+wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen);
+time_t str2time(const wchar_t*);
-const TCHAR* JabberStrIStr(const TCHAR *str, const TCHAR *substr);
-void JabberCopyText(HWND hwnd, const TCHAR *text);
+const wchar_t* JabberStrIStr(const wchar_t *str, const wchar_t *substr);
+void JabberCopyText(HWND hwnd, const wchar_t *text);
CJabberProto* JabberChooseInstance(bool bIsLink=false);
bool JabberReadXep203delay(HXML node, time_t &msgTime);
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 0acd463767..b749ea37ee 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -54,7 +54,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////
-static CMraProto* mraProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static CMraProto* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CMraProto *ppro = new CMraProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index 59e2da8242..fd0bd8ecb0 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -12,42 +12,42 @@ struct FieldNames static const FieldNames GenderField[] =
{
- { 1, LPGENT("Male") },
- { 2, LPGENT("Female") },
+ { 1, LPGENW("Male") },
+ { 2, LPGENW("Female") },
{ 0, NULL }
};
static const FieldNames MonthField[] =
{
- { 1, LPGENT("January") },
- { 2, LPGENT("February") },
- { 3, LPGENT("March") },
- { 4, LPGENT("April") },
- { 5, LPGENT("May") },
- { 6, LPGENT("June") },
- { 7, LPGENT("July") },
- { 8, LPGENT("August") },
- { 9, LPGENT("September") },
- { 10, LPGENT("October") },
- { 11, LPGENT("November") },
- { 12, LPGENT("December") },
+ { 1, LPGENW("January") },
+ { 2, LPGENW("February") },
+ { 3, LPGENW("March") },
+ { 4, LPGENW("April") },
+ { 5, LPGENW("May") },
+ { 6, LPGENW("June") },
+ { 7, LPGENW("July") },
+ { 8, LPGENW("August") },
+ { 9, LPGENW("September") },
+ { 10, LPGENW("October") },
+ { 11, LPGENW("November") },
+ { 12, LPGENW("December") },
{ 0, NULL }
};
static const FieldNames ZodiakField[] =
{
- { 1, LPGENT("Aries") },
- { 2, LPGENT("Taurus") },
- { 3, LPGENT("Gemini") },
- { 4, LPGENT("Cancer") },
- { 5, LPGENT("Leo") },
- { 6, LPGENT("Virgo") },
- { 7, LPGENT("Libra") },
- { 8, LPGENT("Scorpio") },
- { 9, LPGENT("Sagittarius") },
- { 10, LPGENT("Capricorn") },
- { 11, LPGENT("Aquarius") },
- { 12, LPGENT("Pisces") },
+ { 1, LPGENW("Aries") },
+ { 2, LPGENW("Taurus") },
+ { 3, LPGENW("Gemini") },
+ { 4, LPGENW("Cancer") },
+ { 5, LPGENW("Leo") },
+ { 6, LPGENW("Virgo") },
+ { 7, LPGENW("Libra") },
+ { 8, LPGENW("Scorpio") },
+ { 9, LPGENW("Sagittarius") },
+ { 10, LPGENW("Capricorn") },
+ { 11, LPGENW("Aquarius") },
+ { 12, LPGENW("Pisces") },
{ 0, NULL }
};
@@ -76,7 +76,7 @@ void InitComboBoxNumders(HWND hWndCombo, DWORD dwStart, DWORD dwEnd) ResetComboBox(hWndCombo);
for (DWORD i = dwStart; i <= dwEnd; i++) {
- TCHAR szBuff[MAX_PATH];
+ wchar_t szBuff[MAX_PATH];
mir_sntprintf(szBuff, L"%lu", i);
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)szBuff);
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
@@ -254,7 +254,7 @@ HWND CMraProto::SearchAdvanced(HWND hWndDlg) {
DWORD dwRequestFlags = 0;
char szUser[MAX_PATH], szDomain[MAX_PATH];
- TCHAR wszNickName[MAX_PATH], wszFirstName[MAX_PATH], wszLastName[MAX_PATH];
+ wchar_t wszNickName[MAX_PATH], wszFirstName[MAX_PATH], wszLastName[MAX_PATH];
size_t dwUserSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_USER, szUser, _countof(szUser));
size_t dwDomainSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_DOMAIN, szDomain, _countof(szDomain));
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 9f42d03f4f..b7f7aac5b2 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -55,7 +55,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = new MRA_AVATARS_QUEUE();
- TCHAR szBuffer[MAX_PATH];
+ wchar_t szBuffer[MAX_PATH];
mir_sntprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections"));
NETLIBUSER nlu = { sizeof(nlu) };
@@ -316,7 +316,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) ai.hContact = pmraaqiAvatarsQueueItem->hContact;
ai.format = dwAvatarFormat;
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- _tcsncpy_s(ai.filename, wszFileName, _TRUNCATE);
+ wcsncpy_s(ai.filename, wszFileName, _TRUNCATE);
else
PathToRelativeT(wszFileName, ai.filename);
@@ -475,7 +475,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD d if (IsContactChatAgent(hContact))
return ERROR_NOT_SUPPORTED;
- TCHAR tszBase[MAX_PATH];
+ wchar_t tszBase[MAX_PATH];
mir_sntprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName);
res = tszBase;
@@ -631,7 +631,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IsDlgButtonChecked(hWndDlg, IDC_USE_KEEPALIVE_CONN));
db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
- TCHAR szServer[MAX_PATH];
+ wchar_t szServer[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_SERVER, szServer, _countof(szServer));
db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
return TRUE;
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index 1b9f89a0c1..ab2eb18dc0 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -40,7 +40,7 @@ static const LPSTR lpcszMailRuDomains[] = #define EMAILS_MIN_COUNT 16 //internal // êîëëè÷åñòâî ýëåìåíòîâ îáÿçàòåëüíî ïðîâåðÿåìûõ ïðè èçâëå÷åíèè email àäðåñà èç èíôû þçåðà
#define PHONES_MIN_COUNT 4 //internal // êîëëè÷åñòâî ýëåìåíòîâ îáÿçàòåëüíî ïðîâåðÿåìûõ ïðè èçâëå÷åíèè email àäðåñà èç èíôû þçåðà
-#define MRA_ALARM_MESSAGE LPGENT("Your contact wakes you")
+#define MRA_ALARM_MESSAGE LPGENW("Your contact wakes you")
#define MRA_GOTO_INBOX "/GotoInbox"
#define MRA_GOTO_INBOX_STR LPGEN("Display &Inbox")
@@ -157,7 +157,7 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_DEFAULT_SLOW_SEND TRUE
#define MRA_DEFAULT_CVT_SMILES_TO_TAGS TRUE
#define MRA_DEFAULT_MIRVER_RAW FALSE // hidden option
-#define MRA_DEFAULT_AUTH_MESSAGE LPGEN("Please authorize me")
+#define MRA_DEFAULT_AUTH_MESSAGE LPGENW("Please authorize me")
#define MRA_DEFAULT_RTF_RECEIVE_ENABLE FALSE
#define MRA_DEFAULT_RTF_SEND_ENABLE TRUE
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 2b860467f0..bcb9aead3c 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -661,7 +661,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT p.dwNameLen = mir_tstrlen(p.lpwszName);
p.dwSize = _wtoi(wszCurrSize);
dat->dwFilesTotalSize += p.dwSize;
- dwFileNameTotalSize += p.dwNameLen * sizeof(TCHAR);
+ dwFileNameTotalSize += p.dwNameLen * sizeof(wchar_t);
dat->dwFilesCount++;
}
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 8faf3d38a1..8b2c83a35d 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -74,7 +74,7 @@ void IconsLoad() void InitXStatusIcons()
{
// load libs
- TCHAR szBuff[MAX_FILEPATH];
+ wchar_t szBuff[MAX_FILEPATH];
if (GetModuleFileName(NULL, szBuff, _countof(szBuff))) {
LPWSTR lpwszFileName;
g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
@@ -89,7 +89,7 @@ void InitXStatusIcons() g_hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
if (g_hDLLXStatusIcons) {
dwBuffLen = LoadString(g_hDLLXStatusIcons, IDS_IDENTIFY, szBuff, MAX_FILEPATH);
- if (dwBuffLen == 0 || _tcsnicmp(L"# Custom Status Icons #", szBuff, 23)) {
+ if (dwBuffLen == 0 || wcsnicmp(L"# Custom Status Icons #", szBuff, 23)) {
FreeLibrary(g_hDLLXStatusIcons);
g_hDLLXStatusIcons = NULL;
}
@@ -101,8 +101,8 @@ void InitXStatusIcons() GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
SKINICONDESC sid = { 0 };
- sid.section.t = LPGENT("Protocols")L"/" LPGENT("MRA") L"/" LPGENT("Custom Status");
- sid.defaultFile.t = szBuff;
+ sid.section.w = LPGENW("Protocols")L"/" LPGENW("MRA") L"/" LPGENW("Custom Status");
+ sid.defaultFile.w = szBuff;
sid.flags = SIDF_ALL_TCHAR;
hXStatusAdvancedStatusIcons[0] = NULL;
@@ -112,7 +112,7 @@ void InitXStatusIcons() sid.pszName = szIconName;
int iCurIndex = i+IDI_XSTATUS1-1;
- sid.description.t = (TCHAR*)lpcszXStatusNameDef[i];
+ sid.description.w = (wchar_t*)lpcszXStatusNameDef[i];
sid.iDefaultIndex = -iCurIndex;
hXStatusAdvancedStatusIcons[i] = IcoLib_AddIcon(&sid);
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 48eb22e5bc..bad3861365 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -4,13 +4,13 @@ #define POPUPS_TYPES_COUNT 7
static LPCWSTR lpcwszPopupsTypes[] =
{
- LPGENT("None"),
- LPGENT("Debug"),
- LPGENT("Information"),
- LPGENT("Question"),
- LPGENT("Warning"),
- LPGENT("Error"),
- LPGENT("NewMail"),
+ LPGENW("None"),
+ LPGENW("Debug"),
+ LPGENW("Information"),
+ LPGENW("Question"),
+ LPGENW("Warning"),
+ LPGENW("Error"),
+ LPGENW("NewMail"),
NULL
};
@@ -131,8 +131,8 @@ int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM) odp.position = 100000000;
odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Popups");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Popups");
odp.groupPosition = 900000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = MraPopupDlgProcOpts;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 5422fd32f8..ac34d5dfd1 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -7,7 +7,7 @@ static int MraExtraIconsApplyAll(WPARAM, LPARAM) return 0;
}
-CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
+CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) :
PROTO<CMraProto>(_module, _displayName),
m_bLoggedIn(false),
m_groups(5, NumericKeySortT)
@@ -35,7 +35,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : if (ServiceExists(MS_NUDGE_SEND))
m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
- TCHAR name[MAX_PATH];
+ wchar_t name[MAX_PATH];
mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
@@ -155,7 +155,7 @@ MCONTACT CMraProto::AddToList(int flags, PROTOSEARCHRESULT *psr) if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
return 0;
- return AddToListByEmail(psr->email.t, psr->nick.t, psr->firstName.t, psr->lastName.t, flags);
+ return AddToListByEmail(psr->email.w, psr->nick.w, psr->firstName.w, psr->lastName.w, flags);
}
MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent)
@@ -200,7 +200,7 @@ int CMraProto::Authorize(MEVENT hDBEvent) return 0;
}
-int CMraProto::AuthDeny(MEVENT hDBEvent, const TCHAR* szReason)
+int CMraProto::AuthDeny(MEVENT hDBEvent, const wchar_t* szReason)
{
if (!m_bLoggedIn) return 1;
@@ -230,7 +230,7 @@ int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) /////////////////////////////////////////////////////////////////////////////////////////
-HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath)
+HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *szPath)
{
if (szPath != NULL)
if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
@@ -249,7 +249,7 @@ int CMraProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) return 1;
}
-int CMraProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR*)
+int CMraProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t*)
{
return FileCancel(hContact, hTransfer);
}
@@ -300,12 +300,12 @@ int CMraProto::GetInfo(MCONTACT hContact, int) /////////////////////////////////////////////////////////////////////////////////////////
-HANDLE CMraProto::SearchBasic(const TCHAR *id)
+HANDLE CMraProto::SearchBasic(const wchar_t *id)
{
return SearchByEmail(id);
}
-HANDLE CMraProto::SearchByEmail(const TCHAR *email)
+HANDLE CMraProto::SearchByEmail(const wchar_t *email)
{
if (m_bLoggedIn && email) {
CMStringA szEmail(email);
@@ -315,7 +315,7 @@ HANDLE CMraProto::SearchByEmail(const TCHAR *email) return NULL;
}
-HANDLE CMraProto::SearchByName(const TCHAR *pszNick, const TCHAR *pszFirstName, const TCHAR *pszLastName)
+HANDLE CMraProto::SearchByName(const wchar_t *pszNick, const wchar_t *pszFirstName, const wchar_t *pszLastName)
{
if (m_bLoggedIn && (*pszNick || *pszFirstName || *pszLastName)) {
DWORD dwRequestFlags = 0;
@@ -371,7 +371,7 @@ int CMraProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hCo return iRet;
}
-HANDLE CMraProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles)
+HANDLE CMraProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles)
{
if (!m_bLoggedIn || !hContact || !ppszFiles)
return NULL;
@@ -517,7 +517,7 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) if (!m_bLoggedIn || !hContact)
return 0;
- TCHAR szStatusDesc[MICBLOG_STATUS_MAX + MICBLOG_STATUS_MAX + MAX_PATH], szTime[64];
+ wchar_t szStatusDesc[MICBLOG_STATUS_MAX + MICBLOG_STATUS_MAX + MAX_PATH], szTime[64];
DWORD dwTime;
int iRet = 0;
@@ -537,7 +537,7 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)iRet;
}
-int CMraProto::SetAwayMsg(int iStatus, const TCHAR *msg)
+int CMraProto::SetAwayMsg(int iStatus, const wchar_t *msg)
{
if (!m_bLoggedIn)
return 1;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 1ce195d477..8ea6b37f14 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -31,7 +31,7 @@ struct MraGroupItem struct CMraProto : public PROTO<CMraProto>
{
- CMraProto(const char*, const TCHAR*);
+ CMraProto(const char*, const wchar_t*);
~CMraProto();
// ====================================================================================
@@ -42,33 +42,33 @@ struct CMraProto : public PROTO<CMraProto> virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDBEvent);
- virtual int __cdecl AuthDeny(MEVENT hDBEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDBEvent, const wchar_t* szReason);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR* email);
- virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t* email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index ebeb34d92d..3f863a1ed5 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -648,7 +648,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & CMStringA szEmail;
MCONTACT hContact = NULL;
- TCHAR szMailBoxStatus[MAX_SECONDLINE];
+ wchar_t szMailBoxStatus[MAX_SECONDLINE];
mir_sntprintf(szMailBoxStatus, TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
@@ -658,7 +658,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & mir_sntprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
- else _tcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
+ else wcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
if (bTrayIconNewMailNotify) {
char szServiceFunction[MAX_PATH] = { 0 }, *pszServiceFunctionName;
@@ -870,11 +870,11 @@ bool CMraProto::GetContactFirstEMail(MCONTACT hContact, BOOL bMRAOnly, CMStringA void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode)
{
- TCHAR szErrorText[2048], szErrDescription[1024];
+ wchar_t szErrorText[2048], szErrDescription[1024];
size_t dwErrDescriptionSize;
if (dwErrorCode == NO_ERROR)
- _tcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE);
+ wcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE);
else {
dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
@@ -1019,7 +1019,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP case WM_TIMER:
if (dat->dwCountdown != -1) {
- TCHAR szBuff[MAX_PATH];
+ wchar_t szBuff[MAX_PATH];
mir_sntprintf(szBuff, TranslateT("Closing in %ld"), dat->dwCountdown--);
SetDlgItemText(hWndDlg, IDOK, szBuff);
break;
@@ -1046,7 +1046,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP SetWindowLongPtr(hWndDlg, GWLP_USERDATA, 0);
if (dat) { // set our xStatus
- TCHAR szBuff[STATUS_TITLE_MAX + STATUS_DESC_MAX];
+ wchar_t szBuff[STATUS_TITLE_MAX + STATUS_DESC_MAX];
DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, (STATUS_DESC_MAX + 1));
char szValueName[MAX_PATH];
@@ -1145,7 +1145,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w {
DWORD dwFlags;
DWORDLONG dwBlogStatusID;
- TCHAR szBuff[MICBLOG_STATUS_MAX];
+ wchar_t szBuff[MICBLOG_STATUS_MAX];
GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, _countof(szBuff));
@@ -1172,7 +1172,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w case IDC_MSG_TO_SEND:
if (HIWORD(wParam) == EN_CHANGE) {
- TCHAR tszBuff[MAX_PATH];
+ wchar_t tszBuff[MAX_PATH];
size_t dwMessageSize = GetWindowTextLength(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND));
EnableWindow(GetDlgItem(hWndDlg, IDOK), (int)dwMessageSize);
@@ -1232,7 +1232,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD DWORD dwRetErrorCode;
if (lpszFolder && dwFolderLen && lpszFileName && dwFileNameLen) {
- TCHAR szPath[32768];
+ wchar_t szPath[32768];
DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
RECURSION_DATA_STACK_ITEM *prdsiItems;
@@ -1434,15 +1434,15 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac }
static const LPTSTR lpszXMLTags[] = { L"'", L""", L"&", L"<", L">" };
-static const size_t dwXMLTagsCount[] = { (6 * sizeof(TCHAR)), (6 * sizeof(TCHAR)), (5 * sizeof(TCHAR)), (4 * sizeof(TCHAR)), (4 * sizeof(TCHAR)) };
+static const size_t dwXMLTagsCount[] = { (6 * sizeof(wchar_t)), (6 * sizeof(wchar_t)), (5 * sizeof(wchar_t)), (4 * sizeof(wchar_t)), (4 * sizeof(wchar_t)) };
static const LPTSTR lpszXMLSymbols[] = { L"\'", L"\"", L"&", L"<", L">" };
-static const size_t dwXMLSymbolsCount[] = { sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR) };
+static const size_t dwXMLSymbolsCount[] = { sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t) };
//Decode XML coded string. The function translate special xml code into standard characters.
CMStringW DecodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(wchar_t), _countof(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
return ret;
}
@@ -1450,6 +1450,6 @@ CMStringW DecodeXML(const CMStringW &lptszMessage) CMStringW EncodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(wchar_t), _countof(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
return ret;
}
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 902f9eac07..a0ac316017 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -76,7 +76,7 @@ INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM) CMStringW wszAuthMessage;
if (!mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
- wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
+ wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
if (wszAuthMessage.IsEmpty())
return 1;
@@ -281,12 +281,12 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) HGENMENU hRoot;
{
- TCHAR szItem[MAX_PATH + 64];
+ wchar_t szItem[MAX_PATH + 64];
mir_sntprintf(szItem, L"%s Custom Status", m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
- mi.name.t = szItem;
+ mi.name.w = szItem;
mi.position = 10001;
hRoot = Menu_AddStatusMenuItem(&mi, m_szModuleName);
}
@@ -308,14 +308,14 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) if (i) {
mir_snprintf(szValueName, "XStatus%ldName", i);
if (mraGetStringW(NULL, szValueName, szStatusTitle))
- mi.name.t = (TCHAR*)szStatusTitle.c_str();
+ mi.name.w = (wchar_t*)szStatusTitle.c_str();
else
- mi.name.t = (TCHAR*)lpcszXStatusNameDef[i];
+ mi.name.w = (wchar_t*)lpcszXStatusNameDef[i];
mi.hIcolibItem = hXStatusAdvancedStatusIcons[i];
}
else {
- mi.name.t = (TCHAR*)lpcszXStatusNameDef[i];
+ mi.name.w = (wchar_t*)lpcszXStatusNameDef[i];
mi.hIcolibItem = NULL;
}
hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi, m_szModuleName);
@@ -340,7 +340,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI hRootMenu = Menu_GetProtocolRoot(this);
if (hRootMenu == NULL) {
- mi.name.t = m_tszUserName;
+ mi.name.w = m_tszUserName;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.hIcolibItem = g_hMainIcon;
hRootMenu = Menu_AddProtoMenuItem(&mi);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index abf966c43f..6247ef9249 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -36,7 +36,7 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- TCHAR szBuff[MAX_EMAIL_LEN];
+ wchar_t szBuff[MAX_EMAIL_LEN];
GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->setTString(NULL, "e-mail", szBuff);
@@ -86,7 +86,7 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- TCHAR szBuff[MAX_EMAIL_LEN];
+ wchar_t szBuff[MAX_EMAIL_LEN];
GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "e-mail", szBuff);
@@ -186,7 +186,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- TCHAR szBuff[MAX_PATH];
+ wchar_t szBuff[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "Server", szBuff);
ppro->setWord("ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
@@ -216,26 +216,26 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { 0 };
odp.dwInitParam = (LPARAM)this;
odp.hInstance = g_hInstance;
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ACCOUNT);
odp.pfnDlgProc = DlgProcOptsAccount;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Connections");
+ odp.pwszTab = LPGENW("Connections");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONNECTIONS);
odp.pfnDlgProc = DlgProcOptsConnections;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Files");
+ odp.pwszTab = LPGENW("Files");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILES);
odp.pfnDlgProc = MraFilesQueueDlgProcOpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Avatars");
+ odp.pwszTab = LPGENW("Avatars");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AVATRS);
odp.pfnDlgProc = MraAvatarsQueueDlgProcOpts;
Options_AddPage(wParam, &odp);
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 133101acee..283726a3d2 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -502,12 +502,12 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf) }
else if (szString == "micblog.status.id") {
buf >> szStringW;
- DWORDLONG dwBlogStatusID = _ttoi64(szStringW);
+ DWORDLONG dwBlogStatusID = _wtoi64(szStringW);
mraWriteContactSettingBlob(NULL, DBSETTING_BLOGSTATUSID, &dwBlogStatusID, sizeof(DWORDLONG));
}
else if (szString == "micblog.status.time") {
buf >> szStringW;
- setDword(DBSETTING_BLOGSTATUSTIME, _ttoi(szStringW));
+ setDword(DBSETTING_BLOGSTATUSTIME, _wtoi(szStringW));
}
else if (szString == "micblog.status.text") {
buf >> szStringW;
@@ -652,7 +652,7 @@ bool CMraProto::CmdFileTransferAck(BinBuffer &buf) MraFilesQueueSendMirror(hFilesQueueHandle, dwTemp, szString);
break;
default:// ## unknown error
- TCHAR szBuff[1024];
+ wchar_t szBuff[1024];
mir_sntprintf(szBuff, TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
ShowFormattedErrorMessage(szBuff, NO_ERROR);
break;
@@ -749,7 +749,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) ShowFormattedErrorMessage(L"Group limit is 20", NO_ERROR);
break;
default:// ## unknown error
- TCHAR szBuff[1024];
+ wchar_t szBuff[1024];
mir_sntprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
@@ -941,7 +941,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) }
}
else if (dwAckType == ACKTYPE_SEARCH) {
- TCHAR szNick[MAX_EMAIL_LEN] = { 0 },
+ wchar_t szNick[MAX_EMAIL_LEN] = { 0 },
szFirstName[MAX_EMAIL_LEN] = { 0 },
szLastName[MAX_EMAIL_LEN] = { 0 },
szEmail[MAX_EMAIL_LEN] = { 0 };
@@ -950,11 +950,11 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) psr.cbSize = sizeof(psr);
psr.flags = PSR_UNICODE;
- psr.nick.t = szNick;
- psr.firstName.t = szFirstName;
- psr.lastName.t = szLastName;
- psr.email.t = szEmail;
- psr.id.t = szEmail;
+ psr.nick.w = szNick;
+ psr.firstName.w = szFirstName;
+ psr.lastName.w = szLastName;
+ psr.email.w = szEmail;
+ psr.id.w = szEmail;
for (DWORD i = 0; i < dwFieldsNum; i++) {
CMStringA &fld = pmralpsFields[i];
@@ -1043,7 +1043,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) case GAME_MESSAGES_NUMBER:
break;
default:
- TCHAR szBuff[1024];
+ wchar_t szBuff[1024];
mir_sntprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
@@ -1307,7 +1307,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) CMStringW wszAuthMessage, nick;
if (mraGetStringW(NULL, "AuthMessage", wszAuthMessage) == FALSE) // def auth message
- wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
+ wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &email, NULL, NULL) == NO_ERROR)
@@ -1350,7 +1350,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) else if (dwTemp == GET_CONTACTS_INTERR) // ïðîèçîøëà âíóòðåííÿÿ îøèáêà
ShowFormattedErrorMessage(L"MRIM_CS_CONTACT_LIST2: internal server error", NO_ERROR);
else {
- TCHAR szBuff[1024];
+ wchar_t szBuff[1024];
mir_sntprintf(szBuff, TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index d5477896e7..b5902ed4ae 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -66,56 +66,56 @@ LPCSTR lpcszStatusUri[] = LPCWSTR lpcszXStatusNameDef[] =
{
- LPGENT("None"),
- LPGENT("Sick"),
- LPGENT("Home"),
- LPGENT("Eating"),
- LPGENT("Compass"),
- LPGENT("On WC"),
- LPGENT("Cooking"),
- LPGENT("Walking"),
- LPGENT("Alien"),
- LPGENT("Shrimp"),
- LPGENT("Got lost"),
- LPGENT("Crazy"),
- LPGENT("Duck"),
- LPGENT("Playing"),
- LPGENT("Smoking"),
- LPGENT("Office"),
- LPGENT("Meeting"),
- LPGENT("Beer"),
- LPGENT("Coffee"),
- LPGENT("Working"),
- LPGENT("Relaxing"),
- LPGENT("On the phone"),
- LPGENT("In institute"),
- LPGENT("At school"),
- LPGENT("Wrong number"),
- LPGENT("Laughing"),
- LPGENT("Malicious"),
- LPGENT("Imp"),
- LPGENT("Blind"),
- LPGENT("Disappointed"),
- LPGENT("Almost crying"),
- LPGENT("Fearful"),
- LPGENT("Angry"),
- LPGENT("Vampire"),
- LPGENT("Ass"),
- LPGENT("Love"),
- LPGENT("Sleeping"),
- LPGENT("Cool!"),
- LPGENT("Peace!"),
- LPGENT("Cock a snook"),
- LPGENT("Get out"),
- LPGENT("Death"),
- LPGENT("Rocket"),
- LPGENT("Devil-fish"),
- LPGENT("Heavy metal"),
- LPGENT("Things look bad"),
- LPGENT("Squirrel"),
- LPGENT("Star"),
- LPGENT("Music"),
- LPGENT("Dating"),
+ LPGENW("None"),
+ LPGENW("Sick"),
+ LPGENW("Home"),
+ LPGENW("Eating"),
+ LPGENW("Compass"),
+ LPGENW("On WC"),
+ LPGENW("Cooking"),
+ LPGENW("Walking"),
+ LPGENW("Alien"),
+ LPGENW("Shrimp"),
+ LPGENW("Got lost"),
+ LPGENW("Crazy"),
+ LPGENW("Duck"),
+ LPGENW("Playing"),
+ LPGENW("Smoking"),
+ LPGENW("Office"),
+ LPGENW("Meeting"),
+ LPGENW("Beer"),
+ LPGENW("Coffee"),
+ LPGENW("Working"),
+ LPGENW("Relaxing"),
+ LPGENW("On the phone"),
+ LPGENW("In institute"),
+ LPGENW("At school"),
+ LPGENW("Wrong number"),
+ LPGENW("Laughing"),
+ LPGENW("Malicious"),
+ LPGENW("Imp"),
+ LPGENW("Blind"),
+ LPGENW("Disappointed"),
+ LPGENW("Almost crying"),
+ LPGENW("Fearful"),
+ LPGENW("Angry"),
+ LPGENW("Vampire"),
+ LPGENW("Ass"),
+ LPGENW("Love"),
+ LPGENW("Sleeping"),
+ LPGENW("Cool!"),
+ LPGENW("Peace!"),
+ LPGENW("Cock a snook"),
+ LPGENW("Get out"),
+ LPGENW("Death"),
+ LPGENW("Rocket"),
+ LPGENW("Devil-fish"),
+ LPGENW("Heavy metal"),
+ LPGENW("Things look bad"),
+ LPGENW("Squirrel"),
+ LPGENW("Star"),
+ LPGENW("Music"),
+ LPGENW("Dating"),
NULL
};
@@ -247,7 +247,7 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) {
CMStringW wszAuthMessage;
if (!mraGetStringW(NULL, "AuthMessage", wszAuthMessage))
- wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
+ wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
db_unset(hContact, "CList", "Hidden");
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index ae71843bd2..2f217da0b5 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -86,7 +86,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0;
}
-static CMsnProto* msnProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static CMsnProto* msnProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 27a002ceba..aa1bb8e95c 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -358,7 +358,7 @@ int CMsnProto::MSN_GetPassportAuth(void) time_t ts = time(NULL);
- TCHAR szTs1[64], szTs2[64];
+ wchar_t szTs1[64], szTs2[64];
TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, L"I", szTs1, _countof(szTs1), 0);
TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, L"I", szTs2, _countof(szTs2), 0);
@@ -969,7 +969,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam) HWND hWnd;
MSG msg;
WNDCLASSEX wc={0};
- static const TCHAR *ClassName = L"SkypeLoginWindow";
+ static const wchar_t *ClassName = L"SkypeLoginWindow";
CoInitialize(NULL);
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index bb7121218a..5836baa234 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -71,7 +71,7 @@ LBL_Error: return false;
}
- const TCHAR *szExt;
+ const wchar_t *szExt;
int fmt = ProtoGetBufferFormat(nlhrReply->pData, &szExt);
if (fmt == PA_FORMAT_UNKNOWN)
goto LBL_Error;
@@ -80,9 +80,9 @@ LBL_Error: ai.format = fmt;
ai.hContact = p->hContact;
MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), szExt);
- _tremove(ai.filename);
+ _wremove(ai.filename);
- int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _wopen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId == -1)
goto LBL_Error;
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 9c13070bc1..995404ea9b 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_proto.h"
#include <m_history.h>
-static const TCHAR *m_ptszRoles[] = {
+static const wchar_t *m_ptszRoles[] = {
L"admin",
L"user"
};
@@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p {
char *szNet, *szEmail;
- _tcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
+ wcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
- TCHAR szName[512];
+ wchar_t szName[512];
InterlockedIncrement(&m_chatID);
- if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), _countof(szName));
+ if (*pszTopic) wcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_sntprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
@@ -77,7 +77,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
- mir_free((TCHAR*)gce.ptszUID);
+ mir_free((wchar_t*)gce.ptszUID);
return 0;
}
@@ -143,7 +143,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) }
}
-void CMsnProto::MSN_KillChatSession(const TCHAR* id)
+void CMsnProto::MSN_KillChatSession(const wchar_t* id)
{
GCDEST gcd = { m_szModuleName, id, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -168,7 +168,7 @@ void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) thread->netId, thread->szEmail, _T2A(gch->ptszUID), pszRole);
}
-const TCHAR *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID)
+const wchar_t *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID)
{
if (thread)
for (int j = 0; j < thread->mJoinedContacts.getCount(); j++)
@@ -178,7 +178,7 @@ const TCHAR *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) return NULL;
}
-void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID)
+void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID)
{
if (!mir_strcmp(xmli->name, "topicupdate")) {
ezxml_t initiator = ezxml_child(xmli, "initiator");
@@ -191,8 +191,8 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID) gce.ptszNick = GetContactNameT(hContInitiator);
gce.ptszText = mir_a2t(ezxml_txt(ezxml_child(xmli, "value")));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- mir_free((TCHAR*)gce.ptszUID);
- mir_free((TCHAR*)gce.ptszText);
+ mir_free((wchar_t*)gce.ptszUID);
+ mir_free((wchar_t*)gce.ptszText);
}
else if (ezxml_t target = ezxml_child(xmli, "target")) {
MCONTACT hContInitiator = NULL;
@@ -248,7 +248,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID) MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
gce.ptszNick = GetContactNameT(hContTarget);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- mir_free((TCHAR*)gce.ptszUID);
+ mir_free((wchar_t*)gce.ptszUID);
if ((gcd.iType == GC_EVENT_PART || gcd.iType == GC_EVENT_KICK) && gce.bIsMe) {
GCDEST gcd2 = { m_szModuleName, mChatID, GC_EVENT_CONTROL };
GCEVENT gce2 = { sizeof(gce2), &gcd2 };
@@ -282,7 +282,7 @@ void CMsnProto::MSN_GCRefreshThreadsInfo(void) msnNsThread->sendPacketPayload("GET", "MSGR\\THREADS", "<threads>%s</threads>", buf);
}
-void CMsnProto::MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody)
+void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody)
{
GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -292,7 +292,7 @@ void CMsnProto::MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, gce.time = ts;
gce.bIsMe = sentMsg;
- TCHAR* p = mir_utf8decodeT(msgBody);
+ wchar_t* p = mir_utf8decodeT(msgBody);
gce.ptszText = EscapeChatTags(p);
mir_free(p);
@@ -330,7 +330,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
if (chk) {
if (IsHContactInfo(hItem)) {
- TCHAR buf[128] = L"";
+ wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
if (buf[0]) str.insert(mir_t2a(buf));
@@ -420,13 +420,13 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) {
case IDC_ADDSCR:
if (param->ppro->msnLoggedIn) {
- TCHAR email[MSN_MAX_EMAIL_LEN];
+ wchar_t email[MSN_MAX_EMAIL_LEN];
GetDlgItemText(hwndDlg, IDC_EDITSCR, email, _countof(email));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
- cii.pszText = _tcslwr(email);
+ cii.pszText = wcslwr(email);
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
@@ -501,7 +501,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) if (gch->ptszText && gch->ptszText[0]) {
GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
if (thread) {
- TCHAR* pszMsg = UnEscapeChatTags(NEWTSTR_ALLOCA(gch->ptszText));
+ wchar_t* pszMsg = UnEscapeChatTags(NEWWSTR_ALLOCA(gch->ptszText));
rtrimt(pszMsg); // remove the ending linebreak
msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0);
@@ -573,7 +573,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break;
case 40:
- const TCHAR *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
+ const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, L"admin")) ? "user" : "admin");
break;
}
@@ -592,8 +592,8 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (gcmi->Type == MENU_ON_LOG) {
static const struct gc_item Items[] =
{
- { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
- { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
+ { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE },
+ { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
@@ -603,10 +603,10 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (!_stricmp(GetMyUsername(NETID_SKYPE), email)) {
static const struct gc_item Items[] =
{
- { LPGENT("User &details"), 10, MENU_ITEM, FALSE },
- { LPGENT("User &history"), 20, MENU_ITEM, FALSE },
+ { LPGENW("User &details"), 10, MENU_ITEM, FALSE },
+ { LPGENW("User &history"), 20, MENU_ITEM, FALSE },
{ L"", 100, MENU_SEPARATOR, FALSE },
- { LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
+ { LPGENW("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
@@ -614,10 +614,10 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) else {
static struct gc_item Items[] =
{
- { LPGENT("User &details"), 10, MENU_ITEM, FALSE },
- { LPGENT("User &history"), 20, MENU_ITEM, FALSE },
- { LPGENT("&Kick user") , 30, MENU_ITEM, FALSE },
- { LPGENT("&Op user") , 40, MENU_ITEM, FALSE }
+ { LPGENW("User &details"), 10, MENU_ITEM, FALSE },
+ { LPGENW("User &history"), 20, MENU_ITEM, FALSE },
+ { LPGENW("&Kick user") , 30, MENU_ITEM, FALSE },
+ { LPGENW("&Op user") , 40, MENU_ITEM, FALSE }
};
GCThreadData* thread = MSN_GetThreadByChatId(gcmi->pszID);
if (thread && thread->mMe && mir_tstrcmpi(thread->mMe->role, L"admin")) {
@@ -625,9 +625,9 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) Items[3].bDisabled = TRUE;
}
else {
- const TCHAR *pszRole = MSN_GCGetRole(thread, email);
+ const wchar_t *pszRole = MSN_GCGetRole(thread, email);
if (pszRole && !mir_tstrcmpi(pszRole, L"admin"))
- Items[3].pszDesc = LPGENT("&Deop user");
+ Items[3].pszDesc = LPGENW("&Deop user");
}
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index c2a02ae5c1..b38a1c2680 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -125,7 +125,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para int msgBytes;
char *nick = NULL, *email = NULL;
- TCHAR *mChatID = NULL;
+ wchar_t *mChatID = NULL;
bool ubmMsg = strncmp(cmdString, "UBM", 3) == 0;
bool sdgMsg = strncmp(cmdString, "SDG", 3) == 0;
bool nfyMsg = strncmp(cmdString, "NFY", 3) == 0;
@@ -182,7 +182,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para msgBody = tHeader.readFromBuffer(msgBody);
if (!(email = NEWSTR_ALLOCA(tHeader["From"]))) return;
mChatID = mir_a2t(tHeader["To"]);
- if (_tcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD
+ if (wcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD
msgBody = tHeader.readFromBuffer(msgBody);
msgBody = tHeader.readFromBuffer(msgBody);
nick = NEWSTR_ALLOCA(tHeader["IM-Display-Name"]);
@@ -274,7 +274,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para psr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
psr[cnt]->cbSize = sizeof(psr);
psr[cnt]->flags = PSR_TCHAR;
- psr[cnt]->id.t = psr[cnt]->nick.t = psr[cnt]->email.t = mir_a2t(wlid);
+ psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2t(wlid);
cnt++;
}
}
@@ -286,7 +286,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para pre.lParam = cnt;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
for (cnt=0; cnt<pre.lParam; cnt++) {
- mir_free(psr[cnt]->email.t);
+ mir_free(psr[cnt]->email.w);
mir_free(psr[cnt]);
}
}
@@ -519,18 +519,18 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) ft->szInvcookie = (char*)mir_calloc(strlen(uri)+16);
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
- TCHAR tComment[40];
+ wchar_t tComment[40];
mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
- pre.files.t = &ft->std.tszCurrentFile;
+ pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
+ pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- if (desc) mir_free(pre.descr.t);
+ if (desc) mir_free(pre.descr.w);
} else uri=NULL;
}
@@ -574,9 +574,9 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = szEmailT;
- psr.nick.t = szEmailT;
- psr.email.t = szEmailT;
+ psr.id.w = szEmailT;
+ psr.nick.w = szEmailT;
+ psr.email.w = szEmailT;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, msnSearchId, (LPARAM)&psr);
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, msnSearchId, 0);
@@ -808,7 +808,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) char *format = mir_strdup(parts[3]);
char *unknown = NULL;
if (ServiceExists(MS_LISTENINGTO_GETUNKNOWNTEXT))
- unknown = mir_utf8encodeT((TCHAR *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
+ unknown = mir_utf8encodeT((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
for (unsigned i = 4; i < pCount; i++) {
char part[16];
@@ -848,7 +848,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) if (pCount > 12) lti.ptszType = mir_utf8decodeT(parts[12]);
else lti.ptszType = mir_utf8decodeT(parts[1]);
- TCHAR *cm = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
+ wchar_t *cm = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
setTString(hContact, "ListeningTo", cm);
mir_free(cm);
@@ -898,7 +898,7 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) SkinPlaySound(alertsoundname);
- TCHAR* alrt = mir_utf8decodeT(ezxml_txt(xmltxt));
+ wchar_t* alrt = mir_utf8decodeT(ezxml_txt(xmltxt));
MSN_ShowPopup(TranslateT("MSN Alert"), alrt, MSN_ALERT_POPUP | MSN_ALLOW_MSGBOX, fullurl);
mir_free(alrt);
}
@@ -1469,15 +1469,15 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ft->szInvcookie = mir_strdup(Invcookie);
ft->p2p_dest = mir_strdup(email);
- TCHAR tComment[40];
+ wchar_t tComment[40];
mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = tComment;
- pre.files.t = &ft->std.tszCurrentFile;
+ pre.descr.w = tComment;
+ pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
@@ -1536,7 +1536,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, // netmeeting receive 1
if (Appname != NULL && !_stricmp(Appname, "NetMeeting")) {
- TCHAR text[512], *tszEmail = mir_a2t(email);
+ wchar_t text[512], *tszEmail = mir_a2t(email);
mir_sntprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail);
mir_free(tszEmail);
@@ -1644,7 +1644,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i ptrA buf(mir_base64_encode((PBYTE)lastsml, (unsigned)slen));
ptrA smileyName(mir_urlEncode(buf));
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
ft->std.tszCurrentFile = mir_tstrdup(path);
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index 2a50f97480..a9f220575f 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -57,7 +57,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft) if (isOffline) return;
if (thread != NULL) thread->mMsnFtp = ft;
- TCHAR* pszFiles = _tcsrchr(ft->std.ptszFiles[0], '\\');
+ wchar_t* pszFiles = wcsrchr(ft->std.ptszFiles[0], '\\');
if (pszFiles)
pszFiles++;
else
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 3ce9e5a841..9e0cd37318 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-static TCHAR* a2tf(const TCHAR* str, bool unicode)
+static wchar_t* a2tf(const wchar_t* str, bool unicode)
{
if (str == NULL)
return NULL;
@@ -30,7 +30,7 @@ static TCHAR* a2tf(const TCHAR* str, bool unicode) return unicode ? mir_tstrdup(str) : mir_a2t((char*)str);
}
-void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def)
+void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def)
{
mir_free(dest);
dest = NULL;
@@ -298,21 +298,21 @@ void stripHTML(char* str) // Process a string, and double all % characters, according to chat.dll's restrictions
// Returns a pointer to the new string (old one is not freed)
-TCHAR* EscapeChatTags(const TCHAR* pszText)
+wchar_t* EscapeChatTags(const wchar_t* pszText)
{
int nChars = 0;
- for (const TCHAR* p = pszText; (p = _tcschr(p, '%')) != NULL; p++)
+ for (const wchar_t* p = pszText; (p = wcschr(p, '%')) != NULL; p++)
nChars++;
if (nChars == 0)
return mir_tstrdup(pszText);
- TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(pszText) + 1 + nChars));
+ wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(pszText) + 1 + nChars));
if (pszNewText == NULL)
return mir_tstrdup(pszText);
- const TCHAR *s = pszText;
- TCHAR *d = pszNewText;
+ const wchar_t *s = pszText;
+ wchar_t *d = pszNewText;
while (*s) {
if (*s == '%')
*d++ = '%';
@@ -322,9 +322,9 @@ TCHAR* EscapeChatTags(const TCHAR* pszText) return pszNewText;
}
-TCHAR* UnEscapeChatTags(TCHAR* str_in)
+wchar_t* UnEscapeChatTags(wchar_t* str_in)
{
- TCHAR *s = str_in, *d = str_in;
+ wchar_t *s = str_in, *d = str_in;
while (*s) {
if ((*s == '%' && s[1] == '%') || (*s == '\n' && s[1] == '\n'))
s++;
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index d047b03213..a46e26e1a6 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -27,14 +27,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static HANDLE hServiceParseLink;
-static MCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
+static MCONTACT GetContact(wchar_t *arg, wchar_t **pemail, CMsnProto *proto)
{
- TCHAR* email = NULL;
+ wchar_t* email = NULL;
do {
- TCHAR *tok = _tcschr(arg, '&'); /* next token */
+ wchar_t *tok = wcschr(arg, '&'); /* next token */
if (tok != NULL) *tok++ = '\0';
- if (_tcsnicmp(arg, L"contact=", 8) == 0) {
+ if (wcsnicmp(arg, L"contact=", 8) == 0) {
arg += 8;
UrlDecode(arg);
email = arg;
@@ -62,15 +62,15 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) {
if (lParam == 0) return 1; /* sanity check */
- TCHAR *arg = (TCHAR*)lParam;
+ wchar_t *arg = (wchar_t*)lParam;
/* skip leading prefix */
- arg = _tcschr(arg, ':');
+ arg = wcschr(arg, ':');
if (arg == NULL) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg) {}
- arg = NEWTSTR_ALLOCA(arg);
+ arg = NEWWSTR_ALLOCA(arg);
if (g_Instances.getCount() == 0) return 0;
@@ -85,10 +85,10 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) /* add a contact to the list */
- if (_tcsnicmp(arg, L"add?", 4) == 0) {
+ if (wcsnicmp(arg, L"add?", 4) == 0) {
arg += 4;
- TCHAR *email;
+ wchar_t *email;
MCONTACT hContact = GetContact(arg, &email, proto);
if (email == NULL) return 1;
@@ -96,8 +96,8 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) if (hContact == NULL) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = email;
- psr.email.t = email;
+ psr.nick.w = email;
+ psr.email.w = email;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
@@ -109,7 +109,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) }
/* send a message to a contact */
/* "voice" and "video" not yet implemented, perform same action as "chat" */
- else if (_tcsnicmp(arg, L"chat?", 5) == 0) {
+ else if (wcsnicmp(arg, L"chat?", 5) == 0) {
arg += 5;
MCONTACT hContact = GetContact(arg, NULL, proto);
@@ -119,7 +119,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) return 0;
}
}
- else if (_tcsnicmp(arg, L"voice?", 6) == 0) {
+ else if (wcsnicmp(arg, L"voice?", 6) == 0) {
arg += 6;
MCONTACT hContact = GetContact(arg, NULL, proto);
@@ -129,7 +129,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) return 0;
}
}
- else if (_tcsnicmp(arg, L"video?", 6) == 0) {
+ else if (wcsnicmp(arg, L"video?", 6) == 0) {
arg += 6;
MCONTACT hContact = GetContact(arg, NULL, proto);
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index be82a1b15e..28126efa5d 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -244,12 +244,12 @@ void CMsnProto::MSN_CleanupLists(void) if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL) {
int count = db_event_count(p.hContact);
if (count) {
- TCHAR text[256];
- TCHAR *sze = mir_a2t(p.email);
+ wchar_t text[256];
+ wchar_t *sze = mir_a2t(p.email);
mir_sntprintf(text, TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
mir_free(sze);
- TCHAR title[128];
+ wchar_t title[128];
mir_sntprintf(title, TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
@@ -266,7 +266,7 @@ void CMsnProto::MSN_CleanupLists(void) }
if (p.list & (LIST_LL | LIST_FL) && p.hContact) {
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
MSN_GetCustomSmileyFileName(p.hContact, path, _countof(path), "", 0);
if (path[0]) {
SMADD_CONT cont;
@@ -369,7 +369,7 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto) for (int i = 0; i < proto->m_arContacts.getCount(); ++i) {
MsnContact &cont = proto->m_arContacts[i];
if (!(cont.list & (LIST_FL | LIST_LL))) {
- cii.pszText = (TCHAR*)cont.email;
+ cii.pszText = (wchar_t*)cont.email;
hItem = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEMA, 0, (LPARAM)&cii);
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (cont.list & LIST_LL) ? 1 : 0));
@@ -461,7 +461,7 @@ static void SaveSettings(MCONTACT hItem, HWND hwndList, CMsnProto* proto) continue;
}
else if (IsHContactInfo(hItem)) {
- TCHAR buf[MSN_MAX_EMAIL_LEN];
+ wchar_t buf[MSN_MAX_EMAIL_LEN];
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
WideCharToMultiByte(CP_ACP, 0, buf, -1, szEmail, sizeof(szEmail), 0, 0);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 364d437356..27cb629258 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -207,8 +207,8 @@ void CMsnProto::processMailData(char* mailData) void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
{
- TCHAR tBuffer[512];
- TCHAR tBuffer2[512];
+ wchar_t tBuffer[512];
+ wchar_t tBuffer2[512];
int UnreadMessages = mUnreadMessages;
int UnreadJunkEmails = mUnreadJunkEmails;
bool ShowPopup = isInitial;
@@ -259,7 +259,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) - TCHAR* msgtxt = _stricmp(From, Fromaddr) ?
+ wchar_t* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
mir_sntprintf(tBuffer, msgtxt, mimeFromW, Fromaddr);
@@ -377,17 +377,17 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) {
if (!emailEnabled || getByte("DisableHotmailCL", 0)) return;
- TCHAR* name = GetContactNameT(hContact);
+ wchar_t* name = GetContactNameT(hContact);
if (name == NULL) return;
- TCHAR* ch = name - 1;
+ wchar_t* ch = name - 1;
do {
- ch = _tcschr(ch + 1, '[');
- } while (ch && !_istdigit(ch[1]));
+ ch = wcschr(ch + 1, '[');
+ } while (ch && !iswdigit(ch[1]));
if (ch) *ch = 0;
rtrimt(name);
- TCHAR szNick[128];
+ wchar_t szNick[128];
mir_sntprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 532242e257..ef12418621 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -119,10 +119,10 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int listId = Lists_GetMask(szEmail);
bool noChat = !(listId & LIST_FL) || isMe || isChatRoom(hContact);
- Menu_ModifyItem(hBlockMenuItem, (listId & LIST_BL) ? LPGENT("&Unblock") : LPGENT("&Block"));
+ Menu_ModifyItem(hBlockMenuItem, (listId & LIST_BL) ? LPGENW("&Unblock") : LPGENW("&Block"));
Menu_ShowItem(hBlockMenuItem, !noChat);
- Menu_ModifyItem(hOpenInboxMenuItem, isMe ? LPGENT("Open &Hotmail Inbox") : LPGENT("Send &Hotmail E-mail"));
+ Menu_ModifyItem(hOpenInboxMenuItem, isMe ? LPGENW("Open &Hotmail Inbox") : LPGENW("Send &Hotmail E-mail"));
Menu_ShowItem(hOpenInboxMenuItem, emailEnabled);
#ifdef OBSOLETE
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam {
CMsnProto *proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (proto->msnLoggedIn) {
- TCHAR str[130];
+ wchar_t str[130];
GetDlgItemText(hwndDlg, IDC_NICKNAME, str, _countof(str));
proto->MSN_SendNickname(str);
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 6d5b581a89..3d76b63cde 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -117,7 +117,7 @@ void CMsnProto::InitCustomFolders(void) {
if (InitCstFldRan) return;
- TCHAR folder[MAX_PATH];
+ wchar_t folder[MAX_PATH];
mir_sntprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
@@ -168,11 +168,11 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) }
// MSN_GetAvatarFileName - gets a file name for an contact's avatar
-void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
+void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext)
{
size_t tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
- if (_taccess(pszDest, 0))
+ if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
size_t tPathLen2 = tPathLen;
@@ -181,7 +181,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t if (getString(hContact, "PictContext", &dbv) == 0) {
char* szAvatarHash = MSN_GetAvatarHash(dbv.pszVal);
if (szAvatarHash != NULL) {
- TCHAR *sztAvatarHash = mir_a2t(szAvatarHash);
+ wchar_t *sztAvatarHash = mir_a2t(szAvatarHash);
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
mir_free(sztAvatarHash);
mir_free(szAvatarHash);
@@ -196,7 +196,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t pszDest[0] = 0;
}
else {
- TCHAR *sztModuleName = mir_a2t(m_szModuleName);
+ wchar_t *sztModuleName = mir_a2t(m_szModuleName);
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName);
mir_free(sztModuleName);
}
@@ -205,15 +205,15 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
bool found = false;
- _tfinddata_t c_file;
- long hFile = _tfindfirst(pszDest, &c_file);
+ _wfinddata_t c_file;
+ long hFile = _wfindfirst(pszDest, &c_file);
if (hFile > -1L) {
do {
- if (_tcsrchr(c_file.name, '.')) {
+ if (wcsrchr(c_file.name, '.')) {
mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
- } while (_tfindnext(hFile, &c_file) == 0);
+ } while (_wfindnext(hFile, &c_file) == 0);
_findclose(hFile);
}
@@ -225,7 +225,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t }
}
-int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen)
+int CMsnProto::MSN_SetMyAvatar(const wchar_t* sztFname, void* pData, size_t cbLen)
{
mir_sha1_ctx sha1ctx;
BYTE sha1c[MIR_SHA1_HASH_SIZE], sha1d[MIR_SHA1_HASH_SIZE];
@@ -278,18 +278,18 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ptrA szEncodedBuffer(mir_urlEncode(szBuffer));
free(szBuffer);
- const TCHAR *szExt;
+ const wchar_t *szExt;
int fmt = ProtoGetBufferFormat(pData, &szExt);
if (fmt == PA_FORMAT_UNKNOWN)
return fmt;
- TCHAR szFileName[MAX_PATH];
+ wchar_t szFileName[MAX_PATH];
MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
- _tremove(szFileName);
+ _wremove(szFileName);
MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt);
- int fileId = _topen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _wopen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
_write(fileId, pData, (unsigned)cbLen);
_close(fileId);
@@ -310,16 +310,16 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) }
// MSN_GetCustomSmileyFileName - gets a file name for an contact's custom smiley
-void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type)
+void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const char* SmileyName, int type)
{
size_t tPathLen;
InitCustomFolders();
- TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR));
+ wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t));
if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
- TCHAR *tmpPath = Utils_ReplaceVarsT(L"%miranda_userdata%");
- TCHAR *tszModuleName = mir_a2t(m_szModuleName);
+ wchar_t *tmpPath = Utils_ReplaceVarsT(L"%miranda_userdata%");
+ wchar_t *tszModuleName = mir_a2t(m_szModuleName);
tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
mir_free(tszModuleName);
mir_free(tmpPath);
@@ -333,20 +333,20 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, s DBVARIANT dbv = { 0 };
if (getTString(hContact, "e-mail", &dbv)) {
dbv.type = DBVT_ASCIIZ;
- dbv.ptszVal = (TCHAR*)mir_alloc(11*sizeof(TCHAR));
- _ui64tot((UINT_PTR)hContact, dbv.ptszVal, 10);
+ dbv.ptszVal = (wchar_t*)mir_alloc(11*sizeof(wchar_t));
+ _ui64tow((UINT_PTR)hContact, dbv.ptszVal, 10);
}
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
db_free(&dbv);
}
else {
- TCHAR *tszModuleName = mir_a2t(m_szModuleName);
+ wchar_t *tszModuleName = mir_a2t(m_szModuleName);
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName);
mir_free(tszModuleName);
}
- bool exist = _taccess(pszDest, 0) == 0;
+ bool exist = _waccess(pszDest, 0) == 0;
if (type == 0) {
if (!exist) pszDest[0] = 0;
@@ -356,7 +356,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, s if (!exist)
CreateDirectoryTreeT(pszDest);
- TCHAR *sztSmileyName = mir_a2t(SmileyName);
+ wchar_t *sztSmileyName = mir_a2t(SmileyName);
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName,
type == MSN_APPID_CUSTOMSMILEY ? L"png" : L"gif");
mir_free(sztSmileyName);
@@ -587,7 +587,7 @@ void CMsnProto::MSN_StartStopTyping(GCThreadData* info, bool start) }
// Helper to process texts
-static char * HtmlEncodeUTF8T(const TCHAR *src)
+static char * HtmlEncodeUTF8T(const wchar_t *src)
{
if (src == NULL)
return mir_strdup("");
@@ -633,7 +633,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*) if (msnCurrentMedia.ptszPlayer != NULL) lti.ptszPlayer = L"{7}";
if (msnCurrentMedia.ptszType != NULL) lti.ptszType = L"{8}";
- TCHAR *tmp = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
+ wchar_t *tmp = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
szFormatEnc = HtmlEncodeUTF8T(tmp);
mir_free(tmp);
}
@@ -788,7 +788,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) if (!getStringUtf("Place", &dbv))
szPlace = dbv.pszVal;
else {
- TCHAR buf[128] = L"Miranda";
+ wchar_t buf[128] = L"Miranda";
DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
szPlace = mir_utf8encodeT(buf);
@@ -915,10 +915,10 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) // MSN_ShowError - shows an error
void CMsnProto::MSN_ShowError(const char* msgtext, ...)
{
- TCHAR tBuffer[4096];
+ wchar_t tBuffer[4096];
va_list tArgs;
- TCHAR *buf = Langpack_PcharToTchar(msgtext);
+ wchar_t *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
@@ -983,7 +983,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara // InitPopups - popup plugin support
void CMsnProto::InitPopups(void)
{
- TCHAR desc[256];
+ wchar_t desc[256];
char name[256];
POPUPCLASS ppc = { sizeof(ppc) };
@@ -1025,7 +1025,7 @@ void CALLBACK sttMainThreadCallback(void *param) bool iserr = (pud->flags & MSN_SHOW_ERROR) != 0;
if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
- TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
+ wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
mir_sntprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
@@ -1044,8 +1044,8 @@ void CALLBACK sttMainThreadCallback(void *param) char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.ptszTitle = pud->title;
- ppd.ptszText = pud->text;
+ ppd.pwszTitle = pud->title;
+ ppd.pwszText = pud->text;
ppd.PluginData = pud;
ppd.pszClassName = name;
@@ -1059,7 +1059,7 @@ void CALLBACK sttMainThreadCallback(void *param) CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
-void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url)
+void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url)
{
if (g_bTerminated) return;
@@ -1074,7 +1074,7 @@ void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags }
-void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags)
+void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const wchar_t* msg, int flags)
{
MSN_ShowPopup(GetContactNameT(hContact), msg, flags, NULL);
}
@@ -1152,7 +1152,7 @@ int filetransfer::create(void) int flags = _O_BINARY | _O_CREAT | _O_WRONLY | _O_APPEND;
if (std.currentFileProgress == 0) flags |= _O_TRUNC;
- fileId = _topen(std.tszCurrentFile, flags, _S_IREAD | _S_IWRITE);
+ fileId = _wopen(std.tszCurrentFile, flags, _S_IREAD | _S_IWRITE);
if (fileId == -1)
proto->MSN_ShowError("Cannot create file '%s' during a file transfer", std.tszCurrentFile);
@@ -1172,7 +1172,7 @@ int filetransfer::openNext(void) while (std.ptszFiles && std.ptszFiles[cf]) {
struct _stati64 statbuf;
- if (_tstati64(std.ptszFiles[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
+ if (_wstat64(std.ptszFiles[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
break;
++cf;
@@ -1181,7 +1181,7 @@ int filetransfer::openNext(void) if (std.ptszFiles && std.ptszFiles[cf]) {
bCompleted = false;
replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]);
- fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
+ fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
if (fileId != -1) {
std.currentFileSize = _filelengthi64(fileId);
std.currentFileProgress = 0;
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index c8a01be35c..30ecdbc16f 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -311,7 +311,7 @@ static bool IsIcfEnabled(void) hr = fwProfile->get_AuthorizedApplications(&fwApps);
if (FAILED(hr)) goto error;
- TCHAR szFileName[MAX_PATH];
+ wchar_t szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, _countof(szFileName));
wszFileName = mir_t2u(szFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 2adbe2c31f..96437c9bef 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -219,7 +219,7 @@ LBL_Continue: case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
bool reconnectRequired = false;
- TCHAR screenStr[MAX_PATH];
+ wchar_t screenStr[MAX_PATH];
char password[100], szEmail[MSN_MAX_EMAIL_LEN];
DBVARIANT dbv;
@@ -567,7 +567,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else proto->setString("Password", password);
- TCHAR szPlace[64];
+ wchar_t szPlace[64];
GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace));
if (szPlace[0])
proto->setTString("Place", szPlace);
@@ -627,25 +627,25 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.position = -790000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN);
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTab = LPGENW("Account");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.pfnDlgProc = DlgProcMsnOpts;
odp.dwInitParam = (LPARAM)this;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Connection");
+ odp.pwszTab = LPGENW("Connection");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN_CONN);
odp.pfnDlgProc = DlgProcMsnConnOpts;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Server list");
+ odp.pwszTab = LPGENW("Server list");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_LISTSMGR);
odp.pfnDlgProc = DlgProcMsnServLists;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Notifications");
+ odp.pwszTab = LPGENW("Notifications");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY);
odp.pfnDlgProc = DlgProcHotmailPopupOpts;
Options_AddPage(wParam, &odp);
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index b130ad25aa..632aede4bc 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -161,7 +161,7 @@ bool p2p_IsDlFileOk(filetransfer* ft) bool res = false;
- int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
+ int fileId = _wopen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
if (fileId != -1) {
BYTE buf[4096];
int bytes;
@@ -201,7 +201,7 @@ void CMsnProto::p2p_pictureTransferFailed(filetransfer* ft) }
break;
}
- _tremove(ft->std.tszCurrentFile);
+ _wremove(ft->std.tszCurrentFile);
}
void CMsnProto::p2p_savePicture2disk(filetransfer* ft)
@@ -209,13 +209,13 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) ft->close();
if (p2p_IsDlFileOk(ft)) {
- int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
+ int fileId = _wopen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
if (fileId == -1) {
p2p_pictureTransferFailed(ft);
return;
}
- const TCHAR* ext;
+ const wchar_t* ext;
int format;
BYTE buf[6];
@@ -237,7 +237,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) ai.hContact = ft->std.hContact;
MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), ext);
- _trename(ft->std.tszCurrentFile, ai.filename);
+ _wrename(ft->std.tszCurrentFile, ai.filename);
// Store also avatar hash
char *szAvatarHash = MSN_GetAvatarHash(ft->p2p_object);
@@ -259,9 +259,9 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) cont.hContact = ft->std.hContact;
cont.type = 1;
- TCHAR* pathcpy = mir_tstrdup(ft->std.tszCurrentFile);
- mir_tstrcpy(_tcsrchr(pathcpy, '.') + 1, ext);
- _trename(ft->std.tszCurrentFile, pathcpy);
+ wchar_t* pathcpy = mir_tstrdup(ft->std.tszCurrentFile);
+ mir_tstrcpy(wcsrchr(pathcpy, '.') + 1, ext);
+ _wrename(ft->std.tszCurrentFile, pathcpy);
cont.path = pathcpy;
@@ -1173,9 +1173,9 @@ void CMsnProto::p2p_InitFileTransfer( db_free(&dbv);
}
if (pictmatch) {
- TCHAR szFileName[MAX_PATH];
+ wchar_t szFileName[MAX_PATH];
MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
- ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
+ ft->fileId = _wopen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
if (ft->fileId == -1) {
p2p_sendStatus(ft, 603);
MSN_ShowError("Your avatar not set correctly. Avatar should be set in View/Change My Details | Avatar");
@@ -1223,15 +1223,15 @@ void CMsnProto::p2p_InitFileTransfer( ft->std.totalBytes = ft->std.currentFileSize = ((HFileContext*)szContext)->dwSize;
ft->std.totalFiles = 1;
- TCHAR tComment[40];
+ wchar_t tComment[40];
mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = tComment;
- pre.files.t = &ft->std.tszCurrentFile;
+ pre.descr.w = tComment;
+ pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
}
@@ -1698,7 +1698,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr break;
ft->close();
- if (!(ft->std.flags & PFTS_SENDING)) _tremove(ft->std.tszCurrentFile);
+ if (!(ft->std.flags & PFTS_SENDING)) _wremove(ft->std.tszCurrentFile);
p2p_unregisterSession(ft);
}
@@ -2024,7 +2024,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) ctx->type = MSN_TYPEID_FTNOPREVIEW;
ctx->dwSize = ft->std.currentFileSize;
- TCHAR* pszFiles = _tcsrchr(ft->std.tszCurrentFile, '\\');
+ wchar_t* pszFiles = wcsrchr(ft->std.tszCurrentFile, '\\');
if (pszFiles)
pszFiles++;
else
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index d7258e5533..624c736f97 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -33,7 +33,7 @@ static int CompareLists(const MsnContact *p1, const MsnContact *p2) return _stricmp(p1->email, p2->email);
}
-CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
+CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) :
PROTO<CMsnProto>(aProtoName, aUserName),
m_arContacts(10, CompareLists),
m_arGroups(10, CompareId),
@@ -125,16 +125,16 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : mailsoundname = (char*)mir_alloc(64);
mir_snprintf(mailsoundname, 64, "%s:Hotmail", m_szModuleName);
- SkinAddNewSoundExT(mailsoundname, m_tszUserName, LPGENT("Live Mail"));
+ SkinAddNewSoundExT(mailsoundname, m_tszUserName, LPGENW("Live Mail"));
alertsoundname = (char*)mir_alloc(64);
mir_snprintf(alertsoundname, 64, "%s:Alerts", m_szModuleName);
- SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENT("Live Alert"));
+ SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENW("Live Alert"));
AvatarQueue_Init();
InitCustomFolders();
- TCHAR szBuffer[MAX_PATH];
+ wchar_t szBuffer[MAX_PATH];
char szDbsettings[64];
NETLIBUSER nlu1 = { 0 };
@@ -261,10 +261,10 @@ MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- TCHAR *id = psr->id.t ? psr->id.t : psr->email.t;
+ wchar_t *id = psr->id.w ? psr->id.w : psr->email.w;
return AddToListByEmail(
psr->flags & PSR_UNICODE ? UTF8((wchar_t*)id) : UTF8((char*)id),
- psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick.t) : UTF8((char*)psr->nick.t),
+ psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick.w) : UTF8((char*)psr->nick.w),
flags);
}
@@ -294,7 +294,7 @@ int CMsnProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) }
// PSS_AUTHREQUEST
-int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
+int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const wchar_t* szMessage)
{
if (msnLoggedIn) {
char email[MSN_MAX_EMAIL_LEN];
@@ -353,7 +353,7 @@ int CMsnProto::Authorize(MEVENT hDbEvent) }
// MsnAuthDeny - called after unsuccessful authorization
-int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)
+int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
if (!msnLoggedIn)
return 1;
@@ -397,7 +397,7 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) // MsnBasicSearch - search contacts by e-mail
void __cdecl CMsnProto::MsnSearchAckThread(void* arg)
{
- const TCHAR* emailT = (TCHAR*)arg;
+ const wchar_t* emailT = (wchar_t*)arg;
T2Utf email(emailT);
if (Lists_IsInList(LIST_FL, email)) {
@@ -418,9 +418,9 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = (TCHAR*)emailT;
- psr.nick.t = (TCHAR*)emailT;
- psr.email.t = (TCHAR*)emailT;
+ psr.id.w = (wchar_t*)emailT;
+ psr.nick.w = (wchar_t*)emailT;
+ psr.email.w = (wchar_t*)emailT;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
@@ -447,17 +447,17 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg) }
-HANDLE __cdecl CMsnProto::SearchBasic(const TCHAR* id)
+HANDLE __cdecl CMsnProto::SearchBasic(const wchar_t* id)
{
if (!msnLoggedIn) return 0;
- TCHAR* email = mir_tstrdup(id);
+ wchar_t* email = mir_tstrdup(id);
ForkThread(&CMsnProto::MsnSearchAckThread, email);
return email;
}
-HANDLE __cdecl CMsnProto::SearchByEmail(const TCHAR* email)
+HANDLE __cdecl CMsnProto::SearchByEmail(const wchar_t* email)
{
return SearchBasic(email);
}
@@ -491,7 +491,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) {
filetransfer* ft = (filetransfer*)arg;
- TCHAR filefull[MAX_PATH];
+ wchar_t filefull[MAX_PATH];
mir_sntprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
replaceStrT(ft->std.tszCurrentFile, filefull);
@@ -574,7 +574,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) }
// MsnFileAllow - starts the file transfer
-HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
filetransfer* ft = (filetransfer*)hTransfer;
@@ -584,7 +584,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szP #endif
if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
- TCHAR szCurrDir[MAX_PATH];
+ wchar_t szCurrDir[MAX_PATH];
GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
}
@@ -633,7 +633,7 @@ int __cdecl CMsnProto::FileCancel(MCONTACT, HANDLE hTransfer) }
// MsnFileDeny - rejects the file transfer request
-int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szReason*/)
+int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t* /*szReason*/)
{
filetransfer* ft = (filetransfer*)hTransfer;
@@ -661,7 +661,7 @@ int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szRea }
// MsnFileResume - renames a file
-int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
filetransfer* ft = (filetransfer*)hTransfer;
@@ -680,7 +680,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s case FILERESUME_RESUME:
{
struct _stati64 statbuf;
- _tstati64(ft->std.tszCurrentFile, &statbuf);
+ _wstat64(ft->std.tszCurrentFile, &statbuf);
ft->std.currentFileProgress = statbuf.st_size;
}
break;
@@ -829,12 +829,12 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) int i;
for (i = 0; i < pre->lParam; i++)
- dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.t) + 2 + mir_tstrlen(isrList[i]->id.t));
+ dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.w) + 2 + mir_tstrlen(isrList[i]->id.w));
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
for (i = 0, pCurBlob = dbei.pBlob; i < pre->lParam; i++) {
- mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.t));
+ mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w));
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.t));
+ mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.w));
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
}
@@ -849,7 +849,7 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) #ifdef OBSOLETE
// MsnSendFile - initiates a file transfer
-HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppszFiles)
+HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
{
if (!msnLoggedIn)
return 0;
@@ -871,7 +871,7 @@ HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz int count = 0;
while (ppszFiles[count] != NULL) {
struct _stati64 statbuf;
- if (_tstati64(ppszFiles[count++], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
+ if (_wstat64(ppszFiles[count++], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
sft->std.totalBytes += statbuf.st_size;
++sft->std.totalFiles;
}
@@ -1046,7 +1046,7 @@ int __cdecl CMsnProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONT }
// MsnSetAwayMsg - sets the current status message for a user
-int __cdecl CMsnProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CMsnProto::SetAwayMsg(int status, const wchar_t* msg)
{
char** msgptr = GetStatusMsgLoc(status);
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 2ea0df8129..6f26bf1c80 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CMsnProto : public PROTO<CMsnProto>
{
- CMsnProto(const char*, const TCHAR*);
+ CMsnProto(const char*, const wchar_t*);
~CMsnProto();
//====================================================================================
@@ -36,26 +36,26 @@ struct CMsnProto : public PROTO<CMsnProto> virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR* email);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t* email);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
#ifdef OBSOLETE
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
#endif
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
@@ -64,7 +64,7 @@ struct CMsnProto : public PROTO<CMsnProto> virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -196,10 +196,10 @@ struct CMsnProto : public PROTO<CMsnProto> void InitCustomFolders(void);
char* getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status);
- bool getMyAvatarFile(char *url, TCHAR *fname);
+ bool getMyAvatarFile(char *url, wchar_t *fname);
void MSN_GoOffline(void);
- void MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type);
+ void MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const char* SmileyName, int Type);
const char* MirandaStatusToMSN(int status);
WORD MSNStatusToMiranda(const char *status);
@@ -233,8 +233,8 @@ struct CMsnProto : public PROTO<CMsnProto> void LoadOptions(void);
void InitPopups(void);
- void MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url);
- void MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags);
+ void MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url);
+ void MSN_ShowPopup(const MCONTACT hContact, const wchar_t* msg, int flags);
void MSN_ShowError(const char* msgtext, ...);
#ifdef OBSOLETE
@@ -242,7 +242,7 @@ struct CMsnProto : public PROTO<CMsnProto> #endif
void MSN_SendNicknameUtf(const char* nickname);
- typedef struct { TCHAR *szName; const char *szMimeType; unsigned char *data; size_t dataSize; } StoreAvatarData;
+ typedef struct { wchar_t *szName; const char *szMimeType; unsigned char *data; size_t dataSize; } StoreAvatarData;
void __cdecl msn_storeAvatarThread(void* arg);
void __cdecl msn_storeProfileThread(void*);
@@ -305,7 +305,7 @@ struct CMsnProto : public PROTO<CMsnProto> int MSN_GetActiveThreads(ThreadData**);
ThreadData* MSN_GetThreadByConnection(HANDLE hConn);
ThreadData* MSN_GetThreadByContact(const char* wlid, TInfoType type = SERVER_SWITCHBOARD);
- GCThreadData*MSN_GetThreadByChatId(const TCHAR* chatId);
+ GCThreadData*MSN_GetThreadByChatId(const wchar_t* chatId);
ThreadData* MSN_GetP2PThreadByContact(const char *wlid);
void MSN_StartP2PTransferByContact(const char* wlid);
ThreadData* MSN_GetThreadByPort(WORD wPort);
@@ -423,12 +423,12 @@ struct CMsnProto : public PROTO<CMsnProto> int MSN_ChatInit(GCThreadData *info, const char *pszID, const char *pszTopic);
void MSN_ChatStart(ezxml_t xmli);
- void MSN_KillChatSession(const TCHAR* id);
+ void MSN_KillChatSession(const wchar_t* id);
void MSN_Kickuser(GCHOOK *gch);
void MSN_Promoteuser(GCHOOK *gch, const char *pszRole);
- const TCHAR *MSN_GCGetRole(GCThreadData* thread, const char *pszWLID);
- void MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID);
- void MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody);
+ const wchar_t *MSN_GCGetRole(GCThreadData* thread, const char *pszWLID);
+ void MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID);
+ void MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody);
void MSN_GCRefreshThreadsInfo(void);
MCONTACT MSN_GetChatInernalHandle(MCONTACT hContact);
@@ -516,8 +516,8 @@ struct CMsnProto : public PROTO<CMsnProto> void AvatarQueue_Init(void);
void AvatarQueue_Uninit(void);
- void MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
- int MSN_SetMyAvatar(const TCHAR* szFname, void* pData, size_t cbLen);
+ void MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen, const wchar_t *ext);
+ int MSN_SetMyAvatar(const wchar_t* szFname, void* pData, size_t cbLen);
void __cdecl MSN_AvatarsThread(void*);
@@ -590,8 +590,8 @@ struct CMsnProto : public PROTO<CMsnProto> bool MSN_StoreShareItem(const char* id, bool allowRecurse = true);
bool MSN_StoreCreateRelationships(bool allowRecurse = true);
bool MSN_StoreDeleteRelationships(bool tile, bool allowRecurse = true);
- bool MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true);
- bool MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true);
+ bool MSN_StoreCreateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true);
+ bool MSN_StoreUpdateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse = true);
bool MSN_StoreFindDocuments(bool allowRecurse = true);
ezxml_t storeSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr);
@@ -605,8 +605,8 @@ struct CMsnProto : public PROTO<CMsnProto> //////////////////////////////////////////////////////////////////////////////////////
- TCHAR *m_DisplayNameCache;
- TCHAR* GetContactNameT(MCONTACT hContact);
+ wchar_t *m_DisplayNameCache;
+ wchar_t* GetContactNameT(MCONTACT hContact);
int getStringUtf(MCONTACT hContact, const char* name, DBVARIANT* result);
int getStringUtf(const char* name, DBVARIANT* result);
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index d2b1b52444..034b75f52e 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -41,10 +41,10 @@ bool CMsnProto::APISkypeComRequest(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *he return true;
}
-static TCHAR* get_json_str(JSONNode *item, const char *pszValue)
+static wchar_t* get_json_str(JSONNode *item, const char *pszValue)
{
if (JSONNode *node = json_get(item, pszValue)) {
- TCHAR *ret = json_as_string(node);
+ wchar_t *ret = json_as_string(node);
if (!mir_tstrcmp(ret, L"null")) {
mir_free(ret);
return NULL;
@@ -194,10 +194,10 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value);
if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value);
if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value);
- if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_ttoi(value) == 1 ? 'M' : 'F'));
+ if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_wtoi(value) == 1 ? 'M' : 'F'));
if (value = get_json_str(item, "birthday")) {
int d, m, y;
- _stscanf(value, L"%d-%d-%d", &y, &m, &d);
+ swscanf(value, L"%d-%d-%d", &y, &m, &d);
setWord(hContact, "BirthYear", y);
setByte(hContact, "BirthDay", d);
setByte(hContact, "BirthMonth", m);
@@ -387,13 +387,13 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) JSONNode *ContactCards = json_get(item, "ContactCards");
JSONNode *Skype = json_get(ContactCards, "Skype");
- TCHAR *sDisplayName = json_as_string(json_get(Skype, "DisplayName"));
- TCHAR *sSkypeName = json_as_string(json_get(Skype, "SkypeName"));
+ wchar_t *sDisplayName = json_as_string(json_get(Skype, "DisplayName"));
+ wchar_t *sSkypeName = json_as_string(json_get(Skype, "SkypeName"));
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id.t = sSkypeName;
- psr.nick.t = sDisplayName;
+ psr.id.w = sSkypeName;
+ psr.nick.w = sDisplayName;
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, hSearch, (LPARAM)&psr);
}
json_free(items);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 09c8844223..4dafb1f4ef 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -504,7 +504,7 @@ bool CMsnProto::MSN_StoreDeleteRelationships(bool tile, bool allowRecurse) }
-bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
+bool CMsnProto::MSN_StoreCreateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
{
char* reqHdr;
ezxml_t tbdy;
@@ -586,7 +586,7 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime }
-bool CMsnProto::MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
+bool CMsnProto::MSN_StoreUpdateDocument(const wchar_t *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
{
char* reqHdr;
T2Utf szName(sztName);
diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index 76a0b6390c..8420e7e501 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -103,7 +103,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char return result;
}
-bool CMsnProto::getMyAvatarFile(char *url, TCHAR *fname)
+bool CMsnProto::getMyAvatarFile(char *url, wchar_t *fname)
{
NETLIBHTTPREQUEST nlhr = { 0 };
bool result = true;
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 1edd062c00..29bbda9faf 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -43,12 +43,12 @@ void CMsnProto::setStringUtf(MCONTACT hContact, const char* name, const char* va /////////////////////////////////////////////////////////////////////////////////////////
-TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact)
+wchar_t* CMsnProto::GetContactNameT(MCONTACT hContact)
{
if (hContact)
- return (TCHAR*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0);
+ return (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0);
- TCHAR *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName);
+ wchar_t *str = Contact_GetInfo(CNF_DISPLAY, NULL, m_szModuleName);
if (str != NULL) {
mir_free(m_DisplayNameCache);
return m_DisplayNameCache = str;
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 0a9e5b5b0b..a0cc11efe2 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -41,14 +41,14 @@ INT_PTR CMsnProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::GetAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
if (buf == NULL || size <= 0)
return -1;
MSN_GetAvatarFileName(NULL, buf, size, NULL);
- return _taccess(buf, 0);
+ return _waccess(buf, 0);
}
@@ -64,7 +64,7 @@ void CMsnProto::sttFakeAvatarAck(void* arg) INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- TCHAR filename[MAX_PATH];
+ wchar_t filename[MAX_PATH];
MsnContact *cont = NULL;
if (pai->hContact) {
@@ -185,11 +185,11 @@ INT_PTR CMsnProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam)
{
- TCHAR* szFileName = (TCHAR*)lParam;
+ wchar_t* szFileName = (wchar_t*)lParam;
- TCHAR tFileName[MAX_PATH];
+ wchar_t tFileName[MAX_PATH];
MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL);
- _tremove(tFileName);
+ _wremove(tFileName);
if (szFileName == NULL) {
delSetting("PictObject");
@@ -197,7 +197,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) ForkThread(&CMsnProto::msn_storeAvatarThread, NULL);
}
else {
- int fileId = _topen(szFileName, _O_RDONLY | _O_BINARY, _S_IREAD);
+ int fileId = _wopen(szFileName, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fileId < 0) return 1;
size_t dwPngSize = _filelengthi64(fileId);
@@ -210,8 +210,8 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) _read(fileId, pData, (unsigned)dwPngSize);
_close(fileId);
- TCHAR drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
- _tsplitpath(szFileName, drive, dir, fname, ext);
+ wchar_t drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
+ _wsplitpath(szFileName, drive, dir, fname, ext);
MSN_SetMyAvatar(fname, pData, dwPngSize);
@@ -355,11 +355,11 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) if (msnCurrentMedia.cbSize == 0)
delSetting("ListeningTo");
else {
- TCHAR *text;
+ wchar_t *text;
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- text = (TCHAR *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia);
+ text = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia);
else {
- text = (TCHAR *)mir_alloc(128 * sizeof(TCHAR));
+ text = (wchar_t *)mir_alloc(128 * sizeof(wchar_t));
mir_sntprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""),
(msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : L""));
}
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 86c5250e83..ea171e6215 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -383,7 +383,7 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) return NULL;
}
-GCThreadData* CMsnProto::MSN_GetThreadByChatId(const TCHAR* chatId)
+GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId)
{
if (mir_tstrlen(chatId) == 0)
return NULL;
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 6607c74d92..859023b6bc 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -239,10 +239,10 @@ char* getNewUuid(void); time_t IsoToUnixTime(const char *stamp);
time_t MsnTSToUnixtime(const char *pszTS);
-TCHAR* EscapeChatTags(const TCHAR* pszText);
-TCHAR* UnEscapeChatTags(TCHAR* str_in);
+wchar_t* EscapeChatTags(const wchar_t* pszText);
+wchar_t* UnEscapeChatTags(wchar_t* str_in);
-void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def = NULL);
+void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def = NULL);
char* arrayToHex(BYTE* data, size_t datasz);
@@ -268,8 +268,8 @@ typedef struct _tag_PopupData {
unsigned flags;
char* url;
- TCHAR* title;
- TCHAR* text;
+ wchar_t* title;
+ wchar_t* text;
CMsnProto* proto;
} PopupData;
@@ -542,7 +542,7 @@ typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*); struct GCUserItem
{
char WLID[MSN_MAX_EMAIL_LEN];
- TCHAR role[8];
+ wchar_t role[8];
BYTE btag;
};
@@ -554,7 +554,7 @@ struct GCThreadData LIST<GCUserItem> mJoinedContacts;
GCUserItem* mCreator;
GCUserItem* mMe;
- TCHAR mChatID[MSN_MAX_EMAIL_LEN];
+ wchar_t mChatID[MSN_MAX_EMAIL_LEN];
int netId; // from mChatID
char szEmail[MSN_MAX_EMAIL_LEN]; // frim mChatID
};
@@ -577,7 +577,7 @@ struct ThreadData HANDLE mIncomingBoundPort; // Netlib listen for the thread
HANDLE hWaitEvent;
WORD mIncomingPort;
- TCHAR mChatID[10];
+ wchar_t mChatID[10];
bool mIsMainThread;
clock_t mWaitPeriod;
@@ -1028,11 +1028,11 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA struct InviteChatParam
{
- TCHAR* id;
+ wchar_t* id;
MCONTACT hContact;
CMsnProto* ppro;
- InviteChatParam(const TCHAR* id, MCONTACT hContact, CMsnProto* ppro)
+ InviteChatParam(const wchar_t* id, MCONTACT hContact, CMsnProto* ppro)
: id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {}
~InviteChatParam() {
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index a12d70b99c..28c428e30b 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -71,7 +71,7 @@ static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const static void StoreDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { - TCHAR tstr[250+1]; + wchar_t tstr[250+1]; GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr)); if (tstr[0] != '\0') { diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp index a4d6c02ed7..02cd9c4603 100644 --- a/protocols/MinecraftDynmap/src/main.cpp +++ b/protocols/MinecraftDynmap/src/main.cpp @@ -72,7 +72,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO ///////////////////////////////////////////////////////////////////////////////////////// // Load -static PROTO_INTERFACE* protoInit(const char *proto_name,const TCHAR *username) +static PROTO_INTERFACE* protoInit(const char *proto_name,const wchar_t *username) { MinecraftDynmapProto *proto = new MinecraftDynmapProto(proto_name, username); g_Instances.insert(proto); diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index f2a15d6065..71c7932685 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const TCHAR* username) : +MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t* username) : PROTO<MinecraftDynmapProto>(proto_name, username), m_interval(0), hConnection(0), hEventsConnection(0), m_updateRate(5000), m_nick("") { @@ -42,7 +42,7 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const TCHAR* HookProtoEvent(ME_GC_EVENT, &MinecraftDynmapProto::OnChatEvent); // Create standard network connection - TCHAR descr[512]; + wchar_t descr[512]; NETLIBUSER nlu = {sizeof(nlu)}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; @@ -50,7 +50,7 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const TCHAR* nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { - TCHAR error[200]; + wchar_t error[200]; mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -176,13 +176,13 @@ int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; odp.position = 271828; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszGroup = LPGENW("Network"); + odp.pwszTab = LPGENW("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pfnDlgProc = MinecraftDynmapOptionsProc; Options_AddPage(wParam, &odp); diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h index 774f0eddb5..65f67cc25b 100644 --- a/protocols/MinecraftDynmap/src/proto.h +++ b/protocols/MinecraftDynmap/src/proto.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class MinecraftDynmapProto : public PROTO<MinecraftDynmapProto> { public: - MinecraftDynmapProto(const char *proto_name, const TCHAR *username); + MinecraftDynmapProto(const char *proto_name, const wchar_t *username); ~MinecraftDynmapProto(); inline const char* ModuleName() const { diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 6fe46e57b4..b3db982704 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -21,10 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-void OmegleProto::UpdateChat(const TCHAR *name, const TCHAR *message, bool addtolog)
+void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool addtolog)
{
// replace % to %% to not interfere with chat color codes
- std::tstring smessage = message;
+ std::wstring smessage = message;
utils::text::treplace_all(&smessage, L"%", L"%%");
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
@@ -226,7 +226,7 @@ GCEVENT gce = { sizeof(gce), &gcd }; CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
}*/
-void OmegleProto::AddChatContact(const TCHAR *name)
+void OmegleProto::AddChatContact(const wchar_t *name)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -248,7 +248,7 @@ void OmegleProto::AddChatContact(const TCHAR *name) CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
-void OmegleProto::DeleteChatContact(const TCHAR *name)
+void OmegleProto::DeleteChatContact(const wchar_t *name)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -296,7 +296,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress) return 0;
}
-void OmegleProto::SetTopic(const TCHAR *topic)
+void OmegleProto::SetTopic(const wchar_t *topic)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
GCEVENT gce = { sizeof(gce), &gcd };
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index db1391ba82..27370cb1f4 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -365,7 +365,7 @@ bool Omegle_client::start() char str[255]; mir_snprintf(str, Translate("Connected to server %s. There are %s users online now."), server_.c_str(), count.c_str()); - TCHAR *msg = mir_a2t(str); + wchar_t *msg = mir_a2t(str); parent->UpdateChat(NULL, msg); mir_free(msg); } @@ -374,7 +374,7 @@ bool Omegle_client::start() char str[255]; mir_snprintf(str, Translate("Connected to server %s."), server_.c_str()); - TCHAR *msg = mir_a2t(str); + wchar_t *msg = mir_a2t(str); parent->UpdateChat(NULL, msg); mir_free(msg); } @@ -506,7 +506,7 @@ bool Omegle_client::events() // We got info about count of connected people there ptrT count(json_as_string(json_get(data, "count"))); - TCHAR strT[255]; + wchar_t strT[255]; mir_sntprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); parent->UpdateChat(NULL, strT); @@ -531,7 +531,7 @@ bool Omegle_client::events() waiting = false; } else if (name == "commonLikes") { - std::tstring likes = TranslateT("You and the Stranger both like: "); + std::wstring likes = TranslateT("You and the Stranger both like: "); JSONNode *items = json_at(item, 1); size_t size = json_size(items); @@ -614,7 +614,7 @@ bool Omegle_client::events() ptrT stranger(json_as_string(json_at(item, 1))); - TCHAR strT[255]; + wchar_t strT[255]; mir_sntprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); parent->UpdateChat(NULL, strT); @@ -639,7 +639,7 @@ bool Omegle_client::events() else if (name == "error") { ptrT error(json_as_string(json_at(item, 1))); - TCHAR strT[255]; + wchar_t strT[255]; mir_sntprintf(strT, TranslateT("Error: %s"), TranslateTS(error)); parent->UpdateChat(NULL, strT); } diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index 7ff7b76097..9868c51c57 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -45,7 +45,7 @@ static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szS static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- TCHAR tstr[250 + 1];
+ wchar_t tstr[250 + 1];
GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
if (tstr[0] != '\0') {
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index fbde3bf512..309d0fe897 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -74,7 +74,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
OmegleProto *proto = new OmegleProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 8cabb89dcb..2a8f16b95e 100644 --- a/protocols/Omegle/src/messages.cpp +++ b/protocols/Omegle/src/messages.cpp @@ -34,7 +34,7 @@ void OmegleProto::SendMsgWorker(void *p) if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message(data)) { - TCHAR *msg = mir_a2t_cp(data.c_str(), CP_UTF8); + wchar_t *msg = mir_a2t_cp(data.c_str(), CP_UTF8); UpdateChat(facy.nick_, msg); mir_free(msg); } diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 42d0249c1d..aff30158c6 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) :
+OmegleProto::OmegleProto(const char* proto_name, const wchar_t* username) :
PROTO<OmegleProto>(proto_name, username)
{
this->facy.parent = this;
@@ -42,7 +42,7 @@ PROTO<OmegleProto>(proto_name, username) HookProtoEvent(ME_GC_EVENT, &OmegleProto::OnChatEvent);
// Create standard network connection
- TCHAR descr[512];
+ wchar_t descr[512];
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
@@ -50,17 +50,17 @@ PROTO<OmegleProto>(proto_name, username) nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
facy.set_handle(m_hNetlibUser);
- SkinAddNewSoundExT("StrangerTyp", m_tszUserName, LPGENT("Stranger is typing"));
- SkinAddNewSoundExT("StrangerTypStop", m_tszUserName, LPGENT("Stranger stopped typing"));
- SkinAddNewSoundExT("StrangerChange", m_tszUserName, LPGENT("Changing stranger"));
- SkinAddNewSoundExT("StrangerMessage", m_tszUserName, LPGENT("Receive message"));
+ SkinAddNewSoundExT("StrangerTyp", m_tszUserName, LPGENW("Stranger is typing"));
+ SkinAddNewSoundExT("StrangerTypStop", m_tszUserName, LPGENW("Stranger stopped typing"));
+ SkinAddNewSoundExT("StrangerChange", m_tszUserName, LPGENW("Changing stranger"));
+ SkinAddNewSoundExT("StrangerMessage", m_tszUserName, LPGENW("Receive message"));
}
OmegleProto::~OmegleProto()
@@ -181,13 +181,13 @@ int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInstance;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.position = 271828;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTab = LPGENW("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = OmegleOptionsProc;
Options_AddPage(wParam, &odp);
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 522f060991..5b0362b240 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class OmegleProto : public PROTO < OmegleProto >
{
public:
- OmegleProto(const char *proto_name, const TCHAR *username);
+ OmegleProto(const char *proto_name, const wchar_t *username);
~OmegleProto();
inline const char* ModuleName() const
@@ -88,14 +88,14 @@ public: //bool IsMyContact(HANDLE, bool include_chat = false);
// Chat handling
- void AddChat(const TCHAR *id, const TCHAR *name);
- void UpdateChat(const TCHAR *name, const TCHAR *message, bool addtochat = true);
+ void AddChat(const wchar_t *id, const wchar_t *name);
+ void UpdateChat(const wchar_t *name, const wchar_t *message, bool addtochat = true);
void SendChatMessage(std::string message);
- void AddChatContact(const TCHAR *nick);
- void DeleteChatContact(const TCHAR *name);
+ void AddChatContact(const wchar_t *nick);
+ void DeleteChatContact(const wchar_t *name);
void SetChatStatus(int);
void ClearChat();
- void SetTopic(const TCHAR *topic = NULL);
+ void SetTopic(const wchar_t *topic = NULL);
MCONTACT GetChatHandle();
// Connection client
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 46cf1bbf83..71c0528eb0 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -108,8 +108,8 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_conf_opened() start");
- TCHAR* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
- TCHAR* tszConfTitle = mir_utf8decodeT(mwConference_getTitle(conf));
+ wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfTitle = mir_utf8decodeT(mwConference_getTitle(conf));
// create new chat session
GCSESSION gcs = { sizeof(gcs) };
@@ -141,8 +141,8 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) for (;user; user=user->next) {
proto->debugLog(L"mwServiceConf_conf_opened() add user");
- TCHAR* tszUserName = mir_utf8decodeT(((mwLoginInfo*)user->data)->user_name);
- TCHAR* tszUserId = mir_utf8decodeT(((mwLoginInfo*)user->data)->login_id);
+ wchar_t* tszUserName = mir_utf8decodeT(((mwLoginInfo*)user->data)->user_name);
+ wchar_t* tszUserId = mir_utf8decodeT(((mwLoginInfo*)user->data)->login_id);
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.bIsMe = (strcmp(((mwLoginInfo*)user->data)->login_id, proto->my_login_info->login_id) == 0);
@@ -173,7 +173,7 @@ void mwServiceConf_conf_closed(mwConference* conf, guint32 reason) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_conf_closed() start");
- TCHAR* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
GCDEST gcd = { proto->m_szModuleName };
gcd.ptszID = tszConfId;
@@ -261,7 +261,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_on_text() start");
- TCHAR* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
GCDEST gcd = { proto->m_szModuleName };
gcd.ptszID = tszConfId;
@@ -270,9 +270,9 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- TCHAR* textT = mir_utf8decodeT(what);
- TCHAR* tszUserName = mir_utf8decodeT(user->user_name);
- TCHAR* tszUserId = mir_utf8decodeT(user->login_id);
+ wchar_t* textT = mir_utf8decodeT(what);
+ wchar_t* tszUserName = mir_utf8decodeT(user->user_name);
+ wchar_t* tszUserId = mir_utf8decodeT(user->login_id);
gce.ptszText = textT;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
@@ -319,7 +319,7 @@ void CSametimeProto::TerminateConference(char* name) for (;conf;conf = conf->next) {
if (strcmp(name, mwConference_getName((mwConference*)conf->data)) == 0) {
- TCHAR* idt = mir_utf8decodeT(name);
+ wchar_t* idt = mir_utf8decodeT(name);
GCDEST gcd = {m_szModuleName, idt, GC_EVENT_CONTROL};
GCEVENT gce = { sizeof(gce), &gcd };
@@ -341,7 +341,7 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { GList *conferences = mwServiceConference_getConferences(service_conference);
for (GList *conf = conferences;conf;conf = conf->next) {
- TCHAR* tszConfId = mir_utf8decodeT(mwConference_getName((mwConference*)conf->data));
+ wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName((mwConference*)conf->data));
if (mir_tstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
switch(gch->pDest->iType) {
case GC_USER_MESSAGE:
@@ -405,8 +405,8 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) mwAwareIdBlock id_block;
mwIdBlock idb;
if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) {
- TCHAR title[512];
- TCHAR* ts = mir_utf8decodeT(my_login_info->user_name);
+ wchar_t title[512];
+ wchar_t* ts = mir_utf8decodeT(my_login_info->user_name);
mir_sntprintf(title, TranslateT("%s's conference"), ts);
mir_free(ts);
@@ -509,13 +509,13 @@ void CSametimeProto::InitConferenceMenu() mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE;
SET_UID(mi, 0x98cf8a8c, 0x75ba, 0x46f2, 0xa3, 0x35, 0x65, 0x46, 0x4a, 0x38, 0x20, 0x7d);
- mi.name.t = LPGENT("Leave conference");
+ mi.name.w = LPGENW("Leave conference");
mi.pszService = MS_SAMETIME_MENULEAVECHAT;
mi.hIcolibItem = GetIconHandle(IDI_ICON_LEAVE);
hLeaveChatMenuItem = Menu_AddContactMenuItem(&mi, m_szModuleName);
SET_UID(mi, 0x45501e10, 0x2914, 0x4daa, 0xb4, 0xcf, 0x83, 0x8a, 0x6a, 0x14, 0xd, 0x7);
- mi.name.t = LPGENT("Start conference");
+ mi.name.w = LPGENW("Start conference");
mi.pszService = MS_SAMETIME_MENUCREATECHAT;
mi.hIcolibItem = GetIconHandle(IDI_ICON_INVITE);
hCreateChatMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index bbc71b346b..567520469a 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -28,22 +28,22 @@ void mwFileTransfer_offered(mwFileTransfer* ft) proto->ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)ft, 0);
- TCHAR* filenameT = mir_utf8decodeT(mwFileTransfer_getFileName(ft));
+ wchar_t* filenameT = mir_utf8decodeT(mwFileTransfer_getFileName(ft));
const char* message = mwFileTransfer_getMessage(ft);
- TCHAR descriptionT[512];
+ wchar_t descriptionT[512];
if (message) {
- TCHAR* messageT = mir_utf8decodeT(message);
+ wchar_t* messageT = mir_utf8decodeT(message);
mir_sntprintf(descriptionT, L"%s - %s", filenameT, messageT);
mir_free(messageT);
} else
- _tcsncpy_s(descriptionT, filenameT, _TRUNCATE);
+ wcsncpy_s(descriptionT, filenameT, _TRUNCATE);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = descriptionT;
- pre.files.t = &filenameT;
+ pre.descr.w = descriptionT;
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
@@ -282,7 +282,7 @@ mwFileTransferHandler mwFileTransfer_handler = { mwFileTransfer_clear
};
-HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, TCHAR** files, const TCHAR* ptszDesc)
+HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const wchar_t* ptszDesc)
{
debugLog(L"CSametimeProto::SendFilesToUser() start");
@@ -300,7 +300,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, TCHAR** files, const T if (hFile != INVALID_HANDLE_VALUE) {
DWORD filesize = GetFileSize(hFile, 0);
- TCHAR *fn = _tcsrchr(files[i], '\\');
+ wchar_t *fn = wcsrchr(files[i], '\\');
if (fn)
fn++;
else
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index 2bde61b90e..a6092c0c21 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -95,9 +95,9 @@ void mwIm_place_invite(struct mwConversation* conv, const char* message, const c ///TODO unimplemented
- TCHAR* tszMessage = mir_utf8decodeT(message);
+ wchar_t* tszMessage = mir_utf8decodeT(message);
- TCHAR msg[512];
+ wchar_t msg[512];
mir_sntprintf(msg, TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
proto->showPopup(msg, SAMETIME_POPUP_INFO);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index 9f31d92ba6..aa08112856 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -6,7 +6,7 @@ #define NUM_IDS 24
-TCHAR* client_names[NUM_IDS] = {
+wchar_t* client_names[NUM_IDS] = {
L"Official Binary Library",
L"Official Java Applet",
L"Official Binary Application",
@@ -65,7 +65,7 @@ int client_ids[NUM_IDS] = { #define NUM_CVS 5
-TCHAR* CV_names[NUM_CVS] = {
+wchar_t* CV_names[NUM_CVS] = {
L"Sametime (Use old client version)",
L"Sametime (Miranda default)",
L"Sametime 8",
@@ -102,19 +102,19 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA WORD client_ver = proto->GetClientVersion();
if (client_ver) {
- TCHAR verbuf[100];
+ wchar_t verbuf[100];
mir_sntprintf(verbuf, TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_CLIENTVER, verbuf);
}
WORD server_ver = proto->GetServerVersion();
if (server_ver) {
- TCHAR verbuf[100];
+ wchar_t verbuf[100];
mir_sntprintf(verbuf, TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf);
}
- TCHAR *s = mir_utf8decodeT(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s);
+ wchar_t *s = mir_utf8decodeT(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s);
s = mir_utf8decodeT(proto->options.id); SetDlgItemText(hwndDlg, IDC_ED_NAME, s); mir_free(s);
s = mir_utf8decodeT(proto->options.pword); SetDlgItemText(hwndDlg, IDC_ED_PWORD, s); mir_free(s);
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_BTN_IMPORTCONTACTS:
{
- TCHAR import_filename[MAX_PATH]; import_filename[0] = 0;
+ wchar_t import_filename[MAX_PATH]; import_filename[0] = 0;
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -291,7 +291,7 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- TCHAR ws[2048];
+ wchar_t ws[2048];
GetDlgItemText(hwndDlg, IDC_ED_SNAME, ws, LSTRINGLEN);
mir_strcpy(proto->options.server_name, T2Utf(ws));
@@ -350,8 +350,8 @@ int CSametimeProto::OptInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTNET);
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
odp.pfnDlgProc = DlgProcOptNet;
odp.dwInitParam = (LPARAM)this;
Options_AddPage(wParam, &odp);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 6a9e9a3169..0a950bc123 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -248,7 +248,7 @@ void CSametimeProto::BroadcastNewStatus(int iNewStatus) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previous_status, m_iStatus);
}
-static CSametimeProto* sametime_proto_init(const char* pszProtoName, const TCHAR* tszUserName)
+static CSametimeProto* sametime_proto_init(const char* pszProtoName, const wchar_t* tszUserName)
{
CSametimeProto* proto = new CSametimeProto(pszProtoName, tszUserName);
g_Instances.insert(proto);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 4278a309c8..ca84865901 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h"
#include "sametime.h"
-CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserName) :
+CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserName) :
PROTO<CSametimeProto>(pszProtoName, tszUserName),
is_idle(false), idle_status(false),
first_online(true),
@@ -14,7 +14,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserNam server_connection(0)
{
// Register m_hNetlibUser user
- TCHAR name[128];
+ wchar_t name[128];
mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -83,7 +83,7 @@ MCONTACT CSametimeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return AddSearchedUser(sr, flags & PALF_TEMPORARY);
}
-HANDLE CSametimeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE CSametimeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath)
{
debugLog(L"CSametimeProto::FileAllow() hContact=[%x], szPath=[%s]", hContact, szPath);
char* szPathA = mir_t2a(szPath);
@@ -99,14 +99,14 @@ int CSametimeProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) return 0;
}
-int CSametimeProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason)
+int CSametimeProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason)
{
debugLog(L"CSametimeProto::FileDeny() hContact=[%x], szReason=[%s]", hContact, szReason);
RejectFileTransfer(hTransfer);
return 0;
}
-int CSametimeProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int CSametimeProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
debugLog(L"CSametimeProto::FileResume() action=[%d]", &action);
return 0;
@@ -157,7 +157,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) return 0;
}
-HANDLE CSametimeProto::SearchBasic(const TCHAR* id)
+HANDLE CSametimeProto::SearchBasic(const wchar_t* id)
{
debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_tstrlen(id));
return (HANDLE)SearchForUser(T2Utf(id), FALSE);
@@ -166,7 +166,7 @@ HANDLE CSametimeProto::SearchBasic(const TCHAR* id) HWND CSametimeProto::SearchAdvanced(HWND owner)
{
- TCHAR buf[512];
+ wchar_t buf[512];
if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_tstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
@@ -201,7 +201,7 @@ int CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) return Proto_RecvMessage(hContact, pre);
}
-HANDLE CSametimeProto::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+HANDLE CSametimeProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
debugLog(L"CSametimeProto::SendFile() hContact=[%x]", hContact);
if (m_iStatus != ID_STATUS_OFFLINE) {
@@ -282,7 +282,7 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt return 0;
}
-int CSametimeProto::SetAwayMsg(int iStatus, const TCHAR* msg)
+int CSametimeProto::SetAwayMsg(int iStatus, const wchar_t* msg)
{
debugLog(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_tstrlen(msg));
SetSessionAwayMessage(iStatus, msg);
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 7b51b77476..4e652a5dd8 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -7,7 +7,7 @@ struct CSametimeProto : public PROTO<CSametimeProto>
{
- CSametimeProto(const char*, const TCHAR* );
+ CSametimeProto(const char*, const wchar_t* );
~CSametimeProto();
//====================================================================================
@@ -17,29 +17,29 @@ struct CSametimeProto : public PROTO<CSametimeProto> virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET*);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt);
- virtual int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -73,7 +73,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> bool GetAwareIdFromContact(MCONTACT hContact, mwAwareIdBlock* id_block);
MCONTACT FindContactByUserId(const char* id);
void ImportContactsFromList(mwSametimeList* user_list, bool temporary);
- void ImportContactsFromFile(TCHAR* filename);
+ void ImportContactsFromFile(wchar_t* filename);
void ExportContactsToList(mwSametimeList* user_list);
void ExportContactsToServer();
void UserListAddStored();
@@ -93,7 +93,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> HANDLE AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* save_path);
void RejectFileTransfer(HANDLE hFt);
void CancelFileTransfer(HANDLE hFt);
- HANDLE SendFilesToUser(MCONTACT hContact, TCHAR** files, const TCHAR* pszDesc);
+ HANDLE SendFilesToUser(MCONTACT hContact, wchar_t** files, const wchar_t* pszDesc);
// conference.cpp
void InitConference();
@@ -117,7 +117,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> int SetSessionStatus(int status);
void UpdateSelfStatus();
int SetIdle(bool idle);
- void SetSessionAwayMessage(int status, const TCHAR* msg);
+ void SetSessionAwayMessage(int status, const wchar_t* msg);
WORD GetClientVersion();
WORD GetServerVersion();
INT_PTR __cdecl SessionAnnounce(WPARAM wParam, LPARAM lParam);
@@ -132,7 +132,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> void SaveOptions();
// utils.cpp
- void showPopup(const TCHAR* msg, SametimePopupEnum flag);
+ void showPopup(const wchar_t* msg, SametimePopupEnum flag);
void showPopup(guint32 code);
void RegisterPopups();
void UnregisterPopups();
@@ -207,7 +207,7 @@ typedef struct tag_TFakeAckParams { struct SendAnnouncementFunc_arg {
CSametimeProto* proto;
- TCHAR msg[MAX_MESSAGE_SIZE];
+ wchar_t msg[MAX_MESSAGE_SIZE];
GList* recipients;
};
@@ -221,8 +221,8 @@ struct SessionAnnounceDialogProc_arg { struct PopupData {
SametimePopupEnum flag;
- TCHAR* title;
- TCHAR* text;
+ wchar_t* title;
+ wchar_t* text;
CSametimeProto* proto;
};
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 496b1ea95e..6fa0644c75 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -137,7 +137,7 @@ void __cdecl SessionAdmin(struct mwSession* session, const char* text) {
CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLog(L"SessionAdmin()");
- TCHAR* tt = mir_utf8decodeT(text);
+ wchar_t* tt = mir_utf8decodeT(text);
MessageBox(0, tt, TranslateT("Sametime administrator message"), MB_OK);
mir_free(tt);
}
@@ -146,9 +146,9 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from {
CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLog(L"SessionAnnounce()");
- TCHAR* stzFrom;
- TCHAR* stzText;
- TCHAR stzFromBuff[256];
+ wchar_t* stzFrom;
+ wchar_t* stzText;
+ wchar_t stzFromBuff[256];
stzFrom = mir_utf8decodeT(from->user_name);
stzText = mir_utf8decodeT(text);
mir_sntprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom);
@@ -208,7 +208,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) break;
default:
- TCHAR buff[512];
+ wchar_t buff[512];
mir_sntprintf(buff, TranslateT("Unknown user status: %d"), us.status);
proto->showPopup(buff, SAMETIME_POPUP_ERROR);
proto->debugLog(buff);
@@ -311,7 +311,7 @@ int CSametimeProto::SetIdle(bool idle) return 0;
}
-void CSametimeProto::SetSessionAwayMessage(int status, const TCHAR* msgT)
+void CSametimeProto::SetSessionAwayMessage(int status, const wchar_t* msgT)
{
debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_tstrlen(msgT));
@@ -578,7 +578,7 @@ void CSametimeProto::InitSessionMenu() CMenuItem mi;
mi.flags = CMIF_TCHAR;
mi.position = 2000060000;
- mi.name.t = LPGENT("Send announcement...");
+ mi.name.w = LPGENW("Send announcement...");
mi.pszService = MS_SAMETIME_MENUANNOUNCESESSION;
mi.hIcolibItem = GetIconHandle(IDI_ICON_ANNOUNCE);
Menu_AddContactMenuItem(&mi, m_szModuleName);
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 3766dc73f7..4660b68c8f 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -298,7 +298,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) }
}
-void CSametimeProto::ImportContactsFromFile(TCHAR* filename)
+void CSametimeProto::ImportContactsFromFile(wchar_t* filename)
{
debugLog(L"CSametimeProto::ImportContactsFromFile() start");
std::ifstream in(filename);
@@ -654,8 +654,8 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code mcsr.psr.nick.a = mcsr.name;
mcsr.nFieldCount = 4;
- TCHAR fields[4][512];
- TCHAR *fields_addr[4];
+ wchar_t fields[4][512];
+ wchar_t *fields_addr[4];
mcsr.pszFields = fields_addr;
mcsr.pszFields[0] = fields[0];
mcsr.pszFields[1] = fields[1];
@@ -665,10 +665,10 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code if (advanced == TRUE) {
// send column names
mcsr.psr.cbSize = 0;
- _tcsncpy(mcsr.pszFields[0], TranslateT("ID"), 512);
- _tcsncpy(mcsr.pszFields[1], TranslateT("Name"), 512);
- _tcsncpy(mcsr.pszFields[2], TranslateT("Description"), 512);
- _tcsncpy(mcsr.pszFields[3], TranslateT("Group?"), 512);
+ wcsncpy(mcsr.pszFields[0], TranslateT("ID"), 512);
+ wcsncpy(mcsr.pszFields[1], TranslateT("Name"), 512);
+ wcsncpy(mcsr.pszFields[2], TranslateT("Description"), 512);
+ wcsncpy(mcsr.pszFields[3], TranslateT("Group?"), 512);
proto->ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, (HANDLE)id, (LPARAM)&mcsr);
}
@@ -689,7 +689,7 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code mcsr.pszFields[2][0] = 0;
mcsr.group = (((mwResolveMatch *)mri->data)->type == mwResolveMatch_GROUP);
- _tcsncpy_s(mcsr.pszFields[3], 512, mcsr.group ? TranslateT("True") : TranslateT("False"), _TRUNCATE);
+ wcsncpy_s(mcsr.pszFields[3], 512, mcsr.group ? TranslateT("True") : TranslateT("False"), _TRUNCATE);
if (advanced == TRUE)
proto->ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, (HANDLE)id, (LPARAM)&mcsr);
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 0a73ddce90..0e24204f8d 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -29,7 +29,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar void CSametimeProto::RegisterPopups()
{
- TCHAR szDescr[256];
+ wchar_t szDescr[256];
char szName[256];
debugLog(L"CSametimeProto::RegisterPopups()");
@@ -86,8 +86,8 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (disp == ED_POP) {
POPUPDATACLASS ppd = { sizeof(ppd) };
char szName[256];
- ppd.ptszTitle = puData->title;
- ppd.ptszText = puData->text;
+ ppd.pwszTitle = puData->title;
+ ppd.pwszText = puData->text;
if (puData->flag == SAMETIME_POPUP_ERROR)
mir_snprintf(szName, "%s_%s", proto->m_szModuleName, "Error");
else
@@ -125,7 +125,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) }
}
-void CSametimeProto::showPopup(const TCHAR* msg, SametimePopupEnum flag)
+void CSametimeProto::showPopup(const wchar_t* msg, SametimePopupEnum flag)
{
if (Miranda_Terminated()) return;
@@ -143,7 +143,7 @@ void CSametimeProto::showPopup(guint32 code) struct mwReturnCodeDesc *rcDesc = mwGetReturnCodeDesc(code);
SametimePopupEnum flag = (rcDesc->type == mwReturnCodeError ? SAMETIME_POPUP_ERROR : SAMETIME_POPUP_INFO);
- TCHAR buff[512];
+ wchar_t buff[512];
mir_sntprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description)));
showPopup(buff, flag);
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 26ef2bcb81..d2c766c4e1 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -68,7 +68,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) setByte(hContact, "AvatarType", ai.format);
GetAvatarFileName(hContact, ai.filename, _countof(ai.filename));
- FILE *out = _tfopen(ai.filename, L"wb");
+ FILE *out = _wfopen(ai.filename, L"wb");
if (out == NULL) {
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
return;
@@ -100,11 +100,11 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG);
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
- _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
+ wcsncpy(pai->filename, tszFileName, _countof(pai->filename));
- if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
+ if (::_waccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
return GAIR_SUCCESS;
if (IsOnline()) {
@@ -119,13 +119,13 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
GetAvatarFileName(NULL, path, _countof(path));
- _tcsncpy((TCHAR*)wParam, path, (int)lParam);
+ wcsncpy((wchar_t*)wParam, path, (int)lParam);
return 0;
}
-void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen)
+void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
@@ -135,7 +135,7 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cb pszDest[tPathLen++] = '\\';
- const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
+ const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
CMStringA username(Contacts[hContact]);
username.Replace("live:", "__live_");
username.Replace("facebook:", "__facebook_");
@@ -166,14 +166,14 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam)
{
- TCHAR *path = (TCHAR*)lParam;
- TCHAR avatarPath[MAX_PATH];
+ wchar_t *path = (wchar_t*)lParam;
+ wchar_t avatarPath[MAX_PATH];
GetAvatarFileName(NULL, avatarPath, _countof(avatarPath));
if (path != NULL)
{
if (CopyFile(path, avatarPath, FALSE))
{
- FILE *hFile = _tfopen(path, L"rb");
+ FILE *hFile = _wfopen(path, L"rb");
if (hFile)
{
fseek(hFile, 0, SEEK_END);
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 8fa95966d9..282793848c 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -58,7 +58,7 @@ MCONTACT CSkypeProto::FindChatRoom(const char *chatname) return si ? si->hContact : 0;
}
-void CSkypeProto::StartChatRoom(const TCHAR *tid, const TCHAR *tname)
+void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
{
// Create the group chat session
GCSESSION gcw = { sizeof(gcw) };
@@ -408,9 +408,9 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) }
}
-TCHAR* UnEscapeChatTags(TCHAR* str_in)
+wchar_t* UnEscapeChatTags(wchar_t* str_in)
{
- TCHAR *s = str_in, *d = str_in;
+ wchar_t *s = str_in, *d = str_in;
while (*s) {
if (*s == '%' && s[1] == '%')
s++;
@@ -420,12 +420,12 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in) return str_in;
}
-void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage)
+void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage)
{
if (!IsOnline())
return;
- TCHAR *buf = NEWTSTR_ALLOCA(tszMessage);
+ wchar_t *buf = NEWWSTR_ALLOCA(tszMessage);
rtrimt(buf);
UnEscapeChatTags(buf);
@@ -438,7 +438,7 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li));
}
-void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
+void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
{
GCDEST gcd = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
@@ -468,7 +468,7 @@ void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, cons void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
{
- ptrT topic((TCHAR*)p); // memory must be freed in any case
+ ptrT topic((wchar_t*)p); // memory must be freed in any case
if (response == NULL || response->pData == NULL)
return;
@@ -520,13 +520,13 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
-bool CSkypeProto::IsChatContact(const TCHAR *chat_id, const char *id)
+bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id)
{
ptrA users(GetChatUsers(chat_id));
return (users != NULL && strstr(users, id) != NULL);
}
-char *CSkypeProto::GetChatUsers(const TCHAR *chat_id)
+char *CSkypeProto::GetChatUsers(const wchar_t *chat_id)
{
GC_INFO gci = { 0 };
gci.Flags = GCF_USERS;
@@ -536,13 +536,13 @@ char *CSkypeProto::GetChatUsers(const TCHAR *chat_id) return gci.pszUsers;
}
-void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const char *name, const TCHAR *role, bool isChange)
+void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const char *name, const wchar_t *role, bool isChange)
{
if (IsChatContact(tchat_id, id))
return;
ptrT tnick(mir_a2t_cp(name, CP_UTF8));
- if (TCHAR *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id))
+ if (wchar_t *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id))
tnick = tmp;
ptrT tid(mir_a2t(id));
@@ -560,7 +560,7 @@ void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const ch CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
-void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick, const char *initiator)
+void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick, const char *initiator)
{
if (IsMe(id))
return;
@@ -619,9 +619,9 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) {
static const struct gc_item Items[] =
{
- { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
- { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE },
- { LPGENT("&Change topic"), 30, MENU_ITEM, FALSE }
+ { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE },
+ { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE },
+ { LPGENW("&Change topic"), 30, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
@@ -637,12 +637,12 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) {*/
static const struct gc_item Items[] =
{
- { LPGENT("Kick &user"), 10, MENU_ITEM },
+ { LPGENW("Kick &user"), 10, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("Set &role"), 20, MENU_NEWPOPUP },
- { LPGENT("&Admin"), 30, MENU_POPUPITEM },
- { LPGENT("&User"), 40, MENU_POPUPITEM },
- { LPGENT("Change nick"), 50, MENU_ITEM },
+ { LPGENW("Set &role"), 20, MENU_NEWPOPUP },
+ { LPGENW("&Admin"), 30, MENU_POPUPITEM },
+ { LPGENW("&User"), 40, MENU_POPUPITEM },
+ { LPGENW("Change nick"), 50, MENU_ITEM },
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h index 63a38ecadc..60a00b0ac5 100644 --- a/protocols/SkypeWeb/src/skype_db.h +++ b/protocols/SkypeWeb/src/skype_db.h @@ -41,11 +41,11 @@ struct CSkypeOptions CMOption<BYTE> bMarkAllAsUnread;
CMOption<BYTE> bUseHostnameAsPlace;
- CMOption<TCHAR*> wstrPlace;
+ CMOption<wchar_t*> wstrPlace;
CMOption<BYTE> bUseBBCodes;
- CMOption<TCHAR*> wstrCListGroup;
+ CMOption<wchar_t*> wstrCListGroup;
CSkypeOptions(PROTO_INTERFACE *proto) :
diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 4624bb5c45..ecf870469d 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -45,7 +45,7 @@ void CSkypeInviteDlg::OnInitDialog() {
if (!m_proto->isChatRoom(hContact))
{
- TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
m_combo.AddString(ptszNick, hContact);
}
}
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index f38ee7a8dd..cd72da2f78 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -73,7 +73,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) if (xmlDuration != NULL)
{
- callDuration = _ttol(xmlGetText(xmlDuration));
+ callDuration = _wtol(xmlGetText(xmlDuration));
break;
}
}
@@ -115,7 +115,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) HXML xmlNode = xmlGetNthChild(xml, L"file", i);
if (xmlNode != NULL)
{
- fileSize = _ttol(xmlGetAttrValue(xmlNode, L"size"));
+ fileSize = _wtol(xmlGetAttrValue(xmlNode, L"size"));
char *fileName = _T2A(xmlGetText(xmlNode));
if (fileName != NULL)
{
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index bc562a8746..2a2941bdfd 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -2,7 +2,7 @@ #define FILETRANSFER_FAILED(fup) { ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)fup); delete fup; fup = nullptr;}
-HANDLE CSkypeProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles)
+HANDLE CSkypeProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles)
{
if (IsOnline())
{
@@ -38,7 +38,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar JSONNode node = JSONNode::parse((char*)response->pData);
std::string strObjectId = node["id"].as_string();
fup->uid = mir_strdup(strObjectId.c_str());
- FILE *pFile = _tfopen(fup->tszFileName, L"rb");
+ FILE *pFile = _wfopen(fup->tszFileName, L"rb");
if (pFile == NULL) return;
fseek(pFile, 0, SEEK_END);
@@ -75,7 +75,7 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a return;
}
- TCHAR *tszFile = _tcsrchr(fup->tszFileName, L'\\') + 1;
+ wchar_t *tszFile = wcsrchr(fup->tszFileName, L'\\') + 1;
HXML xml = xmlCreateNode(L"URIObject", nullptr, 0);
xmlAddChild(xml, L"Title", tszFile);
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index c4c40d1219..18ab4ad130 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -19,20 +19,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. IconItemT CSkypeProto::Icons[] =
{
- { LPGENT("Protocol icon"), "main", IDI_SKYPE },
- { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE },
- { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY },
- { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER },
- { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER },
- { LPGENT("Incoming call icon"), "inc_call", IDI_CALL },
- { LPGENT("Notification icon"), "notify", IDI_NOTIFY },
- { LPGENT("Error icon"), "error", IDI_ERRORICON },
- { LPGENT("Action icon"), "me_action", IDI_ACTION_ME }
+ { LPGENW("Protocol icon"), "main", IDI_SKYPE },
+ { LPGENW("Create new chat icon"), "conference", IDI_CONFERENCE },
+ { LPGENW("Sync history icon"), "synchistory", IDI_SYNCHISTORY },
+ { LPGENW("Block user icon"), "user_block", IDI_BLOCKUSER },
+ { LPGENW("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER },
+ { LPGENW("Incoming call icon"), "inc_call", IDI_CALL },
+ { LPGENW("Notification icon"), "notify", IDI_NOTIFY },
+ { LPGENW("Error icon"), "error", IDI_ERRORICON },
+ { LPGENW("Action icon"), "me_action", IDI_ACTION_ME }
};
void CSkypeProto::InitIcons()
{
- Icon_RegisterT(g_hInstance, LPGENT("Protocols") L"/" LPGENT(MODULE), Icons, _countof(Icons), MODULE);
+ Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" MODULEW, Icons, _countof(Icons), MODULE);
}
HICON CSkypeProto::GetIcon(int iconId)
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 7909698b37..e2d820eb75 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -236,7 +236,7 @@ void CSkypeProto::SendPresence(bool isLogin) epname = mir_utf8encodeT(m_opts.wstrPlace);
else
{
- TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = _countof(compName);
GetComputerName(compName, &size);
epname = mir_utf8encodeT(compName);
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 6e612c60ce..8ad180448e 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -65,7 +65,7 @@ void CSkypeProto::InitMenus() // Request authorization
mi.pszService = MODULE"/RequestAuth";
- mi.name.t = LPGENT("Request authorization");
+ mi.name.w = LPGENW("Request authorization");
mi.position = CMI_POSITION + CMI_AUTH_REQUEST;
mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
@@ -74,7 +74,7 @@ void CSkypeProto::InitMenus() // Grant authorization
mi.pszService = MODULE"/GrantAuth";
- mi.name.t = LPGENT("Grant authorization");
+ mi.name.w = LPGENW("Grant authorization");
mi.position = CMI_POSITION + CMI_AUTH_GRANT;
mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT);
SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30);
@@ -82,7 +82,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::OnGrantAuth>);
mi.pszService = MODULE"/GetHistory";
- mi.name.t = LPGENT("Get server history");
+ mi.name.w = LPGENW("Get server history");
mi.position = CMI_POSITION + CMI_GETSERVERHISTORY;
mi.hIcolibItem = GetIconHandle(IDI_SYNCHISTORY);
SET_UID(mi, 0xc9a64e98, 0x9257, 0x4b52, 0x98, 0xdd, 0x7f, 0x56, 0xb3, 0x90, 0xe3, 0xde);
@@ -90,7 +90,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GetContactHistory>);
mi.pszService = MODULE"/BlockContact";
- mi.name.t = LPGENT("Block contact");
+ mi.name.w = LPGENW("Block contact");
mi.position = CMI_POSITION + CMI_BLOCK;
mi.hIcolibItem = GetIconHandle(IDI_BLOCKUSER);
SET_UID(mi ,0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
@@ -98,7 +98,7 @@ void CSkypeProto::InitMenus() CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockContact>);
mi.pszService = MODULE"/UnblockContact";
- mi.name.t = LPGENT("Unblock contact");
+ mi.name.w = LPGENW("Unblock contact");
mi.position = CMI_POSITION + CMI_UNBLOCK;
mi.hIcolibItem = GetIconHandle(IDI_UNBLOCKUSER);
SET_UID(mi, 0x88542f43, 0x7448, 0x48d0, 0x81, 0xa3, 0x26, 0x0, 0x4f, 0x37, 0xee, 0xe0);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index cc9ac8e2ca..4d35393d12 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -290,14 +290,14 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const HXML xmlContact = xmlGetNthChild(xmlNode, L"c", i);
if (xmlContact != NULL)
{
- const TCHAR *tszContactId = xmlGetAttrValue(xmlContact, L"s");
- //const TCHAR *tszContactName = xmlGetAttrValue(xmlContact, L"f");
+ const wchar_t *tszContactId = xmlGetAttrValue(xmlContact, L"s");
+ //const wchar_t *tszContactName = xmlGetAttrValue(xmlContact, L"f");
psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
psr[nCount]->cbSize = sizeof(psr);
psr[nCount]->flags = PSR_TCHAR;
- psr[nCount]->id.t = mir_tstrdup(tszContactId);
- //psr[nCount]->nick.t = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName);
+ psr[nCount]->id.w = mir_tstrdup(tszContactId);
+ //psr[nCount]->nick.w = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName);
nCount++;
}
}
@@ -319,7 +319,7 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
for (DWORD i = 0; i < *((PDWORD)b); i++)
{
- mir_free(psr[i]->id.t);
+ mir_free(psr[i]->id.w);
mir_free(psr[i]);
}
mir_free(b);
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index fc6136012c..2026a509eb 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -72,11 +72,11 @@ int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInstance;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszGroup = LPGENW("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = CSkypeOptionsMain::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 49a7b40d60..65e5bb3487 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -2,7 +2,7 @@ void CSkypeProto::InitPopups()
{
- TCHAR desc[256];
+ wchar_t desc[256];
char name[256];
POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
@@ -47,7 +47,7 @@ void CSkypeProto::UninitPopups() }
}
-void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact, int type)
+void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact, int type)
{
if (Miranda_Terminated())
return;
@@ -75,8 +75,8 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, M }
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.ptszTitle = caption;
- ppd.ptszText = message;
+ ppd.pwszTitle = caption;
+ ppd.pwszText = message;
ppd.pszClassName = className.GetBuffer();
ppd.hContact = hContact;
@@ -88,7 +88,7 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, M }
}
-void CSkypeProto::ShowNotification(const TCHAR *message, MCONTACT hContact)
+void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact)
{
ShowNotification(_T(MODULE), message, hContact);
}
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index fff14b059f..2c4678a93a 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-std::map<std::tstring, std::tstring> CSkypeProto::languages;
+std::map<std::wstring, std::wstring> CSkypeProto::languages;
void CSkypeProto::InitLanguages()
{
- std::map<std::tstring, std::tstring> result;
+ std::map<std::wstring, std::wstring> result;
result[L"ab"] = L"Abkhazian";
result[L"aa"] = L"Afar";
result[L"af"] = L"Afrikaans";
@@ -288,7 +288,7 @@ void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact) {
CMString gender = root["gender"].as_mstring();
if (!gender.IsEmpty() && gender != "null")
- setByte(hContact, "Gender", (BYTE)(_ttoi(gender) == 1 ? 'M' : 'F'));
+ setByte(hContact, "Gender", (BYTE)(_wtoi(gender) == 1 ? 'M' : 'F'));
else
delSetting(hContact, "Gender");
}
@@ -299,7 +299,7 @@ void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact) if (!birthday.IsEmpty() && birthday != "null")
{
int d, m, y;
- _stscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d);
+ swscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d);
setWord(hContact, "BirthYear", y);
setByte(hContact, "BirthDay", d);
setByte(hContact, "BirthMonth", m);
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index a4ff764aef..cf003bdb17 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
+CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) :
PROTO<CSkypeProto>(protoName, userName),
m_PopupClasses(1),
m_InviteDialogs(1),
@@ -42,7 +42,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE);
CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP);
- m_tszAvatarFolder = std::tstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName;
+ m_tszAvatarFolder = std::wstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
@@ -114,7 +114,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) return 0;
}
-int CSkypeProto::SetAwayMsg(int, const TCHAR *msg)
+int CSkypeProto::SetAwayMsg(int, const wchar_t *msg)
{
PushRequest(new SetStatusMsgRequest(msg ? T2Utf(msg) : "", li));
return 0;
@@ -148,7 +148,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) MCONTACT hContact;
if (psr->flags & PSR_UNICODE)
- hContact = AddContact(T2Utf(psr->id.t));
+ hContact = AddContact(T2Utf(psr->id.w));
else
hContact = AddContact(psr->id.a);
@@ -186,7 +186,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent) return 0;
}
-int CSkypeProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)
+int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
MCONTACT hContact = GetContactFromAuthEvent(hDbEvent);
if (hContact == INVALID_CONTACT_ID)
@@ -201,7 +201,7 @@ int CSkypeProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) return Proto_AuthRecv(m_szModuleName, pre);
}
-int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
+int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage)
{
if (hContact == INVALID_CONTACT_ID)
return 1;
@@ -329,16 +329,16 @@ int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) //if (GetMessageFromDb(hContact, szMessageId, pre->timestamp)) return 0;
for (i = 0; i < nCount; i++)
- cbBlob += int(/*mir_tstrlen(isrList[i]->nick.t)*/0 + 2 + mir_tstrlen(isrList[i]->id.t) + mir_strlen(szMessageId));
+ cbBlob += int(/*mir_tstrlen(isrList[i]->nick.w)*/0 + 2 + mir_tstrlen(isrList[i]->id.w) + mir_strlen(szMessageId));
pBlob = (PBYTE)mir_calloc(cbBlob);
for (i = 0, pCurBlob = pBlob; i < nCount; i++)
{
- //mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.t));
+ //mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w));
pCurBlob += mir_strlen((PCHAR)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.t));
+ mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.w));
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 94f0aa43a6..37320a43d6 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -41,24 +41,24 @@ public: virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetStatus(int iNewStatus);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
// accounts
- static CSkypeProto* InitAccount(const char *protoName, const TCHAR *userName);
+ static CSkypeProto* InitAccount(const char *protoName, const wchar_t *userName);
static int UninitAccount(CSkypeProto *proto);
// icons
@@ -137,7 +137,7 @@ private: std::map<HANDLE, time_t> m_mpOutMessages;
std::map<std::string, std::string> cookies;
- static std::map<std::tstring, std::tstring> languages;
+ static std::map<std::wstring, std::wstring> languages;
HANDLE m_pollingConnection,
m_hPollingThread,
@@ -174,14 +174,14 @@ private: INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
- std::tstring m_tszAvatarFolder;
+ std::wstring m_tszAvatarFolder;
INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM);
INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM);
- int InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName);
+ int InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t *ptszFileName);
// requests
@@ -282,7 +282,7 @@ private: void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl);
void ReloadAvatarInfo(MCONTACT hContact);
- void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen);
+ void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen);
void OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg);
void OnSentAvatar(const NETLIBHTTPREQUEST *response);
@@ -339,17 +339,17 @@ private: INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM);
INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM);
- void StartChatRoom(const TCHAR *tid, const TCHAR *tname);
+ void StartChatRoom(const wchar_t *tid, const wchar_t *tname);
void OnLoadChats(const NETLIBHTTPREQUEST *response);
void OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p);
void OnChatEvent(const JSONNode &node);
- void OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage);
- char *GetChatUsers(const TCHAR *chat_id);
- bool IsChatContact(const TCHAR *chat_id, const char *id);
- void AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading = false);
- void AddChatContact(const TCHAR *tchat_id, const char *id, const char *name, const TCHAR *role, bool isChange = false);
- void RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = "");
+ void OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage);
+ char *GetChatUsers(const wchar_t *chat_id);
+ bool IsChatContact(const wchar_t *chat_id, const char *id);
+ void AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading = false);
+ void AddChatContact(const wchar_t *tchat_id, const char *id, const char *name, const wchar_t *role, bool isChange = false);
+ void RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = "");
void RenameChat(const char *chat_id, const char *name);
void ChangeChatTopic(const char * chat_id, const char *topic, const char *initiator);
@@ -389,9 +389,9 @@ private: static int SkypeToMirandaStatus(const char *status);
static const char *MirandaToSkypeStatus(int status);
- void ShowNotification(const TCHAR *message, MCONTACT hContact = NULL);
- void ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact = NULL, int type = 0);
- static bool IsFileExists(std::tstring path);
+ void ShowNotification(const wchar_t *message, MCONTACT hContact = NULL);
+ void ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact = NULL, int type = 0);
+ static bool IsFileExists(std::wstring path);
static LRESULT CALLBACK PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 7c7637abdc..427cab89ad 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE CSkypeProto::SearchBasic(const TCHAR* id)
+HANDLE CSkypeProto::SearchBasic(const wchar_t* id)
{
ForkThread(&CSkypeProto::SearchBasicThread, (void *)id);
return (HANDLE)1;
@@ -28,7 +28,7 @@ void CSkypeProto::SearchBasicThread(void* id) debugLogA("CSkypeProto::OnSearchBasicThread");
if (IsOnline())
{
- ptrA szString(mir_urlEncode(T2Utf((TCHAR*)id)));
+ ptrA szString(mir_urlEncode(T2Utf((wchar_t*)id)));
SendRequest(new GetSearchRequest(szString, li), &CSkypeProto::OnSearch);
}
}
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 58d0ad84e4..42fe0bf575 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -32,7 +32,7 @@ time_t CSkypeProto::IsoToUnixTime(const char *stamp) // skip '-' chars
int si = 0, sj = 0;
while (true) {
- if (p[si] == _T('-'))
+ if (p[si] == '-')
si++;
else if (!(p[sj++] = p[si++]))
break;
@@ -426,9 +426,9 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) return ID_STATUS_OFFLINE;
}
-bool CSkypeProto::IsFileExists(std::tstring path)
+bool CSkypeProto::IsFileExists(std::wstring path)
{
- return _taccess(path.c_str(), 0) == 0;
+ return _waccess(path.c_str(), 0) == 0;
}
// url parsing
@@ -480,14 +480,14 @@ CMStringA CSkypeProto::GetServerFromUrl(const char *url) INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam)
{
- TCHAR *arg = (TCHAR *)lParam;
+ wchar_t *arg = (wchar_t *)lParam;
if (arg == NULL)
return 1;
// skip leading prefix
- TCHAR szUri[1024];
- _tcsncpy_s(szUri, arg, _TRUNCATE);
- TCHAR *szJid = _tcschr(szUri, _T(':'));
+ wchar_t szUri[1024];
+ wcsncpy_s(szUri, arg, _TRUNCATE);
+ wchar_t *szJid = wcschr(szUri, ':');
if (szJid == NULL)
return 1;
@@ -496,13 +496,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) return 1;
// command code
- TCHAR *szCommand = szJid;
- szCommand = _tcschr(szCommand, _T('?'));
+ wchar_t *szCommand = szJid;
+ szCommand = wcschr(szCommand, '?');
if (szCommand)
*(szCommand++) = 0;
// parameters
- TCHAR *szSecondParam = szCommand ? _tcschr(szCommand, _T('&')) : NULL;
+ wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : NULL;
if (szSecondParam)
*(szSecondParam++) = 0;
@@ -511,7 +511,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) {
if (szSecondParam)
{
- TCHAR *szChatId = _tcsstr(szSecondParam, L"id=");
+ wchar_t *szChatId = wcsstr(szSecondParam, L"id=");
if (szChatId)
{
szChatId += 5;
@@ -537,8 +537,8 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
- psr.id.t = mir_tstrdup(szJid);
- psr.nick.t = mir_tstrdup(szJid);
+ psr.id.w = mir_tstrdup(szJid);
+ psr.nick.w = mir_tstrdup(szJid);
psr.flags = PSR_UNICODE;
ADDCONTACTSTRUCT acs = { 0 };
diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index afb15d7d91..45e57d6311 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -97,8 +97,8 @@ struct CFileUploadParam : public MZeroedObject { size_t size;
MCONTACT hContact;
- __forceinline CFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {};
- __forceinline bool IsAccess() { return ::_taccess(tszFileName, 0) == 0; }
+ __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {};
+ __forceinline bool IsAccess() { return ::_waccess(tszFileName, 0) == 0; }
};
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 4f33cf6d1a..005f61f945 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -191,6 +191,7 @@ public: #define MODULE "Skype"
+#define MODULEW L"Skype"
#define SKYPE_MAX_CONNECT_RETRIES 10
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index 44e3dfc893..2ebe847089 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -41,6 +41,7 @@ #include "version.h"
#define MODULE "Steam"
+#define MODULEW L"Steam"
#define STEAM_API_TIMEOUT 30
#define STEAM_API_IDLEOUT_AWAY 600
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index ad2348463d..8b852a8fed 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -1,8 +1,8 @@ #include "stdafx.h"
-TCHAR* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
+wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
@@ -24,7 +24,7 @@ bool CSteamProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai) if (!path)
return false;
- _tcsncpy_s(pai.filename, path, _TRUNCATE);
+ wcsncpy_s(pai.filename, path, _TRUNCATE);
pai.format = PA_FORMAT_JPEG;
return true;
@@ -68,7 +68,7 @@ INT_PTR CSteamProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (GetDbAvatarInfo(*pai))
{
- bool fileExist = _taccess(pai->filename, 0) == 0;
+ bool fileExist = _waccess(pai->filename, 0) == 0;
bool needLoad;
if (pai->hContact)
@@ -141,13 +141,13 @@ INT_PTR CSteamProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (!wParam || !lParam)
return -3;
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
PROTO_AVATAR_INFORMATION ai = { 0 };
switch (GetAvatarInfo(0, (LPARAM)&ai)) {
case GAIR_SUCCESS:
- _tcsncpy(buf, ai.filename, size);
+ wcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
return 0;
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index de1253ad2e..3cbdb66c21 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -110,11 +110,11 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) node = json_get(data, "realname"); if (node != NULL) { - std::tstring realname = (TCHAR*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(L' ', 1); - if (pos != std::tstring::npos) + if (pos != std::wstring::npos) { setTString(hContact, "FirstName", realname.substr(0, pos).c_str()); setTString(hContact, "LastName", realname.substr(pos + 1).c_str()); @@ -265,7 +265,7 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) SetContactStatus(hContact, ID_STATUS_OFFLINE); ptrT nick(getTStringA(hContact, "Nick")); - TCHAR message[MAX_PATH]; + wchar_t message[MAX_PATH]; mir_sntprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); ShowNotification(L"Steam", message); @@ -283,7 +283,7 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact) delSetting(hContact, "Grant"); ptrT nick(getTStringA(hContact, "Nick")); - TCHAR message[MAX_PATH]; + wchar_t message[MAX_PATH]; mir_sntprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); ShowNotification(L"Steam", message); @@ -602,7 +602,7 @@ void CSteamProto::OnGotAvatar(const HttpResponse *response, void *arg) return; } - FILE *fp = _tfopen(ai.filename, L"wb"); + FILE *fp = _wfopen(ai.filename, L"wb"); if (fp) { fwrite(response->pData, sizeof(char), response->dataLength, fp); @@ -763,25 +763,25 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) ssr.hdr.flags = PSR_TCHAR; node = json_get(child, "steamid"); - ssr.hdr.id.t = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.id.w = mir_tstrdup(ptrT(json_as_string(node))); node = json_get(child, "personaname"); - ssr.hdr.nick.t = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.nick.w = mir_tstrdup(ptrT(json_as_string(node))); node = json_get(child, "realname"); if (node != NULL) { - std::tstring realname = (TCHAR*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(' ', 1); - if (pos != std::tstring::npos) + if (pos != std::wstring::npos) { - ssr.hdr.firstName.t = mir_tstrdup(realname.substr(0, pos).c_str()); - ssr.hdr.lastName.t = mir_tstrdup(realname.substr(pos + 1).c_str()); + ssr.hdr.firstName.w = mir_tstrdup(realname.substr(0, pos).c_str()); + ssr.hdr.lastName.w = mir_tstrdup(realname.substr(pos + 1).c_str()); } else - ssr.hdr.firstName.t = mir_tstrdup(realname.c_str()); + ssr.hdr.firstName.w = mir_tstrdup(realname.c_str()); } } diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp index c416cbd957..9caa7091b9 100644 --- a/protocols/Steam/src/steam_events.cpp +++ b/protocols/Steam/src/steam_events.cpp @@ -34,15 +34,15 @@ int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszGroup = LPGENT("Network"); + odp.pwszGroup = LPGENW("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszTab = LPGENW("Account"); odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Blocked contacts"); + odp.pwszTab = LPGENW("Blocked contacts"); odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this); Options_AddPage(wParam, &odp); return 0; diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index 75e40a5674..8a16ee5bf3 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -28,13 +28,13 @@ void CSteamProto::OnGotConversations(const HttpResponse *response) JSONNode *session = json_at(nsessions, i); node = json_get(session, "accountid_friend"); - const char *who = AccountIdToSteamId(_ttoi64(ptrT(json_as_string(node)))); + const char *who = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); node = json_get(session, "last_message"); - time_t lastMessageTS = _ttoi64(ptrT(json_as_string(node))); + time_t lastMessageTS = _wtoi64(ptrT(json_as_string(node))); /*node = json_get(session, "last_view"); - time_t last_view = _ttoi64(ptrT(json_as_string(node))); + time_t last_view = _wtoi64(ptrT(json_as_string(node))); node = json_get(session, "unread_message_count"); long unread_count = json_as_int(node);*/ @@ -79,14 +79,14 @@ void CSteamProto::OnGotHistoryMessages(const HttpResponse *response, void *arg) JSONNode *message = json_at(nmessages, i - 1); node = json_get(message, "accountid"); - const char *authorSteamId = AccountIdToSteamId(_ttoi64(ptrT(json_as_string(node)))); + const char *authorSteamId = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); node = json_get(message, "message"); ptrT text(json_as_string(node)); T2Utf szMessage(text); node = json_get(message, "timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); // Ignore already existing messages if (timestamp <= m_lastMessageTS) diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index fd8d7399f7..15fb3d6483 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -383,7 +383,7 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) if (m_lastMessageTS <= 0) { node = json_get(root, "utc_timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); setDword("LastMessageTS", timestamp); } diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index e2c4fcd5b7..c6252dc81b 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -103,7 +103,7 @@ void CSteamProto::OnInitStatusMenu() // Show block list
mi.pszService = "/BlockList";
CreateProtoService(mi.pszService, &CSteamProto::OpenBlockListCommand);
- mi.name.t = LPGENT("Blocked contacts");
+ mi.name.w = LPGENW("Blocked contacts");
mi.position = 200000 + SMI_BLOCKED_LIST;
Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
@@ -120,7 +120,7 @@ void CSteamProto::InitMenus() // "Request authorization"
SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
mi.pszService = MODULE "/AuthRequest";
- mi.name.t = LPGENT("Request authorization");
+ mi.name.w = LPGENW("Request authorization");
mi.position = -201001000 + CMI_AUTH_REQUEST;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
contactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
@@ -129,7 +129,7 @@ void CSteamProto::InitMenus() // "Block"
SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
mi.pszService = MODULE "/Block";
- mi.name.t = LPGENT("Block");
+ mi.name.w = LPGENW("Block");
mi.position = -201001001 + CMI_BLOCK;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
contactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
@@ -140,7 +140,7 @@ void CSteamProto::InitMenus() // "Join to game"
SET_UID(mi, 0x1a6aaab7, 0xba31, 0x4b47, 0x8e, 0xce, 0xf8, 0x8e, 0xf4, 0x62, 0x4f, 0xd7);
mi.pszService = MODULE "/JoinToGame";
- mi.name.t = LPGENT("Join to game");
+ mi.name.w = LPGENW("Join to game");
mi.position = -200001000 + CMI_JOIN_GAME;
mi.hIcolibItem = NULL;
contactMenuItems[CMI_JOIN_GAME] = Menu_AddContactMenuItem(&mi);
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp index 66bc247ea8..00f933a804 100644 --- a/protocols/Steam/src/steam_options.cpp +++ b/protocols/Steam/src/steam_options.cpp @@ -25,7 +25,7 @@ void CSteamOptionsMain::OnInitDialog() void CSteamOptionsMain::OnApply()
{
- TCHAR *group = m_group.GetText();
+ wchar_t *group = m_group.GetText();
if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 9958bd334c..22896647d8 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -35,7 +35,7 @@ void CSteamProto::ParsePollData(JSONNode *data) PROTORECVEVENT recv = { 0 }; recv.timestamp = timestamp; recv.szMessage = szMessage; - if (_tcsstr(type, L"my_") == NULL) + if (wcsstr(type, L"my_") == NULL) { ProtoChainRecvMsg(hContact, &recv); } @@ -223,7 +223,7 @@ void CSteamProto::PollingThread(void*) { // Remember last message timestamp node = json_get(root, "utc_timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); if (timestamp > getDword("LastMessageTS", 0)) setDword("LastMessageTS", timestamp); diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index a6aacedd65..9eadb0fb42 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) +CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) : PROTO<CSteamProto>(protoName, userName), hAuthProcess(1), hMessageProcess(1) { @@ -18,22 +18,22 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) GetModuleFileName(g_hInstance, filePath, MAX_PATH); wchar_t sectionName[100]; - mir_sntprintf(sectionName, L"%s/%s", LPGENT("Protocols"), LPGENT(MODULE)); + mir_sntprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); char settingName[100]; mir_snprintf(settingName, "%s_%s", MODULE, "main"); SKINICONDESC sid = { 0 }; sid.flags = SIDF_ALL_TCHAR; - sid.defaultFile.t = filePath; + sid.defaultFile.w = filePath; sid.pszName = settingName; - sid.section.t = sectionName; - sid.description.t = LPGENT("Protocol icon"); + sid.section.w = sectionName; + sid.description.w = LPGENW("Protocol icon"); sid.iDefaultIndex = -IDI_STEAM; IcoLib_AddIcon(&sid); mir_snprintf(settingName, "%s_%s", MODULE, "gaming"); - sid.description.t = LPGENT("Gaming icon"); + sid.description.w = LPGENW("Gaming icon"); sid.iDefaultIndex = -IDI_GAMING; IcoLib_AddIcon(&sid); @@ -65,7 +65,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) CreateProtoService(STEAM_DB_GETEVENTTEXT_CHATSTATES, &CSteamProto::OnGetEventTextChatStates); // netlib support - TCHAR name[128]; + wchar_t name[128]; mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; @@ -85,7 +85,7 @@ CSteamProto::~CSteamProto() MCONTACT CSteamProto::AddToList(int, PROTOSEARCHRESULT* psr) { MCONTACT hContact = NULL; - ptrA steamId(mir_u2a(psr->id.t)); + ptrA steamId(mir_u2a(psr->id.w)); if (psr->cbSize == sizeof(PROTOSEARCHRESULT)) { if (!FindContact(steamId)) @@ -136,7 +136,7 @@ int CSteamProto::Authorize(MEVENT hDbEvent) return 1; } -int CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CSteamProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { if (IsOnline() && hDbEvent) { @@ -162,7 +162,7 @@ int CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) return 1; } -int CSteamProto::AuthRequest(MCONTACT hContact, const TCHAR*) +int CSteamProto::AuthRequest(MCONTACT hContact, const wchar_t*) { if (IsOnline() && hContact) { @@ -222,7 +222,7 @@ DWORD_PTR CSteamProto:: GetCaps(int type, MCONTACT) } } -HANDLE CSteamProto::SearchBasic(const TCHAR* id) +HANDLE CSteamProto::SearchBasic(const wchar_t* id) { if (!this->IsOnline()) return 0; @@ -238,13 +238,13 @@ HANDLE CSteamProto::SearchBasic(const TCHAR* id) return (HANDLE)STEAM_SEARCH_BYID; } -HANDLE CSteamProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) +HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { if (!this->IsOnline()) return 0; // Combine all fields to single text - TCHAR keywordsT[200]; + wchar_t keywordsT[200]; mir_sntprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); ptrA token(getStringA("TokenSecret")); diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 672f500451..812f88051e 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -46,13 +46,13 @@ public: virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR * szMessage);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t * szMessage);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
- virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
@@ -74,7 +74,7 @@ public: static void UninitMenus();
protected:
- TCHAR *password;
+ wchar_t *password;
bool isLoginAgain;
time_t m_idleTS;
HANDLE m_evRequestsQueue, m_hQueueThread;
@@ -192,7 +192,7 @@ protected: void OnInitStatusMenu();
// avatars
- TCHAR* GetAvatarFilePath(MCONTACT hContact);
+ wchar_t* GetAvatarFilePath(MCONTACT hContact);
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai);
void CheckAvatarChange(MCONTACT hContact, std::string avatarUrl);
@@ -223,8 +223,8 @@ protected: static int RsaEncrypt(const char *pszModulus, const char *data, BYTE *encrypted, DWORD &encryptedSize);
- static void CSteamProto::ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
- static void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static void CSteamProto::ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
INT_PTR __cdecl OnGetEventTextChatStates(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index c45440cb10..264afff378 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -159,7 +159,7 @@ exit: return 0;
}
-void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags, MCONTACT hContact)
+void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
{
if (Miranda_Terminated())
return;
@@ -179,9 +179,9 @@ void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, MessageBox(NULL, message, caption, MB_OK | flags);
}
-void CSteamProto::ShowNotification(const TCHAR *message, int flags, MCONTACT hContact)
+void CSteamProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
{
- ShowNotification(TranslateT(MODULE), message, flags, hContact);
+ ShowNotification(MODULEW, message, flags, hContact);
}
INT_PTR __cdecl CSteamProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam)
diff --git a/protocols/Tlen/src/stdafx.h b/protocols/Tlen/src/stdafx.h index 9341656dc3..d0b6031d7a 100644 --- a/protocols/Tlen/src/stdafx.h +++ b/protocols/Tlen/src/stdafx.h @@ -204,7 +204,7 @@ struct TLEN_VOICE_CONTROL_STRUCT; struct TlenProtocol : public PROTO<TlenProtocol>
{
- TlenProtocol( const char*, const TCHAR* );
+ TlenProtocol( const char*, const wchar_t* );
~TlenProtocol();
//====================================================================================
@@ -215,23 +215,23 @@ struct TlenProtocol : public PROTO<TlenProtocol> virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR* email);
- virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t* email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode);
@@ -239,7 +239,7 @@ struct TlenProtocol : public PROTO<TlenProtocol> virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt);
- virtual int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -416,7 +416,7 @@ typedef struct { typedef struct {
int id;
- TCHAR *name;
+ wchar_t *name;
} TLEN_FIELD_MAP;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index e7ce5b729b..d0bfbce5f4 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -335,7 +335,7 @@ void TlenProtocol::initMenuItems() hMenuContactGrantAuth = Menu_AddContactMenuItem(&mi, m_szModuleName);
}
-TlenProtocol* tlenProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+TlenProtocol* tlenProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
TlenProtocol* ppro = new TlenProtocol(pszProtoName, tszUserName);
return ppro;
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 19466f5c10..47645f8bb8 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -31,16 +31,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* TlenGetAvatarFileName() - gets a file name for the avatar image */ -void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* ptszDest, int cbLen) +void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* ptszDest, int cbLen) { int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); - if (_taccess(ptszDest, 0)) { + if (_waccess(ptszDest, 0)) { int ret = CreateDirectoryTreeT(ptszDest); if (ret == 0) proto->debugLog(L"getAvatarFilename(): Created new directory for avatar cache: %s.", ptszDest); else { proto->debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", ptszDest, errno, strerror(errno)); - TCHAR buffer[512]; + wchar_t buffer[512]; mir_sntprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest); PUShowMessageT(buffer, SM_WARNING); } @@ -56,7 +56,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts else format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN); - const TCHAR *tszFileType = ProtoGetAvatarExtension(format); + const wchar_t *tszFileType = ProtoGetAvatarExtension(format); if (item != NULL) mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); else @@ -65,7 +65,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) { - TCHAR tFileName[MAX_PATH]; + wchar_t tFileName[MAX_PATH]; if (hContact == NULL) proto->threadData->avatarHash[0] = '\0'; @@ -79,7 +79,7 @@ static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) { - TCHAR filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; char md5[33]; mir_md5_state_t ctx; DWORD digest[4]; @@ -104,7 +104,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it } TlenGetAvatarFileName(proto, item, filename, _countof(filename) - 1); DeleteFile(filename); - FILE *out = _tfopen(filename, TEXT("wb")); + FILE *out = _wfopen(filename, TEXT("wb")); if (out != NULL) { fwrite(data, len, 1, out); fclose(out); @@ -113,7 +113,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format); } else { - TCHAR buffer[128]; + wchar_t buffer[128]; mir_sntprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); proto->debugLog(buffer); diff --git a/protocols/Tlen/src/tlen_avatar.h b/protocols/Tlen/src/tlen_avatar.h index 5de5d482a6..d994713a54 100644 --- a/protocols/Tlen/src/tlen_avatar.h +++ b/protocols/Tlen/src/tlen_avatar.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITEM *item);
int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_ITEM *item);
-void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* psztDest, int cbLen);
+void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* psztDest, int cbLen);
void TlenGetAvatar(TlenProtocol *proto, MCONTACT hContact);
void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access);
void TlenRemoveAvatar(TlenProtocol *proto);
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index d43ff1d153..48baafe6d1 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -583,13 +583,13 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
if (szFilename[0] != '\0' && ft->iqId != NULL) {
- TCHAR* filenameT = mir_utf8decodeT((char*)szFilename);
+ wchar_t* filenameT = mir_utf8decodeT((char*)szFilename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = filenameT;
- pre.files.t = &filenameT;
+ pre.descr.w = filenameT;
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 810c3b9f66..364bca28c2 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -429,47 +429,47 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) mir_snprintf(jsr.jid, "%s@%s", jid, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid) - 1] = '\0';
- jsr.hdr.id.t = mir_a2t(jid);
+ jsr.hdr.id.w = mir_a2t(jid);
if ((n = TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.nick.t = mir_a2t(buf);
+ jsr.hdr.nick.w = mir_a2t(buf);
mir_free(buf);
}
else {
- jsr.hdr.nick.t = mir_tstrdup(TEXT(""));
+ jsr.hdr.nick.w = mir_tstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.firstName.t = mir_a2t(buf);
+ jsr.hdr.firstName.w = mir_a2t(buf);
mir_free(buf);
}
else {
- jsr.hdr.firstName.t = mir_tstrdup(TEXT(""));
+ jsr.hdr.firstName.w = mir_tstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.lastName.t = mir_a2t(buf);
+ jsr.hdr.lastName.w = mir_a2t(buf);
mir_free(buf);
}
else {
- jsr.hdr.lastName.t = mir_tstrdup(TEXT(""));
+ jsr.hdr.lastName.w = mir_tstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "email")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.email.t = mir_a2t(buf);
+ jsr.hdr.email.w = mir_a2t(buf);
mir_free(buf);
}
else {
- jsr.hdr.email.t = mir_tstrdup(TEXT(""));
+ jsr.hdr.email.w = mir_tstrdup(TEXT(""));
}
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
found = 1;
- mir_free(jsr.hdr.id.t);
- mir_free(jsr.hdr.nick.t);
- mir_free(jsr.hdr.firstName.t);
- mir_free(jsr.hdr.lastName.t);
- mir_free(jsr.hdr.email.t);
+ mir_free(jsr.hdr.id.w);
+ mir_free(jsr.hdr.nick.w);
+ mir_free(jsr.hdr.firstName.w);
+ mir_free(jsr.hdr.lastName.w);
+ mir_free(jsr.hdr.email.w);
}
}
}
@@ -480,7 +480,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) else
mir_snprintf(jsr.jid, "%s@%s", proto->searchJID, dbv.pszVal);
- jsr.hdr.nick.t = jsr.hdr.firstName.t = jsr.hdr.lastName.t = jsr.hdr.email.t = jsr.hdr.id.t = TEXT("");
+ jsr.hdr.nick.w = jsr.hdr.firstName.w = jsr.hdr.lastName.w = jsr.hdr.email.w = jsr.hdr.id.w = TEXT("");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
}
mir_free(proto->searchJID);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index e3058a8526..abaaa4e584 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -35,14 +35,14 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, typedef struct TabDefStruct { DLGPROC dlgProc; DWORD dlgId; - TCHAR *tabName; + wchar_t *tabName; } TabDef; static TabDef tabPages[] = { - {TlenBasicOptDlgProc, IDD_OPTIONS_BASIC, LPGENT("General")}, - {TlenVoiceOptDlgProc, IDD_OPTIONS_VOICE, LPGENT("Voice Chats")}, - {TlenAdvOptDlgProc, IDD_OPTIONS_ADVANCED, LPGENT("Advanced")}, - {TlenPopupsDlgProc, IDD_OPTIONS_POPUPS, LPGENT("Notifications")} + {TlenBasicOptDlgProc, IDD_OPTIONS_BASIC, LPGENW("General")}, + {TlenVoiceOptDlgProc, IDD_OPTIONS_VOICE, LPGENW("Voice Chats")}, + {TlenAdvOptDlgProc, IDD_OPTIONS_ADVANCED, LPGENW("Advanced")}, + {TlenPopupsDlgProc, IDD_OPTIONS_POPUPS, LPGENW("Notifications")} }; void TlenLoadOptions(TlenProtocol *proto) @@ -86,14 +86,14 @@ int TlenProtocol::OptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = m_tszUserName; + odp.pwszGroup = LPGENW("Network"); + odp.pwszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.dwInitParam = (LPARAM)this; for (int i = 0; i < _countof(tabPages); i++) { odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId); odp.pfnDlgProc = tabPages[i].dlgProc; - odp.ptszTab = tabPages[i].tabName; + odp.pwszTab = tabPages[i].tabName; Options_AddPage(wParam, &odp); } return 0; @@ -594,7 +594,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, #define POPUP_DEFAULT_COLORBKG 0xDCBDA5 #define POPUP_DEFAULT_COLORTXT 0x000000 -static void MailPopupPreview(DWORD colorBack, DWORD colorText, TCHAR *title, TCHAR *emailInfo, int delay) +static void MailPopupPreview(DWORD colorBack, DWORD colorText, wchar_t *title, wchar_t *emailInfo, int delay) { if (!ServiceExists(MS_POPUP_ADDPOPUPT)) return; @@ -602,8 +602,8 @@ static void MailPopupPreview(DWORD colorBack, DWORD colorText, TCHAR *title, TCH HICON hIcon = GetIcolibIcon(IDI_MAIL); ppd.lchIcon = CopyIcon(hIcon); ReleaseIcolibIcon(hIcon); - _tcsncpy(ppd.lptzContactName, title, MAX_CONTACTNAME-1); - _tcsncpy(ppd.lptzText, emailInfo,MAX_SECONDLINE-1); + wcsncpy(ppd.lptzContactName, title, MAX_CONTACTNAME-1); + wcsncpy(ppd.lptzText, emailInfo,MAX_SECONDLINE-1); ppd.colorBack = colorBack; ppd.colorText = colorText; ppd.iSeconds = delay; @@ -648,7 +648,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_PREVIEW: { int delay; - TCHAR title[256]; + wchar_t title[256]; if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_POPUP)) { delay=0; } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 6afb490b0d..5cc872a3bb 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -260,13 +260,13 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { char fileInfo[128];
item->ft = ft;
mir_snprintf(fileInfo, "%s file(s), %s bytes", c, s);
- TCHAR* filenameT = mir_utf8decodeT((char*)fileInfo);
+ wchar_t* filenameT = mir_utf8decodeT((char*)fileInfo);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = filenameT;
- pre.files.t = &filenameT;
+ pre.descr.w = filenameT;
+ pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index a4d77111ca..14b15ad15c 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -250,7 +250,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char *jid = dbv.pszVal;
- TCHAR tszFilter[512], tszFileName[MAX_PATH];
+ wchar_t tszFilter[512], tszFileName[MAX_PATH];
Bitmap_GetFilter(tszFilter, _countof(tszFilter));
tszFileName[0] = '\0';
@@ -263,7 +263,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { ofn.Flags = OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn)) {
long size;
- FILE* fp = _tfopen(tszFileName, L"rb");
+ FILE* fp = _wfopen(tszFileName, L"rb");
if (fp) {
fseek(fp, 0, SEEK_END);
size = ftell(fp);
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 9ce4fc360e..91d4d18ee4 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -86,7 +86,7 @@ void TlenResetSearchQuery(TlenProtocol *proto) { proto->searchID = TlenSerialNext(proto);
}
-HANDLE TlenProtocol::SearchBasic(const TCHAR* id)
+HANDLE TlenProtocol::SearchBasic(const wchar_t* id)
{
int iqId = 0;
if (!isOnline) return 0;
@@ -104,7 +104,7 @@ HANDLE TlenProtocol::SearchBasic(const TCHAR* id) return (HANDLE)iqId;
}
-HANDLE TlenProtocol::SearchByEmail(const TCHAR* email)
+HANDLE TlenProtocol::SearchByEmail(const wchar_t* email)
{
int iqId = 0;
@@ -123,7 +123,7 @@ HANDLE TlenProtocol::SearchByEmail(const TCHAR* email) return (HANDLE)iqId;
}
-HANDLE TlenProtocol::SearchByName(const TCHAR* nickT, const TCHAR* firstNameT, const TCHAR* lastNameT)
+HANDLE TlenProtocol::SearchByName(const wchar_t* nickT, const wchar_t* firstNameT, const wchar_t* lastNameT)
{
if (!isOnline) return 0;
@@ -310,7 +310,7 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) return 0;
}
-int TlenProtocol::AuthDeny(MEVENT hDbEvent, const TCHAR*)
+int TlenProtocol::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
if (!isOnline)
return 1;
@@ -413,7 +413,7 @@ INT_PTR TlenProtocol::GetStatus(WPARAM, LPARAM) return m_iStatus;
}
-int TlenProtocol::SetAwayMsg(int iStatus, const TCHAR* msg)
+int TlenProtocol::SetAwayMsg(int iStatus, const wchar_t* msg)
{
char **szMsg;
char *newModeMsg;
@@ -716,12 +716,12 @@ int TlenProtocol::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*) return 0;
}
-HANDLE TlenProtocol::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE TlenProtocol::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
if (!isOnline) return 0;
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)hTransfer;
- ft->szSavePath = mir_strdup(mir_t2a(szPath)); //TODO convert to TCHAR*
+ ft->szSavePath = mir_strdup(mir_t2a(szPath)); //TODO convert to wchar_t*
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, ft->iqId);
if (item != NULL) {
item->ft = ft;
@@ -737,7 +737,7 @@ HANDLE TlenProtocol::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath) return (HANDLE)hTransfer;
}
-int TlenProtocol::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*)
+int TlenProtocol::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
{
if (!isOnline) return 1;
@@ -754,7 +754,7 @@ int TlenProtocol::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*) return 0;
}
-int TlenProtocol::FileResume(HANDLE, int*, const TCHAR**)
+int TlenProtocol::FileResume(HANDLE, int*, const wchar_t**)
{
return 0;
}
@@ -779,7 +779,7 @@ int TlenProtocol::FileCancel(MCONTACT, HANDLE hTransfer) return 0;
}
-HANDLE TlenProtocol::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
int i, j;
struct _stat statbuf;
@@ -1043,7 +1043,7 @@ int TlenProtocol::UserIsTyping(MCONTACT hContact, int type) INT_PTR TlenProtocol::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
if (buf == NULL || size <= 0)
return -1;
@@ -1084,8 +1084,8 @@ INT_PTR TlenProtocol::SetMyAvatar(WPARAM, LPARAM lParam) PUShowMessageT(TranslateT("You need to be connected to Tlen account to set avatar."), SM_WARNING);
return 1;
}
- TCHAR* szFileName = (TCHAR*)lParam;
- TCHAR tFileName[MAX_PATH];
+ wchar_t* szFileName = (wchar_t*)lParam;
+ wchar_t tFileName[MAX_PATH];
if (szFileName != NULL) {
int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_CHANGEAVATAR), NULL, TlenChangeAvatarDlgProc, (LPARAM)NULL);
TlenGetAvatarFileName(this, NULL, tFileName, MAX_PATH);
@@ -1173,7 +1173,7 @@ void TlenInitServicesVTbl(TlenProtocol *proto) proto->CreateProtoService(PS_CREATEACCMGRUI, &TlenProtocol::AccMgrUI);
}
-TlenProtocol::TlenProtocol(const char *aProtoName, const TCHAR *aUserName) :
+TlenProtocol::TlenProtocol(const char *aProtoName, const wchar_t *aUserName) :
PROTO<TlenProtocol>(aProtoName, aUserName)
{
TlenInitServicesVTbl(this);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 77dac550d6..f0cc77fd33 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -1069,8 +1069,8 @@ static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo) POPUPDATAT ppd = { 0 };
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
- _tcsncpy(ppd.lptzContactName, _A2T(title), MAX_CONTACTNAME -1);
- _tcsncpy(ppd.lptzText, _A2T(emailInfo), MAX_SECONDLINE - 1);
+ wcsncpy(ppd.lptzContactName, _A2T(title), MAX_CONTACTNAME -1);
+ wcsncpy(ppd.lptzText, _A2T(emailInfo), MAX_SECONDLINE - 1);
ppd.colorBack = db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", 0);
ppd.colorText = db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", 0);
BYTE delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 04ca98b5aa..c361120161 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -139,7 +139,7 @@ int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = TlenUserInfoDlgProc;
odp.position = -2000000000;
odp.pszTemplate = ((HANDLE)lParam != NULL) ? MAKEINTRESOURCEA(IDD_USER_INFO):MAKEINTRESOURCEA(IDD_USER_VCARD);
- odp.ptszTitle = (hContact != NULL) ? LPGENT("Account") : m_tszUserName;
+ odp.pwszTitle = (hContact != NULL) ? LPGENW("Account") : m_tszUserName;
odp.dwInitParam = (LPARAM)this;
UserInfo_AddPage(wParam, &odp);
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 10d7042ae9..88fbf0681e 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -27,7 +27,7 @@ BOOL TlenWsInit(TlenProtocol *proto) {
NETLIBUSER nlu = {0};
NETLIBUSERSETTINGS nlus = {0};
- TCHAR name[128];
+ wchar_t name[128];
nlu.cbSize = sizeof(nlu);
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h index a2de2a5528..9f37777cc5 100644 --- a/protocols/Tox/src/stdafx.h +++ b/protocols/Tox/src/stdafx.h @@ -69,6 +69,7 @@ struct CToxProto; extern HINSTANCE g_hInstance;
#define MODULE "Tox"
+#define MODULEW L"Tox"
#define TOX_ERROR -1
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index f4a2ad222d..0c4cea1a40 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -45,9 +45,9 @@ int CToxProto::OnAccountRenamed(WPARAM, LPARAM) mir_cslock locker(profileLock);
ptrT newPath(GetToxProfilePath());
- TCHAR oldPath[MAX_PATH];
+ wchar_t oldPath[MAX_PATH];
mir_sntprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
- _trename(oldPath, newPath);
+ _wrename(oldPath, newPath);
mir_free(accountName);
accountName = mir_tstrdup(m_tszUserName);
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index b62328ae11..252f9f6a18 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -1,8 +1,8 @@ #include "stdafx.h"
-TCHAR* CToxProto::GetAvatarFilePath(MCONTACT hContact)
+wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
- TCHAR *path = (TCHAR*)mir_calloc(MAX_PATH * sizeof(TCHAR) + 1);
+ wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
@@ -22,9 +22,9 @@ TCHAR* CToxProto::GetAvatarFilePath(MCONTACT hContact) return path;
}
-void CToxProto::SetToxAvatar(const TCHAR* path)
+void CToxProto::SetToxAvatar(const wchar_t* path)
{
- FILE *hFile = _tfopen(path, L"rb");
+ FILE *hFile = _wfopen(path, L"rb");
if (!hFile)
{
debugLogA(__FUNCTION__": failed to open avatar file");
@@ -96,7 +96,7 @@ void CToxProto::SetToxAvatar(const TCHAR* path) transfer->pfts.flags |= PFTS_SENDING;
memcpy(transfer->hash, hash, TOX_HASH_LENGTH);
transfer->pfts.hContact = hContact;
- transfer->hFile = _tfopen(path, L"rb");
+ transfer->hFile = _wfopen(path, L"rb");
transfers.Add(transfer);
}
}
@@ -150,7 +150,7 @@ INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) {
ptrT path(GetAvatarFilePath());
if (IsFileExists(path))
- mir_tstrncpy((TCHAR*)wParam, path, (int)lParam);
+ mir_tstrncpy((wchar_t*)wParam, path, (int)lParam);
return 0;
}
@@ -158,7 +158,7 @@ INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
debugLogA(__FUNCTION__": setting avatar");
- TCHAR *path = (TCHAR*)lParam;
+ wchar_t *path = (wchar_t*)lParam;
ptrT avatarPath(GetAvatarFilePath());
if (path != NULL)
{
@@ -230,7 +230,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) db_free(&dbv);
}
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
OnFileAllow(transfer->pfts.hContact, transfer, path);
}
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index 59580431a3..f0a538fb5c 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -28,7 +28,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
- TCHAR title[MAX_PATH];
+ wchar_t title[MAX_PATH];
mir_sntprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
setTString(hContact, "Nick", title);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index c834e43ad0..a78d6e3b39 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -343,7 +343,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE ptrT avatarPath(proto->GetAvatarFilePath());
if (IsFileExists(avatarPath))
{
- FILE *hFile = _tfopen(avatarPath, L"rb");
+ FILE *hFile = _wfopen(avatarPath, L"rb");
if (!hFile)
{
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to open avatar file");
@@ -401,7 +401,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.hInstance = g_hInstance;
odp.dwInitParam = (LPARAM)this;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.pfnDlgProc = UserInfoProc;
odp.position = -2000000000;
@@ -456,7 +456,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar {
break;
}
- TCHAR dnsId[MAX_PATH];
+ wchar_t dnsId[MAX_PATH];
GetDlgItemText(hwnd, IDC_DNS_ID, dnsId, MAX_PATH);
proto->setTString(hContact, TOX_SETTINGS_DNS, dnsId);
break;
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 4aec68a172..083bf078c2 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -2,16 +2,16 @@ IconItemT CToxProto::Icons[] =
{
- { LPGENT("Protocol icon"), "main", IDI_TOX },
- { LPGENT("Audio call"), "audio_call", IDI_AUDIO_CALL },
- { LPGENT("Audio ring"), "audio_ring", IDI_AUDIO_RING },
- { LPGENT("Audio start"), "audio_start", IDI_AUDIO_START },
- { LPGENT("Audio end"), "audio_end", IDI_AUDIO_END },
+ { LPGENW("Protocol icon"), "main", IDI_TOX },
+ { LPGENW("Audio call"), "audio_call", IDI_AUDIO_CALL },
+ { LPGENW("Audio ring"), "audio_ring", IDI_AUDIO_RING },
+ { LPGENW("Audio start"), "audio_start", IDI_AUDIO_START },
+ { LPGENW("Audio end"), "audio_end", IDI_AUDIO_END },
};
void CToxProto::InitIcons()
{
- Icon_RegisterT(g_hInstance, LPGENT("Protocols") L"/" LPGENT(MODULE), Icons, _countof(Icons), MODULE);
+ Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" MODULEW, Icons, _countof(Icons), MODULE);
}
HANDLE CToxProto::GetIconHandle(int iconId)
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 50f51fada4..e7580ef650 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -45,7 +45,7 @@ void CToxProto::InitMenus() // Request authorization
SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
mi.pszService = MODULE"/RequestAuth";
- mi.name.t = LPGENT("Request authorization");
+ mi.name.w = LPGENW("Request authorization");
mi.position = CMI_POSITION + CMI_AUTH_REQUEST;
mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
ContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
@@ -54,7 +54,7 @@ void CToxProto::InitMenus() // Grant authorization
SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30);
mi.pszService = MODULE"/GrantAuth";
- mi.name.t = LPGENT("Grant authorization");
+ mi.name.w = LPGENW("Grant authorization");
mi.position = CMI_POSITION + CMI_AUTH_GRANT;
mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT);
ContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
@@ -63,7 +63,7 @@ void CToxProto::InitMenus() // Start audio call
SET_UID(mi, 0x116cb7fe, 0xce37, 0x429c, 0xb0, 0xa9, 0x7d, 0xe7, 0x70, 0x59, 0xc3, 0x95);
mi.pszService = MODULE"/Audio/Call";
- mi.name.t = LPGENT("Call");
+ mi.name.w = LPGENW("Call");
mi.position = -2000020000 + CMI_AUDIO_CALL;
mi.hIcolibItem = GetIconHandle(IDI_AUDIO_START);
ContactMenuItems[CMI_AUDIO_CALL] = Menu_AddContactMenuItem(&mi);
@@ -79,7 +79,7 @@ int CToxProto::OnInitStatusMenu() // Create copy tox id command
mi.pszService = "/CopyToxID";
CreateProtoService(mi.pszService, &CToxProto::OnCopyToxID);
- mi.name.t = LPGENT("Copy Tox ID");
+ mi.name.w = LPGENW("Copy Tox ID");
mi.position = SMI_POSITION + SMI_TOXID_COPY;
Menu_AddProtoMenuItem(&mi, m_szModuleName);
@@ -87,7 +87,7 @@ int CToxProto::OnInitStatusMenu() /*
mi.pszService = "/CreateChatRoom";
CreateProtoService(mi.pszService, &CToxProto::OnCreateChatRoom);
- mi.name.t = LPGENT("Create group chat");
+ mi.name.w = LPGENW("Create group chat");
mi.position = SMI_POSITION + SMI_GROUPCHAT_CREATE;
mi.hIcolibItem = Skin_GetIconHandle("conference");
HGENMENU hCreateChatRoom = Menu_AddProtoMenuItem(&mi, m_szModuleName);*/
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 48526fa19e..1238ecfda7 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -31,7 +31,7 @@ void CToxCallDlgBase::SetIcon(const char *name) Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
}
-void CToxCallDlgBase::SetTitle(const TCHAR *title)
+void CToxCallDlgBase::SetTitle(const wchar_t *title)
{
SetWindowText(m_hwnd, title);
}
@@ -51,10 +51,10 @@ void CToxIncomingCall::OnInitDialog() CToxCallDlgBase::OnInitDialog();
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "IncomingCallWindow_");
- TCHAR *nick = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, 0);
from.SetText(nick);
- TCHAR title[MAX_PATH];
+ wchar_t title[MAX_PATH];
mir_sntprintf(title, TranslateT("Incoming call from %s"), nick);
SetTitle(title);
SetIcon("audio_ring");
@@ -105,10 +105,10 @@ void CToxOutgoingCall::OnInitDialog() CToxCallDlgBase::OnInitDialog();
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "OutgoingCallWindow_");
- TCHAR *nick = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, 0);
to.SetText(nick);
- TCHAR title[MAX_PATH];
+ wchar_t title[MAX_PATH];
mir_sntprintf(title, TranslateT("Outgoing call to %s"), nick);
SetTitle(title);
SetIcon("audio_end");
@@ -147,7 +147,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) //mir_free(cSettings);
char *message = NULL;
- TCHAR title[MAX_PATH];
+ wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
message = mir_utf8encodeT(title);
else
@@ -216,7 +216,7 @@ void CToxCallDialog::OnClose() {
debugLogA(__FUNCTION__": failed to get input device caps (%d)", error);
- TCHAR errorMessage[MAX_PATH];
+ wchar_t errorMessage[MAX_PATH];
waveInGetErrorText(error, errorMessage, _countof(errorMessage));
CToxProto::ShowNotification(
TranslateT("Unable to find input audio device"),
@@ -315,7 +315,7 @@ void CToxProto::OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_en return;
}
- TCHAR message[MAX_PATH];
+ wchar_t message[MAX_PATH];
mir_sntprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
T2Utf szMessage(message);
@@ -350,7 +350,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) cle.lParam = DB_EVENT_CALL;
cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
- TCHAR szTooltip[MAX_PATH];
+ wchar_t szTooltip[MAX_PATH];
mir_sntprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
@@ -520,7 +520,7 @@ static void CALLBACK ToxShowDialogApcProc(void *arg) proto->debugLogA(__FUNCTION__": failed to open audio device (%d)", error);
toxav_hangup(proto->toxThread->Tox()AV, callId);
- TCHAR errorMessage[MAX_PATH];
+ wchar_t errorMessage[MAX_PATH];
waveInGetErrorText(error, errorMessage, _countof(errorMessage));
CToxProto::ShowNotification(
TranslateT("Unable to find output audio device"),
diff --git a/protocols/Tox/src/tox_multimedia.h b/protocols/Tox/src/tox_multimedia.h index 2f3d41a93f..922b9b406f 100644 --- a/protocols/Tox/src/tox_multimedia.h +++ b/protocols/Tox/src/tox_multimedia.h @@ -14,7 +14,7 @@ protected: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
void SetIcon(const char *name);
- void SetTitle(const TCHAR *title);
+ void SetTitle(const wchar_t *title);
public:
CToxCallDlgBase(CToxProto *proto, int idDialog, MCONTACT hContact);
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index f4e6d887f5..c7212e780b 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -73,7 +73,7 @@ void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool i if (IsFileExists(path))
{
- FILE *hFile = _tfopen(path, L"r");
+ FILE *hFile = _wfopen(path, L"r");
if (hFile != NULL)
{
_fseeki64(hFile, 0, SEEK_END);
@@ -157,7 +157,7 @@ void CToxProto::UpdateNodes() if (lastUpdate <= getDword("NodesUpdate", 0))
return;
- ptrT path(mir_tstrdup((TCHAR*)VARST(_T(TOX_JSON_PATH))));
+ ptrT path(mir_tstrdup((wchar_t*)VARST(_T(TOX_JSON_PATH))));
if (!IsFileExists(path))
{
HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -169,7 +169,7 @@ void CToxProto::UpdateNodes() CloseHandle(hProfile);
}
- FILE *hFile = _tfopen(path, L"w");
+ FILE *hFile = _wfopen(path, L"w");
if (!hFile)
{
debugLogA(__FUNCTION__": failed to open tox.json");
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 527144081b..8d65a7b0a8 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -104,11 +104,11 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
{
- TCHAR filter[MAX_PATH];
+ wchar_t filter[MAX_PATH];
mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0);
- TCHAR profilePath[MAX_PATH] = { 0 };
+ wchar_t profilePath[MAX_PATH] = { 0 };
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = m_hwnd;
@@ -162,11 +162,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
{
- TCHAR filter[MAX_PATH];
+ wchar_t filter[MAX_PATH];
mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%c",
TranslateT("Tox profile"), 0, 0, 0);
- TCHAR profilePath[MAX_PATH];
+ wchar_t profilePath[MAX_PATH];
mir_tstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
OPENFILENAME ofn = { sizeof(ofn) };
@@ -337,7 +337,7 @@ void CToxNodeEditor::OnInitDialog() lvi.mask = LVIF_TEXT;
lvi.iItem = m_iItem;
lvi.cchTextMax = MAX_PATH;
- lvi.pszText = (TCHAR*)alloca(MAX_PATH * sizeof(TCHAR));
+ lvi.pszText = (wchar_t*)alloca(MAX_PATH * sizeof(wchar_t));
lvi.iSubItem = 0;
m_list->GetItem(&lvi);
@@ -542,7 +542,7 @@ void CToxOptionsNodeList::ReloadNodeList() {
ptrA json;
- FILE *hFile = _tfopen(path, L"r");
+ FILE *hFile = _wfopen(path, L"r");
if (hFile != NULL)
{
_fseeki64(hFile, 0, SEEK_END);
@@ -614,7 +614,7 @@ void CToxOptionsNodeList::ReloadNodeList() void CToxOptionsNodeList::OnApply()
{
char setting[MAX_PATH];
- TCHAR tszText[MAX_PATH];
+ wchar_t tszText[MAX_PATH];
LVITEM lvi = { 0 };
lvi.cchTextMax = MAX_PATH;
@@ -650,7 +650,7 @@ void CToxOptionsNodeList::OnApply() lvi.iSubItem = 2;
m_nodes.GetItem(&lvi);
mir_snprintf(setting, TOX_SETTINGS_NODE_PORT, iItem);
- db_set_w(NULL, module, setting, _ttoi(lvi.pszText));
+ db_set_w(NULL, module, setting, _wtoi(lvi.pszText));
lvi.iSubItem = 3;
m_nodes.GetItem(&lvi);
@@ -680,19 +680,19 @@ void CToxOptionsNodeList::OnApply() int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszGroup = LPGENW("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = CToxOptionsMain::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);
- /*odp.ptszTab = LPGENT("Multimedia");
+ /*odp.pwszTab = LPGENW("Multimedia");
odp.pDialog = CToxOptionsMultimedia::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);*/
- odp.ptszTab = LPGENT("Nodes");
+ odp.pwszTab = LPGENW("Nodes");
odp.pDialog = CToxOptionsNodeList::CreateOptionsPage(this);
Options_AddPage(wParam, &odp);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 8c4c49d442..32a024480d 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -2,15 +2,15 @@ HANDLE CToxProto::hProfileFolderPath;
-TCHAR* CToxProto::GetToxProfilePath()
+wchar_t* CToxProto::GetToxProfilePath()
{
return GetToxProfilePath(m_tszUserName);
}
-TCHAR* CToxProto::GetToxProfilePath(const TCHAR *accountName)
+wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName)
{
- TCHAR *profilePath = (TCHAR*)mir_calloc(MAX_PATH * sizeof(TCHAR) + 1);
- TCHAR profileRootPath[MAX_PATH];
+ wchar_t *profilePath = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
+ wchar_t profileRootPath[MAX_PATH];
FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(L"%miranda_userdata%"));
mir_sntprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
return profilePath;
@@ -26,7 +26,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) if (!IsFileExists(profilePath))
return false;
- FILE *profile = _tfopen(profilePath, L"rb");
+ FILE *profile = _wfopen(profilePath, L"rb");
if (profile == NULL)
{
ShowNotification(TranslateT("Unable to open Tox profile"), MB_ICONERROR);
@@ -122,7 +122,7 @@ void CToxProto::SaveToxProfile(CToxThread *toxThread) }
ptrT profilePath(GetToxProfilePath());
- FILE *profile = _tfopen(profilePath, L"wb");
+ FILE *profile = _wfopen(profilePath, L"wb");
if (profile == NULL)
{
debugLogA(__FUNCTION__": failed to open tox profile");
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index ef14dc0b0a..cf8987757d 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-CToxProto::CToxProto(const char* protoName, const TCHAR* userName)
+CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
: PROTO<CToxProto>(protoName, userName),
hPollingThread(NULL), toxThread(NULL),
hOutDevice(NULL), hMessageProcess(1)
@@ -90,13 +90,13 @@ int CToxProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) return Proto_AuthRecv(m_szModuleName, pre);
}
-int CToxProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
+int CToxProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage)
{
ptrA reason(mir_utf8encodeW(szMessage));
return OnRequestAuth(hContact, (LPARAM)reason);
}
-HANDLE CToxProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *tszPath)
+HANDLE CToxProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
return OnFileAllow(hContact, hTransfer, tszPath);
}
@@ -106,12 +106,12 @@ int CToxProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) return CancelTransfer(hContact, hTransfer);
}
-int CToxProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR*)
+int CToxProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t*)
{
return FileCancel(hContact, hTransfer);
}
-int CToxProto::FileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename)
+int CToxProto::FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename)
{
return OnFileResume(hTransfer, action, szFilename);
}
@@ -131,7 +131,7 @@ int CToxProto::SendMsg(MCONTACT hContact, int, const char *msg) return OnSendMessage(hContact, msg);
}
-HANDLE CToxProto::SendFile(MCONTACT hContact, const TCHAR *msg, TCHAR **ppszFiles)
+HANDLE CToxProto::SendFile(MCONTACT hContact, const wchar_t *msg, wchar_t **ppszFiles)
{
return OnSendFile(hContact, msg, ppszFiles);
}
@@ -200,7 +200,7 @@ HANDLE CToxProto::GetAwayMsg(MCONTACT hContact) return 0;
}
-int CToxProto::SetAwayMsg(int, const TCHAR *msg)
+int CToxProto::SetAwayMsg(int, const wchar_t *msg)
{
if (IsOnline())
{
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index d5bd786be9..615e713532 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -25,12 +25,12 @@ public: virtual int __cdecl Authorize(MEVENT hDbEvent);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* tszPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* tszReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** tszFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszReason);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** tszFilename);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
@@ -39,19 +39,19 @@ public: virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
// accounts
- static CToxProto* InitAccount(const char *protoName, const TCHAR *userName);
+ static CToxProto* InitAccount(const char *protoName, const wchar_t *userName);
static int UninitAccount(CToxProto *proto);
// icons
@@ -68,7 +68,7 @@ public: private:
CToxThread *toxThread;
mir_cs profileLock;
- TCHAR *accountName;
+ wchar_t *accountName;
HANDLE hPollingThread;
CTransferList transfers;
ULONG hMessageProcess;
@@ -76,8 +76,8 @@ private: static HANDLE hProfileFolderPath;
// tox profile
- TCHAR* GetToxProfilePath();
- static TCHAR* GetToxProfilePath(const TCHAR *accountName);
+ wchar_t* GetToxProfilePath();
+ static wchar_t* GetToxProfilePath(const wchar_t *accountName);
bool LoadToxProfile(Tox_Options *options);
void SaveToxProfile(CToxThread *toxThread);
@@ -225,9 +225,9 @@ private: int __cdecl OnPreCreateMessage(WPARAM wParam, LPARAM lParam);
// transfer
- HANDLE OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *tszPath);
- int OnFileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename);
- HANDLE OnSendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles);
+ HANDLE OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath);
+ int OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename);
+ HANDLE OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles);
int CancelTransfer(MCONTACT hContact, HANDLE hTransfer);
@@ -244,8 +244,8 @@ private: void CancelAllTransfers(CToxThread *toxThread);
// avatars
- TCHAR* GetAvatarFilePath(MCONTACT hContact = NULL);
- void SetToxAvatar(const TCHAR* path);
+ wchar_t* GetAvatarFilePath(MCONTACT hContact = NULL);
+ void SetToxAvatar(const wchar_t* path);
INT_PTR __cdecl GetAvatarCaps(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM lParam);
@@ -284,13 +284,13 @@ private: static TOX_USER_STATUS MirandaToToxStatus(int status);
static int ToxToMirandaStatus(TOX_USER_STATUS userstatus);
- static TCHAR* ToxErrorToString(TOX_ERR_NEW error);
- static TCHAR* ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error);
+ static wchar_t* ToxErrorToString(TOX_ERR_NEW error);
+ static wchar_t* ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error);
- static void ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
- static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
+ static void ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
- static bool IsFileExists(const TCHAR* path);
+ static bool IsFileExists(const wchar_t* path);
MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, PBYTE pBlob, size_t cbBlob);
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 197f1baaa3..ece71c724d 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -91,7 +91,7 @@ void CToxProto::SearchByNameAsync(void *arg) /*int resolved = 0;
- if (IsFileExists((TCHAR*)VARST(_T(TOX_INI_PATH))))
+ if (IsFileExists((wchar_t*)VARST(_T(TOX_INI_PATH))))
{
char fileName[MAX_PATH];
mir_strcpy(fileName, VARS(TOX_INI_PATH));
@@ -223,7 +223,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) std::smatch match;
std::regex regex("^\\s*([A-Fa-f0-9]{76})\\s*$");
- TCHAR text[MAX_PATH];
+ wchar_t text[MAX_PATH];
GetDlgItemText(owner, IDC_SEARCH, text, _countof(text));
const std::string query = T2Utf(text).str();
diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index 3875a66f47..1b5ab155a6 100644 --- a/protocols/Tox/src/tox_services.cpp +++ b/protocols/Tox/src/tox_services.cpp @@ -2,7 +2,7 @@ INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam)
{
- ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((TCHAR*)lParam) : mir_a2t((char*)lParam));
+ ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((wchar_t*)lParam) : mir_a2t((char*)lParam));
setTString("Nick", nickname);
if (IsOnline())
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index e2b3286d22..d775117f70 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -19,7 +19,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": incoming avatar (%d) from (%d)", fileNumber, friendNumber);
ptrT address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
- TCHAR avatarName[MAX_PATH];
+ wchar_t avatarName[MAX_PATH];
mir_sntprintf(avatarName, MAX_PATH, L"%s.png", address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
@@ -45,7 +45,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u ptrA rawName((char*)mir_alloc(filenameLength + 1));
memcpy(rawName, fileName, filenameLength);
rawName[filenameLength] = 0;
- TCHAR *name = mir_utf8decodeT(rawName);
+ wchar_t *name = mir_utf8decodeT(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -56,8 +56,8 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.t = L"";
- pre.files.t = &name;
+ pre.descr.w = L"";
+ pre.files.w = &name;
pre.lParam = (LPARAM)transfer;
ProtoChainRecvFile(hContact, &pre);
}
@@ -71,20 +71,20 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u }
// file request is allowed
-HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *tszPath)
+HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
transfer->pfts.tszWorkingDir = mir_tstrdup(tszPath);
// stupid fix
- TCHAR fullPath[MAX_PATH];
+ wchar_t fullPath[MAX_PATH];
mir_sntprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
transfer->ChangeName(fullPath);
if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
{
int action = FILERESUME_OVERWRITE;
- const TCHAR **szFilename = (const TCHAR**)mir_alloc(sizeof(TCHAR*) * 2);
+ const wchar_t **szFilename = (const wchar_t**)mir_alloc(sizeof(wchar_t*) * 2);
szFilename[0] = fullPath;
szFilename[1] = NULL;
OnFileResume(hTransfer, &action, szFilename);
@@ -95,7 +95,7 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR * }
// if file is exists
-int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename)
+int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
@@ -111,7 +111,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const TCHAR **szFilen ToxHexAddress pubKey = GetContactPublicKey(transfer->friendNumber);
- TCHAR *mode = *action == FILERESUME_OVERWRITE ? L"wb" : L"ab";
+ wchar_t *mode = *action == FILERESUME_OVERWRITE ? L"wb" : L"ab";
if (!transfer->OpenFile(mode))
{
debugLogA(__FUNCTION__": failed to open file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
@@ -200,23 +200,23 @@ void CToxProto::OnDataReceiving(Tox*, uint32_t friendNumber, uint32_t fileNumber /* FILE SENDING */
// outcoming file flow
-HANDLE CToxProto::OnSendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles)
+HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles)
{
int32_t friendNumber = GetToxFriendNumber(hContact);
if (friendNumber == UINT32_MAX)
return NULL;
- FILE *hFile = _tfopen(ppszFiles[0], L"rb");
+ FILE *hFile = _wfopen(ppszFiles[0], L"rb");
if (hFile == NULL)
{
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
return NULL;
}
- TCHAR *fileName = _tcsrchr(ppszFiles[0], '\\') + 1;
+ wchar_t *fileName = wcsrchr(ppszFiles[0], '\\') + 1;
size_t fileDirLength = fileName - ppszFiles[0];
- TCHAR *fileDir = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileDirLength + 1));
- _tcsncpy(fileDir, ppszFiles[0], fileDirLength);
+ wchar_t *fileDir = (wchar_t*)mir_alloc(sizeof(wchar_t)*(fileDirLength + 1));
+ wcsncpy(fileDir, ppszFiles[0], fileDirLength);
fileDir[fileDirLength] = '\0';
_fseeki64(hFile, 0, SEEK_END);
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index a8dcc55b62..40f8faea75 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -11,7 +11,7 @@ struct FileTransferParam TOX_FILE_KIND transferType;
- FileTransferParam(uint32_t friendNumber, uint32_t fileNumber, const TCHAR *fileName, uint64_t fileSize)
+ FileTransferParam(uint32_t friendNumber, uint32_t fileNumber, const wchar_t *fileName, uint64_t fileSize)
{
hFile = NULL;
this->friendNumber = friendNumber;
@@ -22,7 +22,7 @@ struct FileTransferParam pfts.flags = PFTS_TCHAR;
pfts.hContact = NULL;
pfts.totalFiles = 1;
- pfts.ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(pfts.totalFiles + 1));
+ pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1));
pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_tstrdup(fileName);
pfts.ptszFiles[pfts.totalFiles] = NULL;
pfts.totalBytes = pfts.currentFileSize = fileSize;
@@ -34,13 +34,13 @@ struct FileTransferParam transferType = TOX_FILE_KIND_DATA;
}
- bool OpenFile(const TCHAR *mode)
+ bool OpenFile(const wchar_t *mode)
{
- hFile = _tfopen(pfts.tszCurrentFile, mode);
+ hFile = _wfopen(pfts.tszCurrentFile, mode);
return hFile != NULL;
}
- void ChangeName(const TCHAR *fileName)
+ void ChangeName(const wchar_t *fileName)
{
pfts.ptszFiles[0] = replaceStrT(pfts.tszCurrentFile, fileName);
}
@@ -68,7 +68,7 @@ struct AvatarTransferParam : public FileTransferParam {
uint8_t hash[TOX_HASH_LENGTH];
- AvatarTransferParam(uint32_t friendNumber, uint32_t fileNumber, const TCHAR *fileName, uint64_t fileSize)
+ AvatarTransferParam(uint32_t friendNumber, uint32_t fileNumber, const wchar_t *fileName, uint64_t fileSize)
: FileTransferParam(friendNumber, fileNumber, fileName, fileSize)
{
transferType = TOX_FILE_KIND_AVATAR;
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 0ad5015340..f09f7ca8c1 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -55,7 +55,7 @@ int CToxProto::ToxToMirandaStatus(TOX_USER_STATUS userstatus) return status;
}
-TCHAR* CToxProto::ToxErrorToString(TOX_ERR_NEW error)
+wchar_t* CToxProto::ToxErrorToString(TOX_ERR_NEW error)
{
switch (error)
{
@@ -82,20 +82,20 @@ TCHAR* CToxProto::ToxErrorToString(TOX_ERR_NEW error) }
}
-TCHAR* CToxProto::ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error)
+wchar_t* CToxProto::ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error)
{
switch (error)
{
- case TOX_ERR_FRIEND_SEND_MESSAGE_NULL: - return TranslateT("One of the arguments is missing"); - case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND: - return TranslateT("The friend number did not designate a valid friend"); - case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_CONNECTED: - return TranslateT("This client is currently not connected to the friend"); - case TOX_ERR_FRIEND_SEND_MESSAGE_SENDQ: - return TranslateT("An allocation error occurred while increasing the send queue size"); - case TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG: - return TranslateT("Message length exceeded TOX_MAX_MESSAGE_LENGTH"); + case TOX_ERR_FRIEND_SEND_MESSAGE_NULL:
+ return TranslateT("One of the arguments is missing");
+ case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND:
+ return TranslateT("The friend number did not designate a valid friend");
+ case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_CONNECTED:
+ return TranslateT("This client is currently not connected to the friend");
+ case TOX_ERR_FRIEND_SEND_MESSAGE_SENDQ:
+ return TranslateT("An allocation error occurred while increasing the send queue size");
+ case TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG:
+ return TranslateT("Message length exceeded TOX_MAX_MESSAGE_LENGTH");
case TOX_ERR_FRIEND_SEND_MESSAGE_EMPTY:
return TranslateT("Attempted to send a zero-length message");
default:
@@ -103,7 +103,7 @@ TCHAR* CToxProto::ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error) }
}
-void CToxProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int flags, MCONTACT hContact)
+void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
{
if (Miranda_Terminated())
{
@@ -125,14 +125,14 @@ void CToxProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int MessageBox(NULL, message, caption, MB_OK | flags);
}
-void CToxProto::ShowNotification(const TCHAR *message, int flags, MCONTACT hContact)
+void CToxProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
{
ShowNotification(_T(MODULE), message, flags, hContact);
}
-bool CToxProto::IsFileExists(const TCHAR* path)
+bool CToxProto::IsFileExists(const wchar_t* path)
{
- return _taccess(path, 0) == 0;
+ return _waccess(path, 0) == 0;
}
MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, PBYTE pBlob, size_t cbBlob)
@@ -149,7 +149,7 @@ MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DW INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam)
{
- TCHAR *uri = (TCHAR*)lParam;
+ wchar_t *uri = (wchar_t*)lParam;
if (mir_tstrlen(uri) <= 4)
return 1;
@@ -168,7 +168,7 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) if (proto == NULL)
return 1;
- if (_tcschr(uri, _T('@')) != NULL)
+ if (wcschr(uri, '@') != NULL)
return 1;
PROTOSEARCHRESULT psr = { sizeof(psr) };
diff --git a/protocols/Twitter/src/StringUtil.cpp b/protocols/Twitter/src/StringUtil.cpp index d9b7123216..a902495c20 100644 --- a/protocols/Twitter/src/StringUtil.cpp +++ b/protocols/Twitter/src/StringUtil.cpp @@ -24,7 +24,7 @@ THE SOFTWARE. #include "stdafx.h"
-void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includeEmpty)
+void Split(const wstring& str, std::vector<wstring>& out, wchar_t sep, bool includeEmpty)
{
unsigned start = 0;
unsigned end = 0;
@@ -44,7 +44,7 @@ void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includ }
}
-tstring GetWord(const tstring& str, unsigned index, bool getRest)
+wstring GetWord(const wstring& str, unsigned index, bool getRest)
{
unsigned start = 0;
unsigned end = 0;
@@ -52,7 +52,7 @@ tstring GetWord(const tstring& str, unsigned index, bool getRest) unsigned count = 0;
while (true) {
- if (end == str.size() || str[end] == _T(' ')) {
+ if (end == str.size() || str[end] == ' ') {
if (end > start) {
if (count == index) {
if (getRest)
diff --git a/protocols/Twitter/src/StringUtil.h b/protocols/Twitter/src/StringUtil.h index 0fe42aedce..f1ebdb55e1 100644 --- a/protocols/Twitter/src/StringUtil.h +++ b/protocols/Twitter/src/StringUtil.h @@ -25,8 +25,8 @@ THE SOFTWARE. #ifndef _STRINGUTIL_H_INCLUDED_
#define _STRINGUTIL_H_INCLUDED_
-void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includeEmpty);
-tstring GetWord(const tstring& str, unsigned index, bool getRest = false);
+void Split(const wstring& str, std::vector<wstring>& out, wchar_t sep, bool includeEmpty);
+wstring GetWord(const wstring& str, unsigned index, bool getRest = false);
std::string& replaceAll(std::string& context, const std::string& from, const std::string& to);
@@ -42,7 +42,7 @@ inline std::wstring UTF8ToWide(const std::string& str) return (wchar_t*)ptrW(mir_utf8decodeW(str.c_str()));
}
-inline bool Compare(const tstring& one, const tstring& two, bool caseSensitive)
+inline bool Compare(const wstring& one, const wstring& two, bool caseSensitive)
{
return caseSensitive ? (one == two) : (mir_tstrcmpi(one.c_str(), two.c_str()) == 0);
}
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 13d438c185..940d34eee5 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -51,9 +51,9 @@ void TwitterProto::UpdateChat(const twitter_user &update) CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
- mir_free(const_cast<TCHAR*>(gce.ptszUID));
- mir_free(const_cast<TCHAR*>(gce.ptszText));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszUID));
+ mir_free(const_cast<wchar_t*>(gce.ptszText));
}
int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
@@ -98,8 +98,8 @@ void TwitterProto::AddChatContact(const char *name, const char *nick) gce.ptszStatus = L"Normal";
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
- mir_free(const_cast<TCHAR*>(gce.ptszUID));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszUID));
}
void TwitterProto::DeleteChatContact(const char *name)
@@ -111,7 +111,7 @@ void TwitterProto::DeleteChatContact(const char *name) gce.ptszUID = gce.ptszNick;
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
}
INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 87c5e25aaa..bad7284cbf 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -400,7 +400,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return;
std::string ext = data->url.substr(data->url.rfind('.')); // finds the filetype of the avatar
- std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str()); // local filename and path
+ std::wstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (wchar_t*)_A2T(ext.c_str()); // local filename and path
db_free(&dbv);
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -412,7 +412,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this.
}
- _tcsncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
+ wcsncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
debugLogA("***** Updating avatar: %s", data->url.c_str());
mir_cslock lck(avatar_lock_);
@@ -536,7 +536,7 @@ void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, DBVARIANT dbv;
if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !getTString(hContact, TWITTER_KEY_UN, &dbv)) {
- _tcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
+ wcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
db_free(&dbv);
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index e6c2321d29..880ba6974a 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -49,8 +49,8 @@ MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr) if (m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.t));
- return AddToClientList(_T2A(psr->nick.t), "");
+ ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.w));
+ return AddToClientList(_T2A(psr->nick.w), "");
}
// *************************
@@ -93,10 +93,10 @@ int TwitterProto::GetInfo(MCONTACT hContact, int info_type) struct search_query
{
- search_query(const std::tstring &_query, bool _by_email) : query(_query), by_email(_by_email)
+ search_query(const std::wstring &_query, bool _by_email) : query(_query), by_email(_by_email)
{
}
- std::tstring query;
+ std::wstring query;
bool by_email;
};
@@ -127,27 +127,27 @@ void TwitterProto::DoSearch(void *pArg) if (found) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = mir_a2t(info.username.c_str());
- psr.firstName.t = mir_a2t(info.real_name.c_str());
+ psr.nick.w = mir_a2t(info.username.c_str());
+ psr.firstName.w = mir_a2t(info.real_name.c_str());
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- mir_free(psr.nick.t);
- mir_free(psr.firstName.t);
+ mir_free(psr.nick.w);
+ mir_free(psr.firstName.w);
}
else ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
delete query;
}
-HANDLE TwitterProto::SearchBasic(const TCHAR *username)
+HANDLE TwitterProto::SearchBasic(const wchar_t *username)
{
ForkThread(&TwitterProto::DoSearch, new search_query(username, false));
return (HANDLE)1;
}
-HANDLE TwitterProto::SearchByEmail(const TCHAR *email)
+HANDLE TwitterProto::SearchByEmail(const wchar_t *email)
{
ForkThread(&TwitterProto::DoSearch, new search_query(email, true));
return (HANDLE)1;
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index 2995269fcd..ccc9b20db5 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -70,7 +70,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
TwitterProto *proto = new TwitterProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp index 2bd69b9837..b87e008bcb 100644 --- a/protocols/Twitter/src/oauth.cpp +++ b/protocols/Twitter/src/oauth.cpp @@ -396,5 +396,5 @@ wstring mir_twitter::OAuthCreateSignature(const wstring& signatureBase, const ws string data = WideToUTF8(signatureBase);
mir_hmac_sha1(digest, (PBYTE)keyBytes.c_str(), keyBytes.size(), (PBYTE)data.c_str(), data.size());
ptrA encoded(mir_base64_encode(digest, sizeof(digest)));
- return UrlEncode((TCHAR*)_A2T(encoded));
+ return UrlEncode((wchar_t*)_A2T(encoded));
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index ffa2245609..5b58154808 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static volatile LONG g_msgid = 1;
-TwitterProto::TwitterProto(const char *proto_name, const TCHAR *username) :
+TwitterProto::TwitterProto(const char *proto_name, const wchar_t *username) :
PROTO<TwitterProto>(proto_name, username)
{
CreateProtoService(PS_CREATEACCMGRUI, &TwitterProto::SvcCreateAccMgrUI);
@@ -264,7 +264,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) // "Send Tweet..."
mi.pszService = "/Tweet";
CreateProtoService(mi.pszService, &TwitterProto::OnTweet);
- mi.name.t = LPGENT("Send Tweet...");
+ mi.name.w = LPGENW("Send Tweet...");
mi.position = 200001;
mi.hIcolibItem = GetIconHandle("tweet");
Menu_AddStatusMenuItem(&mi, m_szModuleName);
@@ -276,18 +276,18 @@ int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 271828;
odp.hInstance = g_hInstance;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszTab = LPGENT("Basic");
+ odp.pwszTab = LPGENW("Basic");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = options_proc;
Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
- odp.ptszTab = LPGENT("Popups");
+ odp.pwszTab = LPGENW("Popups");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
odp.pfnDlgProc = popup_options_proc;
Options_AddPage(wParam, &odp);
@@ -307,7 +307,7 @@ INT_PTR TwitterProto::OnTweet(WPARAM, LPARAM) int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
{
- TCHAR descr[512];
+ wchar_t descr[512];
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
@@ -317,7 +317,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -330,7 +330,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = descr;
hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (hAvatarNetlib_ == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -421,7 +421,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast<char*>(p);
if (mir_strlen(mir_utf8decodeA(text)) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
- TCHAR errorPopup[280];
+ wchar_t errorPopup[280];
mir_sntprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
ShowPopup(errorPopup, 1);
return;
@@ -452,9 +452,9 @@ void TwitterProto::UpdateSettings() }
}
-std::tstring TwitterProto::GetAvatarFolder()
+std::wstring TwitterProto::GetAvatarFolder()
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 4ef55b48cf..9aaa196240 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class TwitterProto : public PROTO<TwitterProto>
{
public:
- TwitterProto(const char*,const TCHAR*);
+ TwitterProto(const char*,const wchar_t*);
~TwitterProto();
//PROTO_INTERFACE
@@ -33,8 +33,8 @@ public: virtual DWORD_PTR __cdecl GetCaps(int, MCONTACT = 0);
virtual int __cdecl GetInfo(MCONTACT, int);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR *);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t *);
virtual int __cdecl RecvMsg(MCONTACT, PROTORECVEVENT *);
virtual int __cdecl SendMsg(MCONTACT, int, const char *);
@@ -108,7 +108,7 @@ private: void TwitterProto::resetOAuthKeys();
- std::tstring GetAvatarFolder();
+ std::wstring GetAvatarFolder();
mir_cs signon_lock_;
mir_cs avatar_lock_;
diff --git a/protocols/Twitter/src/stdafx.h b/protocols/Twitter/src/stdafx.h index d8b3ba5274..bd46045ca8 100644 --- a/protocols/Twitter/src/stdafx.h +++ b/protocols/Twitter/src/stdafx.h @@ -10,7 +10,6 @@ #include <Wincrypt.h>
#include <stdio.h>
#include <direct.h>
-#include <tchar.h>
#include <time.h>
#include <cstdio>
@@ -29,7 +28,7 @@ using std::list; using std::min;
#include <sstream>
-typedef std::basic_string<TCHAR> tstring;
+typedef std::basic_string<wchar_t> wstring;
#include "resource.h"
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index db2f27dcf7..4f0f988d02 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -95,7 +95,7 @@ void InitContactMenus() SET_UID(mi, 0xfc4e1245, 0xc8e0, 0x4de2, 0x92, 0x15, 0xfc, 0xcf, 0x48, 0xf9, 0x41, 0x56);
mi.position = -2000006000;
mi.hIcolibItem = GetIconHandle("reply");
- mi.name.t = LPGENT("Reply...");
+ mi.name.w = LPGENW("Reply...");
mi.pszService = "Twitter/ReplyToTweet";
g_hMenuItems[0] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&TwitterProto::ReplyToTweet>);
@@ -103,7 +103,7 @@ void InitContactMenus() SET_UID(mi, 0x7f7e4c24, 0x821c, 0x450f, 0x93, 0x76, 0xbe, 0x65, 0xe9, 0x2f, 0xb6, 0xc2);
mi.position = -2000006000;
mi.hIcolibItem = GetIconHandle("homepage");
- mi.name.t = LPGENT("Visit Homepage");
+ mi.name.w = LPGENW("Visit Homepage");
mi.pszService = "Twitter/VisitHomepage";
g_hMenuItems[1] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&TwitterProto::VisitHomepage>);
diff --git a/protocols/Twitter/src/twitter.h b/protocols/Twitter/src/twitter.h index 5558ad376a..d332050108 100644 --- a/protocols/Twitter/src/twitter.h +++ b/protocols/Twitter/src/twitter.h @@ -25,7 +25,7 @@ using std::vector; #include "http.h"
-#define tstring wstring
+#define wstring wstring
typedef unsigned long long twitter_id;
typedef std::map<std::wstring, std::wstring> OAuthParameters;
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index f82017d613..b6e067dab7 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "proto.h"
#include "twitter.h"
-static const TCHAR *sites[] = {
+static const wchar_t *sites[] = {
L"https://api.twitter.com/",
L"https://identi.ca/api/"
};
@@ -80,7 +80,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) {
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- TCHAR tstr[128];
+ wchar_t tstr[128];
GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
@@ -112,14 +112,14 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SetDlgItemText(hwndDlg, IDC_CHARACTERS, L"140");
// Set window title
- TCHAR title[512];
+ wchar_t title[512];
mir_sntprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
- TCHAR msg[141];
+ wchar_t msg[141];
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
@@ -295,8 +295,8 @@ namespace popup_options struct
{
- TCHAR *name;
- TCHAR *text;
+ wchar_t *name;
+ wchar_t *text;
} const quotes[] = {
{
L"Dorothy Parker", L"If, with the literate, I am\n"
@@ -329,8 +329,8 @@ namespace popup_options // Pick a random quote
int q = rand() % _countof(quotes);
- _tcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
- _tcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
+ wcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
+ wcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
popup.lchContact = hContact;
popup.iSeconds = get_timeout(hwndDlg);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index e8056e02a8..565ef3622b 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -130,7 +130,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu return resp_data;
}
-bool save_url(HANDLE hNetlib, const std::string &url, const std::tstring &filename)
+bool save_url(HANDLE hNetlib, const std::string &url, const std::wstring &filename)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
@@ -144,12 +144,12 @@ bool save_url(HANDLE hNetlib, const std::string &url, const std::tstring &filena bool success = (resp->resultCode == 200);
if (success) {
// Create folder if necessary
- std::tstring dir = filename.substr(0, filename.rfind('\\'));
- if (_taccess(dir.c_str(), 0))
+ std::wstring dir = filename.substr(0, filename.rfind('\\'));
+ if (_waccess(dir.c_str(), 0))
CreateDirectoryTreeT(dir.c_str());
// Write to file
- FILE *f = _tfopen(filename.c_str(), L"wb");
+ FILE *f = _wfopen(filename.c_str(), L"wb");
fwrite(resp->pData, 1, resp->dataLength, f);
fclose(f);
}
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index a7f4f968cd..d5115a1bad 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -90,9 +90,9 @@ protected: PROTO_INTERFACE *ppro_;
};
-inline void mbcs_to_tcs(UINT code_page, const char *mbstr, TCHAR *tstr, int tlen)
+inline void mbcs_to_tcs(UINT code_page, const char *mbstr, wchar_t *tstr, int tlen)
{
MultiByteToWideChar(code_page, 0, mbstr, -1, tstr, tlen);
}
-bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename);
\ No newline at end of file +bool save_url(HANDLE hNetlib,const std::string &url,const std::wstring &filename);
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 5b1f032980..ef8c14bb0c 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -56,7 +56,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO /////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CVkProto* vkProtoInit(const char *pszProtoName, const TCHAR *tszUserName)
+static CVkProto* vkProtoInit(const char *pszProtoName, const wchar_t *tszUserName)
{
CVkProto *ppro = new CVkProto(pszProtoName, tszUserName);
return ppro;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 0e835a8e35..8ac554321c 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -46,16 +46,16 @@ LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField) return NULL;
}
-bool tlstrstr(TCHAR *_s1, TCHAR *_s2)
+bool tlstrstr(wchar_t *_s1, wchar_t *_s2)
{
- TCHAR s1[1024], s2[1024];
+ wchar_t s1[1024], s2[1024];
- _tcsncpy_s(s1, _s1, _TRUNCATE);
+ wcsncpy_s(s1, _s1, _TRUNCATE);
CharLowerBuff(s1, _countof(s1));
- _tcsncpy_s(s2, _s2, _TRUNCATE);
+ wcsncpy_s(s2, _s2, _TRUNCATE);
CharLowerBuff(s2, _countof(s2));
- return _tcsstr(s1, s2) != NULL;
+ return wcsstr(s1, s2) != NULL;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -148,7 +148,7 @@ void CVkProto::ClearAccessToken() ShutdownSession();
}
-TCHAR* CVkProto::GetUserStoredPassword()
+wchar_t* CVkProto::GetUserStoredPassword()
{
debugLogA("CVkProto::GetUserStoredPassword");
ptrA szRawPass(getStringA("Password"));
@@ -677,7 +677,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) if (!time)
return;
- TCHAR ttime[64];
+ wchar_t ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
_tcsftime_l(ttime, _countof(ttime), L"%X - %x", localtime(&time), locale);
_free_locale(locale);
@@ -955,7 +955,7 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b if (IsEmpty(ptszString))
return CMString();
- TCHAR *ptszFormat = NULL;
+ wchar_t *ptszFormat = NULL;
for (int i = 0; i < _countof(bbcItem); i++)
if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
ptszFormat = bbcItem[i].ptszTempate;
@@ -1252,7 +1252,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn }
time_t datetime = (time_t)jnMsg["date"].as_int();
- TCHAR ttime[64];
+ wchar_t ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
_tcsftime_l(ttime, _countof(ttime), L"%x %X", localtime(&datetime), locale);
_free_locale(locale);
@@ -1276,7 +1276,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn }
tszBody.Replace(L"\n", L"\n\t");
- TCHAR tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' ';
+ wchar_t tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' ';
CMString tszMes(FORMAT, L"%s %s%c%s %s:\n\n%s\n",
SetBBCString(TranslateT("Message from"), iBBC, vkbbcB),
SetBBCString(tszNick, iBBC, vkbbcUrl, tszUrl),
@@ -1286,7 +1286,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn SetBBCString(tszBody, iBBC, vkbbcCode));
if (!res.IsEmpty())
- res.AppendChar(_T('\n'));
+ res.AppendChar('\n');
res += tszMes;
}
@@ -1312,14 +1312,14 @@ void CVkProto::SetInvisible(MCONTACT hContact) CMString CVkProto::RemoveBBC(CMString& tszSrc)
{
- static const TCHAR *tszSimpleBBCodes[][2] = {
+ static const wchar_t *tszSimpleBBCodes[][2] = {
{ L"[b]", L"[/b]" },
{ L"[u]", L"[/u]" },
{ L"[i]", L"[/i]" },
{ L"[s]", L"[/s]" },
};
- static const TCHAR *tszParamBBCodes[][2] = {
+ static const wchar_t *tszParamBBCodes[][2] = {
{ L"[url=", L"[/url]" },
{ L"[img=", L"[/img]" },
{ L"[size=", L"[/size]" },
@@ -1392,13 +1392,13 @@ CMString CVkProto::RemoveBBC(CMString& tszSrc) void CVkProto::ShowCaptchaInBrowser(HBITMAP hBitmap)
{
- TCHAR tszTempDir[MAX_PATH];
+ wchar_t tszTempDir[MAX_PATH];
if (!GetEnvironmentVariable(L"TEMP", tszTempDir, MAX_PATH))
return;
CMString tszHTMLPath(FORMAT, L"%s\\miranda_captcha.html", tszTempDir);
- FILE *pFile = _tfopen(tszHTMLPath, L"w");
+ FILE *pFile = _wfopen(tszHTMLPath, L"w");
if (pFile == NULL)
return;
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index a5e441027e..c78a27b0cc 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdio.h>
#include <malloc.h>
-#include <tchar.h>
#include <time.h>
#include <locale.h>
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index feddbdcc82..008541791c 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -97,7 +97,7 @@ extern mir_cs csInstances; extern HINSTANCE hInst;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
-bool tlstrstr(TCHAR *_s1, TCHAR *_s2);
+bool tlstrstr(wchar_t *_s1, wchar_t *_s2);
void InitIcons(void);
HANDLE GetIconHandle(int iCommand);
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 38cb5d7057..a2ada3e6d0 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -27,7 +27,7 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) GetAvatarFileName(param->hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetBufferFormat(reply->pData);
- FILE *out = _tfopen(ai.filename, L"wb");
+ FILE *out = _wfopen(ai.filename, L"wb");
if (out == NULL) {
ProtoBroadcastAck(param->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai);
delete param;
@@ -85,13 +85,13 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) if (szUrl == NULL)
return GAIR_NOAVATAR;
- TCHAR tszFileName[MAX_PATH];
+ wchar_t tszFileName[MAX_PATH];
GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
- _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
+ wcsncpy(pai->filename, tszFileName, _countof(pai->filename));
pai->format = ProtoGetAvatarFormat(pai->filename);
- if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar"))
+ if (::_waccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar"))
return GAIR_SUCCESS;
if (IsOnline()) {
@@ -119,16 +119,16 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) if (SvcGetAvatarInfo(0, (LPARAM)&ai) != GAIR_SUCCESS)
return 1;
- TCHAR *buf = (TCHAR*)wParam;
+ wchar_t *buf = (wchar_t*)wParam;
int size = (int)lParam;
- _tcsncpy(buf, ai.filename, size);
+ wcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
return 0;
}
-void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen)
+void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
@@ -138,10 +138,10 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen pszDest[tPathLen++] = '\\';
- const TCHAR *szFileType = L".jpg";
+ const wchar_t *szFileType = L".jpg";
ptrT szUrl(getTStringA(hContact, "AvatarUrl"));
if (szUrl) {
- TCHAR *p = _tcsrchr(szUrl, '.');
+ wchar_t *p = wcsrchr(szUrl, '.');
if (p != NULL)
szFileType = p;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index d931c85be0..10726e6842 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -24,7 +24,7 @@ enum IDM_KICK, IDM_INFO, IDM_CHANGENICK, IDM_VISIT_PROFILE
};
-static LPCTSTR sttStatuses[] = { LPGENT("Participants"), LPGENT("Owners") };
+static LPCTSTR sttStatuses[] = { LPGENW("Participants"), LPGENW("Owners") };
extern JSONNode nullNode;
@@ -170,8 +170,8 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe break;
int uid = jnUser["id"].as_int();
- TCHAR tszId[20];
- _itot(uid, tszId, 10);
+ wchar_t tszId[20];
+ _itow(uid, tszId, 10);
bool bNew;
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
@@ -209,8 +209,8 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!cu.m_bDel)
continue;
- TCHAR tszId[20];
- _itot(cu.m_uid, tszId, 10);
+ wchar_t tszId[20];
+ _itow(cu.m_uid, tszId, 10);
GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_PART };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
@@ -341,7 +341,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & }
else {
int a_uid = 0;
- int iReadCount = _stscanf(tszActionMid, L"%d", &a_uid);
+ int iReadCount = swscanf(tszActionMid, L"%d", &a_uid);
if (iReadCount == 1) {
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
if (cu == NULL)
@@ -364,7 +364,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & tszBody.AppendFormat(L" (https://vk.com/id%s) %s", tszUid, TranslateT("returned to chat"));
else {
int a_uid = 0;
- int iReadCount = _stscanf(tszActionMid, L"%d", &a_uid);
+ int iReadCount = swscanf(tszActionMid, L"%d", &a_uid);
if (iReadCount == 1) {
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
if (cu == NULL)
@@ -424,8 +424,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR cu->m_bUnknown = true;
}
- TCHAR tszId[20];
- _itot(uid, tszId, 10);
+ wchar_t tszId[20];
+ _itow(uid, tszId, 10);
GCDEST gcd = { m_szModuleName, cc->m_tszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
@@ -434,7 +434,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR gce.time = msgTime;
gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG;
gce.ptszNick = cu->m_tszNick ? mir_tstrdup(cu->m_tszNick) : mir_tstrdup(hContact ? ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
- gce.ptszText = IsEmpty((TCHAR *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody);
+ gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
StopChatContactTyping(cc->m_chatid, uid);
}
@@ -469,9 +469,9 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus) /////////////////////////////////////////////////////////////////////////////////////////
-TCHAR* UnEscapeChatTags(TCHAR *str_in)
+wchar_t* UnEscapeChatTags(wchar_t *str_in)
{
- TCHAR *s = str_in, *d = str_in;
+ wchar_t *s = str_in, *d = str_in;
while (*s) {
if (*s == '%' && s[1] == '%')
s++;
@@ -506,13 +506,13 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- MCONTACT hContact = FindUser(_ttoi(gch->ptszUID));
+ MCONTACT hContact = FindUser(_wtoi(gch->ptszUID));
if (hContact == NULL) {
- hContact = FindUser(_ttoi(gch->ptszUID), true);
+ hContact = FindUser(_wtoi(gch->ptszUID), true);
db_set_b(hContact, "CList", "Hidden", 1);
db_set_b(hContact, "CList", "NotOnList", 1);
db_set_dw(hContact, "Ignore", "Mask1", 0);
- RetrieveUserInfo(_ttoi(gch->ptszUID));
+ RetrieveUserInfo(_wtoi(gch->ptszUID));
}
CallService(MS_MSG_SENDMESSAGET, hContact);
}
@@ -796,8 +796,8 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_NICK };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
- TCHAR tszId[20];
- _itot(cu->m_uid, tszId, 10);
+ wchar_t tszId[20];
+ _itow(cu->m_uid, tszId, 10);
gce.ptszNick = mir_tstrdup(cu->m_tszNick);
gce.bIsMe = (cu->m_uid == m_myUserId);
@@ -829,18 +829,18 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) static gc_item sttLogListItems[] =
{
- { LPGENT("&Invite a user"), IDM_INVITE, MENU_ITEM },
- { LPGENT("View/change &title"), IDM_TOPIC, MENU_ITEM },
+ { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM },
+ { LPGENW("View/change &title"), IDM_TOPIC, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Destroy room"), IDM_DESTROY, MENU_ITEM }
+ { LPGENW("&Destroy room"), IDM_DESTROY, MENU_ITEM }
};
static gc_item sttListItems[] =
{
- { LPGENT("&User details"), IDM_INFO, MENU_ITEM },
- { LPGENT("Visit profile"), IDM_VISIT_PROFILE, MENU_ITEM },
- { LPGENT("Change nick"), IDM_CHANGENICK, MENU_ITEM },
- { LPGENT("&Kick"), IDM_KICK, MENU_ITEM }
+ { LPGENW("&User details"), IDM_INFO, MENU_ITEM },
+ { LPGENW("Visit profile"), IDM_VISIT_PROFILE, MENU_ITEM },
+ { LPGENW("Change nick"), IDM_CHANGENICK, MENU_ITEM },
+ { LPGENW("&Kick"), IDM_KICK, MENU_ITEM }
};
int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam)
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 9e6ba15815..5c119b5d5b 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -160,7 +160,7 @@ void CVkInviteChatForm::OnInitDialog() {
for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
if (!m_proto->isChatRoom(hContact)) {
- TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0);
m_cbxCombo.AddString(ptszNick, hContact);
}
}
diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h index 45272b285c..32ee12608f 100644 --- a/protocols/VKontakte/src/vk_dialogs.h +++ b/protocols/VKontakte/src/vk_dialogs.h @@ -52,12 +52,12 @@ public: struct WALLPOST_FORM_PARAMS
{
- TCHAR *ptszMsg;
- TCHAR *ptszUrl;
- TCHAR *ptszNick;
+ wchar_t *ptszMsg;
+ wchar_t *ptszUrl;
+ wchar_t *ptszNick;
bool bFriendsOnly;
- WALLPOST_FORM_PARAMS(TCHAR *nick) :
+ WALLPOST_FORM_PARAMS(wchar_t *nick) :
ptszNick(nick),
bFriendsOnly(false)
{
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 2bc441d403..be5b0eed16 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -84,7 +84,7 @@ void CVkProto::AddCListEvent(bool bNews) cle.flags = CLEF_URGENT | CLEF_TCHAR;
cle.hContact = hContact;
cle.hDbEvent = NULL;
- TCHAR toolTip[255];
+ wchar_t toolTip[255];
mir_sntprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications"));
cle.ptszTooltip = toolTip;
pcli->pfnAddEvent(&cle);
@@ -238,9 +238,9 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo const JSONNode &jnAttachments = jnItem["attachments"];
if (jnAttachments) {
if (!tszText.IsEmpty())
- tszText.AppendChar(_T('\n'));
+ tszText.AppendChar('\n');
if (!tszPopupText.IsEmpty())
- tszPopupText.AppendChar(_T('\n'));
+ tszPopupText.AppendChar('\n');
tszPopupText += TranslateT("(attachments)");
tszText += GetAttachmentDescr(jnAttachments, m_vkOptions.bUseBBCOnAttacmentsAsNews ? m_vkOptions.BBCForNews() : m_vkOptions.BBCForAttachments());
}
@@ -267,7 +267,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo vkNewsItem->tszId.AppendFormat(L"%d_%d", vkNewsItem->vkUser->m_UserId, iPostId);
if (bPostLink) {
vkNewsItem->tszLink = CMString(L"https://vk.com/wall") + vkNewsItem->tszId;
- vkNewsItem->tszText.AppendChar(_T('\n'));
+ vkNewsItem->tszText.AppendChar('\n');
vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->tszLink);
}
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index cb1e0bc607..59738aab54 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE CVkProto::SendFile(MCONTACT hContact, const TCHAR *desc, TCHAR **files)
+HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **files)
{
debugLogA("CVkProto::SendFile");
@@ -155,7 +155,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * return;
}
- FILE *pFile = _tfopen(fup->FileName, L"rb");
+ FILE *pFile = _wfopen(fup->FileName, L"rb");
if (pFile == NULL) {
SendFileFiled(fup, VKERR_ERR_OPEN_FILE);
return;
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index bdb6bdc3b0..8e0907cb20 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -104,7 +104,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) UINT mid;
if (jnResponse.type() != JSON_STRING)
mid = jnResponse.as_int();
- else if (_stscanf(jnResponse.as_mstring(), L"%d", &mid) != 1)
+ else if (swscanf(jnResponse.as_mstring(), L"%d", &mid) != 1)
mid = 0;
if (param->iMsgID != -1)
@@ -281,7 +281,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (chat_id != 0) {
debugLogA("CVkProto::OnReceiveMessages chat_id != 0");
CMString action_chat = jnMsg["action"].as_mstring();
- int action_mid = _ttoi(jnMsg["action_mid"].as_mstring());
+ int action_mid = _wtoi(jnMsg["action_mid"].as_mstring());
if ((action_chat == "chat_kick_user") && (action_mid == m_myUserId))
KickFromChat(chat_id, uid, jnMsg, jnFUsers);
else {
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index b2b6d7233a..aedf678894 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -74,32 +74,32 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszGroup = LPGENW("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.position = 1;
odp.pDialog = new CVkOptionAccountForm(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Advanced");
+ odp.pwszTab = LPGENW("Advanced");
odp.position = 2;
odp.pDialog = new CVkOptionAdvancedForm(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("News and notifications");
+ odp.pwszTab = LPGENW("News and notifications");
odp.position = 3;
odp.pDialog = new CVkOptionFeedsForm(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("View");
+ odp.pwszTab = LPGENW("View");
odp.position = 4;
odp.pDialog = new CVkOptionViewForm(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Menu");
+ odp.pwszTab = LPGENW("Menu");
odp.position = 5;
odp.pDialog = new CVkOptionMenuForm(this);
Options_AddPage(wParam, &odp);
@@ -110,15 +110,15 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) ////////////////////// Account page //////////////////////////////////////////
static CVKLang vkLangCodes[] = {
- { NULL, LPGENT("Account language") },
- { L"en", LPGENT("English") },
- { L"ru", LPGENT("Russian") },
- { L"be", LPGENT("Belarusian") },
- { L"ua", LPGENT("Ukrainian") },
- { L"es", LPGENT("Spanish") },
- { L"fi", LPGENT("Finnish") },
- { L"de", LPGENT("German") },
- { L"it", LPGENT("Italian") },
+ { NULL, LPGENW("Account language") },
+ { L"en", LPGENW("English") },
+ { L"ru", LPGENW("Russian") },
+ { L"be", LPGENW("Belarusian") },
+ { L"ua", LPGENW("Ukrainian") },
+ { L"es", LPGENW("Spanish") },
+ { L"fi", LPGENW("Finnish") },
+ { L"de", LPGENW("German") },
+ { L"it", LPGENW("Italian") },
};
static CVKSync vkHistorySyncMethods[] =
@@ -192,7 +192,7 @@ void CVkOptionAccountForm::OnApply() {
m_proto->m_vkOptions.iSyncHistoryMetod = m_cbxSyncHistory.GetItemData(m_cbxSyncHistory.GetCurSel());
m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.GetCurSel());
- m_proto->m_vkOptions.ptszVKLang = (TCHAR *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
+ m_proto->m_vkOptions.ptszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
ptrT ptszGroupName(m_edtGroupName.GetText());
if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index f7c5c77900..a31f4658a2 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -33,7 +33,7 @@ LIST<CVkProto> vk_Instances(1, sttCompareProtocols); mir_cs csInstances;
static COLORREF sttColors[] = { 0, 1, 2, 3, 4, 5, 6 };
-CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
+CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) :
PROTO<CVkProto>(szModuleName, ptszUserName),
m_arRequestsQueue(10, sttCompareAsyncHttpRequest),
m_sendIds(3, PtrKeySortT),
@@ -61,7 +61,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
- TCHAR descr[512];
+ wchar_t descr[512];
mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = {sizeof(nlu)};
@@ -120,7 +120,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead);
HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged);
//Sounds
- SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENT("VKontakte newsfeed & notification event"));
+ SkinAddNewSoundExT("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event"));
InitPopups();
InitMenus();
@@ -233,70 +233,70 @@ void CVkProto::InitMenus() mi.pszService = PS_VISITPROFILE;
mi.position = -200001000 + CMI_VISITPROFILE;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_VISITPROFILE));
- mi.name.t = LPGENT("Visit profile");
+ mi.name.w = LPGENW("Visit profile");
SET_UID(mi, 0x828cc50e, 0x398d, 0x43a2, 0xbf, 0xd3, 0xa9, 0x96, 0x47, 0x9d, 0x52, 0xff);
m_hContactMenuItems[CMI_VISITPROFILE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_MARKMESSAGESASREAD;
mi.position = -200001000 + CMI_MARKMESSAGESASREAD;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_MARKMESSAGESASREAD));
- mi.name.t = LPGENT("Mark messages as read");
+ mi.name.w = LPGENW("Mark messages as read");
SET_UID(mi, 0x2587a649, 0xe5d5, 0x4e90, 0x8b, 0x35, 0x81, 0x4c, 0xb1, 0x5, 0x94, 0x7);
m_hContactMenuItems[CMI_MARKMESSAGESASREAD] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_WALLPOST;
mi.position = -200001000 + CMI_WALLPOST;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL));
- mi.name.t = LPGENT("Send message to user\'s wall");
+ mi.name.w = LPGENW("Send message to user\'s wall");
SET_UID(mi, 0xd8841aaf, 0x15f6, 0x4be9, 0x9f, 0x4f, 0x16, 0xa9, 0x47, 0x6a, 0x19, 0x81);
m_hContactMenuItems[CMI_WALLPOST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_ADDASFRIEND;
mi.position = -200001000 + CMI_ADDASFRIEND;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDADD));
- mi.name.t = LPGENT("Add as friend");
+ mi.name.w = LPGENW("Add as friend");
SET_UID(mi, 0xf11b9a7f, 0x569, 0x4023, 0xb0, 0xd6, 0xa3, 0x16, 0xf6, 0xd4, 0xfb, 0xb5);
m_hContactMenuItems[CMI_ADDASFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_DELETEFRIEND;
mi.position = -200001000 + CMI_DELETEFRIEND;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL));
- mi.name.t = LPGENT("Delete from friend list");
+ mi.name.w = LPGENW("Delete from friend list");
SET_UID(mi, 0x1e26514, 0x854f, 0x4e60, 0x8c, 0xf8, 0xab, 0xaa, 0xe0, 0xc3, 0xa5, 0xa7);
m_hContactMenuItems[CMI_DELETEFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_BANUSER;
mi.position = -200001000 + CMI_BANUSER;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BAN));
- mi.name.t = LPGENT("Ban user");
+ mi.name.w = LPGENW("Ban user");
SET_UID(mi, 0x7ba06bab, 0xf770, 0x4938, 0x9c, 0x76, 0xef, 0x40, 0xbc, 0x55, 0x0, 0x9b);
m_hContactMenuItems[CMI_BANUSER] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_REPORTABUSE;
mi.position = -200001000 + CMI_REPORTABUSE;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_ABUSE));
- mi.name.t = LPGENT("Report abuse");
+ mi.name.w = LPGENW("Report abuse");
SET_UID(mi, 0x56454cb9, 0xd80, 0x4050, 0xbe, 0xfc, 0x2c, 0xf6, 0x10, 0x2a, 0x7d, 0x19);
m_hContactMenuItems[CMI_REPORTABUSE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_DESTROYKICKCHAT;
mi.position = -200001000 + CMI_DESTROYKICKCHAT;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL));
- mi.name.t = LPGENT("Destroy room");
+ mi.name.w = LPGENW("Destroy room");
SET_UID(mi, 0x4fa6e75a, 0x30cd, 0x4482, 0xae, 0x8f, 0x0, 0x38, 0xd0, 0x17, 0x33, 0xcd);
m_hContactMenuItems[CMI_DESTROYKICKCHAT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_OPENBROADCAST;
mi.position = -200001000 + CMI_OPENBROADCAST;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BROADCAST));
- mi.name.t = LPGENT("Open broadcast");
+ mi.name.w = LPGENW("Open broadcast");
SET_UID(mi, 0x85251a06, 0xf734, 0x4985, 0x8c, 0x36, 0x6f, 0x66, 0x46, 0xf9, 0xa0, 0x10);
m_hContactMenuItems[CMI_OPENBROADCAST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_LOADVKNEWS;
mi.position = -200001000 + CMI_LOADVKNEWS;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
- mi.name.t = LPGENT("Load news from VK");
+ mi.name.w = LPGENW("Load news from VK");
SET_UID(mi, 0xe1f6888b, 0x21ae, 0x409f, 0x82, 0xa2, 0x7b, 0x72, 0xef, 0x47, 0x9, 0xc0);
m_hContactMenuItems[CMI_LOADVKNEWS] = Menu_AddContactMenuItem(&mi, m_szModuleName);
@@ -304,7 +304,7 @@ void CVkProto::InitMenus() mi.pszService = PS_GETSERVERHISTORY;
mi.position = -200001000 + CMI_GETSERVERHISTORY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("Reload messages from vk.com...");
+ mi.name.w = LPGENW("Reload messages from vk.com...");
SET_UID(mi, 0xc6b59e9f, 0x5250, 0x4146, 0xb6, 0xf3, 0x2d, 0xe1, 0x4, 0x3b, 0x95, 0xf5);
m_hContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
@@ -313,42 +313,42 @@ void CVkProto::InitMenus() mi.pszService = PS_GETSERVERHISTORYLAST1DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST1DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for last 1 day");
+ mi.name.w = LPGENW("for last 1 day");
SET_UID(mi, 0x508dce88, 0x1a9a, 0x4dd7, 0x90, 0xf4, 0x41, 0x35, 0x7b, 0xc3, 0x17, 0xed);
m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST1DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST3DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST3DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for last 3 days");
+ mi.name.w = LPGENW("for last 3 days");
SET_UID(mi, 0x9a878764, 0x5bbf, 0x433a, 0xbd, 0x50, 0xa9, 0xb9, 0x16, 0x1f, 0x99, 0x29);
m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST3DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST7DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST7DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for last week");
+ mi.name.w = LPGENW("for last week");
SET_UID(mi, 0xc6482460, 0xd280, 0x4596, 0x97, 0x4b, 0xf7, 0xfa, 0x6d, 0xe, 0xd5, 0xda);
m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST7DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST30DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST30DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for last 30 days");
+ mi.name.w = LPGENW("for last 30 days");
SET_UID(mi, 0xc48e8a9f, 0x2860, 0x4d5b, 0xa8, 0xdf, 0xb8, 0x3f, 0xdf, 0x7b, 0xa2, 0xba);
m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST30DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST90DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST90DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for last 90 days");
+ mi.name.w = LPGENW("for last 90 days");
SET_UID(mi, 0xd8e30530, 0xa585, 0x4672, 0xa6, 0x39, 0x18, 0xc9, 0xc9, 0xcb, 0xc7, 0x7d);
m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST90DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETALLSERVERHISTORYFORCONTACT;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETALLSERVERHISTORYFORCONTACT;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
- mi.name.t = LPGENT("for all time");
+ mi.name.w = LPGENW("for all time");
SET_UID(mi, 0xaee3d02b, 0x3667, 0x47c8, 0x9f, 0x43, 0x14, 0xb7, 0xab, 0x52, 0x14, 0x94);
m_hContactHistoryMenuItems[CHMI_GETALLSERVERHISTORYFORCONTACT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
}
@@ -418,7 +418,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa void CVkProto::InitPopups(void)
{
- TCHAR desc[256];
+ wchar_t desc[256];
char name[256];
POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
@@ -446,14 +446,14 @@ void CVkProto::InitPopups(void) m_hPopupClassNotification = Popup_RegisterClass(&ppc);
}
-void CVkProto::MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle, bool err)
+void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err)
{
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.ptszTitle = szTitle;
- ppd.ptszText = szMsg;
+ ppd.pwszTitle = szTitle;
+ ppd.pwszText = szMsg;
ppd.pszClassName = name;
ppd.hContact = hContact;
ppd.PluginData = new CVkSendMsgParam(hContact);
@@ -534,7 +534,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr) {
debugLogA("CVkProto::AddToList");
- int uid = _ttoi(psr->id.t);
+ int uid = _wtoi(psr->id.w);
if (!uid)
return NULL;
@@ -543,7 +543,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr) return hContact;
}
-int CVkProto::AuthRequest(MCONTACT hContact, const TCHAR *message)
+int CVkProto::AuthRequest(MCONTACT hContact, const wchar_t *message)
{
debugLogA("CVkProto::AuthRequest");
if (!IsOnline())
@@ -553,9 +553,9 @@ int CVkProto::AuthRequest(MCONTACT hContact, const TCHAR *message) if (userID == -1 || !hContact || userID == VK_FEED_USER)
return 1;
- TCHAR msg[501] = {0};
+ wchar_t msg[501] = {0};
if (message)
- _tcsncpy_s(msg, 500, message, _TRUNCATE);
+ wcsncpy_s(msg, 500, message, _TRUNCATE);
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.add.json", true, &CVkProto::OnReceiveAuthRequest)
<< INT_PARAM("user_id", userID)
@@ -616,7 +616,7 @@ int CVkProto::Authorize(MEVENT hDbEvent) return AuthRequest(hContact, NULL);
}
-int CVkProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)
+int CVkProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
debugLogA("CVkProto::AuthDeny");
if (!IsOnline())
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index ce1f7f02ed..0b8e5b5962 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -45,7 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CVkProto : public PROTO<CVkProto>
{
- CVkProto(const char*, const TCHAR*);
+ CVkProto(const char*, const wchar_t*);
~CVkProto();
//====================================================================================
@@ -54,16 +54,16 @@ struct CVkProto : public PROTO<CVkProto> virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR *email);
- virtual HANDLE __cdecl SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t *email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SetStatus(int iNewStatus);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
@@ -118,7 +118,7 @@ struct CVkProto : public PROTO<CVkProto> __forceinline bool IsOnline() const { return m_bOnline; }
void OnTimerTic();
void ClearAccessToken();
- TCHAR* GetUserStoredPassword(void);
+ wchar_t* GetUserStoredPassword(void);
void ShowCaptchaInBrowser(HBITMAP hBitmap);
static mir_cs m_csTimer;
@@ -232,7 +232,7 @@ private: //==== PopUps ========================================================================
void InitPopups(void);
- void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle, bool err = false);
+ void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle, bool err = false);
//==== Hooks =========================================================================
@@ -302,7 +302,7 @@ private: void OnReceiveMessages(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveDlgs(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- void WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly);
+ void WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, bool bFriendsOnly);
void GetServerHistoryLastNDay(MCONTACT hContact, int NDay);
void GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once = false);
void OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq);
@@ -358,7 +358,7 @@ private: void OnLoggedOut();
void ShutdownSession();
void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl);
- void GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen);
+ void GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen);
void ReloadAvatarInfo(MCONTACT hContact);
void __cdecl SendMsgAck(void *param);
void __cdecl ChatContactTypingThread(void *p);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index bc5ebb88d2..c19c3610bf 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -17,19 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE CVkProto::SearchBasic(const TCHAR *id)
+HANDLE CVkProto::SearchBasic(const wchar_t *id)
{
ForkThread(&CVkProto::SearchBasicThread, (void *)id);
return (HANDLE)1;
}
-HANDLE CVkProto::SearchByEmail(const TCHAR *email)
+HANDLE CVkProto::SearchByEmail(const wchar_t *email)
{
ForkThread(&CVkProto::SearchByMailThread, (void *)email);
return (HANDLE)1;
}
-HANDLE CVkProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
+HANDLE CVkProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName)
{
PROTOSEARCHBYNAME *psr = new (PROTOSEARCHBYNAME);
@@ -47,7 +47,7 @@ void CVkProto::SearchBasicThread(void *id) if (!IsOnline())
return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/users.get.json", true, &CVkProto::OnSearch)
- << TCHAR_PARAM("user_ids", (TCHAR *)id)
+ << TCHAR_PARAM("user_ids", (wchar_t *)id)
<< CHAR_PARAM("fields", "nickname, domain");
pReq->pUserInfo = NULL;
Push(pReq);
@@ -59,7 +59,7 @@ void CVkProto::SearchByMailThread(void *email) if (!IsOnline())
return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/account.lookupContacts.json", true, &CVkProto::OnSearchByMail)
- << TCHAR_PARAM("contacts", (TCHAR *)email)
+ << TCHAR_PARAM("contacts", (wchar_t *)email)
<< CHAR_PARAM("service", "email");
Push(pReq);
}
@@ -68,14 +68,14 @@ void __cdecl CVkProto::SearchThread(void *p) {
PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
- TCHAR arg[200];
+ wchar_t arg[200];
mir_sntprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(L"CVkProto::SearchThread %s", arg);
if (!IsOnline())
return;
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/users.search.json", true, &CVkProto::OnSearch)
- << TCHAR_PARAM("q", (TCHAR *)arg)
+ << TCHAR_PARAM("q", (wchar_t *)arg)
<< CHAR_PARAM("fields", "nickname, domain")
<< INT_PARAM("count", 200);
pReq->pUserInfo = p;
@@ -126,19 +126,19 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Domain(jnRecord["domain"].as_mstring());
- psr.id.t = mir_tstrdup(Id);
- psr.firstName.t = mir_tstrdup(FirstName);
- psr.lastName.t = mir_tstrdup(LastName);
- psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
+ psr.id.w = mir_tstrdup(Id);
+ psr.firstName.w = mir_tstrdup(FirstName);
+ psr.lastName.w = mir_tstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
bool filter = true;
if (pParam) {
- if (psr.firstName.t && pParam->pszFirstName)
- filter = tlstrstr(psr.firstName.t, pParam->pszFirstName) && filter;
- if (psr.lastName.t && pParam->pszLastName)
- filter = tlstrstr(psr.lastName.t, pParam->pszLastName) && filter;
- if (psr.nick.t && pParam->pszNick)
- filter = tlstrstr(psr.nick.t, pParam->pszNick) && filter;
+ if (psr.firstName.w && pParam->pszFirstName)
+ filter = tlstrstr(psr.firstName.w, pParam->pszFirstName) && filter;
+ if (psr.lastName.w && pParam->pszLastName)
+ filter = tlstrstr(psr.lastName.w, pParam->pszLastName) && filter;
+ if (psr.nick.w && pParam->pszNick)
+ filter = tlstrstr(psr.nick.w, pParam->pszNick) && filter;
}
if (filter)
@@ -184,11 +184,11 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Email(jnRecord["contact"].as_mstring());
- psr.id.t = mir_tstrdup(Id);
- psr.firstName.t = mir_tstrdup(FirstName);
- psr.lastName.t = mir_tstrdup(LastName);
- psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
- psr.email.t = mir_tstrdup(Email);
+ psr.id.w = mir_tstrdup(Id);
+ psr.firstName.w = mir_tstrdup(FirstName);
+ psr.lastName.w = mir_tstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
+ psr.email.w = mir_tstrdup(Email);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 8a3566270c..add498f486 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -160,7 +160,7 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnAudio = jnResponse["audio"];
if (!jnAudio) {
CMString tszStatusText(jnResponse["text"].as_mstring());
- if (tszStatusText[0] != TCHAR(9835))
+ if (tszStatusText[0] != wchar_t(9835))
setTString("OldStatusMsg", tszStatusText);
}
}
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index ad7ff94525..a1d074a9ad 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -98,7 +98,7 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr) /////////////////////////////////////////////////////////////////////////////////////////
-CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files) :
+CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files) :
hContact(_hContact),
Desc(mir_tstrdup(_desc)),
FileName(mir_tstrdup(_files[0])),
@@ -125,11 +125,11 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() if (fname)
mir_free(fname);
- TCHAR img[] = L".jpg .jpeg .png .bmp";
- TCHAR audio[] = L".mp3";
+ wchar_t img[] = L".jpg .jpeg .png .bmp";
+ wchar_t audio[] = L".mp3";
- TCHAR DRIVE[3], DIR[256], FNAME[256], EXT[256];
- _tsplitpath(FileName, DRIVE, DIR, FNAME, EXT);
+ wchar_t DRIVE[3], DIR[256], FNAME[256], EXT[256];
+ _wsplitpath(FileName, DRIVE, DIR, FNAME, EXT);
T2Utf pszFNAME(FNAME), pszEXT(EXT);
CMStringA fn(FORMAT, "%s%s", pszFNAME, pszEXT);
@@ -155,7 +155,7 @@ CVkFileUploadParam::VKFileType CVkFileUploadParam::GetType() CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId)
{
- int user_id = _ttoi(ptszId);
+ int user_id = _wtoi(ptszId);
return m_users.find((CVkChatUser*)&user_id);
}
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 5d084189e6..86cee657fe 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -81,17 +81,17 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&); struct CVkFileUploadParam : public MZeroedObject {
enum VKFileType { typeInvalid, typeImg, typeAudio, typeDoc, typeNotSupported };
- TCHAR *FileName;
- TCHAR *Desc;
+ wchar_t *FileName;
+ wchar_t *Desc;
char *atr;
char *fname;
MCONTACT hContact;
VKFileType filetype;
- CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files);
+ CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files);
~CVkFileUploadParam();
VKFileType GetType();
- __forceinline bool IsAccess() { return ::_taccess(FileName, 0) == 0; }
+ __forceinline bool IsAccess() { return ::_waccess(FileName, 0) == 0; }
__forceinline char* atrName() { GetType(); return atr; }
__forceinline char* fileName() { GetType(); return fname; }
};
@@ -203,9 +203,9 @@ struct CVkUserInfo : public MZeroedObject { enum VKObjType { vkNull, vkPost, vkPhoto, vkVideo, vkComment, vkTopic, vkUsers, vkCopy, vkInvite };
struct CVKNotification {
- TCHAR *ptszType;
+ wchar_t *ptszType;
VKObjType vkParent, vkFeedback;
- TCHAR *ptszTranslate;
+ wchar_t *ptszTranslate;
};
struct CVKNewsItem : public MZeroedObject {
@@ -237,7 +237,7 @@ enum BBCSupport : BYTE { bbcNo, bbcBasic, bbcAdvanced }; struct CVKBBCItem {
VKBBCType vkBBCType;
BBCSupport vkBBCSettings;
- TCHAR *ptszTempate;
+ wchar_t *ptszTempate;
};
struct CVKChatContactTypingParam {
@@ -252,12 +252,12 @@ struct CVKChatContactTypingParam { struct CVKInteres {
const char *szField;
- TCHAR *ptszTranslate;
+ wchar_t *ptszTranslate;
};
struct CVKLang {
- TCHAR *szCode;
- TCHAR *szDescription;
+ wchar_t *szCode;
+ wchar_t *szDescription;
};
enum MarkMsgReadOn : BYTE { markOnRead, markOnReceive, markOnReply, markOnTyping };
@@ -266,12 +266,12 @@ enum MusicSendMetod : BYTE { sendNone, sendStatusOnly, sendBroadcastOnly, sendBr enum IMGBBCSypport : BYTE { imgNo, imgFullSize, imgPreview130, imgPreview604 };
struct CVKSync {
- const TCHAR *type;
+ const wchar_t *type;
SyncHistoryMetod data;
};
struct CVKMarkMsgRead {
- const TCHAR *type;
+ const wchar_t *type;
MarkMsgReadOn data;
};
@@ -351,9 +351,9 @@ struct CVKOptions { CMOption<DWORD> iInvisibleInterval;
CMOption<DWORD> iMaxFriendsCount;
- CMOption<TCHAR*> ptszDefaultGroup;
- CMOption<TCHAR*> ptszReturnChatMessage;
- CMOption<TCHAR*> ptszVKLang;
+ CMOption<wchar_t*> ptszDefaultGroup;
+ CMOption<wchar_t*> ptszReturnChatMessage;
+ CMOption<wchar_t*> ptszVKLang;
CVKOptions(PROTO_INTERFACE *proto);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 2f2dcdae8b..185f52e583 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -297,7 +297,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) tszValue = jnItem["bdate"].as_mstring();
if (!tszValue.IsEmpty()) {
int d, m, y, iReadCount;
- iReadCount = _stscanf(tszValue, L"%d.%d.%d", &d, &m, &y);
+ iReadCount = swscanf(tszValue, L"%d.%d.%d", &d, &m, &y);
if (iReadCount > 1) {
if (iReadCount == 3)
setWord(hContact, "BirthYear", y);
@@ -330,7 +330,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) db_set_dw(hContact, "BuddyExpectator", "LastSeen", (DWORD)time(NULL));
db_set_dw(hContact, "BuddyExpectator", "LastStatus", ID_STATUS_ONLINE);
- int online_app = _ttoi(jnItem["online_app"].as_mstring());
+ int online_app = _wtoi(jnItem["online_app"].as_mstring());
int online_mobile = jnItem["online_mobile"].as_int();
if (online_app == 0 && online_mobile == 0)
@@ -368,7 +368,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setTString(hContact, "AudioUrl", jnAudio["url"].as_mstring());
}
}
- else if (tszValue[0] == TCHAR(9835) && tszValue.GetLength() > 2) {
+ else if (tszValue[0] == wchar_t(9835) && tszValue.GetLength() > 2) {
setTString(hContact, "ListeningTo", &(tszValue.GetBuffer())[2]);
db_unset(hContact, m_szModuleName, "AudioUrl");
}
diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index 3dc00b686f..5871dbcff3 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.cpp @@ -30,7 +30,7 @@ INT_PTR __cdecl CVkProto::SvcWallPost(WPARAM hContact, LPARAM) return 0;
}
-void CVkProto::WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly)
+void CVkProto::WallPost(MCONTACT hContact, wchar_t *ptszMsg, wchar_t *ptszUrl, bool bFriendsOnly)
{
debugLogA("CVkProto::WallPost");
if (!IsOnline() || (IsEmpty(ptszMsg) && IsEmpty(ptszUrl)))
diff --git a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp index 9b85cf80bb..ef8fec4bb3 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp @@ -19,7 +19,7 @@ static NETLIBHTTPHEADER s_imageHeaders[] = { "Content-Type", "multipart/form-data; boundary=zzXXzzYYzzXXzzQQ" }
};
-static std::vector<unsigned char>* sttFileToMem(const TCHAR *ptszFileName)
+static std::vector<unsigned char>* sttFileToMem(const wchar_t *ptszFileName)
{
HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 2121430f62..e1839586e6 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -8,8 +8,8 @@ INT_PTR WhatsAppProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (id == NULL)
return GAIR_NOAVATAR;
- std::tstring tszFileName = GetAvatarFileName(pai->hContact);
- _tcsncpy_s(pai->filename, tszFileName.c_str(), _TRUNCATE);
+ std::wstring tszFileName = GetAvatarFileName(pai->hContact);
+ wcsncpy_s(pai->filename, tszFileName.c_str(), _TRUNCATE);
pai->format = PA_FORMAT_JPEG;
ptrA szAvatarId(getStringA(pai->hContact, WHATSAPP_KEY_AVATAR_ID));
@@ -44,9 +44,9 @@ INT_PTR WhatsAppProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) return -1;
}
-std::tstring WhatsAppProto::GetAvatarFileName(MCONTACT hContact)
+std::wstring WhatsAppProto::GetAvatarFileName(MCONTACT hContact)
{
- std::tstring result = m_tszAvatarFolder + L"\\";
+ std::wstring result = m_tszAvatarFolder + L"\\";
std::string jid;
if (hContact != NULL) {
@@ -58,17 +58,17 @@ std::tstring WhatsAppProto::GetAvatarFileName(MCONTACT hContact) }
else jid = m_szJid;
- return result + std::tstring(_A2T(jid.c_str())) + L".jpg";
+ return result + std::wstring(_A2T(jid.c_str())) + L".jpg";
}
INT_PTR WhatsAppProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- std::tstring tszOwnAvatar(m_tszAvatarFolder + L"\\myavatar.jpg");
- _tcsncpy_s((TCHAR*)wParam, lParam, tszOwnAvatar.c_str(), _TRUNCATE);
+ std::wstring tszOwnAvatar(m_tszAvatarFolder + L"\\myavatar.jpg");
+ wcsncpy_s((wchar_t*)wParam, lParam, tszOwnAvatar.c_str(), _TRUNCATE);
return 0;
}
-static std::vector<unsigned char>* sttFileToMem(const TCHAR *ptszFileName)
+static std::vector<unsigned char>* sttFileToMem(const wchar_t *ptszFileName)
{
HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
@@ -81,12 +81,12 @@ static std::vector<unsigned char>* sttFileToMem(const TCHAR *ptszFileName) return result;
}
-int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName)
+int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t *ptszFileName)
{
if (!isOnline() || ptszFileName == NULL)
return 1;
- if (_taccess(ptszFileName, 4) != 0)
+ if (_waccess(ptszFileName, 4) != 0)
return errno;
ResizeBitmap resize = { 0 };
@@ -100,15 +100,15 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const if (hbmpPreview == NULL)
return 3;
- TCHAR tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
+ wchar_t tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
if (hContact == NULL) {
mir_sntprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
mir_sntprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
}
else {
- std::tstring tszContactAva = GetAvatarFileName(hContact);
- _tcsncpy_s(tszMyFile, tszContactAva.c_str(), _TRUNCATE);
- _tcsncpy_s(tszTempFile, (tszContactAva + L".preview").c_str(), _TRUNCATE);
+ std::wstring tszContactAva = GetAvatarFileName(hContact);
+ wcsncpy_s(tszMyFile, tszContactAva.c_str(), _TRUNCATE);
+ wcsncpy_s(tszTempFile, (tszContactAva + L".preview").c_str(), _TRUNCATE);
}
IMGSRVC_INFO saveInfo = { sizeof(saveInfo), 0 };
@@ -130,5 +130,5 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const INT_PTR WhatsAppProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
- return InternalSetAvatar(NULL, m_szJid.c_str(), (const TCHAR*)lParam);
+ return InternalSetAvatar(NULL, m_szJid.c_str(), (const wchar_t*)lParam);
}
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index e55e8274cf..f33a628461 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-static const TCHAR *sttStatuses[] = { LPGENT("Members"), LPGENT("Owners") };
+static const wchar_t *sttStatuses[] = { LPGENW("Members"), LPGENW("Owners") };
enum
{
@@ -100,17 +100,17 @@ int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam) static gc_item sttLogListItems[] =
{
- { LPGENT("&Invite a user"), IDM_INVITE, MENU_ITEM },
+ { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Room options"), 0, MENU_NEWPOPUP },
- { LPGENT("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM },
- { LPGENT("&Quit chat session"), IDM_LEAVE, MENU_POPUPITEM },
+ { LPGENW("&Room options"), 0, MENU_NEWPOPUP },
+ { LPGENW("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM },
+ { LPGENW("&Quit chat session"), IDM_LEAVE, MENU_POPUPITEM },
#ifdef _DEBUG
- { LPGENT("Set &avatar"), IDM_AVATAR, MENU_POPUPITEM }, // doesn't work, therefore commented out
+ { LPGENW("Set &avatar"), IDM_AVATAR, MENU_POPUPITEM }, // doesn't work, therefore commented out
#endif
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM },
- { LPGENT("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM },
+ { LPGENW("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM },
+ { LPGENW("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM },
};
void WhatsAppProto::ChatLogMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch)
@@ -165,7 +165,7 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
{
- TCHAR tszFileName[MAX_PATH], filter[256];
+ wchar_t tszFileName[MAX_PATH], filter[256];
Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
@@ -178,7 +178,7 @@ void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo) ofn.lpstrInitialDir = L".";
ofn.lpstrDefExt = L"";
if (GetOpenFileName(&ofn))
- if (_taccess(tszFileName, 4) != -1)
+ if (_waccess(tszFileName, 4) != -1)
InternalSetAvatar(pInfo->hContact, _T2A(pInfo->tszJid), tszFileName);
}
@@ -187,12 +187,12 @@ void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo) static gc_item sttNickListItems[] =
{
- { LPGENT("&Add to roster"), IDM_ADD_RJID, MENU_POPUPITEM },
+ { LPGENW("&Add to roster"), IDM_ADD_RJID, MENU_POPUPITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Kick"), IDM_KICK, MENU_ITEM },
+ { LPGENW("&Kick"), IDM_KICK, MENU_ITEM },
{ NULL, 0, MENU_SEPARATOR },
- { LPGENT("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM },
- { LPGENT("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM },
+ { LPGENW("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM },
+ { LPGENW("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM },
};
void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch)
@@ -216,7 +216,7 @@ void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) }
}
-void WhatsAppProto::AddChatUser(WAChatInfo*, const TCHAR *ptszJid)
+void WhatsAppProto::AddChatUser(WAChatInfo*, const wchar_t *ptszJid)
{
std::string jid((char*)_T2A(ptszJid));
MCONTACT hContact = ContactIDToHContact(jid);
@@ -226,8 +226,8 @@ void WhatsAppProto::AddChatUser(WAChatInfo*, const TCHAR *ptszJid) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = (TCHAR*)ptszJid;
- psr.nick.t = GetChatUserNick(jid);
+ psr.id.w = (wchar_t*)ptszJid;
+ psr.nick.w = GetChatUserNick(jid);
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
@@ -236,7 +236,7 @@ void WhatsAppProto::AddChatUser(WAChatInfo*, const TCHAR *ptszJid) CallService(MS_ADDCONTACT_SHOW, (WPARAM)pcli->hwndContactList, (LPARAM)&acs);
}
-void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid)
+void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid)
{
if (!isOnline())
return;
@@ -290,7 +290,7 @@ int WhatsAppProto::OnChatMenu(WPARAM, LPARAM lParam) WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &nick)
{
- TCHAR *ptszJid = str2t(jid), *ptszNick = str2t(nick);
+ wchar_t *ptszJid = str2t(jid), *ptszNick = str2t(nick);
WAChatInfo *pInfo = new WAChatInfo(ptszJid, ptszNick);
m_chats[jid] = pInfo;
@@ -328,9 +328,9 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n return pInfo;
}
-TCHAR* WhatsAppProto::GetChatUserNick(const std::string &jid)
+wchar_t* WhatsAppProto::GetChatUserNick(const std::string &jid)
{
- TCHAR* tszNick;
+ wchar_t* tszNick;
if (m_szJid != jid) {
MCONTACT hContact = ContactIDToHContact(jid);
tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 3dfeec59a1..2c9f0c17e9 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -133,11 +133,11 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact) bool denied = getBool(hContact, WHATSAPP_KEY_LAST_SEEN_DENIED, false);
if (lastSeen > 0) {
time_t ts = lastSeen;
- TCHAR stzLastSeen[MAX_PATH];
+ wchar_t stzLastSeen[MAX_PATH];
if (status == ID_STATUS_ONLINE)
- _tcsftime(stzLastSeen, _countof(stzLastSeen), TranslateT("Last online on %x at %X"), localtime(&ts));
+ wcsftime(stzLastSeen, _countof(stzLastSeen), TranslateT("Last online on %x at %X"), localtime(&ts));
else
- _tcsftime(stzLastSeen, _countof(stzLastSeen), denied ? TranslateT("Denied: Last online on %x at %X") : TranslateT("Last seen on %x at %X"), localtime(&ts));
+ wcsftime(stzLastSeen, _countof(stzLastSeen), denied ? TranslateT("Denied: Last online on %x at %X") : TranslateT("Last seen on %x at %X"), localtime(&ts));
ss << stzLastSeen;
}
@@ -162,15 +162,15 @@ void WhatsAppProto::onSendGetPicture(const std::string &jid, const std::vector<u debugLogA("Updating avatar for jid %s", jid.c_str());
// Save avatar
- std::tstring filename = GetAvatarFileName(hContact);
- FILE *f = _tfopen(filename.c_str(), L"wb");
+ std::wstring filename = GetAvatarFileName(hContact);
+ FILE *f = _wfopen(filename.c_str(), L"wb");
size_t r = fwrite(std::string(data.begin(), data.end()).c_str(), 1, data.size(), f);
fclose(f);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
ai.format = PA_FORMAT_JPEG;
- _tcsncpy_s(ai.filename, filename.c_str(), _TRUNCATE);
+ wcsncpy_s(ai.filename, filename.c_str(), _TRUNCATE);
int ackResult;
if (r > 0) {
@@ -184,7 +184,7 @@ void WhatsAppProto::onSendGetPicture(const std::string &jid, const std::vector<u }
}
-TCHAR* WhatsAppProto::GetContactDisplayName(const string& jid)
+wchar_t* WhatsAppProto::GetContactDisplayName(const string& jid)
{
MCONTACT hContact = ContactIDToHContact(jid);
return (hContact) ? pcli->pfnGetContactDisplayName(hContact, 0) : L"none";
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index b770210dd6..501a09151a 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -1,9 +1,9 @@ #include "stdafx.h"
-#define szAskSendSms LPGEN("An SMS with registration code will be sent to your mobile phone.\nNotice that you are not able to use the real WhatsApp and this plugin simultaneously!\nContinue?")
-#define szAskCall LPGEN("A call with registration code will be made to your mobile phone.\nNotice that you are not able to use the real WhatsApp and this plugin simultaneously!\nContinue?")
-#define szPasswordSet LPGEN("Your password has been set automatically. You can proceed with login now.")
-#define szSpecifyCode LPGEN("Please correctly specify your registration code received by SMS/Voice.")
+#define szAskSendSms LPGENW("An SMS with registration code will be sent to your mobile phone.\nNotice that you are not able to use the real WhatsApp and this plugin simultaneously!\nContinue?")
+#define szAskCall LPGENW("A call with registration code will be made to your mobile phone.\nNotice that you are not able to use the real WhatsApp and this plugin simultaneously!\nContinue?")
+#define szPasswordSet LPGENW("Your password has been set automatically. You can proceed with login now.")
+#define szSpecifyCode LPGENW("Please correctly specify your registration code received by SMS/Voice.")
class COptionsDlg : public CProtoDlgBase<WhatsAppProto>
{
@@ -52,14 +52,14 @@ public: void OnRequestVoiceClick(CCtrlButton*)
{
- if (IDYES != MessageBox(GetHwnd(), TranslateT(szAskCall), PRODUCT_NAME, MB_YESNO))
+ if (IDYES != MessageBox(GetHwnd(), TranslateW(szAskCall), PRODUCT_NAME, MB_YESNO))
return;
ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
string password;
if (m_proto->Register(REG_STATE_REQ_CODE, string(cc), string(number), "voice", password)) {
if (!password.empty()) {
- MessageBox(GetHwnd(), TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
+ MessageBox(GetHwnd(), TranslateW(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
}
else {
@@ -73,14 +73,14 @@ public: void OnRequestSMSClick(CCtrlButton*)
{
- if (IDYES != MessageBox(GetHwnd(), TranslateT(szAskSendSms), PRODUCT_NAME, MB_YESNO))
+ if (IDYES != MessageBox(GetHwnd(), TranslateW(szAskSendSms), PRODUCT_NAME, MB_YESNO))
return;
ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
string password;
if (m_proto->Register(REG_STATE_REQ_CODE, string(cc), string(number), "sms", password)) {
if (!password.empty()) {
- MessageBox(GetHwnd(), TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
+ MessageBox(GetHwnd(), TranslateW(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
}
else {
@@ -95,7 +95,7 @@ public: void OnRegisterClick(CCtrlButton*)
{
if (GetWindowTextLength(m_pw1.GetHwnd()) != 3 || GetWindowTextLength(m_pw2.GetHwnd()) != 3)
- MessageBox(GetHwnd(), TranslateT(szSpecifyCode), PRODUCT_NAME, MB_ICONEXCLAMATION);
+ MessageBox(GetHwnd(), TranslateW(szSpecifyCode), PRODUCT_NAME, MB_ICONEXCLAMATION);
else {
char code[10];
GetWindowTextA(m_pw1.GetHwnd(), code, 4);
@@ -105,7 +105,7 @@ public: ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
if (m_proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code), password)) {
m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
- MessageBox(GetHwnd(), TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
+ MessageBox(GetHwnd(), TranslateW(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
}
}
m_proto->setByte("CodeRequestDone", 0);
@@ -133,11 +133,11 @@ INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) int WhatsAppProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszGroup = LPGENW("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = new COptionsDlg(this, IDD_OPTIONS);
Options_AddPage(wParam, &odp);
return 0;
diff --git a/protocols/WhatsApp/src/entities.h b/protocols/WhatsApp/src/entities.h index 657cc82f90..7ed362990e 100644 --- a/protocols/WhatsApp/src/entities.h +++ b/protocols/WhatsApp/src/entities.h @@ -14,9 +14,9 @@ struct send_direct struct input_box
{
- tstring text;
- tstring title;
- tstring defaultValue;
+ wstring text;
+ wstring title;
+ wstring defaultValue;
int limit;
void(__cdecl WhatsAppProto::*thread)(void*);
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index 26eea6b01e..f3e7513339 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -50,7 +50,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
WhatsAppProto *proto = new WhatsAppProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/WhatsApp/src/media.cpp b/protocols/WhatsApp/src/media.cpp index c94d5ab6c8..9b3bb6f5ff 100644 --- a/protocols/WhatsApp/src/media.cpp +++ b/protocols/WhatsApp/src/media.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const TCHAR* desc, TCHAR **ppszFiles) {
+HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const wchar_t* desc, wchar_t **ppszFiles) {
if (!isOnline())
return 0;
@@ -17,7 +17,7 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const TCHAR* desc, TCHAR **pps }
// get file size
- FILE *hFile = _tfopen(ppszFiles[0], L"rb");
+ FILE *hFile = _wfopen(ppszFiles[0], L"rb");
if (hFile == NULL) {
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
mir_free(name);
@@ -69,7 +69,7 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const TCHAR* desc, TCHAR **pps SHA256_CONTEXT sha256;
mir_sha256_init(&sha256);
- FILE *fd = _tfopen(ppszFiles[0], L"rb");
+ FILE *fd = _wfopen(ppszFiles[0], L"rb");
int read = 0;
do {
char buf[1024];
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index aa48df5444..388b12f309 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -112,7 +112,7 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg) return;
}
- const TCHAR *ptszBy;
+ const wchar_t *ptszBy;
switch (fmsg.status) {
case FMessage::STATUS_RECEIVED_BY_SERVER: ptszBy = TranslateT("server"); break;
case FMessage::STATUS_RECEIVED_BY_TARGET: ptszBy = pcli->pfnGetContactDisplayName(hContact, 0); break;
@@ -131,7 +131,7 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg) time_t ts = atol(fmsg.key.id.substr(0, delim).c_str());
- TCHAR ttime[64];
- _tcsftime(ttime, _countof(ttime), L"%X", localtime(&ts));
+ wchar_t ttime[64];
+ wcsftime(ttime, _countof(ttime), L"%X", localtime(&ts));
utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy));
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index a361ad3e16..56c0d3571e 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -4,15 +4,15 @@ struct SearchParam
{
- SearchParam(const TCHAR *_jid, LONG _id) :
+ SearchParam(const wchar_t *_jid, LONG _id) :
jid(_jid), id(_id)
{}
- std::tstring jid;
+ std::wstring jid;
LONG id;
};
-WhatsAppProto::WhatsAppProto(const char *proto_name, const TCHAR *username)
+WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username)
: PROTO<WhatsAppProto>(proto_name, username),
m_tszDefaultGroup(getTStringA(WHATSAPP_KEY_DEF_GROUP))
{
@@ -32,7 +32,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const TCHAR *username) HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu);
// Create standard network connection
- TCHAR descr[512];
+ wchar_t descr[512];
mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
@@ -41,14 +41,14 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const TCHAR *username) nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
WASocketConnection::initNetwork(m_hNetlibUser);
- m_tszAvatarFolder = std::tstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName;
+ m_tszAvatarFolder = std::wstring(VARST(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
@@ -173,10 +173,10 @@ int WhatsAppProto::SetStatus(int new_status) MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- if (psr->id.t == NULL)
+ if (psr->id.w == NULL)
return NULL;
- std::string phone(T2Utf(psr->id.t));
+ std::string phone(T2Utf(psr->id.w));
std::string jid(phone + "@s.whatsapp.net");
MCONTACT hContact = AddToContactList(jid, phone.c_str());
@@ -197,8 +197,8 @@ void WhatsAppProto::SearchAckThread(void *targ) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.nick.t = psr.firstName.t = psr.lastName.t = L"";
- psr.id.t = (TCHAR*)param->jid.c_str();
+ psr.nick.w = psr.firstName.w = psr.lastName.w = L"";
+ psr.id.w = (wchar_t*)param->jid.c_str();
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)param->id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)param->id, 0);
@@ -206,7 +206,7 @@ void WhatsAppProto::SearchAckThread(void *targ) delete param;
}
-HANDLE WhatsAppProto::SearchBasic(const TCHAR* id)
+HANDLE WhatsAppProto::SearchBasic(const wchar_t* id)
{
if (isOffline())
return 0;
@@ -264,7 +264,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
(WPARAM)WASocketConnection::hNetlibUser, (LPARAM)&nlhr);
- const TCHAR *ptszTitle = TranslateT("Registration");
+ const wchar_t *ptszTitle = TranslateT("Registration");
if (pnlhr == NULL) {
NotifyEvent(ptszTitle, TranslateT("Registration failed. Invalid server response."), NULL, WHATSAPP_EVENT_CLIENT);
return false;
@@ -366,16 +366,16 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return DefWindowProc(hwnd, message, wParam, lParam);
};
-void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, TCHAR* url)
+void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, wchar_t* url)
{
- TCHAR *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
- TCHAR *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
+ wchar_t *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
+ wchar_t *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
NotifyEvent(rawTitle, rawInfo, contact, flags, url);
mir_free(rawTitle);
mir_free(rawInfo);
}
-void WhatsAppProto::NotifyEvent(const TCHAR *title, const TCHAR *info, MCONTACT contact, DWORD flags, TCHAR* szUrl)
+void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONTACT contact, DWORD flags, wchar_t* szUrl)
{
int ret, timeout = 0;
COLORREF colorBack = 0, colorText = 0;
@@ -431,8 +431,8 @@ void WhatsAppProto::NotifyEvent(const TCHAR *title, const TCHAR *info, MCONTACT err.szProto = m_szModuleName;
err.cbSize = sizeof(err);
err.dwInfoFlags = NIIF_INTERN_TCHAR | niif_flags;
- err.tszInfoTitle = (TCHAR*)title;
- err.tszInfo = (TCHAR*)info;
+ err.tszInfoTitle = (wchar_t*)title;
+ err.tszInfo = (wchar_t*)info;
err.uTimeout = 1000 * timeout;
ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& err);
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 2822dd85d0..04a557f893 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -7,13 +7,13 @@ class WASocketConnection; struct WAChatInfo
{
- WAChatInfo(TCHAR *_jid, TCHAR *_nick) :
+ WAChatInfo(wchar_t *_jid, wchar_t *_nick) :
tszJid(_jid), tszNick(_nick)
{
bActive = false;
}
- map<std::string, std::tstring> m_unsentMsgs;
+ map<std::string, std::wstring> m_unsentMsgs;
ptrT tszJid, tszNick, tszOwner;
bool bActive;
@@ -23,7 +23,7 @@ struct WAChatInfo class WhatsAppProto : public PROTO<WhatsAppProto>, public WAListener, public WAGroupListener
{
public:
- WhatsAppProto(const char *proto_name, const TCHAR *username);
+ WhatsAppProto(const char *proto_name, const wchar_t *username);
~WhatsAppProto();
inline bool isOnline() const
@@ -44,13 +44,13 @@ public: virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles);
virtual int __cdecl SetStatus(int iNewStatus);
@@ -85,7 +85,7 @@ public: MCONTACT ContactIDToHContact(const std::string&);
void SetAllContactStatuses(int status, bool reset_client = false);
void UpdateStatusMsg(MCONTACT hContact);
- TCHAR* GetContactDisplayName(const string &jid);
+ wchar_t* GetContactDisplayName(const string &jid);
void RequestFriendship(MCONTACT hContact);
// Group chats ///////////////////////////////////////////////////////////////////////
@@ -98,11 +98,11 @@ public: void ChatLogMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
void NickListMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
- void AddChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid);
+ void AddChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid);
void EditChatSubject(WAChatInfo *pInfo);
void InviteChatUser(WAChatInfo *pInfo);
- void KickChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid);
- TCHAR* GetChatUserNick(const std::string &jid);
+ void KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid);
+ wchar_t* GetChatUserNick(const std::string &jid);
void SetChatAvatar(WAChatInfo *pInfo);
void onGroupMessageReceived(const FMessage &fmsg);
@@ -131,15 +131,15 @@ private: /// Avatars //////////////////////////////////////////////////////////////////////////
- std::tstring GetAvatarFileName(MCONTACT);
- std::tstring m_tszAvatarFolder;
+ std::wstring GetAvatarFileName(MCONTACT);
+ std::wstring m_tszAvatarFolder;
INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM);
INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM);
INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM);
INT_PTR __cdecl SetMyAvatar(WPARAM, LPARAM);
- int InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName);
+ int InternalSetAvatar(MCONTACT hContact, const char *szJid, const wchar_t *ptszFileName);
// Private data //////////////////////////////////////////////////////////////////////
@@ -196,8 +196,8 @@ protected: // Information providing /////////////////////////////////////////////////////////////
- void NotifyEvent(const TCHAR *title, const TCHAR *info, MCONTACT contact, DWORD flags, TCHAR *url = NULL);
- void NotifyEvent(const std::string &title, const std::string &info, MCONTACT contact, DWORD flags, TCHAR *url = NULL);
+ void NotifyEvent(const wchar_t *title, const wchar_t *info, MCONTACT contact, DWORD flags, wchar_t *url = NULL);
+ void NotifyEvent(const std::string &title, const std::string &info, MCONTACT contact, DWORD flags, wchar_t *url = NULL);
};
#endif
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp index 35f84bcc1e..71a33dc2fd 100644 --- a/protocols/WhatsApp/src/utils.cpp +++ b/protocols/WhatsApp/src/utils.cpp @@ -1,16 +1,16 @@ #include "stdafx.h"
-TCHAR* utils::removeA(TCHAR *str)
+wchar_t* utils::removeA(wchar_t *str)
{
if (str == NULL)
return NULL;
- TCHAR *p = _tcschr(str, '@');
+ wchar_t *p = wcschr(str, '@');
if (p) *p = 0;
return str;
}
-void utils::copyText(HWND hwnd, const TCHAR *text)
+void utils::copyText(HWND hwnd, const wchar_t *text)
{
if (!hwnd || !text) return;
@@ -18,8 +18,8 @@ void utils::copyText(HWND hwnd, const TCHAR *text) return;
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
- mir_tstrcpy((TCHAR*)GlobalLock(hMem), text);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
+ mir_tstrcpy((wchar_t*)GlobalLock(hMem), text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
@@ -45,13 +45,13 @@ std::string getLastErrorMsg() return ret;
}
-void utils::setStatusMessage(MCONTACT hContact, const TCHAR *ptszMessage)
+void utils::setStatusMessage(MCONTACT hContact, const wchar_t *ptszMessage)
{
if (ptszMessage != NULL) {
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- _tcsncpy_s(st.tszText, ptszMessage, _TRUNCATE);
+ wcsncpy_s(st.tszText, ptszMessage, _TRUNCATE);
CallService(MS_MSG_SETSTATUSTEXT, hContact, (LPARAM)&st);
}
else CallService(MS_MSG_SETSTATUSTEXT, hContact, NULL);
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h index 0e760f5013..333860c1dd 100644 --- a/protocols/WhatsApp/src/utils.h +++ b/protocols/WhatsApp/src/utils.h @@ -27,7 +27,7 @@ public: std::string getLastErrorMsg();
-__forceinline TCHAR* str2t(const std::string &str)
+__forceinline wchar_t* str2t(const std::string &str)
{ return mir_utf8decodeT(str.c_str());
}
@@ -36,10 +36,10 @@ std::vector<std::string> &split(const std::string &s, char delim, std::vector<st namespace utils
{
- TCHAR* removeA(TCHAR *str);
- void copyText(HWND hwnd, const TCHAR *text);
+ wchar_t* removeA(wchar_t *str);
+ void copyText(HWND hwnd, const wchar_t *text);
- void setStatusMessage(MCONTACT hContact, const TCHAR *ptszMessage);
+ void setStatusMessage(MCONTACT hContact, const wchar_t *ptszMessage);
BYTE* md5string(const BYTE*, int, BYTE* digest);
__forceinline BYTE* md5string(const std::string &str, BYTE* digest)
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index ec1696c65d..34f68acc0a 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -112,10 +112,10 @@ void __cdecl CYahooProto::send_avt_thread(void *psf) setByte("AvatarUL", 0);
}
-void CYahooProto::SendAvatar(const TCHAR *szFile)
+void CYahooProto::SendAvatar(const wchar_t *szFile)
{
struct _stat statbuf;
- if (_tstat(szFile, &statbuf) != 0) {
+ if (_wstat(szFile, &statbuf) != 0) {
LOG(("[YAHOO_SendAvatar] Error reading File information?!"));
return;
}
@@ -146,7 +146,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) {
avatar_info *avt = (avatar_info*)pavt;
int error = 0;
- TCHAR buf[4096];
+ wchar_t buf[4096];
if (avt == NULL) {
debugLogA("AVT IS NULL!!!");
@@ -241,7 +241,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) PROTO_AVATAR_INFORMATION ai;
ai.format = PA_FORMAT_PNG;
ai.hContact = hContact;
- _tcsncpy_s(ai.filename, buf, _TRUNCATE);
+ wcsncpy_s(ai.filename, buf, _TRUNCATE);
if (error)
setDword(hContact, "PictCK", 0);
@@ -295,7 +295,7 @@ void CYahooProto::ext_got_picture(const char*, const char *who, const char *pic_ // NO avatar URL??
if (!getTString("AvatarFile", &dbv)) {
struct _stat statbuf;
- if (_tstat(dbv.ptszVal, &statbuf) != 0) {
+ if (_wstat(dbv.ptszVal, &statbuf) != 0) {
LOG(("[ext_yahoo_got_picture] Avatar File Missing? Can't find file: %s", dbv.ptszVal));
}
else {
@@ -342,10 +342,10 @@ void CYahooProto::ext_got_picture(const char*, const char *who, const char *pic_ return;
}
- TCHAR z[1024];
+ wchar_t z[1024];
GetAvatarFileName(hContact, z, 1024, getByte(hContact, "AvatarType", 0));
- if (getDword(hContact, "PictCK", 0) != cksum || _taccess(z, 0) != 0) {
+ if (getDword(hContact, "PictCK", 0) != cksum || _waccess(z, 0) != 0) {
debugLogA("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",
getDword(hContact, "PictCK", 0), cksum);
@@ -460,7 +460,7 @@ void CYahooProto::ext_got_picture_checksum(const char*, const char *who, int cks setDword(hContact, "PictCK", cksum);
// Need to delete the Avatar File!!
- TCHAR szFile[MAX_PATH];
+ wchar_t szFile[MAX_PATH];
GetAvatarFileName(hContact, szFile, _countof(szFile) - 1, 0);
DeleteFile(szFile);
@@ -594,11 +594,11 @@ void CYahooProto::request_avatar(const char* who) else LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time));
}
-void CYahooProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, int cbLen, int type)
+void CYahooProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, int cbLen, int type)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
- if (_taccess(pszDest, 0))
+ if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
if (hContact != NULL) {
@@ -608,7 +608,7 @@ void CYahooProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, int cbLen else
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName);
- _tcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? L".swf" : L".png"), _TRUNCATE);
+ wcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? L".swf" : L".png"), _TRUNCATE);
}
INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
@@ -648,7 +648,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) pai->format = PA_FORMAT_PNG;
debugLogA("[YAHOO_GETAVATARINFO] filename: %s", pai->filename);
- if (_taccess(pai->filename, 0) == 0)
+ if (_waccess(pai->filename, 0) == 0)
return GAIR_SUCCESS;
if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL) {
@@ -733,7 +733,7 @@ return=0 on success, else on error */
INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR *buffer = (TCHAR*)wParam;
+ wchar_t *buffer = (wchar_t*)wParam;
int size = (int)lParam;
debugLogA("[YahooGetMyAvatar]");
@@ -749,7 +749,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (getDword("AvatarHash", 0)) {
if (!getTString("AvatarFile", &dbv)) {
- if (_taccess(dbv.ptszVal, 0) == 0) {
+ if (_waccess(dbv.ptszVal, 0) == 0) {
mir_tstrncpy(buffer, dbv.ptszVal, size - 1);
buffer[size - 1] = '\0';
@@ -771,8 +771,8 @@ return=0 for sucess INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
- TCHAR* tszFile = (TCHAR*)lParam;
- TCHAR tszMyFile[MAX_PATH + 1];
+ wchar_t* tszFile = (wchar_t*)lParam;
+ wchar_t tszMyFile[MAX_PATH + 1];
GetAvatarFileName(NULL, tszMyFile, MAX_PATH, 2);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 105f86f19e..ce59ae92f6 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -37,7 +37,7 @@ struct InviteChatReqParam {
char* room;
char* who;
- TCHAR* msg;
+ wchar_t* msg;
CYahooProto* ppro;
InviteChatReqParam(const char* room, const char* who, const char* msg, CYahooProto* ppro)
@@ -51,9 +51,9 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA void ext_yahoo_conf_userdecline(int id, const char*, const char *who, const char *room, const char *msg)
{
- TCHAR info[1024];
- TCHAR *whot = mir_utf8decodeT(who);
- TCHAR *msgt = mir_utf8decodeT(msg);
+ wchar_t info[1024];
+ wchar_t *whot = mir_utf8decodeT(who);
+ wchar_t *msgt = mir_utf8decodeT(msg);
mir_sntprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L"");
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info);
mir_free(msgt);
@@ -98,7 +98,7 @@ void ext_yahoo_conf_userleave(int id, const char*, const char *who, const char * void ext_yahoo_conf_message(int id, const char*, const char *who, const char *room, const char *msg, int utf8)
{
- TCHAR *msgt = utf8 ? mir_utf8decodeT(msg) : mir_a2t(msg);
+ wchar_t *msgt = utf8 ? mir_utf8decodeT(msg) : mir_a2t(msg);
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_MESSAGE, msgt);
mir_free(msgt);
}
@@ -150,7 +150,7 @@ void CYahooProto::ChatRegister(void) void CYahooProto::ChatStart(const char* room)
{
- TCHAR* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2t(room);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -178,7 +178,7 @@ void CYahooProto::ChatStart(const char* room) void CYahooProto::ChatLeave(const char* room)
{
- TCHAR* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2t(room);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -195,13 +195,13 @@ void CYahooProto::ChatLeaveAll(void) ChatLeave(m_chatrooms[i].name);
}
-void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const TCHAR* msg)
+void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wchar_t* msg)
{
- TCHAR* idt = mir_a2t(room);
- TCHAR* snt = mir_a2t(who);
+ wchar_t* idt = mir_a2t(room);
+ wchar_t* snt = mir_a2t(who);
MCONTACT hContact = getbuddyH(who);
- TCHAR* nick = hContact ? (TCHAR*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt;
+ wchar_t* nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt;
GCDEST gcd = { m_szModuleName, idt, evt };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -340,7 +340,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Invite to chat dialog
-static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, char* room, CYahooProto* ppro, TCHAR *msg)
+static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, char* room, CYahooProto* ppro, wchar_t *msg)
{
bool root = !hItem;
if (root)
@@ -356,7 +356,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, c int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
if (chk) {
if (IsHContactInfo(hItem)) {
- TCHAR buf[128] = L"";
+ wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
who = y_list_append(who, mir_t2a(buf));
@@ -462,7 +462,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR switch (LOWORD(wParam)) {
case IDC_ADDSCR:
if (param->ppro->m_bLoggedIn) {
- TCHAR sn[64];
+ wchar_t sn[64];
GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
@@ -477,7 +477,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR case IDOK:
{
- TCHAR msg[1024];
+ wchar_t msg[1024];
GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
@@ -548,7 +548,7 @@ INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case IDCANCEL:
if (cm) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg));
yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg));
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index d5549b571c..c0620894dd 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -53,7 +53,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons ft->pfts.totalFiles = y_list_length(fs);
- ft->pfts.ptszFiles = (TCHAR**)mir_calloc(ft->pfts.totalFiles * sizeof(TCHAR *));
+ ft->pfts.ptszFiles = (wchar_t**)mir_calloc(ft->pfts.totalFiles * sizeof(wchar_t *));
ft->pfts.totalBytes = 0;
int i = 0;
@@ -67,7 +67,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons ft->pfts.currentFileNumber = 0;
yahoo_file_info *fi = (yahoo_file_info*)fs->data;
- ft->pfts.tszCurrentFile = _tcsdup(ft->pfts.ptszFiles[ft->pfts.currentFileNumber]);
+ ft->pfts.tszCurrentFile = wcsdup(ft->pfts.ptszFiles[ft->pfts.currentFileNumber]);
ft->pfts.currentFileSize = fi->filesize;
file_transfers = y_list_prepend(file_transfers, ft);
@@ -258,7 +258,7 @@ static void upload_file(int, INT_PTR fd, int error, void *data) // need to move to the next file on the list and fill the file information
fi = (yahoo_file_info*)sf->files->data;
- sf->pfts.tszCurrentFile = _tcsdup(sf->pfts.ptszFiles[sf->pfts.currentFileNumber]);
+ sf->pfts.tszCurrentFile = wcsdup(sf->pfts.ptszFiles[sf->pfts.currentFileNumber]);
sf->pfts.currentFileSize = fi->filesize;
sf->pfts.currentFileProgress = 0;
@@ -290,7 +290,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si if (!error) {
HANDLE myhFile;
- TCHAR filefull[MAX_PATH];
+ wchar_t filefull[MAX_PATH];
/*
* We need FULL Path for File Resume to work properly!!!
@@ -299,7 +299,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si */
mir_sntprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
FREE(sf->pfts.tszCurrentFile);
- sf->pfts.tszCurrentFile = _tcsdup(filefull);
+ sf->pfts.tszCurrentFile = wcsdup(filefull);
ResetEvent(sf->hWaitEvent);
@@ -428,7 +428,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si // need to move to the next file on the list and fill the file information
fi = (yahoo_file_info*)sf->files->data;
- sf->pfts.tszCurrentFile = _tcsdup(sf->pfts.ptszFiles[sf->pfts.currentFileNumber]);
+ sf->pfts.tszCurrentFile = wcsdup(sf->pfts.ptszFiles[sf->pfts.currentFileNumber]);
sf->pfts.currentFileSize = fi->filesize;
sf->pfts.currentFileProgress = 0;
@@ -659,7 +659,7 @@ void __cdecl CYahooProto::send_filethread(void *psf) ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CYahooProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles)
+HANDLE __cdecl CYahooProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles)
{
LOG(("[YahooSendFile]"));
@@ -674,7 +674,7 @@ HANDLE __cdecl CYahooProto::SendFile(MCONTACT hContact, const TCHAR *szDescripti int i = 0;
for (; ppszFiles[i] != NULL; i++) {
- if (_tstat(ppszFiles[i], &statbuf) == 0)
+ if (_wstat(ppszFiles[i], &statbuf) == 0)
tFileSize = statbuf.st_size;
yahoo_file_info *fi = y_new(yahoo_file_info, 1);
@@ -712,14 +712,14 @@ HANDLE __cdecl CYahooProto::SendFile(MCONTACT hContact, const TCHAR *szDescripti ////////////////////////////////////////////////////////////////////////////////////////
// FileAllow - starts a file transfer
-HANDLE __cdecl CYahooProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE __cdecl CYahooProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
y_filetransfer *ft = (y_filetransfer *)hTransfer;
debugLogA("[YahooFileAllow]");
//LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user);
- ft->pfts.tszWorkingDir = _tcsdup(szPath);
+ ft->pfts.tszWorkingDir = wcsdup(szPath);
size_t len = mir_tstrlen(ft->pfts.tszWorkingDir) - 1;
if (ft->pfts.tszWorkingDir[len] == '\\')
@@ -763,7 +763,7 @@ int __cdecl CYahooProto::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// FileDeny - denies a file transfer
-int __cdecl CYahooProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*)
+int __cdecl CYahooProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
{
/* deny file receive request.. just ignore it! */
y_filetransfer *ft = (y_filetransfer *)hTransfer;
@@ -794,7 +794,7 @@ int __cdecl CYahooProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*) ////////////////////////////////////////////////////////////////////////////////////////
// FileResume - processes file renaming etc
-int __cdecl CYahooProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CYahooProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
y_filetransfer *ft = (y_filetransfer *)hTransfer;
@@ -813,7 +813,7 @@ int __cdecl CYahooProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** debugLogA("[YahooFileResume] Renamed file!");
FREE(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = _tcsdup(*szFilename);
+ ft->pfts.tszCurrentFile = wcsdup(*szFilename);
}
SetEvent(ft->hWaitEvent);
diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index 18be749700..c42f3ce9ad 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -21,7 +21,7 @@ static HANDLE hServiceParseLink;
-static int SingleHexToDecimal(TCHAR c)
+static int SingleHexToDecimal(wchar_t c)
{
if (c >= '0' && c <= '9') return c - '0';
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
@@ -29,9 +29,9 @@ static int SingleHexToDecimal(TCHAR c) return -1;
}
-static void url_decode(TCHAR* str)
+static void url_decode(wchar_t* str)
{
- TCHAR* s = str, *d = str;
+ wchar_t* s = str, *d = str;
while (*s) {
if (*s == '%') {
@@ -40,7 +40,7 @@ static void url_decode(TCHAR* str) int digit2 = SingleHexToDecimal(s[2]);
if (digit2 != -1) {
s += 3;
- *d++ = (TCHAR)((digit1 << 4) | digit2);
+ *d++ = (wchar_t)((digit1 << 4) | digit2);
continue;
}
}
@@ -51,11 +51,11 @@ static void url_decode(TCHAR* str) *d = 0;
}
-static char* get_buddy(TCHAR ** arg)
+static char* get_buddy(wchar_t ** arg)
{
- TCHAR *buf = *arg;
+ wchar_t *buf = *arg;
- TCHAR *tok = _tcschr(buf, '&'); /* first token */
+ wchar_t *tok = wcschr(buf, '&'); /* first token */
if (tok) *tok = 0;
if (!buf[0]) return NULL;
@@ -74,11 +74,11 @@ static char* get_buddy(TCHAR ** arg) */
static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam)
{
- TCHAR *arg = (TCHAR*)lParam;
+ wchar_t *arg = (wchar_t*)lParam;
if (arg == NULL) return 1; /* sanity check */
/* skip leading prefix */
- arg = _tcschr(arg, ':');
+ arg = wcschr(arg, ':');
if (arg == NULL) return 1; /* parse failed */
for (++arg; *arg == '/'; ++arg) {}
@@ -95,7 +95,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam) if (!proto) return 1;
/* add a contact to the list */
- if (!_tcsnicmp(arg, L"addfriend?", 10)) {
+ if (!wcsnicmp(arg, L"addfriend?", 10)) {
arg += 10;
char *id = get_buddy(&arg);
@@ -111,7 +111,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam) acs.psr = &psr;
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.id.t = (TCHAR*)id;
+ psr.id.w = (wchar_t*)id;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
@@ -119,22 +119,22 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam) return 0;
}
/* send a message to a contact */
- else if (!_tcsnicmp(arg, L"sendim?", 7)) {
+ else if (!wcsnicmp(arg, L"sendim?", 7)) {
arg += 7;
char *id = get_buddy(&arg);
if (!id) return 1;
- TCHAR *msg = NULL;
+ wchar_t *msg = NULL;
while (arg) {
- if (!_tcsnicmp(arg, L"m=", 2)) {
+ if (!wcsnicmp(arg, L"m=", 2)) {
msg = arg + 2;
url_decode(msg);
break;
}
- arg = _tcschr(arg + 1, '&'); /* first token */
+ arg = wcschr(arg + 1, '&'); /* first token */
if (arg) *arg = 0;
}
@@ -146,7 +146,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM, LPARAM lParam) return 0;
}
/* open a chatroom */
- else if (!_tcsnicmp(arg, L"chat?", 5)) {
+ else if (!wcsnicmp(arg, L"chat?", 5)) {
arg += 5;
// char *id = get_buddy(&arg);
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index 18c7f1cdd4..87d254bace 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -77,7 +77,7 @@ static int CompareProtos(const CYahooProto* p1, const CYahooProto* p2) LIST<CYahooProto> g_instances(1, CompareProtos);
-static CYahooProto* yahooProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static CYahooProto* yahooProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CYahooProto* ppro = new CYahooProto(pszProtoName, tszUserName);
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 592f0a455e..321851d965 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -360,20 +360,20 @@ int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.position = -790000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO); - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszGroup = LPGENW("Network"); + odp.pwszTab = LPGENW("Account"); odp.pfnDlgProc = DlgProcYahooOpts; odp.dwInitParam = LPARAM(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Connection"); + odp.pwszTab = LPGENW("Connection"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO_CONNECTION); odp.pfnDlgProc = DlgProcYahooOptsConn; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Ignore List"); + odp.pwszTab = LPGENW("Ignore List"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_YAHOO_IGNORE); odp.pfnDlgProc = DlgProcYahooOptsIgnore; Options_AddPage(wParam, &odp); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index c3682e5696..a2610c5f7b 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -24,7 +24,7 @@ #pragma warning(disable:4355)
-CYahooProto::CYahooProto(const char *aProtoName, const TCHAR *aUserName)
+CYahooProto::CYahooProto(const char *aProtoName, const wchar_t *aUserName)
: PROTO<CYahooProto>(aProtoName, aUserName),
m_bLoggedIn(FALSE),
poll_loop(0),
@@ -35,7 +35,7 @@ CYahooProto::CYahooProto(const char *aProtoName, const TCHAR *aUserName) logoff_buddies();
- SkinAddNewSoundExT("mail", m_tszUserName, LPGENT("New E-mail available in Inbox"));
+ SkinAddNewSoundExT("mail", m_tszUserName, LPGENW("New E-mail available in Inbox"));
LoadYahooServices();
}
@@ -66,7 +66,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_IDLE_CHANGED, &CYahooProto::OnIdleEvent);
HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu);
- TCHAR tModuleDescr[100];
+ wchar_t tModuleDescr[100];
mir_sntprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName);
NETLIBUSER nlu = { 0 };
@@ -113,7 +113,7 @@ MCONTACT CYahooProto::AddToList(int flags, PROTOSEARCHRESULT *psr) return 0;
}
- char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id.t) : mir_utf8encode((char*)psr->id.t);
+ char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id.w) : mir_utf8encode((char*)psr->id.w);
MCONTACT hContact = getbuddyH(id);
if (hContact != NULL) {
if (db_get_b(hContact, "CList", "NotOnList")) {
@@ -217,7 +217,7 @@ int CYahooProto::Authorize(MEVENT hdbe) ////////////////////////////////////////////////////////////////////////////////////////
// AuthDeny - handles the unsuccessful authorization
-int CYahooProto::AuthDeny(MEVENT hdbe, const TCHAR *reason)
+int CYahooProto::AuthDeny(MEVENT hdbe, const wchar_t *reason)
{
debugLogA("[YahooAuthDeny]");
if (!m_bLoggedIn)
@@ -276,7 +276,7 @@ int __cdecl CYahooProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT* pre) ////////////////////////////////////////////////////////////////////////////////////////
// PSS_AUTHREQUEST
-int __cdecl CYahooProto::AuthRequest(MCONTACT hContact, const TCHAR* msg)
+int __cdecl CYahooProto::AuthRequest(MCONTACT hContact, const wchar_t* msg)
{
debugLogA("[YahooSendAuthRequest]");
@@ -539,7 +539,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(MCONTACT hContact) ////////////////////////////////////////////////////////////////////////////////////////
// SetAwayMsg - sets the away status message
-int __cdecl CYahooProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CYahooProto::SetAwayMsg(int status, const wchar_t* msg)
{
char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL;
diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 0f2324ec75..2cfed5b305 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -18,7 +18,7 @@ struct CYahooProto : public PROTO<CYahooProto>
{
- CYahooProto(const char*, const TCHAR*);
+ CYahooProto(const char*, const wchar_t*);
virtual ~CYahooProto();
//====================================================================================
@@ -29,33 +29,33 @@ struct CYahooProto : public PROTO<CYahooProto> virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason);
virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage );
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage );
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath );
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath );
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason );
- virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR **szFilename );
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason );
+ virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const wchar_t **szFilename );
virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType );
- virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET*);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg );
virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg( int m_iStatus, const wchar_t *msg);
virtual INT_PTR __cdecl GetMyAwayMsg(WPARAM wParam, LPARAM lParam);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -146,13 +146,13 @@ struct CYahooProto : public PROTO<CYahooProto> void reset_avatar(MCONTACT hContact);
void request_avatar(const char* who);
- void SendAvatar(const TCHAR *szFile);
- void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, int cbLen, int type);
+ void SendAvatar(const wchar_t *szFile);
+ void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, int cbLen, int type);
//====| chat.cpp |====================================================================
void ChatRegister(void);
void ChatStart(const char* room);
- void ChatEvent(const char* room, const char* who, int evt, const TCHAR* msg = NULL);
+ void ChatEvent(const char* room, const char* who, int evt, const wchar_t* msg = NULL);
void ChatLeave(const char* room);
void ChatLeaveAll(void);
@@ -213,9 +213,9 @@ struct CYahooProto : public PROTO<CYahooProto> DWORD Set_Protocol(MCONTACT hContact, int protocol );
- int ShowNotification(const TCHAR *title, const TCHAR *info, DWORD flags);
- void ShowError(const TCHAR *title, const TCHAR *buff);
- int ShowPopup( const TCHAR* nickname, const TCHAR* msg, const char *szURL );
+ int ShowNotification(const wchar_t *title, const wchar_t *info, DWORD flags);
+ void ShowError(const wchar_t *title, const wchar_t *buff);
+ int ShowPopup( const wchar_t* nickname, const wchar_t* msg, const char *szURL );
bool IsMyContact(MCONTACT hContact);
//====| yahoo.cpp |===================================================================
@@ -257,7 +257,7 @@ struct CYahooProto : public PROTO<CYahooProto> void ext_login_response(int succ, const char *url);
void ext_login(enum yahoo_status login_mode);
- void AddBuddy(MCONTACT hContact, const char *group, const TCHAR *msg);
+ void AddBuddy(MCONTACT hContact, const char *group, const wchar_t *msg);
void YAHOO_utils_logversion();
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 9a606c4245..d08a08df66 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -22,7 +22,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch)
{
- TCHAR *id = (TCHAR *)snsearch;
+ wchar_t *id = (wchar_t *)snsearch;
if (mir_tstrlen(id) < 4) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
@@ -30,14 +30,14 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) return;
}
- TCHAR *c = _tcschr(id, '@');
+ wchar_t *c = wcschr(id, '@');
if (c) *c = 0;
YAHOO_SEARCH_RESULT psr;
memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = (TCHAR*)_tcslwr(id);
+ psr.id.w = (wchar_t*)wcslwr(id);
psr.protocol = YAHOO_IM_YAHOO;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
@@ -47,14 +47,14 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
-HANDLE __cdecl CYahooProto::SearchBasic(const TCHAR* nick)
+HANDLE __cdecl CYahooProto::SearchBasic(const wchar_t* nick)
{
LOG(("[YahooBasicSearch] Searching for: %S", nick));
if (!m_bLoggedIn)
return 0;
- ForkThread(&CYahooProto::search_simplethread, _tcsdup(nick));
+ ForkThread(&CYahooProto::search_simplethread, wcsdup(nick));
return (HANDLE)1;
}
@@ -158,7 +158,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) {
HWND hwndDlg = (HWND)pHWND;
- TCHAR searchid[128];
+ wchar_t searchid[128];
GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid));
if (mir_tstrlen(searchid) == 0) {
@@ -171,13 +171,13 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_UNICODE;
- psr.id.t = _tcslwr(searchid);
+ psr.id.w = wcslwr(searchid);
switch (SendDlgItemMessage(hwndDlg, IDC_SEARCH_PROTOCOL, CB_GETCURSEL, 0, 0)) {
- case 0: psr.firstName.t = L"<Yahoo>"; psr.protocol = YAHOO_IM_YAHOO; break;
- case 1: psr.firstName.t = L"<Lotus Sametime>"; psr.protocol = YAHOO_IM_SAMETIME; break;
- case 2: psr.firstName.t = L"<LCS>"; psr.protocol = YAHOO_IM_LCS; break;
- case 3: psr.firstName.t = L"<Windows Live (MSN)>"; psr.protocol = YAHOO_IM_MSN; break;
+ case 0: psr.firstName.w = L"<Yahoo>"; psr.protocol = YAHOO_IM_YAHOO; break;
+ case 1: psr.firstName.w = L"<Lotus Sametime>"; psr.protocol = YAHOO_IM_SAMETIME; break;
+ case 2: psr.firstName.w = L"<LCS>"; psr.protocol = YAHOO_IM_LCS; break;
+ case 3: psr.firstName.w = L"<Windows Live (MSN)>"; psr.protocol = YAHOO_IM_MSN; break;
}
/*
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index bd171957f6..f5f602139c 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -220,7 +220,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) t = yahoo_urlencode(yahoo_get_cookie(m_id, "t"));
u = yahoo_urlencode(url);
mir_snprintf(tUrl,
- "http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.t=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
+ "http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.w=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
y, t, u);
FREE(y);
diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 016053a9ad..4b90a00e41 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -124,7 +124,7 @@ int __cdecl CYahooProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = YahooUserInfoDlgProc;
odp.position = -1900000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_USER_INFO);
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
UserInfo_AddPage(wParam, &odp);
}
return 0;
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index c4c5e692a2..44584763b6 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -105,7 +105,7 @@ static LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT message, WPARAM wParam, return DefWindowProc(hWnd, message, wParam, lParam);
}
-int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char *szURL)
+int CYahooProto::ShowPopup(const wchar_t* nickname, const wchar_t* msg, const char *szURL)
{
if (!ServiceExists(MS_POPUP_ADDPOPUPT))
return 0;
@@ -127,14 +127,14 @@ int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char * return 1;
}
-int CYahooProto::ShowNotification(const TCHAR *title, const TCHAR *info, DWORD flags)
+int CYahooProto::ShowNotification(const wchar_t *title, const wchar_t *info, DWORD flags)
{
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
MIRANDASYSTRAYNOTIFY err;
err.szProto = m_szModuleName;
err.cbSize = sizeof(err);
- err.tszInfoTitle = (TCHAR*)title;
- err.tszInfo = (TCHAR*)info;
+ err.tszInfoTitle = (wchar_t*)title;
+ err.tszInfo = (wchar_t*)info;
err.dwInfoFlags = flags | NIIF_INTERN_UNICODE;
err.uTimeout = 1000 * 3;
INT_PTR ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& err);
@@ -146,7 +146,7 @@ int CYahooProto::ShowNotification(const TCHAR *title, const TCHAR *info, DWORD f return 0;
}
-void CYahooProto::ShowError(const TCHAR *title, const TCHAR *buff)
+void CYahooProto::ShowError(const wchar_t *title, const wchar_t *buff)
{
if (getByte("ShowErrors", 1))
if (!ShowPopup(title, buff, NULL))
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 7cb6c76f34..b9aca199e2 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -200,7 +200,7 @@ void CYahooProto::logout() poll_loop = 0;
}
-void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const TCHAR *msg)
+void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const wchar_t *msg)
{
/* We adding a buddy to our list.
2 Stages.
@@ -675,8 +675,8 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) ptrT tszWho(mir_utf8decodeT(who));
ptrT tszMsg(mir_utf8decodeT(msg));
- TCHAR buff[1024];
- mir_sntprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (TCHAR*)tszWho);
+ wchar_t buff[1024];
+ mir_sntprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho);
MessageBox(NULL, tszMsg, buff, MB_OK | MB_ICONINFORMATION);
}
@@ -923,7 +923,7 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) SkinPlaySound("mail");
if (!getByte("DisableYahoomail", 0)) {
- TCHAR z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
+ wchar_t z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
if (from == NULL) {
mir_sntprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail"));
@@ -934,7 +934,7 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) ptrT tszFrom(mir_utf8decodeT(from));
ptrT tszSubj(mir_utf8decodeT(subj));
- mir_sntprintf(z, TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
+ mir_sntprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj);
}
if (!ShowPopup(title, z, "http://mail.yahoo.com"))
@@ -1046,7 +1046,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) void CYahooProto::ext_login_response(int succ, const char *url)
{
- TCHAR buff[1024];
+ wchar_t buff[1024];
LOG(("[ext_login_response] succ: %d, url: %s", succ, url));
@@ -1111,34 +1111,34 @@ void CYahooProto::ext_login_response(int succ, const char *url) void CYahooProto::ext_error(const char *err, int fatal, int num)
{
ptrT tszErr(mir_utf8decodeT(err));
- TCHAR buff[1024];
+ wchar_t buff[1024];
LOG(("[ext_error] Error: fatal: %d, num: %d, err: %s", fatal, num, err));
switch (num) {
case E_UNKNOWN:
- mir_sntprintf(buff, TranslateT("Unknown error %s"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr);
break;
case E_CUSTOM:
- mir_sntprintf(buff, TranslateT("Custom error %s"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr);
break;
case E_CONFNOTAVAIL:
- mir_sntprintf(buff, TranslateT("%s is not available for the conference"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr);
break;
case E_IGNOREDUP:
- mir_sntprintf(buff, TranslateT("%s is already ignored"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr);
break;
case E_IGNORENONE:
- mir_sntprintf(buff, TranslateT("%s is not in the ignore list"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr);
break;
case E_IGNORECONF:
- mir_sntprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr);
break;
case E_SYSTEM:
- mir_sntprintf(buff, TranslateT("System Error: %s"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr);
break;
case E_CONNECTION:
- mir_sntprintf(buff, TranslateT("Server Connection Error: %s"), (TCHAR*)tszErr);
+ mir_sntprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr);
debugLogA("Error: %S", buff);
return;
}
|