diff options
Diffstat (limited to 'protocols')
268 files changed, 2547 insertions, 2547 deletions
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index d9cbc9b6de..9172347766 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -30,7 +30,7 @@ HINSTANCE hInstance; // Protocol instances
static int sttCompareProtocols(const CAimProto *p1, const CAimProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<CAimProto> g_Instances(1, sttCompareProtocols);
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index ec3b7c3812..9a8a160503 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -118,7 +118,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c 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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (ext && _waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
@@ -127,19 +127,19 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c DBVARIANT dbv;
if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR;
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
db_free(&dbv);
bool found = false;
if (ext == NULL) {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L".*");
_tfinddata_t c_file;
long hFile = _tfindfirst(pszDest, &c_file);
if (hFile > -1L) {
do {
if (wcsrchr(c_file.name, '.')) {
- mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
+ mir_snwprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
} while (_tfindnext(hFile, &c_file) == 0);
@@ -149,7 +149,7 @@ int CAimProto::get_avatar_filename(MCONTACT hContact, wchar_t* pszDest, size_t c if (!found) pszDest[0] = 0;
}
else {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
found = _waccess(pszDest, 0) == 0;
}
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index dcc0d9449e..40a59adea1 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)
{
- wchar_t *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2u(id);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -66,8 +66,8 @@ void CAimProto::chat_start(const char* id, unsigned short exchange) void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_t* msg)
{
- wchar_t *idt = mir_a2t(id);
- wchar_t *snt = mir_a2t(sn);
+ wchar_t *idt = mir_a2u(id);
+ wchar_t *snt = mir_a2u(sn);
MCONTACT hContact = contact_from_sn(sn);
wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(
@@ -91,7 +91,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_ void CAimProto::chat_leave(const char* id)
{
- wchar_t *idt = mir_a2t(id);
+ wchar_t *idt = mir_a2u(id);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -110,7 +110,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0;
- char *id = mir_t2a(gch->pDest->ptszID);
+ char *id = mir_u2a(gch->pDest->ptszID);
chat_list_item* item = find_chat_by_id(id);
if (item == NULL) return 0;
@@ -122,7 +122,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) break;
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText))
+ if (gch->ptszText && mir_wstrlen(gch->ptszText))
aim_chat_send_message(item->hconn, item->seqno, T2Utf(gch->ptszText));
break;
@@ -133,7 +133,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- char* sn = mir_t2a(gch->ptszUID);
+ char* sn = mir_u2a(gch->ptszUID);
MCONTACT hContact = contact_from_sn(sn);
mir_free(sn);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
@@ -155,7 +155,7 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam) case GC_USER_NICKLISTMENU:
{
- char *sn = mir_t2a(gch->ptszUID);
+ char *sn = mir_u2a(gch->ptszUID);
MCONTACT hContact = contact_from_sn(sn);
mir_free(sn);
@@ -198,7 +198,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char* sn = mir_t2a(gcmi->pszUID);
+ char* sn = mir_u2a(gcmi->pszUID);
if (!mir_strcmp(m_username, sn)) {
static const struct gc_item Items[] = {
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp index a2e3420b2e..ca36a38663 100644 --- a/protocols/AimOscar/src/conv.cpp +++ b/protocols/AimOscar/src/conv.cpp @@ -726,7 +726,7 @@ char* get_fname(char *path) wchar_t* get_dir(wchar_t *path)
{
- wchar_t *cpath = mir_tstrdup(path);
+ wchar_t *cpath = mir_wstrdup(path);
wchar_t *swd = wcsrchr(cpath, '\\');
if (swd) swd[1] = 0; else cpath[0] = 0;
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index d2a392b9a7..a186b29fa8 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -96,8 +96,8 @@ bool send_init_oft2(file_transfer *ft, char* file) void CAimProto::report_file_error(wchar_t *fname)
{
wchar_t errmsg[512];
- wchar_t* error = mir_a2t(_strerror(NULL));
- mir_sntprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
+ wchar_t* error = mir_a2u(_strerror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
@@ -266,7 +266,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET oft2 *oft = NULL;
- ft->pfts.tszWorkingDir = mir_utf8decodeT(ft->file);
+ ft->pfts.tszWorkingDir = mir_utf8decodeW(ft->file);
//start listen for packets stuff
for (;;) {
@@ -314,20 +314,20 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET wchar_t* wbuf = (wchar_t*)buf;
wcs_htons(wbuf);
for (wchar_t *p = wbuf; *p; ++p) { if (*p == 1) *p = '\\'; }
- name = mir_u2t(wbuf);
+ name = mir_wstrdup(wbuf);
}
else {
for (char *p = buf; *p; ++p) { if (*p == 1) *p = '\\'; }
- name = mir_a2t(buf);
+ name = mir_a2u(buf);
}
mir_free(buf);
wchar_t fname[256];
- mir_sntprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name);
+ mir_snwprintf(fname, L"%s%s", ft->pfts.tszWorkingDir, name);
mir_free(name);
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = mir_tstrdup(fname);
+ ft->pfts.tszCurrentFile = mir_wstrdup(fname);
ResetEvent(ft->hResumeEvent);
if (ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->pfts))
diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index ea50d67c58..d759679d9f 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -92,9 +92,9 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
- sn = mir_t2a(url_decode(tok + 11));
+ sn = mir_u2a(url_decode(tok + 11));
if (!wcsnicmp(tok, L"groupname=", 10) && *(tok + 10) != 0)
- group = mir_utf8encodeT(url_decode(tok + 10)); /* group is currently ignored */
+ group = mir_utf8encodeW(url_decode(tok + 10)); /* group is currently ignored */
}
if (sn == NULL) {
mir_free(group);
@@ -119,7 +119,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"screenname=", 11) && *(tok + 11) != 0)
- sn = mir_t2a(url_decode(tok + 11));
+ sn = mir_u2a(url_decode(tok + 11));
if (!wcsnicmp(tok, L"message=", 8) && *(tok + 8) != 0)
msg = url_decode(tok + 8);
}
@@ -143,7 +143,7 @@ static INT_PTR ServiceParseAimLink(WPARAM, LPARAM lParam) tok2 = wcschr(++tok, '&'); /* first token */
if (tok2) *tok2 = 0;
if (!wcsnicmp(tok, L"roomname=", 9) && *(tok + 9) != 0) {
- rm = mir_t2a(url_decode(tok + 9));
+ rm = mir_u2a(url_decode(tok + 9));
for (char *ch = rm; *ch; ++ch)
if (*ch == '+') *ch = ' ';
}
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 8747508724..7e52cd572c 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -65,13 +65,13 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
POPUPDATAT ppd = {0};
- mir_sntprintf(ppd.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(ppd.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
if (flags & ERROR_POPUP)
{
if (flags & TCHAR_POPUP)
{
- char* errmsg = mir_t2a((wchar_t*)msg);
+ char* errmsg = mir_u2a((wchar_t*)msg);
debugLogA(errmsg);
mir_free(errmsg);
}
@@ -79,7 +79,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) debugLogA(msg);
}
- wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((wchar_t*)msg) : mir_a2t(msg);
+ wchar_t *msgt = (flags & TCHAR_POPUP) ? mir_wstrdup((wchar_t*)msg) : mir_a2u(msg);
wcsncpy_s(ppd.lptzText, TranslateTS(msgt), _TRUNCATE);
mir_free(msgt);
@@ -87,8 +87,8 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) {
if (flags & MAIL_POPUP)
{
- size_t len = mir_tstrlen(ppd.lptzText);
- mir_sntprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
+ size_t len = mir_wstrlen(ppd.lptzText);
+ mir_snwprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, L" %s", TranslateT("Open mail account?"));
if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index a198c04b63..0a1f2e9e35 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -52,14 +52,14 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
mir_snprintf(szP2P, "%sP2P", m_szModuleName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
- mir_sntprintf(descr, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.szSettingsModule = szP2P;
nlu.minIncomingPorts = 1;
m_hNetlibPeer = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -155,7 +155,7 @@ HANDLE __cdecl CAimProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *s {
file_transfer *ft = (file_transfer*)hTransfer;
if (ft && m_ft_list.find_by_ft(ft)) {
- char *path = mir_utf8encodeT(szPath);
+ char *path = mir_utf8encodeW(szPath);
if (ft->pfts.totalFiles > 1 && ft->file[0]) {
size_t path_len = mir_strlen(path);
@@ -231,7 +231,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** case FILERESUME_RENAME:
mir_free(ft->pfts.tszCurrentFile);
- ft->pfts.tszCurrentFile = mir_tstrdup(*szFilename);
+ ft->pfts.tszCurrentFile = mir_wstrdup(*szFilename);
break;
case FILERESUME_OVERWRITE:
@@ -321,7 +321,7 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) return 0;
//duplicating the parameter so that it isn't deleted before it's needed- e.g. this function ends before it's used
- ForkThread(&CAimProto::basic_search_ack_success, mir_t2a(szId));
+ ForkThread(&CAimProto::basic_search_ack_success, mir_u2a(szId));
return (HANDLE)1;
}
@@ -331,10 +331,10 @@ HANDLE __cdecl CAimProto::SearchBasic(const wchar_t *szId) 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)
+ if (m_state != 1 || email == NULL || mir_wstrlen(email) >= 254)
return NULL;
- char *szEmail = mir_t2a(email);
+ char *szEmail = mir_u2a(email);
aim_search_by_email(m_hServerConn, m_seqno, szEmail);
mir_free(szEmail);
return (HANDLE)1;
@@ -396,9 +396,9 @@ HANDLE __cdecl CAimProto::SendFile(MCONTACT hContact, const wchar_t* szDescripti ft->pfts.flags |= PFTS_SENDING;
ft->pfts.ptszFiles = ppszFiles;
- ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeT(ppszFiles[0]) : (char*)mir_calloc(1);
+ ft->file = ft->pfts.totalFiles == 1 || isDir ? mir_utf8encodeW(ppszFiles[0]) : (char*)mir_calloc(1);
ft->sending = true;
- ft->message = szDescription[0] ? mir_utf8encodeT(szDescription) : NULL;
+ ft->message = szDescription[0] ? mir_utf8encodeW(szDescription) : NULL;
ft->me_force_proxy = getByte(AIM_KEY_FP, 0) != 0;
ft->requester = true;
@@ -598,7 +598,7 @@ int __cdecl CAimProto::SetAwayMsg(int status, const wchar_t* msg) char **msgptr = get_status_msg_loc(status);
if (msgptr == NULL) return 1;
- char *nmsg = mir_utf8encodeT(msg);
+ char *nmsg = mir_utf8encodeW(msg);
mir_free(*msgptr); *msgptr = nmsg;
switch (status) {
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 34bc6151e2..db3679447b 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);
- wchar_t* tszMsg = mir_utf8decodeT(msg_s);
+ wchar_t* tszMsg = mir_utf8decodeW(msg_s);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
mir_free(tszMsg);
mir_free(msg);
@@ -1247,13 +1247,13 @@ void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned s if (!descr_included) msg_buf = NULL;
- wchar_t* filenameT = mir_utf8decodeT(filename);
+ wchar_t* filenameT = mir_utf8decodeW(filename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(msg_buf);
+ pre.descr.w = mir_utf8decodeW(msg_buf);
pre.files.w = &filenameT;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
@@ -1661,7 +1661,7 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018 if (new_mail && num_msgs) {
wchar_t msg[1024];
- int len = mir_sntprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs,
+ int len = mir_snwprintf(msg, L"%S@%S (%d)\r\n%s ", sn, address, num_msgs,
TranslateT("You've got mail! Checked at"));
SYSTEMTIME stLocal;
@@ -1864,19 +1864,19 @@ void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//fa if (uni) {
char* msg = msg_tlv.dupw();
html_decode(msg);
- message = mir_utf8decodeT(msg);
+ message = mir_utf8decodeW(msg);
mir_free(msg);
}
else if (utf) {
char* msg = msg_tlv.dup();
html_decode(msg);
- message = mir_utf8decodeT(msg);
+ message = mir_utf8decodeW(msg);
mir_free(msg);
}
else {
char* msg = msg_tlv.dup();
html_decode(msg);
- message = mir_a2t(msg);
+ message = mir_a2u(msg);
mir_free(msg);
}
}
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index ee833e6eee..71ebfb2e10 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -105,7 +105,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cf.cbSize = sizeof(cf);
cf.yHeight = 12 * 20;
cf.dwMask = CFM_SIZE | CFM_FACE;
- mir_tstrcpy(cf.szFaceName, TEXT("Arial"));
+ mir_wstrcpy(cf.szFaceName, TEXT("Arial"));
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
else {
@@ -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);
- wchar_t *txt = mir_utf8decodeT(dbv.pszVal);
+ wchar_t *txt = mir_utf8decodeW(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_PROFILE, txt);
mir_free(txt);
db_free(&dbv);
@@ -1270,7 +1270,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, chat_list_item wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- char *sn = mir_t2a(buf);
+ char *sn = mir_u2a(buf);
ppro->aim_chat_invite(ppro->m_hServerConn, ppro->m_seqno,
item->cookie, item->exchange, item->instance, sn, msg);
mir_free(sn);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 247d8bd3fa..10a18ba5af 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;
- wchar_t* szGroupName = mir_utf8decodeT(group);
+ wchar_t* szGroupName = mir_utf8decodeW(group);
Clist_GroupCreate(0, szGroupName);
mir_free(szGroupName);
}
@@ -533,18 +533,18 @@ int CAimProto::open_contact_file(const char*, const wchar_t* file, const char*, {
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);
+ int pos = mir_snwprintf(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);
+ pos += mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%S", m_szModuleName);
if (_waccess(path, 0))
CreateDirectoryTreeT(path);
- mir_sntprintf(path + pos, MAX_PATH - pos, L"\\%s", file);
+ mir_snwprintf(path + pos, MAX_PATH - pos, L"\\%s", file);
int fid = _wopen(path, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD);
if (fid < 0) {
wchar_t errmsg[512];
- mir_sntprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_snwprintf(errmsg, TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 11643b57b3..2a75554c83 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -49,7 +49,7 @@ void CDummyProto::SearchIdAckThread(void *targ) static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2) { - return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName); + return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); } LIST<CDummyProto> dummy_Instances(1, sttCompareProtocols); @@ -147,7 +147,7 @@ HANDLE CDummyProto::SearchBasic(const wchar_t* id) if (uniqueIdSetting[0] == '\0') return 0; - wchar_t *tid = mir_tstrdup(id); + wchar_t *tid = mir_wstrdup(id); ForkThread(&CDummyProto::SearchIdAckThread, tid); return tid; } diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index 49b41bd1d6..5956be29e0 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -79,7 +79,7 @@ static INT_PTR __cdecl EMPGetCaps(WPARAM wParam, LPARAM) static INT_PTR __cdecl EMPGetName(WPARAM wParam, LPARAM lParam)
{
- mir_tstrncpy((char*)lParam, "EmLan", wParam);
+ mir_strncpy((char*)lParam, "EmLan", wParam);
return 0;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 1ba95f8429..25e0258bd5 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -383,9 +383,9 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs) dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; dbei.flags = pre->flags & PREF_CREATEREAD ? DBEF_READ : 0; - dbei.cbBlob = (DWORD)mir_tstrlen(pre->szMessage) + 1; + dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; if (!mir_strcmp(ccs->szProtoService, PSR_URL)) { - dbei.cbBlob += 2 + (DWORD)mir_tstrlen(pre->szMessage + dbei.cbBlob + 1); + dbei.cbBlob += 2 + (DWORD)mir_strlen(pre->szMessage + dbei.cbBlob + 1); } dbei.pBlob = (PBYTE)pre->szMessage; @@ -418,7 +418,7 @@ int CMLan::SendMessageUrl(CCSDATA* ccs, bool isUrl) int cid = GetRandomProcId(); size_t len; if (isUrl) { - len = mir_tstrlen((char*)ccs->lParam); + len = mir_strlen((char*)ccs->lParam); ((char*)ccs->lParam)[len] = 1; } TDataHolder* hold = new TDataHolder(ccs, cid, isUrl ? LEXT_SENDURL : LEXT_SENDMESSAGE, this); @@ -479,10 +479,10 @@ void CMLan::SearchExt(TDataHolder* hold) for (TContact *cont = m_pRootContact; cont; cont = cont->m_prev) { if (mir_strcmp(hold->msg, cont->m_nick) == 0 || mir_strcmp(hold->msg, "*") == 0) { char buf[MAX_HOSTNAME_LEN]; - mir_tstrcpy(buf, cont->m_nick); - size_t len = mir_tstrlen(buf); + mir_strcpy(buf, cont->m_nick); + size_t len = mir_strlen(buf); buf[len] = '@'; - mir_tstrcpy(buf + len + 1, inet_ntoa(cont->m_addr)); + mir_strcpy(buf + len + 1, inet_ntoa(cont->m_addr)); psr.nick.a = cont->m_nick; psr.firstName.a = ""; psr.lastName.a = ""; @@ -590,7 +590,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t nameLen; if (pak.strName) { - nameLen = mir_tstrlen(pak.strName); + nameLen = mir_strlen(pak.strName); len += 1 + 1 + nameLen + 1; } @@ -599,9 +599,9 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t mesLen = 0; if (pak.strMessage) { - mesLen = mir_tstrlen(pak.strMessage); + mesLen = mir_strlen(pak.strMessage); if (pak.flIsUrl) - mesLen += 1 + mir_tstrlen(pak.strMessage + mesLen + 1); + mesLen += 1 + mir_strlen(pak.strMessage + mesLen + 1); len += 3 + 1 + 4 + mesLen + 1; } @@ -613,7 +613,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) size_t awayLen = 0; if (pak.strAwayMessage) { - awayLen = mir_tstrlen(pak.strAwayMessage); + awayLen = mir_strlen(pak.strAwayMessage); len += 3 + 1 + 4 + awayLen + 1; } @@ -780,9 +780,9 @@ void CMLan::LoadSettings() } if (!dbv.pszVal[0]) dbv.pszVal = "EmLan_User"; - mir_tstrcpy(m_name, dbv.pszVal); + mir_strcpy(m_name, dbv.pszVal); } - m_nameLen = (int)mir_tstrlen(m_name); + m_nameLen = (int)mir_strlen(m_name); if (GetStatus() != LM_LISTEN) { int ipcount = GetHostAddrCount(); diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index c41c7026d5..55c7f046e6 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *) std::wstring FacebookProto::GetAvatarFolder()
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index c3a02a8a22..eeb44b4c59 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -30,10 +30,10 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * std::string smessage = message; utils::text::replace_all(&smessage, "%", "%%"); - ptrT tid(mir_a2t(id)); - ptrT tnick(mir_a2t_cp(name, CP_UTF8)); - ptrT ttext(mir_a2t_cp(smessage.c_str(), CP_UTF8)); - ptrT tchat_id(mir_a2t(chat_id)); + ptrW tid(mir_a2u(id)); + ptrW tnick(mir_a2u_cp(name, CP_UTF8)); + ptrW ttext(mir_a2u_cp(smessage.c_str(), CP_UTF8)); + ptrW tchat_id(mir_a2u(chat_id)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -55,8 +55,8 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char * void FacebookProto::RenameChat(const char *chat_id, const char *name) { - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -72,7 +72,7 @@ int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam) return 0; // Ignore for special chatrooms - if (!mir_tstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))) + if (!mir_wstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))) return 0; switch (hook->pDest->iType) @@ -169,9 +169,9 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa if (IsChatContact(chat_id, user.user_id.c_str())) return; - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tnick(mir_a2t_cp(user.nick.c_str(), CP_UTF8)); - ptrT tid(mir_a2t(user.user_id.c_str())); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tnick(mir_a2u_cp(user.nick.c_str(), CP_UTF8)); + ptrW tid(mir_a2u(user.user_id.c_str())); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -208,9 +208,9 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const if (!mir_strcmp(id, facy.self_.user_id.c_str())) return; - ptrT tchat_id(mir_a2t(chat_id)); - ptrT tnick(mir_a2t_cp(name, CP_UTF8)); - ptrT tid(mir_a2t(id)); + ptrW tchat_id(mir_a2u(chat_id)); + ptrW tnick(mir_a2u_cp(name, CP_UTF8)); + ptrW tid(mir_a2u(id)); GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -226,7 +226,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const /** Caller must free result */ char *FacebookProto::GetChatUsers(const char *chat_id) { - ptrT ptszChatID(mir_a2t(chat_id)); + ptrW ptszChatID(mir_a2u(chat_id)); GC_INFO gci = { 0 }; gci.Flags = GCF_USERS; @@ -246,7 +246,7 @@ bool FacebookProto::IsChatContact(const char *chat_id, const char *id) void FacebookProto::AddChat(const char *id, const wchar_t *tname) { - ptrT tid(mir_a2t(id)); + ptrW tid(mir_a2u(id)); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; @@ -285,8 +285,8 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) if (!m_enableChat || IsSpecialChatRoom(hContact)) return 0; - ptrT idT(getTStringA(hContact, "ChatRoomID")); - ptrT nameT(getTStringA(hContact, "Nick")); + ptrW idT(getTStringA(hContact, "ChatRoomID")); + ptrW nameT(getTStringA(hContact, "Nick")); ptrA threadId(getStringA(hContact, FACEBOOK_KEY_TID)); if (!idT || !nameT || !threadId) @@ -338,7 +338,7 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM) { - ptrT idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL); + ptrW idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL); GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL }; gcd.ptszID = idT; @@ -430,7 +430,7 @@ void FacebookProto::PrepareNotificationsChatRoom() { MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM); if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) { wchar_t nameT[200]; - mir_sntprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications")); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; @@ -460,8 +460,8 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat std::string message = text.str(); utils::text::replace_all(&message, "%", "%%"); - ptrT idT(mir_tstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))); - ptrT messageT(mir_a2t_cp(message.c_str(), CP_UTF8)); + ptrW idT(mir_wstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM))); + ptrW messageT(mir_a2u_cp(message.c_str(), CP_UTF8)); GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index cfbae1cbc9..63bdec6d32 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -727,7 +727,7 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s std::wstring treaders; // Load old readers - ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + ptrW told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); if (told) treaders = std::wstring(told) + L", "; @@ -772,8 +772,8 @@ void loginError(FacebookProto *proto, std::string error_str) { proto->debugLogA("!!! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error"); wchar_t buf[200]; - mir_sntprintf(buf, TranslateT("Login error: %s"), - (error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str()))); + mir_snwprintf(buf, TranslateT("Login error: %s"), + (error_str.empty()) ? TranslateT("Unknown error") : ptrW(mir_utf8decodeW(error_str.c_str()))); proto->facy.client_notify(buf); } @@ -932,7 +932,7 @@ bool facebook_client::login(const char *username, const char *password) std::string activity = utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "<body", "</strong></div>", "</div>")); activity = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(activity))); if (!activity.empty()) { - tszMessage.AppendFormat(L"\n\n%s", ptrT(mir_utf8decodeT(activity.c_str()))); + tszMessage.AppendFormat(L"\n\n%s", ptrW(mir_utf8decodeW(activity.c_str()))); } if (MessageBox(0, tszMessage, tszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1) == IDYES) { diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 028c2a918f..ad82b665be 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -409,7 +409,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc) if (fbc->participants.size() > namesUsed) { wchar_t more[200]; - mir_sntprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); + mir_snwprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); fbc->chat_name = more; } @@ -734,7 +734,7 @@ void FacebookProto::SendPokeWorker(void *p) message = utils::text::html_entities_decode( utils::text::remove_html(message)); - ptrT tmessage(mir_utf8decodeT(message.c_str())); + ptrW tmessage(mir_utf8decodeW(message.c_str())); NotifyEvent(m_tszUserName, tmessage, NULL, FACEBOOK_EVENT_OTHER); } diff --git a/protocols/FacebookRM/src/definitions.h b/protocols/FacebookRM/src/definitions.h index 97c8025833..1fd4102920 100644 --- a/protocols/FacebookRM/src/definitions.h +++ b/protocols/FacebookRM/src/definitions.h @@ -39,5 +39,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define NIIF_INTERN_TCHAR NIIF_INTERN_UNICODE // m_clist.h
-#define mir_tstrdup mir_wstrdup // m_system.h
+#define mir_wstrdup mir_wstrdup // m_system.h
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 75aa98da3b..8574cf9431 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -159,7 +159,7 @@ void GetSelectedContacts(FacebookProto *proto, MCONTACT hItem, HWND hwndList, st if (userId) fu->user_id = userId; - ptrT realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); + ptrW realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); if (realName) fu->real_name = _T2A(realName); @@ -201,7 +201,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0); SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0); - ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); + ptrW place(data->proto->getTStringA(FACEBOOK_KEY_PLACE)); SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : L"Miranda NG"); bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0; @@ -405,7 +405,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr)); if (tstr[0] != '\0') { - proto->m_tszDefaultGroup = mir_tstrdup(tstr); + proto->m_tszDefaultGroup = mir_wstrdup(tstr); proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr); Clist_GroupCreate(0, tstr); } diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 2ab26361da..cd17067e89 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -328,7 +328,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO newText = _A2T(type.c_str()); wchar_t title[200]; - mir_sntprintf(title, TranslateT("User sent %s:"), newText.c_str()); + mir_snwprintf(title, TranslateT("User sent %s:"), newText.c_str()); *message_text += T2Utf(title); *message_text += attachments_text; @@ -615,7 +615,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo // Notify it, if user wants to be notified if (proto->getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) { - proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id); + proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id); } } } @@ -671,13 +671,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo participant = participants.find(from_id); if (participant != participants.end()) { MCONTACT hChatContact = proto->ChatIDToHContact(tid); - ptrT name(mir_utf8decodeT(participant->second.nick.c_str())); + ptrW name(mir_utf8decodeW(participant->second.nick.c_str())); if (st_.as_int() == 1) { StatusTextData st = { 0 }; st.cbSize = sizeof(st); - mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), name); + mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), name); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); } @@ -775,8 +775,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo client = FACEBOOK_CLIENT_OTHER; } - ptrT oldClient(proto->getTStringA(hContact, "MirVer")); - if (!oldClient || mir_tstrcmp(oldClient, client)) + ptrW oldClient(proto->getTStringA(hContact, "MirVer")); + if (!oldClient || mir_wstrcmp(oldClient, client)) proto->setTString(hContact, "MirVer", client); } } @@ -813,13 +813,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; std::string contactname = getContactName(this, fbu->handle, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), fbu->handle, FACEBOOK_EVENT_FRIENDSHIP, &url); } */ - /* ptrT client(getTStringA(fbu->handle, "MirVer")); - if (!client || mir_tstrcmp(client, fbu->getMirVer())) + /* ptrW client(getTStringA(fbu->handle, "MirVer")); + if (!client || mir_wstrcmp(client, fbu->getMirVer())) setTString(fbu->handle, "MirVer", fbu->getMirVer()); */ @@ -894,8 +894,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo client = FACEBOOK_CLIENT_OTHER; }*/ - ptrT oldClient(proto->getTStringA(hContact, "MirVer")); - if (!oldClient || mir_tstrcmp(oldClient, client)) + ptrW oldClient(proto->getTStringA(hContact, "MirVer")); + if (!oldClient || mir_wstrcmp(oldClient, client)) proto->setTString(hContact, "MirVer", client); } } @@ -922,7 +922,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo proto->debugLogA("+++ Got ticker type='%s' class='%s'", story_type.c_str(), story_class.c_str()); if (!text.empty()) - proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url); + proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url); } else if (t == "mercury") { // rename multi user chat, video call, ... @@ -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::wstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name... + iter->second->chat_name = std::wstring(ptrW(mir_utf8decodeW(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::wstring(ptrT(mir_utf8decodeT(name_.as_string().c_str()))); + fbc->chat_name = std::wstring(ptrW(mir_utf8decodeW(name_.as_string().c_str()))); } return EXIT_SUCCESS; diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index bf63f1f8a7..35f9477192 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -49,7 +49,7 @@ PLUGININFOEX pluginInfo = { // Protocol instances
static int compare_protos(const FacebookProto *p1, const FacebookProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<FacebookProto> g_Instances(1, compare_protos);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index e5777e6f29..5076730817 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -218,7 +218,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, b64 = utils::url::encode(b64); std::wstring filename = GetAvatarFolder() + L"\\stickers\\"; - ptrT dir(mir_tstrdup(filename.c_str())); + ptrW dir(mir_wstrdup(filename.c_str())); filename += (wchar_t*)_A2T(b64.c_str()); filename += L".png"; diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 6be6c3f539..3a3e00905c 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -134,7 +134,7 @@ void FacebookProto::ProcessFriendList(void*) std::string url = FACEBOOK_URL_PROFILE + fbu->user_id; std::string contactname = getContactName(this, hContact, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } } @@ -158,7 +158,7 @@ void FacebookProto::ProcessFriendList(void*) std::string url = FACEBOOK_URL_PROFILE + std::string(id); std::string contactname = getContactName(this, hContact, id); - ptrT szTitle(mir_utf8decodeT(contactname.c_str())); + ptrW szTitle(mir_utf8decodeW(contactname.c_str())); NotifyEvent(szTitle, TranslateT("Contact is no longer on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } } @@ -518,7 +518,7 @@ 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 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::wstring ttext = ptrT(mir_utf8decodeT(text.c_str())); + std::wstring ttext = ptrW(mir_utf8decodeW(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)); @@ -703,8 +703,8 @@ void FacebookProto::ProcessMemories(void*) for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { - ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str())); - ptrT tszText(mir_utf8decodeT(news[i]->text.c_str())); + ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); + ptrW tszText(mir_utf8decodeW(news[i]->text.c_str())); NotifyEvent(TranslateT("On this day"), tszText, NULL, FACEBOOK_EVENT_ON_THIS_DAY, &news[i]->link); delete news[i]; @@ -952,7 +952,7 @@ void FacebookProto::ShowNotifications() { facebook_notification *notification = it->second; if (notification != NULL && !notification->seen) { debugLogA(" Showing popup for notification ID: %s", notification->id.c_str()); - ptrT szText(mir_utf8decodeT(notification->text.c_str())); + ptrW szText(mir_utf8decodeW(notification->text.c_str())); MCONTACT hContact = (notification->user_id.empty() ? NULL : ContactIDToHContact(notification->user_id)); notification->hWndPopup = NotifyEvent(m_tszUserName, szText, hContact, FACEBOOK_EVENT_NOTIFICATION, ¬ification->link, ¬ification->id, notification->icon); notification->seen = true; @@ -1124,8 +1124,8 @@ void FacebookProto::ProcessFeeds(void*) for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { - ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str())); - ptrT tszText(mir_utf8decodeT(news[i]->text.c_str())); + ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); + ptrW tszText(mir_utf8decodeW(news[i]->text.c_str())); MCONTACT hContact = ContactIDToHContact(news[i]->user_id); NotifyEvent(tszTitle, tszText, hContact, FACEBOOK_EVENT_NEWSFEED, &news[i]->link); @@ -1237,11 +1237,11 @@ void FacebookProto::SearchAckThread(void *targ) if (id.empty() || id == facy.self_.user_id) continue; - ptrT tid(mir_utf8decodeT(id.c_str())); - ptrT tname(mir_utf8decodeT(utils::text::html_entities_decode(name).c_str())); - ptrT tsurname(mir_utf8decodeT(utils::text::html_entities_decode(surname).c_str())); - ptrT tnick(mir_utf8decodeT(utils::text::html_entities_decode(nick).c_str())); - ptrT tcommon(mir_utf8decodeT(utils::text::html_entities_decode(common).c_str())); + ptrW tid(mir_utf8decodeW(id.c_str())); + ptrW tname(mir_utf8decodeW(utils::text::html_entities_decode(name).c_str())); + ptrW tsurname(mir_utf8decodeW(utils::text::html_entities_decode(surname).c_str())); + ptrW tnick(mir_utf8decodeW(utils::text::html_entities_decode(nick).c_str())); + ptrW tcommon(mir_utf8decodeW(utils::text::html_entities_decode(common).c_str())); PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); @@ -1300,9 +1300,9 @@ void FacebookProto::SearchIdAckThread(void *targ) // ignore self contact and empty ids if (!id.empty() && id != facy.self_.user_id){ - ptrT tid(mir_utf8decodeT(id.c_str())); - ptrT tname(mir_utf8decodeT(name.c_str())); - ptrT tsurname(mir_utf8decodeT(surname.c_str())); + ptrW tid(mir_utf8decodeW(id.c_str())); + ptrW tname(mir_utf8decodeW(name.c_str())); + ptrW tsurname(mir_utf8decodeW(surname.c_str())); PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index a0fdcf6c52..667738556f 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -48,11 +48,11 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : m_locale = locale; // Load custom page prefix, if set - ptrT pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX)); + ptrW pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX)); m_pagePrefix = (pagePrefix != NULL) ? _T2A(pagePrefix, CP_UTF8) : TEXT_EMOJI_PAGE; if (m_tszDefaultGroup == NULL) - m_tszDefaultGroup = mir_tstrdup(L"Facebook"); + m_tszDefaultGroup = mir_wstrdup(L"Facebook"); CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI); CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg); @@ -86,12 +86,12 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; - mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } @@ -253,7 +253,7 @@ HANDLE FacebookProto::SearchBasic(const wchar_t* id) if (isOffline()) return 0; - wchar_t *tid = mir_tstrdup(id); + wchar_t *tid = mir_wstrdup(id); ForkThread(&FacebookProto::SearchIdAckThread, tid); return tid; } @@ -263,7 +263,7 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email) if (isOffline()) return 0; - wchar_t *temail = mir_tstrdup(email); + wchar_t *temail = mir_wstrdup(email); ForkThread(&FacebookProto::SearchAckThread, temail); return temail; } @@ -271,15 +271,15 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email) HANDLE FacebookProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { wchar_t arg[200]; - mir_sntprintf(arg, L"%s %s %s", nick, firstName, lastName); + mir_snwprintf(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.w, CP_UTF8)); - ptrA name(mir_t2a_cp(psr->firstName.w, CP_UTF8)); - ptrA surname(mir_t2a_cp(psr->lastName.w, CP_UTF8)); + ptrA id(mir_u2a_cp(psr->id.w, CP_UTF8)); + ptrA name(mir_u2a_cp(psr->firstName.w, CP_UTF8)); + ptrA surname(mir_u2a_cp(psr->lastName.w, CP_UTF8)); if (id == NULL) return NULL; @@ -380,11 +380,11 @@ int FacebookProto::GetInfo(MCONTACT hContact, int) INT_PTR FacebookProto::GetMyAwayMsg(WPARAM, LPARAM lParam) { - ptrT statusMsg(getTStringA("StatusMsg")); + ptrW statusMsg(getTStringA("StatusMsg")); if (statusMsg == NULL || statusMsg[0] == '\0') return 0; - return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(statusMsg) : (INT_PTR)mir_t2a(statusMsg); + return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(statusMsg) : (INT_PTR)mir_u2a(statusMsg); } int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam) @@ -570,7 +570,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM) if (wall->user_id == facy.self_.user_id) { for (std::map<std::string, std::string>::iterator iter = facy.pages.begin(); iter != facy.pages.end(); ++iter) { - data->walls.push_back(new wall_data(iter->first, mir_utf8decodeT(iter->second.c_str()), true)); + data->walls.push_back(new wall_data(iter->first, mir_utf8decodeW(iter->second.c_str()), true)); } } @@ -782,7 +782,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE) != CONTACT_FRIEND)) return 0; - ptrT tname(getTStringA(hContact, FACEBOOK_KEY_NICK)); + ptrW tname(getTStringA(hContact, FACEBOOK_KEY_NICK)); if (tname == NULL) tname = getTStringA(hContact, FACEBOOK_KEY_ID); @@ -790,7 +790,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) return 1; wchar_t tstr[256]; - mir_sntprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname); + mir_snwprintf(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) { ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -923,10 +923,10 @@ std::string FacebookProto::PrepareUrl(std::string url) { void FacebookProto::OpenUrl(std::string url) { url = PrepareUrl(url); - ptrT data(mir_utf8decodeT(url.c_str())); + ptrW data(mir_utf8decodeW(url.c_str())); // Check if there is user defined browser for opening links - ptrT browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); + ptrW browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER)); if (browser != NULL) // If so, use it to open this link ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data)); @@ -1009,7 +1009,7 @@ void FacebookProto::InitPopups() char name[256]; // Client - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Client"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1020,7 +1020,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Newsfeeds - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1031,7 +1031,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Notifications - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1042,7 +1042,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Others - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Other"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1053,7 +1053,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Friendship changes - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events")); mir_snprintf(name, "%s_%s", m_szModuleName, "Friendship"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1064,7 +1064,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // Ticker - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity")); mir_snprintf(name, "%s_%s", m_szModuleName, "Ticker"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1075,7 +1075,7 @@ void FacebookProto::InitPopups() popupClasses.push_back(Popup_RegisterClass(&ppc)); // On this day (memories) - mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories")); mir_snprintf(name, "%s_%s", m_szModuleName, "Memories"); ppc.ptszDescription = desc; ppc.pszName = name; @@ -1151,11 +1151,11 @@ void FacebookProto::MessageRead(MCONTACT hContact) if (isChatRoom(hContact)) { // Load readers names - ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); - mir_sntprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"); + ptrW treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + mir_snwprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){ - mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime); + mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } } diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index d7792aa029..cb1b8febe3 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -250,7 +250,7 @@ public: HANDLE log_lock_; HANDLE update_loop_lock_; - ptrT m_tszDefaultGroup; + ptrW m_tszDefaultGroup; std::vector<HANDLE> popupClasses; diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index edd023c8d5..9c87926832 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -45,7 +45,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) return NULL;
wchar_t full[MAX_PATH + 2];
- mir_sntprintf(full, AVA_FILE_NAME_FORMAT, path, name);
+ mir_snwprintf(full, AVA_FILE_NAME_FORMAT, path, name);
CreateDirectoryTreeT(full);
HANDLE h = CreateFile(full, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
@@ -57,7 +57,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) else
CloseHandle(h);
- return mir_tstrdup(full);
+ return mir_wstrdup(full);
}
BOOL SaveAvatar(HANDLE hFile)
@@ -144,7 +144,7 @@ void SetAvatar(MCONTACT hContact) return;
HANDLE hFile;
- ptrT avaFile(CreateAvaFile(&hFile));
+ ptrW avaFile(CreateAvaFile(&hFile));
if (avaFile == NULL)
return;
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 5dd4cf0345..485dc454a4 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -41,25 +41,25 @@ GoogleTalkAcc* isGoogle(LPARAM lParam) void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR 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));
+ size_t l = mir_wstrlen(buf);
+ mir_snwprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
+ assert(l >= mir_wstrlen(buf));
}
void MakeUrlHex(LPTSTR url, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _wtoi64(tid);
LPTSTR tidInUrl = wcsstr(url, tid);
- LPTSTR trail = tidInUrl + mir_tstrlen(tid);
+ LPTSTR trail = tidInUrl + mir_wstrlen(tid);
wsprintf(tidInUrl, L"%x%08x", iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!!
- wmemmove(tidInUrl + mir_tstrlen(tidInUrl), trail, mir_tstrlen(trail) + 1);
+ wmemmove(tidInUrl + mir_wstrlen(tidInUrl), trail, mir_wstrlen(trail) + 1);
}
LPTSTR ExtractJid(LPCTSTR jidWithRes)
{
LPCTSTR p = wcsrchr(jidWithRes, '/');
if (p == NULL)
- return mir_tstrdup(jidWithRes);
+ return mir_wstrdup(jidWithRes);
size_t l = size_t(p - jidWithRes);
LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(wchar_t));
@@ -149,7 +149,7 @@ BOOL MailListHandler(IJabberInterface *ji, HXML node, void *) {
LPCTSTR jidWithRes = xmlGetAttrValue(node, ATTRNAME_TO);
__try {
- if (!node || mir_tstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT)) return TRUE;
+ if (!node || mir_wstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT)) return TRUE;
LPCTSTR jid = xmlGetAttrValue(node, ATTRNAME_FROM);
assert(jid);
@@ -177,15 +177,15 @@ void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) xmlAddAttr(node, ATTRNAME_FROM, jidWithRes);
UINT uID = ji->SerialNext();
- ptrT jid(ExtractJid(jidWithRes));
+ ptrW jid(ExtractJid(jidWithRes));
xmlAddAttr(node, ATTRNAME_TO, jid);
- ptrT
+ ptrW
lastMailTime(ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid)),
lastThreadId(ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid));
wchar_t id[30];
- mir_sntprintf(id, JABBER_IQID_FORMAT, uID);
+ mir_snwprintf(id, JABBER_IQID_FORMAT, uID);
xmlAddAttr(node, ATTRNAME_ID, id);
child = xmlAddChild(node, NODENAME_QUERY, NULL);
@@ -241,11 +241,11 @@ void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) xmlAddAttr(node, ATTRNAME_TYPE, IQTYPE_SET);
xmlAddAttr(node, ATTRNAME_FROM, jidWithResource);
- ptrT jid(ExtractJid(jidWithResource));
+ ptrW jid(ExtractJid(jidWithResource));
xmlAddAttr(node, ATTRNAME_TO, jid);
wchar_t id[30];
- mir_sntprintf(id, JABBER_IQID_FORMAT, ji->SerialNext());
+ mir_snwprintf(id, JABBER_IQID_FORMAT, ji->SerialNext());
xmlAddAttr(node, ATTRNAME_ID, id);
child = xmlAddChild(node, NODENAME_USERSETTING, NULL);
@@ -294,7 +294,7 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *) 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) {
+ if (!mir_wstrcmp(xmlGetName(node), L"presence") && xmlGetAttrValue(node, ATTRNAME_TO) == 0) {
if (!gta->m_bGoogleSharedStatus)
return FALSE;
@@ -317,7 +317,7 @@ BOOL OnIqResultGoogleSharedStatus(IJabberInterface *ji, HXML node, void *) {
GoogleTalkAcc *gta = isGoogle(LPARAM(ji));
if (gta != NULL) {
- gta->m_bGoogleSharedStatus = mir_tstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT) == 0;
+ gta->m_bGoogleSharedStatus = mir_wstrcmp(xmlGetAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT) == 0;
gta->m_bGoogleSharedStatusLock = FALSE;
}
return FALSE;
@@ -328,7 +328,7 @@ BOOL OnIqSetGoogleSharedStatus(IJabberInterface *ji, HXML iqNode, void *) GoogleTalkAcc *gta = isGoogle(LPARAM(ji));
if (gta == NULL)
return FALSE;
- if (mir_tstrcmp(xmlGetAttrValue(iqNode, ATTRNAME_TYPE), IQTYPE_SET))
+ if (mir_wstrcmp(xmlGetAttrValue(iqNode, ATTRNAME_TYPE), IQTYPE_SET))
return FALSE;
if (gta->m_bGoogleSharedStatusLock)
return TRUE;
@@ -336,11 +336,11 @@ BOOL OnIqSetGoogleSharedStatus(IJabberInterface *ji, HXML iqNode, void *) int status;
HXML query = xmlGetChildByPath(iqNode, NODENAME_QUERY, 0);
HXML node = xmlGetChildByPath(query, L"invisible", 0);
- if (0 == mir_tstrcmpi(L"true", xmlGetAttrValue(node, L"value")))
+ if (0 == mir_wstrcmpi(L"true", xmlGetAttrValue(node, L"value")))
status = ID_STATUS_INVISIBLE;
else {
LPCTSTR txt = xmlGetText(xmlGetChildByPath(query, L"show", 0));
- if (txt && 0 == mir_tstrcmpi(L"dnd", txt))
+ if (txt && 0 == mir_wstrcmpi(L"dnd", txt))
status = ID_STATUS_DND;
else if (gta->m_pa->ppro->m_iStatus == ID_STATUS_DND || gta->m_pa->ppro->m_iStatus == ID_STATUS_INVISIBLE)
status = ID_STATUS_ONLINE;
@@ -364,12 +364,12 @@ void GoogleTalkAcc::SendIqGoogleSharedStatus(LPCTSTR status, LPCTSTR msg) xmlAddAttrInt(query, L"version", 2);
xmlAddChild(query, L"status", msg);
- if (!mir_tstrcmp(status, L"invisible")) {
+ if (!mir_wstrcmp(status, L"invisible")) {
xmlAddChild(query, L"show", L"default");
xmlAddAttr(xmlAddChild(query, L"invisible", 0), L"value", L"true");
}
else {
- if (!mir_tstrcmp(status, L"dnd"))
+ if (!mir_wstrcmp(status, L"dnd"))
xmlAddChild(query, L"show", L"dnd");
else
xmlAddChild(query, L"show", L"default");
@@ -390,7 +390,7 @@ int OnServerDiscoInfo(WPARAM wParam, LPARAM lParam) // m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PING;
JABBER_DISCO_FIELD *fld = (JABBER_DISCO_FIELD*)wParam;
- if (!mir_tstrcmp(fld->category, L"server") && !mir_tstrcmp(fld->type, L"im") && !mir_tstrcmp(fld->name, L"Google Talk")) {
+ if (!mir_wstrcmp(fld->category, L"server") && !mir_wstrcmp(fld->type, L"im") && !mir_wstrcmp(fld->name, L"Google Talk")) {
HXML iq = xmlCreateNode(NODENAME_IQ, NULL, FALSE);
xmlAddAttr(iq, ATTRNAME_TYPE, IQTYPE_GET);
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index f4e6c3ee4d..2e73250e7d 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -168,8 +168,8 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) int pwdLen = GetMailboxPwd(acc, NULL, 0);
if (!pwdLen++) return FALSE;
- size_t urlLen = mir_tstrlen(url) + 1;
- size_t mailboxLen = mir_tstrlen(mailbox) + 1;
+ size_t urlLen = mir_wstrlen(url) + 1;
+ size_t mailboxLen = mir_wstrlen(mailbox) + 1;
OPEN_URL_HEADER *data = (OPEN_URL_HEADER*)malloc(sizeof(OPEN_URL_HEADER) + urlLen + mailboxLen + pwdLen);
data->url = (LPSTR)data + sizeof(OPEN_URL_HEADER);
@@ -196,7 +196,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) void OpenContactInbox(LPCSTR szModuleName)
{
- ptrT tszJid(db_get_tsa(0, szModuleName, "jid"));
+ ptrW tszJid(db_get_tsa(0, szModuleName, "jid"));
if (tszJid == NULL)
return;
@@ -206,9 +206,9 @@ void OpenContactInbox(LPCSTR szModuleName) *host++ = 0;
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
+ if (mir_wstrcmpi(host, COMMON_GMAIL_HOST1) && mir_wstrcmpi(host, COMMON_GMAIL_HOST2))
+ mir_snwprintf(buf, INBOX_URL_FORMAT, L"a/", host); // hosted
else
- mir_sntprintf(buf, INBOX_URL_FORMAT, L"", L"mail"); // common
+ mir_snwprintf(buf, INBOX_URL_FORMAT, L"", L"mail"); // common
OpenUrl(szModuleName, tszJid, buf);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index fda2db7eb5..e2243609ca 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -54,8 +54,8 @@ LPCSTR GetJidAcc(LPCTSTR jid) Proto_EnumAccounts(&count, &protos);
for (int i = 0; i < count; i++) {
if (getJabberApi(protos[i]->szModuleName)) {
- ptrT tszJid(db_get_tsa(0, protos[i]->szModuleName, "jid"));
- if (!mir_tstrcmpi(jid, tszJid))
+ ptrW tszJid(db_get_tsa(0, protos[i]->szModuleName, "jid"));
+ if (!mir_wstrcmpi(jid, tszJid))
return protos[i]->szModuleName;
}
}
@@ -158,7 +158,7 @@ static bool DoAddPopup(POPUPDATAT *data) void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCount)
{
- if (mir_tstrcmp(unreadCount, L"0"))
+ if (mir_wstrcmp(unreadCount, L"0"))
wsprintf(buff, L"%s [%s]", jid, unreadCount); //!!!!!!!!!!!
else
wsprintf(buff, L"%s", jid); //!!!!!!!!!!!
@@ -177,7 +177,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST // SetAvatar(hContact);
if (displayName == NULL) {
- wchar_t *tszTemp = (wchar_t*)alloca((mir_tstrlen(jid) + mir_tstrlen(unreadCount) + 3 + 1) * sizeof(wchar_t));
+ wchar_t *tszTemp = (wchar_t*)alloca((mir_wstrlen(jid) + mir_wstrlen(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(wchar_t);
- size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(wchar_t);
+ size_t lurl = (mir_wstrlen(url) + 1) * sizeof(wchar_t);
+ size_t ljid = (mir_wstrlen(jid) + 1) * sizeof(wchar_t);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
@@ -253,7 +253,7 @@ void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unread POPUPDATAT data = { 0 };
FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount);
- mir_sntprintf(data.lptzText, TranslateT("You've received an e-mail\n%s unread threads"), unreadCount);
+ mir_snwprintf(data.lptzText, TranslateT("You've received an e-mail\n%s unread threads"), unreadCount);
ShowNotification(acc, &data, jid, url, unreadCount);
}
@@ -276,9 +276,9 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre }
if (ReadCheckbox(0, IDC_ADDSNIP, (UINT_PTR)TlsGetValue(itlsSettings)))
- mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip);
+ mir_snwprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str(), mtn->snip);
else
- mir_sntprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str());
+ mir_snwprintf(data.lptzText, TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, tszSenders.c_str());
ShowNotification(acc, &data, jid, url, unreadCount);
}
@@ -321,7 +321,7 @@ BOOL CALLBACK ClosePopupFunc(__in HWND hwnd, __in LPARAM lParam) if (!ppdh)
return TRUE;
- if (!mir_tstrcmpi(ppis->url, ppdh->url) && !mir_tstrcmpi(ppis->jid, ppdh->jid))
+ if (!mir_wstrcmpi(ppis->url, ppdh->url) && !mir_wstrcmpi(ppis->jid, ppdh->jid))
SendMessage(hwnd, MESSAGE_CLOSEPOPUP, 0, 0);
return TRUE;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 02394e0949..9183d773e4 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -155,8 +155,8 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa void ShowTestPopup(HWND wnd)
{
POPUPDATAT data = { 0 };
- mir_sntprintf(data.lptzContactName, TranslateTS(TEST_LETTER_INBOX));
- mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
+ mir_snwprintf(data.lptzContactName, TranslateTS(TEST_LETTER_INBOX));
+ mir_snwprintf(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(wchar_t));
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index ef886b764f..929078c2f7 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -74,15 +74,15 @@ void SetLabelProp(int index, LPSTR setting) {
sprintf(setting, LABEL_SETTING_PROP, index); //!!!!!!!!!!!!!!
- ptrT tszProp(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ ptrW tszProp(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
if (tszProp == NULL)
return;
- ptrT tszLastWritten(db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING));
+ ptrW tszLastWritten(db_get_tsa(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING));
if (tszLastWritten == NULL)
return;
- if (!mir_tstrcmp(tszProp, tszLastWritten)) {
+ if (!mir_wstrcmp(tszProp, tszLastWritten)) {
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label);
@@ -103,9 +103,9 @@ void AddTipperItem() for (i = 0; i < itemCount; i++) {
mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
- ptrT tszSetting(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
+ ptrW tszSetting(db_get_tsa(0, TIPPER_ITEMS_MOD_NAME, setting));
if (tszSetting) {
- if (!mir_tstrcmp(UNREAD_THREADS_RAW, tszSetting)) {
+ if (!mir_wstrcmp(UNREAD_THREADS_RAW, tszSetting)) {
SetLabelProp(i, setting);
return;
}
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index f3c8a3cc05..764cc426ef 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -28,7 +28,7 @@ //
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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
@@ -37,7 +37,7 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) else {
debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
+ mir_snwprintf(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);
}
}
@@ -47,13 +47,13 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) if (hContact != NULL) {
DBVARIANT dbv;
if (!getString(hContact, GG_KEY_AVATARHASH, &dbv)) {
- wchar_t* avatarHashT = mir_a2t(dbv.pszVal);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
+ wchar_t* avatarHashT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
mir_free(avatarHashT);
db_free(&dbv);
}
}
- else mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
+ else mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
}
bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
@@ -83,19 +83,19 @@ 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)
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
- if (blank != NULL && mir_tstrcmp(blank, L"1")) {
+ if (blank != NULL && mir_wstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
- *avatarts = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarts = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/bigavatar", 0); //new gg convention
if (node == NULL){
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/originBigAvatar", 0); //old gg convention
}
- *avatarurl = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarurl = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
}
xmlDestroyNode(hXml);
}
@@ -271,7 +271,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) } else {
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);
+ mir_snwprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
@@ -363,7 +363,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) if (file_fd == -1) {
debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
+ mir_snwprintf(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);
int prevType = getByte(GG_KEY_AVATARTYPEPREV, -1);
@@ -512,5 +512,5 @@ void GGPROTO::setAvatar(const wchar_t *szFilename) #ifdef DEBUGMODE
debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
#endif
- ForkThread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
+ ForkThread(&GGPROTO::setavatarthread, mir_wstrdup(szFilename));
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 692b36aef5..dec48051e4 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -67,58 +67,58 @@ void GGPROTO::disconnect() switch (getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
case ID_STATUS_ONLINE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 6, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.online);
+ szMsg = mir_utf8encodeW(modemsg.online);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 6, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_AWAY:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 7, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.away);
+ szMsg = mir_utf8encodeW(modemsg.away);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 7, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_DND:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 8, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.dnd);
+ szMsg = mir_utf8encodeW(modemsg.dnd);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 8, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_FREECHAT:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 9, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.freechat);
+ szMsg = mir_utf8encodeW(modemsg.freechat);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_INVISIBLE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 10, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.invisible);
+ szMsg = mir_utf8encodeW(modemsg.invisible);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 10, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
default:
// Set last status
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 11, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(getstatusmsg(m_iStatus));
+ szMsg = mir_utf8encodeW(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 11, 1, "modemsg_mutex", 1);
}
}
@@ -360,8 +360,8 @@ void __cdecl GGPROTO::mainthread(void *) if (!getString(GG_KEY_FORWARDHOST, &dbv)) {
if (!(p.external_addr = gg_dnslookup(this, 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);
+ wchar_t* forwardHostT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(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);
}
@@ -378,7 +378,7 @@ retry: // Loadup startup status & description
gg_EnterCriticalSection(&modemsg_mutex, "mainthread", 13, "modemsg_mutex", 1);
- p.status_descr = mir_utf8encodeT(getstatusmsg(m_iDesiredStatus));
+ p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus));
p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
debugLog(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus,
@@ -391,8 +391,8 @@ retry: if (!(p.server_addr = gg_dnslookup(this, 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);
+ wchar_t* hostnameT = mir_a2u(hosts[hostnum].hostname);
+ mir_snwprintf(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);
}
@@ -423,7 +423,7 @@ retry: }
}
if (!perror) {
- mir_sntprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
+ mir_snwprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
perror = error;
}
debugLog(L"mainthread() (%x): %s", this, perror);
@@ -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)
- wchar_t *status_descr = mir_utf8decodeT(p.status_descr);
+ wchar_t *status_descr = mir_utf8decodeW(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++)
{
- wchar_t *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_utf8decodeW(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;
- wchar_t *descrT = mir_utf8decodeT(e->event.notify60[i].descr);
+ wchar_t *descrT = mir_utf8decodeW(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);
- 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));
+ wchar_t *__nickname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
+ wchar_t *__firstname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
+ wchar_t *__lastname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
+ wchar_t *__familyname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
+ wchar_t *__city = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
+ wchar_t *__familycity = mir_utf8decodeW(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);
@@ -637,8 +637,8 @@ retry: 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));
+ mir_snwprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
time_t t = time(NULL);
@@ -646,8 +646,8 @@ retry: int br = atoi(__birthyear);
if (br < (lt->tm_year + 1900) && br > 1900) {
- mir_sntprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
- mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
+ mir_snwprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
}
@@ -757,7 +757,7 @@ retry: // Status (deprecated)
case GG_EVENT_STATUS:
{
- wchar_t *descrT = mir_utf8decodeT(e->event.status.descr);
+ wchar_t *descrT = mir_utf8decodeW(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);
- wchar_t *descrT = mir_utf8decodeT(e->event.status60.descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.status60.descr);
if (e->event.status60.uin == uin)
{
@@ -832,7 +832,7 @@ retry: GCEVENT gce = { sizeof(gce), &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
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;
@@ -895,14 +895,14 @@ retry: GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.multilogon_msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
gce.time = e->event.multilogon_msg.time;
gce.bIsMe = 1;
@@ -974,7 +974,7 @@ retry: if (iIndexes && iIndexes[i])
continue;
- mir_sntprintf(szMsg, L"%s (%s)", szText,
+ mir_snwprintf(szMsg, L"%s (%s)", szText,
*e->event.multilogon_info.sessions[i].name != '\0' ?
_A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
@@ -1052,7 +1052,7 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
- wchar_t* filenameT = mir_a2t((char*)dcc7->filename);
+ wchar_t* filenameT = mir_a2u((char*)dcc7->filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -1149,8 +1149,8 @@ retry: wchar_t *xmlAction;
wchar_t *tag;
- xmlAction = mir_a2t(e->event.xml_action.data);
- tag = mir_a2t("events");
+ xmlAction = mir_a2u(e->event.xml_action.data);
+ tag = mir_a2u("events");
hXml = xmlParseString(xmlAction, 0, tag);
if (hXml != NULL) {
@@ -1158,14 +1158,14 @@ retry: char *type, *sender;
mir_free(tag);
- tag = mir_a2t("event/type");
+ tag = mir_a2u("event/type");
node = xmlGetChildByPath(hXml, tag, 0);
- type = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ type = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
mir_free(tag);
- tag = mir_a2t("event/sender");
+ tag = mir_a2u("event/sender");
node = xmlGetChildByPath(hXml, tag, 0);
- sender = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ sender = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
// Avatar change notify
if (type != NULL && !mir_strcmp(type, "28")) {
@@ -1311,11 +1311,11 @@ static wchar_t* sttSettingToTchar( DBVARIANT* value ) {
switch(value->type) {
case DBVT_ASCIIZ:
- return mir_a2t(value->pszVal);
+ return mir_a2u(value->pszVal);
case DBVT_UTF8:
- return mir_utf8decodeT(value->pszVal);
+ return mir_utf8decodeW(value->pszVal);
case DBVT_WCHAR:
- return mir_u2t(value->pwszVal);
+ return mir_wstrdup(value->pwszVal);
}
return NULL;
}
@@ -1570,7 +1570,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_pubdir50(sess, req);
gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1);
gg_pubdir50_free(req);
- wchar_t* uinT = mir_a2t(ditoa(uin));
+ wchar_t* uinT = mir_a2u(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, wchar_t *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);
- wchar_t *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
+ wchar_t *szMsg = mir_wstrdup(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);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index e4a593496f..1aceff00a9 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -65,7 +65,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (dbv.cVal == -100) unspecified = 1; else { ptstr = str; - mir_sntprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); + mir_snwprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); @@ -79,7 +79,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } } else { @@ -97,12 +97,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } if (dbv.dVal == 0) unspecified = 1; } else if (special == SVS_GGVERSION) { ptstr = str; - mir_sntprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); + mir_snwprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); } else { ptstr = _itow(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } @@ -110,7 +110,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_ASCIIZ: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); ptstr = str; - mir_sntprintf(str, L"%S", dbv.pszVal); + mir_snwprintf(str, L"%S", dbv.pszVal); break; case DBVT_TCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); @@ -118,14 +118,14 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule break; case DBVT_UTF8: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - valT = mir_utf8decodeT(dbv.pszVal); + valT = mir_utf8decodeW(dbv.pszVal); ptstr = str; wcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: ptstr = str; - mir_tstrcpy(str, L"???"); + mir_wstrcpy(str, L"???"); break; } } @@ -803,19 +803,19 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, break; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_CITY, T2Utf(text)); // Gadu-Gadu Female <-> Male @@ -831,15 +831,15 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, } GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, T2Utf(text)); // Run update diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 14a82d4b58..38909300a0 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,7 +381,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
// Make new ggtransfer struct
local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
- wchar_t* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename);
+ wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -662,7 +662,7 @@ void __cdecl GGPROTO::dccmainthread(void*) 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);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc->file_info.filename);
dcc->folder = _strdup((char*)path);
dcc->tick = 0;
@@ -678,7 +678,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(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);
// Free transfer
@@ -702,7 +702,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* 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);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc7->filename);
dcc7->folder = _strdup((char*)path);
dcc7->tick = 0;
@@ -727,7 +727,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(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);
ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0);
@@ -917,7 +917,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles if (!isonline())
return ftfail(this, hContact);
- filename = mir_t2a(ppszFiles[0]);
+ filename = mir_u2a(ppszFiles[0]);
// Read user IP and port
ip = swap32(getDword(hContact, GG_KEY_CLIENTIP, 0));
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 11c44a47de..18e264e031 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -65,9 +65,9 @@ wchar_t* ws_strerror(int code) 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());
+ mir_snwprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
else
- mir_sntprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
+ mir_snwprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
return err_desc;
}
@@ -174,18 +174,18 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
wchar_t avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath);
wchar_t spec[MAX_PATH + 10];
- mir_sntprintf(spec, L"%s\\*.(null)", avatarsPath);
+ mir_snwprintf(spec, L"%s\\*.(null)", avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
wchar_t filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
+ mir_snwprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
if (!_waccess(filePathT, 0)){
debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT);
_wremove(filePathT);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 10ea01e41b..be0a8943fe 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -40,7 +40,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : // Register m_hNetlibUser user
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED);
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
+ mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
DWORD dwVersion;
@@ -379,7 +379,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data
wchar_t text[64];
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf firstName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
szQuery.Append(firstName_utf8);
@@ -387,7 +387,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf lastName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
szQuery.Append(lastName_utf8);
@@ -395,7 +395,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf nickName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8);
szQuery.Append(nickName_utf8);
@@ -403,7 +403,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf city_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8);
szQuery.Append(city_utf8);
@@ -411,7 +411,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
time_t t = time(NULL);
@@ -431,7 +431,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) yearFrom = 0;
else
yearFrom = ay - yearFrom;
- mir_sntprintf(text, L"%d %d", yearFrom, yearTo);
+ mir_snwprintf(text, L"%d %d", yearFrom, yearTo);
T2Utf age_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8);
@@ -653,7 +653,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) }
// Check if we change status here somehow
- if (*msgPtr && newMsg && !mir_tstrcmp(*msgPtr, newMsg)
+ if (*msgPtr && newMsg && !mir_wstrcmp(*msgPtr, newMsg)
|| !*msgPtr && (!newMsg || !*newMsg)) {
if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) {
debugLogA("SetAwayMsg(): Message hasn't been changed, return.");
@@ -664,7 +664,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) else {
if (*msgPtr)
mir_free(*msgPtr);
- *msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL;
+ *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : NULL;
#ifdef DEBUGMODE
debugLogA("SetAwayMsg(): Message changed.");
#endif
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 85790434eb..52d5399ef8 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -102,7 +102,7 @@ GGGC* GGPROTO::gc_lookup(const wchar_t *id) for(l = chats; l; l = l->next)
{
chat = (GGGC *)l->data;
- if (chat && !mir_tstrcmp(chat->id, id))
+ if (chat && !mir_wstrcmp(chat->id, id))
return chat;
}
@@ -138,7 +138,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) MCONTACT hNext = db_find_next(hContact);
DBVARIANT dbv;
if (!getTString(hContact, "ChatRoomID", &dbv)) {
- if (dbv.ptszVal && !mir_tstrcmp(gch->pDest->ptszID, dbv.ptszVal))
+ if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal))
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
db_free(&dbv);
}
@@ -159,14 +159,14 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) gce.ptszText = gch->ptszText;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
// Get rid of CRLF at back
- int lc = (int)mir_tstrlen(gch->ptszText) - 1;
+ int lc = (int)mir_wstrlen(gch->ptszText) - 1;
while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc --] = 0;
@@ -282,7 +282,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t *senderName = unknownSender ?
TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
wchar_t error[256];
- mir_sntprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
+ mir_snwprintf(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;
}
@@ -307,12 +307,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (sender)
{
senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
- mir_sntprintf(status, TranslateT("%s initiated the conference.") , senderName);
+ mir_snwprintf(status, TranslateT("%s initiated the conference.") , senderName);
}
else
{
senderName = NULL;
- mir_sntprintf(status, TranslateT("This is my own conference."));
+ mir_snwprintf(status, TranslateT("This is my own conference."));
}
GCSESSION gcwindow = { sizeof(gcwindow) };
@@ -324,8 +324,8 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
- wchar_t *name = (wchar_t*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
- *name = '#'; mir_tstrcpy(name + 1, gcwindow.ptszName);
+ wchar_t *name = (wchar_t*)calloc(mir_wstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
+ *name = '#'; mir_wstrcpy(name + 1, gcwindow.ptszName);
gcwindow.ptszName = name;
// Create new room
@@ -354,10 +354,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)) {
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
} else {
- nickT = mir_tstrdup(TranslateT("Me"));
+ nickT = mir_wstrdup(TranslateT("Me"));
}
gce.ptszNick = nickT;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index a883917caf..106b8e2d5f 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -223,10 +223,10 @@ wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) // Make up filter
wcsncpy(pFilter, szFilterName, nSize);
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
*pFilter = 0;
@@ -420,9 +420,9 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP wchar_t *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128];
if (dat->bReceiving)
- mir_sntprintf(szTitle, TranslateT("Image from %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image from %s"), szName);
else
- mir_sntprintf(szTitle, TranslateT("Image for %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image for %s"), szName);
SetWindowText(hwndDlg, szTitle);
// Store client extents
@@ -495,7 +495,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->bReceiving)
{
wchar_t szTitle[128];
- mir_sntprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
+ mir_snwprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
SetDlgItemText(hwndDlg, IDC_IMG_NAME, szTitle);
}
else
@@ -777,14 +777,14 @@ wchar_t *gg_img_hasextension(wchar_t *filename) wchar_t *imgtype = wcsrchr(filename, '.');
if (imgtype != NULL)
{
- size_t len = mir_tstrlen(imgtype);
+ size_t len = mir_wstrlen(imgtype);
imgtype++;
- if (len == 4 && (mir_tstrcmpi(imgtype, L"bmp") == 0 ||
- mir_tstrcmpi(imgtype, L"gif") == 0 ||
- mir_tstrcmpi(imgtype, L"jpg") == 0 ||
- mir_tstrcmpi(imgtype, L"png") == 0))
+ if (len == 4 && (mir_wstrcmpi(imgtype, L"bmp") == 0 ||
+ mir_wstrcmpi(imgtype, L"gif") == 0 ||
+ mir_wstrcmpi(imgtype, L"jpg") == 0 ||
+ mir_wstrcmpi(imgtype, L"png") == 0))
return --imgtype;
- if (len == 5 && mir_tstrcmpi(imgtype, L"jpeg") == 0)
+ if (len == 5 && mir_wstrcmpi(imgtype, L"jpeg") == 0)
return --imgtype;
}
}
@@ -803,12 +803,12 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%");
- tPathLen = mir_sntprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
+ tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
}
else {
- mir_tstrcpy(szPath, path);
- tPathLen = mir_tstrlen(szPath);
+ mir_wstrcpy(szPath, path);
+ tPathLen = mir_wstrlen(szPath);
}
if ( _waccess(szPath, 0)){
@@ -818,19 +818,19 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(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);
}
}
- mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
+ mir_snwprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
if ((pImgext = gg_img_hasextension(szPath)) == NULL)
- pImgext = szPath + mir_tstrlen(szPath);
+ pImgext = szPath + mir_wstrlen(szPath);
wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
{
if ((res = gg_img_isexists(szPath, dat)) != -1) break;
- mir_sntprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
+ mir_snwprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
}
if (res == 0) {
@@ -842,7 +842,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(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;
}
@@ -850,7 +850,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res != 0) {
wchar_t image_msg[MAX_PATH + 11];
- mir_sntprintf(image_msg, L"[img]%s[/img]", szPath);
+ mir_snwprintf(image_msg, L"[img]%s[/img]", szPath);
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
@@ -963,7 +963,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat);
debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
+ mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return NULL;
}
@@ -1005,15 +1005,15 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) dat->lpData = (char*)malloc(dat->nSize);
memcpy(dat->lpData, e->event.image_reply.image, dat->nSize);
- ptrT tmpFileName( mir_a2t(e->event.image_reply.filename));
+ ptrW tmpFileName( mir_a2u(e->event.image_reply.filename));
if (!gg_img_hasextension(tmpFileName)) {
// Add missing file extension
const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
- dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
+ dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_wstrlen(tmpFileName) + mir_wstrlen(szImgType) + 1);
if (dat->lpszFileName != NULL) {
- mir_tstrcpy(dat->lpszFileName, tmpFileName);
- mir_tstrcat(dat->lpszFileName, szImgType);
+ mir_wstrcpy(dat->lpszFileName, tmpFileName);
+ mir_wstrcat(dat->lpszFileName, szImgType);
}
}
}
@@ -1143,7 +1143,7 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) if (!dat || !isonline())
return FALSE;
- char* lpszFileNameA = mir_t2a(dat->lpImages->lpszFileName);
+ char* lpszFileNameA = mir_u2a(dat->lpImages->lpszFileName);
gg_EnterCriticalSection(&sess_mutex, "img_sendonrequest", 63, "sess_mutex", 1);
gg_image_reply(sess, e->event.image_request.sender, lpszFileNameA, dat->lpImages->lpData, dat->lpImages->nSize);
gg_LeaveCriticalSection(&sess_mutex, "img_sendonrequest", 63, 1, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 08a882079e..6e8e3f43f0 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -34,7 +34,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) DBVARIANT dbv;
if (!gg->getTString(hContact, GG_KEY_PD_FIRSTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -43,7 +43,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup LastName
if (!gg->getTString(hContact, GG_KEY_PD_LASTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -53,11 +53,11 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup Nick
if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !gg->getTString(hContact, GG_KEY_NICK, &dbv))
{
- char* dbvA = mir_t2a(dbv.ptszVal);
+ char* dbvA = mir_u2a(dbv.ptszVal);
DBVARIANT dbv2;
if (!gg->getTString(hContact, GG_KEY_PD_NICKNAME, &dbv2))
{
- char* pszValA = mir_t2a(dbv2.ptszVal);
+ char* pszValA = mir_u2a(dbv2.ptszVal);
string_append(s, pszValA);
mir_free(pszValA);
db_free(&dbv2);
@@ -216,19 +216,19 @@ void GGPROTO::parsecontacts(char *contacts) #endif
// Write group
if (hContact && strGroup) {
- ptrT tszGrpName( mir_a2t(strGroup));
+ ptrW tszGrpName( mir_a2u(strGroup));
Clist_GroupCreate(0, tszGrpName);
db_set_ts(hContact, "CList", "Group", tszGrpName);
}
// Write misc data
if (hContact && strFirstName){
- wchar_t *tstrFirstName = mir_a2t(strFirstName);
+ wchar_t *tstrFirstName = mir_a2u(strFirstName);
setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName);
mir_free(tstrFirstName);
}
if (hContact && strLastName){
- wchar_t *tstrLastName = mir_a2t(strLastName);
+ wchar_t *tstrLastName = mir_a2u(strLastName);
setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName);
mir_free(tstrLastName);
}
@@ -278,7 +278,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) {
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);
+ mir_snwprintf(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);
debugLog(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno));
}
@@ -316,7 +316,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) {
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);
+ mir_snwprintf(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);
debugLog(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno));
}
@@ -337,24 +337,24 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
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;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
@@ -390,7 +390,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) else
{
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);
+ mir_snwprintf(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));
if (f)
@@ -406,25 +406,25 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) wchar_t filter[512], *pfilter;
wcsncpy(str, TranslateT("contacts"), _countof(str));
- mir_tstrncat(str, L".txt", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, L".txt", _countof(str) - mir_wstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
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;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
@@ -452,7 +452,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) else
{
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);
+ mir_snwprintf(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));
}
@@ -496,7 +496,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) {
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);
+ mir_snwprintf(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);
debugLog(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno));
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 818daa2d8d..2a24e7e5c5 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -315,14 +315,14 @@ int GGPROTO::oauth_receivetoken() if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token_secret = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
xmlDestroyNode(hXml);
}
@@ -384,14 +384,14 @@ 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) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = mir_t2a(xmlGetText(node));
+ token = mir_u2a(xmlGetText(node));
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = mir_t2a(xmlGetText(node));
+ token_secret = mir_u2a(xmlGetText(node));
xmlDestroyNode(hXml);
}
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 7d7ebeb5cd..c89521354f 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -57,7 +57,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0)))
{
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);
+ mir_snwprintf(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 ca8ff1fa74..7712477bc2 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -87,7 +87,7 @@ void GGPROTO::initpopups() puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
ReleaseIconEx("main", FALSE);
puc.iSeconds = 4;
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&puc);
@@ -95,7 +95,7 @@ void GGPROTO::initpopups() puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
}
@@ -155,8 +155,8 @@ void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags) PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flags = flags;
- puData->title = mir_tstrdup(nickname);
- puData->text = mir_tstrdup(msg);
+ puData->title = mir_wstrdup(nickname);
+ puData->text = mir_wstrdup(msg);
puData->gg = this;
CallFunctionAsync(sttMainThreadCallback, puData);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index f067ae87b7..e0fde48c40 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -189,7 +189,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar
DBVARIANT dbv;
if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
- if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
+ if ((mir_wstrlen(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");
wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -242,7 +242,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) 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);
+ mir_snwprintf(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);
}
setString(pai->hContact, GG_KEY_AVATARHASH, AvatarHash);
@@ -257,7 +257,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) 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);
+ mir_snwprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
delSetting(pai->hContact, GG_KEY_AVATARHASH);
@@ -337,7 +337,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) wchar_t szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
- if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
+ if ( mir_wstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
}
@@ -357,7 +357,7 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam) gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
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);
+ res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(szMsg) : (INT_PTR)mir_u2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
return res;
}
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 13db5b1072..cd2225ddad 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -142,7 +142,7 @@ static BOOL IsOverAction(HWND hwndDlg) szText[0] = 0;
ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, _countof(szText));
hdc = GetDC(hList);
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w HANDLE hProtoAckEvent;
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, oldTitle, gg->m_tszUserName);
+ mir_snwprintf(newTitle, oldTitle, gg->m_tszUserName);
SetWindowText(hwndDlg, newTitle);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS));
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
}
- int cbLen = (int)mir_tstrlen(szText);
+ int cbLen = (int)mir_wstrlen(szText);
SIZE textSize;
GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
@@ -330,10 +330,10 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, _countof(szClientName));
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
- mir_sntprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
+ mir_snwprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != NULL)
{
- mir_tstrcpy((wchar_t*)GlobalLock(hData), szText);
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w 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);
+ mir_snwprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
Utils_OpenUrlT(szUrl);
break;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index da89d11331..351b0df053 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -114,7 +114,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) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
+ mir_snwprintf(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);
return FALSE;
@@ -123,7 +123,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_token *t = (struct gg_token *)h->data;
if (!t || !h->body) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
+ mir_snwprintf(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);
return FALSE;
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 0a2e424c2f..2b8be7fb7a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -40,7 +40,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
+ mir_snwprintf(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)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -86,7 +86,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)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
+ mir_snwprintf(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)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -138,7 +138,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)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(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)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -180,7 +180,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(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);
gg->debugLog(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno));
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 06215bfe8c..19b51ca642 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -2203,12 +2203,12 @@ void ICQ::addUrl(ICQUser *u, char *m, unsigned short theCmd, unsigned short theS CCSDATA ccs;
PROTORECVEVENT pre;
- messageLen = (int)mir_tstrlen(m);
+ messageLen = (int)mir_strlen(m);
for (i=0; i<messageLen; i++) if (m[i] == (char)0xFE) m[i] = 0;
url = new char[messageLen + 1];
- lstrcpy(url, m + mir_tstrlen(m) + 1);
- lstrcpy(url + mir_tstrlen(url) + 1, m);
+ lstrcpy(url, m + mir_strlen(m) + 1);
+ lstrcpy(url + mir_strlen(url) + 1, m);
ccs.hContact = u->hContact;
ccs.szProtoService = PSR_URL;
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index a03ac228ad..d2d559f7da 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -199,7 +199,7 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (DWORD)mir_tstrlen(pre->szMessage) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(ccs->hContact, &dbei);
return 0;
@@ -235,14 +235,14 @@ static INT_PTR icqRecvUrl(WPARAM, LPARAM lParam) T("[ ] recieve url\n");
db_unset(ccs->hContact, "CList", "Hidden");
- pszDescr = pre->szMessage + mir_tstrlen(pre->szMessage) + 1;
+ pszDescr = pre->szMessage + mir_strlen(pre->szMessage) + 1;
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
dbei.szModule = protoName;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_URL;
- dbei.cbBlob = (DWORD)(mir_tstrlen(pre->szMessage) + mir_tstrlen(pszDescr) + 2);
+ dbei.cbBlob = (DWORD)(mir_strlen(pre->szMessage) + mir_strlen(pszDescr) + 2);
dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(ccs->hContact, &dbei);
return 0;
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 3f3676869e..c4f076d1c7 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -69,7 +69,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, cle.hIcon = LoadIconEx(IDI_DCC);
mir_snprintf(szService, "%s/DblClickEvent", m_szModuleName);
cle.pszService = szService;
- mir_sntprintf(szNick, TranslateT("CTCP chat request from %s"), name.c_str());
+ mir_snwprintf(szNick, TranslateT("CTCP chat request from %s"), name.c_str());
cle.ptszTooltip = szNick;
cle.lParam = (LPARAM)pdci;
@@ -165,7 +165,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) if (!user || !user->name)
return 0;
- wchar_t* lowercasename = mir_tstrdup(user->name);
+ wchar_t* lowercasename = mir_wstrdup(user->name);
CharLower(lowercasename);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -173,33 +173,33 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) continue;
MCONTACT hContact_temp = NULL;
- ptrT DBNick(getTStringA(hContact, "Nick"));
- ptrT DBUser(getTStringA(hContact, "UUser"));
- ptrT DBHost(getTStringA(hContact, "UHost"));
- ptrT DBDefault(getTStringA(hContact, "Default"));
- ptrT DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBNick(getTStringA(hContact, "Nick"));
+ ptrW DBUser(getTStringA(hContact, "UUser"));
+ ptrW DBHost(getTStringA(hContact, "UHost"));
+ ptrW DBDefault(getTStringA(hContact, "Default"));
+ ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
if (IsChannel(user->name)) {
- if (DBDefault && !mir_tstrcmpi(DBDefault, user->name))
+ if (DBDefault && !mir_wstrcmpi(DBDefault, user->name))
hContact_temp = (MCONTACT)-1;
}
- else if (user->ExactNick && DBNick && !mir_tstrcmpi(DBNick, user->name))
+ else if (user->ExactNick && DBNick && !mir_wstrcmpi(DBNick, user->name))
hContact_temp = hContact;
- else if (user->ExactOnly && DBDefault && !mir_tstrcmpi(DBDefault, user->name))
+ else if (user->ExactOnly && DBDefault && !mir_wstrcmpi(DBDefault, user->name))
hContact_temp = hContact;
else if (user->ExactWCOnly) {
- if (DBWildcard && !mir_tstrcmpi(DBWildcard, lowercasename)
- || (DBWildcard && !mir_tstrcmpi(DBNick, lowercasename) && !WCCmp(DBWildcard, lowercasename))
- || (!DBWildcard && !mir_tstrcmpi(DBNick, lowercasename))) {
+ if (DBWildcard && !mir_wstrcmpi(DBWildcard, lowercasename)
+ || (DBWildcard && !mir_wstrcmpi(DBNick, lowercasename) && !WCCmp(DBWildcard, lowercasename))
+ || (!DBWildcard && !mir_wstrcmpi(DBNick, lowercasename))) {
hContact_temp = hContact;
}
}
else if (wcschr(user->name, ' ') == 0) {
- if ((DBDefault && !mir_tstrcmpi(DBDefault, user->name) || DBNick && !mir_tstrcmpi(DBNick, user->name) ||
+ if ((DBDefault && !mir_wstrcmpi(DBDefault, user->name) || DBNick && !mir_wstrcmpi(DBNick, user->name) ||
DBWildcard && WCCmp(DBWildcard, lowercasename))
&& (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) {
hContact_temp = hContact;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 8a10cecca7..ab36e0d46e 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -71,9 +71,9 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) wchar_t temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
- mir_sntprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
+ mir_snwprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
- mir_sntprintf(temp2, L"PING %u", time(0));
+ mir_snwprintf(temp2, L"PING %u", time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -261,7 +261,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di) bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
wchar_t szResponse[100];
- mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
+ mir_snwprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
}
@@ -277,7 +277,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) {
- mir_tstrncpy(host, word.c_str(), _countof(host));
+ mir_wstrncpy(host, word.c_str(), _countof(host));
wchar_t* p1 = wcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -497,7 +497,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if (strchr(sUserModes.c_str(), (char)*p1)) {
CMString sStatus = ModeToStatus(*p1);
if ((int)pmsg->parameters.getCount() > iParametercount) {
- if (!mir_tstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
+ if (!mir_wstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
char cModeBit = -1;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, false, false, 0);
switch (*p1) {
@@ -532,7 +532,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) if (m_oldStyleModes) {
wchar_t temp[256];
- mir_sntprintf(temp, TranslateT("%s sets mode %s"),
+ mir_snwprintf(temp, TranslateT("%s sets mode %s"),
pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
@@ -546,7 +546,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) sParams += L" " + pmsg->parameters[i];
wchar_t temp[4000];
- mir_sntprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
+ mir_snwprintf(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);
}
@@ -555,7 +555,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) }
else {
wchar_t temp[256];
- mir_sntprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
+ mir_snwprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
@@ -661,7 +661,7 @@ bool CIrcProto::OnIrc_INVITE(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && (m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'i')))
return true;
- if (pmsg->m_bIncoming && m_joinOnInvite && pmsg->parameters.getCount() > 1 && mir_tstrcmpi(pmsg->parameters[0].c_str(), m_info.sNick.c_str()) == 0)
+ if (pmsg->m_bIncoming && m_joinOnInvite && pmsg->parameters.getCount() > 1 && mir_wstrcmpi(pmsg->parameters[0].c_str(), m_info.sNick.c_str()) == 0)
PostIrcMessage(L"/JOIN %s", pmsg->parameters[1].c_str());
ShowMessage(pmsg);
@@ -672,7 +672,7 @@ bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg) {
if (pmsg->m_bIncoming && pmsg->sCommand == L"PING") {
wchar_t szResponse[100];
- mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
+ mir_snwprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -743,7 +743,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // exploit???
if (mess.Find(1) != -1 || mess.Find(L"%newl") != -1) {
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());
+ mir_snwprintf(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;
}
@@ -801,7 +801,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001FINGER %s (%s)\001", pmsg->prefix.sNick.c_str(), m_name, m_userID);
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -810,7 +810,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _A2W(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -819,7 +819,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001SOURCE Get Miranda IRC here: http://miranda-ng.org/ \001", pmsg->prefix.sNick.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -828,7 +828,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001USERINFO %s\001", pmsg->prefix.sNick.c_str(), m_userInfo);
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -837,7 +837,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) PostIrcMessage(L"/NOTICE %s \001%s\001", pmsg->prefix.sNick.c_str(), mess.c_str());
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -845,10 +845,10 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) else if (pmsg->m_bIncoming && command == L"time") {
wchar_t temp[300];
time_t tim = time(NULL);
- mir_tstrncpy(temp, _wctime(&tim), 25);
+ mir_wstrncpy(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());
+ mir_snwprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -1016,16 +1016,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (bIsChat && !m_DCCChatEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
else if (type == L"send" && !m_DCCFileEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: File transfer request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: File transfer request from %s denied"), pmsg->prefix.sNick.c_str());
else if (type == L"send" && !iPort && ulAdr == 0)
- mir_sntprintf(szTemp, TranslateT("DCC: Reverse file transfer request from %s denied [No local IP]"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: Reverse file transfer request from %s denied [No local IP]"), pmsg->prefix.sNick.c_str());
if (sFile.IsEmpty() || dwAdr == 0 || dwSize == 0 || iPort == 0 && sToken.IsEmpty())
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
@@ -1044,10 +1044,10 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) szTemp[0] = '\0';
if (type == L"resume" && !m_DCCFileEnabled)
- mir_sntprintf(szTemp, TranslateT("DCC: File transfer resume request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC: File transfer resume request from %s denied"), pmsg->prefix.sNick.c_str());
if (sToken.IsEmpty() && iPort == 0 || sFile.IsEmpty())
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Malformed CTCP request from %s [%s]"), pmsg->prefix.sNick.c_str(), mess.c_str());
if (szTemp[0]) {
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
@@ -1079,7 +1079,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
else {
wchar_t szTemp[512];
- mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(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);
}
}
@@ -1176,7 +1176,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
else if (pmsg->m_bIncoming) {
wchar_t temp[300];
- mir_sntprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(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);
}
}
@@ -1197,7 +1197,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
if (m_whoisDlg && IsWindowVisible(m_whoisDlg->GetHwnd())) {
m_whoisDlg->m_InfoNick.GetText(szTemp, _countof(szTemp));
- if (mir_tstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
+ if (mir_wstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
if (pmsg->m_bIncoming && (command == L"version" || command == L"userinfo" || command == L"time")) {
SetActiveWindow(m_whoisDlg->GetHwnd());
m_whoisDlg->m_Reply.SetText(DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE));
@@ -1208,9 +1208,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) 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);
+ mir_snwprintf(szTmp, TranslateT("%u second"), s);
else
- mir_sntprintf(szTmp, TranslateT("%u seconds"), s);
+ mir_snwprintf(szTmp, TranslateT("%u seconds"), s);
m_whoisDlg->m_Reply.SetText(DoColorCodes(szTmp, TRUE, FALSE));
return true;
@@ -1221,11 +1221,11 @@ 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)_wtol(GetWordAddress(mess.c_str(), 1));
- mir_sntprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
+ mir_snwprintf(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);
}
else {
- mir_sntprintf(szTemp, TranslateT("CTCP %s reply from %s: %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str(), GetWordAddress(mess.c_str(), 1));
+ mir_snwprintf(szTemp, TranslateT("CTCP %s reply from %s: %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str(), GetWordAddress(mess.c_str(), 1));
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
}
@@ -1257,7 +1257,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) while (wcschr(sUserModePrefixes.c_str(), name[index]))
index++;
- if (!mir_tstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
+ if (!mir_wstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
bFlag = true;
break;
}
@@ -1316,7 +1316,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) gce.ptszUID = sTemp.c_str();
gce.ptszNick = sTemp.c_str();
gce.ptszStatus = sStat.c_str();
- BOOL bIsMe = (!mir_tstrcmpi(gce.ptszNick, m_info.sNick.c_str())) ? TRUE : FALSE;
+ BOOL bIsMe = (!mir_wstrcmpi(gce.ptszNick, m_info.sNick.c_str())) ? TRUE : FALSE;
if (bIsMe) {
char BitNr = -1;
switch (sTemp2[0]) {
@@ -1364,7 +1364,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) wi->codepage = getCodepage();
DoEvent(GC_EVENT_SETITEMDATA, sChanName, NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
- if (!sTopic.IsEmpty() && !mir_tstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
+ if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? NULL : sTopicName.c_str(), GetWordAddress(sTopic.c_str(), 1), NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
AddWindowItemData(sChanName, 0, 0, 0, GetWordAddress(sTopic.c_str(), 1));
sTopic = L"";
@@ -1396,7 +1396,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) k++;
if (!command.IsEmpty()) {
CMString S = command.Mid(1);
- if (!mir_tstrcmpi(sChanName, S))
+ if (!mir_wstrcmpi(sChanName, S))
break;
save += command + L" ";
@@ -1514,13 +1514,13 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) lvItem.pszText = (wchar_t*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
ListView_SetItem(hListView, &lvItem);
- wchar_t* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
+ wchar_t* temp = mir_wstrdup(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 = wcsstr(temp, L"]");
- if (mir_tstrlen(temp) > 1) {
+ if (mir_wstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
lvItem.iSubItem = 2;
@@ -1545,9 +1545,9 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) wchar_t text[100];
if (percent < 100)
- mir_sntprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
+ mir_snwprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
else
- mir_sntprintf(text, TranslateT("Downloading list - %u channels"), m_channelNumber);
+ mir_snwprintf(text, TranslateT("Downloading list - %u channels"), m_channelNumber);
m_listDlg->m_status.SetText(text);
}
@@ -1565,13 +1565,13 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg) m_listDlg->UpdateList();
wchar_t text[100];
- mir_sntprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
+ mir_snwprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
int percent = 100;
if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
if (percent < 70) {
- mir_tstrcat(text, L" ");
- mir_tstrcat(text, TranslateT("(probably truncated by server)"));
+ mir_wstrcat(text, L" ");
+ mir_wstrcat(text, TranslateT("(probably truncated by server)"));
}
SetDlgItemText(m_listDlg->GetHwnd(), IDC_TEXT, text);
}
@@ -1678,8 +1678,8 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
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());
+ mir_wstrcat(temp, L"%s\r\n");
+ mir_snwprintf(temp2, temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
ShowMessage(pmsg);
@@ -1715,13 +1715,13 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) wchar_t temp[100];
if (D)
- mir_sntprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
+ mir_snwprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
else if (H)
- mir_sntprintf(temp, TranslateT("%uh, %um, %us"), H, M, S);
+ mir_snwprintf(temp, TranslateT("%uh, %um, %us"), H, M, S);
else if (M)
- mir_sntprintf(temp, TranslateT("%um, %us"), M, S);
+ mir_snwprintf(temp, TranslateT("%um, %us"), M, S);
else if (S)
- mir_sntprintf(temp, TranslateT("%us"), S);
+ mir_snwprintf(temp, TranslateT("%us"), S);
else
temp[0] = 0;
@@ -1729,7 +1729,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg) 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);
+ mir_snwprintf(temp3, TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
ShowMessage(pmsg);
@@ -1813,9 +1813,9 @@ static void __stdcall sttShowNickWnd(void* param) 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))) {
+ if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_wstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
wchar_t m[200];
- mir_sntprintf(m, L"NICK %s", m_alternativeNick);
+ mir_snwprintf(m, L"NICK %s", m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
}
@@ -1943,20 +1943,20 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) }
/// if it is not a channel
- ptrT UserList(mir_tstrdup(m_whoReply.c_str()));
+ ptrW UserList(mir_wstrdup(m_whoReply.c_str()));
const wchar_t* p1 = UserList;
m_whoReply = L"";
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) {
- ptrT DBHost(getTStringA(hContact, "UHost"));
- ptrT DBNick(getTStringA(hContact, "Nick"));
- ptrT DBUser(getTStringA(hContact, "UUser"));
- ptrT DBDefault(getTStringA(hContact, "Default"));
- ptrT DBManUser(getTStringA(hContact, "User"));
- ptrT DBManHost(getTStringA(hContact, "Host"));
- ptrT DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBHost(getTStringA(hContact, "UHost"));
+ ptrW DBNick(getTStringA(hContact, "Nick"));
+ ptrW DBUser(getTStringA(hContact, "UUser"));
+ ptrW DBDefault(getTStringA(hContact, "Default"));
+ ptrW DBManUser(getTStringA(hContact, "User"));
+ ptrW DBManHost(getTStringA(hContact, "Host"));
+ ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
@@ -1969,18 +1969,18 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) nick = GetWord(p1, 0);
user = GetWord(p1, 1);
host = GetWord(p1, 2);
- if ((DBWildcard && WCCmp(DBWildcard, nick.c_str()) || DBNick && !mir_tstrcmpi(DBNick, nick.c_str()) || DBDefault && !mir_tstrcmpi(DBDefault, nick.c_str()))
+ if ((DBWildcard && WCCmp(DBWildcard, nick.c_str()) || DBNick && !mir_wstrcmpi(DBNick, nick.c_str()) || DBDefault && !mir_wstrcmpi(DBDefault, nick.c_str()))
&& (WCCmp(DBUser, user.c_str()) && WCCmp(DBHost, host.c_str()))) {
if (away[0] == 'G' && getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_AWAY)
setWord(hContact, "Status", ID_STATUS_AWAY);
else if (away[0] == 'H' && getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
- if ((DBNick && mir_tstrcmpi(nick.c_str(), DBNick)) || !DBNick)
+ if ((DBNick && mir_wstrcmpi(nick.c_str(), DBNick)) || !DBNick)
setTString(hContact, "Nick", nick.c_str());
- if ((DBManUser && mir_tstrcmpi(user.c_str(), DBManUser)) || !DBManUser)
+ if ((DBManUser && mir_wstrcmpi(user.c_str(), DBManUser)) || !DBManUser)
setTString(hContact, "User", user.c_str());
- if ((DBManHost && mir_tstrcmpi(host.c_str(), DBManHost)) || !DBManHost)
+ if ((DBManHost && mir_wstrcmpi(host.c_str(), DBManHost)) || !DBManHost)
setTString(hContact, "Host", host.c_str());
return true;
}
@@ -2016,9 +2016,9 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) CMString command = PeekAtReasons(2);
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) {
+ if (mir_wstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
wchar_t host[1024];
- mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
+ mir_wstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
}
@@ -2076,7 +2076,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) if (sTemp.IsEmpty())
break;
- wchar_t *p1 = mir_tstrdup(sTemp.c_str());
+ wchar_t *p1 = mir_wstrdup(sTemp.c_str());
// Pull out host, user and nick
wchar_t *p2 = wcschr(p1, '@');
@@ -2119,7 +2119,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) // If user found, remove from checklist
for (int i = 0; i < checklist.getCount(); i++)
- if (!mir_tstrcmpi(checklist[i].c_str(), nick.c_str()))
+ if (!mir_wstrcmpi(checklist[i].c_str(), nick.c_str()))
checklist.remove(i);
}
}
@@ -2203,17 +2203,17 @@ 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++) {
- wchar_t* temp = mir_tstrdup(pmsg->parameters[i].c_str());
+ wchar_t* temp = mir_wstrdup(pmsg->parameters[i].c_str());
if (wcsstr(temp, L"CHANTYPES=")) {
wchar_t* p1 = wcschr(temp, '=');
p1++;
- if (mir_tstrlen(p1) > 0)
+ if (mir_wstrlen(p1) > 0)
sChannelPrefixes = p1;
}
if (wcsstr(temp, L"CHANMODES=")) {
wchar_t* p1 = wcschr(temp, '=');
p1++;
- if (mir_tstrlen(p1) > 0)
+ if (mir_wstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
if (wcsstr(temp, L"PREFIX=")) {
@@ -2414,12 +2414,12 @@ int CIrcProto::IsIgnored(CMString user, char type) for (int i = 0; i < m_ignoreItems.getCount(); i++) {
const CIrcIgnoreItem& C = m_ignoreItems[i];
- if (type == 0 && !mir_tstrcmpi(user.c_str(), C.mask.c_str()))
+ if (type == 0 && !mir_wstrcmpi(user.c_str(), C.mask.c_str()))
return i + 1;
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())) {
+ bUserContainsWild && !mir_wstrcmpi(user.c_str(), C.mask.c_str())) {
if (C.flags.IsEmpty() || C.flags[0] != '+')
continue;
@@ -2429,7 +2429,7 @@ int CIrcProto::IsIgnored(CMString user, char type) if (C.network.IsEmpty())
return i + 1;
- if (IsConnected() && !mir_tstrcmpi(C.network.c_str(), m_info.sNetwork.c_str()))
+ if (IsConnected() && !mir_wstrcmpi(C.network.c_str(), m_info.sNetwork.c_str()))
return i + 1;
}
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index aef90b870e..c8deea034a 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CIrcProto::FormatMsg(CMString& text)
{
wchar_t temp[30];
- mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_wstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString S = L"";
@@ -89,16 +89,16 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) Messageout += L"\r\n";
wchar_t* line = new wchar_t[p2 - p1 + 1];
- mir_tstrncpy(line, p1, p2 - p1 + 1);
+ mir_wstrncpy(line, p1, p2 - p1 + 1);
wchar_t* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
- mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
+ mir_wstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
line = new wchar_t[S.GetLength() + 2];
- mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
+ mir_wstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
if (p3 != alias.c_str()) {
@@ -121,7 +121,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) wchar_t buf[5];
for (int index = 1; index < 8; index++) {
- mir_sntprintf(buf, L"#$%u", index);
+ mir_snwprintf(buf, L"#$%u", index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
str.Replace(buf, GetWord(line, index).c_str());
else {
@@ -131,11 +131,11 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) }
}
for (int index2 = 1; index2 < 8; index2++) {
- mir_sntprintf(buf, L"$%u-", index2);
+ mir_snwprintf(buf, L"$%u-", index2);
str.Replace(buf, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
- mir_sntprintf(buf, L"$%u", index3);
+ mir_snwprintf(buf, L"$%u", index3);
str.Replace(buf, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(str.c_str(), 1);
@@ -245,7 +245,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon else
S = MakeWndID(one.c_str());
}
- else if (mir_tstrcmpi(window, SERVERWINDOW) == 0)
+ else if (mir_wstrcmpi(window, SERVERWINDOW) == 0)
S = window;
else
S = MakeWndID(window);
@@ -267,12 +267,12 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
m_ignore = 1;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
m_ignore = 0;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
@@ -304,7 +304,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon AddIgnore(one.c_str(), IgnoreFlags.c_str(), szNetwork.c_str());
- mir_sntprintf(temp, TranslateT("%s on %s is now ignored (+%s)"), one.c_str(), szNetwork.c_str(), IgnoreFlags.c_str());
+ mir_snwprintf(temp, TranslateT("%s on %s is now ignored (+%s)"), one.c_str(), szNetwork.c_str(), IgnoreFlags.c_str());
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
return true;
@@ -316,9 +316,9 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon wchar_t temp[500];
if (RemoveIgnore(one.c_str()))
- mir_sntprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
+ mir_snwprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
else
- mir_sntprintf(temp, TranslateT("%s was not ignored"), one.c_str());
+ mir_snwprintf(temp, TranslateT("%s was not ignored"), one.c_str());
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
return true;
}
@@ -369,7 +369,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
- mir_sntprintf(szTemp, L"users: %u", gci.iCount);
+ mir_snwprintf(szTemp, L"users: %u", gci.iCount);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
return true;
@@ -379,12 +379,12 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty())
return true;
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
bEcho = TRUE;
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are shown"), NULL, NULL, NULL, true, false);
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Outgoing commands are not shown"), NULL, NULL, NULL, true, false);
bEcho = FALSE;
}
@@ -400,17 +400,17 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!mir_tstrcmpi(one.c_str(), L"on")) {
+ if (!mir_wstrcmpi(one.c_str(), L"on")) {
bTempForceCheck = true;
bTempDisableCheck = false;
CallFunctionAsync(sttSetTimerOn, this);
}
- if (!mir_tstrcmpi(one.c_str(), L"off")) {
+ if (!mir_wstrcmpi(one.c_str(), L"off")) {
bTempForceCheck = false;
bTempDisableCheck = true;
CallFunctionAsync(sttSetTimerOff, this);
}
- if (!mir_tstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
+ if (!mir_wstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
m_iTempCheckTime = _wtoi(two.c_str());
if (m_iTempCheckTime < 10 && m_iTempCheckTime != 0)
m_iTempCheckTime = 10;
@@ -419,7 +419,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon 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 {
wchar_t temp[200];
- mir_sntprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
+ mir_snwprintf(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 +507,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true;
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
}
@@ -537,7 +537,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true;
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
@@ -572,7 +572,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (!two.IsEmpty()) {
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
}
return true;
@@ -590,16 +590,16 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
// if it is not dcc or if it is dcc and a local ip exist
- if (mir_tstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
- if (mir_tstrcmpi(two.c_str(), L"ping") == 0)
- mir_sntprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
+ if (mir_wstrcmpi(two.c_str(), L"dcc") != 0 || ulAdr) {
+ if (mir_wstrcmpi(two.c_str(), L"ping") == 0)
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s %u\001", one.c_str(), two.c_str(), time(0));
else
- mir_sntprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
+ mir_snwprintf(szTemp, L"/PRIVMSG %s \001%s\001", one.c_str(), GetWordAddress(text.c_str(), 2));
PostIrcMessageWnd(window, hContact, szTemp);
}
- if (mir_tstrcmpi(two.c_str(), L"dcc") != 0) {
- mir_sntprintf(szTemp, TranslateT("CTCP %s request sent to %s"), two.c_str(), one.c_str());
+ if (mir_wstrcmpi(two.c_str(), L"dcc") != 0) {
+ mir_snwprintf(szTemp, TranslateT("CTCP %s request sent to %s"), two.c_str(), one.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
@@ -610,7 +610,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty() || two.IsEmpty())
return true;
- if (mir_tstrcmpi(one.c_str(), L"send") == 0) {
+ if (mir_wstrcmpi(one.c_str(), L"send") == 0) {
wchar_t szTemp[1000];
unsigned long ulAdr = 0;
@@ -654,13 +654,13 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon }
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
return true;
}
- if (mir_tstrcmpi(one.c_str(), L"chat") == 0) {
+ if (mir_wstrcmpi(one.c_str(), L"chat") == 0) {
wchar_t szTemp[1000];
unsigned long ulAdr = 0;
@@ -693,16 +693,16 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (iPort != 0) {
PostIrcMessage(L"/CTCP %s DCC CHAT chat %u %u", two.c_str(), ulAdr, iPort);
- mir_sntprintf(szTemp, TranslateT("DCC CHAT request sent to %s"), two.c_str(), one.c_str());
+ mir_snwprintf(szTemp, TranslateT("DCC CHAT request sent to %s"), two.c_str(), one.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to bind port"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to bind port"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
}
else {
- mir_sntprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
+ mir_snwprintf(szTemp, TranslateT("DCC ERROR: Unable to automatically resolve external IP"));
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
}
@@ -717,7 +717,7 @@ struct DoInputRequestParam {
DoInputRequestParam(CIrcProto* _pro, const wchar_t* _str) :
ppro(_pro),
- str(mir_tstrdup(_str))
+ str(mir_wstrdup(_str))
{}
CIrcProto *ppro;
@@ -786,13 +786,13 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) bool CIrcProto::PostIrcMessage(const wchar_t* fmt, ...)
{
- if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
+ if (!fmt || mir_wstrlen(fmt) < 1 || mir_wstrlen(fmt) > 4000)
return 0;
va_list marker;
va_start(marker, fmt);
static wchar_t szBuf[4 * 1024];
- mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
+ mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
@@ -807,19 +807,19 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (hContact)
bDCC = getByte(hContact, "DCC", 0);
- if (!IsConnected() && !bDCC || !szBuf || mir_tstrlen(szBuf) < 1)
+ if (!IsConnected() && !bDCC || !szBuf || mir_wstrlen(szBuf) < 1)
return 0;
if (hContact && !getTString(hContact, "Nick", &dbv)) {
- mir_tstrncpy(windowname, dbv.ptszVal, 255);
+ mir_wstrncpy(windowname, dbv.ptszVal, 255);
db_free(&dbv);
}
else if (window)
- mir_tstrncpy(windowname, window, 255);
+ mir_wstrncpy(windowname, window, 255);
else
- mir_tstrncpy(windowname, SERVERWINDOW, 255);
+ mir_wstrncpy(windowname, SERVERWINDOW, 255);
- if (mir_tstrcmpi(window, SERVERWINDOW) != 0) {
+ if (mir_wstrcmpi(window, SERVERWINDOW) != 0) {
wchar_t* p1 = wcschr(windowname, ' ');
if (p1)
*p1 = '\0';
@@ -878,7 +878,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha ((GetWord(DoThis.c_str(), 0)[0] == '/') && (GetWord(DoThis.c_str(), 0)[1] == '/')) || // or double backslash at the beginning
hContact) {
CMString S = L"/PRIVMSG ";
- if (mir_tstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
+ if (mir_wstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
S += m_info.sServerName + L" " + DoThis;
else
S += CMString(windowname) + L" " + DoThis;
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 3828a45f5f..ab4430ad42 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -29,7 +29,7 @@ int CDccSession::nDcc = 0; static int CompareHandlers( const CIrcHandler* p1, const CIrcHandler* p2 ) { - return mir_tstrcmp( p1->m_name, p2->m_name ); + return mir_wstrcmp( p1->m_name, p2->m_name ); } OBJLIST<CIrcHandler> CIrcProto::m_handlers( 30, CompareHandlers ); @@ -174,7 +174,7 @@ void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp) cp = getCodepage(); if (this) { - char* str = mir_t2a_cp(msg, cp); + char* str = mir_u2a_cp(msg, cp); rtrim(str); int cbLen = (int)mir_strlen(str); str = (char*)mir_realloc(str, cbLen + 3); @@ -201,7 +201,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon); if (con == NULL) { wchar_t szTemp[300]; - mir_sntprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).", + mir_snwprintf(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); return false; @@ -289,10 +289,10 @@ int CIrcProto::NLSend(const wchar_t* fmt, ...) va_start(marker, fmt); wchar_t szBuf[1024 * 4]; - mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker); + mir_vsnwprintf(szBuf, _countof(szBuf), fmt, marker); va_end(marker); - char* buf = mir_t2a_cp(szBuf, getCodepage()); + char* buf = mir_u2a_cp(szBuf, getCodepage()); int result = NLSend((unsigned char*)buf, (int)mir_strlen(buf)); mir_free(buf); return result; @@ -344,9 +344,9 @@ void CIrcProto::createMessageFromPchar(const char* p) wchar_t* ptszMsg; if (codepage != CP_UTF8 && m_utfAutodetect) { if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == NULL) - ptszMsg = mir_a2t_cp(p, codepage); + ptszMsg = mir_a2u_cp(p, codepage); } - else ptszMsg = mir_a2t_cp(p, codepage); + else ptszMsg = mir_a2u_cp(p, codepage); CIrcMessage msg(this, ptszMsg, codepage, true); Notify(&msg); mir_free(ptszMsg); @@ -526,7 +526,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam CDccSession* p = m_dcc_xfers[i]; DBVARIANT dbv; if (!getTString(p->di->hContact, "Nick", &dbv)) { - if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_tstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { + if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_wstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { db_free(&dbv); return p; } diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index dc17feab0a..2d3b16f50f 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -181,7 +181,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(name, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -189,7 +189,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) char szTemp2[256];
mir_snprintf(szTemp2, "%s DCC", m_szModuleName);
nlu.szSettingsModule = szTemp2;
- mir_sntprintf(name, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -219,7 +219,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
wchar_t szTemp[MAX_PATH];
- mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
+ mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszPerformData = IrcLoadFile(szLoadFileName);
if (pszPerformData != NULL) {
@@ -273,16 +273,16 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) if (m_nick[0]) {
wchar_t szBuf[40];
- if (mir_tstrlen(m_alternativeNick) == 0) {
- mir_sntprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
+ if (mir_wstrlen(m_alternativeNick) == 0) {
+ mir_snwprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
- mir_tstrncpy(m_alternativeNick, szBuf, 30);
+ mir_wstrncpy(m_alternativeNick, szBuf, 30);
}
- if (mir_tstrlen(m_name) == 0) {
- mir_sntprintf(szBuf, L"Miranda%u", rand() % 9999);
+ if (mir_wstrlen(m_name) == 0) {
+ mir_snwprintf(szBuf, L"Miranda%u", rand() % 9999);
setTString("Name", szBuf);
- mir_tstrncpy(m_name, szBuf, 200);
+ mir_wstrncpy(m_name, szBuf, 200);
}
}
@@ -298,7 +298,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) return 0;
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);
+ id = psr->flags & PSR_UNICODE ? mir_wstrdup((wchar_t*)id) : mir_a2u((char*)id);
CONTACT user = { id, NULL, NULL, true, false, false };
MCONTACT hContact = CList_AddContact(&user, true, false);
@@ -497,7 +497,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId) if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
szId && szId[0] && !IsChannel(szId)) {
AckBasicSearchParam* param = new AckBasicSearchParam;
- mir_tstrncpy(param->buf, szId, 50);
+ mir_wstrncpy(param->buf, szId, 50);
ForkThread(&CIrcProto::AckBasicSearch, param);
return (HANDLE)1;
}
@@ -592,13 +592,13 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** PostIrcMessage(L"/CTCP %s DCC SEND %s 200 0 %I64u %u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), dci->dwSize, dcc->iToken);
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("DCC reversed file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
if (m_sendNotice) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
L"/NOTICE %s I am sending the file '\002%s\002' (%I64u kB) to you, please accept it. [Reverse transfer]",
dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024);
PostIrcMessage(szTemp);
@@ -611,13 +611,13 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** PostIrcMessage(L"/CTCP %s DCC SEND %s %u %u %I64u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), ulAdr, iPort, dci->dwSize);
- mir_sntprintf(szTemp,
+ mir_snwprintf(szTemp,
TranslateT("DCC file transfer request sent to %s [%s]"),
dci->sContactName.c_str(), sFileCorrect.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
if (m_sendNotice) {
- mir_sntprintf(szTemp,
+ mir_snwprintf(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, (wchar_t*)_A2T(ConvertIntegerToIP(ulAdr)));
PostIrcMessage(szTemp);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 3dee470d0d..9102b14c3a 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -62,11 +62,11 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) case DBVT_TCHAR:
if (!getTString(p->name, &dbv)) {
if (p->size != -1) {
- size_t len = min(p->size - 1, mir_tstrlen(dbv.ptszVal));
+ size_t len = min(p->size - 1, mir_wstrlen(dbv.ptszVal));
memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t));
*(wchar_t*)&ptr[len*sizeof(wchar_t)] = 0;
}
- else *(wchar_t**)ptr = mir_tstrdup(dbv.ptszVal);
+ else *(wchar_t**)ptr = mir_wstrdup(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((wchar_t*)ptr, p->defStr, (int)p->size);
+ mir_wstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
}
- else *(wchar_t**)ptr = mir_tstrdup(p->defStr);
+ else *(wchar_t**)ptr = mir_wstrdup(p->defStr);
}
break;
} } }
@@ -177,7 +177,7 @@ static void removeSpaces(wchar_t* p) {
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(wchar_t)*mir_tstrlen(p));
+ memmove(p, p + 1, sizeof(wchar_t)*mir_wstrlen(p));
p++;
}
}
@@ -602,7 +602,7 @@ void CConnectPrefsDlg::OnDeleteServer(CCtrlButton*) SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
wchar_t temp[200];
- mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (wchar_t*)_A2T(pData->m_name));
+ mir_snwprintf(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);
@@ -828,7 +828,7 @@ void CCtcpPrefsDlg::OnInitDialog() m_combo.AddStringA("8192");
wchar_t szTemp[10];
- mir_sntprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
+ mir_snwprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
int i = m_combo.SelectString(szTemp);
if (i == CB_ERR)
m_combo.SelectString(L"4096");
@@ -1282,7 +1282,7 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam hwndDlg->m_list.GetItem(&lvm);
if (temp1[0] && temp2[0])
- return mir_tstrcmpi(temp1, temp2);
+ return mir_wstrcmpi(temp1, temp2);
return (temp1[0] == 0) ? 1 : -1;
}
@@ -1316,7 +1316,7 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, void CIrcProto::InitIgnore(void)
{
wchar_t szTemp[MAX_PATH];
- mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
+ mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
if (pszIgnoreData != NULL) {
@@ -1701,7 +1701,7 @@ void CIrcProto::InitPrefs(void) m_mySpecifiedHostIP[0] = 0;
if (m_alias == NULL)
- m_alias = mir_tstrdup(L"/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout");
+ m_alias = mir_wstrdup(L"/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout");
m_quickComboSelection = getDword("QuickComboSelection", m_serverComboSelection + 1);
m_myHost[0] = '\0';
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index 711b164e22..eacf4c785b 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -28,7 +28,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) {
wchar_t temp[200]; *temp = '\0';
- mir_sntprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
+ mir_snwprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
sMessage = temp;
for (int i = 0; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += pmsg->parameters[i];
@@ -40,7 +40,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) if (pmsg->sCommand == L"INVITE" && pmsg->parameters.getCount() > 1) {
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());
+ mir_snwprintf(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++) {
sMessage += L": " + pmsg->parameters[i];
@@ -53,7 +53,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg) int index = _wtoi(pmsg->sCommand.c_str());
if (index == 301 && pmsg->parameters.getCount() > 0) {
wchar_t temp[500]; *temp = '\0';
- mir_sntprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
+ mir_snwprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += L": " + pmsg->parameters[i];
@@ -89,14 +89,14 @@ static CMString FormatOutput(const CIrcMessage* pmsg) tempstr.Delete(0, 1);
tempstr.Delete(tempstr.GetLength() - 1, 1);
CMString type = GetWord(tempstr.c_str(), 0);
- if (mir_tstrcmpi(type.c_str(), L"ping") == 0)
- mir_sntprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str());
+ if (mir_wstrcmpi(type.c_str(), L"ping") == 0)
+ mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str());
else
- mir_sntprintf(temp, TranslateT("CTCP %s reply sent to %s: %s"), type.c_str(), pmsg->parameters[0].c_str(), GetWordAddress(tempstr.c_str(), 1));
+ mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s: %s"), type.c_str(), pmsg->parameters[0].c_str(), GetWordAddress(tempstr.c_str(), 1));
sMessage = temp;
}
else {
- mir_sntprintf(temp, TranslateT("Notice to %s: "), pmsg->parameters[0].c_str());
+ mir_snwprintf(temp, TranslateT("Notice to %s: "), pmsg->parameters[0].c_str());
sMessage = temp;
for (int i = 1; i < (int)pmsg->parameters.getCount(); i++) {
sMessage += pmsg->parameters[i];
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 1620b46e24..9813630002 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()) {
- wchar_t* p = mir_a2t(pszRaw);
+ wchar_t* p = mir_a2u(pszRaw);
InsertIncomingEvent(p);
mir_free(p);
return 0;
@@ -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);
- wchar_t* p = mir_a2t(sString.Mid(i + 1));
+ wchar_t* p = mir_a2u(sString.Mid(i + 1));
sChannel = p;
mir_free(p);
}
@@ -149,7 +149,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
wchar_t szTemp[40];
- mir_sntprintf(szTemp, L"%u", gci.iCount);
+ mir_snwprintf(szTemp, L"%u", gci.iCount);
sOutput = szTemp;
}
}
@@ -173,7 +173,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszModule = m_szModuleName;
gci.iItem = j;
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- if (mir_tstrcmpi(gci.pszID, SERVERWINDOW)) {
+ if (mir_wstrcmpi(gci.pszID, SERVERWINDOW)) {
CMString S1 = gci.pszID;
int k = S1.Find(L" ");
if (k != -1)
@@ -190,7 +190,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) }
// send it to mbot
if (!sOutput.IsEmpty())
- return (INT_PTR)mir_t2a(sOutput.c_str());
+ return (INT_PTR)mir_u2a(sOutput.c_str());
}
return 0;
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 2f7e814455..a05b6d0b17 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -182,7 +182,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) dlg->Show();
HWND hWnd = dlg->GetHwnd();
wchar_t szTemp[500];
- mir_sntprintf(szTemp, TranslateT("%s (%s) is requesting a client-to-client chat connection."),
+ mir_snwprintf(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);
ShowWindow(hWnd, SW_SHOW);
@@ -404,61 +404,61 @@ static void DoChatFormatting(wchar_t* pszText) switch (p1[1]) {
case 'B':
case 'b':
- mir_tstrcpy(InsertThis, L"\002");
+ mir_wstrcpy(InsertThis, L"\002");
iRemoveChars = 2;
break;
case 'I':
case 'i':
- mir_tstrcpy(InsertThis, L"\026");
+ mir_wstrcpy(InsertThis, L"\026");
iRemoveChars = 2;
break;
case 'U':
case 'u':
- mir_tstrcpy(InsertThis, L"\037");
+ mir_wstrcpy(InsertThis, L"\037");
iRemoveChars = 2;
break;
case 'c':
{
- mir_tstrcpy(InsertThis, L"\003");
+ mir_wstrcpy(InsertThis, L"\003");
iRemoveChars = 2;
wchar_t szTemp[3];
- mir_tstrncpy(szTemp, p1 + 2, 3);
+ mir_wstrncpy(szTemp, p1 + 2, 3);
iFG = _wtoi(szTemp);
}
break;
case 'C':
if (p1[2] == '%' && p1[3] == 'F') {
- mir_tstrcpy(InsertThis, L"\x0399,99");
+ mir_wstrcpy(InsertThis, L"\x0399,99");
iRemoveChars = 4;
}
else {
- mir_tstrcpy(InsertThis, L"\x0399");
+ mir_wstrcpy(InsertThis, L"\x0399");
iRemoveChars = 2;
}
iFG = -1;
break;
case 'f':
if (p1 - 3 >= pszText && p1[-3] == '\003')
- mir_tstrcpy(InsertThis, L",");
+ mir_wstrcpy(InsertThis, L",");
else if (iFG >= 0)
- mir_sntprintf(InsertThis, L"\x03%u,", iFG);
+ mir_snwprintf(InsertThis, L"\x03%u,", iFG);
else
- mir_tstrcpy(InsertThis, L"\x0399,");
+ mir_wstrcpy(InsertThis, L"\x0399,");
iRemoveChars = 2;
break;
case 'F':
if (iFG >= 0)
- mir_sntprintf(InsertThis, L"\x03%u,99", iFG);
+ mir_snwprintf(InsertThis, L"\x03%u,99", iFG);
else
- mir_tstrcpy(InsertThis, L"\x0399,99");
+ mir_wstrcpy(InsertThis, L"\x0399,99");
iRemoveChars = 2;
break;
case '%':
- mir_tstrcpy(InsertThis, L"%");
+ mir_wstrcpy(InsertThis, L"%");
iRemoveChars = 2;
break;
@@ -467,10 +467,10 @@ static void DoChatFormatting(wchar_t* pszText) break;
}
- 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);
+ memmove(p1 + mir_wstrlen(InsertThis), p1 + iRemoveChars, sizeof(wchar_t)*(mir_wstrlen(p1) - iRemoveChars + 1));
+ memcpy(p1, InsertThis, sizeof(wchar_t)*mir_wstrlen(InsertThis));
+ if (iRemoveChars || mir_wstrlen(InsertThis))
+ p1 += mir_wstrlen(InsertThis);
else
p1++;
}
@@ -488,7 +488,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) // handle the hook
if (gch) {
if (!mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) {
- wchar_t *p1 = mir_tstrdup(gch->pDest->ptszID);
+ wchar_t *p1 = mir_wstrdup(gch->pDest->ptszID);
wchar_t *p2 = wcsstr(p1, L" - ");
if (p2)
*p2 = '\0';
@@ -500,8 +500,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- wchar_t* pszText = new wchar_t[mir_tstrlen(gch->ptszText) + 1000];
- mir_tstrcpy(pszText, gch->ptszText);
+ wchar_t* pszText = new wchar_t[mir_wstrlen(gch->ptszText) + 1000];
+ mir_wstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
delete[]pszText;
@@ -515,7 +515,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
wchar_t szTemp[4000];
- mir_sntprintf(szTemp, L"/QUERY %s", gch->ptszUID);
+ mir_snwprintf(szTemp, L"/QUERY %s", gch->ptszUID);
PostIrcMessageWnd(p1, NULL, szTemp);
}
break;
@@ -835,7 +835,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) if (gcmi) {
if (!mir_strcmpi(gcmi->pszModule, m_szModuleName)) {
if (gcmi->Type == MENU_ON_LOG) {
- if (mir_tstrcmpi(gcmi->pszID, SERVERWINDOW)) {
+ if (mir_wstrcmpi(gcmi->pszID, SERVERWINDOW)) {
gcmi->nItems = _countof(logItems);
gcmi->Item = logItems;
}
@@ -860,8 +860,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) 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);
+ size_t len = min(((temp == NULL) ? mir_wstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
+ mir_wstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
@@ -1056,7 +1056,7 @@ void CIrcProto::ConnectToServer(void) InterlockedIncrement((long *)&m_bConnectRequested);
wchar_t szTemp[300];
- mir_sntprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
+ mir_snwprintf(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);
}
@@ -1082,5 +1082,5 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) const wchar_t* p = m_statusMessage.c_str();
- return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(p) : (INT_PTR)mir_t2a(p);
+ return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(p) : (INT_PTR)mir_u2a(p);
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 6a2af3446e..4869720b3f 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -84,7 +84,7 @@ CMString __stdcall GetWord(const wchar_t* text, int index) const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index)
{
- if (!text || !mir_tstrlen(text))
+ if (!text || !mir_wstrlen(text))
return text;
const wchar_t* temp = text;
@@ -141,7 +141,7 @@ char* __stdcall IrcLoadFile(wchar_t* szPath) int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string)
{
- if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
+ if (wild == NULL || !mir_wstrlen(wild) || string == NULL || !mir_wstrlen(string))
return 1;
const wchar_t *cp = NULL, *mp = NULL;
@@ -309,10 +309,10 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP // fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- mir_tstrncpy(buf, text, 3);
+ mir_wstrncpy(buf, text, 3);
else
- mir_tstrncpy(buf, text, 2);
- text += mir_tstrlen(buf);
+ mir_wstrncpy(buf, text, 2);
+ text += mir_wstrlen(buf);
iFG = _wtoi(buf);
// fix background color
@@ -320,10 +320,10 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP text++;
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- mir_tstrncpy(buf, text, 3);
+ mir_wstrncpy(buf, text, 3);
else
- mir_tstrncpy(buf, text, 2);
- text += mir_tstrlen(buf);
+ mir_wstrncpy(buf, text, 2);
+ text += mir_wstrlen(buf);
iBG = _wtoi(buf);
}
}
@@ -342,7 +342,7 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP *p++ = '%';
*p++ = 'c';
- mir_sntprintf(buf, L"%02u", iFG);
+ mir_snwprintf(buf, L"%02u", iFG);
for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
@@ -355,7 +355,7 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP *p++ = '%';
*p++ = 'f';
- mir_sntprintf(buf, L"%02u", iBG);
+ mir_snwprintf(buf, L"%02u", iBG);
for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
@@ -400,7 +400,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* }
if (pszWindow) {
- if (mir_tstrcmpi(pszWindow, SERVERWINDOW))
+ if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
sID = pszWindow + (CMString)L" - " + m_info.sNetwork;
else
sID = pszWindow;
@@ -548,7 +548,7 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi) CMString CIrcProto::MakeWndID(const wchar_t* sWindow)
{
wchar_t buf[200];
- mir_sntprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
+ mir_snwprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
return CMString(buf);
}
@@ -575,20 +575,20 @@ bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, cons CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_tstrlen(pszLimit) + 1));
- mir_tstrcpy(wi->pszLimit, pszLimit);
+ wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_wstrlen(pszLimit) + 1));
+ mir_wstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_tstrlen(pszMode) + 1));
- mir_tstrcpy(wi->pszMode, pszMode);
+ wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_wstrlen(pszMode) + 1));
+ mir_wstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_tstrlen(pszPassword) + 1));
- mir_tstrcpy(wi->pszPassword, pszPassword);
+ wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_wstrlen(pszPassword) + 1));
+ mir_wstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_tstrlen(pszTopic) + 1));
- mir_tstrcpy(wi->pszTopic, pszTopic);
+ wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_wstrlen(pszTopic) + 1));
+ mir_wstrcpy(wi->pszTopic, pszTopic);
}
SetChannelSBText(window, wi);
@@ -628,7 +628,7 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman va_list ap;
va_start(ap, userhostparams);
- mir_vsntprintf(temp, _countof(temp), (S + L" " + userhostparams).c_str(), ap);
+ mir_vsnwprintf(temp, _countof(temp), (S + L" " + userhostparams).c_str(), ap);
va_end(ap);
// Add reason
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 6237ceaa31..0079e410e0 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -117,7 +117,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM S += L" (";
S += dbv.ptszVal;
S += L")";
- if ((mir_tstrlen(temp) < 4 && mir_tstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
+ if ((mir_wstrlen(temp) < 4 && mir_wstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
db_free(&dbv);
return FALSE;
@@ -126,7 +126,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM }
GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
@@ -135,13 +135,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp));
- if (mir_tstrlen(GetWord(temp, 0).c_str()))
+ if (mir_wstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index de14672a0a..494000553c 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -278,10 +278,10 @@ void CListDlg::OnInitDialog() lvC.cx = COLUMNS_SIZES[index];
switch (index) {
- case 0: mir_tstrcpy(szBuffer, TranslateT("Channel")); break;
- case 1: mir_tstrcpy(szBuffer, L"#"); break;
- case 2: mir_tstrcpy(szBuffer, TranslateT("Mode")); break;
- case 3: mir_tstrcpy(szBuffer, TranslateT("Topic")); break;
+ case 0: mir_wstrcpy(szBuffer, TranslateT("Channel")); break;
+ case 1: mir_wstrcpy(szBuffer, L"#"); break;
+ case 2: mir_wstrcpy(szBuffer, TranslateT("Mode")); break;
+ case 3: mir_wstrcpy(szBuffer, TranslateT("Topic")); break;
}
lvC.pszText = szBuffer;
m_list.InsertColumn(index, &lvC);
@@ -376,13 +376,13 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ShowWindow(m_list.GetHwnd(), SW_HIDE);
// New dialog title
- mir_sntprintf(newTitle, TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
+ mir_snwprintf(newTitle, TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
SetWindowText(m_hwnd, newTitle);
}
else {
ShowWindow(m_list.GetHwnd(), SW_SHOW);
ShowWindow(m_list2.GetHwnd(), SW_HIDE);
- mir_sntprintf(newTitle, TranslateT("Channels on server"));
+ mir_snwprintf(newTitle, TranslateT("Channels on server"));
SetWindowText(m_hwnd, newTitle);
}
}
@@ -429,8 +429,8 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo lvm.pszText = temp2;
param->pList->GetItem(&lvm);
if (param->iSubItem != 1) {
- if (mir_tstrlen(temp1) != 0 && mir_tstrlen(temp2) != 0)
- return mir_tstrcmpi(temp1, temp2);
+ if (mir_wstrlen(temp1) != 0 && mir_wstrlen(temp2) != 0)
+ return mir_wstrcmpi(temp1, temp2);
return (*temp1 == 0) ? 1 : -1;
}
@@ -633,7 +633,7 @@ void CQuickDlg::OnOk(CCtrlButton*) wchar_t windowname[20];
GetWindowText(m_hwnd, windowname, _countof(windowname));
- if (mir_tstrcmpi(windowname, L"Miranda IRC") == 0) {
+ if (mir_wstrcmpi(windowname, L"Miranda IRC") == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
m_proto->setDword("ServerComboSelection", m_proto->m_serverComboSelection);
m_proto->setString("ServerName", m_proto->m_serverName);
@@ -923,8 +923,8 @@ void CManagerDlg::OnClose() }
if (!S.IsEmpty() && m_proto->IsConnected()) {
- mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
- char* p = mir_t2a(temp);
+ mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
+ char* p = mir_u2a(temp);
m_proto->setTString(p, S.c_str());
mir_free(p);
}
@@ -942,16 +942,16 @@ void CManagerDlg::OnAdd(CCtrlButton*) wchar_t temp[100];
wchar_t mode[3];
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"+b");
- mir_tstrncpy(temp, TranslateT("Add ban"), 100);
+ mir_wstrcpy(mode, L"+b");
+ mir_wstrncpy(temp, TranslateT("Add ban"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"+I");
- mir_tstrncpy(temp, TranslateT("Add invite"), 100);
+ mir_wstrcpy(mode, L"+I");
+ mir_wstrncpy(temp, TranslateT("Add invite"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"+e");
- mir_tstrncpy(temp, TranslateT("Add exception"), 100);
+ mir_wstrcpy(mode, L"+e");
+ mir_wstrncpy(temp, TranslateT("Add exception"), 100);
}
m_add.Disable();
@@ -967,7 +967,7 @@ void CManagerDlg::OnAdd(CCtrlButton*) 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");
+ mir_snwprintf(temp2, L"/MODE %s %s %s", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -984,16 +984,16 @@ void CManagerDlg::OnEdit(CCtrlButton*) wchar_t temp[100];
wchar_t mode[3];
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"b");
- mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
+ mir_wstrcpy(mode, L"b");
+ mir_wstrncpy(temp, TranslateT("Edit ban"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"I");
- mir_tstrncpy(temp, TranslateT("Edit invite?"), 100);
+ mir_wstrcpy(mode, L"I");
+ mir_wstrncpy(temp, TranslateT("Edit invite?"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"e");
- mir_tstrncpy(temp, TranslateT("Edit exception?"), 100);
+ mir_wstrcpy(mode, L"e");
+ mir_wstrncpy(temp, TranslateT("Edit exception?"), 100);
}
CQuestionDlg* dlg = new CQuestionDlg(m_proto, this);
@@ -1010,7 +1010,7 @@ void CManagerDlg::OnEdit(CCtrlButton*) 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");
+ mir_snwprintf(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);
dlg->Activate();
}
@@ -1030,16 +1030,16 @@ void CManagerDlg::OnRemove(CCtrlButton*) CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
- mir_tstrcpy(mode, L"-b");
- mir_tstrncpy(temp, TranslateT("Remove ban?"), 100);
+ mir_wstrcpy(mode, L"-b");
+ mir_wstrncpy(temp, TranslateT("Remove ban?"), 100);
}
if (m_radio2.GetState()) {
- mir_tstrcpy(mode, L"-I");
- mir_tstrncpy(temp, TranslateT("Remove invite?"), 100);
+ mir_wstrcpy(mode, L"-I");
+ mir_wstrncpy(temp, TranslateT("Remove invite?"), 100);
}
if (m_radio3.GetState()) {
- mir_tstrcpy(mode, L"-e");
- mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
+ mir_wstrcpy(mode, L"-e");
+ mir_wstrncpy(temp, TranslateT("Remove exception?"), 100);
}
wchar_t window[256];
@@ -1087,58 +1087,58 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) CMString appendixremove = L"";
if (wi->pszMode && wcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
- mir_tstrcat(toremove, L"t");
+ mir_wstrcat(toremove, L"t");
}
else if (m_check1.GetState())
- mir_tstrcat(toadd, L"t");
+ mir_wstrcat(toadd, L"t");
if (wi->pszMode && wcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
- mir_tstrcat(toremove, L"n");
+ mir_wstrcat(toremove, L"n");
}
else if (m_check2.GetState())
- mir_tstrcat(toadd, L"n");
+ mir_wstrcat(toadd, L"n");
if (wi->pszMode && wcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
- mir_tstrcat(toremove, L"i");
+ mir_wstrcat(toremove, L"i");
}
else if (m_check3.GetState())
- mir_tstrcat(toadd, L"i");
+ mir_wstrcat(toadd, L"i");
if (wi->pszMode && wcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
- mir_tstrcat(toremove, L"m");
+ mir_wstrcat(toremove, L"m");
}
else if (m_check4.GetState())
- mir_tstrcat(toadd, L"m");
+ mir_wstrcat(toadd, L"m");
if (wi->pszMode && wcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
- mir_tstrcat(toremove, L"p");
+ mir_wstrcat(toremove, L"p");
}
else if (m_check7.GetState())
- mir_tstrcat(toadd, L"p");
+ mir_wstrcat(toadd, L"p");
if (wi->pszMode && wcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
- mir_tstrcat(toremove, L"s");
+ mir_wstrcat(toremove, L"s");
}
else if (m_check8.GetState())
- mir_tstrcat(toadd, L"s");
+ mir_wstrcat(toadd, L"s");
if (wi->pszMode && wcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
- mir_tstrcat(toremove, L"c");
+ mir_wstrcat(toremove, L"c");
}
else if (m_check9.GetState())
- mir_tstrcat(toadd, L"c");
+ mir_wstrcat(toadd, L"c");
CMString Key = L"";
CMString Limit = L"";
if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
- mir_tstrcat(toremove, L"k");
+ mir_wstrcat(toremove, L"k");
appendixremove += L" " + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
@@ -1146,15 +1146,15 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) m_key.GetText(temp, 14);
if (Key != temp) {
- mir_tstrcat(toremove, L"k");
- mir_tstrcat(toadd, L"k");
+ mir_wstrcat(toremove, L"k");
+ mir_wstrcat(toadd, L"k");
appendixadd += L" " + CMString(temp);
appendixremove += L" " + CMString(wi->pszPassword);
}
}
}
else if (m_check5.GetState() && GetWindowTextLength(m_key.GetHwnd())) {
- mir_tstrcat(toadd, L"k");
+ mir_wstrcat(toadd, L"k");
appendixadd += L" ";
wchar_t temp[400];
@@ -1164,18 +1164,18 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (wcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
- mir_tstrcat(toremove, L"l");
+ mir_wstrcat(toremove, L"l");
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
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");
+ if (wi->pszLimit && mir_wstrcmpi(wi->pszLimit, temp)) {
+ mir_wstrcat(toadd, L"l");
appendixadd += L" " + CMString(temp);
}
}
}
else if (m_check6.GetState() && GetWindowTextLength(m_limit.GetHwnd())) {
- mir_tstrcat(toadd, L"l");
+ mir_wstrcat(toadd, L"l");
appendixadd += L" ";
wchar_t temp[15];
@@ -1183,19 +1183,19 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) appendixadd += temp;
}
- if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
+ if (mir_wstrlen(toadd) || mir_wstrlen(toremove)) {
wchar_t temp[500];
- mir_tstrcpy(temp, L"/mode ");
- mir_tstrcat(temp, window);
- mir_tstrcat(temp, L" ");
- if (mir_tstrlen(toremove))
- mir_sntprintf(temp, L"%s-%s", temp, toremove);
- if (mir_tstrlen(toadd))
- mir_sntprintf(temp, L"%s+%s", temp, toadd);
+ mir_wstrcpy(temp, L"/mode ");
+ mir_wstrcat(temp, window);
+ mir_wstrcat(temp, L" ");
+ if (mir_wstrlen(toremove))
+ mir_snwprintf(temp, L"%s-%s", temp, toremove);
+ if (mir_wstrlen(toadd))
+ mir_snwprintf(temp, L"%s+%s", temp, toadd);
if (!appendixremove.IsEmpty())
- mir_tstrcat(temp, appendixremove.c_str());
+ mir_wstrcat(temp, appendixremove.c_str());
if (!appendixadd.IsEmpty())
- mir_tstrcat(temp, appendixadd.c_str());
+ mir_wstrcat(temp, appendixadd.c_str());
m_proto->PostIrcMessage(temp);
}
}
@@ -1246,11 +1246,11 @@ void CManagerDlg::ApplyQuestion() GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
wchar_t mode[3];
- mir_tstrcpy(mode, L"+b");
+ mir_wstrcpy(mode, L"+b");
if (m_radio2.GetState())
- mir_tstrcpy(mode, L"+I");
+ mir_wstrcpy(mode, L"+I");
if (m_radio3.GetState())
- mir_tstrcpy(mode, L"+e");
+ mir_wstrcpy(mode, L"+e");
m_list.ResetContent();
m_radio1.Disable();
m_radio2.Disable();
@@ -1278,9 +1278,9 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) if (wi) {
if (m_proto->IsConnected()) {
wchar_t temp[1000];
- mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
+ mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
- char* p = mir_t2a(temp);
+ char* p = mir_u2a(temp);
DBVARIANT dbv;
if (!m_proto->getTString(p, &dbv)) {
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index 9a99841d22..cf1a1a8f1c 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -465,7 +465,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
wchar_t buf[MAX_PATH];
- mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
+ mir_snwprintf(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/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 4a86609b9e..f78ba6541c 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);
- wchar_t *tszNote = mir_utf8decodeT(szStatusNote);
+ wchar_t *tszNote = mir_utf8decodeW(szStatusNote);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
mir_free(tszNote);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 3d03ed6f43..c2cc01818e 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -76,7 +76,7 @@ void CIcqProto::GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest, size_t cbLen)
{
wchar_t szPath[MAX_PATH * 2];
- mir_sntprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(szPath, L"%s\\%S\\", VARST(L"%miranda_avatarcache%"), m_szModuleName);
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = _countof(szPath);
@@ -84,8 +84,8 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest fgd.flags = FF_TCHAR;
// fill the destination
- mir_tstrncpy(pszDest, szPath, cbLen - 1);
- size_t tPathLen = mir_tstrlen(pszDest);
+ mir_wstrncpy(pszDest, szPath, cbLen - 1);
+ size_t tPathLen = mir_wstrlen(pszDest);
// make sure the avatar cache directory exists
CreateDirectoryTreeT(szPath);
@@ -93,21 +93,21 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest if (dwUin != 0)
_ltow(dwUin, pszDest + tPathLen, 10);
else if (szUid) {
- wchar_t* p = mir_a2t(szUid);
- mir_tstrcpy(pszDest + tPathLen, p);
+ wchar_t* p = mir_a2u(szUid);
+ mir_wstrcpy(pszDest + tPathLen, p);
mir_free(p);
}
else {
wchar_t szBuf[MAX_PATH];
if (CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)szBuf))
- mir_tstrcpy(pszDest + tPathLen, L"avatar");
+ mir_wstrcpy(pszDest + tPathLen, L"avatar");
else {
wchar_t *szLastDot = wcsrchr(szBuf, '.');
if (szLastDot)
szLastDot[0] = '\0';
- mir_tstrcpy(pszDest + tPathLen, szBuf);
- mir_tstrcat(pszDest + tPathLen, L"_avt");
+ mir_wstrcpy(pszDest + tPathLen, szBuf);
+ mir_wstrcat(pszDest + tPathLen, L"_avt");
}
}
}
@@ -115,7 +115,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, wchar_t *pszDest void AddAvatarExt(int dwFormat, wchar_t *pszDest)
{
const wchar_t *ext = ProtoGetAvatarExtension(dwFormat);
- mir_tstrcat(pszDest, (*ext == 0) ? L".dat" : ext);
+ mir_wstrcat(pszDest, (*ext == 0) ? L".dat" : ext);
}
#define MD5_BLOCK_SIZE 1024*1024 /* use 1MB blocks */
@@ -1159,7 +1159,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- mir_tstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
+ mir_wstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
@@ -1212,11 +1212,11 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen const wchar_t *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
wchar_t tszImageFile[MAX_PATH];
- mir_sntprintf(tszImageFile, L"%s%s", pCookieData->szFile, ptszExt);
+ mir_snwprintf(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));
+ mir_wstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
int out = _wopen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
if (out != -1) {
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index e993445c08..93382f6b04 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -152,13 +152,13 @@ void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD ft->bEmptyDesc = bEmptyDesc;
// Send chain event
- wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeW(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(hContact, &pre);
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 7843f50a10..0c755f0d79 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -158,7 +158,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : // Register netlib users
NETLIBUSER nlu = { 0 };
wchar_t szBuffer[MAX_PATH + 64];
- mir_sntprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName);
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
@@ -173,7 +173,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : char szP2PModuleName[MAX_PATH];
mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName);
- mir_sntprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
nlu.szSettingsModule = szP2PModuleName;
@@ -1644,7 +1644,7 @@ void __cdecl CIcqProto::GetAwayMsgThread(void *pStatusData) setStatusMsgVar(pThreadData->hContact, pThreadData->szMessage, false);
- wchar_t *tszMsg = mir_utf8decodeT(pThreadData->szMessage);
+ wchar_t *tszMsg = mir_utf8decodeW(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);
- wchar_t* pszMsg = mir_utf8decodeT(evt->szMessage);
+ wchar_t* pszMsg = mir_utf8decodeW(evt->szMessage);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)pszMsg);
mir_free(pszMsg);
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 4c91d239ac..856c8327c9 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -1386,7 +1386,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) break;
// we have found the group
- if (!mir_tstrcmp(tszGroup, tszGroupName))
+ if (!mir_wstrcmp(tszGroup, tszGroupName))
return i;
}
@@ -1396,7 +1396,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) int CIcqProto::moveContactToCListGroup(MCONTACT hContact, const char *szGroup)
{
- MGROUP hGroup = Clist_GroupCreate(0, ptrT(mir_utf8decodeT(szGroup)));
+ MGROUP hGroup = Clist_GroupCreate(0, ptrW(mir_utf8decodeW(szGroup)));
return CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, hGroup);
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index ecc192ac4d..52f532436f 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -125,15 +125,15 @@ static HANDLE LoadXStatusIconLibrary(wchar_t *path, const wchar_t *sub) wchar_t* p = wcsrchr(path, '\\');
HANDLE hLib;
- mir_tstrcpy(p, sub);
- mir_tstrcat(p, L"\\xstatus_ICQ.dll");
+ mir_wstrcpy(p, sub);
+ mir_wstrcat(p, L"\\xstatus_ICQ.dll");
if (hLib = LoadLibrary(path))
return hLib;
- mir_tstrcpy(p, sub);
- mir_tstrcat(p, L"\\xstatus_icons.dll");
+ mir_wstrcpy(p, sub);
+ mir_wstrcat(p, L"\\xstatus_icons.dll");
if (hLib = LoadLibrary(path))
return hLib;
- mir_tstrcpy(p, L"\\");
+ mir_wstrcpy(p, L"\\");
return hLib;
}
@@ -852,7 +852,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) HGENMENU hRoot;
{
wchar_t szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName);
+ mir_snwprintf(szItem, TranslateT("%s Custom Status"), m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index a2c40d3b83..d8e50a1837 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -352,7 +352,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2);
- mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
+ mir_wstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
pai->format = dwPaFormat;
if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same
@@ -370,7 +370,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2);
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
- mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
+ mir_wstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
db_free(&dbv);
@@ -501,7 +501,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) GetFullAvatarFileName(0, NULL, dwPaFormat, tszMyFile, MAX_PATH);
// if not in our storage, copy
- if (mir_tstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
+ if (mir_wstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
debugLogA("Failed to copy our avatar to local storage.");
return -1;
}
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 253bb1b843..8d37efc053 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DWORD dwUin = ppro->getContactUin(NULL);
wchar_t pszUIN[MAX_PATH];
- mir_sntprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
+ mir_snwprintf(pszUIN, TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index be3dae1b0d..fdfa9da536 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -497,13 +497,13 @@ 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);
- wchar_t* ptszFileName = mir_utf8decodeT(pszFileName);
+ wchar_t* ptszFileName = mir_utf8decodeW(pszFileName);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = mir_utf8decodeT(pszDescription);
+ pre.descr.w = mir_utf8decodeW(pszDescription);
pre.files.w = &ptszFileName;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->hContact, &pre);
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 207ff0fe32..25ba1d7e98 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -279,7 +279,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if (!lParam) {
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("%s Details"), m_tszUserName);
+ mir_snwprintf(buf, TranslateT("%s Details"), m_tszUserName);
odp.pwszTitle = buf;
odp.position = -1899999999;
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 75c4f3dfab..c074e502ef 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -75,7 +75,7 @@ bool bSecureIM, bMirOTR, bNewGPG, bPlatform; // Protocol instances
static int sttCompareProtocols(const CJabberProto *p1, const CJabberProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
LIST<CJabberProto> g_Instances(1, sttCompareProtocols);
@@ -135,7 +135,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- mir_tstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
+ mir_wstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE);
@@ -195,7 +195,7 @@ extern "C" int __declspec(dllexport) Load() WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, L"%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
+ mir_snwprintf(szCoreVersion, L"%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
@@ -235,13 +235,13 @@ extern "C" int __declspec(dllexport) Unload(void) if (g_nTempFileId != 0) {
wchar_t tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
- mir_sntprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath);
+ mir_snwprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath);
WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile(tszFilePath, &findData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(tszFilePath, L"%s%s", tszTempPath, findData.cFileName);
+ mir_snwprintf(tszFilePath, L"%s%s", tszTempPath, findData.cFileName);
DeleteFile(tszFilePath);
} while (FindNextFile(hFind, &findData));
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index ea2d3c6748..e29f3fde4e 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -143,7 +143,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe {
int nodeIdx = 0;
const wchar_t * type = XmlGetAttrValue(iqNode, L"type");
- if (!type || !mir_tstrcmp(type, L"error")) {
+ if (!type || !mir_wstrcmp(type, L"error")) {
// error occurred here
wchar_t buff[255];
const wchar_t *code = NULL;
@@ -154,10 +154,10 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe code = XmlGetAttrValue(errorNode, L"code");
description = XmlGetText(errorNode);
}
- mir_sntprintf(buff, TranslateT("Error %s %s"), (code) ? code : L"", (description) ? description : L"");
+ mir_snwprintf(buff, TranslateT("Error %s %s"), (code) ? code : L"", (description) ? description : L"");
JabberFormSetInstruction(hwndDlg, buff);
}
- else if (!mir_tstrcmp(type, L"result")) {
+ else if (!mir_wstrcmp(type, L"result")) {
BOOL validResponse = FALSE;
EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), sttDeleteChildWindowsProc, 0);
dat->CurrentHeight = 0;
@@ -167,7 +167,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe if (queryNode) {
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))
+ if (xmlns && node && !mir_wstrcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_wstrcmp(node, JABBER_FEAT_COMMANDS))
validResponse = TRUE;
}
if (queryNode && XmlGetChild(queryNode, 0) && validResponse) {
@@ -213,7 +213,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA const wchar_t *type;
if ((type = XmlGetAttrValue(workNode, L"type")) == NULL) return TRUE;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
// wParam = <iq/> node from responder as a result of command execution
HXML commandNode, xNode;
if ((commandNode = XmlGetChild(dat->AdHocNode, L"command")) == NULL)
@@ -264,12 +264,12 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA EnableDlgItem(hwndDlg, IDC_SUBMIT, TRUE);
}
- if (!status || mir_tstrcmp(status, L"executing")) {
+ if (!status || mir_wstrcmp(status, L"executing")) {
ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_HIDE);
SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Done"));
}
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
// error occurred here
int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0};
sttShowControls(hwndDlg, FALSE, toHide);
@@ -282,7 +282,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA code = XmlGetAttrValue(errorNode, L"code");
description = XmlGetText(errorNode);
}
- mir_sntprintf(buff, TranslateT("Error %s %s"), code ? code : L"", description ? description : L"");
+ mir_snwprintf(buff, TranslateT("Error %s %s"), code ? code : L"", description ? description : L"");
JabberFormSetInstruction(hwndDlg,buff);
}
JabberAdHoc_RefreshFrameScroll(hwndDlg, dat);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat = (JabberAdHocData*)mir_calloc(sizeof(JabberAdHocData));
{
CJabberAdhocStartupParams* pStartupParams = (CJabberAdhocStartupParams *)lParam;
- dat->ResponderJID = mir_tstrdup(pStartupParams->m_szJid);
+ dat->ResponderJID = mir_wstrdup(pStartupParams->m_szJid);
dat->proto = pStartupParams->m_pProto;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
wchar_t Caption[512];
- mir_sntprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_snwprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
wchar_t Caption[512];
- mir_sntprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_snwprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -513,7 +513,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) int res = -1;
if ((hContact != NULL || lParam != 0) && m_bJabberOnline) {
- ptrT szJid(getTStringA(hContact, "jid"));
+ ptrW szJid(getTStringA(hContact, "jid"));
if (hContact && szJid != NULL) {
JABBER_LIST_ITEM *item = NULL;
int selected = 0;
@@ -541,8 +541,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (selected > 0) {
JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- mir_tstrncat(jid, L"/", _countof(jid) - mir_tstrlen(jid));
- mir_tstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_tstrlen(jid));
+ mir_wstrncat(jid, L"/", _countof(jid) - mir_wstrlen(jid));
+ mir_wstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_wstrlen(jid));
}
selected = 1;
}
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index a09ad50983..2e8654f265 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -169,13 +169,13 @@ public: break;
if (XmlGetName(n)) {
- if (!mir_tstrcmp(XmlGetName(n), L"instructions")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"instructions")) {
JabberFormSetInstruction(m_hwnd, XmlGetText(n));
}
- else if (!mir_tstrcmp(XmlGetName(n), L"key") || !mir_tstrcmp(XmlGetName(n), L"registered")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"key") || !mir_wstrcmp(XmlGetName(n), L"registered")) {
// do nothing
}
- else if (!mir_tstrcmp(XmlGetName(n), L"password"))
+ else if (!mir_wstrcmp(XmlGetName(n), L"password"))
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_PRIVATE, XmlGetName(n), XmlGetText(n));
else // everything else is a normal text field
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_SINGLE, XmlGetName(n), XmlGetText(n));
@@ -253,14 +253,14 @@ public: break;
if (XmlGetName(n)) {
- if (!mir_tstrcmp(XmlGetName(n), L"key")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"key")) {
// field that must be passed along with the registration
if (XmlGetText(n))
XmlAddChild(query, XmlGetName(n), XmlGetText(n));
else
XmlAddChild(query, XmlGetName(n));
}
- else if (!mir_tstrcmp(XmlGetName(n), L"registered") || !mir_tstrcmp(XmlGetName(n), L"instructions")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"registered") || !mir_wstrcmp(XmlGetName(n), L"instructions")) {
// do nothing, we will skip these
}
else {
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index a144c1324d..167c518bdc 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -67,9 +67,9 @@ LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) LPCTSTR p = wcschr(jid, '/');
if (p == NULL) {
mir_cslock lck(m_csLists);
- return mir_tstrdup(ListGetBestClientResourceNamePtr(jid));
+ return mir_wstrdup(ListGetBestClientResourceNamePtr(jid));
}
- return mir_tstrdup(jid);
+ return mir_wstrdup(jid);
}
LPTSTR CJabberProto::GetResourceList(LPCTSTR jid)
@@ -94,7 +94,7 @@ LPTSTR CJabberProto::GetResourceList(LPCTSTR jid) }
res.AppendChar(0);
- return mir_tstrndup(res, res.GetLength());
+ return mir_wstrndup(res, res.GetLength());
}
char *CJabberProto::GetModuleName() const
@@ -199,7 +199,7 @@ int CJabberProto::RemoveHandler(HJHANDLER hHandler) JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
{
for (int i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
- if (!mir_tstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
+ if (!mir_wstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
return m_lstJabberFeatCapPairsDynamic[i];
return NULL;
@@ -213,7 +213,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) // check for this feature in core features, and return false if it's present, to prevent re-registering a core feature
int i;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
- if (!mir_tstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
return false;
mir_cslock lck(m_csLists);
@@ -237,7 +237,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) return false;
// remove unnecessary symbols from szFeature to make the string shorter, and use it as szExt
- LPTSTR szExt = mir_tstrdup(szFeature);
+ LPTSTR szExt = mir_wstrdup(szFeature);
LPTSTR pSrc, pDst;
for (pSrc = szExt, pDst = szExt; *pSrc; pSrc++)
if (wcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc))
@@ -247,15 +247,15 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) fcp = new JabberFeatCapPairDynamic();
fcp->szExt = szExt; // will be deallocated along with other values of JabberFeatCapPairDynamic in CJabberProto destructor
- fcp->szFeature = mir_tstrdup(szFeature);
- fcp->szDescription = szDescription ? mir_tstrdup(szDescription) : NULL;
+ fcp->szFeature = mir_wstrdup(szFeature);
+ fcp->szDescription = szDescription ? mir_wstrdup(szDescription) : NULL;
fcp->jcbCap = jcb;
m_lstJabberFeatCapPairsDynamic.insert(fcp);
}
else if (szDescription) { // update description
if (fcp->szDescription)
mir_free(fcp->szDescription);
- fcp->szDescription = mir_tstrdup(szDescription);
+ fcp->szDescription = mir_wstrdup(szDescription);
}
return true;
}
@@ -281,7 +281,7 @@ int CJabberProto::AddFeatures(LPCTSTR szFeatures) m_uEnabledFeatCapsDynamic |= fcp->jcbCap;
else
ret = false;
- szFeat += mir_tstrlen(szFeat) + 1;
+ szFeat += mir_wstrlen(szFeat) + 1;
}
lck.unlock();
@@ -306,7 +306,7 @@ int CJabberProto::RemoveFeatures(LPCTSTR szFeatures) else
ret = false; // indicate that there was an error removing at least one of the specified features
- szFeat += mir_tstrlen(szFeat) + 1;
+ szFeat += mir_wstrlen(szFeat) + 1;
}
lck.unlock();
@@ -328,25 +328,25 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) // calculate total necessary string length
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap)
- iLen += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ iLen += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap)
- iLen += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ iLen += mir_wstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
// allocate memory and fill it
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) {
- mir_tstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
- p += mir_tstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ mir_wstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
+ p += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
}
for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
if (jcb & m_lstJabberFeatCapPairsDynamic[i]->jcbCap) {
- mir_tstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
- p += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
+ mir_wstrcpy(p, m_lstJabberFeatCapPairsDynamic[i]->szFeature);
+ p += mir_wstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1;
}
*p = 0; // extra zero terminator
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index d0718ab3ca..863a19fb44 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -58,11 +58,11 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*)
{
const wchar_t *to = XmlGetAttrValue(iqNode, L"to");
- if (to == NULL || mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (to == NULL || mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
return;
HXML list = XmlGetChild(iqNode, "list");
- if (!list || mir_tstrcmp(XmlGetAttrValue(list, L"xmlns"), JABBER_FEAT_ARCHIVE))
+ if (!list || mir_wstrcmp(XmlGetAttrValue(list, L"xmlns"), JABBER_FEAT_ARCHIVE))
return;
for (int nodeIdx = 1;; nodeIdx++) {
@@ -221,11 +221,11 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*)
{
- if (mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
return;
HXML chatNode = XmlGetChild(iqNode, "chat");
- if (!chatNode || mir_tstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE))
+ if (!chatNode || mir_wstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE))
return;
const wchar_t* start = XmlGetAttrValue(chatNode, L"start");
@@ -249,9 +249,9 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) int from;
const wchar_t *itemName = XmlGetName(itemNode);
- if (!mir_tstrcmp(itemName, L"to"))
+ if (!mir_wstrcmp(itemName, L"to"))
from = DBEF_SENT;
- else if (!mir_tstrcmp(itemName, L"from"))
+ else if (!mir_wstrcmp(itemName, L"from"))
from = 0;
else
continue;
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index f7915fe86b..b1cc884948 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -47,7 +47,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM param->ppro->m_hwndJabberAddBookmark = hwndDlg;
TranslateDialogDefault(hwndDlg);
if (item = param->m_item) {
- if (!mir_tstrcmp(item->type, L"conference")) {
+ if (!mir_wstrcmp(item->type, L"conference")) {
if (!wcschr(item->jid, '@')) { //no room name - consider it is transport
CheckDlgButton(hwndDlg, IDC_AGENT_RADIO, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE);
@@ -118,18 +118,18 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM item = param->ppro->ListAdd(LIST_BOOKMARK, roomJID);
if (IsDlgButtonChecked(hwndDlg, IDC_URL_RADIO) == BST_CHECKED)
- replaceStrT(item->type, L"url");
+ replaceStrW(item->type, L"url");
else
- replaceStrT(item->type, L"conference");
+ replaceStrW(item->type, L"conference");
GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text));
- replaceStrT(item->nick, text);
+ replaceStrW(item->nick, text);
GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text));
- replaceStrT(item->password, text);
+ replaceStrW(item->password, text);
GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text));
- replaceStrT(item->name, (text[0] == 0) ? roomJID : text);
+ replaceStrW(item->name, (text[0] == 0) ? roomJID : text);
item->bAutoJoin = IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED;
@@ -329,7 +329,7 @@ void CJabberDlgBookmarks::OpenBookmark() JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
if (item == NULL) return;
- if (!mir_tstrcmpi(item->type, L"conference")) {
+ if (!mir_wstrcmpi(item->type, L"conference")) {
m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item
/* some hack for using bookmark to transport not under XEP-0048 */
@@ -344,7 +344,7 @@ void CJabberDlgBookmarks::OpenBookmark() if (item->nick && *item->nick)
m_proto->GroupchatJoinRoom(server, room, item->nick, item->password);
else
- m_proto->GroupchatJoinRoom(server, room, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)), item->password);
+ m_proto->GroupchatJoinRoom(server, room, ptrW(JabberNickFromJID(m_proto->m_szJabberJID)), item->password);
}
}
else Utils_OpenUrlT(item->jid);
@@ -391,7 +391,7 @@ void CJabberDlgBookmarks::OnProtoRefresh(WPARAM, LPARAM) LISTFOREACH(i, m_proto, LIST_BOOKMARK)
{
if (item = m_proto->ListGetItemPtrFromIndex(i)) {
- int itemType = mir_tstrcmpi(item->type, L"conference") ? 1 : 0;
+ int itemType = mir_wstrcmpi(item->type, L"conference") ? 1 : 0;
int iItem = m_lvBookmarks.AddItem(item->name, itemType, (LPARAM)item->jid, itemType);
m_lvBookmarks.SetItem(iItem, 1, item->jid);
if (itemType == 0)
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index c889f7099f..a940fee985 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -61,16 +61,16 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
+ if (queryXmlns && !mir_wstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost");
if (streamHostNode) {
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);
- jbt->szProxyPort = mir_tstrdup(streamPort);
+ jbt->szProxyHost = mir_wstrdup(streamHost);
+ jbt->szProxyJid = mir_wstrdup(streamJid);
+ jbt->szProxyPort = mir_wstrdup(streamPort);
jbt->bProxyDiscovered = TRUE;
} } } } }
else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR)
@@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, L"%u", connInfo.wPort);
+ mir_snwprintf(szPort, L"%u", connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -153,7 +153,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) BOOL bDirect = m_options.BsDirect;
if (m_options.BsProxyManual) {
- ptrT proxyJid( getTStringA("BsProxyServer"));
+ ptrW proxyJid( getTStringA("BsProxyServer"));
if (proxyJid) {
jbt->bProxyDiscovered = FALSE;
jbt->szProxyHost = NULL;
@@ -209,7 +209,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, L"%d", nlb.wPort);
+ mir_snwprintf(szPort, L"%d", nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -258,7 +258,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) return;
}
- if (jbt->bProxyDiscovered && !mir_tstrcmp(jbt->szProxyJid, jbt->szStreamhostUsed)) {
+ if (jbt->bProxyDiscovered && !mir_wstrcmp(jbt->szProxyJid, jbt->szStreamhostUsed)) {
// jabber proxy used
if (bDirect) {
SetEvent(jbt->hSendEvent);
@@ -300,12 +300,12 @@ void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo) HXML queryNode = XmlGetChild(iqNode , "query");
if (queryNode) {
const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
+ if (queryXmlns && !mir_wstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) {
HXML streamHostNode = XmlGetChild(queryNode , "streamhost-used");
if (streamHostNode) {
const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid");
if (streamJid)
- jbt->szStreamhostUsed = mir_tstrdup(streamJid);
+ jbt->szStreamhostUsed = mir_wstrdup(streamJid);
} } } }
if (jbt->hProxyEvent)
@@ -364,7 +364,7 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -407,13 +407,13 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) int id = JabberGetPacketID(iqNode);
wchar_t listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, L"ftproxy_%d", id);
+ mir_snwprintf(listJid, L"ftproxy_%d", id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
return;
- if (!mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
+ if (!mir_wstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result"))
item->jbt->bStreamActivated = TRUE;
if (item->jbt->hProxyEvent)
@@ -445,11 +445,11 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) szHost = jbt->szProxyHost;
port = (WORD)_wtoi(szPort);
- replaceStrT(jbt->streamhostJID, jbt->szProxyJid);
+ replaceStrW(jbt->streamhostJID, jbt->szProxyJid);
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
- nloc.szHost = mir_t2a(szHost);
+ nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
mir_free((void*)nloc.szHost);
@@ -513,7 +513,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID);
wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID);
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
mir_free(szInitiatorJid);
mir_free(szTargetJid);
@@ -556,7 +556,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext();
wchar_t listJid[256];
- mir_sntprintf(listJid, L"ftproxy_%d", iqId);
+ mir_snwprintf(listJid, L"ftproxy_%d", iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
@@ -612,10 +612,10 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) }
if (szId && from && to && sid && (n = XmlGetChild(queryNode, "streamhost")) != NULL) {
- jbt->iqId = mir_tstrdup(szId);
- jbt->srcJID = mir_tstrdup(from);
- jbt->dstJID = mir_tstrdup(to);
- jbt->sid = mir_tstrdup(sid);
+ jbt->iqId = mir_wstrdup(szId);
+ jbt->srcJID = mir_wstrdup(from);
+ jbt->dstJID = mir_wstrdup(to);
+ jbt->sid = mir_wstrdup(sid);
if ((buffer = (char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE))) {
for (i = 1; (n = XmlGetNthChild(queryNode, L"streamhost", i)) != NULL; i++) {
@@ -624,12 +624,12 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) (str = XmlGetAttrValue(n, L"jid")) != NULL) {
port = (WORD)_wtoi(szPort);
- replaceStrT(jbt->streamhostJID, str);
+ replaceStrW(jbt->streamhostJID, str);
debugLog(L"bytestream_recv connecting to %s:%d", szHost, port);
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
- nloc.szHost = mir_t2a(szHost);
+ nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
mir_free((void*)nloc.szHost);
@@ -707,9 +707,9 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char wchar_t text[JABBER_MAX_JID_LEN * 2];
{
- ptrT szInitiatorJid(JabberPrepareJid(jbt->srcJID));
- ptrT szTargetJid(JabberPrepareJid(jbt->dstJID));
- mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
+ ptrW szInitiatorJid(JabberPrepareJid(jbt->srcJID));
+ ptrW szTargetJid(JabberPrepareJid(jbt->dstJID));
+ mir_snwprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid);
}
T2Utf szAuthString(text);
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 275e869901..f4457137c8 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -111,22 +111,22 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo) HXML xform;
for (int i = 1; (xform = XmlGetNthChild(query, L"x", i)) != NULL; i++) {
wchar_t *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value");
- if (szFormTypeValue && !mir_tstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) {
+ if (szFormTypeValue && !mir_wstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) {
wchar_t *szTmp = XPath(xform, L"field[@var='os']/value");
if (szTmp)
- r->m_tszOs = mir_tstrdup(szTmp);
+ r->m_tszOs = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='os_version']/value");
if (szTmp)
- r->m_tszOsVersion = mir_tstrdup(szTmp);
+ r->m_tszOsVersion = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='software']/value");
if (szTmp)
- r->m_tszSoftware = mir_tstrdup(szTmp);
+ r->m_tszSoftware = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='software_version']/value");
if (szTmp)
- r->m_tszSoftwareVersion = mir_tstrdup(szTmp);
+ r->m_tszSoftwareVersion = mir_wstrdup(szTmp);
szTmp = XPath(xform, L"field[@var='x-miranda-core-version']/value");
if (szTmp)
- r->m_tszXMirandaCoreVersion = mir_tstrdup(szTmp);
+ r->m_tszXMirandaCoreVersion = mir_wstrdup(szTmp);
JabberUserInfoUpdate(pInfo->GetHContact());
}
@@ -148,7 +148,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if (!mir_tstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
jcbCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid) if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
wchar_t szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_snwprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
wchar_t queryNode[512];
- mir_sntprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_snwprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", queryNode));
bRequestSent = TRUE;
@@ -251,7 +251,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app jcbCaps |= jcbMainCaps;
if (jcbMainCaps != JABBER_RESOURCE_CAPS_TIMEOUT && r->m_tszCapsExt) {
- wchar_t *caps = mir_tstrdup(r->m_tszCapsExt);
+ wchar_t *caps = mir_wstrdup(r->m_tszCapsExt);
wchar_t *token = wcstok(caps, L" ");
while (token) {
@@ -349,17 +349,17 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app JabberCapsBits jcbMainCaps = m_clientCapsManager.GetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion);
if (jcbMainCaps == JABBER_RESOURCE_CAPS_ERROR) {
// Bombus hack:
- if (!mir_tstrcmp(r->m_tszSoftware, L"Bombus") || !mir_tstrcmp(r->m_tszSoftware, L"BombusMod")) {
+ if (!mir_wstrcmp(r->m_tszSoftware, L"Bombus") || !mir_wstrcmp(r->m_tszSoftware, L"BombusMod")) {
jcbMainCaps = JABBER_CAPS_SI | JABBER_CAPS_SI_FT | JABBER_CAPS_IBB | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY | JABBER_CAPS_DATA_FORMS | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_VERSION | JABBER_CAPS_COMMANDS | JABBER_CAPS_VCARD_TEMP;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// Neos hack:
- else if (!mir_tstrcmp(r->m_tszSoftware, L"neos")) {
+ else if (!mir_wstrcmp(r->m_tszSoftware, L"neos")) {
jcbMainCaps = JABBER_CAPS_OOB | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY | JABBER_CAPS_LAST_ACTIVITY | JABBER_CAPS_VERSION;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// sim hack:
- else if (!mir_tstrcmp(r->m_tszSoftware, L"sim")) {
+ else if (!mir_wstrcmp(r->m_tszSoftware, L"sim")) {
jcbMainCaps = JABBER_CAPS_OOB | JABBER_CAPS_VERSION | JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
@@ -390,7 +390,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL app CJabberClientPartialCaps::CJabberClientPartialCaps(const wchar_t *szVer)
{
- m_szVer = mir_tstrdup(szVer);
+ m_szVer = mir_wstrdup(szVer);
m_jcbCaps = JABBER_RESOURCE_CAPS_UNINIT;
m_pNext = NULL;
m_nIqId = -1;
@@ -437,7 +437,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const wchar_t *szVer) CJabberClientPartialCaps *pCaps = m_pCaps;
while (pCaps) {
- if (!mir_tstrcmp(szVer, pCaps->GetVersion()))
+ if (!mir_wstrcmp(szVer, pCaps->GetVersion()))
break;
pCaps = pCaps->GetNext();
}
@@ -463,7 +463,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindById(int nIqId) CJabberClientCaps::CJabberClientCaps(const wchar_t *szNode)
{
- m_szNode = mir_tstrdup(szNode);
+ m_szNode = mir_wstrdup(szNode);
m_pCaps = NULL;
m_pNext= NULL;
}
@@ -536,7 +536,7 @@ CJabberClientCaps * CJabberClientCapsManager::FindClient(const wchar_t *szNode) CJabberClientCaps *pClient = m_pClients;
while (pClient) {
- if (!mir_tstrcmp(szNode, pClient->GetNode()))
+ if (!mir_wstrcmp(szNode, pClient->GetNode()))
break;
pClient = pClient->GetNext();
}
@@ -615,8 +615,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con continue;
wchar_t szExtCap[ 512 ];
- mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
- if (!mir_tstrcmp(szNode, szExtCap)) {
+ mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ if (!mir_wstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
}
@@ -625,8 +625,8 @@ 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++) {
wchar_t szExtCap[ 512 ];
- mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
- if (!mir_tstrcmp(szNode, szExtCap)) {
+ mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ if (!mir_wstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
}
@@ -668,10 +668,10 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con if (ppro->m_options.ShowOSVersion) {
if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
- mir_tstrncpy(szOsBuffer, L"", _countof(szOsBuffer));
+ mir_wstrncpy(szOsBuffer, L"", _countof(szOsBuffer));
else {
wchar_t *szOsWindows = L"Microsoft Windows";
- size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
+ size_t nOsWindowsLength = mir_wstrlen(szOsWindows);
if (!wcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
os += nOsWindowsLength + 1;
}
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 159b9c15a0..0de9eda1bb 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -158,7 +158,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) param.w = bmp.bmWidth;
param.h = bmp.bmHeight;
int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CAPTCHAFORM), NULL, JabberCaptchaFormDlgProc, (LPARAM)¶m);
- if (mir_tstrcmp(param.Result, L"") == 0 || !res)
+ if (mir_wstrcmp(param.Result, L"") == 0 || !res)
sendCaptchaError(info, param.from, param.to, param.challenge);
else
sendCaptchaResult(param.Result, info, param.from, param.challenge, param.fromjid, param.sid);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index c260b23348..4f3cf9534c 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -126,7 +126,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) for (int i = 0; i < _countof(sttRoleItems); i++)
sttRoleItems[i].translate();
- ptrT szNick(JabberNickFromJID(item->jid));
+ ptrW szNick(JabberNickFromJID(item->jid));
GCSESSION gcw = { sizeof(GCSESSION) };
gcw.iType = GCW_CHATROOM;
@@ -141,22 +141,22 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) if (JABBER_LIST_ITEM *bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid)) {
if (bookmark->name) {
- ptrT myHandle(db_get_tsa(si->hContact, "CList", "MyHandle"));
+ ptrW myHandle(db_get_tsa(si->hContact, "CList", "MyHandle"));
if (myHandle == NULL)
db_set_ts(si->hContact, "CList", "MyHandle", bookmark->name);
}
}
- ptrT tszNick(getTStringA(si->hContact, "MyNick"));
+ ptrW tszNick(getTStringA(si->hContact, "MyNick"));
if (tszNick != NULL) {
- if (!mir_tstrcmp(tszNick, szNick))
+ if (!mir_wstrcmp(tszNick, szNick))
delSetting(si->hContact, "MyNick");
else
setTString(si->hContact, "MyNick", item->nick);
}
else setTString(si->hContact, "MyNick", item->nick);
- ptrT passw(getTStringA(si->hContact, "Password"));
+ ptrW passw(getTStringA(si->hContact, "Password"));
if (lstrcmp_null(passw, item->password)) {
if (!item->password || !item->password[0])
delSetting(si->hContact, "Password");
@@ -265,7 +265,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t szReason = TranslateT("user banned");
}
- ptrT myNick(mir_tstrdup(item->nick));
+ ptrW myNick(mir_wstrdup(item->nick));
if (myNick == NULL)
myNick = JabberNickFromJID(m_szJabberJID);
@@ -290,7 +290,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t mir_cslock lck(m_csLists);
for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *JS = item->arResources[i];
- if (!mir_tstrcmp(resource, JS->m_tszResourceName)) {
+ if (!mir_wstrcmp(resource, JS->m_tszResourceName)) {
if (action != GC_EVENT_JOIN) {
switch (action) {
case 0:
@@ -301,7 +301,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t gce.ptszText = TranslateT("Moderator");
}
gce.ptszStatus = TranslateTS(sttStatuses[JabberGcGetStatus(JS)]);
- gce.bIsMe = (mir_tstrcmp(nick, myNick) == 0);
+ gce.bIsMe = (mir_wstrcmp(nick, myNick) == 0);
statusToSet = JS->m_iStatus;
break;
}
@@ -331,14 +331,14 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) wchar_t *szMessage = NULL;
if (code != 307 && code != 301) {
- ptrT tszMessage(getTStringA("GcMsgQuit"));
+ ptrW tszMessage(getTStringA("GcMsgQuit"));
if (tszMessage != NULL)
szMessage = NEWWSTR_ALLOCA(tszMessage);
else
szMessage = TranslateTS(JABBER_GC_MSG_QUIT);
}
else {
- ptrT myNick(JabberNickFromJID(m_szJabberJID));
+ ptrW myNick(JabberNickFromJID(m_szJabberJID));
GcLogUpdateMemberStatus(item, myNick, myNick, NULL, GC_EVENT_KICK, reason);
}
@@ -353,7 +353,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) if (m_bJabberOnline) {
wchar_t szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(szPresenceTo, L"%s/%s", item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(L"presence") << XATTR(L"to", szPresenceTo) << XATTR(L"type", L"unavailable")
@@ -513,9 +513,9 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) pResourceStatus me(NULL), him(NULL);
for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *p = item->arResources[i];
- if (!mir_tstrcmp(p->m_tszResourceName, item->nick))
+ if (!mir_wstrcmp(p->m_tszResourceName, item->nick))
me = p;
- if (!mir_tstrcmp(p->m_tszResourceName, gcmi->pszUID))
+ if (!mir_wstrcmp(p->m_tszResourceName, gcmi->pszUID))
him = p;
}
@@ -537,7 +537,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) 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));
+ mir_wstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -602,7 +602,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) }
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_snwprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (wchar_t *tmp = wcschr(sttRJidBuf, '/')) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -710,7 +710,7 @@ public: m_txtReason(this, IDC_REASON),
m_clc(this, IDC_CLIST)
{
- m_room = mir_tstrdup(room);
+ m_room = mir_wstrdup(room);
m_btnAddJid.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_AddJid);
m_btnInvite.OnClick = Callback(this, &CGroupchatInviteDlg::OnCommand_Invite);
m_clc.OnNewContact =
@@ -755,17 +755,17 @@ public: int i;
for (i = 0; i < m_newJids.getCount(); i++)
- if (!mir_tstrcmp(m_newJids[i]->jid, buf))
+ if (!mir_wstrcmp(m_newJids[i]->jid, buf))
break;
if (i != m_newJids.getCount())
return;
JabberGcLogInviteDlgJidData *jidData = (JabberGcLogInviteDlgJidData *)mir_alloc(sizeof(JabberGcLogInviteDlgJidData));
- mir_tstrcpy(jidData->jid, buf);
+ mir_wstrcpy(jidData->jid, buf);
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_CHECKBOX;
- mir_sntprintf(buf, TranslateT("%s (not on roster)"), jidData->jid);
+ mir_snwprintf(buf, TranslateT("%s (not on roster)"), jidData->jid);
cii.pszText = buf;
jidData->hItem = SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETCHECKMARK, jidData->hItem, 1);
@@ -776,7 +776,7 @@ public: {
if (!m_room) return;
- ptrT text(m_txtReason.GetText());
+ ptrW text(m_txtReason.GetText());
HWND hwndList = GetDlgItem(m_hwnd, IDC_CLIST);
// invite users from roster
@@ -786,7 +786,7 @@ public: if (int hItem = SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0)) {
if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
- ptrT jid(m_proto->getTStringA(hContact, "jid"));
+ ptrW jid(m_proto->getTStringA(hContact, "jid"));
if (jid != NULL)
InviteUser(jid, text);
}
@@ -860,7 +860,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);
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid);
+ mir_snwprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf);
SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->m_tszResourceName);
@@ -1010,17 +1010,17 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* switch (gch->dwData) {
case IDM_SLAP:
if (ppro->m_bJabberOnline) {
- ptrT szMessage(ppro->getTStringA("GcMsgSlap"));
+ ptrW szMessage(ppro->getTStringA("GcMsgSlap"));
if (szMessage == NULL)
- szMessage = mir_tstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
+ szMessage = mir_wstrdup(TranslateTS(JABBER_GC_MSG_SLAP));
wchar_t buf[256];
// do not use snprintf to avoid possible problems with % symbol
if (wchar_t *p = wcsstr(szMessage, L"%s")) {
*p = 0;
- mir_sntprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
+ mir_snwprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2);
}
- else mir_tstrncpy(buf, szMessage, _countof(buf));
+ else mir_wstrncpy(buf, szMessage, _countof(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -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);
- wchar_t *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
+ wchar_t *resourceName_copy = mir_wstrdup(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)
@@ -1279,7 +1279,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer);
+ mir_snwprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer);
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, NULL);
}
}
@@ -1335,7 +1335,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g int idx = IDM_LINK0;
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);
+ char *bufPtr, *url = mir_u2a(p);
for (bufPtr = url; *bufPtr && !isspace(*bufPtr); ++bufPtr);
*bufPtr++ = 0;
Utils_OpenUrl(url);
@@ -1364,7 +1364,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const wchar_t *nick)
{
wchar_t szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, L"%s/%s", item->jid, nick);
+ mir_snwprintf(szFullJid, L"%s/%s", item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, true, false);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
@@ -1396,8 +1396,8 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText) > 0) {
- rtrimt(gch->ptszText);
+ if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
+ rtrimw(gch->ptszText);
if (m_bJabberOnline) {
wchar_t tszID[100];
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 3070d0b223..28af8638a0 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -116,9 +116,9 @@ bool CJabberProto::RecursiveCheckFilter(HXML node, DWORD flags) bool CJabberProto::FilterXml(HXML node, DWORD flags)
{
- if (!m_filterInfo.msg && !mir_tstrcmp(XmlGetName(node), L"message")) return false;
- if (!m_filterInfo.presence && !mir_tstrcmp(XmlGetName(node), L"presence")) return false;
- if (!m_filterInfo.iq && !mir_tstrcmp(XmlGetName(node), L"iq")) return false;
+ if (!m_filterInfo.msg && !mir_wstrcmp(XmlGetName(node), L"message")) return false;
+ if (!m_filterInfo.presence && !mir_wstrcmp(XmlGetName(node), L"presence")) return false;
+ if (!m_filterInfo.iq && !mir_wstrcmp(XmlGetName(node), L"iq")) return false;
if (m_filterInfo.type == TFilterInfo::T_OFF) return true;
mir_cslock lck(m_filterInfo.csPatternLock);
@@ -346,9 +346,9 @@ void CJabberDlgConsole::OnInitDialog() m_proto->m_filterInfo.type = (TFilterInfo::Type)m_proto->getByte("consoleWnd_ftype", TFilterInfo::T_OFF);
*m_proto->m_filterInfo.pattern = 0;
- ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
+ ptrW tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
+ mir_wstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern);
@@ -552,7 +552,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (len > _countof(m_proto->m_filterInfo.pattern)) {
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));
+ mir_wstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index e93545ca06..9f2d52f03e 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -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"), (wchar_t *)pInfo->m_pUserData)) {
+ if (!mir_wstrcmp(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;
@@ -402,7 +402,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) mir_cslockfull lck(m_SDManager.cs());
m_SDManager.RemoveAll();
- if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
+ if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
sttBrowseMode = SD_BROWSE_MYAGENTS;
JABBER_LIST_ITEM *item = NULL;
LISTFOREACH(i, this, LIST_ROSTER)
@@ -414,7 +414,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) setByte(hContact, "IsTransport", TRUE);
if (m_lstTransports.getIndex(item->jid) == -1)
- m_lstTransports.insert(mir_tstrdup(item->jid));
+ m_lstTransports.insert(mir_wstrdup(item->jid));
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(item->jid, NULL, NULL);
SendBothRequests(pNode, NULL);
@@ -422,9 +422,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) }
}
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
- wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2u(m_ThreadInfo->conn.server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)JABBER_FEAT_MUC;
pInfo->SetTimeout(30000);
@@ -433,9 +433,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
sttBrowseMode = SD_BROWSE_AGENTS;
- wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServerJid = mir_a2u(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);
@@ -444,27 +444,27 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
+ else if (!mir_wstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
sttBrowseMode = SD_BROWSE_FAVORITES;
int count = getDword("discoWnd_favCount", 0);
for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName(getTStringA(setting));
+ ptrW tszName(getTStringA(setting));
if (tszName == NULL)
continue;
mir_snprintf(setting, "discoWnd_favJID_%d", i);
- ptrT dbvJid(getTStringA(setting));
+ ptrW dbvJid(getTStringA(setting));
mir_snprintf(setting, "discoWnd_favNode_%d", i);
- ptrT dbvNode(getTStringA(setting));
+ ptrW dbvNode(getTStringA(setting));
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(dbvJid, dbvNode, tszName);
SendBothRequests(pNode, NULL);
}
}
else {
sttBrowseMode = SD_BROWSE_NORMAL;
- CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, mir_tstrlen(szNode) ? szNode : NULL, NULL);
+ CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(szJid, mir_wstrlen(szNode) ? szNode : NULL, NULL);
SendBothRequests(pNode, NULL);
}
lck.unlock();
@@ -518,8 +518,8 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) if (sttNodeIcons[i].category) {
CJabberSDIdentity *iIdentity;
for (iIdentity = pNode->GetFirstIdentity(); iIdentity; iIdentity = iIdentity->GetNext())
- if (!mir_tstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
- (!sttNodeIcons[i].type || !mir_tstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
+ if (!mir_wstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
+ (!sttNodeIcons[i].type || !mir_wstrcmp(iIdentity->GetType(), sttNodeIcons[i].type))) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
@@ -529,7 +529,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) if (sttNodeIcons[i].feature) {
CJabberSDFeature *iFeature;
for (iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_tstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
+ if (!mir_wstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature)) {
iIcon = sttNodeIcons[i].listIndex;
break;
}
@@ -802,7 +802,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) for (int i = 0; i < count; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favName_%d", i);
- ptrT tszName(m_proto->getTStringA(setting));
+ ptrW tszName(m_proto->getTStringA(setting));
if (tszName != NULL) {
HMENU hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_STRING, 100 + i * 10 + 0, TranslateT("Navigate"));
@@ -851,7 +851,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "discoWnd_favJID_%d", res);
- ptrT dbv(m_proto->getTStringA(setting));
+ ptrW dbv(m_proto->getTStringA(setting));
if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv);
mir_snprintf(setting, "discoWnd_favNode_%d", res);
@@ -1250,7 +1250,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM bool bFeatureOk = !bFilterItems;
if (bFilterItems)
for (CJabberSDFeature *iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if (!mir_tstrcmp(iFeature->GetVar(), items[i].feature)) {
+ if (!mir_wstrcmp(iFeature->GetVar(), items[i].feature)) {
bFeatureOk = true;
break;
}
@@ -1381,7 +1381,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM item = ListAdd(LIST_ROOM, pNode->GetJid());
if (item == NULL)
break;
- item->name = mir_tstrdup(pNode->GetName());
+ item->name = mir_wstrdup(pNode->GetName());
}
item->type = L"conference";
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index 486d4c7289..ecc55393e6 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -43,9 +43,9 @@ protected: public:
CJabberSDIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName)
{
- m_szCategory = mir_tstrdup(szCategory);
- m_szType = mir_tstrdup(szType);
- m_szName = mir_tstrdup(szName);
+ m_szCategory = mir_wstrdup(szCategory);
+ m_szType = mir_wstrdup(szType);
+ m_szName = mir_wstrdup(szName);
m_pNext = NULL;
}
~CJabberSDIdentity()
@@ -89,7 +89,7 @@ protected: public:
CJabberSDFeature(const wchar_t *szVar)
{
- m_szVar = szVar ? mir_tstrdup(szVar) : NULL;
+ m_szVar = szVar ? mir_wstrdup(szVar) : NULL;
m_pNext = NULL;
}
~CJabberSDFeature()
@@ -134,9 +134,9 @@ protected: public:
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);
- m_szName = mir_tstrdup(szName);
+ m_szJid = mir_wstrdup(szJid);
+ m_szNode = mir_wstrdup(szNode);
+ m_szName = mir_wstrdup(szName);
m_pIdentities = NULL;
m_pFeatures = NULL;
m_pNext = NULL;
@@ -155,11 +155,11 @@ public: }
BOOL RemoveAll()
{
- replaceStrT(m_szJid, NULL);
- replaceStrT(m_szNode, NULL);
- replaceStrT(m_szName, NULL);
- replaceStrT(m_szInfoError, NULL);
- replaceStrT(m_szItemsError, NULL);
+ replaceStrW(m_szJid, NULL);
+ replaceStrW(m_szNode, NULL);
+ replaceStrW(m_szName, NULL);
+ replaceStrW(m_szInfoError, NULL);
+ replaceStrW(m_szItemsError, NULL);
if (m_pIdentities)
delete m_pIdentities;
m_pIdentities = NULL;
@@ -181,8 +181,8 @@ public: }
BOOL ResetInfo()
{
- replaceStrT(m_szInfoError, NULL);
- replaceStrT(m_szItemsError, NULL);
+ replaceStrW(m_szInfoError, NULL);
+ replaceStrW(m_szItemsError, NULL);
if (m_pIdentities)
delete m_pIdentities;
m_pIdentities = NULL;
@@ -229,7 +229,7 @@ public: }
BOOL SetJid(wchar_t *szJid)
{
- replaceStrT(m_szJid, szJid);
+ replaceStrW(m_szJid, szJid);
return TRUE;
}
wchar_t *GetJid()
@@ -238,7 +238,7 @@ public: }
BOOL SetNode(wchar_t *szNode)
{
- replaceStrT(m_szNode, szNode);
+ replaceStrW(m_szNode, szNode);
return TRUE;
}
wchar_t *GetNode()
@@ -335,13 +335,13 @@ public: BOOL SetItemsRequestErrorText(wchar_t *szError)
{
- replaceStrT(m_szItemsError, szError);
+ replaceStrW(m_szItemsError, szError);
return TRUE;
}
BOOL SetInfoRequestErrorText(wchar_t *szError)
{
- replaceStrT(m_szInfoError, szError);
+ replaceStrW(m_szInfoError, szError);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 24580a5207..61aecd3a6b 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -36,7 +36,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) if (!m_bJabberOnline) // should never happen
return 0;
- ptrT jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"));
+ ptrW jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"));
if (jid == NULL)
return 0;
@@ -45,7 +45,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) wchar_t szStrippedJid[JABBER_MAX_JID_LEN];
JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
wchar_t *szDog = wcschr(szStrippedJid, '@');
- if (szDog && mir_tstrcmpi(szDog + 1, jid))
+ if (szDog && mir_wstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(L"remove"));
}
@@ -63,24 +63,24 @@ static wchar_t* sttSettingToTchar(DBCONTACTWRITESETTING *cws) {
switch (cws->value.type) {
case DBVT_ASCIIZ:
- return mir_a2t(cws->value.pszVal);
+ return mir_a2u(cws->value.pszVal);
case DBVT_UTF8:
- return mir_utf8decodeT(cws->value.pszVal);
+ return mir_utf8decodeW(cws->value.pszVal);
case DBVT_WCHAR:
- return mir_u2t(cws->value.pwszVal);
+ return mir_wstrdup(cws->value.pwszVal);
}
return NULL;
}
void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
{
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (item == NULL)
return;
- ptrT tszNick(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszNick(db_get_tsa(hContact, "CList", "MyHandle"));
if (tszNick == NULL)
tszNick = getTStringA(hContact, "Nick");
if (tszNick == NULL)
@@ -96,7 +96,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC }
else {
wchar_t *p = sttSettingToTchar(cws);
- if (cws->value.pszVal != NULL && mir_tstrcmp(p, item->group)) {
+ if (cws->value.pszVal != NULL && mir_wstrcmp(p, item->group)) {
debugLog(L"Group set to %s", p);
if (p)
AddContactToRoster(item->jid, tszNick, p);
@@ -107,7 +107,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
{
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW( getTStringA(hContact, "jid")));
if (item == NULL)
return;
@@ -118,8 +118,8 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT return;
}
- ptrT newNick( sttSettingToTchar(cws));
- if (newNick && mir_tstrcmp(item->nick, newNick)) {
+ ptrW newNick( sttSettingToTchar(cws));
+ if (newNick && mir_wstrcmp(item->nick, newNick)) {
debugLog(L"Renaming contact %s: %s -> %s", item->jid, item->nick, newNick);
AddContactToRoster(item->jid, newNick, item->group);
}
@@ -130,12 +130,12 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT if (cws->value.type != DBVT_DELETED && !(cws->value.type == DBVT_BYTE && cws->value.bVal == 0))
return;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return;
debugLog(L"Add %s permanently to list", jid);
- ptrT nick(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW nick(db_get_tsa(hContact, "CList", "MyHandle"));
if (nick == NULL)
nick = getTStringA(hContact, "Nick");
if (nick == NULL)
@@ -143,10 +143,10 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT if (nick == NULL)
return;
- AddContactToRoster(jid, nick, ptrT(db_get_tsa(hContact, "CList", "Group")));
+ AddContactToRoster(jid, nick, ptrW(db_get_tsa(hContact, "CList", "Group")));
XmlNode xPresence(L"presence"); xPresence << XATTR(L"to", LPCTSTR(jid)) << XATTR(L"type", L"subscribe");
- ptrT myNick(getTStringA(NULL, "Nick"));
+ ptrW myNick(getTStringA(NULL, "Nick"));
if (myNick != NULL)
xPresence << XCHILD(L"nick", LPCTSTR(myNick)) << XATTR(L"xmlns", JABBER_FEAT_NICK);
m_ThreadInfo->send(xPresence);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index a3e2c0776f..27eda280b2 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -118,7 +118,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) s++;
else
s = ft->httpPath;
- ft->std.tszCurrentFile = mir_tstrdup(s);
+ ft->std.tszCurrentFile = mir_wstrdup(s);
JabberHttpUrlDecode(ft->std.tszCurrentFile);
if (ft->create() == -1) {
ft->state = FT_ERROR;
@@ -179,7 +179,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
wchar_t szPort[10];
- mir_sntprintf(szPort, L"%d", connInfo.wPort);
+ mir_snwprintf(szPort, L"%d", connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -260,7 +260,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->hFileEvent = hEvent;
wchar_t szPort[20];
- mir_sntprintf(szPort, L"%d", nlb.wPort);
+ mir_snwprintf(szPort, L"%d", nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -292,9 +292,9 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) char szAddr[256];
mir_snprintf(szAddr, "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
- size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
+ size_t len = mir_wstrlen(ptszResource) + mir_wstrlen(ft->jid) + 2;
wchar_t *fulljid = (wchar_t *)alloca(sizeof(wchar_t) * len);
- mir_sntprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource);
+ mir_snwprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource);
XmlNodeIq iq(L"set", ft->szId, fulljid);
HXML query = iq << XQUERY(JABBER_FEAT_OOB);
@@ -366,7 +366,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, for (t = str + 4; *t != '\0' && *t != ' '; t++);
*t = '\0';
for (t = str + 4; *t != '\0' && *t == '/'; t++);
- ft->httpPath = mir_a2t(t);
+ ft->httpPath = mir_a2u(t);
JabberHttpUrlDecode(ft->httpPath);
ft->state = FT_INITIALIZING;
debugLogA("Change to FT_INITIALIZING");
@@ -386,7 +386,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, else
t = ft->std.ptszFiles[currentFile];
- if (ft->httpPath == NULL || mir_tstrcmp(ft->httpPath, t)) {
+ if (ft->httpPath == NULL || mir_wstrcmp(ft->httpPath, t)) {
if (ft->httpPath == NULL)
debugLogA("Requested file name does not matched (httpPath == NULL)");
else
@@ -501,8 +501,8 @@ int filetransfer::create() return fileId;
wchar_t filefull[MAX_PATH];
- mir_sntprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
- replaceStrT(std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
+ replaceStrW(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index a74abfae40..ceabe55ba9 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -110,7 +110,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) {
if (!text) text = L"";
- size_t len = mir_tstrlen(text);
+ size_t len = mir_wstrlen(text);
size_t fixedLen = len;
for (int i = 1; i < len; i++)
if ((text[i - 1] == '\n') && (text[i] != '\r'))
@@ -142,7 +142,7 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *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, (wchar_t *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
+ DrawTextEx(hdcEdit, (wchar_t *)text, (int)mir_wstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
@@ -205,19 +205,19 @@ void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) static TJabberFormControlType JabberFormTypeNameToId(const wchar_t *type)
{
- if (!mir_tstrcmp(type, L"text-private"))
+ if (!mir_wstrcmp(type, L"text-private"))
return JFORM_CTYPE_TEXT_PRIVATE;
- if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi"))
+ if (!mir_wstrcmp(type, L"text-multi") || !mir_wstrcmp(type, L"jid-multi"))
return JFORM_CTYPE_TEXT_MULTI;
- if (!mir_tstrcmp(type, L"boolean"))
+ if (!mir_wstrcmp(type, L"boolean"))
return JFORM_CTYPE_BOOLEAN;
- if (!mir_tstrcmp(type, L"list-single"))
+ if (!mir_wstrcmp(type, L"list-single"))
return JFORM_CTYPE_LIST_SINGLE;
- if (!mir_tstrcmp(type, L"list-multi"))
+ if (!mir_wstrcmp(type, L"list-multi"))
return JFORM_CTYPE_LIST_MULTI;
- if (!mir_tstrcmp(type, L"fixed"))
+ if (!mir_wstrcmp(type, L"fixed"))
return JFORM_CTYPE_FIXED;
- if (!mir_tstrcmp(type, L"hidden"))
+ if (!mir_wstrcmp(type, L"hidden"))
return JFORM_CTYPE_HIDDEN;
return JFORM_CTYPE_TEXT_SINGLE;
@@ -323,7 +323,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE,
0, 0, 0, 0,
hwndStatic, (HMENU)layout_info->id, hInst, NULL);
- if (valueStr && !mir_tstrcmp(valueStr, L"1"))
+ if (valueStr && !mir_wstrcmp(valueStr, L"1"))
SendMessage(item->hCtrl, BM_SETCHECK, 1, 0);
++layout_info->id;
break;
@@ -440,7 +440,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp wchar_t *labelStr, *valueStr;
RECT frameRect;
- if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
+ if (xNode == NULL || XmlGetName(xNode) == NULL || mir_wstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
return;
GetClientRect(hwndStatic, &frameRect);
@@ -460,7 +460,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (!n)
break;
- if (mir_tstrcmp(XmlGetName(n), L"field"))
+ if (mir_wstrcmp(XmlGetName(n), L"field"))
continue;
varStr = XmlGetAttrValue(n, L"var");
@@ -468,24 +468,24 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp continue;
if ((label = XmlGetAttrValue(n, L"label")) != NULL)
- labelStr = mir_tstrdup(label);
+ labelStr = mir_wstrdup(label);
else
- labelStr = mir_tstrdup(varStr);
+ labelStr = mir_wstrdup(varStr);
TJabberFormControlType type = JabberFormTypeNameToId(typeName);
if ((v = XmlGetChild(n, "value")) != NULL) {
valueText = XmlGetText(v);
if (type != JFORM_CTYPE_TEXT_MULTI)
- valueStr = mir_tstrdup(valueText);
+ valueStr = mir_wstrdup(valueText);
else {
size_t size = 1;
for (int j = 0;; j++) {
v = XmlGetChild(n, j);
if (!v)
break;
- if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v))
- size += mir_tstrlen(XmlGetText(v)) + 2;
+ if (XmlGetName(v) && !mir_wstrcmp(XmlGetName(v), L"value") && XmlGetText(v))
+ size += mir_wstrlen(XmlGetText(v)) + 2;
}
valueStr = (wchar_t*)mir_alloc(sizeof(wchar_t)*size);
valueStr[0] = '\0';
@@ -493,10 +493,10 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp v = XmlGetChild(n, j);
if (!v)
break;
- if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v)) {
+ if (XmlGetName(v) && !mir_wstrcmp(XmlGetName(v), L"value") && XmlGetText(v)) {
if (valueStr[0])
- mir_tstrcat(valueStr, L"\r\n");
- mir_tstrcat(valueStr, XmlGetText(v));
+ mir_wstrcat(valueStr, L"\r\n");
+ mir_wstrcat(valueStr, XmlGetText(v));
}
}
}
@@ -514,7 +514,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (o == NULL)
break;
- if (mir_tstrcmp(XmlGetName(o), L"option"))
+ if (mir_wstrcmp(XmlGetName(o), L"option"))
continue;
if ((v = XmlGetChild(o, "value")) == NULL || XmlGetText(v) == NULL)
continue;
@@ -523,7 +523,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (str == NULL)
continue;
- bool selected = !mir_tstrcmp(valueText, XmlGetText(v));
+ bool selected = !mir_wstrcmp(valueText, XmlGetText(v));
JabberFormAddListItem(item, str, selected);
}
}
@@ -533,7 +533,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (o == NULL)
break;
- if (mir_tstrcmp(XmlGetName(o), L"option"))
+ if (mir_wstrcmp(XmlGetName(o), L"option"))
continue;
if ((v = XmlGetChild(o, "value")) == NULL || XmlGetText(v) == NULL)
continue;
@@ -547,7 +547,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp vs = XmlGetChild(n, k);
if (!vs)
break;
- if (!mir_tstrcmp(XmlGetName(vs), L"value") && !mir_tstrcmp(XmlGetText(vs), XmlGetText(v))) {
+ if (!mir_wstrcmp(XmlGetName(vs), L"value") && !mir_wstrcmp(XmlGetText(vs), XmlGetText(v))) {
selected = true;
break;
}
@@ -579,7 +579,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) 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)
+ if (xNode == NULL || XmlGetName(xNode) == NULL || mir_wstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL)
return NULL;
hFrame = hwndStatic;
@@ -593,7 +593,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) break;
fieldStr = NULL;
- if (mir_tstrcmp(XmlGetName(n), L"field"))
+ if (mir_wstrcmp(XmlGetName(n), L"field"))
continue;
if ((varName = XmlGetAttrValue(n, L"var")) == NULL || (type = XmlGetAttrValue(n, L"type")) == NULL)
@@ -602,7 +602,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) hCtrl = GetDlgItem(hFrame, id);
HXML field = x << XCHILD(L"field") << XATTR(L"var", varName);
- if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi")) {
+ if (!mir_wstrcmp(type, L"text-multi") || !mir_wstrcmp(type, L"jid-multi")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
@@ -616,13 +616,13 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) mir_free(str);
id++;
}
- else if (!mir_tstrcmp(type, L"boolean")) {
+ else if (!mir_wstrcmp(type, L"boolean")) {
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")) {
+ else if (!mir_wstrcmp(type, L"list-single")) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
GetDlgItemText(hFrame, id, str, len + 1);
@@ -632,11 +632,11 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!o)
break;
- if (!mir_tstrcmp(XmlGetName(o), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(o), L"option")) {
if ((v = XmlGetChild(o, "value")) != NULL && XmlGetText(v)) {
if ((str2 = XmlGetAttrValue(o, L"label")) == NULL)
str2 = XmlGetText(v);
- if (!mir_tstrcmp(str2, str))
+ if (!mir_wstrcmp(str2, str))
break;
}
}
@@ -648,7 +648,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) mir_free(str);
id++;
}
- else if (!mir_tstrcmp(type, L"list-multi")) {
+ else if (!mir_wstrcmp(type, L"list-multi")) {
int count = SendMessage(hCtrl, LB_GETCOUNT, 0, 0);
for (j = 0; j < count; j++) {
if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
@@ -661,12 +661,12 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!o)
break;
- if (XmlGetName(o) && !mir_tstrcmp(XmlGetName(o), L"option")) {
+ if (XmlGetName(o) && !mir_wstrcmp(XmlGetName(o), L"option")) {
if ((v = XmlGetChild(o, "value")) != NULL && XmlGetText(v)) {
if ((labelText = XmlGetAttrValue(o, L"label")) == NULL)
labelText = XmlGetText(v);
- if (!mir_tstrcmp(labelText, str))
+ if (!mir_wstrcmp(labelText, str))
field << XCHILD(L"value", XmlGetText(v));
}
}
@@ -677,7 +677,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) }
id++;
}
- else if (!mir_tstrcmp(type, L"fixed") || !mir_tstrcmp(type, L"hidden")) {
+ else if (!mir_wstrcmp(type, L"fixed") || !mir_wstrcmp(type, L"hidden")) {
v = XmlGetChild(n, "value");
if (v != NULL && XmlGetText(v) != NULL)
field << XCHILD(L"value", XmlGetText(v));
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index c41f958c7b..e1da41f62c 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -59,7 +59,7 @@ public: void SetInfo(HANDLE hIcolibIcon, wchar_t *pszText)
{
mir_free(m_pszText);
- m_pszText = pszText ? mir_tstrdup(pszText) : NULL;
+ m_pszText = pszText ? mir_wstrdup(pszText) : NULL;
m_hIcolibIcon = hIcolibIcon;
}
@@ -83,7 +83,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto): frame.align = alBottom;
frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
- frame.tname = mir_a2t(proto->m_szModuleName);
+ frame.tname = mir_a2u(proto->m_szModuleName);
frame.TBtname = proto->m_tszUserName;
m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
mir_free(frame.tname);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index a7142148d4..01ef6ac638 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -94,13 +94,13 @@ void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft) sid[i] = (rand() % 10) + '0';
sid[8] = '\0';
if (ft->sid != NULL) mir_free(ft->sid);
- ft->sid = mir_tstrdup(sid);
+ ft->sid = mir_wstrdup(sid);
filename = ft->std.ptszFiles[ft->std.currentFileNumber];
if ((p = wcsrchr(filename, '\\')) != NULL)
filename = p + 1;
wchar_t tszJid[512];
- mir_sntprintf(tszJid, L"%s/%s", jid, rs);
+ mir_snwprintf(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));
HXML si = iq << XCHILDNS(L"si", JABBER_FEAT_SI) << XATTR(L"id", sid)
@@ -140,13 +140,13 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo) if ((xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL) {
if ((fieldNode = XmlGetChildByTag(xNode, "field", "var", L"stream-method")) != NULL) {
if ((valueNode = XmlGetChild(fieldNode, "value")) != NULL && XmlGetText(valueNode) != NULL) {
- if ((bDirect || bProxy) && !mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
+ if ((bDirect || bProxy) && !mir_wstrcmp(XmlGetText(valueNode), JABBER_FEAT_BYTESTREAMS)) {
// Start Bytestream session
JABBER_BYTE_TRANSFER *jbt = new JABBER_BYTE_TRANSFER;
memset(jbt, 0, sizeof(JABBER_BYTE_TRANSFER));
- jbt->srcJID = mir_tstrdup(pInfo->m_szTo);
- jbt->dstJID = mir_tstrdup(pInfo->m_szFrom);
- jbt->sid = mir_tstrdup(ft->sid);
+ jbt->srcJID = mir_wstrdup(pInfo->m_szTo);
+ jbt->dstJID = mir_wstrdup(pInfo->m_szFrom);
+ jbt->sid = mir_wstrdup(ft->sid);
jbt->pfnSend = &CJabberProto::FtSend;
jbt->pfnFinal = &CJabberProto::FtSendFinal;
jbt->ft = ft;
@@ -154,12 +154,12 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo) ft->jbt = jbt;
ForkThread((MyThreadFunc)&CJabberProto::ByteSendThread, jbt);
}
- else if (!mir_tstrcmp(XmlGetText(valueNode), JABBER_FEAT_IBB)) {
+ else if (!mir_wstrcmp(XmlGetText(valueNode), JABBER_FEAT_IBB)) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
- jibb->srcJID = mir_tstrdup(pInfo->m_szTo);
- jibb->dstJID = mir_tstrdup(pInfo->m_szFrom);
- jibb->sid = mir_tstrdup(ft->sid);
+ jibb->srcJID = mir_wstrdup(pInfo->m_szTo);
+ jibb->dstJID = mir_wstrdup(pInfo->m_szFrom);
+ jibb->sid = mir_wstrdup(ft->sid);
jibb->pfnSend = &CJabberProto::FtIbbSend;
jibb->pfnFinal = &CJabberProto::FtSendFinal;
jibb->ft = ft;
@@ -284,7 +284,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft) else {
if (ft->std.currentFileNumber < ft->std.totalFiles - 1) {
ft->std.currentFileNumber++;
- replaceStrT(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
+ replaceStrW(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
FtInitiate(ft->jid, ft);
return;
@@ -307,7 +307,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!iqNode ||
(from = XmlGetAttrValue(iqNode, L"from")) == NULL ||
- (str = XmlGetAttrValue(iqNode, L"type")) == NULL || mir_tstrcmp(str, L"set") ||
+ (str = XmlGetAttrValue(iqNode, L"type")) == NULL || mir_wstrcmp(str, L"set") ||
(siNode = XmlGetChildByTag(iqNode, "si", "xmlns", JABBER_FEAT_SI)) == NULL)
return;
@@ -332,9 +332,9 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!optionNode)
break;
- if (!mir_tstrcmp(XmlGetName(optionNode), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(optionNode), L"option")) {
if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
- if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
+ if (!mir_wstrcmp(XmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
ftType = FT_BYTESTREAM;
break;
}
@@ -350,9 +350,9 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) if (!optionNode)
break;
- if (!mir_tstrcmp(XmlGetName(optionNode), L"option")) {
+ if (!mir_wstrcmp(XmlGetName(optionNode), L"option")) {
if ((n = XmlGetChild(optionNode, "value")) != NULL && XmlGetText(n)) {
- if (!mir_tstrcmp(XmlGetText(n), JABBER_FEAT_IBB)) {
+ if (!mir_wstrcmp(XmlGetText(n), JABBER_FEAT_IBB)) {
ftType = FT_IBB;
break;
}
@@ -365,13 +365,13 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) // Found known stream mechanism
filetransfer *ft = new filetransfer(this);
ft->dwExpectedRecvFileSize = filesize;
- ft->jid = mir_tstrdup(from);
+ ft->jid = mir_wstrdup(from);
ft->std.hContact = HContactFromJID(from);
- ft->sid = mir_tstrdup(sid);
- ft->szId = mir_tstrdup(szId);
+ ft->sid = mir_wstrdup(sid);
+ ft->szId = mir_wstrdup(szId);
ft->type = ftType;
ft->std.totalFiles = 1;
- ft->std.tszCurrentFile = mir_tstrdup(filename);
+ ft->std.tszCurrentFile = mir_wstrdup(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
PROTORECVFILET pre = { 0 };
@@ -497,9 +497,9 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen) if (!item->jibb) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)mir_alloc(sizeof(JABBER_IBB_TRANSFER));
memset(jibb, 0, sizeof(JABBER_IBB_TRANSFER));
- jibb->srcJID = mir_tstrdup(from);
- jibb->dstJID = mir_tstrdup(to);
- jibb->sid = mir_tstrdup(sid);
+ jibb->srcJID = mir_wstrdup(from);
+ jibb->dstJID = mir_wstrdup(to);
+ jibb->sid = mir_wstrdup(sid);
jibb->pfnRecv = &CJabberProto::FtReceive;
jibb->pfnFinal = &CJabberProto::FtReceiveFinal;
jibb->ft = item->ft;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 9188846f5e..52bef54a38 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -33,7 +33,7 @@ int JabberGcGetStatus(JABBER_RESOURCE_STATUS *r); struct JabberGcRecentInfo
{
- ptrT m_room, m_server, m_nick, m_password;
+ ptrW m_room, m_server, m_nick, m_password;
CJabberProto *ppro;
JabberGcRecentInfo(CJabberProto *proto)
@@ -92,10 +92,10 @@ struct JabberGcRecentInfo 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);
- m_nick = mir_tstrdup(nick);
- m_password = mir_tstrdup(password);
+ m_room = mir_wstrdup(room);
+ m_server = mir_wstrdup(server);
+ m_nick = mir_wstrdup(nick);
+ m_password = mir_wstrdup(password);
}
void fillData(const wchar_t *jid)
@@ -173,7 +173,7 @@ private: if (!str1 && str2) return FALSE;
if (!str2 && str1) return FALSE;
- return !mir_tstrcmp(str1, str2);
+ return !mir_wstrcmp(str1, str2);
}
};
@@ -185,16 +185,16 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleJoinGroupchat(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM)
{
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid == NULL)
return 0;
- ptrT nick(getTStringA(hContact, "MyNick"));
+ ptrW nick(getTStringA(hContact, "MyNick"));
if (nick == NULL)
if ((nick = getTStringA("Nick")) == NULL)
return 0;
- ptrT password(getTStringA(hContact, "Password"));
+ ptrW password(getTStringA(hContact, "Password"));
if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) {
wchar_t *p = wcschr(jid, '@');
@@ -209,7 +209,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM hContact, LPARAM)
{
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid != NULL) {
if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid);
@@ -246,12 +246,12 @@ void CJabberProto::GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, }
wchar_t text[JABBER_MAX_JID_LEN + 1];
- mir_sntprintf(text, L"%s@%s/%s", room, server, nick);
+ mir_snwprintf(text, L"%s@%s/%s", room, server, nick);
JABBER_LIST_ITEM *item = ListAdd(LIST_CHATROOM, text);
item->bAutoJoin = autojoin;
- replaceStrT(item->nick, nick);
- replaceStrT(item->password, info.m_password);
+ replaceStrW(item->nick, nick);
+ replaceStrW(item->password, info.m_password);
int status = (m_iStatus == ID_STATUS_INVISIBLE) ? ID_STATUS_ONLINE : m_iStatus;
XmlNode x(L"x"); x << XATTR(L"xmlns", JABBER_FEAT_MUC);
@@ -277,8 +277,8 @@ static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const wch {
RoomInfo *info = (RoomInfo *)mir_alloc(sizeof(RoomInfo));
info->overlay = overlay;
- info->line1 = line1 ? mir_tstrdup(line1) : 0;
- info->line2 = line2 ? mir_tstrdup(line2) : 0;
+ info->line1 = line1 ? mir_wstrdup(line1) : 0;
+ info->line2 = line2 ? mir_wstrdup(line2) : 0;
int id = SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwndList, CB_SETITEMDATA, id, (LPARAM)info);
@@ -403,7 +403,7 @@ protected: CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid) :
CSuper(proto, IDD_GROUPCHAT_JOIN, NULL),
btnOk(this, IDOK),
- m_jid(mir_tstrdup(jid))
+ m_jid(mir_wstrdup(jid))
{
btnOk.OnClick = Callback(this, &CJabberDlgGcJoin::OnBtnOk);
}
@@ -439,7 +439,7 @@ void CJabberDlgGcJoin::OnInitDialog() delete pInfo;
}
- ptrT tszNick(m_proto->getTStringA("Nick"));
+ ptrW tszNick(m_proto->getTStringA("Nick"));
if (tszNick == NULL)
tszNick = JabberNickFromJID(m_proto->m_szJabberJID);
SetDlgItemText(m_hwnd, IDC_NICK, tszNick);
@@ -471,7 +471,7 @@ void CJabberDlgGcJoin::OnInitDialog() if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, L"%s@%s (%s)", info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
+ mir_snwprintf(jid, L"%s@%s (%s)", info.m_room, info.m_server, info.m_nick ? info.m_nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
}
sttJoinDlgShowRecentItems(m_hwnd, i);
@@ -652,7 +652,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) {
JABBER_LIST_ITEM *item = 0;
if (item = m_proto->ListGetItemPtrFromIndex(i))
- if (!mir_tstrcmp(item->type, L"conference"))
+ if (!mir_wstrcmp(item->type, L"conference"))
AppendMenu(hMenu, MF_STRING, (UINT_PTR)item, item->name);
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
@@ -728,7 +728,7 @@ struct JabberGroupchatChangeNicknameParam {
JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const wchar_t *jid_) :
ppro(ppro_),
- jid(mir_tstrdup(jid_))
+ jid(mir_wstrdup(jid_))
{}
~JabberGroupchatChangeNicknameParam()
@@ -753,7 +753,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) szBuffer = item->nick;
if (param->ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
- replaceStrT(item->nick, szBuffer);
+ replaceStrW(item->nick, szBuffer);
param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMString(FORMAT, L"%s/%s", item->jid, szBuffer), NULL);
}
}
@@ -785,10 +785,10 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t * if (r == NULL)
return;
- r->m_tszResourceName = mir_tstrdup(newNick);
+ r->m_tszResourceName = mir_wstrdup(newNick);
- if (!mir_tstrcmp(item->nick, oldNick)) {
- replaceStrT(item->nick, newNick);
+ if (!mir_wstrcmp(item->nick, oldNick)) {
+ replaceStrW(item->nick, newNick);
MCONTACT hContact = HContactFromJID(item->jid);
if (hContact != NULL)
@@ -815,7 +815,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) {
const wchar_t *from;
- if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence")) return;
+ if (!node || !XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"presence")) return;
if ((from = XmlGetAttrValue(node, L"from")) == NULL) return;
const wchar_t *resource = wcschr(from, '/');
@@ -833,8 +833,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) 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))
- r->m_tszNick = mir_tstrdup(cnick);
+ if (cnick && r && r->m_tszNick && mir_wstrcmp(cnick, r->m_tszNick))
+ r->m_tszNick = mir_wstrdup(cnick);
HXML xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
HXML itemNode = XmlGetChild(xNode, "item");
@@ -842,8 +842,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) const wchar_t *type = XmlGetAttrValue(node, L"type");
// entering room or a usual room presence
- if (type == NULL || !mir_tstrcmp(type, L"available")) {
- if (ptrT(JabberNickFromJID(from)) == NULL)
+ if (type == NULL || !mir_wstrcmp(type, L"available")) {
+ if (ptrW(JabberNickFromJID(from)) == NULL)
return;
GcInit(item);
@@ -853,10 +853,10 @@ void CJabberProto::GroupchatProcessPresence(HXML node) int status = ID_STATUS_ONLINE;
LPCTSTR ptszShow = XmlGetText(XmlGetChild(node, "show"));
if (ptszShow) {
- if (!mir_tstrcmp(ptszShow, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(ptszShow, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(ptszShow, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(ptszShow, L"chat")) status = ID_STATUS_FREECHAT;
+ if (!mir_wstrcmp(ptszShow, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(ptszShow, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(ptszShow, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(ptszShow, L"chat")) status = ID_STATUS_FREECHAT;
}
LPCTSTR str = XmlGetText(XmlGetChild(node, "status"));
@@ -881,16 +881,16 @@ void CJabberProto::GroupchatProcessPresence(HXML node) JABBER_GC_ROLE role = r->m_role;
if ((str = XmlGetAttrValue(itemNode, L"affiliation")) != NULL) {
- if (!mir_tstrcmp(str, L"owner")) affiliation = AFFILIATION_OWNER;
- else if (!mir_tstrcmp(str, L"admin")) affiliation = AFFILIATION_ADMIN;
- else if (!mir_tstrcmp(str, L"member")) affiliation = AFFILIATION_MEMBER;
- else if (!mir_tstrcmp(str, L"none")) affiliation = AFFILIATION_NONE;
- else if (!mir_tstrcmp(str, L"outcast")) affiliation = AFFILIATION_OUTCAST;
+ if (!mir_wstrcmp(str, L"owner")) affiliation = AFFILIATION_OWNER;
+ else if (!mir_wstrcmp(str, L"admin")) affiliation = AFFILIATION_ADMIN;
+ else if (!mir_wstrcmp(str, L"member")) affiliation = AFFILIATION_MEMBER;
+ else if (!mir_wstrcmp(str, L"none")) affiliation = AFFILIATION_NONE;
+ else if (!mir_wstrcmp(str, L"outcast")) affiliation = AFFILIATION_OUTCAST;
}
if ((str = XmlGetAttrValue(itemNode, L"role")) != NULL) {
- if (!mir_tstrcmp(str, L"moderator")) role = ROLE_MODERATOR;
- else if (!mir_tstrcmp(str, L"participant")) role = ROLE_PARTICIPANT;
- else if (!mir_tstrcmp(str, L"visitor")) role = ROLE_VISITOR;
+ if (!mir_wstrcmp(str, L"moderator")) role = ROLE_MODERATOR;
+ else if (!mir_wstrcmp(str, L"participant")) role = ROLE_PARTICIPANT;
+ else if (!mir_wstrcmp(str, L"visitor")) role = ROLE_VISITOR;
else role = ROLE_NONE;
}
@@ -911,7 +911,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
if (str = XmlGetAttrValue(itemNode, L"jid"))
- r->m_tszRealJid = mir_tstrdup(str);
+ r->m_tszRealJid = mir_wstrdup(str);
}
}
@@ -936,7 +936,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // Check <created/>
if (bRoomCreated) {
HXML n = XmlGetChild(node, "created");
- if (n != NULL && (str = XmlGetAttrValue(n, L"xmlns")) != NULL && !mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER))
+ if (n != NULL && (str = XmlGetAttrValue(n, L"xmlns")) != NULL && !mir_wstrcmp(str, JABBER_FEAT_MUC_OWNER))
// A new room just created by me
// Request room config
m_ThreadInfo->send(
@@ -946,7 +946,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
// leaving room
- else if (!mir_tstrcmp(type, L"unavailable")) {
+ else if (!mir_wstrcmp(type, L"unavailable")) {
const wchar_t *str = 0;
if (xNode != NULL && item->nick != NULL) {
HXML reasonNode = XmlGetChild(itemNode, "reason");
@@ -956,7 +956,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (iStatus == 301 && r != NULL)
GcLogShowInformation(item, r, INFO_BAN);
- if (!mir_tstrcmp(resource, item->nick)) {
+ if (!mir_wstrcmp(resource, item->nick)) {
switch (iStatus) {
case 301:
case 307:
@@ -994,17 +994,17 @@ void CJabberProto::GroupchatProcessPresence(HXML node) }
// processing room errors
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
int errorCode = 0;
HXML errorNode = XmlGetChild(node, "error");
- ptrT str(JabberErrorMsg(errorNode, &errorCode));
+ ptrW str(JabberErrorMsg(errorNode, &errorCode));
if (errorCode == JABBER_ERROR_CONFLICT) {
- ptrT newNick(getTStringA("GcAltNick"));
+ ptrW newNick(getTStringA("GcAltNick"));
if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) {
- replaceStrT(item->nick, newNick);
+ replaceStrW(item->nick, newNick);
wchar_t text[1024] = { 0 };
- mir_sntprintf(text, L"%s/%s", item->jid, newNick);
+ mir_snwprintf(text, L"%s/%s", item->jid, newNick);
SendPresenceTo(m_iStatus, text, NULL);
}
else {
@@ -1028,12 +1028,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node) JABBER_LIST_ITEM *item;
CMString imgLink;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"message")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message")) return;
if ((from = XmlGetAttrValue(node, L"from")) == NULL) return;
if ((item = ListGetItemPtr(LIST_CHATROOM, from)) == NULL) return;
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return;
- if (!mir_tstrcmp(type, L"error"))
+ if (!mir_wstrcmp(type, L"error"))
return;
GCDEST gcd = { m_szModuleName, item->jid, 0 };
@@ -1064,7 +1064,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) resource = tmpnick;
}
}
- item->getTemp()->m_tszStatusMessage = mir_tstrdup(msgText);
+ item->getTemp()->m_tszStatusMessage = mir_wstrdup(msgText);
}
else {
imgLink = ExtractImage(node);
@@ -1079,7 +1079,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource == NULL)
gcd.iType = GC_EVENT_INFORMATION;
- else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) {
+ else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_wstrlen(msgText) > 4) {
msgText += 4;
gcd.iType = GC_EVENT_ACTION;
}
@@ -1115,7 +1115,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) gce.ptszNick = nick;
gce.time = msgTime;
gce.ptszText = tszText;
- gce.bIsMe = nick == NULL ? FALSE : (mir_tstrcmp(resource, item->nick) == 0);
+ gce.bIsMe = nick == NULL ? FALSE : (mir_wstrcmp(resource, item->nick) == 0);
if (!isHistory)
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -1157,12 +1157,12 @@ public: CSuper::OnInitDialog();
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
+ mir_snwprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid);
SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
SetDlgItemText(m_hwnd, IDC_FROM, m_from);
SetDlgItemText(m_hwnd, IDC_REASON, m_reason);
- SetDlgItemText(m_hwnd, IDC_NICK, ptrT(JabberNickFromJID(m_proto->m_szJabberJID)));
+ SetDlgItemText(m_hwnd, IDC_NICK, ptrW(JabberNickFromJID(m_proto->m_szJabberJID)));
Window_SetIcon_IcoLib(m_hwnd, g_GetIconHandle(IDI_GROUP));
@@ -1193,7 +1193,7 @@ void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t return;
if (m_options.AutoAcceptMUC) {
- ptrT nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
+ ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == NULL)
nick = getTStringA("Nick");
if (nick == NULL)
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index f15b3f4776..91a1df8f61 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -46,11 +46,11 @@ void JabberIbbFreeJibb(JABBER_IBB_TRANSFER *jibb) BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo)
{
- if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"open"))
+ if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"open"))
FtHandleIbbRequest(iqNode, TRUE);
- else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"close"))
+ else if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"close"))
FtHandleIbbRequest(iqNode, FALSE);
- else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"data")) {
+ else if (!mir_wstrcmp(pInfo->GetChildNodeName(), L"data")) {
BOOL bOk = FALSE;
const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid");
const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq");
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 6d85d38886..64aae7a25b 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -307,7 +307,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) int first = -1;
HICON empty = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- mir_sntprintf(Group, LPGENW("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport"));
+ mir_snwprintf(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);
@@ -389,7 +389,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransported", 0))
return -1;
- int iID = GetTransportProtoID(ptrT(getTStringA(hContact, "Transport")));
+ int iID = GetTransportProtoID(ptrW(getTStringA(hContact, "Transport")));
if (iID < 0)
return -1;
@@ -431,7 +431,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon }
if (m_lstTransports.getIndex(domain) == -1 && isAgent) {
- m_lstTransports.insert(mir_tstrdup(domain));
+ m_lstTransports.insert(mir_wstrdup(domain));
setByte(hContact, "IsTransport", 1);
}
@@ -445,7 +445,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hCon void CJabberProto::CheckAllContactsAreTransported()
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid)
DBCheckIsTransportedContact(jid, hContact);
}
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 60040145af..79db2a2232 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -248,9 +248,9 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) return false;
int nIqType = JABBER_IQ_TYPE_FAIL;
- if (!mir_tstrcmpi(szType, L"result"))
+ if (!mir_wstrcmpi(szType, L"result"))
nIqType = JABBER_IQ_TYPE_RESULT;
- else if (!mir_tstrcmpi(szType, L"error"))
+ else if (!mir_wstrcmpi(szType, L"error"))
nIqType = JABBER_IQ_TYPE_ERROR;
else
return false;
@@ -300,9 +300,9 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) CJabberIqInfo iqInfo;
iqInfo.m_nIqType = JABBER_IQ_TYPE_FAIL;
- if (!mir_tstrcmpi(szType, L"get"))
+ if (!mir_wstrcmpi(szType, L"get"))
iqInfo.m_nIqType = JABBER_IQ_TYPE_GET;
- else if (!mir_tstrcmpi(szType, L"set"))
+ else if (!mir_wstrcmpi(szType, L"set"))
iqInfo.m_nIqType = JABBER_IQ_TYPE_SET;
else
return FALSE;
@@ -317,8 +317,8 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) 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)))
+ if ((!pInfo.m_szXmlns || (szXmlns && !mir_wstrcmp(pInfo.m_szXmlns, szXmlns))) &&
+ (!pInfo.m_szTag || !mir_wstrcmp(pInfo.m_szTag, szTagName)))
{
// node suits handler criteria, call the handler
iqInfo.m_pChildNode = pFirstChild;
@@ -416,9 +416,9 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler( CJabberIqPermanentInfo *pInfo = new CJabberIqPermanentInfo();
pInfo->m_pHandler = pHandler;
pInfo->m_nIqTypes = nIqTypes ? nIqTypes : JABBER_IQ_TYPE_ANY;
- pInfo->m_szXmlns = mir_tstrdup(szXmlns);
+ pInfo->m_szXmlns = mir_wstrdup(szXmlns);
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- pInfo->m_szTag = mir_tstrdup(szTag);
+ pInfo->m_szTag = mir_wstrdup(szTag);
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index 6d5b75d68a..a8110ea52c 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -81,7 +81,7 @@ public: { mir_free(m_szReceiver);
}
- __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrT(m_szReceiver, szReceiver); }
+ __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrW(m_szReceiver, szReceiver); }
__forceinline void SetParamsToParse(DWORD dwParamsToParse) { m_dwParamsToParse = dwParamsToParse; }
__forceinline void SetTimeout(DWORD dwTimeout) { m_dwTimeout = dwTimeout; }
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 9a87819646..84e5c93ef8 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -44,7 +44,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) if (m_options.ShowOSVersion) {
wchar_t os[256] = { 0 };
if (!GetOSDisplayString(os, _countof(os)))
- mir_tstrncpy(os, L"Microsoft Windows", _countof(os));
+ mir_wstrncpy(os, L"Microsoft Windows", _countof(os));
query << XCHILD(L"os", os);
}
@@ -104,7 +104,7 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) TimeZone_PrintDateTime(UTC_TIME_HANDLE, L"I", stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, L"%+03d:%02d", nGmtOffset / 60, nGmtOffset % 60);
+ mir_snwprintf(szTZ, L"%+03d:%02d", nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(L"result", pInfo);
HXML timeNode = iq << XCHILDNS(L"time", JABBER_FEAT_ENTITY_TIME);
@@ -125,7 +125,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) _tzset();
time(<ime);
gmt = gmtime(<ime);
- mir_sntprintf(stime, L"%.4i%.2i%.2iT%.2i:%.2i:%.2i",
+ mir_snwprintf(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 = _wctime(<ime);
@@ -186,7 +186,7 @@ BOOL CJabberProto::OnSiRequest(HXML node, CJabberIqInfo *pInfo) {
const wchar_t *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile");
- if (szProfile && !mir_tstrcmp(szProfile, JABBER_FEAT_SI_FT))
+ if (szProfile && !mir_wstrcmp(szProfile, JABBER_FEAT_SI_FT))
FtHandleSiRequest(node);
else {
XmlNodeIq iq(L"error", pInfo);
@@ -220,7 +220,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) pDelimiter = wcschr(szTo, '/');
if (pDelimiter) *pDelimiter = 0;
- BOOL bRetVal = mir_tstrcmp(szFrom, szTo) == 0;
+ BOOL bRetVal = mir_wstrcmp(szFrom, szTo) == 0;
mir_free(szFrom);
mir_free(szTo);
@@ -240,7 +240,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item") != 0)
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item") != 0)
continue;
if ((jid = XmlGetAttrValue(itemNode, L"jid")) == NULL)
continue;
@@ -248,9 +248,9 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) continue;
// 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")) {
+ if (!mir_wstrcmp(str, L"to") || !mir_wstrcmp(str, L"both") || !mir_wstrcmp(str, L"from") || !mir_wstrcmp(str, L"none")) {
const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
- ptrT nick((name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid));
+ ptrW nick((name != NULL) ? mir_wstrdup(name) : JabberNickFromJID(jid));
if (nick != NULL) {
MCONTACT hContact = HContactFromJID(jid, false);
if (hContact == NULL)
@@ -259,15 +259,15 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) setTString(hContact, "jid", jid);
JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact);
- replaceStrT(item->nick, nick);
+ replaceStrW(item->nick, nick);
HXML groupNode = XmlGetChild(itemNode, "group");
- replaceStrT(item->group, XmlGetText(groupNode));
+ replaceStrW(item->group, XmlGetText(groupNode));
if (name != NULL) {
- ptrT tszNick(getTStringA(hContact, "Nick"));
+ ptrW tszNick(getTStringA(hContact, "Nick"));
if (tszNick != NULL) {
- if (mir_tstrcmp(nick, tszNick) != 0)
+ if (mir_wstrcmp(nick, tszNick) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
db_unset(hContact, "CList", "MyHandle");
@@ -287,9 +287,9 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) }
if (JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid)) {
- if (!mir_tstrcmp(str, L"both")) item->subscription = SUB_BOTH;
- else if (!mir_tstrcmp(str, L"to")) item->subscription = SUB_TO;
- else if (!mir_tstrcmp(str, L"from")) item->subscription = SUB_FROM;
+ if (!mir_wstrcmp(str, L"both")) item->subscription = SUB_BOTH;
+ else if (!mir_wstrcmp(str, L"to")) item->subscription = SUB_TO;
+ else if (!mir_wstrcmp(str, L"from")) item->subscription = SUB_FROM;
else item->subscription = SUB_NONE;
debugLog(L"Roster push for jid=%s, set subscription to %s", jid, str);
@@ -298,7 +298,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // subscription = remove is to remove from roster list
// but we will just set the contact to offline and not actually
// remove, so that history will be retained.
- if (!mir_tstrcmp(str, L"remove")) {
+ if (!mir_wstrcmp(str, L"remove")) {
if (hContact) {
SetContactOfflineStatus(hContact);
ListRemove(LIST_ROSTER, jid);
@@ -335,7 +335,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) filetransfer *ft = new filetransfer(this);
ft->std.totalFiles = 1;
- ft->jid = mir_tstrdup(pInfo->GetFrom());
+ ft->jid = mir_wstrdup(pInfo->GetFrom());
ft->std.hContact = pInfo->GetHContact();
ft->type = FT_OOB;
ft->httpHostName = NULL;
@@ -355,7 +355,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->httpPort = (WORD)_wtoi(p + 1);
*p = '\0';
}
- ft->httpHostName = mir_t2a(text);
+ ft->httpHostName = mir_u2a(text);
}
}
}
@@ -376,7 +376,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) str2++;
else
str2 = ft->httpPath;
- str2 = mir_tstrdup(str2);
+ str2 = mir_wstrdup(str2);
JabberHttpUrlDecode(str2);
PROTORECVFILET pre;
@@ -482,10 +482,10 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo) CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams*)mir_calloc(sizeof(CJabberHttpAuthParams));
if (pParams) {
pParams->m_nType = CJabberHttpAuthParams::IQ;
- pParams->m_szFrom = mir_tstrdup(pInfo->GetFrom());
- pParams->m_szId = mir_tstrdup(szId);
- pParams->m_szMethod = mir_tstrdup(szMethod);
- pParams->m_szUrl = mir_tstrdup(szUrl);
+ pParams->m_szFrom = mir_wstrdup(pInfo->GetFrom());
+ pParams->m_szId = mir_wstrdup(szId);
+ pParams->m_szMethod = mir_wstrdup(szMethod);
+ pParams->m_szUrl = mir_wstrdup(szUrl);
AddClistHttpAuthEvent(pParams);
}
return TRUE;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index de177c797d..caa0532da6 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -35,7 +35,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) return;
const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
- if (mir_tstrcmp(type, L"result"))
+ if (mir_wstrcmp(type, L"result"))
return;
HXML query = XmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_DISCO_INFO);
@@ -49,7 +49,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) XmlGetAttrValue(identity, L"type"),
XmlGetAttrValue(identity, L"name") };
- if (!mir_tstrcmp(tmp.category, L"pubsub") && !mir_tstrcmp(tmp.type, L"pep")) {
+ if (!mir_wstrcmp(tmp.category, L"pubsub") && !mir_wstrcmp(tmp.type, L"pep")) {
m_bPepSupported = true;
EnableMenuItems(true);
@@ -68,7 +68,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if (!mir_tstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -96,13 +96,13 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInf return;
// is our default delimiter?
- if ((!szGroupDelimeter && bPrivateStorageSupport) || (szGroupDelimeter && mir_tstrcmp(szGroupDelimeter, L"\\")))
+ if ((!szGroupDelimeter && bPrivateStorageSupport) || (szGroupDelimeter && mir_wstrcmp(szGroupDelimeter, L"\\")))
m_ThreadInfo->send(
XmlNodeIq(L"set", SerialNext()) << XQUERY(JABBER_FEAT_PRIVATE_STORAGE)
<< XCHILD(L"roster", L"\\") << XATTR(L"xmlns", JABBER_FEAT_NESTED_ROSTER_GROUPS));
// roster request
- wchar_t *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\");
+ wchar_t *szUserData = mir_wstrdup(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));
@@ -134,7 +134,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) LISTFOREACH(i, this, LIST_BOOKMARK)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
- if (item != NULL && !mir_tstrcmp(item->type, L"conference") && item->bAutoJoin)
+ if (item != NULL && !mir_wstrcmp(item->type, L"conference") && item->bAutoJoin)
ll.insert(item);
}
@@ -149,7 +149,7 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) if (item->nick && item->nick[0])
GroupchatJoinRoom(server, p, item->nick, item->password, true);
else {
- ptrT nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
+ ptrW nick(getTStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == NULL)
nick = getTStringA("Nick");
if (nick == NULL)
@@ -219,7 +219,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResultSetAuth, JABBER_IQ_TYPE_SET));
HXML query = iq << XQUERY(L"jabber:iq:auth");
query << XCHILD(L"username", m_ThreadInfo->conn.username);
@@ -243,11 +243,11 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) m_ThreadInfo->send(iq);
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
m_ThreadInfo->send("</stream:stream>");
wchar_t text[128];
- mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
m_ThreadInfo = NULL; // To disallow auto reconnect
@@ -263,19 +263,19 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdSetAuth");
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
- ptrT tszNick(getTStringA("Nick"));
+ if (!mir_wstrcmp(type, L"result")) {
+ ptrW tszNick(getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", m_ThreadInfo->conn.username);
OnLoggedIn();
}
// What to do if password error? etc...
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
wchar_t text[128];
m_ThreadInfo->send("</stream:stream>");
- mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
m_ThreadInfo = NULL; // To disallow auto reconnect
@@ -318,7 +318,7 @@ void CJabberProto::OnIqResultSession(HXML, CJabberIqInfo *pInfo) void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin)
{
- ptrT roomjid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomjid(getTStringA(hContact, "ChatRoomID"));
if (roomjid == NULL)
return;
@@ -329,14 +329,14 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) server[0] = 0; server++;
- ptrT nick(getTStringA(hContact, "MyNick"));
+ ptrW nick(getTStringA(hContact, "MyNick"));
if (nick == NULL) {
nick = JabberNickFromJID(m_szJabberJID);
if (nick == NULL)
return;
}
- GroupchatJoinRoom(server, room, nick, ptrT(getTStringA(hContact, "Password")), autojoin);
+ GroupchatJoinRoom(server, room, nick, ptrW(getTStringA(hContact, "Password")), autojoin);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -357,12 +357,12 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) return;
}
- if (mir_tstrcmp(XmlGetAttrValue(queryNode, L"xmlns"), JABBER_FEAT_IQ_ROSTER)) {
+ if (mir_wstrcmp(XmlGetAttrValue(queryNode, L"xmlns"), JABBER_FEAT_IQ_ROSTER)) {
mir_free(szGroupDelimeter);
return;
}
- if (!mir_tstrcmp(szGroupDelimeter, L"\\")) {
+ if (!mir_wstrcmp(szGroupDelimeter, L"\\")) {
mir_free(szGroupDelimeter);
szGroupDelimeter = NULL;
}
@@ -377,16 +377,16 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item"))
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item"))
continue;
const wchar_t *str = XmlGetAttrValue(itemNode, L"subscription");
JABBER_SUBSCRIPTION sub;
if (str == NULL) sub = SUB_NONE;
- else if (!mir_tstrcmp(str, L"both")) sub = SUB_BOTH;
- else if (!mir_tstrcmp(str, L"to")) sub = SUB_TO;
- else if (!mir_tstrcmp(str, L"from")) sub = SUB_FROM;
+ else if (!mir_wstrcmp(str, L"both")) sub = SUB_BOTH;
+ else if (!mir_wstrcmp(str, L"to")) sub = SUB_TO;
+ else if (!mir_wstrcmp(str, L"from")) sub = SUB_FROM;
else sub = SUB_NONE;
const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid");
@@ -396,7 +396,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) bIsTransport = true;
const wchar_t *name = XmlGetAttrValue(itemNode, L"name");
- wchar_t *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid);
+ wchar_t *nick = (name != NULL) ? mir_wstrdup(name) : JabberNickFromJID(jid);
if (nick == NULL)
continue;
@@ -410,26 +410,26 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) mir_free(item->nick); item->nick = nick;
HXML groupNode = XmlGetChild(itemNode, "group");
- replaceStrT(item->group, XmlGetText(groupNode));
+ replaceStrW(item->group, XmlGetText(groupNode));
// check group delimiters:
if (item->group && szGroupDelimeter) {
while (wchar_t *szPos = wcsstr(item->group, szGroupDelimeter)) {
*szPos = 0;
- szPos += mir_tstrlen(szGroupDelimeter);
- 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);
+ szPos += mir_wstrlen(szGroupDelimeter);
+ wchar_t *szNewGroup = (wchar_t *)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(item->group) + mir_wstrlen(szPos) + 2));
+ mir_wstrcpy(szNewGroup, item->group);
+ mir_wstrcat(szNewGroup, L"\\");
+ mir_wstrcat(szNewGroup, szPos);
mir_free(item->group);
item->group = szNewGroup;
}
}
if (name != NULL) {
- ptrT tszNick(getTStringA(hContact, "Nick"));
+ ptrW tszNick(getTStringA(hContact, "Nick"));
if (tszNick != NULL) {
- if (mir_tstrcmp(nick, tszNick) != 0)
+ if (mir_wstrcmp(nick, tszNick) != 0)
db_set_ts(hContact, "CList", "MyHandle", nick);
else
db_unset(hContact, "CList", "MyHandle");
@@ -461,9 +461,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) Clist_GroupCreate(0, item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup != NULL) {
- if (mir_tstrcmp(tszGroup, item->group))
+ if (mir_wstrcmp(tszGroup, item->group))
db_set_ts(hContact, "CList", "Group", item->group);
}
else db_set_ts(hContact, "CList", "Group", item->group);
@@ -492,7 +492,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (m_options.RosterSync == TRUE) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
MCONTACT hNext = db_find_next(hContact, m_szModuleName);
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) {
debugLog(L"Syncing roster: preparing to delete %s (hContact=0x%x)", jid, hContact);
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
@@ -533,11 +533,11 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if (m_hwndAgentRegInput)
SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 1 /*success*/, (LPARAM)xmlCopyNode(iqNode));
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_hwndAgentRegInput) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
@@ -557,7 +557,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((from = XmlGetAttrValue(iqNode, L"from")) == NULL) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
MCONTACT hContact = HContactFromJID(from);
if (hContact != NULL)
setByte(hContact, "IsTransport", true);
@@ -565,7 +565,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if (m_hwndRegProgress)
SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Registration successful"));
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_hwndRegProgress) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
@@ -621,7 +621,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP debugLog(L"My picture saved to %s", szAvatarFileName);
}
else {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
@@ -631,9 +631,9 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP }
if (item != NULL) {
hasPhoto = true;
- if (item->photoFileName && mir_tstrcmp(item->photoFileName, szAvatarFileName))
+ if (item->photoFileName && mir_wstrcmp(item->photoFileName, szAvatarFileName))
DeleteFile(item->photoFileName);
- replaceStrT(item->photoFileName, szAvatarFileName);
+ replaceStrW(item->photoFileName, szAvatarFileName);
debugLog(L"Contact's picture saved to %s", szAvatarFileName);
OnIqResultGotAvatar(hContact, o, szPicType);
}
@@ -669,7 +669,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) m_nJabberSearchID = -1;
if ((vCardNode = XmlGetChild(iqNode, "vCard")) != NULL) {
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
@@ -681,14 +681,14 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
else ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
return;
}
- size_t len = mir_tstrlen(m_szJabberJID);
+ size_t len = mir_wstrlen(m_szJabberJID);
if (!wcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) {
hContact = NULL;
debugLogA("Vcard for myself");
@@ -699,13 +699,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) debugLogA("Other user's vcard");
}
- if (!mir_tstrcmp(type, L"error")) {
+ if (!mir_wstrcmp(type, L"error")) {
if ((hContact = HContactFromJID(jid)) != NULL)
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0);
return;
}
- if (mir_tstrcmp(type, L"result"))
+ if (mir_wstrcmp(type, L"result"))
return;
bool hasFn = false, hasNick = false, hasGiven = false, hasFamily = false, hasMiddle = false,
@@ -723,19 +723,19 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!n)
break;
if (XmlGetName(n) == NULL) continue;
- if (!mir_tstrcmp(XmlGetName(n), L"FN")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"FN")) {
if (XmlGetText(n) != NULL) {
hasFn = true;
setTString(hContact, "FullName", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"NICKNAME")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"NICKNAME")) {
if (XmlGetText(n) != NULL) {
hasNick = true;
setTString(hContact, "Nick", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"N")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"N")) {
// First/Last name
if (!hasGiven && !hasFamily && !hasMiddle) {
if ((m = XmlGetChild(n, "GIVEN")) != NULL && XmlGetText(m) != NULL) {
@@ -752,7 +752,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"EMAIL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"EMAIL")) {
// E-mail address(es)
if ((m = XmlGetChild(n, "USERID")) == NULL) // Some bad client put e-mail directly in <EMAIL/> instead of <USERID/>
m = n;
@@ -779,7 +779,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) nEmail++;
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"BDAY")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"BDAY")) {
// Birthday
if (!hasBday && XmlGetText(n) != NULL) {
if (hContact != NULL) {
@@ -804,7 +804,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"GENDER")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"GENDER")) {
// Gender
if (!hasGender && XmlGetText(n) != NULL) {
if (hContact != NULL) {
@@ -819,7 +819,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ADR")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ADR")) {
if (!hasHome && XmlGetChild(n, "HOME") != NULL) {
// Home address
wchar_t text[128];
@@ -828,9 +828,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) hasHomeStreet = true;
if (hContact != NULL) {
if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
@@ -875,9 +875,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) hasWorkStreet = true;
if (hContact != NULL) {
if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL)
- mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
+ mir_snwprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o));
else
wcsncpy_s(text, XmlGetText(m), _TRUNCATE);
text[_countof(text) - 1] = '\0';
@@ -914,7 +914,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"TEL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"TEL")) {
// Telephone/Fax/Cellular
if ((m = XmlGetChild(n, "NUMBER")) != NULL && XmlGetText(m) != NULL) {
if (hContact != NULL) {
@@ -966,14 +966,14 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"URL")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"URL")) {
// Homepage
if (!hasUrl && XmlGetText(n) != NULL) {
hasUrl = true;
setTString(hContact, "Homepage", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ORG")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ORG")) {
if (!hasOrgname && !hasOrgunit) {
if ((m = XmlGetChild(n, "ORGNAME")) != NULL && XmlGetText(m) != NULL) {
hasOrgname = true;
@@ -985,19 +985,19 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"ROLE")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"ROLE")) {
if (!hasRole && XmlGetText(n) != NULL) {
hasRole = true;
setTString(hContact, "Role", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"TITLE")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"TITLE")) {
if (!hasTitle && XmlGetText(n) != NULL) {
hasTitle = true;
setTString(hContact, "CompanyPosition", XmlGetText(n));
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"DESC")) {
+ else if (!mir_wstrcmp(XmlGetName(n), L"DESC")) {
if (!hasDesc && XmlGetText(n) != NULL) {
hasDesc = true;
CMString tszMemo(XmlGetText(n));
@@ -1005,16 +1005,16 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) setTString(hContact, "About", tszMemo);
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"PHOTO"))
+ else if (!mir_wstrcmp(XmlGetName(n), L"PHOTO"))
OnIqResultGetVcardPhoto(n, hContact, hasPhoto);
}
}
if (hasFn && !hasNick) {
- ptrT nick(getTStringA(hContact, "Nick"));
- ptrT jidNick(JabberNickFromJID(jid));
- if (!nick || (jidNick && !mir_tstrcmpi(nick, jidNick)))
- setTString(hContact, "Nick", ptrT(getTStringA(hContact, "FullName")));
+ ptrW nick(getTStringA(hContact, "Nick"));
+ ptrW jidNick(JabberNickFromJID(jid));
+ if (!nick || (jidNick && !mir_wstrcmpi(nick, jidNick)))
+ setTString(hContact, "Nick", ptrW(getTStringA(hContact, "FullName")));
}
if (!hasFn)
delSetting(hContact, "FullName");
@@ -1125,7 +1125,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
}
@@ -1159,7 +1159,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
if ((id = JabberGetPacketID(iqNode)) == -1) return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL)
return;
@@ -1170,7 +1170,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!itemNode)
break;
- if (!mir_tstrcmp(XmlGetName(itemNode), L"item")) {
+ if (!mir_wstrcmp(XmlGetName(itemNode), L"item")) {
if ((jid = XmlGetAttrValue(itemNode, L"jid")) != NULL) {
psr.id.w = (wchar_t*)jid;
debugLog(L"Result jid = %s", jid);
@@ -1198,7 +1198,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1215,14 +1215,14 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (id == -1)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return;
if ((queryNode = XmlGetChild(queryNode, "x")) == NULL) return;
for (int i = 0;; i++) {
HXML itemNode = XmlGetChild(queryNode, i);
if (!itemNode)
break;
- if (mir_tstrcmp(XmlGetName(itemNode), L"item"))
+ if (mir_wstrcmp(XmlGetName(itemNode), L"item"))
continue;
PROTOSEARCHRESULT psr = { 0 };
@@ -1234,7 +1234,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (!fieldNode)
break;
- if (mir_tstrcmp(XmlGetName(fieldNode), L"field"))
+ if (mir_wstrcmp(XmlGetName(fieldNode), L"field"))
continue;
const wchar_t *fieldName = XmlGetAttrValue(fieldNode, L"var");
@@ -1245,19 +1245,19 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (n == NULL)
continue;
- if (!mir_tstrcmp(fieldName, L"jid")) {
+ if (!mir_wstrcmp(fieldName, L"jid")) {
psr.id.w = (wchar_t*)XmlGetText(n);
debugLog(L"Result jid = %s", psr.id.w);
}
- else if (!mir_tstrcmp(fieldName, L"nickname"))
+ else if (!mir_wstrcmp(fieldName, L"nickname"))
psr.nick.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"fn"))
+ else if (!mir_wstrcmp(fieldName, L"fn"))
psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"given"))
+ else if (!mir_wstrcmp(fieldName, L"given"))
psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"family"))
+ else if (!mir_wstrcmp(fieldName, L"family"))
psr.lastName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
- else if (!mir_tstrcmp(fieldName, L"email"))
+ else if (!mir_wstrcmp(fieldName, L"email"))
psr.email.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L"";
}
@@ -1266,7 +1266,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if (!mir_tstrcmp(type, L"error"))
+ else if (!mir_wstrcmp(type, L"error"))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1278,11 +1278,11 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
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"))
+ else if (!mir_wstrcmp(type, L"error"))
MessageBox(NULL, TranslateT("Password cannot be changed."), TranslateT("Change Password"), MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
}
@@ -1300,7 +1300,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) const wchar_t *type;
if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return;
- if (mir_tstrcmp(type, L"result")) return;
+ if (mir_wstrcmp(type, L"result")) return;
HXML vCard = XmlGetChild(iqNode, "vCard");
if (vCard == NULL) return;
@@ -1309,7 +1309,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (XmlGetChildCount(vCard) == 0) {
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
}
@@ -1339,11 +1339,11 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) return;
HXML n = NULL;
- if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_tstrcmp(type, L"result")) {
+ if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(xmlns, JABBER_FEAT_AVATAR))
+ if (!mir_wstrcmp(xmlns, JABBER_FEAT_AVATAR))
n = XmlGetChild(queryNode, "data");
}
}
@@ -1354,7 +1354,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) }
wchar_t szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, _countof(szJid));
+ mir_wstrncpy(szJid, from, _countof(szJid));
wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1379,11 +1379,11 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) HXML n = NULL;
const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, "query");
if (queryNode != NULL) {
const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR))
+ if (!mir_wstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR))
n = XmlGetChild(queryNode, "data");
}
}
@@ -1394,7 +1394,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) }
wchar_t szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, _countof(szJid));
+ mir_wstrncpy(szJid, from, _countof(szJid));
wchar_t *res = wcschr(szJid, '/');
if (res != NULL)
*res = 0;
@@ -1414,10 +1414,10 @@ void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t int pictureType;
if (mimeType != NULL) {
- if (!mir_tstrcmp(mimeType, L"image/jpeg")) pictureType = PA_FORMAT_JPEG;
- else if (!mir_tstrcmp(mimeType, L"image/png")) pictureType = PA_FORMAT_PNG;
- else if (!mir_tstrcmp(mimeType, L"image/gif")) pictureType = PA_FORMAT_GIF;
- else if (!mir_tstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP;
+ if (!mir_wstrcmp(mimeType, L"image/jpeg")) pictureType = PA_FORMAT_JPEG;
+ else if (!mir_wstrcmp(mimeType, L"image/png")) pictureType = PA_FORMAT_PNG;
+ else if (!mir_wstrcmp(mimeType, L"image/gif")) pictureType = PA_FORMAT_GIF;
+ else if (!mir_wstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP;
else {
LBL_ErrFormat:
debugLog(L"Invalid mime type specified for picture: %s", mimeType);
@@ -1474,7 +1474,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) return;
const wchar_t *jid;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) {
m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE;
EnableMenuItems(true);
@@ -1486,23 +1486,23 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) HXML itemNode;
for (int i = 0; itemNode = XmlGetChild(storageNode, i); i++) {
if (LPCTSTR name = XmlGetName(itemNode)) {
- if (!mir_tstrcmp(name, L"conference") && (jid = XmlGetAttrValue(itemNode, L"jid"))) {
+ if (!mir_wstrcmp(name, L"conference") && (jid = XmlGetAttrValue(itemNode, L"jid"))) {
JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid);
- item->name = mir_tstrdup(XmlGetAttrValue(itemNode, L"name"));
- item->type = mir_tstrdup(L"conference");
+ item->name = mir_wstrdup(XmlGetAttrValue(itemNode, L"name"));
+ item->type = mir_wstrdup(L"conference");
item->bUseResource = true;
- item->nick = mir_tstrdup(XPathT(itemNode, "nick"));
- item->password = mir_tstrdup(XPathT(itemNode, "password"));
+ item->nick = mir_wstrdup(XPathT(itemNode, "nick"));
+ item->password = mir_wstrdup(XPathT(itemNode, "password"));
const wchar_t *autoJ = XmlGetAttrValue(itemNode, L"autojoin");
if (autoJ != NULL)
- item->bAutoJoin = !mir_tstrcmp(autoJ, L"true") || !mir_tstrcmp(autoJ, L"1");
+ item->bAutoJoin = !mir_wstrcmp(autoJ, L"true") || !mir_wstrcmp(autoJ, L"1");
}
- else if (!mir_tstrcmp(name, L"url") && (jid = XmlGetAttrValue(itemNode, L"url"))) {
+ else if (!mir_wstrcmp(name, L"url") && (jid = XmlGetAttrValue(itemNode, L"url"))) {
JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid);
item->bUseResource = true;
- item->name = mir_tstrdup(XmlGetAttrValue(itemNode, L"name"));
- item->type = mir_tstrdup(L"url");
+ item->name = mir_wstrdup(XmlGetAttrValue(itemNode, L"name"));
+ item->type = mir_wstrdup(L"url");
}
}
}
@@ -1512,7 +1512,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_BOOKMARKS);
}
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
if (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE) {
m_ThreadInfo->jabberServerCaps &= ~JABBER_CAPS_PRIVATE_STORAGE;
EnableMenuItems(true);
@@ -1532,7 +1532,7 @@ void CJabberProto::SetBookmarkRequest(XmlNodeIq& iq) if (item == NULL || item->jid == NULL)
continue;
- if (!mir_tstrcmp(item->type, L"conference")) {
+ if (!mir_wstrcmp(item->type, L"conference")) {
HXML itemNode = storage << XCHILD(L"conference") << XATTR(L"jid", item->jid);
if (item->name)
itemNode << XATTR(L"name", item->name);
@@ -1544,7 +1544,7 @@ void CJabberProto::SetBookmarkRequest(XmlNodeIq& iq) itemNode << XCHILD(L"password", item->password);
}
- if (!mir_tstrcmp(item->type, L"url")) {
+ if (!mir_wstrcmp(item->type, L"url")) {
HXML itemNode = storage << XCHILD(L"url") << XATTR(L"url", item->jid);
if (item->name)
itemNode << XATTR(L"name", item->name);
@@ -1563,10 +1563,10 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_REFRESH);
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
HXML errorNode = XmlGetChild(iqNode, "error");
wchar_t *str = JabberErrorMsg(errorNode);
MessageBox(NULL, str, TranslateT("Jabber Bookmarks Error"), MB_OK | MB_SETFOREGROUND);
@@ -1593,7 +1593,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) LPCTSTR szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
if (szLastStatusMessage) // replace only if it exists
- r->m_tszStatusMessage = mir_tstrdup(szLastStatusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(szLastStatusMessage);
}
r->m_dwIdleStartTime = lastActivity;
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 1795ccbcfb..1904cb0cf7 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -49,17 +49,17 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo*) if (from == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != NULL) {
LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != NULL) {
str = XmlGetAttrValue(xNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_DATA_FORMS))
+ if (!mir_wstrcmp(str, JABBER_FEAT_DATA_FORMS))
//LaunchForm(xNode);
- FormCreateDialog(xNode, L"Jabber Conference Room Configuration", &CJabberProto::SetMucConfig, mir_tstrdup(from));
+ FormCreateDialog(xNode, L"Jabber Conference Room Configuration", &CJabberProto::SetMucConfig, mir_wstrdup(from));
}
}
}
@@ -116,14 +116,14 @@ static void sttFillJidList(HWND hwndDlg) if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = XmlGetText(XmlGetChild(itemNode, L"reason"));
if (reason != NULL) {
- mir_sntprintf(tszItemText, L"%s (%s)", jid, reason);
+ mir_snwprintf(tszItemText, L"%s (%s)", jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = XmlGetAttrValue(itemNode, L"nick");
if (nick != NULL) {
- mir_sntprintf(tszItemText, L"%s (%s)", nick, jid);
+ mir_snwprintf(tszItemText, L"%s (%s)", nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -131,7 +131,7 @@ static void sttFillJidList(HWND hwndDlg) if (filter && *filter && !JabberStrIStr(lvi.pszText, filter))
continue;
- lvi.lParam = (LPARAM)mir_tstrdup(jid);
+ lvi.lParam = (LPARAM)mir_wstrdup(jid);
ListView_InsertItem(hwndList, &lvi);
lvi.iItem++;
@@ -235,17 +235,17 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// Populate displayed list from iqNode
- mir_tstrncpy(title, TranslateT("JID List"), _countof(title));
+ mir_wstrncpy(title, TranslateT("JID List"), _countof(title));
if ((dat = (JABBER_MUC_JIDLIST_INFO *)lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
if (from != NULL) {
- dat->roomJid = mir_tstrdup(from);
+ dat->roomJid = mir_wstrdup(from);
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != NULL) {
- wchar_t *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, TranslateT("%s, %d items (%s)"),
+ wchar_t *localFrom = mir_wstrdup(from);
+ mir_snwprintf(title, TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -345,7 +345,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w //delete
wchar_t msgText[128];
- mir_sntprintf(msgText, TranslateT("Removing %s?"), text);
+ mir_snwprintf(msgText, TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO | MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (wchar_t*)lvi.lParam);
mir_free((void *)lvi.lParam);
@@ -484,7 +484,7 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE if (type == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
JABBER_MUC_JIDLIST_INFO *jidListInfo = new JABBER_MUC_JIDLIST_INFO;
if (jidListInfo != NULL) {
jidListInfo->type = listType;
diff --git a/protocols/JabberG/src/jabber_libstr.cpp b/protocols/JabberG/src/jabber_libstr.cpp index 24b13f8478..8c8ce64065 100644 --- a/protocols/JabberG/src/jabber_libstr.cpp +++ b/protocols/JabberG/src/jabber_libstr.cpp @@ -29,5 +29,5 @@ int lstrcmp_null(const wchar_t *s1, const wchar_t *s2) if (!s1 && !s2) return 0;
if (!s1) return -1;
if (!s2) return 1;
- return mir_tstrcmp(s1, s2);
+ return mir_wstrcmp(s1, s2);
}
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index 434bdd1028..1e4c95f77f 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -91,12 +91,12 @@ void CJabberProto::ListInit(void) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (isChatRoom(hContact)) {
- ptrT jid(getTStringA(hContact, "ChatRoomID"));
+ ptrW jid(getTStringA(hContact, "ChatRoomID"));
if (jid != NULL)
ListAdd(LIST_CHATROOM, jid, hContact);
}
else {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
ListAdd(LIST_ROSTER, jid, hContact);
}
@@ -127,7 +127,7 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const wchar_t *jid, MC return item;
}
- wchar_t *s = mir_tstrdup(jid);
+ wchar_t *s = mir_wstrdup(jid);
wchar_t *q = NULL;
// strip resource name if any
//fyr
@@ -244,7 +244,7 @@ pResourceStatus JABBER_LIST_ITEM::findResource(const wchar_t *resourceName) cons for (int i = 0; i < arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = arResources[i];
- if (!mir_tstrcmp(r->m_tszResourceName, resourceName))
+ if (!mir_wstrcmp(r->m_tszResourceName, resourceName))
return r;
}
@@ -282,7 +282,7 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta JABBER_RESOURCE_STATUS *r = LI->findResource(resource);
if (r != NULL) { // Already exists, update status and statusMessage
r->m_iStatus = status;
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
r->m_iPriority = priority;
}
else { // Does not exist, add new resource
@@ -291,10 +291,10 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta r->m_iStatus = status;
r->m_affiliation = AFFILIATION_NONE;
r->m_role = ROLE_NONE;
- r->m_tszResourceName = mir_tstrdup(resource);
- r->m_tszNick = mir_tstrdup(nick);
+ r->m_tszResourceName = mir_wstrdup(resource);
+ r->m_tszNick = mir_wstrdup(nick);
if (statusMessage)
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
r->m_iPriority = priority;
LI->arResources.insert(r);
}
@@ -303,7 +303,7 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int sta else {
JABBER_RESOURCE_STATUS *r = LI->getTemp();
r->m_iStatus = status;
- r->m_tszStatusMessage = mir_tstrdup(statusMessage);
+ r->m_tszStatusMessage = mir_wstrdup(statusMessage);
}
lck.unlock();
diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 29f145422c..f3184582eb 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -85,29 +85,29 @@ public: void Release();
int m_iStatus;
- ptrT m_tszResourceName;
- ptrT m_tszStatusMessage;
+ ptrW m_tszResourceName;
+ ptrW m_tszStatusMessage;
int m_iPriority; // resource priority, -128..+127
time_t m_dwIdleStartTime;// XEP-0012 support
// groupchat support
JABBER_GC_AFFILIATION m_affiliation;
JABBER_GC_ROLE m_role;
- ptrT m_tszNick;
- ptrT m_tszRealJid; // real jid for jabber conferences
+ ptrW m_tszNick;
+ ptrW m_tszRealJid; // real jid for jabber conferences
// XEP-0115 support
- ptrT m_tszCapsNode;
- ptrT m_tszCapsVer;
- ptrT m_tszCapsExt;
+ ptrW m_tszCapsNode;
+ ptrW m_tszCapsVer;
+ ptrW m_tszCapsExt;
DWORD m_dwVersionRequestTime, m_dwDiscoInfoRequestTime;
JabberCapsBits m_jcbCachedCaps;
JabberCapsBits m_jcbManualDiscoveredCaps;
// XEP-232 support
- ptrT m_tszOs, m_tszOsVersion;
- ptrT m_tszSoftware, m_tszSoftwareVersion, m_tszXMirandaCoreVersion;
+ ptrW m_tszOs, m_tszOsVersion;
+ ptrW m_tszSoftware, m_tszSoftwareVersion, m_tszXMirandaCoreVersion;
// XEP-0085 gone event support
BOOL m_bMessageSessionActive;
@@ -221,7 +221,7 @@ struct JABBER_HTTP_AVATARS MCONTACT hContact;
JABBER_HTTP_AVATARS(const wchar_t *tUrl, MCONTACT thContact)
- : Url(mir_t2a(tUrl)), hContact(thContact) {}
+ : Url(mir_u2a(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 3df1e3989d..512ec95593 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -374,7 +374,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool bIsTransport = getBool(hContact, "IsTransport", false);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- if (ptrT(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
+ if (ptrW(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
Menu_ShowItem(g_hMenuConvert, TRUE);
Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENW("&Convert to Contact") : LPGENW("&Convert to Chat Room"));
}
@@ -388,7 +388,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ModifyItem(g_hMenuDirectPresence[i + 1], NULL, Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode));
if (bIsChatRoom) {
- ptrT roomid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomid(getTStringA(hContact, "ChatRoomID"));
if (roomid != NULL) {
Menu_ShowItem(g_hMenuRosterAdd, FALSE);
@@ -406,7 +406,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hMenuRefresh, TRUE);
}
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -477,7 +477,7 @@ INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM hContact, LPARAM) BYTE bIsChatRoom = isChatRoom(hContact);
const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid";
- ptrT jid(getTStringA(hContact, szSetting));
+ ptrW jid(getTStringA(hContact, szSetting));
if (jid != NULL) {
delSetting(hContact, szSetting);
setTString(hContact, szSetting, jid);
@@ -491,21 +491,21 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) if (!hContact)
return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- ptrT roomID(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomID(getTStringA(hContact, "ChatRoomID"));
if (roomID == NULL)
return 0;
if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) {
- ptrT group(db_get_tsa(hContact, "CList", "Group"));
- ptrT nick(getTStringA(hContact, "Nick"));
+ ptrW group(db_get_tsa(hContact, "CList", "Group"));
+ ptrW nick(getTStringA(hContact, "Nick"));
AddContactToRoster(roomID, nick, group);
if (m_options.AddRoster2Bookmarks == TRUE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_BOOKMARK, roomID);
if (item == NULL) {
item = new JABBER_LIST_ITEM();
- item->jid = mir_tstrdup(roomID);
- item->name = mir_tstrdup(nick);
+ item->jid = mir_wstrdup(roomID);
+ item->name = mir_wstrdup(nick);
item->nick = getTStringA(hContact, "MyNick");
AddEditBookmark(item);
delete item;
@@ -518,7 +518,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribe"));
}
@@ -528,7 +528,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"subscribed"));
}
@@ -538,7 +538,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM hContact, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM hContact, LPARAM)
{
if (hContact != NULL && m_bJabberOnline) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", jid) << XATTR(L"type", L"unsubscribed"));
}
@@ -550,7 +550,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0))
return 0;
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (item != NULL) {
XmlNode p(L"presence"); XmlAddAttr(p, L"to", item->jid);
if (item->getTemp()->m_iStatus == ID_STATUS_ONLINE)
@@ -565,7 +565,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM hContact, LPARAM) if (!getByte(hContact, "IsTransport", 0))
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL)
ResolveTransportNicks(jid);
return 0;
@@ -576,13 +576,13 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) if (!hContact)
return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
- ptrT roomID(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomID(getTStringA(hContact, "ChatRoomID"));
if (roomID == NULL)
return 0;
if (ListGetItemPtr(LIST_BOOKMARK, roomID) == NULL) {
JABBER_LIST_ITEM *item = new JABBER_LIST_ITEM();
- item->jid = mir_tstrdup(roomID);
+ item->jid = mir_wstrdup(roomID);
item->name = pcli->pfnGetContactDisplayName(hContact, 0);
item->type = L"conference";
item->nick = getTStringA(hContact, "MyNick");
@@ -723,11 +723,11 @@ void CJabberProto::MenuInit() mir_snprintf(srvFce, "/menuSetPriority/%d", steps[i]);
if (steps[i] > 0) {
- mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
+ mir_snwprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
mi.hIcolibItem = GetIconHandle(IDI_ARROW_UP);
}
else {
- mir_sntprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
+ mir_snwprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
mi.hIcolibItem = GetIconHandle(IDI_ARROW_DOWN);
}
@@ -771,7 +771,7 @@ void CJabberProto::UpdatePriorityMenu(int priority) return;
wchar_t szName[128];
- mir_sntprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
+ mir_snwprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
Menu_ModifyItem(m_hMenuPriorityRoot, szName);
m_priorityMenuVal = priority;
@@ -941,7 +941,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) hDialogsList = WindowList_Create();
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
- ptrT jid(getTStringA(event->hContact, "jid"));
+ ptrW jid(getTStringA(event->hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid);
if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_options.EnableMsgArchive)
@@ -991,14 +991,14 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) if (!hContact)
return 0;
- JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrW(getTStringA(hContact, "jid")));
if (LI == NULL)
return 0;
HMENU hMenu = CreatePopupMenu();
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("Last active (%s)"),
+ mir_snwprintf(buf, TranslateT("Last active (%s)"),
LI->m_pLastSeenResource ? LI->m_pLastSeenResource->m_tszResourceName : TranslateT("No activity yet, use server's choice"));
AppendMenu(hMenu, MF_STRING, MENUITEM_LASTSEEN, buf);
@@ -1041,7 +1041,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM hContact, LPARAM, LPAR if (!m_bJabberOnline || !hContact)
return 0;
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL)
return 0;
@@ -1073,9 +1073,9 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM return 0;
wchar_t *jid, text[1024];
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL) {
- ptrT roomid(getTStringA(hContact, "ChatRoomID"));
+ ptrW roomid(getTStringA(hContact, "ChatRoomID"));
if (roomid == NULL)
return 0;
@@ -1083,7 +1083,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM if (item == NULL)
return 0;
- mir_sntprintf(text, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(text, L"%s/%s", item->jid, item->nick);
jid = text;
}
else jid = tszJid;
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index cb17a7fa13..b0ffaddade 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -36,7 +36,7 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI if (item != NULL) { // yes, it is
wchar_t *szErrText = JabberErrorMsg(pInfo->GetChildNode());
if (id != -1) {
- char *errText = mir_t2a(szErrText);
+ char *errText = mir_u2a(szErrText);
ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText);
mir_free(errText);
}
@@ -44,9 +44,9 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI 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);
+ mir_snwprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), XmlGetText(bodyNode), szErrText);
else
- mir_sntprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText);
+ mir_snwprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText);
MsgPopup(NULL, buf, TranslateT("Jabber Error"));
}
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index c6253582ae..99b853bca9 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -59,15 +59,15 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea LPCTSTR szType = XmlGetAttrValue(node, L"type");
if (szType) {
- if (!mir_tstrcmpi(szType, L"normal"))
+ if (!mir_wstrcmpi(szType, L"normal"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
- else if (!mir_tstrcmpi(szType, L"error"))
+ else if (!mir_wstrcmpi(szType, L"error"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_ERROR;
- else if (!mir_tstrcmpi(szType, L"chat"))
+ else if (!mir_wstrcmpi(szType, L"chat"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_CHAT;
- else if (!mir_tstrcmpi(szType, L"groupchat"))
+ else if (!mir_wstrcmpi(szType, L"groupchat"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_GROUPCHAT;
- else if (!mir_tstrcmpi(szType, L"headline"))
+ else if (!mir_wstrcmpi(szType, L"headline"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_HEADLINE;
else
return false;
@@ -82,7 +82,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea LPCTSTR szTagName = XmlGetName(child);
LPCTSTR szXmlns = XmlGetAttrValue(child, L"xmlns");
- if ((!pInfo.m_szXmlns || (szXmlns && !mir_tstrcmp(pInfo.m_szXmlns, szXmlns))) && (!pInfo.m_szTag || !mir_tstrcmp(pInfo.m_szTag, szTagName))) {
+ if ((!pInfo.m_szXmlns || (szXmlns && !mir_wstrcmp(pInfo.m_szXmlns, szXmlns))) && (!pInfo.m_szTag || !mir_wstrcmp(pInfo.m_szTag, szTagName))) {
// node suits handler criteria, call the handler
messageInfo.m_hChildNode = child;
messageInfo.m_szChildTagName = szTagName;
@@ -125,9 +125,9 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler( CJabberMessagePermanentInfo* pInfo = new CJabberMessagePermanentInfo();
pInfo->m_pHandler = pHandler;
pInfo->m_nMessageTypes = nMessageTypes ? nMessageTypes : JABBER_MESSAGE_TYPE_ANY;
- pInfo->m_szXmlns = mir_tstrdup(szXmlns);
+ pInfo->m_szXmlns = mir_wstrdup(szXmlns);
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- pInfo->m_szTag = mir_tstrdup(szTag);
+ pInfo->m_szTag = mir_wstrdup(szTag);
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 36d7eda517..ac90da7561 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -156,7 +156,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) 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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -176,15 +176,15 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t db_free(&dbv);
}
else _i64toa((LONG_PTR)hContact, str, 10);
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", JabberSha1(str, buf), szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", JabberSha1(str, buf), szFileType);
}
else if (m_ThreadInfo != NULL) {
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%s@%S avatar%s",
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%s@%S avatar%s",
m_ThreadInfo->conn.username, m_ThreadInfo->conn.server, szFileType);
}
else {
ptrA res1(getStringA("LoginName")), res2(getStringA("LoginServer"));
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S@%S avatar%s",
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S@%S avatar%s",
(res1) ? (LPSTR)res1 : "noname", (res2) ? (LPSTR)res2 : m_szModuleName, szFileType);
}
}
@@ -203,15 +203,15 @@ void CJabberProto::ResolveTransportNicks(const wchar_t *jid) if (!getByte(hContact, "IsTransported", 0))
continue;
- ptrT dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
- ptrT dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
+ ptrW dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
+ ptrW dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue;
wchar_t *p = wcschr(dbJid, '@');
if (p == NULL)
continue;
*p = 0;
- if (!mir_tstrcmp(jid, p + 1) && !mir_tstrcmp(dbJid, dbNick)) {
+ if (!mir_wstrcmp(jid, p + 1) && !mir_wstrcmp(dbJid, dbNick)) {
*p = '@';
m_ThreadInfo->resolveID = SendGetVcard(dbJid);
m_ThreadInfo->resolveContact = hContact;
@@ -379,15 +379,15 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) if (!tszMirVer.IsEmpty())
setTString(hContact, "MirVer", tszMirVer);
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return;
wchar_t szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !wcschr(jid, '/'))
- mir_sntprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName);
+ mir_snwprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName);
else
- mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
+ mir_wstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
@@ -438,7 +438,7 @@ void CJabberProto::SetContactOfflineStatus(MCONTACT hContact) void CJabberProto::InitPopups(void)
{
wchar_t desc[256];
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
char name[256];
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 58fd94594c..66f16d6f1a 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -35,10 +35,10 @@ static wchar_t* StrTrimCopy(wchar_t *str) {
if (!str) return 0;
while (*str && iswspace(*str)) ++str;
- if (!*str) return mir_tstrdup(str);
+ if (!*str) return mir_wstrdup(str);
- wchar_t *res = mir_tstrdup(str);
- for (wchar_t *p = res + mir_tstrlen(res) - 1; p >= res; --p) {
+ wchar_t *res = mir_wstrdup(str);
+ for (wchar_t *p = res + mir_wstrlen(res) - 1; p >= res; --p) {
if (iswspace(*p))
*p = 0;
else
@@ -85,8 +85,8 @@ void CNoteItem::SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *t m_szFrom = StrTrimCopy(from);
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));
+ wchar_t *p = m_szTags = (wchar_t *)mir_alloc((mir_wstrlen(szTags) + 2 /*for double zero*/) * sizeof(wchar_t));
+ wchar_t *q = m_szTagsStr = (wchar_t *)mir_alloc((mir_wstrlen(szTags) + 1) * sizeof(wchar_t));
for (; szTags && *szTags; ++szTags) {
if (iswspace(*szTags))
continue;
@@ -108,8 +108,8 @@ bool CNoteItem::HasTag(const wchar_t *szTag) if (!szTag || !*szTag)
return true;
- for (wchar_t *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1)
- if (!mir_tstrcmp(p, szTag))
+ for (wchar_t *p = m_szTags; p && *p; p = p + mir_wstrlen(p) + 1)
+ if (!mir_wstrcmp(p, szTag))
return true;
return false;
@@ -118,9 +118,9 @@ bool CNoteItem::HasTag(const wchar_t *szTag) int CNoteItem::cmp(const CNoteItem *p1, const CNoteItem *p2)
{
int ret = 0;
- if (ret = mir_tstrcmp(p1->m_szTitle, p2->m_szTitle)) return ret;
- if (ret = mir_tstrcmp(p1->m_szText, p2->m_szText)) return ret;
- if (ret = mir_tstrcmp(p1->m_szTagsStr, p2->m_szTagsStr)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szTitle, p2->m_szTitle)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szText, p2->m_szText)) return ret;
+ if (ret = mir_wstrcmp(p1->m_szTagsStr, p2->m_szTagsStr)) return ret;
if (p1 < p2) return -1;
if (p1 > p2) return 1;
return 0;
@@ -190,7 +190,7 @@ private: 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());
+ wchar_t *szFrom = mir_wstrdup(m_pNote->GetFrom());
m_pNote->SetData(szTitle, szFrom, szText, szTags);
mir_free(szTitle);
mir_free(szText);
@@ -375,7 +375,7 @@ public: SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
+ mir_snwprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rc.top += DrawText(hdc, buf, -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
rc.top += DrawText(hdc, pNote->GetText(), -1, &rc, DT_NOPREFIX | DT_WORDBREAK | DT_EXPANDTABS | DT_END_ELLIPSIS);
@@ -410,7 +410,7 @@ public: SelectObject(hdc, m_hfntNormal);
if (pNote->GetFrom()) {
wchar_t buf[256];
- mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
+ mir_snwprintf(buf, TranslateT("From: %s"), pNote->GetFrom());
rcTmp = rc;
DrawText(hdc, buf, -1, &rcTmp, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT);
lps->itemHeight += rcTmp.bottom;
@@ -473,7 +473,7 @@ private: tvi.hInsertAfter = TVI_LAST;
tvi.itemex.mask = TVIF_TEXT | TVIF_PARAM;
tvi.itemex.pszText = (wchar_t *)tag;
- tvi.itemex.lParam = (LPARAM)mir_tstrdup(tag);
+ tvi.itemex.lParam = (LPARAM)mir_wstrdup(tag);
HTREEITEM hti = m_tvFilter.InsertItem(&tvi);
if (bSelect) m_tvFilter.SelectItem(hti);
}
@@ -483,14 +483,14 @@ private: LIST<wchar_t> tagSet(5, wcscmp);
for (int i = 0; i < m_proto->m_notes.getCount(); i++) {
wchar_t *tags = m_proto->m_notes[i].GetTags();
- for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1)
+ for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_wstrlen(tag) + 1)
if (!tagSet.find(tag))
tagSet.insert(tag);
}
bool selected = false;
for (int j = 0; j < tagSet.getCount(); ++j) {
- bool select = !mir_tstrcmp(szActiveTag, tagSet[j]);
+ bool select = !mir_wstrcmp(szActiveTag, tagSet[j]);
selected |= select;
InsertTag(htiRoot, tagSet[j], select);
}
@@ -505,7 +505,7 @@ private: tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = m_tvFilter.GetSelection();
m_tvFilter.GetItem(&tvi);
- wchar_t *szActiveTag = mir_tstrdup((wchar_t *)tvi.lParam);
+ wchar_t *szActiveTag = mir_wstrdup((wchar_t *)tvi.lParam);
m_tvFilter.DeleteAllItems();
@@ -727,7 +727,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) }
wchar_t buf[1024];
- mir_sntprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
+ mir_snwprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s",
pNote->GetTitle(), pNote->GetText(), pNote->GetTagsStr());
JabberCapsBits jcb = GetResourceCapabilites(pNote->GetFrom(), TRUE);
@@ -815,7 +815,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM wParam, LPARAM)
{
if (wParam) {
- CNoteItem *pItem = new CNoteItem(NULL, ptrT(getTStringA(wParam, "jid")));
+ CNoteItem *pItem = new CNoteItem(NULL, ptrW(getTStringA(wParam, "jid")));
CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pItem, &CJabberProto::ProcessOutgoingNote);
pDlg->Show();
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 828b0a9648..66fb8e5e49 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -243,7 +243,7 @@ protected: void OnInitDialog()
{
wchar_t text[256];
- mir_sntprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port);
+ mir_snwprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port);
SetDlgItemText(m_hwnd, IDC_REG_STATUS, text);
}
@@ -331,7 +331,7 @@ CCtrlEditJid::CCtrlEditJid(CDlgBase* dlg, int ctrlId): static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlCombo &cbServer)
{
- ppro->setTString("jid", CMString(FORMAT, L"%s@%s", ptrT(txtUsername.GetText()), ptrT(cbServer.GetText())));
+ ppro->setTString("jid", CMString(FORMAT, L"%s@%s", ptrW(txtUsername.GetText()), ptrW(cbServer.GetText())));
}
class CDlgOptAccount : public CJabberDlgBase
@@ -444,7 +444,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- ptrT tszResource(m_proto->getTStringA("Resource"));
+ ptrW tszResource(m_proto->getTStringA("Resource"));
if (tszResource != NULL) {
if (CB_ERR == m_cbResource.FindString(tszResource, -1, true))
m_cbResource.AddString(tszResource);
@@ -454,7 +454,7 @@ protected: for (int i = 0; g_LanguageCodes[i].szCode; i++) {
int iItem = m_cbLocale.AddString(TranslateTS(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode);
- if (!mir_tstrcmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
+ if (!mir_wstrcmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
m_cbLocale.SetCurSel(iItem);
}
@@ -483,7 +483,7 @@ protected: m_proto->m_savedPassword = NULL;
if (m_chkSavePassword.GetState() == BST_CHECKED)
- m_proto->setTString("Password", ptrT(m_txtPassword.GetText()));
+ m_proto->setTString("Password", ptrW(m_txtPassword.GetText()));
else
m_proto->delSetting("Password");
@@ -494,7 +494,7 @@ protected: m_proto->setTString("XmlLang", szLanguageCode);
mir_free(m_proto->m_tszSelectedLang);
- m_proto->m_tszSelectedLang = mir_tstrdup(szLanguageCode);
+ m_proto->m_tszSelectedLang = mir_wstrdup(szLanguageCode);
}
}
@@ -697,7 +697,7 @@ private: if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"item"))
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
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) {
- wchar_t *buf = mir_a2t(result->pData);
+ wchar_t *buf = mir_a2u(result->pData);
XmlNode node(buf, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
@@ -1016,7 +1016,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) // now it is require to process whole contact list to add not in roster contacts
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT tszJid(getTStringA(hContact, "jid"));
+ ptrW tszJid(getTStringA(hContact, "jid"));
if (tszJid == NULL)
continue;
@@ -1029,8 +1029,8 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) if (p) *p = 0;
}
if (ListView_FindItem(hList, -1, &lvfi) == -1) {
- ptrT tszName(db_get_tsa(hContact, "CList", "MyHandle"));
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszName(db_get_tsa(hContact, "CList", "MyHandle"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
_RosterInsertListItem(hList, tszJid, tszName, tszGroup, NULL, FALSE);
}
}
@@ -1074,24 +1074,24 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) BOOL bPushed = itemRoster ? TRUE : FALSE;
if (!bPushed) {
const wchar_t *rosterName = XmlGetAttrValue(itemRoster, L"name");
- if ((rosterName != NULL || name[0] != 0) && mir_tstrcmpi(rosterName, name))
+ if ((rosterName != NULL || name[0] != 0) && mir_wstrcmpi(rosterName, name))
bPushed = TRUE;
if (!bPushed) {
rosterName = XmlGetAttrValue(itemRoster, L"subscription");
- if ((rosterName != NULL || subscr[0] != 0) && mir_tstrcmpi(rosterName, subscr))
+ if ((rosterName != NULL || subscr[0] != 0) && mir_wstrcmpi(rosterName, subscr))
bPushed = TRUE;
}
if (!bPushed) {
const wchar_t *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group"));
- if ((rosterGroup != NULL || group[0] != 0) && mir_tstrcmpi(rosterGroup, group))
+ if ((rosterGroup != NULL || group[0] != 0) && mir_wstrcmpi(rosterGroup, group))
bPushed = TRUE;
}
}
if (bPushed) {
HXML item = query << XCHILD(L"item");
- if (mir_tstrlen(group))
+ if (mir_wstrlen(group))
item << XCHILD(L"group", group);
- if (mir_tstrlen(name))
+ if (mir_wstrlen(name))
item << XATTR(L"name", name);
item << XATTR(L"jid", jid) << XATTR(L"subscription", subscr[0] ? subscr : L"none");
itemCount++;
@@ -1179,7 +1179,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) wchar_t filename[MAX_PATH] = { 0 };
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);
+ mir_snwprintf(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;
ofn.hwndOwner = hwndDlg;
@@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) fclose(fp);
_RosterListClear(hwndDlg);
- wchar_t *newBuf = mir_utf8decodeT(buffer);
+ wchar_t *newBuf = mir_utf8decodeW(buffer);
mir_free(buffer);
int nBytesProcessed = 0;
@@ -1295,15 +1295,15 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) HXML Cell = XmlGetNthChild(Row, L"Cell", 1);
HXML Data = (Cell) ? XmlGetChild(Cell, "Data") : XmlNode();
if (Data) {
- if (!mir_tstrcmpi(XmlGetText(Data), L"+")) bAdd = TRUE;
- else if (mir_tstrcmpi(XmlGetText(Data), L"-")) continue;
+ if (!mir_wstrcmpi(XmlGetText(Data), L"+")) bAdd = TRUE;
+ else if (mir_wstrcmpi(XmlGetText(Data), L"-")) continue;
Cell = XmlGetNthChild(Row, L"Cell", 2);
if (Cell) Data = XmlGetChild(Cell, "Data");
else Data = NULL;
if (Data) {
jid = XmlGetText(Data);
- if (!jid || mir_tstrlen(jid) == 0) continue;
+ if (!jid || mir_wstrlen(jid) == 0) continue;
}
Cell = XmlGetNthChild(Row, L"Cell", 3);
@@ -1588,7 +1588,7 @@ protected: if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- ptrT tszResource(m_proto->getTStringA("Resource"));
+ ptrW tszResource(m_proto->getTStringA("Resource"));
if (tszResource != NULL) {
if (CB_ERR == m_cbResource.FindString(tszResource, -1, true))
m_cbResource.AddString(tszResource);
@@ -1666,7 +1666,7 @@ protected: m_txtManualHost.Enable();
m_txtPort.Enable();
- ptrT dbManualHost(m_proto->getTStringA("ManualHost"));
+ ptrW dbManualHost(m_proto->getTStringA("ManualHost"));
if (dbManualHost != NULL)
m_txtManualHost.SetText(dbManualHost);
@@ -1708,7 +1708,7 @@ protected: DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
m_cbResource.GetText(szResource, _countof(szResource));
- if (!mir_tstrcmp(szCompName, szResource))
+ if (!mir_wstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
m_proto->m_options.HostNameAsResource = bUseHostnameAsResource;
@@ -2171,7 +2171,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"item"))
+ if (!mir_wstrcmp(XmlGetName(n), L"item"))
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) {
- wchar_t *ptszText = mir_a2t(result->pData);
+ wchar_t *ptszText = mir_a2u(result->pData);
XmlNode node(ptszText, NULL, NULL);
if (node) {
HXML queryNode = XmlGetChild(node, L"query");
@@ -2236,7 +2236,7 @@ INT_PTR __cdecl CJabberProto::OnMenuOptions(WPARAM, LPARAM) OPENOPTIONSDIALOG ood = { 0 };
ood.cbSize = sizeof(ood);
ood.pszGroup = "Network";
- ood.pszPage = mir_t2a(m_tszUserName);
+ ood.pszPage = mir_u2a(m_tszUserName);
ood.pszTab = "Account";
Options_Open(&ood);
@@ -2258,7 +2258,7 @@ int CJabberProto::OnModernOptInit(WPARAM, LPARAM) obj.hInstance = hInst;
obj.iSection = MODERNOPT_PAGE_ACCOUNTS;
obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE;
- obj.lptzSubsection = mir_a2t(m_szModuleName); // title!!!!!!!!!!!
+ obj.lptzSubsection = mir_a2u(m_szModuleName); // title!!!!!!!!!!!
obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT);
obj.iBoldControls = iBoldControls;
obj.pfnDlgProc = JabberWizardDlgProc;
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index e1b800afa2..97566fa22c 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -112,7 +112,7 @@ void CCtrlTreeOpts::OnInit() int sectionLevel = 0;
HTREEITEM hSection = NULL;
- mir_tstrcpy(itemName, m_options[i]->m_szOptionName);
+ mir_wstrcpy(itemName, m_options[i]->m_szOptionName);
sectionName = itemName;
while (sectionName) {
@@ -228,7 +228,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) CCtrlTreeOpts::COptionsItem::COptionsItem(wchar_t *szOption, CMOption<BYTE> &option) :
m_option(&option), m_groupId(OPTTREE_CHECK), m_hItem(NULL)
{
- m_szOptionName = mir_tstrdup(szOption);
+ m_szOptionName = mir_wstrdup(szOption);
}
CCtrlTreeOpts::COptionsItem::~COptionsItem()
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 54d1b74bdd..456c9e5d5b 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -50,7 +50,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR TranslateDialogDefault(hwndDlg);
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server);
+ mir_snwprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server);
SetWindowText(hwndDlg, text);
}
return TRUE;
@@ -61,16 +61,16 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR 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)) {
+ if (mir_wstrcmp(newPasswd, text)) {
MessageBox(hwndDlg, TranslateT("New password does not match."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, _countof(text));
- if (mir_tstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
+ if (mir_wstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- ppro->m_ThreadInfo->tszNewPassword = mir_tstrdup(newPasswd);
+ ppro->m_ThreadInfo->tszNewPassword = mir_wstrdup(newPasswd);
XmlNodeIq iq(ppro->AddIQ(&CJabberProto::OnIqResultSetPassword, JABBER_IQ_TYPE_SET, _A2T(ppro->m_ThreadInfo->conn.server)));
HXML q = iq << XQUERY(JABBER_FEAT_REGISTER);
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index ba3df4a5b0..8e9e009d1d 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -58,9 +58,9 @@ void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo) if (!pParam->m_dwCount) {
wchar_t szText[ 512 ];
if (!pParam->m_bAllOk)
- mir_sntprintf(szText, TranslateT("Error occurred while applying changes"));
+ mir_snwprintf(szText, TranslateT("Error occurred while applying changes"));
else
- mir_sntprintf(szText, TranslateT("Privacy lists successfully saved"));
+ mir_snwprintf(szText, TranslateT("Privacy lists successfully saved"));
if (m_pDlgPrivacyLists)
m_pDlgPrivacyLists->SetStatusText(szText);
// FIXME: enable apply button
@@ -77,7 +77,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) if (type == NULL)
return;
- if ( mir_tstrcmp(type, L"result"))
+ if ( mir_wstrcmp(type, L"result"))
return;
HXML query = XmlGetChild(iqNode , "query");
@@ -104,11 +104,11 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) const wchar_t *itemType = XmlGetAttrValue(item, L"type");
PrivacyListRuleType nItemType = Else;
if (itemType) {
- if (!mir_tstrcmpi(itemType, L"jid"))
+ if (!mir_wstrcmpi(itemType, L"jid"))
nItemType = Jid;
- else if (!mir_tstrcmpi(itemType, L"group"))
+ else if (!mir_wstrcmpi(itemType, L"group"))
nItemType = Group;
- else if (!mir_tstrcmpi(itemType, L"subscription"))
+ else if (!mir_wstrcmpi(itemType, L"subscription"))
nItemType = Subscription;
}
@@ -116,7 +116,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) const wchar_t *itemAction = XmlGetAttrValue(item, L"action");
BOOL bAllow = TRUE;
- if (itemAction && !mir_tstrcmpi(itemAction, L"deny"))
+ if (itemAction && !mir_wstrcmpi(itemAction, L"deny"))
bAllow = FALSE;
const wchar_t *itemOrder = XmlGetAttrValue(item, L"order");
@@ -185,7 +185,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo CMString szText;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
mir_cslock lck(m_privacyListManager.m_cs);
if (pList) {
m_privacyListManager.SetActiveListName(pList->GetListName());
@@ -222,18 +222,18 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInf szText[0] = 0;
{
mir_cslock lck(m_privacyListManager.m_cs);
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
CPrivacyList *pList = (CPrivacyList *)pInfo->GetUserData();
if (pList) {
m_privacyListManager.SetDefaultListName(pList->GetListName());
- mir_sntprintf(szText, TranslateT("Privacy list %s set as default"), pList->GetListName());
+ mir_snwprintf(szText, TranslateT("Privacy list %s set as default"), pList->GetListName());
}
else {
m_privacyListManager.SetDefaultListName(NULL);
- mir_sntprintf(szText, TranslateT("Default privacy list successfully declined"));
+ mir_snwprintf(szText, TranslateT("Default privacy list successfully declined"));
}
}
- else mir_sntprintf(szText, TranslateT("Error occurred while setting default list"));
+ else mir_snwprintf(szText, TranslateT("Error occurred while setting default list"));
}
if (m_pDlgPrivacyLists) {
@@ -423,7 +423,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0);
{
for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) {
- ptrT jid( m_proto->getTStringA(hContact, "jid"));
+ ptrW jid( m_proto->getTStringA(hContact, "jid"));
if (jid != NULL)
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, jid);
}
@@ -633,7 +633,7 @@ protected: HANDLE hItem;
wchar_t *jid;
- static int cmp(const TJidData *p1, const TJidData *p2) { return mir_tstrcmp(p1->jid, p2->jid); }
+ static int cmp(const TJidData *p1, const TJidData *p2) { return mir_wstrcmp(p1->jid, p2->jid); }
};
HANDLE hItemDefault;
@@ -661,7 +661,7 @@ protected: {
TJidData *data = (TJidData *)mir_alloc(sizeof(TJidData));
data->hItem = hItem;
- data->jid = mir_tstrdup(jid);
+ data->jid = mir_wstrdup(jid);
newJids.insert(data);
}
@@ -949,7 +949,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) for (i=0; i < _countof(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
- GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_tstrlen(drawItems[i].text), &sz);
+ GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_wstrlen(drawItems[i].text), &sz);
totalWidth += sz.cx + 18 + 5; // 18 pixels for icon, 5 pixel spacing
}
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) wchar_t szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, L"If group is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If group is '%s' then", pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, L"If subscription is '%s' then", pRule->GetValue());
+ mir_snwprintf(szTypeValue, L"If subscription is '%s' then", pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, L"Else");
+ mir_snwprintf(szTypeValue, L"Else");
break;
}
@@ -1011,29 +1011,29 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) if (!dwPackets)
dwPackets = JABBER_PL_RULE_TYPE_ALL;
if (dwPackets == JABBER_PL_RULE_TYPE_ALL)
- mir_tstrcpy(szPackets, L"all");
+ mir_wstrcpy(szPackets, L"all");
else {
if (dwPackets & JABBER_PL_RULE_TYPE_MESSAGE)
- mir_tstrcat(szPackets, L"messages");
+ mir_wstrcat(szPackets, L"messages");
if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_IN) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"presence-in");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"presence-in");
}
if (dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_OUT) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"presence-out");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"presence-out");
}
if (dwPackets & JABBER_PL_RULE_TYPE_IQ) {
- if (mir_tstrlen(szPackets))
- mir_tstrcat(szPackets, L", ");
- mir_tstrcat(szPackets, L"queries");
+ if (mir_wstrlen(szPackets))
+ mir_wstrcat(szPackets, L", ");
+ mir_wstrcat(szPackets, L"queries");
}
}
wchar_t szListItem[ 512 ];
- mir_sntprintf(szListItem, L"%s %s %s", szTypeValue, pRule->GetAction() ? L"allow" : L"deny", szPackets);
+ mir_snwprintf(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);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
@@ -1056,7 +1056,7 @@ void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const wch DrawText(hdc, text, -1, rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
SIZE sz;
- GetTextExtentPoint32(hdc, text, (int)mir_tstrlen(text), &sz);
+ GetTextExtentPoint32(hdc, text, (int)mir_wstrlen(text), &sz);
rc->left += sz.cx;
}
@@ -1248,8 +1248,8 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) szName = TranslateT("<none>");
}
else {
- if (!mir_tstrcmp(pList->GetListName(), szActive)) bActive = true;
- if (!mir_tstrcmp(pList->GetListName(), szDefault)) bDefault = true;
+ if (!mir_wstrcmp(pList->GetListName(), szActive)) bActive = true;
+ if (!mir_wstrcmp(pList->GetListName(), szDefault)) bDefault = true;
szName = pList->GetListName();
}
@@ -1385,10 +1385,10 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList) break;
case Subscription:
- if (!mir_tstrcmp(pRule->GetValue(), L"none")) hItem = clc_info.hItemSubNone;
- else if (!mir_tstrcmp(pRule->GetValue(), L"from")) hItem = clc_info.hItemSubFrom;
- else if (!mir_tstrcmp(pRule->GetValue(), L"to")) hItem = clc_info.hItemSubTo;
- else if (!mir_tstrcmp(pRule->GetValue(), L"both")) hItem = clc_info.hItemSubBoth;
+ if (!mir_wstrcmp(pRule->GetValue(), L"none")) hItem = clc_info.hItemSubNone;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"from")) hItem = clc_info.hItemSubFrom;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"to")) hItem = clc_info.hItemSubTo;
+ else if (!mir_wstrcmp(pRule->GetValue(), L"both")) hItem = clc_info.hItemSubBoth;
break;
case Else:
@@ -1462,7 +1462,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
hItem = m_clcClist.FindContact(hContact);
- ptrT jid( m_proto->getTStringA(hContact, "jid"));
+ ptrW jid( m_proto->getTStringA(hContact, "jid"));
if (jid == NULL)
if ((jid = m_proto->getTStringA(hContact, "ChatRoomID")) == NULL)
continue;
@@ -1837,7 +1837,7 @@ void CJabberDlgPrivacyLists::btnAddList_OnClick(CCtrlButton*) // FIXME: line length is hard coded in dialog procedure
CJabberDlgPrivacyAddList dlgPrivacyAddList(m_proto, m_hwnd);
int nRetVal = dlgPrivacyAddList.DoModal();
- if (nRetVal && mir_tstrlen(dlgPrivacyAddList.szLine)) {
+ if (nRetVal && mir_wstrlen(dlgPrivacyAddList.szLine)) {
mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
@@ -1870,8 +1870,8 @@ void CJabberDlgPrivacyLists::btnRemoveList_OnClick(CCtrlButton *) CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList) {
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())))
+ if ((m_proto->m_privacyListManager.GetActiveListName() && !mir_wstrcmp(szListName, m_proto->m_privacyListManager.GetActiveListName())) ||
+ (m_proto->m_privacyListManager.GetDefaultListName() && !mir_wstrcmp(szListName, m_proto->m_privacyListManager.GetDefaultListName())))
{
lck.unlock();
MessageBox(m_hwnd, TranslateT("Can't remove active or default list"), TranslateT("Sorry"), MB_OK | MB_ICONSTOP);
@@ -2148,7 +2148,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);
+ mir_wstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB);
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 67b8ce7e33..fc04a1d96f 100644 --- a/protocols/JabberG/src/jabber_privacy.h +++ b/protocols/JabberG/src/jabber_privacy.h @@ -61,7 +61,7 @@ public: 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);
+ m_szValue = mir_wstrdup(szValue);
m_nType = type;
m_bAction = bAction;
m_dwOrder = dwOrder;
@@ -109,7 +109,7 @@ public: }
__inline BOOL SetValue(wchar_t *szValue)
{
- replaceStrT(m_szValue, szValue);
+ replaceStrW(m_szValue, szValue);
return TRUE;
}
__inline DWORD GetPackets()
@@ -156,7 +156,7 @@ public: CPrivacyList(CJabberProto *ppro, wchar_t *szListName)
{
m_proto = ppro;
- m_szListName = mir_tstrdup(szListName);
+ m_szListName = mir_wstrdup(szListName);
m_pRules = NULL;
m_pNext = NULL;
m_bLoaded = FALSE;
@@ -344,11 +344,11 @@ public: };
void SetActiveListName(const wchar_t *szListName)
{
- replaceStrT(m_szActiveListName, szListName);
+ replaceStrW(m_szActiveListName, szListName);
}
void SetDefaultListName(const wchar_t *szListName)
{
- replaceStrT(m_szDefaultListName, szListName);
+ replaceStrW(m_szDefaultListName, szListName);
}
wchar_t* GetDefaultListName()
{
@@ -369,7 +369,7 @@ public: {
CPrivacyList *pList = m_pLists;
while (pList) {
- if (!mir_tstrcmp(pList->GetListName(), szListName))
+ if (!mir_wstrcmp(pList->GetListName(), szListName))
return pList;
pList = pList->GetNext();
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 2f847dd408..198a8231d0 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int compareTransports(const wchar_t *p1, const wchar_t *p2)
{
- return mir_tstrcmpi(p1, p2);
+ return mir_wstrcmpi(p1, p2);
}
static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM *p2)
@@ -44,12 +44,12 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * // resource must be used in the comparison
if ((p1->list == LIST_ROSTER && (p1->bUseResource == true || p2->bUseResource == true))
|| (p1->list == LIST_BOOKMARK) || (p1->list == LIST_VCARD_TEMP))
- return mir_tstrcmpi(p1->jid, p2->jid);
+ return mir_wstrcmpi(p1->jid, p2->jid);
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);
+ return mir_wstrcmpi(szp1, szp2);
}
CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
@@ -147,7 +147,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : db_set_resident(m_szModuleName, "Grant");
if ((m_tszSelectedLang = getTStringA("XmlLang")) == NULL)
- m_tszSelectedLang = mir_tstrdup(L"en");
+ m_tszSelectedLang = mir_wstrdup(L"en");
}
CJabberProto::~CJabberProto()
@@ -242,7 +242,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) SetContactOfflineStatus(hContact);
if (getByte(hContact, "IsTransport", 0)) {
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
continue;
@@ -250,7 +250,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) if (resourcepos != NULL)
*resourcepos = '\0';
- m_lstTransports.insert(mir_tstrdup(jid));
+ m_lstTransports.insert(mir_wstrdup(jid));
}
}
@@ -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;
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(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);
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
+ wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid);
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed"));
@@ -429,7 +429,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) debugLogA("Send 'authorization denied' to %s", jid);
- ptrT newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeT(jid) : mir_a2t(jid));
+ ptrW newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeW(jid) : mir_a2u(jid));
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"unsubscribed"));
return 0;
}
@@ -443,8 +443,8 @@ HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, return 0;
filetransfer *ft = (filetransfer*)hTransfer;
- ft->std.tszWorkingDir = mir_tstrdup(szPath);
- size_t len = mir_tstrlen(ft->std.tszWorkingDir)-1;
+ ft->std.tszWorkingDir = mir_wstrdup(szPath);
+ size_t len = mir_wstrlen(ft->std.tszWorkingDir)-1;
if (ft->std.tszWorkingDir[len] == '/' || ft->std.tszWorkingDir[len] == '\\')
ft->std.tszWorkingDir[len] = 0;
@@ -528,7 +528,7 @@ int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const wchar_ return 1;
if (*action == FILERESUME_RENAME)
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
SetEvent(ft->hWaitEvent);
return 0;
@@ -593,10 +593,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
- bool bHasResource = mir_tstrcmp(jid, szBareJid) != 0;
+ bool bHasResource = mir_wstrcmp(jid, szBareJid) != 0;
JABBER_LIST_ITEM *tmpItem = NULL;
if (bHasResource && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
- pResourceStatus him(tmpItem->findResource(szBareJid+mir_tstrlen(szBareJid)+1));
+ pResourceStatus him(tmpItem->findResource(szBareJid+mir_wstrlen(szBareJid)+1));
if (him) {
item = ListAdd(LIST_VCARD_TEMP, jid, hContact);
ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
@@ -610,7 +610,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) for (int i = 0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
wchar_t tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
+ mir_snwprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -624,7 +624,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) m_ThreadInfo->send(iq4);
}
- if (!mir_tstrcmp(tmp, jid)) {
+ if (!mir_wstrcmp(tmp, jid)) {
XmlNodeIq iq3(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM));
iq3 << XQUERY(JABBER_FEAT_LAST_ACTIVITY);
m_ThreadInfo->send(iq3);
@@ -679,7 +679,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) return 0;
if (wcschr(szJid, '@') == NULL) {
- wchar_t *szServer = mir_a2t(m_ThreadInfo->conn.server);
+ wchar_t *szServer = mir_a2u(m_ThreadInfo->conn.server);
const wchar_t *p = wcsstr(szJid, szServer);
if (p == NULL) {
bool numericjid = true;
@@ -689,12 +689,12 @@ HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) mir_free(szServer);
szServer = getTStringA(NULL, "LoginServer");
if (szServer == NULL)
- szServer = mir_tstrdup(L"jabber.org");
- else if (numericjid && !mir_tstrcmpi(szServer, L"S.ms")) {
+ szServer = mir_wstrdup(L"jabber.org");
+ else if (numericjid && !mir_wstrcmpi(szServer, L"S.ms")) {
mir_free(szServer);
- szServer = mir_tstrdup(L"sms");
+ szServer = mir_wstrdup(L"sms");
}
- mir_sntprintf(jsb->jid, L"%s@%s", szJid, szServer);
+ mir_snwprintf(jsb->jid, L"%s@%s", szJid, szServer);
}
else wcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -802,7 +802,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC HXML x = m << XCHILDNS(L"x", JABBER_FEAT_ROSTER_EXCHANGE);
for (int i = 0; i < nContacts; i++) {
- ptrT jid(getTStringA(hContactsList[i], "jid"));
+ ptrW jid(getTStringA(hContactsList[i], "jid"));
if (jid != NULL)
x << XCHILD(L"item") << XATTR(L"action", L"add") << XATTR(L"jid", jid);
}
@@ -822,7 +822,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -875,7 +875,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (_wstat64(ppszFiles[i], &statbuf))
debugLog(L"'%s' is an invalid filename", ppszFiles[i]);
else {
- ft->std.ptszFiles[j] = mir_tstrdup(ppszFiles[i]);
+ ft->std.ptszFiles[j] = mir_wstrdup(ppszFiles[i]);
ft->fileSize[j] = statbuf.st_size;
j++;
ft->std.totalBytes += statbuf.st_size;
@@ -886,9 +886,9 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri return NULL;
}
- ft->std.tszCurrentFile = mir_tstrdup(ppszFiles[0]);
- ft->szDescription = mir_tstrdup(szDescription);
- ft->jid = mir_tstrdup(jid);
+ ft->std.tszCurrentFile = mir_wstrdup(ppszFiles[0]);
+ ft->szDescription = mir_wstrdup(szDescription);
+ ft->jid = mir_wstrdup(jid);
if (jcb & JABBER_CAPS_SI_FT)
FtInitiate(item->jid, ft);
@@ -985,11 +985,11 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) // if client knows nothing about delivery
!(jcb & (JABBER_CAPS_MESSAGE_EVENTS | JABBER_CAPS_MESSAGE_RECEIPTS)) ||
// if message sent to groupchat
- !mir_tstrcmp(msgType, L"groupchat") ||
+ !mir_wstrcmp(msgType, L"groupchat") ||
// if message delivery check disabled in settings
!m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE))
{
- if (!mir_tstrcmp(msgType, L"groupchat"))
+ if (!mir_wstrcmp(msgType, L"groupchat"))
XmlAddAttr(m, L"to", szClientJid);
else {
id = SerialNext();
@@ -1031,7 +1031,7 @@ int __cdecl CJabberProto::SetApparentMode(MCONTACT hContact, int mode) if (!m_bJabberOnline)
return 0;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -1103,7 +1103,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) MCONTACT hContact = (DWORD_PTR)param;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
@@ -1115,7 +1115,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
msgCount++;
- len += (mir_tstrlen(r->m_tszResourceName) + mir_tstrlen(r->m_tszStatusMessage) + 8);
+ len += (mir_wstrlen(r->m_tszResourceName) + mir_wstrlen(r->m_tszStatusMessage) + 8);
}
}
@@ -1124,13 +1124,13 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
- if (str[0] != '\0') mir_tstrcat(str, L"\r\n");
+ if (str[0] != '\0') mir_wstrcat(str, L"\r\n");
if (msgCount > 1) {
- mir_tstrcat(str, L"(");
- mir_tstrcat(str, r->m_tszResourceName);
- mir_tstrcat(str, L"): ");
+ mir_wstrcat(str, L"(");
+ mir_wstrcat(str, r->m_tszResourceName);
+ mir_wstrcat(str, L"): ");
}
- mir_tstrcat(str, r->m_tszStatusMessage);
+ mir_wstrcat(str, r->m_tszStatusMessage);
}
}
@@ -1197,11 +1197,11 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const wchar_t *msg) return 1;
}
- if ((*szMsg == NULL && msg == NULL) || (*szMsg != NULL && msg != NULL && !mir_tstrcmp(*szMsg, msg)))
+ if ((*szMsg == NULL && msg == NULL) || (*szMsg != NULL && msg != NULL && !mir_wstrcmp(*szMsg, msg)))
return 0; // Message is the same, no update needed
// Update with the new mode message
- replaceStrT(*szMsg, msg);
+ replaceStrW(*szMsg, msg);
// Send a presence update if needed
lck.unlock();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index d1ee6abe76..f0e36b64ff 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -675,7 +675,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_thread.c ----------------------------------------------
- ptrT m_savedPassword;
+ ptrW m_savedPassword;
typedef struct {
bool isPlainAvailable;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index c4bd0161b9..6cfb672dd0 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -71,7 +71,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const w if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
- if (!mir_tstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!mir_wstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(L"result", pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(L"node", JABBER_FEAT_COMMANDS);
{
@@ -102,7 +102,7 @@ BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wc return FALSE;
// FIXME: same code twice
- if (!mir_tstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!mir_wstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(L"result", pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", JABBER_FEAT_COMMANDS);
resultQuery << XCHILD(L"identity") << XATTR(L"name", L"Ad-hoc commands")
@@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc // priority
wchar_t szPriority[ 256 ];
- mir_sntprintf(szPriority, L"%d", (int)getDword("Priority", 5));
+ mir_snwprintf(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((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
+ ptrW tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0));
if (tszStatusMsg)
fieldNode << XCHILD(L"value", tszStatusMsg);
@@ -346,13 +346,13 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
int status;
- if (!mir_tstrcmp(ptszValue, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(ptszValue, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(ptszValue, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(ptszValue, L"chat")) status = ID_STATUS_FREECHAT;
- else if (!mir_tstrcmp(ptszValue, L"online")) status = ID_STATUS_ONLINE;
- else if (!mir_tstrcmp(ptszValue, L"invisible")) status = ID_STATUS_INVISIBLE;
- else if (!mir_tstrcmp(ptszValue, L"offline")) status = ID_STATUS_OFFLINE;
+ if (!mir_wstrcmp(ptszValue, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(ptszValue, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(ptszValue, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(ptszValue, L"chat")) status = ID_STATUS_FREECHAT;
+ else if (!mir_wstrcmp(ptszValue, L"online")) status = ID_STATUS_ONLINE;
+ else if (!mir_wstrcmp(ptszValue, L"invisible")) status = ID_STATUS_INVISIBLE;
+ else if (!mir_wstrcmp(ptszValue, L"offline")) status = ID_STATUS_OFFLINE;
else
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // Automatically Accept File Transfers
wchar_t szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_snwprintf(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);
// Use sounds
- mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_snwprintf(szTmpBuff, L"%d", db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Play sounds"))
<< XATTR(L"type", L"boolean") << XATTR(L"var", L"sounds") << XCHILD(L"value", szTmpBuff);
@@ -465,7 +465,7 @@ int CJabberProto::RcGetUnreadEventsCount() {
int nEventsSent = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrW jid( getTStringA(hContact, "jid"));
if (jid == NULL) continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, TranslateT("There is no messages to forward"));
+ mir_snwprintf(szMsg, TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe xNode << XCHILD(L"title", TranslateT("Forward options"));
- mir_sntprintf(szMsg, TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_snwprintf(szMsg, TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(L"instructions", szMsg);
xNode << XCHILD(L"field") << XATTR(L"type", L"hidden") << XATTR(L"var", L"FORM_TYPE")
@@ -551,7 +551,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe int nEventsSent = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrT tszJid( getTStringA(hContact, "jid"));
+ ptrW tszJid( getTStringA(hContact, "jid"));
if (tszJid == NULL)
continue;
@@ -569,7 +569,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT)))
continue;
- ptrT szEventText( DbGetEventTextT(&dbei, CP_ACP));
+ ptrW szEventText( DbGetEventTextT(&dbei, CP_ACP));
if (szEventText == NULL)
continue;
@@ -582,8 +582,8 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe 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);
+ ptrW szOResource( mir_utf8decodeW((LPSTR)dbei.pBlob + cbBlob+1));
+ mir_snwprintf(szOFrom, L"%s/%s", tszJid, szOResource);
} else
wcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
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,
+ mir_snwprintf(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);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe }
}
- mir_sntprintf(szMsg, TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_snwprintf(szMsg, TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes wchar_t szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, TranslateT("Workstation successfully locked"));
+ mir_snwprintf(szMsg, TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_snwprintf(szMsg, TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (!nChatsCount) {
wchar_t szMsg[ 1024 ];
- mir_sntprintf(szMsg, TranslateT("There is no group chats to leave"));
+ mir_snwprintf(szMsg, TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(L"result", pInfo)
@@ -763,7 +763,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (fieldNode) {
for (i=0; i < XmlGetChildCount(fieldNode); i++) {
HXML valueNode = XmlGetChild(fieldNode, i);
- if (valueNode && XmlGetName(valueNode) && XmlGetText(valueNode) && !mir_tstrcmp(XmlGetName(valueNode), L"value")) {
+ if (valueNode && XmlGetName(valueNode) && XmlGetText(valueNode) && !mir_wstrcmp(XmlGetName(valueNode), L"value")) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, XmlGetText(valueNode));
if (item)
GcQuit(item, 0, NULL);
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index aa5306e381..fd4a6664d9 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -112,9 +112,9 @@ public: 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);
- replaceStrT(m_szNode, szNode);
- replaceStrT(m_szName, szName);
+ replaceStrW(m_szJid, szJid);
+ replaceStrW(m_szNode, szNode);
+ replaceStrW(m_szName, szName);
m_pHandler = pHandler;
m_pProto = pProto;
}
@@ -169,7 +169,7 @@ protected: {
CJabberAdhocSession* pSession = m_pSessions;
while (pSession) {
- if (!mir_tstrcmp(pSession->GetSessionId(), szSession))
+ if (!mir_wstrcmp(pSession->GetSessionId(), szSession))
return pSession;
pSession = pSession->GetNext();
}
@@ -192,7 +192,7 @@ protected: {
CJabberAdhocNode* pNode = m_pNodes;
while (pNode) {
- if (!mir_tstrcmp(pNode->GetNode(), szNode))
+ if (!mir_wstrcmp(pNode->GetNode(), szNode))
return pNode;
pNode = pNode->GetNext();
}
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index c1d3795688..69f3c6f3ee 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -141,7 +141,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) if (type == NULL) return; - if (!mir_tstrcmp(type, L"result")) { + if (!mir_wstrcmp(type, L"result")) { HXML queryNode = XmlGetNthChild(iqNode, L"query", 1); HXML xNode = XmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS); @@ -160,15 +160,15 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) if (!chNode) break; - if (!mir_tstrcmpi(XmlGetName(chNode), L"instructions") && XmlGetText(chNode)) + if (!mir_wstrcmpi(XmlGetName(chNode), L"instructions") && XmlGetText(chNode)) SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateTS(XmlGetText(chNode))); else if (XmlGetName(chNode)) { Data *MyData = (Data*)malloc(sizeof(Data)); memset(MyData, 0, sizeof(Data)); - MyData->Label = mir_tstrdup(XmlGetName(chNode)); - MyData->Var = mir_tstrdup(XmlGetName(chNode)); - MyData->defValue = mir_tstrdup(XmlGetText(chNode)); + MyData->Label = mir_wstrdup(XmlGetName(chNode)); + MyData->Var = mir_wstrdup(XmlGetName(chNode)); + MyData->defValue = mir_wstrdup(XmlGetText(chNode)); MyData->Order = Order; if (MyData->defValue) MyData->bReadOnly = TRUE; PostMessage(searchHandleDlg, WM_USER + 10, FALSE, (LPARAM)MyData); @@ -183,7 +183,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) PostMessage(searchHandleDlg, WM_USER + 10, 0, 0); ShowWindow(searchHandleDlg, SW_SHOW); } - else if (!mir_tstrcmp(type, L"error")) { + else if (!mir_wstrcmp(type, L"error")) { const wchar_t *code = NULL; const wchar_t *description = NULL; wchar_t buff[255]; @@ -192,7 +192,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) code = XmlGetAttrValue(errorNode, L"code"); description = XmlGetText(errorNode); } - mir_sntprintf(buff, TranslateT("Error %s %s\r\nPlease select other server"), code ? code : L"", description ? description : L""); + mir_snwprintf(buff, TranslateT("Error %s %s\r\nPlease select other server"), code ? code : L"", description ? description : L""); SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); } else SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateT("Error: unknown reply received\r\nPlease select other server")); @@ -261,7 +261,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M 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) + if (!mir_wstrcmpi(var, L"jid") && value) Results.psr.id.w = value; } @@ -270,8 +270,8 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M nick = pmUserData->operator [](nickfields[k]); if (nick) { - if (mir_tstrcmpi(nick, Results.psr.id.w)) - mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.w); + if (mir_wstrcmpi(nick, Results.psr.id.w)) + mir_snwprintf(buff, L"%s (%s)", nick, Results.psr.id.w); else wcsncpy_s(buff, nick, _TRUNCATE); @@ -293,7 +293,7 @@ void DestroyKey(wchar_t* key) wchar_t* CopyKey(wchar_t* key) { - return mir_tstrdup(key); + return mir_wstrdup(key); } //////////////////////////////////////////////////////////////////////////////// @@ -312,7 +312,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) return; } - if (!mir_tstrcmp(type, L"result")) { + if (!mir_wstrcmp(type, L"result")) { HXML queryNode = XmlGetNthChild(iqNode, L"query", 1); HXML xNode = XmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS); if (xNode) { @@ -379,7 +379,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) } } } - else if (!mir_tstrcmp(type, L"error")) { + else if (!mir_wstrcmp(type, L"error")) { const wchar_t *code = NULL; const wchar_t *description = NULL; wchar_t buff[255]; @@ -389,7 +389,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) description = XmlGetText(errorNode); } - mir_sntprintf(buff, TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : L"", description ? description : L""); + mir_snwprintf(buff, TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : L"", description ? description : L""); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0); if (searchHandleDlg) SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, buff); @@ -494,8 +494,8 @@ void CJabberProto::SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLast for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrT szValue(getTStringA(key)); - if (szValue == NULL || mir_tstrcmpi(szAddr, szValue)) + ptrW szValue(getTStringA(key)); + if (szValue == NULL || mir_wstrcmpi(szAddr, szValue)) continue; for (int j = i; j < 10; j++) { @@ -524,7 +524,7 @@ void CJabberProto::SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog) for (int j = 9; j > 0; j--) { mir_snprintf(key, "RecentlySearched_%d", j - 1); - ptrT szValue(getTStringA(key)); + ptrW szValue(getTStringA(key)); if (szValue != NULL) { mir_snprintf(key, "RecentlySearched_%d", j); setTString(NULL, key, szValue); @@ -564,7 +564,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR for (i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); - ptrT szValue(dat->ppro->getTStringA(key)); + ptrW szValue(dat->ppro->getTStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); } @@ -714,8 +714,8 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent) { if (parent && hInst) { - ptrT szServer(getTStringA("LoginServer")); - if (szServer == NULL || mir_tstrcmpi(szServer, L"S.ms")) + ptrW szServer(getTStringA("LoginServer")); + if (szServer == NULL || mir_wstrcmpi(szServer, L"S.ms")) return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this); } diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h index cf3f053728..34eee4d1bc 100644 --- a/protocols/JabberG/src/jabber_search.h +++ b/protocols/JabberG/src/jabber_search.h @@ -262,5 +262,5 @@ public: inline int TCharKeyCmp(wchar_t* a, wchar_t* b)
{
- return (int)(mir_tstrcmpi(a,b));
+ return (int)(mir_wstrcmpi(a,b));
}
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 447e15edd1..6508672e41 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -78,8 +78,8 @@ bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) else return false;
if (szHostName && szHostName[0]) {
- wchar_t *szFullUserNameU = wcsupr(mir_tstrdup(szFullUserName));
- mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU);
+ wchar_t *szFullUserNameU = wcsupr(mir_wstrdup(szFullUserName));
+ mir_snwprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU);
mir_free(szFullUserNameU);
}
else {
@@ -90,8 +90,8 @@ bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) if (host && host->h_name)
connectHost = host->h_name;
- wchar_t *connectHostT = mir_a2t(connectHost);
- mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName));
+ wchar_t *connectHostT = mir_a2u(connectHost);
+ mir_snwprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName));
mir_free(connectHostT);
}
@@ -116,7 +116,7 @@ char* TNtlmAuth::getChallenge(const wchar_t *challenge) if (!hProvider)
return NULL;
- ptrA text((!mir_tstrcmp(challenge, L"=")) ? mir_strdup("") : mir_t2a(challenge));
+ ptrA text((!mir_wstrcmp(challenge, L"=")) ? mir_strdup("") : mir_u2a(challenge));
if (info->conn.password[0] != 0)
return Netlib_NtlmCreateResponse2(hProvider, text, info->conn.username, info->conn.password, &complete);
@@ -261,7 +261,7 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) if (snonce == NULL || salt == NULL || ind == -1)
return NULL;
- ptrA passw(mir_utf8encodeT(info->conn.password));
+ ptrA passw(mir_utf8encodeW(info->conn.password));
size_t passwLen = mir_strlen(passw);
BYTE saltedPassw[MIR_SHA1_HASH_SIZE];
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 521d4eaa08..9d5553db8f 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -65,7 +65,7 @@ INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) }
if (szStatus)
- return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szStatus) : (INT_PTR)mir_t2a(szStatus);
+ return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(szStatus) : (INT_PTR)mir_u2a(szStatus);
return 0;
}
@@ -144,7 +144,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) }
if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL && m_bJabberOnline) {
- ptrT tszJid( getTStringA(pai->hContact, "jid"));
+ ptrW tszJid( getTStringA(pai->hContact, "jid"));
if (tszJid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, tszJid);
if (item != NULL) {
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) wchar_t szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (wchar_t *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, L"%s/%s", tszJid, bestResName);
+ mir_snwprintf(szJid, L"%s/%s", tszJid, bestResName);
if (szJid[0] == 0)
wcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -181,7 +181,7 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam) if (pdbEvent->dbei->cbBlob > 0) {
if (pdbEvent->dbei->pBlob[0] == JABBER_DB_EVENT_CHATSTATES_GONE) {
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("closed chat session"));
+ return (INT_PTR)mir_wstrdup(TranslateT("closed chat session"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("closed chat session"));
}
@@ -200,42 +200,42 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextPresence(WPARAM, LPARAM lParam) switch (pdbEvent->dbei->pBlob[0]) {
case JABBER_DB_EVENT_PRESENCE_SUBSCRIBE:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent subscription request"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent subscription request"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent subscription request"));
break;
case JABBER_DB_EVENT_PRESENCE_SUBSCRIBED:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("approved subscription request"));
+ return (INT_PTR)mir_wstrdup(TranslateT("approved subscription request"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("approved subscription request"));
break;
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("declined subscription"));
+ return (INT_PTR)mir_wstrdup(TranslateT("declined subscription"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("declined subscription"));
break;
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("declined subscription"));
+ return (INT_PTR)mir_wstrdup(TranslateT("declined subscription"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("declined subscription"));
break;
case JABBER_DB_EVENT_PRESENCE_ERROR:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent error presence"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent error presence"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent error presence"));
break;
default:
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("sent unknown presence type"));
+ return (INT_PTR)mir_wstrdup(TranslateT("sent unknown presence type"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("sent unknown presence type"));
break;
@@ -317,7 +317,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam)
{
- wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam);
+ wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_wstrdup((WCHAR*)lParam) : mir_a2u((char*)lParam);
setTString("Nick", nickname);
SetServerVcard(FALSE, L"");
@@ -347,7 +347,7 @@ static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t out.AppendFormat(L"<b>%s</b>\t%s", TranslateTS(tszTitle), tszValue);
else {
wchar_t *p = TranslateTS(tszTitle);
- out.AppendFormat(L"%s%s\t%s", p, mir_tstrlen(p) <= 7 ? L"\t" : L"", tszValue);
+ out.AppendFormat(L"%s%s\t%s", p, mir_wstrlen(p) <= 7 ? L"\t" : L"", tszValue);
}
}
@@ -398,7 +398,7 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara if (info->m_tszRealJid)
appendString(bIsTipper, LPGENW("Real JID:"), info->m_tszRealJid, outBuf);
- return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_tstrdup(outBuf));
+ return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_wstrdup(outBuf));
}
// File Association Manager plugin support
@@ -434,7 +434,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) *(szSecondParam++) = 0;
// no command or message command
- if (!szCommand || (szCommand && !mir_tstrcmpi(szCommand, L"message"))) {
+ if (!szCommand || (szCommand && !mir_wstrcmpi(szCommand, L"message"))) {
// message
if (!ServiceExists(MS_MSG_SENDMESSAGEW))
return 1;
@@ -461,7 +461,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) return 0;
}
- if (!mir_tstrcmpi(szCommand, L"roster")) {
+ if (!mir_wstrcmpi(szCommand, L"roster")) {
if (!HContactFromJID(szJid)) {
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
@@ -479,19 +479,19 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) }
// chat join invitation
- if (!mir_tstrcmpi(szCommand, L"join")) {
+ if (!mir_wstrcmpi(szCommand, L"join")) {
GroupchatJoinRoomByJid(NULL, szJid);
return 0;
}
// service discovery request
- if (!mir_tstrcmpi(szCommand, L"disco")) {
+ if (!mir_wstrcmpi(szCommand, L"disco")) {
OnMenuHandleServiceDiscovery(0, (LPARAM)szJid);
return 0;
}
// ad-hoc commands
- if (!mir_tstrcmpi(szCommand, L"command")) {
+ if (!mir_wstrcmpi(szCommand, L"command")) {
if (szSecondParam) {
if (!wcsnicmp(szSecondParam, L"node=", 5)) {
szSecondParam += 5;
@@ -506,7 +506,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) }
// send file
- if (!mir_tstrcmpi(szCommand, L"sendfile")) {
+ if (!mir_wstrcmpi(szCommand, L"sendfile")) {
MCONTACT hContact = HContactFromJID(szJid, false);
if (hContact == NULL)
hContact = DBCreateContact(szJid, szJid, true, true);
@@ -525,14 +525,14 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (!m_bJabberOnline)
return 0;
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrW jid( getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
wchar_t tszJid[JABBER_MAX_JID_LEN];
wchar_t *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, L"%s/%s", jid, szResource);
+ mir_snwprintf(tszJid, L"%s/%s", jid, szResource);
else
wcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 074476651f..bc3486fdf5 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -77,7 +77,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
wchar_t text[512];
- mir_sntprintf(text, TranslateT("Enter password for %s"), param->ptszJid);
+ mir_snwprintf(text, TranslateT("Enter password for %s"), param->ptszJid);
SetDlgItemText(hwndDlg, IDC_JID, text);
CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, param->pro->getByte("SaveSessionPassword", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -217,7 +217,7 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData *info) void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam)
{
- ptrT tszValue;
+ ptrW tszValue;
ThreadData info(this, pParam);
@@ -248,7 +248,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) if ((tszValue = getTStringA("LoginName")) != NULL)
wcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
- if (*rtrimt(info.conn.username) == '\0') {
+ if (*rtrimw(info.conn.username) == '\0') {
DWORD dwSize = _countof(info.conn.username);
if (GetUserName(info.conn.username, &dwSize))
setTString("LoginName", info.conn.username);
@@ -256,7 +256,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) info.conn.username[0] = 0;
}
- if (*rtrimt(info.conn.username) == '\0') {
+ if (*rtrimw(info.conn.username) == '\0') {
debugLogA("Thread ended, login name is not configured");
JLoginFailed(LOGINERR_BADUSERID);
@@ -279,17 +279,17 @@ LBL_FatalError: if (m_options.HostNameAsResource) {
DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
- mir_tstrcpy(info.resource, L"Miranda");
+ mir_wstrcpy(info.resource, L"Miranda");
}
else {
if ((tszValue = getTStringA("Resource")) != NULL)
wcsncpy_s(info.resource, tszValue, _TRUNCATE);
else
- mir_tstrcpy(info.resource, L"Miranda");
+ mir_wstrcpy(info.resource, L"Miranda");
}
wchar_t jidStr[512];
- mir_sntprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
+ mir_snwprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
wcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -298,7 +298,7 @@ LBL_FatalError: if (m_savedPassword != NULL)
wcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server);
+ mir_snwprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -314,12 +314,12 @@ LBL_FatalError: goto LBL_FatalError;
}
- m_savedPassword = (param.saveOnlinePassword) ? mir_tstrdup(param.onlinePassword) : NULL;
+ m_savedPassword = (param.saveOnlinePassword) ? mir_wstrdup(param.onlinePassword) : NULL;
wcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE);
}
}
else {
- ptrT tszPassw(getTStringA(NULL, "Password"));
+ ptrW tszPassw(getTStringA(NULL, "Password"));
if (tszPassw == NULL) {
JLoginFailed(LOGINERR_BADUSERID);
debugLogA("Thread ended, password is not configured");
@@ -390,9 +390,9 @@ LBL_FatalError: // User may change status to OFFLINE while we are connecting above
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;
+ size_t len = mir_wstrlen(info.conn.username) + mir_strlen(info.conn.server) + 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);
+ mir_snwprintf(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
@@ -439,7 +439,7 @@ LBL_FatalError: recvRest:
info.buffer[datalen] = '\0';
- ptrT str(mir_utf8decodeW(info.buffer));
+ ptrW str(mir_utf8decodeW(info.buffer));
int bytesParsed = 0;
XmlNode root(str, &bytesParsed, tag);
@@ -569,13 +569,13 @@ void CJabberProto::PerformIqAuth(ThreadData *info) void CJabberProto::OnProcessStreamOpening(HXML node, ThreadData *info)
{
- if (mir_tstrcmp(XmlGetName(node), L"stream:stream"))
+ if (mir_wstrcmp(XmlGetName(node), L"stream:stream"))
return;
if (!info->bIsReg) {
const wchar_t *sid = XmlGetAttrValue(node, L"id");
if (sid != NULL)
- info->szStreamId = mir_t2a(sid);
+ info->szStreamId = mir_u2a(sid);
}
// old server - disable SASL then
@@ -654,7 +654,7 @@ void CJabberProto::PerformAuthentication(ThreadData *info) }
wchar_t text[1024];
- mir_sntprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server);
+ mir_snwprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server);
MsgPopup(NULL, text, TranslateT("Jabber Authentication"));
JLoginFailed(LOGINERR_WRONGPASSWORD);
info->send("</stream:stream>");
@@ -682,29 +682,29 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) if (!n)
break;
- if (!mir_tstrcmp(XmlGetName(n), L"starttls")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"starttls")) {
if (!info->conn.useSSL && m_options.UseTLS) {
debugLogA("Requesting TLS");
info->send(XmlNode(XmlGetName(n)) << XATTR(L"xmlns", L"urn:ietf:params:xml:ns:xmpp-tls"));
return;
} }
- if (!mir_tstrcmp(XmlGetName(n), L"compression") && m_options.EnableZlib == TRUE) {
+ if (!mir_wstrcmp(XmlGetName(n), L"compression") && m_options.EnableZlib == TRUE) {
debugLogA("Server compression available");
for (int k = 0;; k++) {
HXML c = XmlGetChild(n, k);
if (!c)
break;
- if (!mir_tstrcmp(XmlGetName(c), L"method")) {
- if (!mir_tstrcmp(XmlGetText(c), L"zlib") && info->zlibInit() == TRUE) {
+ if (!mir_wstrcmp(XmlGetName(c), L"method")) {
+ if (!mir_wstrcmp(XmlGetText(c), L"zlib") && info->zlibInit() == TRUE) {
debugLogA("Requesting Zlib compression");
info->send(XmlNode(L"compress") << XATTR(L"xmlns", L"http://jabber.org/protocol/compress")
<< XCHILD(L"method", L"zlib"));
return;
} } } }
- if (!mir_tstrcmp(XmlGetName(n), L"mechanisms")) {
+ if (!mir_wstrcmp(XmlGetName(n), L"mechanisms")) {
m_AuthMechs.isPlainAvailable = false;
m_AuthMechs.isPlainOldAvailable = false;
m_AuthMechs.isMd5Available = false;
@@ -721,26 +721,26 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) if (!c)
break;
- if (!mir_tstrcmp(XmlGetName(c), L"mechanism")) {
+ if (!mir_wstrcmp(XmlGetName(c), L"mechanism")) {
LPCTSTR ptszMechanism = XmlGetText(c);
- if (!mir_tstrcmp(ptszMechanism, L"PLAIN")) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"DIGEST-MD5")) m_AuthMechs.isMd5Available = true;
- else if (!mir_tstrcmp(ptszMechanism, L"SCRAM-SHA-1")) m_AuthMechs.isScramAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"NTLM")) m_AuthMechs.isNtlmAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"GSS-SPNEGO")) m_AuthMechs.isSpnegoAvailable = true;
- else if (!mir_tstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true;
+ if (!mir_wstrcmp(ptszMechanism, L"PLAIN")) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"DIGEST-MD5")) m_AuthMechs.isMd5Available = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"SCRAM-SHA-1")) m_AuthMechs.isScramAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"NTLM")) m_AuthMechs.isNtlmAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"GSS-SPNEGO")) m_AuthMechs.isSpnegoAvailable = true;
+ else if (!mir_wstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true;
}
- else if (!mir_tstrcmp(XmlGetName(c), L"hostname")) {
+ else if (!mir_wstrcmp(XmlGetName(c), L"hostname")) {
const wchar_t *mech = XmlGetAttrValue(c, L"mechanism");
- if (mech && mir_tstrcmpi(mech, L"GSSAPI") == 0) {
- m_AuthMechs.m_gssapiHostName = mir_tstrdup(XmlGetText(c));
+ if (mech && mir_wstrcmpi(mech, L"GSSAPI") == 0) {
+ m_AuthMechs.m_gssapiHostName = mir_wstrdup(XmlGetText(c));
}
}
}
}
- else if (!mir_tstrcmp(XmlGetName(n), L"register")) isRegisterAvailable = true;
- else if (!mir_tstrcmp(XmlGetName(n), L"auth")) m_AuthMechs.isAuthAvailable = true;
- else if (!mir_tstrcmp(XmlGetName(n), L"session")) m_AuthMechs.isSessionAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"register")) isRegisterAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"auth")) m_AuthMechs.isAuthAvailable = true;
+ else if (!mir_wstrcmp(XmlGetName(n), L"session")) m_AuthMechs.isSessionAvailable = true;
}
if (areMechanismsDefined) {
@@ -773,7 +773,7 @@ void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) 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")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
PerformAuthentication(info);
}
}
@@ -799,13 +799,13 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) 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);
+ pos += mir_snwprintf(buff + pos, 1024 - pos, L"%s: %s\r\n", name, desc);
else
- pos += mir_sntprintf(buff + pos, 1024 - pos, L"%s\r\n", name);
+ pos += mir_snwprintf(buff + pos, 1024 - pos, L"%s\r\n", name);
- if (!mir_tstrcmp(name, L"conflict"))
+ if (!mir_wstrcmp(name, L"conflict"))
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- else if (!mir_tstrcmp(name, L"see-other-host")) {
+ else if (!mir_wstrcmp(name, L"see-other-host")) {
skipMsg = true;
}
}
@@ -823,14 +823,14 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData *info) if ((type = XmlGetAttrValue(node, L"xmlns")) == NULL)
return;
- if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) {
if (!info->auth->validateLogin(XmlGetText(node))) {
info->send("</stream:stream>");
return;
}
debugLogA("Success: Logged-in.");
- ptrT tszNick(getTStringA("Nick"));
+ ptrW tszNick(getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", info->conn.username);
@@ -846,7 +846,7 @@ void CJabberProto::OnProcessChallenge(HXML node, ThreadData *info) return;
}
- if (mir_tstrcmp(XmlGetAttrValue(node, L"xmlns"), L"urn:ietf:params:xml:ns:xmpp-sasl"))
+ if (mir_wstrcmp(XmlGetAttrValue(node, L"xmlns"), L"urn:ietf:params:xml:ns:xmpp-sasl"))
return;
char* challenge = info->auth->getChallenge(XmlGetText(node));
@@ -858,34 +858,34 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) {
OnConsoleProcessXml(node, JCPF_IN);
- if (!mir_tstrcmp(XmlGetName(node), L"proceed"))
+ if (!mir_wstrcmp(XmlGetName(node), L"proceed"))
OnProcessProceed(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"compressed"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"compressed"))
OnProcessCompressed(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:features"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:features"))
OnProcessFeatures(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:stream"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:stream"))
OnProcessStreamOpening(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"success"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"success"))
OnProcessSuccess(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"failure"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"failure"))
OnProcessFailure(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"stream:error"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"stream:error"))
OnProcessError(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"challenge"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"challenge"))
OnProcessChallenge(node, info);
else if (!info->bIsReg) {
- if (!mir_tstrcmp(XmlGetName(node), L"message"))
+ if (!mir_wstrcmp(XmlGetName(node), L"message"))
OnProcessMessage(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"presence"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"presence"))
OnProcessPresence(node, info);
- else if (!mir_tstrcmp(XmlGetName(node), L"iq"))
+ else if (!mir_wstrcmp(XmlGetName(node), L"iq"))
OnProcessIq(node);
else
debugLogA("Invalid top-level tag (only <message/> <presence/> and <iq/> allowed)");
}
else {
- if (!mir_tstrcmp(XmlGetName(node), L"iq"))
+ if (!mir_wstrcmp(XmlGetName(node), L"iq"))
OnProcessRegIq(node, info);
else
debugLogA("Invalid top-level tag (only <iq/> allowed)");
@@ -895,10 +895,10 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) void CJabberProto::OnProcessProceed(HXML node, ThreadData *info)
{
const wchar_t *type;
- if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_tstrcmp(type, L"error"))
+ if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_wstrcmp(type, L"error"))
return;
- if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-tls")) {
+ if (!mir_wstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-tls")) {
debugLogA("Starting TLS...");
char* gtlk = strstr(info->conn.manualHost, "google.com");
@@ -923,9 +923,9 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) debugLogA("Compression confirmed");
const wchar_t *type = XmlGetAttrValue(node, L"xmlns");
- if (type != NULL && !mir_tstrcmp(type, L"error"))
+ if (type != NULL && !mir_wstrcmp(type, L"error"))
return;
- if (mir_tstrcmp(type, L"http://jabber.org/protocol/compress"))
+ if (mir_wstrcmp(type, L"http://jabber.org/protocol/compress"))
return;
debugLogA("Starting Zlib stream compression...");
@@ -974,7 +974,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) szLengthInTime[0] = 0;
if (szLength) {
int nLength = _wtoi(szLength);
- mir_sntprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60);
+ mir_snwprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
SetContactTune(hContact, szArtist, szLength ? szLengthInTime : NULL, szSource, szTitle, szTrack);
@@ -1006,7 +1006,7 @@ DWORD JabberGetLastContactMessageTime(MCONTACT hContact) MCONTACT CJabberProto::CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem)
{
if (chatItem == NULL)
- return DBCreateContact(szJid, ptrT(JabberNickFromJID(szJid)), true, true);
+ return DBCreateContact(szJid, ptrW(JabberNickFromJID(szJid)), true, true);
const wchar_t *p = wcschr(szJid, '/');
if (p != NULL && p[1] != '\0')
@@ -1026,7 +1026,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) {
HXML xNode, n;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"message"))
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message"))
return;
LPCTSTR from, type = XmlGetAttrValue(node, L"type");
@@ -1037,7 +1037,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) pResourceStatus pFromResource(ResourceInfoFromJID(from));
// Message receipts delivery request. Reply here, before a call to HandleMessagePermanent() to make sure message receipts are handled for external plugins too.
- if ((!type || mir_tstrcmpi(type, L"error")) && XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
+ if ((!type || mir_wstrcmpi(type, L"error")) && XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
info->send(
XmlNode(L"message") << XATTR(L"to", from) << XATTR(L"id", idStr)
<< XCHILDNS(L"received", JABBER_FEAT_MESSAGE_RECEIPTS) << XATTR(L"id", idStr));
@@ -1067,15 +1067,15 @@ 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;
+ size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszSubject) + 128;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t) * cbLen);
szTmp[0] = 0;
if (szMessage)
- mir_tstrcat(szTmp, L"Subject: ");
- mir_tstrcat(szTmp, ptszSubject);
+ mir_wstrcat(szTmp, L"Subject: ");
+ mir_wstrcat(szTmp, ptszSubject);
if (szMessage) {
- mir_tstrcat(szTmp, L"\r\n");
- mir_tstrcat(szTmp, szMessage);
+ mir_wstrcat(szTmp, L"\r\n");
+ mir_wstrcat(szTmp, szMessage);
}
szMessage = szTmp;
}
@@ -1085,9 +1085,9 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (addressNode) {
const wchar_t *szJid = XmlGetAttrValue(addressNode, L"jid");
if (szJid) {
- size_t cbLen = mir_tstrlen(szMessage) + 1000;
+ size_t cbLen = mir_wstrlen(szMessage) + 1000;
wchar_t *p = (wchar_t*)alloca(sizeof(wchar_t) * cbLen);
- mir_sntprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage);
+ mir_snwprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage);
szMessage = p;
from = szJid;
// rewrite hContact
@@ -1173,13 +1173,13 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) memset(pParams, 0, sizeof(CJabberHttpAuthParams));
pParams->m_nType = CJabberHttpAuthParams::MSG;
- pParams->m_szFrom = mir_tstrdup(from);
+ pParams->m_szFrom = mir_wstrdup(from);
LPCTSTR ptszThread = XmlGetText(XmlGetChild(node, "thread"));
if (ptszThread && *ptszThread)
- pParams->m_szThreadId = mir_tstrdup(ptszThread);
- pParams->m_szId = mir_tstrdup(szId);
- pParams->m_szMethod = mir_tstrdup(szMethod);
- pParams->m_szUrl = mir_tstrdup(szUrl);
+ pParams->m_szThreadId = mir_wstrdup(ptszThread);
+ pParams->m_szId = mir_wstrdup(szId);
+ pParams->m_szMethod = mir_wstrdup(szMethod);
+ pParams->m_szUrl = mir_wstrdup(szUrl);
AddClistHttpAuthEvent(pParams);
return;
@@ -1194,11 +1194,11 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (ptszXmlns == NULL)
continue;
- if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
+ if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
if (OnIncomingNote(from, XmlGetChild(xNode, "note")))
return;
}
- else if (!mir_tstrcmp(ptszXmlns, L"jabber:x:encrypted")) {
+ else if (!mir_wstrcmp(ptszXmlns, L"jabber:x:encrypted")) {
LPCTSTR ptszText = XmlGetText(xNode);
if (ptszText == NULL)
return;
@@ -1213,25 +1213,25 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) wchar_t *tempstring = nullptr;
if(!wcsstr(ptszText, prolog))
{
- len = mir_tstrlen(prolog) + mir_tstrlen(prolog_newline) + mir_tstrlen(ptszText) + mir_tstrlen(epilog) + 3;
+ len = mir_wstrlen(prolog) + mir_wstrlen(prolog_newline) + mir_wstrlen(ptszText) + mir_wstrlen(epilog) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
- mir_sntprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
+ mir_snwprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
}
else
{
- len = mir_tstrlen(ptszText) + 3;
+ len = mir_wstrlen(ptszText) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
- mir_sntprintf(tempstring, len, L"%s", ptszText);
+ mir_snwprintf(tempstring, len, L"%s", ptszText);
}
szMessage = tempstring;
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
const wchar_t *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp");
if (ptszTimeStamp != NULL)
msgTime = JabberIsoToUnixTime(ptszTimeStamp);
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
// set events support only if we discovered caps and if events not already set
JabberCapsBits jcbCaps = GetResourceCapabilites(from, TRUE);
@@ -1275,24 +1275,24 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (item != NULL && XmlGetChild(xNode, "composing") != NULL) {
if (item->messageEventIdStr)
mir_free(item->messageEventIdStr);
- item->messageEventIdStr = (idStr == NULL) ? NULL : mir_tstrdup(idStr);
+ item->messageEventIdStr = (idStr == NULL) ? NULL : mir_wstrdup(idStr);
}
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_OOB2)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OOB2)) {
LPCTSTR ptszUrl = XmlGetText(XmlGetChild(xNode, "url"));
if (ptszUrl != NULL && *ptszUrl) {
- size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszUrl) + 32;
+ size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszUrl) + 32;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t)* cbLen);
- mir_tstrcpy(szTmp, ptszUrl);
+ mir_wstrcpy(szTmp, ptszUrl);
if (szMessage) {
- mir_tstrcat(szTmp, L"\r\n");
- mir_tstrcat(szTmp, szMessage);
+ mir_wstrcat(szTmp, L"\r\n");
+ mir_wstrcat(szTmp, szMessage);
}
szMessage = szTmp;
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_MUC_USER)) {
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_MUC_USER)) {
HXML inviteNode = XmlGetChild(xNode, L"invite");
if (inviteNode != NULL) {
inviteFromJid = XmlGetAttrValue(inviteNode, L"from");
@@ -1304,7 +1304,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) invitePassword = XmlGetText(XmlGetChild(xNode, "password"));
}
}
- else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
+ else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
wchar_t chkJID[JABBER_MAX_JID_LEN] = L"@";
JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
@@ -1318,12 +1318,12 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) 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")) {
+ if (!mir_wstrcmp(action, L"add")) {
MCONTACT cc = DBCreateContact(jid, nick, false, false);
if (group)
db_set_ts(cc, "CList", "Group", group);
}
- else if (!mir_tstrcmp(action, L"delete")) {
+ else if (!mir_wstrcmp(action, L"delete")) {
MCONTACT cc = HContactFromJID(jid);
if (cc)
CallService(MS_DB_CONTACT_DELETE, cc, 0);
@@ -1331,7 +1331,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
}
}
- else if (!isChatRoomInvitation && !mir_tstrcmp(ptszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
+ else if (!isChatRoomInvitation && !mir_wstrcmp(ptszXmlns, JABBER_FEAT_DIRECT_MUC_INVITE)) {
inviteRoomJid = XmlGetAttrValue(xNode, L"jid");
inviteFromJid = from;
if (inviteReason == NULL)
@@ -1422,9 +1422,9 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML 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);
- r->m_tszCapsExt = mir_tstrdup(szExt);
+ r->m_tszCapsNode = mir_wstrdup(szNode);
+ r->m_tszCapsVer = mir_wstrdup(szVer);
+ r->m_tszCapsExt = mir_wstrdup(szExt);
MCONTACT hContact = HContactFromJID(from);
if (hContact)
UpdateMirVer(hContact, r);
@@ -1497,7 +1497,7 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) void CJabberProto::OnProcessPresence(HXML node, ThreadData *info)
{
- if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence"))
+ if (!node || !XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"presence"))
return;
LPCTSTR from = XmlGetAttrValue(node, L"from");
@@ -1519,17 +1519,17 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) wchar_t szBareOurJid[JABBER_MAX_JID_LEN];
JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
- if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
+ if (!mir_wstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = true;
LPCTSTR type = XmlGetAttrValue(node, L"type");
- if (type == NULL || !mir_tstrcmp(type, L"available")) {
- ptrT nick(JabberNickFromJID(from));
+ if (type == NULL || !mir_wstrcmp(type, L"available")) {
+ ptrW nick(JabberNickFromJID(from));
if (nick == NULL)
return;
if ((hContact = HContactFromJID(from)) == NULL) {
- if (!mir_tstrcmpi(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
+ if (!mir_wstrcmpi(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
debugLog(L"SKIP Receive presence online from %s (who is not in my roster and not in list - skiping)", from);
return;
}
@@ -1543,10 +1543,10 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) int status = ID_STATUS_ONLINE;
if (HXML showNode = XmlGetChild(node, "show")) {
if (LPCTSTR show = XmlGetText(showNode)) {
- if (!mir_tstrcmp(show, L"away")) status = ID_STATUS_AWAY;
- else if (!mir_tstrcmp(show, L"xa")) status = ID_STATUS_NA;
- else if (!mir_tstrcmp(show, L"dnd")) status = ID_STATUS_DND;
- else if (!mir_tstrcmp(show, L"chat")) status = ID_STATUS_FREECHAT;
+ if (!mir_wstrcmp(show, L"away")) status = ID_STATUS_AWAY;
+ else if (!mir_wstrcmp(show, L"xa")) status = ID_STATUS_NA;
+ else if (!mir_wstrcmp(show, L"dnd")) status = ID_STATUS_DND;
+ else if (!mir_wstrcmp(show, L"chat")) status = ID_STATUS_FREECHAT;
}
}
@@ -1572,15 +1572,15 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("Avatar enabled");
for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"jabber:x:avatar")) {
+ if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"jabber:x:avatar")) {
LPCTSTR ptszHash = XmlGetText(XmlGetChild(xNode, "hash"));
if (ptszHash != NULL) {
delSetting(hContact, "AvatarXVcard");
debugLogA("AvatarXVcard deleted");
setTString(hContact, "AvatarHash", ptszHash);
bHasAvatar = true;
- ptrT saved(getTStringA(hContact, "AvatarSaved"));
- if (saved == NULL || mir_tstrcmp(saved, ptszHash)) {
+ ptrW saved(getTStringA(hContact, "AvatarSaved"));
+ if (saved == NULL || mir_wstrcmp(saved, ptszHash)) {
debugLogA("Avatar was changed");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
@@ -1591,7 +1591,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (!bHasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
debugLogA("Not hasXAvatar");
for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != NULL; i++) {
- if (!mir_tstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"vcard-temp:x:update")) {
+ if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"vcard-temp:x:update")) {
if ((xNode = XmlGetChild(xNode, "photo")) != NULL) {
LPCTSTR txt = XmlGetText(xNode);
if (txt != NULL && txt[0] != 0) {
@@ -1599,8 +1599,8 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("AvatarXVcard set");
setTString(hContact, "AvatarHash", txt);
bHasAvatar = true;
- ptrT saved(getTStringA(hContact, "AvatarSaved"));
- if (saved == NULL || mir_tstrcmp(saved, txt)) {
+ ptrW saved(getTStringA(hContact, "AvatarSaved"));
+ if (saved == NULL || mir_wstrcmp(saved, txt)) {
debugLogA("Avatar was changed. Using vcard-temp:x:update");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
@@ -1612,14 +1612,14 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
- if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) {
+ if (ptrW(getTStringA(hContact, "AvatarSaved")) != NULL) {
delSetting(hContact, "AvatarSaved");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL);
} } }
return;
}
- if (!mir_tstrcmp(type, L"unavailable")) {
+ if (!mir_wstrcmp(type, L"unavailable")) {
hContact = HContactFromJID(from);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, from);
if (item != NULL) {
@@ -1636,7 +1636,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) // set status only if no more available resources
if (!item->arResources.getCount()) {
item->getTemp()->m_iStatus = ID_STATUS_OFFLINE;
- item->getTemp()->m_tszStatusMessage = mir_tstrdup(XmlGetText(XmlGetChild(node, "status")));
+ item->getTemp()->m_tszStatusMessage = mir_wstrdup(XmlGetText(XmlGetChild(node, "status")));
}
}
else debugLog(L"SKIP Receive presence offline from %s (who is not in my roster)", from);
@@ -1650,17 +1650,17 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) return;
}
- if (!mir_tstrcmp(type, L"subscribe")) {
+ if (!mir_wstrcmp(type, L"subscribe")) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBE);
- ptrT tszNick(JabberNickFromJID(from));
+ ptrW tszNick(JabberNickFromJID(from));
HXML xNick = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
if (xNick != NULL) {
LPCTSTR xszNick = XmlGetText(xNick);
if (xszNick != NULL && *xszNick) {
debugLog(L"Grabbed nick from presence: %s", xszNick);
- tszNick = mir_tstrdup(xszNick);
+ tszNick = mir_wstrdup(xszNick);
}
}
@@ -1690,19 +1690,19 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) return;
}
- if (!mir_tstrcmp(type, L"unsubscribe"))
+ if (!mir_wstrcmp(type, L"unsubscribe"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE);
- if (!mir_tstrcmp(type, L"unsubscribed"))
+ if (!mir_wstrcmp(type, L"unsubscribed"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED);
- if (!mir_tstrcmp(type, L"error"))
+ if (!mir_wstrcmp(type, L"error"))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_ERROR);
- if (!mir_tstrcmp(type, L"subscribed")) {
+ if (!mir_wstrcmp(type, L"subscribed")) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBED);
@@ -1736,11 +1736,11 @@ void CJabberProto::OnIqResultVersion(HXML /*node*/, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT && queryNode) {
HXML n;
if ((n = XmlGetChild(queryNode, "name")) != NULL && XmlGetText(n))
- r->m_tszSoftware = mir_tstrdup(XmlGetText(n));
+ r->m_tszSoftware = mir_wstrdup(XmlGetText(n));
if ((n = XmlGetChild(queryNode, "version")) != NULL && XmlGetText(n))
- r->m_tszSoftwareVersion = mir_tstrdup(XmlGetText(n));
+ r->m_tszSoftwareVersion = mir_wstrdup(XmlGetText(n));
if ((n = XmlGetChild(queryNode, "os")) != NULL && XmlGetText(n))
- r->m_tszOs = mir_tstrdup(XmlGetText(n));
+ r->m_tszOs = mir_wstrdup(XmlGetText(n));
}
GetResourceCapabilites(pInfo->GetFrom(), TRUE);
@@ -1757,11 +1757,11 @@ BOOL CJabberProto::OnProcessJingle(HXML node) if (child) {
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return FALSE;
- if ((!mir_tstrcmp(type, L"get") || !mir_tstrcmp(type, L"set"))) {
+ if ((!mir_wstrcmp(type, L"get") || !mir_wstrcmp(type, L"set"))) {
LPCTSTR szAction = XmlGetAttrValue(child, L"action");
LPCTSTR idStr = XmlGetAttrValue(node, L"id");
LPCTSTR from = XmlGetAttrValue(node, L"from");
- if (szAction && !mir_tstrcmp(szAction, L"session-initiate")) {
+ if (szAction && !mir_wstrcmp(szAction, L"session-initiate")) {
// if this is a Jingle 'session-initiate' and noone processed it yet, reply with "unsupported-applications"
m_ThreadInfo->send(XmlNodeIq(L"result", idStr, from));
@@ -1801,7 +1801,7 @@ void CJabberProto::OnProcessIq(HXML node) HXML queryNode;
const wchar_t *type, *xmlns;
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"iq")) return;
if ((type = XmlGetAttrValue(node, L"type")) == NULL) return;
int id = JabberGetPacketID(node);
@@ -1822,7 +1822,7 @@ void CJabberProto::OnProcessIq(HXML node) return;
// RECVED: <iq type='error'> ...
- if (!mir_tstrcmp(type, L"error")) {
+ if (!mir_wstrcmp(type, L"error")) {
wchar_t tszBuf[20];
_itow(id, tszBuf, 10);
@@ -1831,7 +1831,7 @@ void CJabberProto::OnProcessIq(HXML node) LISTFOREACH(i, this, LIST_FILE)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
- if (item->ft != NULL && item->ft->state == FT_CONNECTING && !mir_tstrcmp(tszBuf, item->ft->szId)) {
+ if (item->ft != NULL && item->ft->state == FT_CONNECTING && !mir_wstrcmp(tszBuf, item->ft->szId)) {
debugLogA("Denying file sending request");
item->ft->state = FT_DENIED;
if (item->ft->hFileEvent != NULL)
@@ -1839,7 +1839,7 @@ void CJabberProto::OnProcessIq(HXML node) }
}
}
- else if ((!mir_tstrcmp(type, L"get") || !mir_tstrcmp(type, L"set"))) {
+ else if ((!mir_wstrcmp(type, L"get") || !mir_wstrcmp(type, L"set"))) {
XmlNodeIq iq(L"error", id, XmlGetAttrValue(node, L"from"));
HXML pFirstChild = XmlGetChild(node, 0);
@@ -1857,7 +1857,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from) {
if (m_regInfo && from) {
wchar_t text[MAX_PATH];
- mir_sntprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
+ mir_snwprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from);
iq << XATTR(L"from", text);
HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
@@ -1868,7 +1868,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from) void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info)
{
- if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return;
+ if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"iq")) return;
LPCTSTR type = XmlGetAttrValue(node, L"type");
if (type == NULL)
return;
@@ -1879,17 +1879,17 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) if (from == NULL)
return;
- if (!mir_tstrcmp(type, L"result")) {
+ if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(node, L"query");
if (queryNode != NULL) {
LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_REGISTER)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_REGISTER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != NULL) {
str = XmlGetAttrValue(xNode, L"xmlns");
- if (!mir_tstrcmp(str, JABBER_FEAT_DATA_FORMS)) {
+ if (!mir_wstrcmp(str, JABBER_FEAT_DATA_FORMS)) {
m_regInfo = info;
- FormCreateDialog(xNode, L"Jabber register new user", &CJabberProto::SetRegConfig, mir_tstrdup(from));
+ FormCreateDialog(xNode, L"Jabber register new user", &CJabberProto::SetRegConfig, mir_wstrdup(from));
return;
}
}
@@ -1917,7 +1917,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) }
}
- else if (!mir_tstrcmp(type, L"error")) {
+ else if (!mir_wstrcmp(type, L"error")) {
wchar_t *str = JabberErrorMsg(XmlGetChild(node, "error"));
SendMessage(info->conn.reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
mir_free(str);
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index c3d2bdb878..2321ee9b3f 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -183,7 +183,7 @@ void TreeList_SetFilter(HWND hwnd, wchar_t *filter) TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
if (data->filter) mir_free(data->filter);
data->filter = NULL;
- if (filter) data->filter = mir_tstrdup(filter);
+ if (filter) data->filter = mir_wstrdup(filter);
TreeList_Update(hwnd);
}
@@ -207,7 +207,7 @@ HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, TTreeList_ItemInfo *item = new TTreeList_ItemInfo;
item->data = nodeDdata;
item->parent = hParent;
- item->text.insert(mir_tstrdup(text));
+ item->text.insert(mir_wstrdup(text));
item->flags |= TLIF_MODIFIED;
if (hParent->flags & TLIF_ROOT) {
item->flags |= TLIF_EXPANDED;
@@ -241,7 +241,7 @@ void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag) void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text)
{
- hItem->text.insert(mir_tstrdup(text));
+ hItem->text.insert(mir_wstrdup(text));
hItem->flags |= TLIF_MODIFIED;
}
@@ -469,12 +469,12 @@ BOOL TreeList_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, UINT id }
///////////////////////////////////////////////////////////////////////////
-static int sttTreeList_SortItems_Cmp0(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
-static int sttTreeList_SortItems_Cmp1(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
-static int sttTreeList_SortItems_Cmp2(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
-static int sttTreeList_SortItems_Cmp3(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
-static int sttTreeList_SortItems_Cmp4(const void *p1, const void *p2) { return mir_tstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
-static int sttTreeList_SortItems_Cmp5(const void *p1, const void *p2) { return -mir_tstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
+static int sttTreeList_SortItems_Cmp0(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
+static int sttTreeList_SortItems_Cmp1(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[0], (*(HTREELISTITEM *)p2)->text[0]); }
+static int sttTreeList_SortItems_Cmp2(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
+static int sttTreeList_SortItems_Cmp3(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[1], (*(HTREELISTITEM *)p2)->text[1]); }
+static int sttTreeList_SortItems_Cmp4(const void *p1, const void *p2) { return mir_wstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
+static int sttTreeList_SortItems_Cmp5(const void *p1, const void *p2) { return -mir_wstrcmp((*(HTREELISTITEM *)p1)->text[2], (*(HTREELISTITEM *)p2)->text[2]); }
static void sttTreeList_SortItems(HTREELISTITEM hItem, LPARAM data)
{
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 6b0907a7b3..4a0f6e0046 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -46,12 +46,12 @@ struct UserInfoStringBuf void append(wchar_t *str) { if (!str) return; - size_t length = mir_tstrlen(str); + size_t length = mir_wstrlen(str); if (size - offset < length + 1) { size += (length + STRINGBUF_INCREMENT); buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } - mir_tstrcpy(buf + offset, str); + mir_wstrcpy(buf + offset, str); offset += length; } @@ -64,7 +64,7 @@ struct UserInfoStringBuf } void actualize() { - if (buf) offset = mir_tstrlen(buf); + if (buf) offset = mir_wstrlen(buf); } }; @@ -174,9 +174,9 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, wchar_t buf[256]; if (title) - mir_sntprintf(buf, L"%s: %s", title, value); + mir_snwprintf(buf, L"%s: %s", title, value); else - mir_tstrncpy(buf, value, _countof(buf)); + mir_wstrncpy(buf, value, _countof(buf)); TVINSERTSTRUCT tvis = {0}; tvis.hParent = htiRoot; @@ -227,7 +227,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti HICON hIcon = NULL; if ( ServiceExists(MS_FP_GETCLIENTICONT)) { if (r->m_tszSoftware != NULL) { - mir_sntprintf(buf, L"%s %s", r->m_tszSoftware, r->m_tszSoftwareVersion); + mir_snwprintf(buf, L"%s %s", r->m_tszSoftware, r->m_tszSoftwareVersion); hIcon = Finger_GetClientIcon(buf, 0); } } @@ -251,25 +251,25 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // Resource priority wchar_t szPriority[128]; - mir_sntprintf(szPriority, L"%d", (int)r->m_iPriority); + mir_snwprintf(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, _wctime(&r->m_dwIdleStartTime), _countof(buf)); - size_t len = mir_tstrlen(buf); + mir_wstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); + size_t len = mir_wstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE)); // caps - mir_sntprintf(buf, L"%s/%s", item->jid, r->m_tszResourceName); + mir_snwprintf(buf, L"%s/%s", item->jid, r->m_tszResourceName); JabberCapsBits jcb = ppro->GetResourceCapabilites(buf, TRUE); if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) { @@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & g_JabberFeatCapPairs[i].jcbCap) { wchar_t szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) - mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); + mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else wcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { 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); + mir_snwprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else wcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -320,7 +320,7 @@ static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM ht if (szAdvStatusIcon && szAdvStatusTitle && *szAdvStatusTitle) { wchar_t szText[2048]; if (szAdvStatusText && *szAdvStatusText) - mir_sntprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); + mir_snwprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); else wcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, IcoLib_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); @@ -365,15 +365,15 @@ 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, _wctime(&r->m_dwIdleStartTime), _countof(buf)); - size_t len = mir_tstrlen(buf); + mir_wstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); + size_t len = mir_wstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, (item->jid && wcschr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, @@ -384,9 +384,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // activity if (item->m_pLastSeenResource) - mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); + mir_wstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); + mir_wstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf, sttInfoLineId(0, INFOLINE_LASTACTIVE)); @@ -470,7 +470,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if (dat == NULL) break; if (dat->item == NULL) { - ptrT jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); if (jid == NULL) break; @@ -560,7 +560,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case PSN_PARAMCHANGED: dat->ppro = (CJabberProto*)((PSHNOTIFY*)lParam)->lParam; if (dat->hContact != NULL) { - ptrT jid(dat->ppro->getTStringA(dat->hContact, "jid")); + ptrW jid(dat->ppro->getTStringA(dat->hContact, "jid")); if (jid != NULL) if (!(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid))) dat->item = dat->ppro->ListGetItemPtr(LIST_ROSTER, jid); @@ -642,7 +642,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE); { - ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid); if (item == NULL) @@ -666,7 +666,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case IDC_SAVE: static wchar_t szFilter[512]; - ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); + ptrW jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid == NULL) break; @@ -677,19 +677,19 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP switch (ProtoGetAvatarFileFormat(item->photoFileName)) { case PA_FORMAT_BMP: - mir_sntprintf(szFilter, L"BMP %s (*.bmp)%c*.BMP", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"BMP %s (*.bmp)%c*.BMP", TranslateT("format"), 0); break; case PA_FORMAT_GIF: - mir_sntprintf(szFilter, L"GIF %s (*.gif)%c*.GIF", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"GIF %s (*.gif)%c*.GIF", TranslateT("format"), 0); break; case PA_FORMAT_JPEG: - mir_sntprintf(szFilter, L"JPEG %s (*.jpg;*.jpeg)%c*.JPG;*.JPEG", TranslateT("format"), 0); + mir_snwprintf(szFilter, L"JPEG %s (*.jpg;*.jpeg)%c*.JPG;*.JPEG", TranslateT("format"), 0); break; default: - mir_sntprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); + mir_snwprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); } wchar_t szFileName[MAX_PATH]; szFileName[0] = '\0'; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 610790fe63..c607e10c26 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -69,13 +69,13 @@ MCONTACT CJabberProto::HContactFromJID(const wchar_t *jid, bool bStripResource) wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid)
{
if (jid == NULL)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
const wchar_t *p = wcschr(jid, '@');
if (p == NULL)
p = wcschr(jid, '/');
- return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid);
+ return (p != NULL) ? mir_wstrndup(jid, p - jid) : mir_wstrdup(jid);
}
pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid)
@@ -99,7 +99,7 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid) wchar_t* JabberPrepareJid(LPCTSTR jid)
{
if (jid == NULL) return NULL;
- wchar_t *szNewJid = mir_tstrdup(jid);
+ wchar_t *szNewJid = mir_wstrdup(jid);
if (!szNewJid) return NULL;
wchar_t *pDelimiter = wcschr(szNewJid, '/');
if (pDelimiter) *pDelimiter = 0;
@@ -156,7 +156,7 @@ wchar_t* __stdcall JabberStrFixLines(const wchar_t *str) if (*p == '\r' || *p == '\n')
++add;
- wchar_t *buf = (wchar_t *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(wchar_t));
+ wchar_t *buf = (wchar_t *)mir_alloc((mir_wstrlen(str) + add + 1) * sizeof(wchar_t));
wchar_t *res = buf;
for (p = str; p && *p; ++p) {
@@ -258,7 +258,7 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) if (errorNode == NULL) {
if (pErrorCode)
*pErrorCode = -1;
- mir_sntprintf(errorStr, 256, L"%s -1: %s", TranslateT("Error"), TranslateT("Unknown error message"));
+ mir_snwprintf(errorStr, 256, L"%s -1: %s", TranslateT("Error"), TranslateT("Unknown error message"));
return errorStr;
}
@@ -275,7 +275,7 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) HXML c = XmlGetChild(errorNode, i);
if (c == NULL) break;
const wchar_t *attr = XmlGetAttrValue(c, L"xmlns");
- if (attr && !mir_tstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) {
+ if (attr && !mir_wstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) {
str = XmlGetName(c);
break;
}
@@ -283,9 +283,9 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) }
if (str != NULL)
- mir_sntprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)), str);
+ mir_snwprintf(errorStr, 256, L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)), str);
else
- mir_sntprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)));
+ mir_snwprintf(errorStr, 256, L"%s %d: %s", TranslateT("Error"), errorCode, TranslateTS(JabberErrorStr(errorCode)));
if (pErrorCode)
*pErrorCode = errorCode;
@@ -493,7 +493,7 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item != NULL && item->nick != NULL) {
wchar_t text[1024];
- mir_sntprintf(text, L"%s/%s", item->jid, item->nick);
+ mir_snwprintf(text, L"%s/%s", item->jid, item->nick);
SendPresenceTo(status == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : status, text, NULL);
}
}
@@ -516,8 +516,8 @@ int __stdcall JabberGetPacketID(HXML n) wchar_t* __stdcall JabberId2string(int id)
{
wchar_t text[100];
- mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
- return mir_tstrdup(text);
+ mir_snwprintf(text, _T(JABBER_IQID) L"%d", id);
+ return mir_wstrdup(text);
}
///////////////////////////////////////////////////////////////////////////////
@@ -528,7 +528,7 @@ wchar_t* CJabberProto::GetClientJID(MCONTACT hContact, wchar_t *dest, size_t des if (hContact == NULL)
return NULL;
- ptrT jid(getTStringA(hContact, "jid"));
+ ptrW jid(getTStringA(hContact, "jid"));
return GetClientJID(jid, dest, destLen);
}
@@ -543,7 +543,7 @@ wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t de mir_cslock lck(m_csLists);
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid);
if (LI != NULL) {
- if (LI->arResources.getCount() == 1 && !mir_tstrcmp(LI->arResources[0]->m_tszCapsNode, L"http://talk.google.com/xmpp/bot/caps")) {
+ if (LI->arResources.getCount() == 1 && !mir_wstrcmp(LI->arResources[0]->m_tszCapsNode, L"http://talk.google.com/xmpp/bot/caps")) {
if (p) *p = 0;
return dest;
}
@@ -551,7 +551,7 @@ wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t de if (p == NULL) {
pResourceStatus r(LI->getBestResource());
if (r != NULL)
- mir_sntprintf(dest, destLen, L"%s/%s", jid, r->m_tszResourceName);
+ mir_snwprintf(dest, destLen, L"%s/%s", jid, r->m_tszResourceName);
}
}
@@ -582,10 +582,10 @@ wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t dest LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
{
if (LPCTSTR ptszType = XmlGetText(XmlGetChild(node, "TYPE")))
- if (!mir_tstrcmp(ptszType, L"image/jpeg") ||
- !mir_tstrcmp(ptszType, L"image/png") ||
- !mir_tstrcmp(ptszType, L"image/gif") ||
- !mir_tstrcmp(ptszType, L"image/bmp"))
+ if (!mir_wstrcmp(ptszType, L"image/jpeg") ||
+ !mir_wstrcmp(ptszType, L"image/png") ||
+ !mir_wstrcmp(ptszType, L"image/gif") ||
+ !mir_wstrcmp(ptszType, L"image/bmp"))
return ptszType;
switch (ProtoGetBufferFormat(picBuf)) {
@@ -658,7 +658,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par for (int i = 0; i < recentCount; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", param, i);
- ptrT tszRecent(getTStringA(setting));
+ ptrW tszRecent(getTStringA(setting));
if (tszRecent != NULL)
SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, tszRecent);
}
@@ -733,7 +733,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) if (hContact == NULL) continue;
char name[128];
- char *jid_copy = mir_t2a(item->jid);
+ char *jid_copy = mir_u2a(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), (wchar_t *)item->jid);
@@ -758,7 +758,7 @@ void CJabberProto::RebuildInfoFrame() 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",
+ mir_snwprintf(buf, bufLen, L"%04d-%02d-%02dT%02d:%02d:%02dZ",
T->tm_year + 1900, T->tm_mon + 1, T->tm_mday, T->tm_hour, T->tm_min, T->tm_sec);
return buf;
}
@@ -784,8 +784,8 @@ const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *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));
+ CharUpperBuff(str_up, (DWORD)mir_wstrlen(str_up));
+ CharUpperBuff(substr_up, (DWORD)mir_wstrlen(substr_up));
wchar_t *p = wcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
@@ -800,9 +800,9 @@ void JabberCopyText(HWND hwnd, const wchar_t *text) if (OpenClipboard(hwnd)) {
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
wchar_t *s = (wchar_t *)GlobalLock(hMem);
- mir_tstrcpy(s, text);
+ mir_wstrcpy(s, text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
@@ -863,11 +863,11 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (m_ThreadInfo == NULL)
return false;
- ptrT szFrom(JabberPrepareJid(szJID));
+ ptrW szFrom(JabberPrepareJid(szJID));
if (szFrom == NULL)
return false;
- ptrT szTo(JabberPrepareJid(m_ThreadInfo->fullJID));
+ ptrW szTo(JabberPrepareJid(m_ThreadInfo->fullJID));
if (szTo == NULL)
return false;
@@ -879,7 +879,7 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (pDelimiter)
*pDelimiter = 0;
- return mir_tstrcmp(szFrom, szTo) == 0;
+ return mir_wstrcmp(szFrom, szTo) == 0;
}
void __cdecl CJabberProto::LoadHttpAvatars(void* param)
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 6d1ae5d239..f48503739d 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -46,7 +46,7 @@ int CJabberProto::SendGetVcard(const wchar_t *jid) static void SetDialogField(CJabberProto *ppro, HWND hwndDlg, int nDlgItem, char* key, bool bTranslate = false)
{
- ptrT tszValue(ppro->getTStringA(key));
+ ptrW tszValue(ppro->getTStringA(key));
if (tszValue != NULL)
SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(tszValue) : tszValue);
else
@@ -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) {
- wchar_t *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2u(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) {
- wchar_t *country = mir_a2t(g_countries[i].szName);
+ wchar_t *country = mir_a2u(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
@@ -291,13 +291,13 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
if (_waccess(szAvatarFileName, 0) == 0) {
if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
- mir_tstrcpy(szTempPath, L".\\");
+ mir_wstrcpy(szTempPath, L".\\");
if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) {
dat->ppro->debugLog(L"Temp file = %s", szTempFileName);
if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) {
if ((dat->hBitmap = Bitmap_Load(szTempFileName)) != NULL) {
FIP->FI_Premultiply(dat->hBitmap);
- mir_tstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
+ mir_wstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
}
else DeleteFile(szTempFileName);
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
}
if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
- mir_tstrcpy(szTempPath, L".\\");
+ mir_wstrcpy(szTempPath, L".\\");
if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) {
dat->ppro->debugLog(L"Temp file = %s", szTempFileName);
@@ -367,7 +367,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
dat->hBitmap = hNewBitmap;
- mir_tstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
+ mir_wstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
dat->ppro->m_bPhotoChanged = TRUE;
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
InvalidateRect(hwndDlg, NULL, TRUE);
@@ -730,10 +730,10 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "e-mail%d", i);
- ptrT email( ppro->getTStringA(idstr));
+ ptrW email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, L"%d", i+1);
+ mir_snwprintf(number, L"%d", i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -751,10 +751,10 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "Phone%d", i);
- ptrT phone( ppro->getTStringA(idstr));
+ ptrW phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, L"%d", i+1);
+ mir_snwprintf(number, L"%d", i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -958,7 +958,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2u((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);
- wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName);
+ wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName);
setTString("CompanyCountry", country);
mir_free(country);
}
@@ -1006,7 +1006,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) if (n == NULL || tag == NULL || key == NULL)
return;
- ptrT tszValue(getTStringA(key));
+ ptrW tszValue(getTStringA(key));
n << XCHILD(_A2T(tag), tszValue);
}
@@ -1033,7 +1033,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) {
mir_snprintf(idstr, "e-mail%d", i);
- ptrT email(getTStringA(idstr));
+ ptrW email(getTStringA(idstr));
if (email == NULL)
break;
@@ -1081,7 +1081,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) for (i = 0;; i++) {
mir_snprintf(idstr, "Phone%d", i);
- ptrT phone(getTStringA(idstr));
+ ptrW phone(getTStringA(idstr));
if (phone == NULL)
break;
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 201b1fbbd4..739fd07362 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void) m_lastTicks = ::GetTickCount();
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 32b1b6194e..71f6697e2d 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -154,7 +154,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) void __fastcall XmlAddAttrID(HXML hXml, int id)
{
wchar_t text[100];
- mir_sntprintf(text, _T(JABBER_IQID) L"%d", id);
+ mir_snwprintf(text, _T(JABBER_IQID) L"%d", id);
XmlAddAttr(hXml, L"id", text);
}
@@ -218,7 +218,7 @@ HXML __fastcall XmlGetChild(HXML hXml, LPCTSTR key) HXML __fastcall XmlGetChild(HXML hXml, LPCSTR key)
{
- LPTSTR wszKey = mir_a2t(key);
+ LPTSTR wszKey = mir_a2u(key);
HXML result = xmlGetNthChild(hXml, wszKey, 0);
mir_free(wszKey);
return result;
@@ -231,7 +231,7 @@ HXML __fastcall XmlGetChildByTag(HXML hXml, LPCTSTR key, LPCTSTR attrName, LPCTS HXML __fastcall XmlGetChildByTag(HXML hXml, LPCSTR key, LPCSTR attrName, LPCTSTR attrValue)
{
- LPTSTR wszKey = mir_a2t(key), wszName = mir_a2t(attrName);
+ LPTSTR wszKey = mir_a2u(key), wszName = mir_a2u(attrName);
HXML result = xmlGetChildByAttrValue(hXml, wszKey, wszName, attrValue);
mir_free(wszKey), mir_free(wszName);
return result;
@@ -246,7 +246,7 @@ HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) {
int i, num;
- if (!hXml || tag == NULL || mir_tstrlen(tag) <= 0 || nth < 1)
+ if (!hXml || tag == NULL || mir_wstrlen(tag) <= 0 || nth < 1)
return NULL;
num = 1;
@@ -254,7 +254,7 @@ HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) HXML n = xmlGetChild(hXml, i);
if (!n)
break;
- if (!mir_tstrcmp(tag, XmlGetName(n))) {
+ if (!mir_wstrcmp(tag, XmlGetName(n))) {
if (num == nth)
return n;
@@ -281,20 +281,20 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate) if (!info.nodeName) return;
wchar_t *nodeName = (wchar_t *)alloca(sizeof(wchar_t) * (info.nodeName.length+1));
- mir_tstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
+ mir_wstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
if (info.attrName && info.attrValue) {
wchar_t *attrName = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrName.length + 1));
- mir_tstrncpy(attrName, info.attrName.p, info.attrName.length + 1);
+ mir_wstrncpy(attrName, info.attrName.p, info.attrName.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);
+ mir_wstrncpy(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 = _wtoi(info.nodeIndex.p);
- m_hXml = mir_tstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1);
+ m_hXml = mir_wstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1);
}
else {
HXML hXml = XmlGetChild(m_hXml, nodeName);
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 739ba708db..0102cac006 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -258,11 +258,11 @@ public: }
__forceinline bool operator== (wchar_t *str)
{
- return !mir_tstrcmp((LPCTSTR)*this, str);
+ return !mir_wstrcmp((LPCTSTR)*this, str);
}
__forceinline bool operator!= (wchar_t *str)
{
- return mir_tstrcmp((LPCTSTR)*this, str) ? true : false;
+ return mir_wstrcmp((LPCTSTR)*this, str) ? true : false;
}
HXML operator[] (int idx)
{
@@ -359,7 +359,7 @@ public: va_list args;
va_start(args, path);
- mir_vsntprintf(m_buf, BUFSIZE, path, args);
+ mir_vsnwprintf(m_buf, BUFSIZE, path, args);
m_buf[BUFSIZE-1] = 0;
va_end(args);
}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 4e0b3b521b..7a0c229662 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -68,7 +68,7 @@ void CJabberDlgPepBase::OnInitDialog() SetTimer(m_hwnd, 1, 1000, NULL);
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), m_time);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), m_time);
m_btnOk.SetText(buf);
}
@@ -89,7 +89,7 @@ INT_PTR CJabberDlgPepBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_TIMER:
if (wParam == 1) {
wchar_t buf[128];
- mir_sntprintf(buf, TranslateT("OK (%d)"), --m_time);
+ mir_snwprintf(buf, TranslateT("OK (%d)"), --m_time);
m_btnOk.SetText(buf);
if (m_time < 0) {
@@ -285,7 +285,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) {
mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name);
- ptrT szDescr( m_proto->getTStringA(szSetting));
+ ptrW szDescr( m_proto->getTStringA(szSetting));
m_txtDescription.SetText((szDescr != NULL) ? szDescr : L"");
m_txtDescription.Enable(true);
}
@@ -341,20 +341,20 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) if (mode->m_subitem) {
for (int i = lpdis->itemData; i >= 0; --i)
if (!m_modes[i].m_subitem) {
- mir_sntprintf(text, L"%s [%s]", m_modes[i].m_title, mode->m_title);
+ mir_snwprintf(text, L"%s [%s]", m_modes[i].m_title, mode->m_title);
break;
}
}
- else mir_tstrncpy(text, mode->m_title, _countof(text));
+ else mir_wstrncpy(text, mode->m_title, _countof(text));
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 2, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
- TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_wstrlen(text));
}
else {
wchar_t text[128];
- mir_sntprintf(text, L"...%s", mode->m_title);
+ mir_snwprintf(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));
+ TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_wstrlen(text));
}
return TRUE;
@@ -398,7 +398,7 @@ void CPepService::Publish() void CPepService::Retract()
{
- wchar_t *tempName = mir_a2t(m_name);
+ wchar_t *tempName = mir_a2u(m_name);
wcslwr(tempName);
m_proto->m_ThreadInfo->send(
@@ -489,7 +489,7 @@ bool CPepGuiService::LaunchSetGui(BYTE bQuiet) void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text)
{
m_hIcolibItem = hIcolibIcon;
- replaceStrT(m_szText, text);
+ replaceStrW(m_szText, text);
if (m_hMenuItem)
Menu_ModifyItem(m_hMenuItem, m_szText ? m_szText : TranslateT("<advanced status slot>"), m_hIcolibItem, CMIF_KEEPUNTRANSLATED);
@@ -632,7 +632,7 @@ void CPepMood::ProcessItems(const wchar_t *from, HXML itemsNode) LPCTSTR moodType = NULL, moodText = NULL;
for (int i=0; n = XmlGetChild(moodNode, i); i++) {
- if (!mir_tstrcmp(XmlGetName(n), L"text"))
+ if (!mir_wstrcmp(XmlGetName(n), L"text"))
moodText = XmlGetText(n);
else
moodType = XmlGetName(n);
@@ -672,7 +672,7 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * {
int mood = -1;
if (szMood) {
- char* p = mir_t2a(szMood);
+ char* p = mir_u2a(szMood);
for (int i = 1; i < _countof(g_arrMoods); i++)
if (!mir_strcmp(g_arrMoods[i].szTag, p)) {
@@ -688,16 +688,16 @@ void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t * if (!hContact) {
m_mode = mood;
- replaceStrT(m_text, szText);
+ replaceStrW(m_text, szText);
HANDLE hIcon;
wchar_t title[128];
if (mood >= 0) {
- mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_snwprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag);
}
else {
- mir_tstrcpy(title, TranslateT("Set mood..."));
+ mir_wstrcpy(title, TranslateT("Set mood..."));
hIcon = Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
}
@@ -741,7 +741,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) return;
m_mode = dlg.GetStatusMode();
- replaceStrT(m_text, dlg.GetStatusText());
+ replaceStrW(m_text, dlg.GetStatusText());
}
HANDLE hIcon;
@@ -865,7 +865,7 @@ static int ActivityCheck(LPCTSTR szFirstNode, LPCTSTR szSecondNode) {
if (!szFirstNode) return 0;
- char *s1 = mir_t2a(szFirstNode), *s2 = mir_t2a(szSecondNode);
+ char *s1 = mir_u2a(szFirstNode), *s2 = mir_u2a(szSecondNode);
int i = 0, nFirst = -1, nSecond = -1;
while (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond) {
@@ -971,9 +971,9 @@ void ActivityBuildTitle(int id, wchar_t *buf, int size) if (szFirst) {
if (szSecond)
- mir_sntprintf(buf, size, L"%s [%s]", TranslateTS(szFirst), TranslateTS(szSecond));
+ mir_snwprintf(buf, size, L"%s [%s]", TranslateTS(szFirst), TranslateTS(szSecond));
else
- mir_tstrncpy(buf, TranslateTS(szFirst), size);
+ mir_wstrncpy(buf, TranslateTS(szFirst), size);
}
else *buf = 0;
}
@@ -1016,7 +1016,7 @@ void CPepActivity::ProcessItems(const wchar_t *from, HXML itemsNode) HXML n;
for (int i=0; n = XmlGetChild(actNode, i); i++) {
- if (mir_tstrcmp(XmlGetName(n), L"text")) {
+ if (mir_wstrcmp(XmlGetName(n), L"text")) {
szFirstNode = XmlGetName(n);
HXML secondNode = XmlGetChild(n, 0);
if (szFirstNode && secondNode && XmlGetName(secondNode))
@@ -1076,17 +1076,17 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec if (!hContact) {
m_mode = activity;
- replaceStrT(m_text, szText);
+ replaceStrW(m_text, szText);
HANDLE hIcon;
wchar_t title[128];
if (activity >= 0) {
- mir_sntprintf(title, TranslateT("Activity: %s"), activityTitle);
+ mir_snwprintf(title, TranslateT("Activity: %s"), activityTitle);
hIcon = g_ActivityIcons.GetIcolibHandle(returnActivity(activity));
}
else {
- mir_tstrcpy(title, TranslateT("Set activity..."));
+ mir_wstrcpy(title, TranslateT("Set activity..."));
hIcon = Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT);
}
@@ -1097,7 +1097,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec else SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity));
if (activity >= 0) {
- wchar_t *p = mir_a2t(ActivityGetId(activity));
+ wchar_t *p = mir_a2u(ActivityGetId(activity));
m_proto->WriteAdvStatus(hContact, ADVSTATUS_ACTIVITY, p, g_ActivityIcons.GetIcolibName(returnActivity(activity)), activityTitle, szText);
mir_free(p);
}
@@ -1118,7 +1118,7 @@ void CPepActivity::ShowSetDialog(BYTE) m_mode = dlg.GetStatusMode();
if (m_mode >= 0) {
- replaceStrT(m_text, dlg.GetStatusText());
+ replaceStrW(m_text, dlg.GetStatusText());
Publish();
UpdateMenuItem(g_ActivityIcons.GetIcolibHandle(returnActivity(m_mode)), g_arrActivities[m_mode].szTitle);
@@ -1215,7 +1215,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s }
else {
szListeningTo = (wchar_t*)mir_alloc(2048 * sizeof(wchar_t));
- mir_sntprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L"");
+ mir_snwprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L"");
}
setTString(hContact, "ListeningTo", szListeningTo);
@@ -1232,7 +1232,7 @@ wchar_t* a2tf(const wchar_t *str, BOOL unicode) if (str == NULL)
return NULL;
- return (unicode) ? mir_tstrdup(str) : mir_a2t((char*)str);
+ return (unicode) ? mir_wstrdup(str) : mir_a2u((char*)str);
}
void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t *def = NULL)
@@ -1245,7 +1245,7 @@ void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t if (src != NULL)
dest = a2tf(src, unicode);
else if (def != NULL)
- dest = mir_tstrdup(def);
+ dest = mir_wstrdup(def);
}
INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
@@ -1286,7 +1286,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) szTmp++;
}
}
- mir_sntprintf(szLengthInSec, L"%d", result);
+ mir_snwprintf(szLengthInSec, L"%d", result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
@@ -1365,7 +1365,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) else {
*pData->ptszName = 0;
if (pData->flags & CSSF_UNICODE) {
- ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ ptrW title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
if (title)
wcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE);
}
@@ -1381,7 +1381,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_MASK_MESSAGE) {
*pData->pszMessage = 0;
if (pData->flags & CSSF_UNICODE) {
- ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ ptrW title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
if (title)
wcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE);
}
@@ -1505,15 +1505,15 @@ void g_XstatusIconsInit() wchar_t szFile[MAX_PATH];
GetModuleFileName(hInst, szFile, _countof(szFile));
if (wchar_t *p = wcsrchr(szFile, '\\'))
- mir_tstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
+ mir_wstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
wchar_t szSection[100];
- mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods"));
+ mir_wstrcpy(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/" LPGENW("Activities"));
+ mir_wstrcpy(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 ccda5b0886..dae7929b38 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -114,7 +114,7 @@ public: CPepService *Find(wchar_t *node)
{
for (int i=0; i < getCount(); i++)
- if (!mir_tstrcmp((*this)[i].GetNode(), node))
+ if (!mir_wstrcmp((*this)[i].GetNode(), node))
return &((*this)[i]);
return NULL;
}
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 56f199f509..f445c93799 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -403,7 +403,7 @@ struct ThreadData JABBER_CONN_DATA conn;
wchar_t resource[128];
wchar_t fullJID[JABBER_MAX_JID_LEN];
- ptrT tszNewPassword;
+ ptrW tszNewPassword;
class TJabberAuth *auth;
JabberCapsBits jabberServerCaps;
@@ -683,8 +683,8 @@ struct CJabberAdhocStartupParams CJabberAdhocStartupParams(CJabberProto *proto, wchar_t* szJid, wchar_t* szNode = NULL)
{
m_pProto = proto;
- m_szJid = mir_tstrdup(szJid);
- m_szNode = szNode ? mir_tstrdup(szNode) : NULL;
+ m_szJid = mir_wstrdup(szJid);
+ m_szNode = szNode ? mir_wstrdup(szNode) : NULL;
}
~CJabberAdhocStartupParams()
{
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index fd0bd8ecb0..5ea4500c69 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -77,7 +77,7 @@ void InitComboBoxNumders(HWND hWndCombo, DWORD dwStart, DWORD dwEnd) for (DWORD i = dwStart; i <= dwEnd; i++) {
wchar_t szBuff[MAX_PATH];
- mir_sntprintf(szBuff, L"%lu", i);
+ mir_snwprintf(szBuff, L"%lu", i);
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)szBuff);
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index b7f7aac5b2..ca412ee5dc 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -56,7 +56,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = new MRA_AVATARS_QUEUE();
wchar_t szBuffer[MAX_PATH];
- mir_sntprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections"));
+ mir_snwprintf(szBuffer, L"%s %s", m_tszUserName, TranslateT("Avatars' plugin connections"));
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -232,7 +232,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) break;
default:
- mir_sntprintf(szErrorText, TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
+ mir_snwprintf(szErrorText, TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
break;
}
@@ -290,7 +290,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
else {
dwErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Avatars: can't open file %s, error"), wszFileName);
+ mir_snwprintf(szErrorText, TranslateT("Avatars: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwErrorCode);
}
}
@@ -476,7 +476,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD d return ERROR_NOT_SUPPORTED;
wchar_t tszBase[MAX_PATH];
- mir_sntprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(tszBase, L"%s\\%s\\", VARST(L"%miranda_avatarcache%"), m_tszUserName);
res = tszBase;
// some path in buff and free space for file name is avaible
@@ -530,7 +530,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hQueue, DWORD dwFlags, MCONTACT // ôàéë ñ àâàòàðîì ñóùåñòâóåò è íå óñòàðåë/íå áûëî êîììàíäû îáíîâëÿòü(ïðîñòî çàïðîñ èìåíè)
if (lpszPath) {
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- mir_tstrncpy(lpszPath, wszFileName, MAX_PATH);
+ mir_wstrncpy(lpszPath, wszFileName, MAX_PATH);
else
PathToRelativeT(wszFileName, lpszPath);
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 782cb3fe40..58b17b39f8 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -192,7 +192,7 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) if (!_stricmp(gch->pDest->pszModule, m_szModuleName)) {
switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (gch->ptszText && mir_tstrlen(gch->ptszText)) {
+ if (gch->ptszText && mir_wstrlen(gch->ptszText)) {
CMStringA szEmail = gch->pDest->ptszID;
MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index bcb9aead3c..83234d5adf 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -563,7 +563,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) lpwszCurPos = lpwszFiles;
for (size_t i = 0; i < dat->dwFilesCount; i++) {
MRA_FILES_QUEUE_FILE &p = dat->pmfqfFiles[i];
- lpwszCurPos += mir_sntprintf(lpwszCurPos, (dwFilesSize - ((size_t)lpwszCurPos - (size_t)lpwszFiles)), L"%s;%I64u;",
+ lpwszCurPos += mir_snwprintf(lpwszCurPos, (dwFilesSize - ((size_t)lpwszCurPos - (size_t)lpwszFiles)), L"%s;%I64u;",
GetFileNameFromFullPathW(p.lpwszName, p.dwNameLen), p.dwSize);
}
dwFilesSize = (lpwszCurPos - lpwszFiles);// size in WCHARs
@@ -658,7 +658,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT MRA_FILES_QUEUE_FILE &p = dat->pmfqfFiles[dat->dwFilesCount];
p.lpwszName = mir_wstrdup(wszCurrFile);
- p.dwNameLen = mir_tstrlen(p.lpwszName);
+ p.dwNameLen = mir_wstrlen(p.lpwszName);
p.dwSize = _wtoi(wszCurrSize);
dat->dwFilesTotalSize += p.dwSize;
dwFileNameTotalSize += p.dwNameLen * sizeof(wchar_t);
@@ -674,13 +674,13 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT LPWSTR lpwszDelimiter = dat->pwszFilesList;
LPWSTR lpwszCurrentItem = dat->pwszDescription;
StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, _countof(szBuff));
- lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
+ lpwszCurrentItem += mir_snwprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
// description + filesnames
for (size_t i = 0; i < dat->dwFilesCount; i++) {
- lpwszDelimiter += mir_sntprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
+ lpwszDelimiter += mir_snwprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, _countof(szBuff));
- lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
+ lpwszCurrentItem += mir_snwprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
}
lpwszCurrentItem += MultiByteToWideChar(MRA_CODE_PAGE, 0, szAddresses, (int)szAddresses.GetLength(), lpwszCurrentItem, (int)((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)));
@@ -862,7 +862,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err allocating file disk space
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
}
CloseHandle(hFile);
@@ -875,7 +875,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: can't open file %s, error"), wszFileName);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
@@ -883,7 +883,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on send request for file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
+ mir_snwprintf(szErrorText, TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
@@ -1108,14 +1108,14 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) }
else { // err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
+ mir_snwprintf(szErrorText, TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
}
}
else {
- mir_sntprintf(szErrorText, TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
+ mir_snwprintf(szErrorText, TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
diff --git a/protocols/MRA/src/MraPlaces.h b/protocols/MRA/src/MraPlaces.h index e58e27962b..100887c18a 100644 --- a/protocols/MRA/src/MraPlaces.h +++ b/protocols/MRA/src/MraPlaces.h @@ -41,7 +41,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID == 0 && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
+ mir_snwprintf(szBuff, L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
@@ -53,7 +53,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
+ mir_snwprintf(szBuff, L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index bad3861365..2f5bc21800 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -254,9 +254,9 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP ppd.lchContact = hContact;
if (lpszTitle)
- mir_tstrncpy(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzContactName, lpszTitle, MAX_CONTACTNAME);
if (lpszMessage)
- mir_tstrncpy(ppd.lptzText, lpszMessage, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzText, lpszMessage, MAX_SECONDLINE);
ppd.PluginWindowProc = MraPopupDlgProc;
ppd.PluginData = dat;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index ac34d5dfd1..5ba003938d 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -36,7 +36,7 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
wchar_t name[MAX_PATH];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -172,7 +172,7 @@ MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent) char *firstName = nick + mir_strlen(nick) + 1;
char *lastName = firstName + mir_strlen(firstName) + 1;
char *email = lastName + mir_strlen(lastName) + 1;
- return AddToListByEmail(ptrT(mir_utf8decodeT(email)), ptrT(mir_utf8decodeT(nick)), ptrT(mir_utf8decodeT(firstName)), ptrT(mir_utf8decodeT(lastName)), 0);
+ return AddToListByEmail(ptrW(mir_utf8decodeW(email)), ptrW(mir_utf8decodeW(nick)), ptrW(mir_utf8decodeW(firstName)), ptrW(mir_utf8decodeW(lastName)), 0);
}
}
return 0;
@@ -233,7 +233,7 @@ int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) 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)
+ if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_wstrlen(szPath)) == NO_ERROR)
return hTransfer; // Success
return NULL;
@@ -392,7 +392,7 @@ int CMraProto::SendMsg(MCONTACT hContact, int, const char *lpszMessage) }
DWORD dwFlags = 0;
- CMStringW wszMessage(ptrW(mir_utf8decodeT(lpszMessage)));
+ CMStringW wszMessage(ptrW(mir_utf8decodeW(lpszMessage)));
if (wszMessage.IsEmpty()) {
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"Cant allocate buffer for convert to unicode.");
return 0;
@@ -526,11 +526,11 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) SYSTEMTIME tt = { 0 };
dwTime = getDword(hContact, DBSETTING_BLOGSTATUSTIME, 0);
if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &tt))
- mir_sntprintf(szTime, L"%04ld.%02ld.%02ld %02ld:%02ld: ", tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
+ mir_snwprintf(szTime, L"%04ld.%02ld.%02ld %02ld:%02ld: ", tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
else
szTime[0] = 0;
- mir_sntprintf(szStatusDesc, L"%s%s", szTime, szBlogStatus.c_str());
+ mir_snwprintf(szStatusDesc, L"%s%s", szTime, szBlogStatus.c_str());
iRet = GetTickCount();
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc);
}
@@ -542,7 +542,7 @@ int CMraProto::SetAwayMsg(int iStatus, const wchar_t *msg) if (!m_bLoggedIn)
return 1;
- size_t dwStatusDescSize = mir_tstrlen(msg);
+ size_t dwStatusDescSize = mir_wstrlen(msg);
DWORD dwStatus = iStatus;
DWORD dwXStatus = m_iXStatus;
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index ab7077f9d1..1f735924d2 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -210,7 +210,7 @@ DWORD CMraProto::MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMess HDC hDC = GetDC(NULL);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
- mir_tstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
ReleaseDC(NULL, hDC);
}
dwFontSize = ((-lf.lfHeight)+(((-lf.lfHeight)+4)/8));
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 3f863a1ed5..60d4784a14 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -458,8 +458,8 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D MraGroupItem *grp = m_groups.find((MraGroupItem*)&dwGroupID);
if (grp) {
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
- if (mir_tstrcmp(tszGroup, grp->m_name))
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ if (mir_wstrcmp(tszGroup, grp->m_name))
db_set_ts(hContact, "CList", "Group", grp->m_name);
}
}
@@ -649,14 +649,14 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & MCONTACT hContact = NULL;
wchar_t szMailBoxStatus[MAX_SECONDLINE];
- mir_sntprintf(szMailBoxStatus, TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
+ mir_snwprintf(szMailBoxStatus, TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
CMStringA szFrom, szSubject;
if (GetEMailFromString(szFrom, szEmail))
hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
- mir_sntprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
+ mir_snwprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
else wcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
@@ -693,7 +693,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & hWndEMailPopupStatus = NULL;
}
else {
- mir_sntprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
+ mir_snwprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText);
}
}
@@ -878,7 +878,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode else {
dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
- mir_sntprintf(szErrorText, L"%s %lu: %s", TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
+ mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
}
MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText);
}
@@ -1020,7 +1020,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP case WM_TIMER:
if (dat->dwCountdown != -1) {
wchar_t szBuff[MAX_PATH];
- mir_sntprintf(szBuff, TranslateT("Closing in %ld"), dat->dwCountdown--);
+ mir_snwprintf(szBuff, TranslateT("Closing in %ld"), dat->dwCountdown--);
SetDlgItemText(hWndDlg, IDOK, szBuff);
break;
}
@@ -1056,7 +1056,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dwBuffSize = GetDlgItemText(hWndDlg, IDC_XTITLE, szBuff, (STATUS_TITLE_MAX + 1));
if (dwBuffSize == 0) { // user delete all text
- mir_tstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
+ mir_wstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
dwBuffSize = (DWORD)mir_wstrlen(szBuff);
}
mir_snprintf(szValueName, "XStatus%dName", dat->dwXStatus);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w size_t dwMessageSize = GetWindowTextLength(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND));
EnableWindow(GetDlgItem(hWndDlg, IDOK), (int)dwMessageSize);
- mir_sntprintf(tszBuff, L"%d/%d", dwMessageSize, MICBLOG_STATUS_MAX);
+ mir_snwprintf(tszBuff, L"%d/%d", dwMessageSize, MICBLOG_STATUS_MAX);
SetDlgItemText(hWndDlg, IDC_STATIC_CHARS_COUNTER, tszBuff);
}
break;
@@ -1250,7 +1250,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwPathLen++;
}
szPath[dwPathLen] = 0;
- mir_tstrcat(szPath, L"*.*");
+ mir_wstrcat(szPath, L"*.*");
dwRetErrorCode = ERROR_FILE_NOT_FOUND;
prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
@@ -1265,7 +1265,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, L"..", 2) != CSTR_EQUAL) {
prdsiItems[dwRecDeepCurPos].dwFileNameLen = (int)mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1;
memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
- mir_tstrcat(szPath, L"\\*.*");
+ mir_wstrcat(szPath, L"\\*.*");
dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
dwRecDeepCurPos++;
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index a0ac316017..f54ecfb595 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -282,7 +282,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) HGENMENU hRoot;
{
wchar_t szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, L"%s Custom Status", m_tszUserName);
+ mir_snwprintf(szItem, L"%s Custom Status", m_tszUserName);
CMenuItem mi;
mi.root = pcli->pfnGetProtocolMenu(m_szModuleName);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 6247ef9249..1bd1a5694f 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L HDC hDC = GetDC(NULL);// kegl
lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET;
lf.lfHeight = -MulDiv(MRA_DEFAULT_RTF_FONT_SIZE, GetDeviceCaps(hDC, LOGPIXELSY), 72);
- mir_tstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
+ mir_wstrncpy(lf.lfFaceName, MRA_DEFAULT_RTF_FONT_NAME, LF_FACESIZE);
ReleaseDC(NULL, hDC);
}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 283726a3d2..19d568e54c 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -653,7 +653,7 @@ bool CMraProto::CmdFileTransferAck(BinBuffer &buf) break;
default:// ## unknown error
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
ShowFormattedErrorMessage(szBuff, NO_ERROR);
break;
}
@@ -721,7 +721,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) case CONTACT_OPER_SUCCESS:// ## äîáàâëåíèå ïðîèçâåäåíî óñïåøíî
if (cmd == MRIM_CS_ADD_CONTACT_ACK) {
DWORD dwFlags = SCBIF_ID | SCBIF_SERVER_FLAG, dwGroupID = 0;
- ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
+ ptrW grpName(db_get_tsa(hContact, "CList", "Group"));
if (grpName) {
dwFlags |= SCBIF_GROUP_ID;
dwGroupID = MraMoveContactToGroup(hContact, -1, grpName);
@@ -750,7 +750,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) break;
default:// ## unknown error
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1044,7 +1044,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) break;
default:
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
+ mir_snwprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1259,7 +1259,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
else {
if (iGroupMode == 100) { // first start
- ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
+ ptrW tszGroup(db_get_tsa(hContact, "CList", "Group"));
if (tszGroup)
dwGroupID = MraMoveContactToGroup(hContact, dwGroupID, tszGroup);
}
@@ -1351,7 +1351,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) ShowFormattedErrorMessage(L"MRIM_CS_CONTACT_LIST2: internal server error", NO_ERROR);
else {
wchar_t szBuff[1024];
- mir_sntprintf(szBuff, TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
+ mir_snwprintf(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 b5902ed4ae..c957ad89d5 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -310,7 +310,7 @@ INT_PTR CMraProto::MraSetListeningTo(WPARAM, LPARAM lParam) else if (pliInfo->dwFlags & LTI_UNICODE) {
CMStringW wszListeningTo;
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- wszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%track%. %title% - %artist% - %player%", (LPARAM)pliInfo));
+ wszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%track%. %title% - %artist% - %player%", (LPARAM)pliInfo));
else
wszListeningTo.Format(L"%s. %s - %s - %s", pliInfo->ptszTrack ? pliInfo->ptszTrack : L"", pliInfo->ptszTitle ? pliInfo->ptszTitle : L"", pliInfo->ptszArtist ? pliInfo->ptszArtist : L"", pliInfo->ptszPlayer ? pliInfo->ptszPlayer : L"");
@@ -466,9 +466,9 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) return 1;
if (pData->flags & CSSF_UNICODE)
- mir_tstrncpy(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
+ mir_wstrncpy(pData->ptszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX + 1));
else {
- size_t dwStatusTitleSize = mir_tstrlen(lpcszXStatusNameDef[dwXStatus]);
+ size_t dwStatusTitleSize = mir_wstrlen(lpcszXStatusNameDef[dwXStatus]);
if (dwStatusTitleSize > STATUS_TITLE_MAX)
dwStatusTitleSize = STATUS_TITLE_MAX;
@@ -625,7 +625,7 @@ INT_PTR CMraProto::MraGetMyAvatar(WPARAM wParam, LPARAM lParam) {
CMStringW wszFileName;
if (MraAvatarsGetFileName(hAvatarsQueueHandle, NULL, GetContactAvatarFormat(NULL, PA_FORMAT_DEFAULT), wszFileName) == NO_ERROR) {
- mir_tstrncpy((LPTSTR)wParam, wszFileName, (size_t)lParam);
+ mir_wstrncpy((LPTSTR)wParam, wszFileName, (size_t)lParam);
return 0;
}
return 1;
@@ -644,7 +644,7 @@ int CMraProto::OnGroupChanged(WPARAM hContact, LPARAM lParam) MraGroupItem *pGrp = NULL;
for (int i = 0; i < m_groups.getCount(); i++) {
MraGroupItem &p = m_groups[i];
- if (!mir_tstrcmp(p.m_name, cgc->pszOldName)) {
+ if (!mir_wstrcmp(p.m_name, cgc->pszOldName)) {
pGrp = &p;
break;
}
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 2f217da0b5..9fa392318d 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -61,7 +61,7 @@ int MSN_GCMenuHook(WPARAM wParam, LPARAM lParam); // Protocol instances
static int sttCompareProtocols(const CMsnProto *p1, const CMsnProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<CMsnProto> g_Instances(1, sttCompareProtocols);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 995404ea9b..539280f125 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -55,7 +55,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p wchar_t szName[512];
InterlockedIncrement(&m_chatID);
if (*pszTopic) wcsncpy(szName, _A2T(pszTopic), _countof(szName));
- else mir_sntprintf(szName, L"%s %s%d",
+ else mir_snwprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
GCSESSION gcw = { sizeof(gcw) };
@@ -123,7 +123,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) info->mJoinedContacts.insert(gcu);
strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
}
- mir_tstrcpy(gcu->role, _A2T(role));
+ mir_wstrcpy(gcu->role, _A2T(role));
if (pszCreator && !mir_strcmp(mri, pszCreator)) info->mCreator = gcu;
char* szEmail, *szNet;
@@ -186,10 +186,10 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
- gce.ptszUID = initiator?mir_a2t(initiator->txt):NULL;
+ gce.ptszUID = initiator?mir_a2u(initiator->txt):NULL;
MCONTACT hContInitiator = MSN_HContactFromEmail(initiator->txt);
gce.ptszNick = GetContactNameT(hContInitiator);
- gce.ptszText = mir_a2t(ezxml_txt(ezxml_child(xmli, "value")));
+ gce.ptszText = mir_a2u(ezxml_txt(ezxml_child(xmli, "value")));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
mir_free((wchar_t*)gce.ptszUID);
mir_free((wchar_t*)gce.ptszText);
@@ -244,7 +244,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID char *szEmail, *szNet;
parseWLID(NEWSTR_ALLOCA(pszTarget), &szNet, &szEmail, NULL);
gce.bIsMe = !mir_strcmpi(szEmail, GetMyUsername(atoi(szNet)));
- gce.ptszUID = mir_a2t(pszTarget);
+ gce.ptszUID = mir_a2u(pszTarget);
MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
gce.ptszNick = GetContactNameT(hContTarget);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -287,12 +287,12 @@ void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *emai GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = mir_a2t(email);
+ gce.ptszUID = mir_a2u(email);
gce.ptszNick = GetContactNameT(hContact);
gce.time = ts;
gce.bIsMe = sentMsg;
- wchar_t* p = mir_utf8decodeT(msgBody);
+ wchar_t* p = mir_utf8decodeW(msgBody);
gce.ptszText = EscapeChatTags(p);
mir_free(p);
@@ -333,7 +333,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- if (buf[0]) str.insert(mir_t2a(buf));
+ if (buf[0]) str.insert(mir_u2a(buf));
}
else {
MsnContact *msc = ppro->Lists_Get((UINT_PTR)hItem);
@@ -502,7 +502,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
if (thread) {
wchar_t* pszMsg = UnEscapeChatTags(NEWWSTR_ALLOCA(gch->ptszText));
- rtrimt(pszMsg); // remove the ending linebreak
+ rtrimw(pszMsg); // remove the ending linebreak
msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0);
DBVARIANT dbv;
@@ -512,7 +512,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
- gce.ptszUID = mir_a2t(MyOptions.szEmail);
+ gce.ptszUID = mir_a2u(MyOptions.szEmail);
gce.time = time(NULL);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
@@ -532,7 +532,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- char *email = mir_t2a(gch->ptszUID);
+ char *email = mir_u2a(gch->ptszUID);
MCONTACT hContact = MSN_HContactFromEmail(email);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
mir_free(email);
@@ -574,7 +574,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case 40:
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");
+ MSN_Promoteuser(gch, (pszRole && !mir_wstrcmp(pszRole, L"admin")) ? "user" : "admin");
break;
}
break;
@@ -599,7 +599,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char *email = mir_t2a(gcmi->pszUID);
+ char *email = mir_u2a(gcmi->pszUID);
if (!_stricmp(GetMyUsername(NETID_SKYPE), email)) {
static const struct gc_item Items[] =
{
@@ -620,13 +620,13 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { LPGENW("&Op user") , 40, MENU_ITEM, FALSE }
};
GCThreadData* thread = MSN_GetThreadByChatId(gcmi->pszID);
- if (thread && thread->mMe && mir_tstrcmpi(thread->mMe->role, L"admin")) {
+ if (thread && thread->mMe && mir_wstrcmpi(thread->mMe->role, L"admin")) {
Items[2].bDisabled = TRUE;
Items[3].bDisabled = TRUE;
}
else {
const wchar_t *pszRole = MSN_GCGetRole(thread, email);
- if (pszRole && !mir_tstrcmpi(pszRole, L"admin"))
+ if (pszRole && !mir_wstrcmpi(pszRole, L"admin"))
Items[3].pszDesc = LPGENW("&Deop user");
}
gcmi->nItems = _countof(Items);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index b38a1c2680..2a37ab21e1 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -181,7 +181,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"]);
+ mChatID = mir_a2u(tHeader["To"]);
if (wcsncmp(mChatID, L"19:", 3)) mChatID[0]=0; // NETID_THREAD
msgBody = tHeader.readFromBuffer(msgBody);
msgBody = tHeader.readFromBuffer(msgBody);
@@ -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.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2t(wlid);
+ psr[cnt]->id.w = psr[cnt]->nick.w = psr[cnt]->email.w = mir_a2u(wlid);
cnt++;
}
}
@@ -513,20 +513,20 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) }
if (!pszFile || !*pszFile) pszFile="file";
}
- ft->std.tszCurrentFile = mir_utf8decodeT(pszFile);
+ ft->std.tszCurrentFile = mir_utf8decodeW(pszFile);
ft->std.totalBytes = ft->std.currentFileSize = fileSize;
ft->std.totalFiles = 1;
ft->szInvcookie = (char*)mir_calloc(strlen(uri)+16);
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
pre.timestamp = time(NULL);
- pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeT(desc->txt):tComment;
+ pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
pre.files.w = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
@@ -569,7 +569,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
if (szNetId != NULL) {
- ptrT szEmailT(mir_utf8decodeT(szEmail));
+ ptrW szEmailT(mir_utf8decodeW(szEmail));
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
@@ -749,7 +749,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) }
{
- ptrT tszStatus(mir_utf8decodeT(szStatMsg));
+ ptrW tszStatus(mir_utf8decodeW(szStatMsg));
if (szInst) MSN_SetMirVer(hContact, Lists_GetPlace(szEmail, szInst));
else {
MsnContact *cont = Lists_Get(hContact);
@@ -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((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
+ unknown = mir_utf8encodeW((wchar_t *)CallService(MS_LISTENINGTO_GETUNKNOWNTEXT, 0, 0));
for (unsigned i = 4; i < pCount; i++) {
char part[16];
@@ -836,17 +836,17 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) LISTENINGTOINFO lti = { 0 };
lti.cbSize = sizeof(LISTENINGTOINFO);
- lti.ptszTitle = mir_utf8decodeT(parts[4]);
- if (pCount > 5) lti.ptszArtist = mir_utf8decodeT(parts[5]);
- if (pCount > 6) lti.ptszAlbum = mir_utf8decodeT(parts[6]);
- if (pCount > 7) lti.ptszTrack = mir_utf8decodeT(parts[7]);
- if (pCount > 8) lti.ptszYear = mir_utf8decodeT(parts[8]);
- if (pCount > 9) lti.ptszGenre = mir_utf8decodeT(parts[9]);
- if (pCount > 10) lti.ptszLength = mir_utf8decodeT(parts[10]);
- if (pCount > 11) lti.ptszPlayer = mir_utf8decodeT(parts[11]);
- else lti.ptszPlayer = mir_utf8decodeT(parts[0]);
- if (pCount > 12) lti.ptszType = mir_utf8decodeT(parts[12]);
- else lti.ptszType = mir_utf8decodeT(parts[1]);
+ lti.ptszTitle = mir_utf8decodeW(parts[4]);
+ if (pCount > 5) lti.ptszArtist = mir_utf8decodeW(parts[5]);
+ if (pCount > 6) lti.ptszAlbum = mir_utf8decodeW(parts[6]);
+ if (pCount > 7) lti.ptszTrack = mir_utf8decodeW(parts[7]);
+ if (pCount > 8) lti.ptszYear = mir_utf8decodeW(parts[8]);
+ if (pCount > 9) lti.ptszGenre = mir_utf8decodeW(parts[9]);
+ if (pCount > 10) lti.ptszLength = mir_utf8decodeW(parts[10]);
+ if (pCount > 11) lti.ptszPlayer = mir_utf8decodeW(parts[11]);
+ else lti.ptszPlayer = mir_utf8decodeW(parts[0]);
+ if (pCount > 12) lti.ptszType = mir_utf8decodeW(parts[12]);
+ else lti.ptszType = mir_utf8decodeW(parts[1]);
wchar_t *cm = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)<i);
setTString(hContact, "ListeningTo", cm);
@@ -898,7 +898,7 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) SkinPlaySound(alertsoundname);
- wchar_t* alrt = mir_utf8decodeT(ezxml_txt(xmltxt));
+ wchar_t* alrt = mir_utf8decodeW(ezxml_txt(xmltxt));
MSN_ShowPopup(TranslateT("MSN Alert"), alrt, MSN_ALERT_POPUP | MSN_ALLOW_MSGBOX, fullurl);
mir_free(alrt);
}
@@ -1463,14 +1463,14 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ft->std.hContact = MSN_HContactFromEmail(email, nick, true, true);
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_utf8decodeT(Appfile);
+ ft->std.tszCurrentFile = mir_utf8decodeW(Appfile);
ft->std.totalBytes = ft->std.currentFileSize = _atoi64(Appfilesize);
ft->std.totalFiles = 1;
ft->szInvcookie = mir_strdup(Invcookie);
ft->p2p_dest = mir_strdup(email);
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1536,8 +1536,8 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, // netmeeting receive 1
if (Appname != NULL && !_stricmp(Appname, "NetMeeting")) {
- wchar_t text[512], *tszEmail = mir_a2t(email);
- mir_sntprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail);
+ wchar_t text[512], *tszEmail = mir_a2u(email);
+ mir_snwprintf(text, TranslateT("Accept NetMeeting request from %s?"), tszEmail);
mir_free(tszEmail);
if (MessageBox(NULL, text, TranslateT("MSN Protocol"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
@@ -1646,7 +1646,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i wchar_t path[MAX_PATH];
MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
- ft->std.tszCurrentFile = mir_tstrdup(path);
+ ft->std.tszCurrentFile = mir_wstrdup(path);
if (p2p_IsDlFileOk(ft))
delete ft;
@@ -1885,7 +1885,7 @@ LBL_InvalidCommand: GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
- gce.ptszUID = mir_a2t(data.userEmail);
+ gce.ptszUID = mir_a2u(data.userEmail);
gce.time = time(NULL);
gce.bIsMe = FALSE;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -2141,7 +2141,7 @@ LBL_InvalidCommand: GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
- gce.ptszUID = mir_a2t(data.userEmail);
+ gce.ptszUID = mir_a2u(data.userEmail);
gce.ptszStatus = TranslateT("Others");
gce.time = time(NULL);
gce.bIsMe = FALSE;
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 9e0cd37318..e51ac49e88 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -27,7 +27,7 @@ static wchar_t* a2tf(const wchar_t* str, bool unicode) if (str == NULL)
return NULL;
- return unicode ? mir_tstrdup(str) : mir_a2t((char*)str);
+ return unicode ? mir_wstrdup(str) : mir_a2u((char*)str);
}
void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def)
@@ -38,7 +38,7 @@ void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t if (src != NULL)
dest = a2tf(src, unicode);
else if (def != NULL)
- dest = mir_tstrdup(def);
+ dest = mir_wstrdup(def);
}
char* arrayToHex(BYTE* data, size_t datasz)
@@ -305,11 +305,11 @@ wchar_t* EscapeChatTags(const wchar_t* pszText) nChars++;
if (nChars == 0)
- return mir_tstrdup(pszText);
+ return mir_wstrdup(pszText);
- wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_tstrlen(pszText) + 1 + nChars));
+ wchar_t *pszNewText = (wchar_t*)mir_alloc(sizeof(wchar_t)*(mir_wstrlen(pszText) + 1 + nChars));
if (pszNewText == NULL)
- return mir_tstrdup(pszText);
+ return mir_wstrdup(pszText);
const wchar_t *s = pszText;
wchar_t *d = pszNewText;
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 28126efa5d..acd43695cb 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -245,12 +245,12 @@ void CMsnProto::MSN_CleanupLists(void) int count = db_event_count(p.hContact);
if (count) {
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);
+ wchar_t *sze = mir_a2u(p.email);
+ mir_snwprintf(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);
wchar_t title[128];
- mir_sntprintf(title, TranslateT("%s protocol"), m_tszUserName);
+ mir_snwprintf(title, TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 27cb629258..2016dfc9b9 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -255,14 +255,14 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) wchar_t* mimeSubjectW = tFileInfo.decode(Subject);
- mir_sntprintf(tBuffer2, TranslateT("Subject: %s"), mimeSubjectW);
+ mir_snwprintf(tBuffer2, TranslateT("Subject: %s"), mimeSubjectW);
wchar_t* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
- mir_sntprintf(tBuffer, msgtxt, mimeFromW, Fromaddr);
+ mir_snwprintf(tBuffer, msgtxt, mimeFromW, Fromaddr);
mir_free(mimeFromW);
mir_free(mimeSubjectW);
ShowPopup = true;
@@ -271,8 +271,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
- mir_sntprintf(tBuffer, m_tszUserName);
- mir_sntprintf(tBuffer2, TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
+ mir_snwprintf(tBuffer, m_tszUserName);
+ mir_snwprintf(tBuffer2, TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
}
if (UnreadMessages == mUnreadMessages && UnreadJunkEmails == mUnreadJunkEmails && !isInitial)
@@ -385,10 +385,10 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) ch = wcschr(ch + 1, '[');
} while (ch && !iswdigit(ch[1]));
if (ch) *ch = 0;
- rtrimt(name);
+ rtrimw(name);
wchar_t szNick[128];
- mir_sntprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails);
+ mir_snwprintf(szNick, getByte("DisableHotmailJunk", 0) ? L"%s [%d]" : L"%s [%d][%d]", name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
setTString(hContact, "Nick", szNick);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 3d76b63cde..5b6b1b1ec7 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -118,7 +118,7 @@ void CMsnProto::InitCustomFolders(void) if (InitCstFldRan) return;
wchar_t folder[MAX_PATH];
- mir_sntprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
+ mir_snwprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
@@ -170,7 +170,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) // MSN_GetAvatarFileName - gets a file name for an contact's avatar
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);
+ size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
@@ -181,8 +181,8 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ if (getString(hContact, "PictContext", &dbv) == 0) {
char* szAvatarHash = MSN_GetAvatarHash(dbv.pszVal);
if (szAvatarHash != NULL) {
- wchar_t *sztAvatarHash = mir_a2t(szAvatarHash);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
+ wchar_t *sztAvatarHash = mir_a2u(szAvatarHash);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.", sztAvatarHash);
mir_free(sztAvatarHash);
mir_free(szAvatarHash);
}
@@ -196,13 +196,13 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ pszDest[0] = 0;
}
else {
- wchar_t *sztModuleName = mir_a2t(m_szModuleName);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName);
+ wchar_t *sztModuleName = mir_a2u(m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s avatar.", sztModuleName);
mir_free(sztModuleName);
}
if (ext == NULL) {
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"*");
bool found = false;
_wfinddata_t c_file;
@@ -210,7 +210,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ if (hFile > -1L) {
do {
if (wcsrchr(c_file.name, '.')) {
- mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
+ mir_snwprintf(pszDest + tPathLen2, cbLen - tPathLen2, L"\\%s", c_file.name);
found = true;
}
} while (_wfindnext(hFile, &c_file) == 0);
@@ -221,7 +221,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_ }
else {
tPathLen--;
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, ext);
}
}
@@ -319,14 +319,14 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t));
if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
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);
+ wchar_t *tszModuleName = mir_a2u(m_szModuleName);
+ tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
mir_free(tszModuleName);
mir_free(tmpPath);
}
else {
- mir_tstrcpy(pszDest, path);
- tPathLen = mir_tstrlen(pszDest);
+ mir_wstrcpy(pszDest, path);
+ tPathLen = mir_wstrlen(pszDest);
}
if (hContact != NULL) {
@@ -337,12 +337,12 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, _ui64tow((UINT_PTR)hContact, dbv.ptszVal, 10);
}
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", dbv.ptszVal);
db_free(&dbv);
}
else {
- wchar_t *tszModuleName = mir_a2t(m_szModuleName);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName);
+ wchar_t *tszModuleName = mir_a2u(m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s", tszModuleName);
mir_free(tszModuleName);
}
@@ -356,8 +356,8 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, if (!exist)
CreateDirectoryTreeT(pszDest);
- wchar_t *sztSmileyName = mir_a2t(SmileyName);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName,
+ wchar_t *sztSmileyName = mir_a2u(SmileyName);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s.%s", sztSmileyName,
type == MSN_APPID_CUSTOMSMILEY ? L"png" : L"gif");
mir_free(sztSmileyName);
}
@@ -791,7 +791,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) wchar_t buf[128] = L"Miranda";
DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
- szPlace = mir_utf8encodeT(buf);
+ szPlace = mir_utf8encodeW(buf);
}
char** msgptr = GetStatusMsgLoc(newStatus);
@@ -921,7 +921,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) wchar_t *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
- mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
+ mir_vsnwprintf(tBuffer, _countof(tBuffer), buf, tArgs);
va_end(tArgs);
mir_free(buf);
@@ -996,14 +996,14 @@ void CMsnProto::InitPopups(void) ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Hotmail");
hPopupHotmail = Popup_RegisterClass(&ppc);
ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notify"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notify"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&ppc);
@@ -1012,7 +1012,7 @@ void CMsnProto::InitPopups(void) ppc.colorText = RGB(255, 245, 225); //Yellow
ppc.iSeconds = 60;
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&ppc);
}
@@ -1026,7 +1026,7 @@ void CALLBACK sttMainThreadCallback(void *param) if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
- mir_sntprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
+ mir_snwprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
if (ret == IDYES)
@@ -1066,8 +1066,8 @@ void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int f PopupData *pud = (PopupData*)mir_calloc(sizeof(PopupData));
pud->flags = flags;
pud->url = mir_strdup(url);
- pud->title = mir_tstrdup(nickname);
- pud->text = mir_tstrdup(msg);
+ pud->title = mir_wstrdup(nickname);
+ pud->text = mir_wstrdup(msg);
pud->proto = this;
CallFunctionAsync(sttMainThreadCallback, pud);
@@ -1180,7 +1180,7 @@ int filetransfer::openNext(void) if (std.ptszFiles && std.ptszFiles[cf]) {
bCompleted = false;
- replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]);
+ replaceStrW(std.tszCurrentFile, std.ptszFiles[cf]);
fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
if (fileId != -1) {
std.currentFileSize = _filelengthi64(fileId);
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 30ecdbc16f..e468eebf2c 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -314,7 +314,7 @@ static bool IsIcfEnabled(void) wchar_t szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, _countof(szFileName));
- wszFileName = mir_t2u(szFileName);
+ wszFileName = mir_wstrdup(szFileName);
// Allocate a BSTR for the process image file name.
fwBstrProcessImageFileName = SysAllocString(wszFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 96437c9bef..38b32891a8 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -250,7 +250,7 @@ LBL_Continue: #ifdef OBSOLETE
GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
- if (mir_tstrcmp(dbv.ptszVal, screenStr))
+ if (mir_wstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
db_free(&dbv);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 632aede4bc..5bb5a9b610 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -259,8 +259,8 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) cont.hContact = ft->std.hContact;
cont.type = 1;
- wchar_t* pathcpy = mir_tstrdup(ft->std.tszCurrentFile);
- mir_tstrcpy(wcsrchr(pathcpy, '.') + 1, ext);
+ wchar_t* pathcpy = mir_wstrdup(ft->std.tszCurrentFile);
+ mir_wstrcpy(wcsrchr(pathcpy, '.') + 1, ext);
_wrename(ft->std.tszCurrentFile, pathcpy);
cont.path = pathcpy;
@@ -1184,7 +1184,7 @@ void CMsnProto::p2p_InitFileTransfer( }
else {
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_tstrdup(szFileName);
+ ft->std.tszCurrentFile = mir_wstrdup(szFileName);
// debugLogA("My avatar file opened for %s as %08p::%d", szEmail, ft, ft->fileId);
ft->std.totalBytes = ft->std.currentFileSize = _filelengthi64(ft->fileId);
ft->std.flags |= PFTS_SENDING;
@@ -1218,13 +1218,13 @@ void CMsnProto::p2p_InitFileTransfer( }
mir_free(ft->std.tszCurrentFile);
- ft->std.tszCurrentFile = mir_u2t(wszFileName);
+ ft->std.tszCurrentFile = mir_wstrdup(wszFileName);
ft->std.totalBytes = ft->std.currentFileSize = ((HFileContext*)szContext)->dwSize;
ft->std.totalFiles = 1;
wchar_t tComment[40];
- mir_sntprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -2030,7 +2030,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) else
pszFiles = ft->std.tszCurrentFile;
- wchar_t *fname = mir_t2u(pszFiles);
+ wchar_t *fname = mir_wstrdup(pszFiles);
wcsncpy(ctx->wszFileName, fname, MAX_PATH);
mir_free(fname);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 624c736f97..e9e6950beb 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -144,7 +144,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : nlu1.ptszDescriptiveName = szBuffer;
mir_snprintf(szDbsettings, "%s_HTTPS", m_szModuleName);
- mir_sntprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
NETLIBUSER nlu = { 0 };
@@ -158,7 +158,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : nlu.pfnHttpGatewayWrapSend = msn_httpGatewayWrapSend;
nlu.pfnHttpGatewayUnwrapRecv = msn_httpGatewayUnwrapRecv;
- mir_sntprintf(szBuffer, TranslateT("%s plugin connections"), m_tszUserName);
+ mir_snwprintf(szBuffer, TranslateT("%s plugin connections"), m_tszUserName);
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
m_DisplayNameCache = NULL;
@@ -451,7 +451,7 @@ HANDLE __cdecl CMsnProto::SearchBasic(const wchar_t* id) {
if (!msnLoggedIn) return 0;
- wchar_t* email = mir_tstrdup(id);
+ wchar_t* email = mir_wstrdup(id);
ForkThread(&CMsnProto::MsnSearchAckThread, email);
return email;
@@ -492,8 +492,8 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) filetransfer* ft = (filetransfer*)arg;
wchar_t filefull[MAX_PATH];
- mir_sntprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
- replaceStrT(ft->std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
+ replaceStrW(ft->std.tszCurrentFile, filefull);
ResetEvent(ft->hResumeEvt);
if (ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->std))
@@ -583,13 +583,13 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s return 0;
#endif
- if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
+ if ((ft->std.tszWorkingDir = mir_wstrdup(szPath)) == NULL) {
wchar_t szCurrDir[MAX_PATH];
GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
- ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
+ ft->std.tszWorkingDir = mir_wstrdup(szCurrDir);
}
else {
- size_t len = mir_tstrlen(ft->std.tszWorkingDir) - 1;
+ size_t len = mir_wstrlen(ft->std.tszWorkingDir) - 1;
if (ft->std.tszWorkingDir[len] == '\\')
ft->std.tszWorkingDir[len] = 0;
}
@@ -672,7 +672,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** ft->bCanceled = true;
break;
case FILERESUME_RENAME:
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
break;
case FILERESUME_OVERWRITE:
ft->std.currentFileProgress = 0;
@@ -701,7 +701,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** break;
case FILERESUME_RENAME:
- replaceStrT(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.tszCurrentFile, *szFilename);
default:
bool fcrt = ft->create() != -1;
@@ -829,7 +829,7 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) int i;
for (i = 0; i < pre->lParam; i++)
- dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.w) + 2 + mir_tstrlen(isrList[i]->id.w));
+ dbei.cbBlob += int(mir_wstrlen(isrList[i]->nick.w) + 2 + mir_wstrlen(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.w));
@@ -1054,7 +1054,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const wchar_t* msg) return 1;
mir_free(*msgptr);
- char* buf = *msgptr = mir_utf8encodeT(msg);
+ char* buf = *msgptr = mir_utf8encodeW(msg);
if (buf && mir_strlen(buf) > 1859) {
buf[1859] = 0;
const int i = 1858;
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 034b75f52e..a0cd9ca76d 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -45,7 +45,7 @@ static wchar_t* get_json_str(JSONNode *item, const char *pszValue) {
if (JSONNode *node = json_get(item, pszValue)) {
wchar_t *ret = json_as_string(node);
- if (!mir_tstrcmp(ret, L"null")) {
+ if (!mir_wstrcmp(ret, L"null")) {
mir_free(ret);
return NULL;
}
@@ -79,14 +79,14 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) JSONNode *items = json_as_array(root), *item;
for (size_t i = 0; i < json_size(items); i++) {
int lstId = LIST_FL;
- ptrT nick;
+ ptrW nick;
item = json_at(items, i);
if (item == NULL)
break;
- ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "skypename")))));
- ptrA pszNick(mir_t2a(ptrT(get_json_str(item, "fullname"))));
+ ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "skypename")))));
+ ptrA pszNick(mir_u2a(ptrW(get_json_str(item, "fullname"))));
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, pszNick, true, false);
@@ -137,8 +137,8 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) break;
node = json_get(item, "username");
- ptrA skypename(mir_t2a(ptrT(json_as_string(node))));
- ptrT value;
+ ptrA skypename(mir_u2a(ptrW(json_as_string(node))));
+ ptrW value;
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
@@ -184,8 +184,8 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (item == NULL)
return false;
- ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "username")))));
- ptrT value;
+ ptrA skypename(mir_u2a(ptrW(json_as_string(json_get(item, "username")))));
+ ptrW value;
char szWLId[128];
mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 33f1a10da5..b854e48596 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -38,7 +38,7 @@ void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init) m_arGroups.insert(p);
if (init)
- Clist_GroupCreate(0, ptrT(mir_utf8decodeT(grpName)));
+ Clist_GroupCreate(0, ptrW(mir_utf8decodeW(grpName)));
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index a0cc11efe2..4746906aca 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -81,7 +81,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
- mir_tstrcpy(pai->filename, filename);
+ mir_wstrcpy(pai->filename, filename);
return pai->format == PA_FORMAT_UNKNOWN ? GAIR_NOAVATAR : GAIR_SUCCESS;
}
@@ -113,7 +113,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) mir_free(szAvatarHash);
}
}
- mir_tstrcpy(pai->filename, filename);
+ mir_wstrcpy(pai->filename, filename);
return GAIR_SUCCESS;
}
@@ -140,7 +140,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) ft->p2p_object = mir_strdup(szContext);
MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), L"unk");
- ft->std.tszCurrentFile = mir_tstrdup(filename);
+ ft->std.tszCurrentFile = mir_wstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
}
@@ -216,7 +216,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) MSN_SetMyAvatar(fname, pData, dwPngSize);
StoreAvatarData* par = (StoreAvatarData*)mir_alloc(sizeof(StoreAvatarData));
- par->szName = mir_tstrdup(fname);
+ par->szName = mir_wstrdup(fname);
par->data = pData;
par->dataSize = dwPngSize;
par->szMimeType = "image/png";
@@ -301,15 +301,15 @@ INT_PTR CMsnProto::GetCurrentMedia(WPARAM, LPARAM lParam) if (cm == NULL || cm->cbSize != sizeof(LISTENINGTOINFO))
return -1;
- cm->ptszArtist = mir_tstrdup(msnCurrentMedia.ptszArtist);
- cm->ptszAlbum = mir_tstrdup(msnCurrentMedia.ptszAlbum);
- cm->ptszTitle = mir_tstrdup(msnCurrentMedia.ptszTitle);
- cm->ptszTrack = mir_tstrdup(msnCurrentMedia.ptszTrack);
- cm->ptszYear = mir_tstrdup(msnCurrentMedia.ptszYear);
- cm->ptszGenre = mir_tstrdup(msnCurrentMedia.ptszGenre);
- cm->ptszLength = mir_tstrdup(msnCurrentMedia.ptszLength);
- cm->ptszPlayer = mir_tstrdup(msnCurrentMedia.ptszPlayer);
- cm->ptszType = mir_tstrdup(msnCurrentMedia.ptszType);
+ cm->ptszArtist = mir_wstrdup(msnCurrentMedia.ptszArtist);
+ cm->ptszAlbum = mir_wstrdup(msnCurrentMedia.ptszAlbum);
+ cm->ptszTitle = mir_wstrdup(msnCurrentMedia.ptszTitle);
+ cm->ptszTrack = mir_wstrdup(msnCurrentMedia.ptszTrack);
+ cm->ptszYear = mir_wstrdup(msnCurrentMedia.ptszYear);
+ cm->ptszGenre = mir_wstrdup(msnCurrentMedia.ptszGenre);
+ cm->ptszLength = mir_wstrdup(msnCurrentMedia.ptszLength);
+ cm->ptszPlayer = mir_wstrdup(msnCurrentMedia.ptszPlayer);
+ cm->ptszType = mir_wstrdup(msnCurrentMedia.ptszType);
cm->dwFlags = msnCurrentMedia.dwFlags;
return 0;
@@ -360,7 +360,7 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM, LPARAM lParam) text = (wchar_t *)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&msnCurrentMedia);
else {
text = (wchar_t *)mir_alloc(128 * sizeof(wchar_t));
- mir_sntprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""),
+ mir_snwprintf(text, 128, L"%s - %s", (msnCurrentMedia.ptszTitle ? msnCurrentMedia.ptszTitle : L""),
(msnCurrentMedia.ptszArtist ? msnCurrentMedia.ptszArtist : L""));
}
setTString("ListeningTo", text);
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index ea171e6215..d3ec36dc86 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -385,13 +385,13 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) GCThreadData* CMsnProto::MSN_GetThreadByChatId(const wchar_t* chatId)
{
- if (mir_tstrlen(chatId) == 0)
+ if (mir_wstrlen(chatId) == 0)
return NULL;
mir_cslock lck(m_csThreads);
for (int i = 0; i < m_arGCThreads.getCount(); i++) {
GCThreadData *T = m_arGCThreads[i];
- if (mir_tstrcmpi(T->mChatID, chatId) == 0)
+ if (mir_wstrcmpi(T->mChatID, chatId) == 0)
return T;
}
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 859023b6bc..3439a57fc0 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -1033,7 +1033,7 @@ struct InviteChatParam CMsnProto* ppro;
InviteChatParam(const wchar_t* id, MCONTACT hContact, CMsnProto* ppro)
- : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {}
+ : id(mir_wstrdup(id)), hContact(hContact), ppro(ppro) {}
~InviteChatParam() {
mir_free(id);
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index 4317adf91a..d41748bd84 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -27,8 +27,8 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con std::string smessage = message; utils::text::replace_all(&smessage, "%", "%%"); - ptrT tmessage(mir_a2t_cp(smessage.c_str(), CP_UTF8)); - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tmessage(mir_a2u_cp(smessage.c_str(), CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -37,7 +37,7 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con if (tname == NULL) { gcd.iType = GC_EVENT_INFORMATION; - tname = mir_tstrdup(TranslateT("Server")); + tname = mir_wstrdup(TranslateT("Server")); gce.bIsMe = false; } else gce.bIsMe = (m_nick == name); @@ -61,7 +61,7 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam) { case GC_USER_MESSAGE: { - std::string text = mir_t2a_cp(hook->ptszText,CP_UTF8); + std::string text = mir_u2a_cp(hook->ptszText,CP_UTF8); // replace %% back to %, because chat automatically does this to sent messages utils::text::replace_all(&text, "%%", "%"); @@ -88,7 +88,7 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam) void MinecraftDynmapProto::AddChatContact(const char *name) { - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -108,7 +108,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name) void MinecraftDynmapProto::DeleteChatContact(const char *name) { - ptrT tname(mir_a2t_cp(name, CP_UTF8)); + ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -123,7 +123,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name) INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) { - ptrT tszTitle(mir_a2t_cp(m_title.c_str(), CP_UTF8)); + ptrW tszTitle(mir_a2u_cp(m_title.c_str(), CP_UTF8)); // Create the group chat session GCSESSION gcw = {sizeof(gcw)}; @@ -155,7 +155,7 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) void MinecraftDynmapProto::SetTopic(const char *topic) { - ptrT ttopic(mir_a2t_cp(topic, CP_UTF8)); + ptrW ttopic(mir_a2u_cp(topic, CP_UTF8)); GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC }; GCEVENT gce = { sizeof(gce), &gcd }; diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index 28c428e30b..3f8c6fc4c9 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -64,7 +64,7 @@ static BOOL StoreDBCheckState(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { - ptrT tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); + ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting)); if (tstr) SetDlgItemText(hwnd, idCtrl, tstr); } diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 71c7932685..7d2c845e55 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -46,12 +46,12 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t NETLIBUSER nlu = {sizeof(nlu)}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; - mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName); + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; - mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); } diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index b3db982704..73fc40ea11 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -37,7 +37,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a name = TranslateT("Server");
gce.bIsMe = false;
}
- else gce.bIsMe = !mir_tstrcmp(name, this->facy.nick_);
+ else gce.bIsMe = !mir_wstrcmp(name, this->facy.nick_);
if (addtolog)
gce.dwFlags |= GCEF_ADDTOLOG;
@@ -58,7 +58,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) {
case GC_USER_MESSAGE:
{
- std::string text = mir_t2a_cp(hook->ptszText, CP_UTF8);
+ std::string text = mir_u2a_cp(hook->ptszText, CP_UTF8);
// replace %% back to %, because chat automatically does this to sent messages
utils::text::replace_all(&text, "%%", "%");
@@ -238,7 +238,7 @@ void OmegleProto::AddChatContact(const wchar_t *name) if (name == NULL)
gce.bIsMe = false;
else
- gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
+ gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
if (gce.bIsMe)
gce.ptszStatus = L"Admin";
@@ -259,7 +259,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name) if (name == NULL)
gce.bIsMe = false;
else
- gce.bIsMe = mir_tstrcmp(name, this->facy.nick_);
+ gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
@@ -333,7 +333,7 @@ void OmegleProto::SetChatStatus(int status) // Load actual name from database
facy.nick_ = db_get_tsa(NULL, m_szModuleName, OMEGLE_KEY_NAME);
if (facy.nick_ == NULL) {
- facy.nick_ = mir_tstrdup(TranslateT("You"));
+ facy.nick_ = mir_wstrdup(TranslateT("You"));
db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
}
diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h index 2aae2017a8..925132bb82 100644 --- a/protocols/Omegle/src/client.h +++ b/protocols/Omegle/src/client.h @@ -69,7 +69,7 @@ public: std::string chat_id_;
std::string server_;
std::string question_;
- ptrT nick_;
+ ptrW nick_;
//int msgid_;
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 27370cb1f4..0e3abe9354 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()); - wchar_t *msg = mir_a2t(str); + wchar_t *msg = mir_a2u(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()); - wchar_t *msg = mir_a2t(str); + wchar_t *msg = mir_a2u(str); parent->UpdateChat(NULL, msg); mir_free(msg); } @@ -505,14 +505,14 @@ bool Omegle_client::events() //data["timestamp"]; // e.g. 1445336566.0196209 // We got info about count of connected people there - ptrT count(json_as_string(json_get(data, "count"))); + ptrW count(json_as_string(json_get(data, "count"))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); + mir_snwprintf(strT, TranslateT("On whole Omegle are %s strangers online now."), count); parent->UpdateChat(NULL, strT); } else if (name == "serverMessage") { - ptrT message(json_as_string(json_at(item, 1))); + ptrW message(json_as_string(json_at(item, 1))); parent->UpdateChat(NULL, TranslateTS(message)); } else if (name == "connected") { @@ -536,7 +536,7 @@ bool Omegle_client::events() JSONNode *items = json_at(item, 1); size_t size = json_size(items); for (size_t i = 0; i < size; i++) { - likes += ptrT(json_as_string(json_at(items, i))); + likes += ptrW(json_as_string(json_at(items, i))); if (i < size - 1) likes += L", "; } @@ -545,7 +545,7 @@ bool Omegle_client::events() parent->SetTopic(likes.c_str()); } else if (name == "question") { - ptrT question(json_as_string(json_at(item, 1))); + ptrW question(json_as_string(json_at(item, 1))); parent->SetTopic(question); } else if (name == "typing" || name == "spyTyping") { @@ -556,8 +556,8 @@ bool Omegle_client::events() st.cbSize = sizeof(st); st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); - ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(L"Stranger")); - mir_sntprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who)); + ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); + mir_snwprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -569,8 +569,8 @@ bool Omegle_client::events() st.cbSize = sizeof(st); st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); - ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(L"Stranger")); - mir_sntprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who)); + ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger")); + mir_snwprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who)); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } @@ -581,7 +581,7 @@ bool Omegle_client::events() SkinPlaySound("StrangerMessage"); if (state_ == STATE_ACTIVE) { - ptrT msg(json_as_string(json_at(item, 1))); + ptrW msg(json_as_string(json_at(item, 1))); parent->UpdateChat(TranslateT("Stranger"), msg); } } @@ -592,8 +592,8 @@ bool Omegle_client::events() SkinPlaySound("StrangerMessage"); if (state_ == STATE_SPY) { - ptrT stranger(json_as_string(json_at(item, 1))); - ptrT msg(json_as_string(json_at(item, 2))); + ptrW stranger(json_as_string(json_at(item, 1))); + ptrW msg(json_as_string(json_at(item, 2))); parent->UpdateChat(stranger, msg); } } @@ -612,10 +612,10 @@ bool Omegle_client::events() else if (name == "spyDisconnected") { CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL); - ptrT stranger(json_as_string(json_at(item, 1))); + ptrW stranger(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); + mir_snwprintf(strT, TranslateT("%s disconnected."), TranslateTS(stranger)); parent->UpdateChat(NULL, strT); // Stranger disconnected @@ -637,10 +637,10 @@ bool Omegle_client::events() parent->StopChat(false); } else if (name == "error") { - ptrT error(json_as_string(json_at(item, 1))); + ptrW error(json_as_string(json_at(item, 1))); wchar_t strT[255]; - mir_sntprintf(strT, TranslateT("Error: %s"), TranslateTS(error)); + mir_snwprintf(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 9868c51c57..206f3af30e 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -38,7 +38,7 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- ptrT tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
+ ptrW tstr(db_get_tsa(NULL, ppro->m_szModuleName, szSetting));
if (tstr)
SetDlgItemText(hwnd, idCtrl, tstr);
}
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index 309d0fe897..f49306a5a5 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -49,7 +49,7 @@ PLUGININFOEX pluginInfo = { // Protocol instances
static int compare_protos(const OmegleProto *p1, const OmegleProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<OmegleProto> g_Instances(1, compare_protos);
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 2a8f16b95e..86eff3e5fd 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)) { - wchar_t *msg = mir_a2t_cp(data.c_str(), CP_UTF8); + wchar_t *msg = mir_a2u_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 aff30158c6..ee0b34a616 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -46,12 +46,12 @@ PROTO<OmegleProto>(proto_name, username) NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 71c0528eb0..dcf7aa0b27 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -51,7 +51,7 @@ void mwServiceConf_on_invited(mwConference* conf, mwLoginInfo* inviter, const ch }
else {
proto->debugLog(L"mwServiceConf_on_invited() mwConference_reject");
- char* temp = mir_utf8encodeT(TranslateT("Your invitation has been rejected."));
+ char* temp = mir_utf8encodeW(TranslateT("Your invitation has been rejected."));
mwConference_reject(conf, 0, temp);
mir_free(temp);
}
@@ -108,8 +108,8 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_conf_opened() start");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
- wchar_t* tszConfTitle = mir_utf8decodeT(mwConference_getTitle(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
+ wchar_t* tszConfTitle = mir_utf8decodeW(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");
- wchar_t* tszUserName = mir_utf8decodeT(((mwLoginInfo*)user->data)->user_name);
- wchar_t* tszUserId = mir_utf8decodeT(((mwLoginInfo*)user->data)->login_id);
+ wchar_t* tszUserName = mir_utf8decodeW(((mwLoginInfo*)user->data)->user_name);
+ wchar_t* tszUserId = mir_utf8decodeW(((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");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
GCDEST gcd = { proto->m_szModuleName };
gcd.ptszID = tszConfId;
@@ -208,9 +208,9 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user) mwSametimeList_free(user_list);
}
- ptrT tszConfId(mir_utf8decodeT(mwConference_getName(conf)));
- ptrT tszUserName(mir_utf8decodeT(user->user_name));
- ptrT tszUserId(mir_utf8decodeT(user->login_id));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszUserName(mir_utf8decodeW(user->user_name));
+ ptrW tszUserId(mir_utf8decodeW(user->login_id));
// add user
GCDEST gcd = { proto->m_szModuleName };
@@ -237,9 +237,9 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user) CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLog(L"mwServiceConf_on_peer_parted() start");
- ptrT tszConfId(mir_utf8decodeT(mwConference_getName(conf)));
- ptrT tszUserName(mir_utf8decodeT(user->user_name));
- ptrT tszUserId(mir_utf8decodeT(user->login_id));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszUserName(mir_utf8decodeW(user->user_name));
+ ptrW tszUserId(mir_utf8decodeW(user->login_id));
// remove user
GCDEST gcd = { proto->m_szModuleName };
@@ -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");
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName(conf));
+ wchar_t* tszConfId = mir_utf8decodeW(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;
- wchar_t* textT = mir_utf8decodeT(what);
- wchar_t* tszUserName = mir_utf8decodeT(user->user_name);
- wchar_t* tszUserId = mir_utf8decodeT(user->login_id);
+ wchar_t* textT = mir_utf8decodeW(what);
+ wchar_t* tszUserName = mir_utf8decodeW(user->user_name);
+ wchar_t* tszUserId = mir_utf8decodeW(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) {
- wchar_t* idt = mir_utf8decodeT(name);
+ wchar_t* idt = mir_utf8decodeW(name);
GCDEST gcd = {m_szModuleName, idt, GC_EVENT_CONTROL};
GCEVENT gce = { sizeof(gce), &gcd };
@@ -341,8 +341,8 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) { GList *conferences = mwServiceConference_getConferences(service_conference);
for (GList *conf = conferences;conf;conf = conf->next) {
- wchar_t* tszConfId = mir_utf8decodeT(mwConference_getName((mwConference*)conf->data));
- if (mir_tstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
+ wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName((mwConference*)conf->data));
+ if (mir_wstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
switch(gch->pDest->iType) {
case GC_USER_MESSAGE:
{
@@ -406,8 +406,8 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) mwIdBlock idb;
if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) {
wchar_t title[512];
- wchar_t* ts = mir_utf8decodeT(my_login_info->user_name);
- mir_sntprintf(title, TranslateT("%s's conference"), ts);
+ wchar_t* ts = mir_utf8decodeW(my_login_info->user_name);
+ mir_snwprintf(title, TranslateT("%s's conference"), ts);
mir_free(ts);
idb.user = id_block.user;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 567520469a..c606e0587e 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -28,12 +28,12 @@ void mwFileTransfer_offered(mwFileTransfer* ft) proto->ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)ft, 0);
- wchar_t* filenameT = mir_utf8decodeT(mwFileTransfer_getFileName(ft));
+ wchar_t* filenameT = mir_utf8decodeW(mwFileTransfer_getFileName(ft));
const char* message = mwFileTransfer_getMessage(ft);
wchar_t descriptionT[512];
if (message) {
- wchar_t* messageT = mir_utf8decodeT(message);
- mir_sntprintf(descriptionT, L"%s - %s", filenameT, messageT);
+ wchar_t* messageT = mir_utf8decodeW(message);
+ mir_snwprintf(descriptionT, L"%s - %s", filenameT, messageT);
mir_free(messageT);
} else
wcsncpy_s(descriptionT, filenameT, _TRUNCATE);
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index a6092c0c21..ee7cc4d659 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -95,10 +95,10 @@ void mwIm_place_invite(struct mwConversation* conv, const char* message, const c ///TODO unimplemented
- wchar_t* tszMessage = mir_utf8decodeT(message);
+ wchar_t* tszMessage = mir_utf8decodeW(message);
wchar_t msg[512];
- mir_sntprintf(msg, TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
+ mir_snwprintf(msg, TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
proto->showPopup(msg, SAMETIME_POPUP_INFO);
mir_free(tszMessage);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index aa08112856..c848ee911b 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -103,20 +103,20 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA WORD client_ver = proto->GetClientVersion();
if (client_ver) {
wchar_t verbuf[100];
- mir_sntprintf(verbuf, TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
+ mir_snwprintf(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) {
wchar_t verbuf[100];
- mir_sntprintf(verbuf, TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
+ mir_snwprintf(verbuf, TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf);
}
- 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);
+ wchar_t *s = mir_utf8decodeW(proto->options.server_name); SetDlgItemText(hwndDlg, IDC_ED_SNAME, s); mir_free(s);
+ s = mir_utf8decodeW(proto->options.id); SetDlgItemText(hwndDlg, IDC_ED_NAME, s); mir_free(s);
+ s = mir_utf8decodeW(proto->options.pword); SetDlgItemText(hwndDlg, IDC_ED_PWORD, s); mir_free(s);
SetDlgItemInt(hwndDlg, IDC_ED_PORT, proto->options.port, FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_GETSERVERCONTACTS, proto->options.get_server_contacts ? BST_CHECKED : BST_UNCHECKED);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index ca84865901..aa3981f62b 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -15,7 +15,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN {
// Register m_hNetlibUser user
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS;
@@ -86,7 +86,7 @@ MCONTACT CSametimeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) 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);
+ char* szPathA = mir_u2a(szPath);
HANDLE res = AcceptFileTransfer(hContact, hTransfer, szPathA);
mir_free(szPathA);
return res;
@@ -159,7 +159,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) HANDLE CSametimeProto::SearchBasic(const wchar_t* id)
{
- debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_tstrlen(id));
+ debugLog(L"CSametimeProto::SearchBasic() id:len=[%d]", id == NULL ? -1 : mir_wstrlen(id));
return (HANDLE)SearchForUser(T2Utf(id), FALSE);
///TODO - add timeout (like at GGPROTO::searchthread)
}
@@ -168,7 +168,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) {
wchar_t buf[512];
if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
- debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_tstrlen(buf));
+ debugLog(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
return NULL;
@@ -277,14 +277,14 @@ int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt {
debugLog(L"CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]", hContact, mode);
- ptrT pszMsg(mir_utf8decodeT(evt->szMessage));
+ ptrW pszMsg(mir_utf8decodeW(evt->szMessage));
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, pszMsg);
return 0;
}
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));
+ debugLog(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == NULL ? -1 : mir_wstrlen(msg));
SetSessionAwayMessage(iStatus, msg);
return 0;
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index 6fa0644c75..d9b8234596 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()");
- wchar_t* tt = mir_utf8decodeT(text);
+ wchar_t* tt = mir_utf8decodeW(text);
MessageBox(0, tt, TranslateT("Sametime administrator message"), MB_OK);
mir_free(tt);
}
@@ -149,9 +149,9 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from 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);
+ stzFrom = mir_utf8decodeW(from->user_name);
+ stzText = mir_utf8decodeW(text);
+ mir_snwprintf(stzFromBuff, TranslateT("Session announcement - from '%s'"), stzFrom);
MessageBox(0, TranslateTS(stzText), stzFromBuff, MB_OK);
mir_free(stzText);
mir_free(stzFrom);
@@ -209,7 +209,7 @@ void __cdecl SessionSetUserStatus(struct mwSession* session) default:
wchar_t buff[512];
- mir_sntprintf(buff, TranslateT("Unknown user status: %d"), us.status);
+ mir_snwprintf(buff, TranslateT("Unknown user status: %d"), us.status);
proto->showPopup(buff, SAMETIME_POPUP_ERROR);
proto->debugLog(buff);
@@ -313,7 +313,7 @@ int CSametimeProto::SetIdle(bool idle) void CSametimeProto::SetSessionAwayMessage(int status, const wchar_t* msgT)
{
- debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_tstrlen(msgT));
+ debugLog(L"SetSessionAwayMessage() status=[%d], msgT:len=[%d]", status, msgT == NULL ? -1 : mir_wstrlen(msgT));
T2Utf msg(msgT);
if (status == ID_STATUS_ONLINE)
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 4660b68c8f..4d65b377da 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -48,7 +48,7 @@ void CSametimeProto::AddGroup(const char* name, bool expanded) if (name && mir_strcmp(name, Translate("None")) == 0)
return;
- MGROUP hGroup = Clist_GroupCreate(NULL, ptrT(mir_utf8decodeT(name)));
+ MGROUP hGroup = Clist_GroupCreate(NULL, ptrW(mir_utf8decodeW(name)));
Clist_GroupSetExpanded(hGroup, expanded);
}
@@ -237,7 +237,7 @@ void CSametimeProto::ExportContactsToList(mwSametimeList* user_list) //group_open = (db_get_b(0, szProtoGroups, buff, 0) == 1);
- ptrT ptszGroup(mir_utf8decodeT(group_alias));
+ ptrW ptszGroup(mir_utf8decodeW(group_alias));
MGROUP hGroup = Clist_GroupExists(ptszGroup);
if (hGroup) {
DWORD expanded;
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 0e24204f8d..f876860fc0 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -41,7 +41,7 @@ void CSametimeProto::RegisterPopups() puc.pszName = szName;
mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify");
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notification"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notification"));
puc.hIcon = CopyIcon(LoadIconEx("notify", FALSE));
ReleaseIconEx("notify", FALSE);
puc.iSeconds = 8;
@@ -50,7 +50,7 @@ void CSametimeProto::RegisterPopups() hPopupNotify = Popup_RegisterClass(&puc);
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
puc.hIcon = CopyIcon(LoadIconEx("error", FALSE));
ReleaseIconEx("error", FALSE);
puc.iSeconds = 10;
@@ -131,8 +131,8 @@ void CSametimeProto::showPopup(const wchar_t* msg, SametimePopupEnum flag) PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flag = flag;
- puData->title = mir_tstrdup(m_tszUserName);
- puData->text = mir_tstrdup(msg);
+ puData->title = mir_wstrdup(m_tszUserName);
+ puData->text = mir_wstrdup(msg);
puData->proto = this;
CallFunctionAsync(sttMainThreadCallback, puData);
@@ -144,7 +144,7 @@ void CSametimeProto::showPopup(guint32 code) SametimePopupEnum flag = (rcDesc->type == mwReturnCodeError ? SAMETIME_POPUP_ERROR : SAMETIME_POPUP_INFO);
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)));
+ mir_snwprintf(buff, TranslateT("%s\n\nSametime error %S\n%s"), TranslateTS(_A2T(rcDesc->name)), rcDesc->codeString, TranslateTS(_A2T(rcDesc->description)));
showPopup(buff, flag);
debugLog(buff);
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 2bc4d097d0..201d692982 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -21,7 +21,7 @@ LIST<CSkypeProto> CSkypeProto::Accounts(1, CSkypeProto::CompareAccounts); int CSkypeProto::CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
CSkypeProto* CSkypeProto::InitAccount(const char *protoName, const wchar_t *userName)
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index d2c766c4e1..0c780094ff 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -127,7 +127,7 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) 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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -139,12 +139,12 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t CMStringA username(Contacts[hContact]);
username.Replace("live:", "__live_");
username.Replace("facebook:", "__facebook_");
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType);
}
void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
{
- ptrT oldUrl(getTStringA(hContact, "AvatarUrl"));
+ ptrW oldUrl(getTStringA(hContact, "AvatarUrl"));
if (oldUrl != NULL)
if (tszUrl == oldUrl)
return;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 282793848c..6916ad1c35 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -248,8 +248,8 @@ INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM) {
if (hContact)
{
- ptrT idT(getTStringA(hContact, "ChatRoomID"));
- ptrT nameT(getTStringA(hContact, "Nick"));
+ ptrW idT(getTStringA(hContact, "ChatRoomID"));
+ ptrW nameT(getTStringA(hContact, "Nick"));
StartChatRoom(idT, nameT != NULL ? nameT : idT);
}
return 0;
@@ -261,7 +261,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) return 1;
if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
{
- ptrT idT(getTStringA(hContact, "ChatRoomID"));
+ ptrW idT(getTStringA(hContact, "ChatRoomID"));
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
gcd.ptszID = idT;
@@ -309,7 +309,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget, initiator;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"addmember");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"addmember");
if (xml == NULL)
return;
@@ -319,7 +319,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) if (xmlNode == NULL)
break;
- xtarget = mir_t2a(xmlGetText(xmlNode));
+ xtarget = mir_u2a(xmlGetText(xmlNode));
CMStringA target = ParseUrl(xtarget, "8:");
AddChatContact(_A2T(szConversationName), target, target, L"User");
@@ -331,13 +331,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"deletemember");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"deletemember");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = node != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
- xtarget = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xtarget = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlDestroyNode(xml);
}
@@ -353,13 +353,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) {
//content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
ptrA xinitiator, value;
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"topicupdate");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"topicupdate");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"value", 0);
- value = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ value = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlDestroyNode(xml);
}
@@ -372,18 +372,18 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) {
//content=<roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate>
ptrA xinitiator, xId, xRole;
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, L"roleupdate");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"roleupdate");
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0);
- xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
+ xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL;
xmlNode = xmlGetChildByPath(xml, L"target", 0);
if (xmlNode != NULL)
{
HXML xmlId = xmlGetChildByPath(xmlNode, L"id", 0);
HXML xmlRole = xmlGetChildByPath(xmlNode, L"role", 0);
- xId = xmlId != NULL ? mir_t2a(xmlGetText(xmlId)) : NULL;
- xRole = xmlRole != NULL ? mir_t2a(xmlGetText(xmlRole)) : NULL;
+ xId = xmlId != NULL ? mir_u2a(xmlGetText(xmlId)) : NULL;
+ xRole = xmlRole != NULL ? mir_u2a(xmlGetText(xmlRole)) : NULL;
}
xmlDestroyNode(xml);
@@ -392,9 +392,9 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) GCDEST gcd = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
GCEVENT gce = { sizeof(gce), &gcd };
- ptrT tszId(mir_a2t(id));
- ptrT tszRole(mir_a2t(xRole));
- ptrT tszInitiator(mir_a2t(initiator));
+ ptrW tszId(mir_a2u(id));
+ ptrW tszRole(mir_a2u(xRole));
+ ptrW tszInitiator(mir_a2u(initiator));
gce.pDest = &gcd;
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszId;
@@ -426,11 +426,11 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM return;
wchar_t *buf = NEWWSTR_ALLOCA(tszMessage);
- rtrimt(buf);
+ rtrimw(buf);
UnEscapeChatTags(buf);
- ptrA szChatId(mir_t2a(chat_id));
- ptrA szMessage(mir_utf8encodeT(buf));
+ ptrA szChatId(mir_u2a(chat_id));
+ ptrA szMessage(mir_utf8encodeW(buf));
if (strncmp(szMessage, "/me ", 4) == 0)
SendRequest(new SendChatActionRequest(szChatId, time(NULL), szMessage, li));
@@ -448,7 +448,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, gce.time = timestamp;
gce.ptszUID = from;
- CMString tszText(ptrT(mir_utf8decodeT(content)));
+ CMString tszText(ptrW(mir_utf8decodeW(content)));
tszText.Replace(L"%", L"%%");
if (!isAction)
@@ -468,7 +468,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
{
- ptrT topic((wchar_t*)p); // memory must be freed in any case
+ ptrW topic((wchar_t*)p); // memory must be freed in any case
if (response == NULL || response->pData == NULL)
return;
@@ -497,8 +497,8 @@ void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) void CSkypeProto::RenameChat(const char *chat_id, const char *name)
{
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tname(mir_utf8decodeT(name));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tname(mir_utf8decodeW(name));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -508,9 +508,9 @@ void CSkypeProto::RenameChat(const char *chat_id, const char *name) void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const char *initiator)
{
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tname(mir_a2t(initiator));
- ptrT ttopic(mir_utf8decodeT(topic));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tname(mir_a2u(initiator));
+ ptrW ttopic(mir_utf8decodeW(topic));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -541,11 +541,11 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const if (IsChatContact(tchat_id, id))
return;
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
if (wchar_t *tmp = db_get_tsa(FindChatRoom(_T2A(tchat_id)), "UsersNicks", id))
tnick = tmp;
- ptrT tid(mir_a2t(id));
+ ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -565,9 +565,9 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con if (IsMe(id))
return;
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
- ptrT tid(mir_a2t(id));
- ptrT tinitiator(mir_a2t(initiator));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
+ ptrW tid(mir_a2u(id));
+ ptrW tinitiator(mir_a2u(initiator));
GCDEST gcd = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -661,5 +661,5 @@ CMString CSkypeProto::ChangeTopicForm() pForm.caption = caption;
pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index c4aecd4825..bbe4765ca7 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -46,7 +46,7 @@ void CSkypeProto::SetAllContactsStatus(WORD status) void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return;
GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index cd72da2f78..227661c944 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -57,10 +57,10 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) case SKYPE_DB_EVENT_TYPE_CALL_INFO:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"partlist");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"partlist");
if (xml != NULL)
{
- ptrA type(mir_t2a(xmlGetAttrValue(xml, L"type")));
+ ptrA type(mir_u2a(xmlGetAttrValue(xml, L"type")));
bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0;
time_t callDuration = 0;
@@ -106,7 +106,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) }
case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"files");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"files");
if (xml != NULL)
{
for (int i = 0; i < xmlGetChildCount(xml); i++)
@@ -136,7 +136,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) case SKYPE_DB_EVENT_TYPE_MOJI:
case SKYPE_DB_EVENT_TYPE_URIOBJ:
{
- HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, L"URIObject");
+ HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)pEvent->dbei->pBlob)), 0, L"URIObject");
if (xml != NULL)
{
//szText.Append(_T2A(xmlGetText(xml)));
@@ -175,7 +175,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) {
case DBVT_TCHAR:
{
- return (INT_PTR)mir_a2t(szText);
+ return (INT_PTR)mir_a2u(szText);
}
case DBVT_ASCIIZ:
{
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 2a2941bdfd..aa26123f46 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -91,7 +91,7 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a xmlAddAttr(xml, L"uri", CMStringW(FORMAT, L"https://api.asm.skype.com/v1/objects/%s", _A2T(fup->uid)));
xmlAddAttr(xml, L"url_thumbnail", CMStringW(FORMAT, L"https://api.asm.skype.com/v1/objects/%s/views/thumbnail", _A2T(fup->uid)));
- SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), T2Utf(ptrT(xmlToString(xml, nullptr))), li, "RichText/Media_GenericFile"));
+ SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), T2Utf(ptrW(xmlToString(xml, nullptr))), li, "RichText/Media_GenericFile"));
xmlDestroyNode(xml);
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)fup);
delete fup;
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index e2d820eb75..b2b668a1a8 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -233,13 +233,13 @@ void CSkypeProto::SendPresence(bool isLogin) ptrA epname;
if (!m_opts.bUseHostnameAsPlace && m_opts.wstrPlace && *m_opts.wstrPlace)
- epname = mir_utf8encodeT(m_opts.wstrPlace);
+ epname = mir_utf8encodeW(m_opts.wstrPlace);
else
{
wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = _countof(compName);
GetComputerName(compName, &size);
- epname = mir_utf8encodeT(compName);
+ epname = mir_utf8encodeW(compName);
}
if (isLogin)
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 4d35393d12..f4a42e2f2b 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -275,7 +275,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId)
{
- HXML xmlNode = xmlParseString(mir_utf8decodeT(szContent), 0, L"contacts");
+ HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), 0, L"contacts");
if (xmlNode)
{
int nCount = 0;
@@ -296,8 +296,8 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
psr[nCount]->cbSize = sizeof(psr);
psr[nCount]->flags = PSR_TCHAR;
- psr[nCount]->id.w = mir_tstrdup(tszContactId);
- //psr[nCount]->nick.w = mir_tstrdup(tszContactName == NULL ? L"" : tszContactName);
+ psr[nCount]->id.w = mir_wstrdup(tszContactId);
+ //psr[nCount]->nick.w = mir_wstrdup(tszContactName == NULL ? L"" : tszContactName);
nCount++;
}
}
diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index 3992ab48b7..976cf98d77 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -93,7 +93,7 @@ void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response) CMStringA ppft(GetStringChunk(szContent, "sFT:'", "'"));
- ptrA code(mir_utf8encodeT(RunConfirmationCode()));
+ ptrA code(mir_utf8encodeW(RunConfirmationCode()));
SendRequest(new LoginMSRequest(url.c_str(), ptrA(getStringA(SKYPE_SETTINGS_ID)), szCookies.c_str(), ppft.c_str(), code), &CSkypeProto::OnMSLoginEnd);
return;
@@ -182,5 +182,5 @@ CMString CSkypeProto::RunConfirmationCode() pForm.caption = caption;
pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index 2026a509eb..dafd60ebf2 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -61,8 +61,8 @@ void CSkypeOptionsMain::OnApply() m_proto->delSetting("TokenExpiresIn");
m_proto->setString(SKYPE_SETTINGS_ID, szNewSkypename);
m_proto->setString("Password", szNewPassword);
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
}
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 65e5bb3487..6cc8c44cd6 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -7,7 +7,7 @@ void CSkypeProto::InitPopups() POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -17,7 +17,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = 5;
m_PopupClasses.insert(Popup_RegisterClass(&ppc));
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -27,7 +27,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = -1;
m_PopupClasses.insert(Popup_RegisterClass(&ppc));
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
ppc.ptszDescription = desc;
ppc.pszName = name;
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 2c4678a93a..ac9b4d6a9b 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -263,8 +263,8 @@ void CSkypeProto::UpdateProfileLastName(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact)
{
- ptrT firstname(getTStringA(hContact, "FirstName"));
- ptrT lastname(getTStringA(hContact, "LastName"));
+ ptrW firstname(getTStringA(hContact, "FirstName"));
+ ptrW lastname(getTStringA(hContact, "LastName"));
if (firstname) {
CMString nick(firstname);
if (lastname)
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index cf003bdb17..b496e4c2d7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -329,7 +329,7 @@ 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.w)*/0 + 2 + mir_tstrlen(isrList[i]->id.w) + mir_strlen(szMessageId));
+ cbBlob += int(/*mir_wstrlen(isrList[i]->nick.w)*/0 + 2 + mir_wstrlen(isrList[i]->id.w) + mir_strlen(szMessageId));
pBlob = (PBYTE)mir_calloc(cbBlob);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 42fe0bf575..41d01665b8 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -507,7 +507,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) *(szSecondParam++) = 0;
// no command or message command
- if (!szCommand || (szCommand && !mir_tstrcmpi(szCommand, L"chat")))
+ if (!szCommand || (szCommand && !mir_wstrcmpi(szCommand, L"chat")))
{
if (szSecondParam)
{
@@ -523,22 +523,22 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL);
return 0;
}
- else if (!mir_tstrcmpi(szCommand, L"call"))
+ else if (!mir_wstrcmpi(szCommand, L"call"))
{
MCONTACT hContact = AddContact(_T2A(szJid), true);
NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0);
return 0;
}
- else if (!mir_tstrcmpi(szCommand, L"userinfo")){ return 0; }
- else if (!mir_tstrcmpi(szCommand, L"add"))
+ else if (!mir_wstrcmpi(szCommand, L"userinfo")){ return 0; }
+ else if (!mir_wstrcmpi(szCommand, L"add"))
{
MCONTACT hContact = FindContact(_T2A(szJid));
if (hContact == NULL)
{
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
- psr.id.w = mir_tstrdup(szJid);
- psr.nick.w = mir_tstrdup(szJid);
+ psr.id.w = mir_wstrdup(szJid);
+ psr.nick.w = mir_wstrdup(szJid);
psr.flags = PSR_UNICODE;
ADDCONTACTSTRUCT acs = { 0 };
@@ -550,13 +550,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) }
return 0;
}
- if (!mir_tstrcmpi(szCommand, L"sendfile"))
+ if (!mir_wstrcmpi(szCommand, L"sendfile"))
{
MCONTACT hContact = AddContact(_T2A(szJid), true);
CallService(MS_FILE_SENDFILE, hContact, NULL);
return 1;
}
- if (!mir_tstrcmpi(szCommand, L"voicemail"))
+ if (!mir_wstrcmpi(szCommand, L"voicemail"))
{
return 1;
}
diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index 45e57d6311..497e1b99e1 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -89,15 +89,15 @@ public: };
struct CFileUploadParam : public MZeroedObject {
- ptrT tszFileName;
- ptrT tszDesc;
+ ptrW tszFileName;
+ ptrW tszDesc;
ptrA atr;
ptrA fname;
ptrA uid;
size_t size;
MCONTACT hContact;
- __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {};
+ __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) : hContact(_hContact), tszDesc(mir_wstrdup(_desc)), tszFileName(mir_wstrdup(_files[0])) {};
__forceinline bool IsAccess() { return ::_waccess(tszFileName, 0) == 0; }
};
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 8b852a8fed..0ebd7d1c8b 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -3,7 +3,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -11,16 +11,16 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact) ptrA steamId(getStringA(hContact, "SteamID"));
if (steamId != NULL)
- mir_sntprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId));
+ mir_snwprintf(path, MAX_PATH, L"%s\\%s.jpg", path, _A2T(steamId));
else
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
bool CSteamProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai)
{
- ptrT path(GetAvatarFilePath(pai.hContact));
+ ptrW path(GetAvatarFilePath(pai.hContact));
if (!path)
return false;
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 3cbdb66c21..1477b2d19f 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -98,19 +98,19 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) { // set common data JSONNode *node = json_get(data, "personaname"); - setTString(hContact, "Nick", ptrT(json_as_string(node))); + setTString(hContact, "Nick", ptrW(json_as_string(node))); node = json_get(data, "profileurl"); - setString(hContact, "Homepage", _T2A(ptrT(json_as_string(node)))); + setString(hContact, "Homepage", _T2A(ptrW(json_as_string(node)))); node = json_get(data, "primaryclanid"); - setString(hContact, "PrimaryClanID", _T2A(ptrT(json_as_string(node)))); + setString(hContact, "PrimaryClanID", _T2A(ptrW(json_as_string(node)))); // set name node = json_get(data, "realname"); if (node != NULL) { - std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(L' ', 1); @@ -135,14 +135,14 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // avatar bool biggerAvatars = getBool("UseBigAvatars", false); node = json_get(data, biggerAvatars ? "avatarfull" : "avatarmedium"); - std::string avatarUrl = (char*)_T2A(ptrT(json_as_string(node))); + std::string avatarUrl = (char*)_T2A(ptrW(json_as_string(node))); CheckAvatarChange(hContact, avatarUrl); // set country node = json_get(data, "loccountrycode"); if (node != NULL) { - const char *iso = ptrA(mir_u2a(ptrT(json_as_string(node)))); + const char *iso = ptrA(mir_u2a(ptrW(json_as_string(node)))); char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)iso, 0); setString(hContact, "Country", country); } @@ -211,18 +211,18 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // playing game node = json_get(data, "gameid"); - DWORD gameId = node ? atol(_T2A(ptrT(json_as_string(node)))) : 0; + DWORD gameId = node ? atol(_T2A(ptrW(json_as_string(node)))) : 0; node = json_get(data, "gameextrainfo"); - ptrT gameInfo(json_as_string(node)); + ptrW gameInfo(json_as_string(node)); if (gameId > 0 || gameInfo[0] != '\0') { node = json_get(data, "gameserverip"); - ptrT serverIP(json_as_string(node)); + ptrW serverIP(json_as_string(node)); node = json_get(data, "gameserversteamid"); - ptrT serverID (json_as_string(node)); + ptrW serverID (json_as_string(node)); setDword(hContact, "GameID", gameId); setString(hContact, "ServerIP", _T2A(serverIP)); @@ -264,9 +264,9 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) setDword(hContact, "DeletedTS", ::time(NULL)); SetContactStatus(hContact, ID_STATUS_OFFLINE); - ptrT nick(getTStringA(hContact, "Nick")); + ptrW nick(getTStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; - mir_sntprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); + mir_snwprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); ShowNotification(L"Steam", message); } @@ -282,9 +282,9 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact) delSetting(hContact, "DeletedTS"); delSetting(hContact, "Grant"); - ptrT nick(getTStringA(hContact, "Nick")); + ptrW nick(getTStringA(hContact, "Nick")); wchar_t message[MAX_PATH]; - mir_sntprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); + mir_snwprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); ShowNotification(L"Steam", message); } @@ -401,7 +401,7 @@ void CSteamProto::ProcessContact(std::map<std::string, JSONNode*>::iterator *it, if (node == NULL) return; - ptrA relationship(mir_u2a(ptrT(json_as_string(node)))); + ptrA relationship(mir_u2a(ptrW(json_as_string(node)))); if (!lstrcmpiA(relationship, "friend")) { ContactIsFriend(hContact); @@ -444,7 +444,7 @@ void CSteamProto::OnGotFriendList(const HttpResponse *response) if (node == NULL) continue; - std::string steamId = (char*)_T2A(ptrT(json_as_string(node))); + std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); friends.insert(std::make_pair(steamId, child)); } } @@ -529,7 +529,7 @@ void CSteamProto::OnGotBlockList(const HttpResponse *response) break; node = json_get(child, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); /*MCONTACT hContact = FindContact(steamId); if (!hContact) @@ -539,7 +539,7 @@ void CSteamProto::OnGotBlockList(const HttpResponse *response) }*/ node = json_get(child, "relationship"); - ptrA relationship(mir_u2a(ptrT(json_as_string(node)))); + ptrA relationship(mir_u2a(ptrW(json_as_string(node)))); if (!lstrcmpiA(relationship, "ignoredfriend")) { @@ -571,7 +571,7 @@ void CSteamProto::OnGotUserSummaries(const HttpResponse *response) break; node = json_get(item, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); MCONTACT hContact = NULL; if (!IsMe(steamId)) { @@ -676,7 +676,7 @@ void CSteamProto::OnAuthRequested(const HttpResponse *response, void *arg) if (nroot != NULL) { node = json_get(nroot, "steamid"); - ptrA steamId(mir_u2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); MCONTACT hContact = FindContact(steamId); if (!hContact) @@ -706,7 +706,7 @@ void CSteamProto::OnPendingApproved(const HttpResponse *response, void *arg) if (json_as_int(node) == 0) { node = json_get(root, "error_text"); - debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrT(json_as_string(node))))); + debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrW(json_as_string(node))))); } } @@ -726,7 +726,7 @@ void CSteamProto::OnPendingIgnoreded(const HttpResponse *response, void *arg) if (json_as_int(node) == 0) { node = json_get(root, "error_text"); - debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrT(json_as_string(node))))); + debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s (%s)", (char*)arg, ptrA(mir_utf8encodeW(ptrW(json_as_string(node))))); } } @@ -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.w = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.id.w = mir_wstrdup(ptrW(json_as_string(node))); node = json_get(child, "personaname"); - ssr.hdr.nick.w = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.nick.w = mir_wstrdup(ptrW(json_as_string(node))); node = json_get(child, "realname"); if (node != NULL) { - std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrW(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(' ', 1); if (pos != std::wstring::npos) { - ssr.hdr.firstName.w = mir_tstrdup(realname.substr(0, pos).c_str()); - ssr.hdr.lastName.w = mir_tstrdup(realname.substr(pos + 1).c_str()); + ssr.hdr.firstName.w = mir_wstrdup(realname.substr(0, pos).c_str()); + ssr.hdr.lastName.w = mir_wstrdup(realname.substr(pos + 1).c_str()); } else - ssr.hdr.firstName.w = mir_tstrdup(realname.c_str()); + ssr.hdr.firstName.w = mir_wstrdup(realname.c_str()); } } @@ -833,7 +833,7 @@ void CSteamProto::OnSearchByNameStarted(const HttpResponse *response, void *arg) if (node == NULL) continue; - std::string steamId = (char*)_T2A(ptrT(json_as_string(node))); + std::string steamId = (char*)_T2A(ptrW(json_as_string(node))); steamIds.append(steamId).append(","); } json_delete(nroot); diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index 8a16ee5bf3..61b9ae6019 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(_wtoi64(ptrT(json_as_string(node)))); + const char *who = AccountIdToSteamId(_wtoi64(ptrW(json_as_string(node)))); node = json_get(session, "last_message"); - time_t lastMessageTS = _wtoi64(ptrT(json_as_string(node))); + time_t lastMessageTS = _wtoi64(ptrW(json_as_string(node))); /*node = json_get(session, "last_view"); - time_t last_view = _wtoi64(ptrT(json_as_string(node))); + time_t last_view = _wtoi64(ptrW(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(_wtoi64(ptrT(json_as_string(node)))); + const char *authorSteamId = AccountIdToSteamId(_wtoi64(ptrW(json_as_string(node)))); node = json_get(message, "message"); - ptrT text(json_as_string(node)); + ptrW text(json_as_string(node)); T2Utf szMessage(text); node = json_get(message, "timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(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 15fb3d6483..8bf65f6f30 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -30,11 +30,11 @@ bool CSteamProto::Relogin() if (root != NULL) { JSONNode *node = json_get(root, "error"); - ptrT error(json_as_string(node)); - if (!mir_tstrcmpi(error, L"OK")) + ptrW error(json_as_string(node)); + if (!mir_wstrcmpi(error, L"OK")) { node = json_get(root, "umqid"); - setString("UMQID", ptrA(mir_u2a(ptrT(json_as_string(node))))); + setString("UMQID", ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(root, "message"); setDword("MessageID", json_as_int(node)); @@ -148,10 +148,10 @@ void CSteamProto::DeleteAuthSettings() void CSteamProto::OnAuthorizationError(const JSONNode &node) { std::string message = node["message"].as_string(); - ptrT messageT(mir_utf8decodeT(message.c_str())); + ptrW messageT(mir_utf8decodeW(message.c_str())); debugLogA("CSteamProto::OnAuthorizationError: %s", message.c_str()); - if (!mir_tstrcmpi(messageT, L"Incorrect login.")) + if (!mir_wstrcmpi(messageT, L"Incorrect login.")) { // We can't continue with incorrect login/password DeleteAuthSettings(); @@ -367,8 +367,8 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) JSONROOT root(response->pData); JSONNode *node = json_get(root, "error"); - ptrT error(json_as_string(node)); - if (mir_tstrcmpi(error, L"OK")) + ptrW error(json_as_string(node)); + if (mir_wstrcmpi(error, L"OK")) { // Probably expired TokenSecret HandleTokenExpired(); @@ -376,14 +376,14 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) } node = json_get(root, "umqid"); - setString("UMQID", ptrA(mir_u2a(ptrT(json_as_string(node))))); + setString("UMQID", ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(root, "message"); setDword("MessageID", json_as_int(node)); if (m_lastMessageTS <= 0) { node = json_get(root, "utc_timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(json_as_string(node))); setDword("LastMessageTS", timestamp); } diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index bfcde18b1d..d399f7ff47 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -38,8 +38,8 @@ void CSteamProto::OnMessageSent(const HttpResponse *response, void *arg) {
SendMessageParam *param = (SendMessageParam*)arg;
- ptrT error(mir_tstrdup(TranslateT("Unknown error")));
- ptrT steamId(getTStringA(param->hContact, "SteamID"));
+ ptrW error(mir_wstrdup(TranslateT("Unknown error")));
+ ptrW steamId(getTStringA(param->hContact, "SteamID"));
time_t timestamp = NULL;
if (ResponseHttpOk(response))
@@ -52,15 +52,15 @@ void CSteamProto::OnMessageSent(const HttpResponse *response, void *arg) node = json_get(root, "utc_timestamp");
if (node)
{
- timestamp = atol(ptrA(mir_t2a(ptrT(json_as_string(node)))));
+ timestamp = atol(ptrA(mir_u2a(ptrW(json_as_string(node)))));
if (timestamp > getDword("LastMessageTS", 0))
setDword("LastMessageTS", timestamp);
}
}
- if (mir_tstrcmpi(error, L"OK") != 0)
+ if (mir_wstrcmpi(error, L"OK") != 0)
{
- ptrA errorA(mir_t2a(error));
+ ptrA errorA(mir_u2a(error));
debugLogA("CSteamProto::OnMessageSent: failed to send message for %s (%s)", steamId, errorA);
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)errorA);
}
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp index 00f933a804..cc62799a62 100644 --- a/protocols/Steam/src/steam_options.cpp +++ b/protocols/Steam/src/steam_options.cpp @@ -26,7 +26,7 @@ void CSteamOptionsMain::OnInitDialog() void CSteamOptionsMain::OnApply()
{
wchar_t *group = m_group.GetText();
- if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
+ if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 22896647d8..6774bb60ab 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -14,13 +14,13 @@ void CSteamProto::ParsePollData(JSONNode *data) break; node = json_get(item, "steamid_from"); - ptrA steamId(mir_t2a(ptrT(json_as_string(node)))); + ptrA steamId(mir_u2a(ptrW(json_as_string(node)))); node = json_get(item, "utc_timestamp"); - time_t timestamp = atol(ptrA(mir_t2a(ptrT(json_as_string(node))))); + time_t timestamp = atol(ptrA(mir_u2a(ptrW(json_as_string(node))))); node = json_get(item, "type"); - ptrT type(json_as_string(node)); + ptrW type(json_as_string(node)); if (!lstrcmpi(type, L"saytext") || !lstrcmpi(type, L"emote") || !lstrcmpi(type, L"my_saytext") || !lstrcmpi(type, L"my_emote")) { @@ -29,7 +29,7 @@ void CSteamProto::ParsePollData(JSONNode *data) continue; node = json_get(item, "text"); - ptrT text(json_as_string(node)); + ptrW text(json_as_string(node)); T2Utf szMessage(text); PROTORECVEVENT recv = { 0 }; @@ -61,7 +61,7 @@ void CSteamProto::ParsePollData(JSONNode *data) if (IsMe(steamId)) { node = json_get(item, "persona_name"); - setTString("Nick", ptrT(json_as_string(node))); + setTString("Nick", ptrW(json_as_string(node))); if (status == -1 || status == ID_STATUS_OFFLINE) continue; @@ -85,7 +85,7 @@ void CSteamProto::ParsePollData(JSONNode *data) SetContactStatus(hContact, status); node = json_get(item, "persona_name"); - setTString(hContact, "Nick", ptrT(json_as_string(node))); + setTString(hContact, "Nick", ptrW(json_as_string(node))); // todo: find difference between state changing and info changing steamIds.append(steamId).append(","); @@ -217,13 +217,13 @@ void CSteamProto::PollingThread(void*) { JSONNode *node = json_get(root, "error"); if (node) { - ptrT error(json_as_string(node)); + ptrW error(json_as_string(node)); if (!lstrcmpi(error, L"OK")) { // Remember last message timestamp node = json_get(root, "utc_timestamp"); - time_t timestamp = _wtoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrW(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 9eadb0fb42..964225abcc 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -18,7 +18,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) GetModuleFileName(g_hInstance, filePath, MAX_PATH); wchar_t sectionName[100]; - mir_sntprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); + mir_snwprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); char settingName[100]; mir_snprintf(settingName, "%s_%s", MODULE, "main"); @@ -66,7 +66,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) // netlib support wchar_t name[128]; - mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); + mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; @@ -228,7 +228,7 @@ HANDLE CSteamProto::SearchBasic(const wchar_t* id) return 0; ptrA token(getStringA("TokenSecret")); - ptrA steamId(mir_t2a(id)); + ptrA steamId(mir_u2a(id)); PushRequest( new GetUserSummariesRequest(token, steamId), @@ -245,7 +245,7 @@ HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, // Combine all fields to single text wchar_t keywordsT[200]; - mir_sntprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); + mir_snwprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); ptrA token(getStringA("TokenSecret")); ptrA keywords(mir_utf8encodeW(keywordsT)); @@ -338,7 +338,7 @@ int CSteamProto::SetStatus(int new_status) } else { - ptrA username(mir_urlEncode(ptrA(mir_utf8encodeT(getTStringA("Username"))))); + ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getTStringA("Username"))))); if (username == NULL || username[0] == '\0') { m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; @@ -371,8 +371,8 @@ void __cdecl CSteamProto::GetAwayMsgThread(void *arg) // if contact has no status message, get xstatus message if (message.IsEmpty()) { - ptrT xStatusName(getTStringA(hContact, "XStatusName")); - ptrT xStatusMsg(getTStringA(hContact, "XStatusMsg")); + ptrW xStatusName(getTStringA(hContact, "XStatusName")); + ptrW xStatusMsg(getTStringA(hContact, "XStatusMsg")); if (xStatusName) message.AppendFormat(L"%s: %s", xStatusName, xStatusMsg); diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 264afff378..0fb7f4474d 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -192,7 +192,7 @@ INT_PTR __cdecl CSteamProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam) if (pdbEvent->dbei->cbBlob > 0) {
if (pdbEvent->dbei->pBlob[0] == STEAM_DB_EVENT_CHATSTATES_GONE) {
if (pdbEvent->datatype == DBVT_WCHAR)
- return (INT_PTR)mir_tstrdup(TranslateT("closed chat session"));
+ return (INT_PTR)mir_wstrdup(TranslateT("closed chat session"));
else if (pdbEvent->datatype == DBVT_ASCIIZ)
return (INT_PTR)mir_strdup(Translate("closed chat session"));
}
diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp index 7a42c3f4e3..8f8cdd015c 100644 --- a/protocols/Steam/src/steam_xstatus.cpp +++ b/protocols/Steam/src/steam_xstatus.cpp @@ -44,24 +44,24 @@ INT_PTR CSteamProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) if (status < 1) return 1; - ptrT title; + ptrW title; if (pData->flags & CSSF_DEFAULT_NAME) - title = mir_tstrdup(TranslateT("Playing")); + title = mir_wstrdup(TranslateT("Playing")); else title = getTStringA(hContact, "XStatusName"); if (pData->flags & CSSF_UNICODE) - mir_tstrncpy(pData->ptszName, title, STATUS_TITLE_MAX); + mir_wstrncpy(pData->ptszName, title, STATUS_TITLE_MAX); else mir_strncpy(pData->pszName, _T2A(title), STATUS_TITLE_MAX); } // fill status message member if (pData->flags & CSSF_MASK_MESSAGE) { - ptrT message(getTStringA(hContact, "XStatusMsg")); + ptrW message(getTStringA(hContact, "XStatusMsg")); if (pData->flags & CSSF_UNICODE) - mir_tstrncpy(pData->ptszMessage, message, STATUS_DESC_MAX); + mir_wstrncpy(pData->ptszMessage, message, STATUS_DESC_MAX); else mir_strncpy(pData->pszMessage, _T2A(message), STATUS_DESC_MAX); } diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 78024a40d4..83bd751010 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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); + int tPathLen = mir_snwprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); if (_waccess(ptszDest, 0)) { int ret = CreateDirectoryTreeT(ptszDest); if (ret == 0) @@ -41,7 +41,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* p else { proto->debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", ptszDest, errno, strerror(errno)); wchar_t buffer[512]; - mir_sntprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _wcserror(errno), ptszDest); + mir_snwprintf(buffer, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _wcserror(errno), ptszDest); PUShowMessageT(buffer, SM_WARNING); } } @@ -58,9 +58,9 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, wchar_t* p const wchar_t *tszFileType = ProtoGetAvatarExtension(format); if (item != NULL) - mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); + mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); else - mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); + mir_snwprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); } static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) @@ -114,7 +114,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it } else { wchar_t buffer[128]; - mir_sntprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _wcserror(errno), errno); + mir_snwprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _wcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); proto->debugLog(buffer); return; diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 48baafe6d1..dadf79e4b3 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -583,7 +583,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
if (szFilename[0] != '\0' && ft->iqId != NULL) {
- wchar_t* filenameT = mir_utf8decodeT((char*)szFilename);
+ wchar_t* filenameT = mir_utf8decodeW((char*)szFilename);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 364bca28c2..50d77a3c3b 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -429,38 +429,38 @@ 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.w = mir_a2t(jid);
+ jsr.hdr.id.w = mir_a2u(jid);
if ((n = TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.nick.w = mir_a2t(buf);
+ jsr.hdr.nick.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.nick.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.nick.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.firstName.w = mir_a2t(buf);
+ jsr.hdr.firstName.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.firstName.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.firstName.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.lastName.w = mir_a2t(buf);
+ jsr.hdr.lastName.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.lastName.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.lastName.w = mir_wstrdup(TEXT(""));
}
if ((n = TlenXmlGetChild(itemNode, "email")) != NULL && n->text != NULL) {
char* buf = TlenTextDecode(n->text);
- jsr.hdr.email.w = mir_a2t(buf);
+ jsr.hdr.email.w = mir_a2u(buf);
mir_free(buf);
}
else {
- jsr.hdr.email.w = mir_tstrdup(TEXT(""));
+ jsr.hdr.email.w = mir_wstrdup(TEXT(""));
}
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 24ab3ec60b..a2a0469ff6 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -73,9 +73,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) mir_snprintf(jid, "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if (((hContact = TlenHContactFromJID(proto, jid)) != NULL) || !mir_strcmp(id, proto->threadData->username)) {
- ptrT szName(Contact_GetInfo(CNF_DISPLAY, hContact, proto->m_szModuleName));
+ ptrW szName(Contact_GetInfo(CNF_DISPLAY, hContact, proto->m_szModuleName));
if (szName)
- return mir_t2a(szName);
+ return mir_u2a(szName);
}
}
return mir_strdup(id);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index abaaa4e584..2a855116dd 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -656,7 +656,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else { delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); } - mir_sntprintf(title, TranslateT("%S mail"), proto->m_szModuleName); + mir_snwprintf(title, TranslateT("%S mail"), proto->m_szModuleName); MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0), title, diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 5cc872a3bb..d091aaa825 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -260,7 +260,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { char fileInfo[128];
item->ft = ft;
mir_snprintf(fileInfo, "%s file(s), %s bytes", c, s);
- wchar_t* filenameT = mir_utf8decodeT((char*)fileInfo);
+ wchar_t* filenameT = mir_utf8decodeW((char*)fileInfo);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.fileCount = 1;
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 91d4d18ee4..ee3759740c 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -91,7 +91,7 @@ HANDLE TlenProtocol::SearchBasic(const wchar_t* id) int iqId = 0;
if (!isOnline) return 0;
if (id == NULL) return 0;
- char* id_A = mir_t2a(id);
+ char* id_A = mir_u2a(id);
char *jid = TlenTextEncode(id_A);
if (jid != NULL) {
searchJID = mir_strdup(id_A);
@@ -111,7 +111,7 @@ HANDLE TlenProtocol::SearchByEmail(const wchar_t* email) if (!isOnline) return 0;
if (email == NULL) return 0;
- char* email_A = mir_t2a(email);
+ char* email_A = mir_u2a(email);
char *emailEnc = TlenTextEncode(email_A);
if (emailEnc != NULL) {
TlenResetSearchQuery(this);
@@ -127,9 +127,9 @@ HANDLE TlenProtocol::SearchByName(const wchar_t* nickT, const wchar_t* firstName {
if (!isOnline) return 0;
- char *nick = mir_t2a(nickT);
- char *firstName = mir_t2a(firstNameT);
- char *lastName = mir_t2a(lastNameT);
+ char *nick = mir_u2a(nickT);
+ char *firstName = mir_u2a(firstNameT);
+ char *lastName = mir_u2a(lastNameT);
char *p;
int iqId = 0;
@@ -418,7 +418,7 @@ int TlenProtocol::SetAwayMsg(int iStatus, const wchar_t* msg) char **szMsg;
char *newModeMsg;
- newModeMsg = mir_t2a(msg);
+ newModeMsg = mir_u2a(msg);
debugLogA("SetAwayMsg called, wParam=%d lParam=%s", iStatus, newModeMsg);
@@ -721,7 +721,7 @@ 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 wchar_t*
+ ft->szSavePath = mir_strdup(mir_u2a(szPath)); //TODO convert to wchar_t*
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, ft->iqId);
if (item != NULL) {
item->ft = ft;
@@ -795,7 +795,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w ft->filesSize = (long *)mir_alloc(sizeof(long) * ft->fileCount);
ft->allFileTotalSize = 0;
for (i = j = 0; i < ft->fileCount; i++) {
- char* ppszFiles_i_A = mir_t2a(ppszFiles[i]);
+ char* ppszFiles_i_A = mir_u2a(ppszFiles[i]);
if (_stat(ppszFiles_i_A, &statbuf))
debugLogA("'%s' is an invalid filename", ppszFiles[i]);
else {
@@ -806,7 +806,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w mir_free(ppszFiles_i_A);
}
ft->fileCount = j;
- ft->szDescription = mir_t2a(szDescription);
+ ft->szDescription = mir_u2a(szDescription);
ft->hContact = hContact;
ft->currentFile = 0;
db_free(&dbv);
@@ -826,7 +826,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const wchar_t* szDescription, w }
else {
if (ft->fileCount == 1) {
- char* ppszFiles_0_A = mir_t2a(ppszFiles[0]);
+ char* ppszFiles_0_A = mir_u2a(ppszFiles[0]);
if ((p = strrchr(ppszFiles_0_A, '\\')) != NULL) {
p++;
}
@@ -926,7 +926,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) jid = dbv.pszVal;
if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
- newNick = mir_t2a(pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE));
+ newNick = mir_u2a(pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE));
}
else if (cws->value.pszVal != NULL) {
newNick = settingToChar(cws);
@@ -1092,7 +1092,7 @@ INT_PTR TlenProtocol::SetMyAvatar(WPARAM, LPARAM lParam) if (CopyFile(szFileName, tFileName, FALSE) == FALSE)
return 1;
- char* tFileNameA = mir_t2a(tFileName); //TODO - drop io.h
+ char* tFileNameA = mir_u2a(tFileName); //TODO - drop io.h
int fileIn = open(tFileNameA, O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
if (fileIn != -1) {
long dwPngSize = filelength(fileIn);
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 0002d8c9c4..6dfb47e3f8 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -936,7 +936,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) mir_snprintf(jid, "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if ((hContact = TlenHContactFromJID(proto, jid)) != NULL)
- return mir_t2a(pcli->pfnGetContactDisplayName(hContact, 0));
+ return mir_u2a(pcli->pfnGetContactDisplayName(hContact, 0));
}
return mir_strdup(id);
}
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 88fbf0681e..ec0a691917 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -32,13 +32,13 @@ BOOL TlenWsInit(TlenProtocol *proto) nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
- mir_sntprintf(name, TranslateT("%s connection"), proto->m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = proto->m_szModuleName;
proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
- mir_sntprintf(name, TranslateT("%s SOCKS connection"), proto->m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s SOCKS connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlus.cbSize = sizeof(nlus);
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index 0c4cea1a40..dfdca9e4f7 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -4,7 +4,7 @@ LIST<CToxProto> CToxProto::Accounts(1, CToxProto::CompareAccounts); int CToxProto::CompareAccounts(const CToxProto *p1, const CToxProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
CToxProto* CToxProto::InitAccount(const char *protoName, const wchar_t *userName)
@@ -44,12 +44,12 @@ int CToxProto::OnAccountRenamed(WPARAM, LPARAM) {
mir_cslock locker(profileLock);
- ptrT newPath(GetToxProfilePath());
+ ptrW newPath(GetToxProfilePath());
wchar_t oldPath[MAX_PATH];
- mir_sntprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
_wrename(oldPath, newPath);
mir_free(accountName);
- accountName = mir_tstrdup(m_tszUserName);
+ accountName = mir_wstrdup(m_tszUserName);
return 0;
}
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 252f9f6a18..ed0c482cda 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -3,21 +3,21 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
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);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(path);
- ptrT address(getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrW address(getTStringA(hContact, TOX_SETTINGS_ID));
if (address == NULL) {
mir_free(path);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
- if (hContact && mir_tstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
+ if (hContact && mir_wstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
address[TOX_PUBLIC_KEY_SIZE * 2] = 0;
- mir_sntprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
return path;
}
@@ -133,10 +133,10 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam) ptrA address(getStringA(pai->hContact, TOX_SETTINGS_ID));
if (address != NULL)
{
- ptrT path(GetAvatarFilePath(pai->hContact));
+ ptrW path(GetAvatarFilePath(pai->hContact));
if (IsFileExists(path))
{
- mir_tstrncpy(pai->filename, path, _countof(pai->filename));
+ mir_wstrncpy(pai->filename, path, _countof(pai->filename));
pai->format = PA_FORMAT_PNG;
return GAIR_SUCCESS;
@@ -148,9 +148,9 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- ptrT path(GetAvatarFilePath());
+ ptrW path(GetAvatarFilePath());
if (IsFileExists(path))
- mir_tstrncpy((wchar_t*)wParam, path, (int)lParam);
+ mir_wstrncpy((wchar_t*)wParam, path, (int)lParam);
return 0;
}
@@ -159,7 +159,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) {
debugLogA(__FUNCTION__": setting avatar");
wchar_t *path = (wchar_t*)lParam;
- ptrT avatarPath(GetAvatarFilePath());
+ ptrW avatarPath(GetAvatarFilePath());
if (path != NULL)
{
debugLogA(__FUNCTION__": copy new avatar");
@@ -208,7 +208,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) if (transfer->pfts.totalBytes == 0)
{
MCONTACT hConact = transfer->pfts.hContact;
- ptrT path(GetAvatarFilePath(hConact));
+ ptrW path(GetAvatarFilePath(hConact));
if (IsFileExists(path))
DeleteFile(path);
@@ -231,7 +231,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) }
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
OnFileAllow(transfer->pfts.hContact, transfer, path);
}
@@ -242,7 +242,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_PNG;
ai.hContact = transfer->pfts.hContact;
- mir_tstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
+ mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
transfer->hFile = NULL;
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index f0a538fb5c..fde562fe83 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -29,7 +29,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
+ mir_snwprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
setTString(hContact, "Nick", title);
DBVARIANT dbv;
@@ -67,7 +67,7 @@ void CToxProto::LoadChatRoomList(void*) {
uint8_t title[TOX_MAX_NAME_LENGTH] = { 0 };
tox_group_get_title(toxThread->Tox(), groupNumber, title, TOX_MAX_NAME_LENGTH);
- setWString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)title)));
+ setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)title)));
}
}
mir_free(groupChats);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index a78d6e3b39..d3e094e0db 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -91,10 +91,10 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char setString(hContact, TOX_SETTINGS_ID, address);
if (mir_strlen(nick))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT(nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW(nick)));
if (mir_strlen(dnsId))
- setTString(hContact, TOX_SETTINGS_DNS, ptrT(mir_utf8decodeT(dnsId)));
+ setTString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId)));
DBVARIANT dbv;
if (!getTString(TOX_SETTINGS_GROUP, &dbv))
@@ -149,7 +149,7 @@ void CToxProto::LoadFriendList(void*) TOX_ERR_FRIEND_QUERY getNameResult;
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &getNameResult))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", getNameResult);
@@ -188,7 +188,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
TOX_ERR_FRIEND_QUERY errorFriendQuery;
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &errorFriendQuery))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", errorFriendQuery);
@@ -291,7 +291,7 @@ void CToxProto::OnFriendNameChange(Tox*, uint32_t friendNumber, const uint8_t *n memcpy(rawName, name, length);
rawName[length] = 0;
- ptrT nickname(mir_utf8decodeW(rawName));
+ ptrW nickname(mir_utf8decodeW(rawName));
proto->setTString(hContact, "Nick", nickname);
}
}
@@ -306,7 +306,7 @@ void CToxProto::OnStatusMessageChanged(Tox*, uint32_t friendNumber, const uint8_ memcpy(rawMessage, message, length);
rawMessage[length] = 0;
- ptrT statusMessage(mir_utf8decodeT(rawMessage));
+ ptrW statusMessage(mir_utf8decodeW(rawMessage));
db_set_ts(hContact, "CList", "StatusMsg", statusMessage);
}
}
@@ -340,7 +340,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE proto->ResumeIncomingTransfers(friendNumber);
// update avatar
- ptrT avatarPath(proto->GetAvatarFilePath());
+ ptrW avatarPath(proto->GetAvatarFilePath());
if (IsFileExists(avatarPath))
{
FILE *hFile = _wfopen(avatarPath, L"rb");
@@ -441,7 +441,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar break;
}
- SetDlgItemText(hwnd, IDC_DNS_ID, ptrT(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
+ SetDlgItemText(hwnd, IDC_DNS_ID, ptrW(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
}
break;
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index b535597a0e..108d9b0003 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -95,9 +95,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread->Tox(), nick);
- setTString("Nick", ptrT(Utf8DecodeT((char*)nick)));*/
+ setTString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/
- ptrA nick(mir_utf8encodeT(ptrT(getTStringA("Nick"))));
+ ptrA nick(mir_utf8encodeW(ptrW(getTStringA("Nick"))));
tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
@@ -107,9 +107,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread->Tox(), statusMessage);
- setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));*/
+ setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/
- ptrA statusMessage(mir_utf8encodeT(ptrT(getTStringA("StatusMsg"))));
+ ptrA statusMessage(mir_utf8encodeW(ptrW(getTStringA("StatusMsg"))));
tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index c2c409c3e2..b1c6ef7d3d 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -159,7 +159,7 @@ void CToxProto::GetStatusMessageAsync(void* arg) return;
}
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrT(mir_utf8decodeT(statusMessage)));
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrW(mir_utf8decodeW(statusMessage)));
}
/* TYPING */
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 1238ecfda7..0cf156dace 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -55,7 +55,7 @@ void CToxIncomingCall::OnInitDialog() from.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Incoming call from %s"), nick);
+ mir_snwprintf(title, TranslateT("Incoming call from %s"), nick);
SetTitle(title);
SetIcon("audio_ring");
}
@@ -109,7 +109,7 @@ void CToxOutgoingCall::OnInitDialog() to.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Outgoing call to %s"), nick);
+ mir_snwprintf(title, TranslateT("Outgoing call to %s"), nick);
SetTitle(title);
SetIcon("audio_end");
}
@@ -149,7 +149,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) char *message = NULL;
wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
- message = mir_utf8encodeT(title);
+ message = mir_utf8encodeW(title);
else
message = mir_utf8encode("Outgoing call");
m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -316,7 +316,7 @@ void CToxProto::OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_en }
wchar_t message[MAX_PATH];
- mir_sntprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
T2Utf szMessage(message);
PROTORECVEVENT recv = { 0 };
@@ -351,7 +351,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
wchar_t szTooltip[MAX_PATH];
- mir_sntprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
char szService[MAX_PATH];
@@ -400,7 +400,7 @@ INT_PTR CToxProto::OnAudioRing(WPARAM, LPARAM lParam) }
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -435,7 +435,7 @@ INT_PTR CToxProto::OnSendAudioCall(WPARAM hContact, LPARAM) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -459,7 +459,7 @@ void CToxProto::OnAvCallTimeout(void*, int32_t callId, void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -552,7 +552,7 @@ static void CALLBACK ToxShowDialogApcProc(void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call started"));
+ char *message = mir_utf8encodeW(TranslateT("Call started"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -583,7 +583,7 @@ void CToxProto::OnAvEnd(void*, int32_t callId, void *arg) return;
}
- char *message = mir_utf8encodeT(TranslateT("Call ended"));
+ char *message = mir_utf8encodeW(TranslateT("Call ended"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index c32e8059c8..82153c743a 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -3,7 +3,7 @@ void CToxProto::InitNetlib()
{
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof(nlu);
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 2f5b3dcddb..580fa31622 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -157,7 +157,7 @@ void CToxProto::UpdateNodes() if (lastUpdate <= getDword("NodesUpdate", 0))
return;
- ptrT path(mir_tstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
+ ptrW path(mir_wstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
if (!IsFileExists(path))
{
HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 4b31e1cf61..96564f432e 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -26,7 +26,7 @@ void CToxOptionsMain::OnInitDialog() {
CToxDlgBase::OnInitDialog();
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (CToxProto::IsFileExists(profilePath))
{
m_toxAddress.Enable();
@@ -67,7 +67,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) CToxThread toxThread(options);
tox_options_free(options);
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (!m_proto->IsFileExists(profilePath))
{
HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -81,8 +81,8 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) if (m_proto->InitToxCore(&toxThread))
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
m_proto->UninitToxCore(&toxThread);
@@ -90,9 +90,9 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) m_toxAddress.Enable();
m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID)));
- m_nickname.SetText(ptrT(m_proto->getTStringA("Nick")));
- m_password.SetText(ptrT(m_proto->getTStringA("Password")));
- m_group.SetText(ptrT(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
+ m_nickname.SetText(ptrW(m_proto->getTStringA("Nick")));
+ m_password.SetText(ptrW(m_proto->getTStringA("Password")));
+ m_group.SetText(ptrW(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -105,7 +105,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0);
wchar_t profilePath[MAX_PATH] = { 0 };
@@ -123,8 +123,8 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) if (!GetOpenFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
Tox_Options *options = NULL;
@@ -143,13 +143,13 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread.Tox(), nick);
- ptrT nickname(Utf8DecodeT((char*)nick));
+ ptrW nickname(Utf8DecodeT((char*)nick));
m_proto->setTString("Nick", nickname);
m_nickname.SetText(nickname);
uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread.Tox(), statusMessage);
- m_proto->setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));
+ m_proto->setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -163,11 +163,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%c",
TranslateT("Tox profile"), 0, 0, 0);
wchar_t profilePath[MAX_PATH];
- mir_tstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
+ mir_wstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = m_hwnd;
@@ -182,20 +182,20 @@ void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*) if (!GetSaveFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(defaultProfilePath, profilePath, FALSE);
}
void CToxOptionsMain::OnApply()
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
{
- CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrT(m_nickname.GetText()));
+ CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrW(m_nickname.GetText()));
// todo: add checkbox
m_proto->setTString("Password", pass_ptrT(m_password.GetText()));
@@ -361,21 +361,21 @@ void CToxNodeEditor::OnInitDialog() void CToxNodeEditor::OnOk(CCtrlBase*)
{
- ptrT ipv4(m_ipv4.GetText());
+ ptrW ipv4(m_ipv4.GetText());
if (!ipv4)
{
MessageBox(m_hwnd, TranslateT("Enter IPv4"), TranslateT("Error"), MB_OK);
return;
}
- ptrT port(m_port.GetText());
+ ptrW port(m_port.GetText());
if (!port)
{
MessageBox(m_hwnd, TranslateT("Enter port"), TranslateT("Error"), MB_OK);
return;
}
- ptrT pubKey(m_pkey.GetText());
+ ptrW pubKey(m_pkey.GetText());
if (!pubKey)
{
MessageBox(m_hwnd, TranslateT("Enter public key"), TranslateT("Error"), MB_OK);
@@ -563,17 +563,17 @@ void CToxOptionsNodeList::ReloadNodeList() {
JSONNode node = nodes[i];
- ptrT ipv4(mir_utf8decodeT(node.at("ipv4").as_string().c_str()));
+ ptrW ipv4(mir_utf8decodeW(node.at("ipv4").as_string().c_str()));
iItem = m_nodes.AddItem(ipv4, -1, NULL, 0);
- ptrT ipv6(mir_utf8decodeT(node.at("ipv6").as_string().c_str()));
- if (mir_tstrcmp(ipv6, L"-"))
+ ptrW ipv6(mir_utf8decodeW(node.at("ipv6").as_string().c_str()));
+ if (mir_wstrcmp(ipv6, L"-"))
m_nodes.SetItem(iItem, 1, ipv6);
- ptrT port(mir_utf8decodeT(node.at("port").as_string().c_str()));
+ ptrW port(mir_utf8decodeW(node.at("port").as_string().c_str()));
m_nodes.SetItem(iItem, 2, port);
- ptrT pubKey(mir_utf8decodeT(node.at("public_key").as_string().c_str()));
+ ptrW pubKey(mir_utf8decodeW(node.at("public_key").as_string().c_str()));
m_nodes.SetItem(iItem, 3, pubKey);
}
}
@@ -586,7 +586,7 @@ void CToxOptionsNodeList::ReloadNodeList() for (int i = 0; i < nodeCount; i++)
{
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV4, i);
- ptrT value(db_get_tsa(NULL, module, setting));
+ ptrW value(db_get_tsa(NULL, module, setting));
iItem = m_nodes.AddItem(value, -1, NULL, 1);
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV6, i);
@@ -599,7 +599,7 @@ void CToxOptionsNodeList::ReloadNodeList() {
char portNum[10];
itoa(port, portNum, 10);
- m_nodes.SetItem(iItem, 2, mir_a2t(portNum));
+ m_nodes.SetItem(iItem, 2, mir_a2u(portNum));
}
mir_snprintf(setting, TOX_SETTINGS_NODE_PKEY, i);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 32a024480d..16658bc7c6 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -12,7 +12,7 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName) 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);
+ mir_snwprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
return profilePath;
}
@@ -22,7 +22,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) mir_cslock locker(profileLock);
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
if (!IsFileExists(profilePath))
return false;
@@ -121,7 +121,7 @@ void CToxProto::SaveToxProfile(CToxThread *toxThread) size += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
}
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
if (profile == NULL)
{
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index cf8987757d..9ae714bd31 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -7,7 +7,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) {
InitNetlib();
- accountName = mir_tstrdup(userName);
+ accountName = mir_wstrdup(userName);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index 1b5ab155a6..1651bbc597 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((wchar_t*)lParam) : mir_a2t((char*)lParam));
+ ptrW nickname((wParam & SMNN_UNICODE) ? mir_wstrdup((wchar_t*)lParam) : mir_a2u((char*)lParam));
setTString("Nick", nickname);
if (IsOnline())
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index d775117f70..5eaf69dffe 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -18,9 +18,9 @@ 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));
+ ptrW address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
wchar_t avatarName[MAX_PATH];
- mir_sntprintf(avatarName, MAX_PATH, L"%s.png", address);
+ mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -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;
- wchar_t *name = mir_utf8decodeT(rawName);
+ wchar_t *name = mir_utf8decodeW(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -74,11 +74,11 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- transfer->pfts.tszWorkingDir = mir_tstrdup(tszPath);
+ transfer->pfts.tszWorkingDir = mir_wstrdup(tszPath);
// stupid fix
wchar_t fullPath[MAX_PATH];
- mir_sntprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
+ mir_snwprintf(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))
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 40f8faea75..af5b51d8cc 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -23,7 +23,7 @@ struct FileTransferParam pfts.hContact = NULL;
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[0] = pfts.tszCurrentFile = mir_wstrdup(fileName);
pfts.ptszFiles[pfts.totalFiles] = NULL;
pfts.totalBytes = pfts.currentFileSize = fileSize;
pfts.totalProgress = pfts.currentFileProgress = 0;
@@ -42,7 +42,7 @@ struct FileTransferParam void ChangeName(const wchar_t *fileName)
{
- pfts.ptszFiles[0] = replaceStrT(pfts.tszCurrentFile, fileName);
+ pfts.ptszFiles[0] = replaceStrW(pfts.tszCurrentFile, fileName);
}
uint8_t GetDirection() const
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index a8e89ac51b..009c32b867 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -150,7 +150,7 @@ MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DW INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam)
{
wchar_t *uri = (wchar_t*)lParam;
- if (mir_tstrlen(uri) <= 4)
+ if (mir_wstrlen(uri) <= 4)
return 1;
if (Accounts.getCount() == 0)
@@ -173,7 +173,7 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
- psr.id.a = mir_t2a(&uri[4]);
+ psr.id.a = mir_u2a(&uri[4]);
ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
acs.szProto = proto->m_szModuleName;
diff --git a/protocols/Twitter/src/StringUtil.h b/protocols/Twitter/src/StringUtil.h index f1ebdb55e1..51a13123e8 100644 --- a/protocols/Twitter/src/StringUtil.h +++ b/protocols/Twitter/src/StringUtil.h @@ -44,7 +44,7 @@ inline std::wstring UTF8ToWide(const std::string& str) inline bool Compare(const wstring& one, const wstring& two, bool caseSensitive)
{
- return caseSensitive ? (one == two) : (mir_tstrcmpi(one.c_str(), two.c_str()) == 0);
+ return caseSensitive ? (one == two) : (mir_wstrcmpi(one.c_str(), two.c_str()) == 0);
}
#endif//_STRINGUTIL_H_INCLUDED_
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 940d34eee5..8a7d155f26 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -29,25 +29,25 @@ void TwitterProto::UpdateChat(const twitter_user &update) gce.pDest = &gcd;
gce.bIsMe = (update.username == twit_.get_username());
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = mir_a2t(update.username.c_str());
+ gce.ptszUID = mir_a2u(update.username.c_str());
//TODO: write code here to replace % with %% in update.status.text (which is a std::string)
std::string chatText = update.status.text;
replaceAll(chatText, "%", "%%");
- gce.ptszText = mir_a2t_cp(chatText.c_str(), CP_UTF8);
- //gce.ptszText = mir_a2t_cp(update.status.text.c_str(),CP_UTF8);
+ gce.ptszText = mir_a2u_cp(chatText.c_str(), CP_UTF8);
+ //gce.ptszText = mir_a2u_cp(update.status.text.c_str(),CP_UTF8);
gce.time = static_cast<DWORD>(update.status.time);
DBVARIANT nick;
MCONTACT hContact = UsernameToHContact(update.username.c_str());
if (hContact && !db_get_s(hContact, "CList", "MyHandle", &nick)) {
- gce.ptszNick = mir_a2t(nick.pszVal);
+ gce.ptszNick = mir_a2u(nick.pszVal);
db_free(&nick);
}
else
- gce.ptszNick = mir_a2t(update.username.c_str());
+ gce.ptszNick = mir_a2u(update.username.c_str());
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
@@ -78,7 +78,7 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS:
{
- ptrA text(mir_t2a(hook->ptszUID));
+ ptrA text(mir_u2a(hook->ptszUID));
CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0);
}
break;
@@ -93,8 +93,8 @@ void TwitterProto::AddChatContact(const char *name, const char *nick) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2t(nick ? nick : name);
- gce.ptszUID = mir_a2t(name);
+ gce.ptszNick = mir_a2u(nick ? nick : name);
+ gce.ptszUID = mir_a2u(name);
gce.ptszStatus = L"Normal";
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
@@ -107,7 +107,7 @@ void TwitterProto::DeleteChatContact(const char *name) GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2t(name);
+ gce.ptszNick = mir_a2u(name);
gce.ptszUID = gce.ptszNick;
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 880ba6974a..174046afdb 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -49,7 +49,7 @@ MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr) if (m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.w));
+ ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeW(psr->nick.w));
return AddToClientList(_T2A(psr->nick.w), "");
}
@@ -127,8 +127,8 @@ void TwitterProto::DoSearch(void *pArg) if (found) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.w = mir_a2t(info.username.c_str());
- psr.firstName.w = mir_a2t(info.real_name.c_str());
+ psr.nick.w = mir_a2u(info.username.c_str());
+ psr.firstName.w = mir_a2u(info.real_name.c_str());
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index ccc9b20db5..dc5a40dc99 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -46,7 +46,7 @@ PLUGININFOEX pluginInfo = { static int compare_protos(const TwitterProto *p1, const TwitterProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<TwitterProto> g_Instances(1, compare_protos);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 5b58154808..c0f1e32b01 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -313,12 +313,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.szSettingsModule = m_szModuleName;
// Create standard network connection
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -326,12 +326,12 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) char module[512];
mir_snprintf(module, "%sAv", m_szModuleName);
nlu.szSettingsModule = module;
- mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (hAvatarNetlib_ == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -380,7 +380,7 @@ int TwitterProto::ShowPinDialog() void TwitterProto::ShowPopup(const wchar_t *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
wcsncpy_s(popup.lptzText, text, _TRUNCATE);
if (Error) {
@@ -398,7 +398,7 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) void TwitterProto::ShowPopup(const char *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
+ mir_snwprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText));
if (Error) {
popup.iSeconds = -1;
@@ -422,7 +422,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.
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));
+ mir_snwprintf(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;
}
@@ -455,7 +455,7 @@ void TwitterProto::UpdateSettings() std::wstring TwitterProto::GetAvatarFolder()
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index b6e067dab7..e6e5dc2a5e 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -113,7 +113,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Set window title
wchar_t title[512];
- mir_sntprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
+ mir_snwprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
@@ -125,7 +125,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
ShowWindow(hwndDlg, SW_HIDE);
- char *narrow = mir_t2a_cp(msg, CP_UTF8);
+ char *narrow = mir_u2a_cp(msg, CP_UTF8);
proto->ForkThread(&TwitterProto::SendTweetWorker, narrow);
EndDialog(hwndDlg, wParam);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 340a27c78e..31865ddd4a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -152,7 +152,7 @@ wchar_t* CVkProto::GetUserStoredPassword() {
debugLogA("CVkProto::GetUserStoredPassword");
ptrA szRawPass(getStringA("Password"));
- return (szRawPass != NULL) ? mir_utf8decodeT(szRawPass) : NULL;
+ return (szRawPass != NULL) ? mir_utf8decodeW(szRawPass) : NULL;
}
void CVkProto::SetAllContactStatuses(int iStatus)
@@ -389,9 +389,9 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul CMStringA name = getAttr(pFieldBeg, "name");
CMStringA value = getAttr(pFieldBeg, "value");
if (name == "email")
- value = (char*)T2Utf(ptrT(getTStringA("Login")));
+ value = (char*)T2Utf(ptrW(getTStringA("Login")));
else if (name == "pass")
- value = (char*)T2Utf(ptrT(GetUserStoredPassword()));
+ value = (char*)T2Utf(ptrW(GetUserStoredPassword()));
else if (name == "captcha_key") {
char *pCaptchaBeg = strstr(pFormBeg, "<img id=\"captcha\"");
if (pCaptchaBeg != NULL)
@@ -421,7 +421,7 @@ CMString CVkProto::RunConfirmationCode() pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
CMString CVkProto::RunRenameNick(LPCTSTR ptszOldName)
@@ -433,7 +433,7 @@ CMString CVkProto::RunRenameNick(LPCTSTR ptszOldName) pForm.ptszInitVal = ptszOldName;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "renamenick_";
- return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult));
+ return (!EnterString(&pForm)) ? CMString() : CMString(ptrW(pForm.ptszResult));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -504,7 +504,7 @@ void __cdecl CVkProto::DBAddAuthRequestThread(void *p) if (param->hContact == NULL || param->hContact == INVALID_CONTACT_ID || !IsOnline())
return;
- for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick"))); i++) {
+ for (int i = 0; i < MAX_RETRIES && IsEmpty(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick"))); i++) {
Sleep(1500);
if (!IsOnline())
@@ -519,9 +519,9 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) {
debugLogA("CVkProto::DBAddAuthRequest");
- T2Utf szNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")));
- T2Utf szFirstName(ptrT(db_get_tsa(hContact, m_szModuleName, "FirstName")));
- T2Utf szLastName(ptrT(db_get_tsa(hContact, m_szModuleName, "LastName")));
+ T2Utf szNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")));
+ T2Utf szFirstName(ptrW(db_get_tsa(hContact, m_szModuleName, "FirstName")));
+ T2Utf szLastName(ptrW(db_get_tsa(hContact, m_szModuleName, "LastName")));
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
@@ -589,7 +589,7 @@ void CVkProto::SetMirVer(MCONTACT hContact, int platform) return;
}
- CMString MirVer, OldMirVer(ptrT(db_get_tsa(hContact, m_szModuleName, "MirVer")));
+ CMString MirVer, OldMirVer(ptrW(db_get_tsa(hContact, m_szModuleName, "MirVer")));
bool bSetFlag = true;
switch (platform) {
@@ -685,7 +685,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
- mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime);
+ mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -1245,7 +1245,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn else {
MCONTACT hContact = FindUser(uid);
if (hContact || uid == m_msgId)
- tszNick = ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ tszNick = ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
else
tszNick = TranslateT("(Unknown contact)");
tszUrl.AppendFormat(L"https://vk.com/id%d", uid);
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index a2ada3e6d0..7401f2a386 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -130,7 +130,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) 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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -139,7 +139,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbL pszDest[tPathLen++] = '\\';
const wchar_t *szFileType = L".jpg";
- ptrT szUrl(getTStringA(hContact, "AvatarUrl"));
+ ptrW szUrl(getTStringA(hContact, "AvatarUrl"));
if (szUrl) {
wchar_t *p = wcsrchr(szUrl, '.');
if (p != NULL)
@@ -147,7 +147,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbL }
LONG id = getDword(hContact, "ID", -1);
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
+ mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%d%s", id, szFileType);
}
void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl)
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 10726e6842..33add5f629 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -46,12 +46,12 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) c = new CVkChatInfo(id);
if (jnDlg) {
tszTitle = jnDlg["title"].as_mstring();
- c->m_tszTopic = mir_tstrdup(!tszTitle.IsEmpty() ? tszTitle : L"");
+ c->m_tszTopic = mir_wstrdup(!tszTitle.IsEmpty() ? tszTitle : L"");
}
CMString sid;
sid.Format(L"%S_%d", m_szModuleName, id);
- c->m_tszId = mir_tstrdup(sid);
+ c->m_tszId = mir_wstrdup(sid);
GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
@@ -183,13 +183,13 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe bNew = cu->m_bUnknown;
cu->m_bDel = false;
- CMString tszNick(ptrT(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
if (tszNick.IsEmpty()) {
CMString fName(jnUser["first_name"].as_mstring());
CMString lName(jnUser["last_name"].as_mstring());
tszNick = fName.Trim() + L" " + lName.Trim();
}
- cu->m_tszNick = mir_tstrdup(tszNick);
+ cu->m_tszNick = mir_wstrdup(tszNick);
cu->m_bUnknown = false;
if (bNew) {
@@ -217,7 +217,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe gce.ptszUID = tszId;
gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY;
gce.time = time(NULL);
- gce.ptszNick = mir_tstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_tszNick, tszId));
+ gce.ptszNick = mir_wstrdup(CMString(FORMAT, L"%s (https://vk.com/id%s)", cu.m_tszNick, tszId));
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
cc->m_users.remove(i);
@@ -272,10 +272,10 @@ void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCTSTR tszTopic) if (!cc)
return;
- if (mir_tstrcmp(cc->m_tszTopic, tszTopic) == 0)
+ if (mir_wstrcmp(cc->m_tszTopic, tszTopic) == 0)
return;
- cc->m_tszTopic = mir_tstrdup(tszTopic);
+ cc->m_tszTopic = mir_wstrdup(tszTopic);
setTString(cc->m_hContact, "Nick", tszTopic);
GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_CHANGESESSIONAME };
@@ -406,7 +406,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & cm->m_uid = uid;
cm->m_date = msgTime;
- cm->m_tszBody = mir_tstrdup(tszBody);
+ cm->m_tszBody = mir_wstrdup(tszBody);
cm->m_bHistory = bIsHistory;
cm->m_bIsAction = bIsAction;
}
@@ -419,8 +419,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu == NULL) {
cc->m_users.insert(cu = new CVkChatUser(uid));
- CMString tszNick(ptrT(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
- cu->m_tszNick = mir_tstrdup(tszNick.IsEmpty() ? (hContact ? ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : tszNick);
+ CMString tszNick(ptrW(db_get_tsa(cc->m_hContact, m_szModuleName, CMStringA(FORMAT, "nick%d", cu->m_uid))));
+ cu->m_tszNick = mir_wstrdup(tszNick.IsEmpty() ? (hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown")) : tszNick);
cu->m_bUnknown = true;
}
@@ -433,8 +433,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR gce.ptszUID = tszId;
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((wchar_t *)ptszBody) ? mir_tstrdup(L"...") : mir_tstrdup(ptszBody);
+ gce.ptszNick = cu->m_tszNick ? mir_wstrdup(cu->m_tszNick) : mir_wstrdup(hContact ? ptrW(db_get_tsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
+ gce.ptszText = IsEmpty((wchar_t *)ptszBody) ? mir_wstrdup(L"...") : mir_wstrdup(ptszBody);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
StopChatContactTyping(cc->m_chatid, uid);
}
@@ -444,7 +444,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCTSTR CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId)
{
for (int i = 0; i < m_chats.getCount(); i++)
- if (!mir_tstrcmp(m_chats[i].m_tszId, ptszId))
+ if (!mir_wstrcmp(m_chats[i].m_tszId, ptszId))
return &m_chats[i];
return NULL;
@@ -454,7 +454,7 @@ CVkChatInfo* CVkProto::GetChatById(LPCTSTR ptszId) void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return;
@@ -496,9 +496,9 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
- if (IsOnline() && mir_tstrlen(gch->ptszText) > 0) {
- ptrT ptszBuf(mir_tstrdup(gch->ptszText));
- rtrimt(ptszBuf);
+ if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
+ ptrW ptszBuf(mir_wstrdup(gch->ptszText));
+ rtrimw(ptszBuf);
UnEscapeChatTags(ptszBuf);
SendMsg(cc->m_hContact, 0, T2Utf(ptszBuf));
}
@@ -641,7 +641,7 @@ INT_PTR __cdecl CVkProto::OnLeaveChat(WPARAM hContact, LPARAM) if (!IsOnline())
return 1;
- ptrT tszChatID(getTStringA(hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(hContact, "ChatRoomID"));
if (tszChatID == NULL)
return 1;
@@ -695,7 +695,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con if (msg.IsEmpty()) {
msg = TranslateT("You've been kicked by ");
if (hContact != NULL)
- msg += ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ msg += ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"));
else
msg += TranslateT("(Unknown contact)");
}
@@ -799,15 +799,15 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) wchar_t tszId[20];
_itow(cu->m_uid, tszId, 10);
- gce.ptszNick = mir_tstrdup(cu->m_tszNick);
+ gce.ptszNick = mir_wstrdup(cu->m_tszNick);
gce.bIsMe = (cu->m_uid == m_myUserId);
gce.ptszUID = tszId;
- gce.ptszText = mir_tstrdup(tszNewNick);
+ gce.ptszText = mir_wstrdup(tszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- cu->m_tszNick = mir_tstrdup(tszNewNick);
+ cu->m_tszNick = mir_wstrdup(tszNewNick);
setTString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), tszNewNick);
}
break;
@@ -901,7 +901,7 @@ void CVkProto::ChatContactTypingThread(void *p) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick);
+ mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_tszNick);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
@@ -933,7 +933,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, L" ");
+ mir_snwprintf(st.tszText, L" ");
// CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, NULL) clears statusbar very slowly.
// (1-10 sec(!!!) for me on tabSRMM O_o)
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 5c119b5d5b..b043e9c242 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -142,7 +142,7 @@ void CVkWallPostForm::On_btnShare_Click(CCtrlButton*) void CVkWallPostForm::On_edtValue_Change(CCtrlEdit*)
{
- m_btnShare.Enable(!IsEmpty(ptrT(m_edtMsg.GetText())) || !IsEmpty(ptrT(m_edtUrl.GetText())));
+ m_btnShare.Enable(!IsEmpty(ptrW(m_edtMsg.GetText())) || !IsEmpty(ptrW(m_edtUrl.GetText())));
}
////////////////////////////////// IDD_INVITE /////////////////////////////////////////////
@@ -213,7 +213,7 @@ void CVkGCCreateForm::btnOk_OnOk(CCtrlButton*) bool bRes = !szUIds.IsEmpty();
if (bRes)
- m_proto->CreateNewChat(szUIds, ptrT(m_edtTitle.GetText()));
+ m_proto->CreateNewChat(szUIds, ptrW(m_edtTitle.GetText()));
EndDialog(m_hwnd, bRes);
}
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index be5b0eed16..0ab7fdd00d 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -85,7 +85,7 @@ void CVkProto::AddCListEvent(bool bNews) cle.hContact = hContact;
cle.hDbEvent = NULL;
wchar_t toolTip[255];
- mir_sntprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications"));
+ mir_snwprintf(toolTip, bNews ? TranslateT("New news") : TranslateT("New notifications"));
cle.ptszTooltip = toolTip;
pcli->pfnAddEvent(&cle);
}
@@ -541,7 +541,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser LONG iGroupId = jnItem["id"].as_int();
CMString tszId(FORMAT, L"%d,", iGroupId);
- CMString tszIds(ptrT(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds")));
+ CMString tszIds(ptrW(db_get_tsa(NULL, m_szModuleName, "InviteGroupIds")));
if (tszIds.Find(tszId, 0) != -1)
return NULL;
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 59738aab54..bcb06a7a29 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -351,7 +351,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (isChatRoom(fup->hContact)) {
- ptrT tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
+ ptrW tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
if (!tszChatID) {
SendFileFiled(fup, VKERR_INVALID_USER);
return;
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index ec6ed4100e..2d07963dad 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -188,7 +188,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrT ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
CMString str(FORMAT, L"%s %s %s", TranslateT("Error loading message history from server"), TranslateT("for"), ptszNick);
MsgPopup(param->hContact, str, TranslateT("Error"), true);
@@ -280,7 +280,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (m_iLoadHistoryTask > 0)
m_iLoadHistoryTask--;
- ptrT ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(param->hContact, m_szModuleName, "Nick"));
CMString str(FORMAT, TranslateT("Loading messages for %s is completed"), ptszNick);
debugLog(L"CVkProto::OnReceiveHistoryMessages for %s m_iLoadHistoryTask=%d", ptszNick, m_iLoadHistoryTask);
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index aedf678894..b83e711ab1 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -54,7 +54,7 @@ void CVkAccMgrForm::OnInitDialog() void CVkAccMgrForm::OnApply()
{
pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
if (bPassChanged) {
T2Utf szRawPasswd(ptszNewPass);
m_proto->setString("Password", szRawPasswd);
@@ -62,8 +62,8 @@ void CVkAccMgrForm::OnApply() m_ptszOldPass = ptszNewPass;
}
- ptrT ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
m_proto->ClearAccessToken();
m_ptszOldLogin = ptszNewLogin;
}
@@ -182,7 +182,7 @@ void CVkOptionAccountForm::OnInitDialog() for (size_t i = 0; i < _countof(vkLangCodes); i++) {
int cur = m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
- if (!mir_tstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
+ if (!mir_wstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
m_cbxVKLang.SetCurSel(cur);
}
@@ -194,14 +194,14 @@ void CVkOptionAccountForm::OnApply() m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.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)) {
+ ptrW ptszGroupName(m_edtGroupName.GetText());
+ if (mir_wstrcmp(m_ptszOldGroup, ptszGroupName)) {
Clist_GroupCreate(NULL, ptszGroupName);
m_ptszOldGroup = ptszGroupName;
}
pass_ptrT ptszNewPass(m_edtPassword.GetText());
- bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ bool bPassChanged = mir_wstrcmp(m_ptszOldPass, ptszNewPass) != 0;
if (bPassChanged) {
T2Utf szRawPasswd(ptszNewPass);
m_proto->setString("Password", szRawPasswd);
@@ -209,8 +209,8 @@ void CVkOptionAccountForm::OnApply() m_ptszOldPass = ptszNewPass;
}
- ptrT ptszNewLogin(m_edtLogin.GetText());
- if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ ptrW ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_wstrcmpi(m_ptszOldLogin, ptszNewLogin))
m_proto->ClearAccessToken();
m_ptszOldLogin = ptszNewLogin;
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index ed5e35bc15..ddc9b42d09 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -31,7 +31,7 @@ class CVkAccMgrForm : public CVkDlgBase CCtrlHyperlink m_hlLink;
pass_ptrT m_ptszOldPass;
- ptrT m_ptszOldLogin;
+ ptrW m_ptszOldLogin;
public:
CVkAccMgrForm(CVkProto *proto, HWND hwndParent);
@@ -55,8 +55,8 @@ class CVkOptionAccountForm : public CVkDlgBase CCtrlCombo m_cbxMarkAsRead;
pass_ptrT m_ptszOldPass;
- ptrT m_ptszOldLogin;
- ptrT m_ptszOldGroup;
+ ptrW m_ptszOldLogin;
+ ptrW m_ptszOldGroup;
public:
CVkOptionAccountForm(CVkProto *proto);
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index a18754ce83..372a73e92f 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -41,8 +41,8 @@ void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * itoa(jnResponse["ts"].as_int(), ts, 10);
m_pollingTs = mir_strdup(ts);
- m_pollingKey = mir_t2a(jnResponse["key"].as_mstring());
- m_pollingServer = mir_t2a(jnResponse["server"].as_mstring());
+ m_pollingKey = mir_u2a(jnResponse["key"].as_mstring());
+ m_pollingServer = mir_u2a(jnResponse["server"].as_mstring());
if (!m_hPollingThread) {
debugLogA("CVkProto::OnReceivePollingInfo m_hPollingThread is NULL");
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index a31f4658a2..8144f79aa2 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static int sttCompareProtocols(const CVkProto *p1, const CVkProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHttpRequest *p2)
@@ -62,7 +62,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *ptszUserName) : HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
wchar_t descr[512];
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = {sizeof(nlu)};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -357,7 +357,7 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) {
LONG userID = getDword(hContact, "ID", -1);
bool bisFriend = (getBool(hContact, "Auth", true) == 0);
- bool bisBroadcast = !(IsEmpty(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
+ bool bisBroadcast = !(IsEmpty(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
Menu_ShowItem(m_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
Menu_ShowItem(m_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
@@ -425,7 +425,7 @@ void CVkProto::InitPopups(void) ppc.PluginWindowProc = PopupDlgProc;
ppc.lParam = APF_RETURN_HWND;
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -435,7 +435,7 @@ void CVkProto::InitPopups(void) ppc.iSeconds = 60;
m_hPopupClassError = Popup_RegisterClass(&ppc);
- mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notification"));
+ mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notification"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -576,7 +576,7 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * setByte(param->hContact, "Auth", 0);
if (iRet == 2) {
CMString msg,
- tszNick(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
+ tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
if (tszNick.IsEmpty())
tszNick = TranslateT("(Unknown contact)");
msg.AppendFormat(TranslateT("User %s added as friend"), tszNick);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index c19c3610bf..f3004e3855 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -33,9 +33,9 @@ HANDLE CVkProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, con {
PROTOSEARCHBYNAME *psr = new (PROTOSEARCHBYNAME);
- psr->pszFirstName = mir_tstrdup(firstName);
- psr->pszLastName = mir_tstrdup(lastName);
- psr->pszNick = mir_tstrdup(nick);
+ psr->pszFirstName = mir_wstrdup(firstName);
+ psr->pszLastName = mir_wstrdup(lastName);
+ psr->pszNick = mir_wstrdup(nick);
ForkThread(&CVkProto::SearchThread, (void *)psr);
return (HANDLE)1;
@@ -69,7 +69,7 @@ void __cdecl CVkProto::SearchThread(void *p) PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
wchar_t arg[200];
- mir_sntprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
+ mir_snwprintf(arg, L"%s %s %s", pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(L"CVkProto::SearchThread %s", arg);
if (!IsOnline())
return;
@@ -126,10 +126,10 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Domain(jnRecord["domain"].as_mstring());
- 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);
+ psr.id.w = mir_wstrdup(Id);
+ psr.firstName.w = mir_wstrdup(FirstName);
+ psr.lastName.w = mir_wstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_wstrdup(Domain) : mir_wstrdup(Nick);
bool filter = true;
if (pParam) {
@@ -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.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);
+ psr.id.w = mir_wstrdup(Id);
+ psr.firstName.w = mir_wstrdup(FirstName);
+ psr.lastName.w = mir_wstrdup(LastName);
+ psr.nick.w = Nick.IsEmpty() ? mir_wstrdup(Email) : mir_wstrdup(Nick);
+ psr.email.w = mir_wstrdup(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 add498f486..9fc8aef944 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -69,8 +69,8 @@ void CVkProto::SetServerStatus(int iNewStatus) return;
int iOldStatus = m_iStatus;
- CMString oldStatusMsg(ptrT(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")));
- ptrT ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
+ CMString oldStatusMsg(ptrW(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")));
+ ptrW ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
m_bNeedSendOnline = false;
@@ -126,7 +126,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR OnReceiveStatus(reply, pReq);
- ptrT ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
+ ptrW ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg"));
CMString tszOldStatusMsg(ptszOldStatusMsg);
ENTER_STRING pForm = { sizeof(pForm) };
@@ -139,7 +139,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR if (!EnterString(&pForm))
return;
- CMString tszNewStatusMsg(ptrT(pForm.ptszResult));
+ CMString tszNewStatusMsg(ptrW(pForm.ptszResult));
if (tszOldStatusMsg == tszNewStatusMsg)
return;
@@ -240,7 +240,7 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam) db_unset(NULL, m_szModuleName, "ListeningTo");
else if (pliInfo->dwFlags & LTI_UNICODE) {
if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT))
- tszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
+ tszListeningTo = ptrW((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%artist% - %title%", (LPARAM)pliInfo));
else
tszListeningTo.Format(L"%s - %s",
pliInfo->ptszArtist ? pliInfo->ptszArtist : L"",
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index a1d074a9ad..12bc8804d0 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -100,8 +100,8 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr) CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const wchar_t *_desc, wchar_t **_files) :
hContact(_hContact),
- Desc(mir_tstrdup(_desc)),
- FileName(mir_tstrdup(_files[0])),
+ Desc(mir_wstrdup(_desc)),
+ FileName(mir_wstrdup(_files[0])),
atr(NULL),
fname(NULL),
filetype(typeInvalid)
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 86cee657fe..19e320eb67 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -141,7 +141,7 @@ struct CVkChatMessage : public MZeroedObject int m_mid, m_uid, m_date;
bool m_bHistory, m_bIsAction;
- ptrT m_tszBody;
+ ptrW m_tszBody;
};
struct CVkChatUser : public MZeroedObject
@@ -154,7 +154,7 @@ struct CVkChatUser : public MZeroedObject int m_uid;
bool m_bDel, m_bUnknown;
- ptrT m_tszNick;
+ ptrW m_tszNick;
};
struct CVkChatInfo : public MZeroedObject
@@ -170,7 +170,7 @@ struct CVkChatInfo : public MZeroedObject int m_chatid, m_admin_id;
bool m_bHistoryRead;
- ptrT m_tszTopic, m_tszId;
+ ptrW m_tszTopic, m_tszId;
MCONTACT m_hContact;
OBJLIST<CVkChatUser> m_users;
OBJLIST<CVkChatMessage> m_msgs;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 185f52e583..ea600d8eb4 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -355,11 +355,11 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) setTString(hContact, "Phone", tszValue);
tszValue = jnItem["status"].as_mstring();
- CMString tszOldStatus(ptrT(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
+ CMString tszOldStatus(ptrW(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
if (tszValue != tszOldStatus)
db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", tszValue);
- CMString tszOldListeningTo(ptrT(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
+ CMString tszOldListeningTo(ptrW(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
const JSONNode &jnAudio = jnItem["status_audio"];
if (jnAudio) {
CMString tszListeningTo(FORMAT, L"%s - %s", jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
@@ -428,13 +428,13 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) for (int i = iInteres; iInteres > 0; i++) {
CMStringA InteresCat(FORMAT, "Interest%dCat", iInteres);
- ptrT ptszCat(db_get_tsa(hContact, m_szModuleName, InteresCat));
+ ptrW ptszCat(db_get_tsa(hContact, m_szModuleName, InteresCat));
if (!ptszCat)
break;
db_unset(hContact, m_szModuleName, InteresCat);
CMStringA InteresText(FORMAT, "Interest%dText", iInteres);
- ptrT ptszText(db_get_tsa(hContact, m_szModuleName, InteresText));
+ ptrW ptszText(db_get_tsa(hContact, m_szModuleName, InteresText));
if (!ptszText)
break;
db_unset(hContact, m_szModuleName, InteresText);
@@ -678,7 +678,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- ptrT ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
CMString ptszMsg;
if (flag == 0) {
ptszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick);
@@ -699,7 +699,7 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
- CMString tszNick(ptrT(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
+ CMString tszNick(ptrW(db_get_tsa(param->hContact, m_szModuleName, "Nick")));
if (tszNick.IsEmpty())
tszNick = TranslateT("(Unknown contact)");
CMString msgformat, msg;
@@ -771,7 +771,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) tszVarWarning += ".\n";
code += "return 1;";
- ptrT ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
+ ptrW ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
CMString ptszMsg(FORMAT, TranslateT("Are you sure to ban %s? %s%sContinue?"),
IsEmpty(ptszNick) ? TranslateT("(Unknown contact)") : ptszNick,
tszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
@@ -796,7 +796,7 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
- CMString tszNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick"))),
+ CMString tszNick(ptrW(db_get_tsa(hContact, m_szModuleName, "Nick"))),
ptszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), tszNick.IsEmpty() ? TranslateT("(Unknown contact)") : tszNick);
if (IDNO == MessageBox(NULL, ptszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
@@ -812,7 +812,7 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcOpenBroadcast");
- CMString tszAudio(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
+ CMString tszAudio(ptrW(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
if (!tszAudio.IsEmpty())
Utils_OpenUrlT(tszAudio);
@@ -823,14 +823,14 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) {
debugLogA("CVkProto::SvcVisitProfile");
if (isChatRoom(hContact)) {
- ptrT tszHomepage(db_get_tsa(hContact, m_szModuleName, "Homepage"));
+ ptrW tszHomepage(db_get_tsa(hContact, m_szModuleName, "Homepage"));
if(!IsEmpty(tszHomepage))
Utils_OpenUrlT(tszHomepage);
return 0;
}
LONG userID = getDword(hContact, "ID", -1);
- ptrT tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
+ ptrW tszDomain(db_get_tsa(hContact, m_szModuleName, "domain"));
CMString tszUrl("https://vk.com/");
if (tszDomain)
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index e1839586e6..536602bcb2 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -102,8 +102,8 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const 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());
+ mir_snwprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
+ mir_snwprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
}
else {
std::wstring tszContactAva = GetAvatarFileName(hContact);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index f33a628461..26a46bec48 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -146,7 +146,7 @@ void WhatsAppProto::ChatLogMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo)
{
CMString title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick);
- ptrT tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ ptrW tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
ENTER_STRING es = { 0 };
es.cbSize = sizeof(es);
@@ -207,7 +207,7 @@ void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) break;
case IDM_CPY_NICK:
- utils::copyText(pcli->hwndContactList, ptrT(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
+ utils::copyText(pcli->hwndContactList, ptrW(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
break;
case IDM_CPY_RJID:
@@ -253,7 +253,7 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid) int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM)
{
if (isChatRoom(hContact) && isOnline()) {
- ptrT tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
+ ptrW tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
if (tszID)
m_pConnection->sendJoinLeaveGroup(_T2A(tszID), false);
}
@@ -333,12 +333,12 @@ wchar_t* WhatsAppProto::GetChatUserNick(const std::string &jid) wchar_t* tszNick;
if (m_szJid != jid) {
MCONTACT hContact = ContactIDToHContact(jid);
- tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
}
else tszNick = str2t(m_szNick);
if (tszNick == NULL)
- tszNick = mir_tstrdup(TranslateT("Unknown user"));
+ tszNick = mir_wstrdup(TranslateT("Unknown user"));
return tszNick;
}
@@ -393,9 +393,9 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg) msg += pMsg.media_url;
}
- ptrT tszText(str2t(msg));
- ptrT tszUID(str2t(pMsg.remote_resource));
- ptrT tszNick(GetChatUserNick(pMsg.remote_resource));
+ ptrW tszText(str2t(msg));
+ ptrW tszUID(str2t(pMsg.remote_resource));
+ ptrW tszNick(GetChatUserNick(pMsg.remote_resource));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
@@ -418,13 +418,13 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string if (pInfo == NULL)
return;
- ptrT tszText(str2t(newSubject));
- ptrT tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
- if (!mir_tstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
+ ptrW tszText(str2t(newSubject));
+ ptrW tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ if (!mir_wstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
return;
- ptrT tszUID(str2t(author));
- ptrT tszNick(GetChatUserNick(author));
+ ptrW tszUID(str2t(author));
+ ptrW tszNick(GetChatUserNick(author));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
@@ -445,8 +445,8 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u if (pInfo == NULL || !pInfo->bActive)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -464,8 +464,8 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string if (pInfo == NULL)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
@@ -505,8 +505,8 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector for (size_t i = 0; i < participants.size(); i++) {
std::string curr = participants[i];
- ptrT ujid(str2t(curr)), nick(GetChatUserNick(curr));
- bool bIsOwner = !mir_tstrcmp(ujid, pInfo->tszOwner);
+ ptrW ujid(str2t(curr)), nick(GetChatUserNick(curr));
+ bool bIsOwner = !mir_wstrcmp(ujid, pInfo->tszOwner);
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -538,8 +538,8 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg) if (p == pInfo->m_unsentMsgs.end())
return;
- ptrT tszUID(str2t(m_szJid));
- ptrT tszNick(str2t(m_szNick));
+ ptrW tszUID(str2t(m_szJid));
+ ptrW tszNick(str2t(m_szNick));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 2c9f0c17e9..8026cc0912 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -21,7 +21,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new if (oldName.compare(string(new_name)) != 0) {
db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name);
- CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrT(mir_utf8decodeT(new_name)));
+ CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrW(mir_utf8decodeW(new_name)));
this->NotifyEvent(_A2T(oldName.c_str()), tmp, hContact, WHATSAPP_EVENT_OTHER);
}
}
@@ -74,8 +74,8 @@ void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (reset_client) {
- ptrT tszMirVer(getTStringA(hContact, "MirVer"));
- if (mir_tstrcmp(tszMirVer, L"WhatsApp"))
+ ptrW tszMirVer(getTStringA(hContact, "MirVer"));
+ if (mir_wstrcmp(tszMirVer, L"WhatsApp"))
setTString(hContact, "MirVer", L"WhatsApp");
db_set_ws(hContact, "CList", "StatusMsg", L"");
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 501a09151a..6a86685895 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -113,8 +113,8 @@ public: virtual void OnApply()
{
- ptrT tszGroup(m_group.GetText());
- if (mir_tstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
+ ptrW tszGroup(m_group.GetText());
+ if (mir_wstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
m_proto->m_tszDefaultGroup = tszGroup.detach();
if (m_proto->isOnline())
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index f3e7513339..7cc94409ea 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -26,7 +26,7 @@ PLUGININFOEX pluginInfo = { static int compare_protos(const WhatsAppProto *p1, const WhatsAppProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<WhatsAppProto> g_Instances(1, compare_protos);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 56c0d3571e..e40588f0cc 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -33,7 +33,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) // Create standard network connection
wchar_t descr[512];
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -42,7 +42,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -54,7 +54,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
if (m_tszDefaultGroup == NULL)
- m_tszDefaultGroup = mir_tstrdup(L"WhatsApp");
+ m_tszDefaultGroup = mir_wstrdup(L"WhatsApp");
Clist_GroupCreate(0, m_tszDefaultGroup);
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
@@ -368,8 +368,8 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, wchar_t* url)
{
- wchar_t *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
- wchar_t *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
+ wchar_t *rawTitle = mir_a2u_cp(title.c_str(), CP_UTF8);
+ wchar_t *rawInfo = mir_a2u_cp(info.c_str(), CP_UTF8);
NotifyEvent(rawTitle, rawInfo, contact, flags, url);
mir_free(rawTitle);
mir_free(rawInfo);
@@ -415,8 +415,8 @@ void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONT pd.lchIcon = IcoLib_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = PopupDlgProc;
- mir_tstrcpy(pd.lptzContactName, title);
- mir_tstrcpy(pd.lptzText, info);
+ mir_wstrcpy(pd.lptzContactName, title);
+ mir_wstrcpy(pd.lptzText, info);
ret = PUAddPopupT(&pd);
if (ret == 0)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 04a557f893..f885369ddf 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -14,7 +14,7 @@ struct WAChatInfo }
map<std::string, std::wstring> m_unsentMsgs;
- ptrT tszJid, tszNick, tszOwner;
+ ptrW tszJid, tszNick, tszOwner;
bool bActive;
MCONTACT hContact;
@@ -93,7 +93,7 @@ public: std::vector<string> m_szInviteJids;
map<std::string, WAChatInfo*> m_chats;
mir_cs m_csChats;
- ptrT m_tszDefaultGroup;
+ ptrW m_tszDefaultGroup;
void ChatLogMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
void NickListMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp index 71a33dc2fd..c131dda0f8 100644 --- a/protocols/WhatsApp/src/utils.cpp +++ b/protocols/WhatsApp/src/utils.cpp @@ -18,8 +18,8 @@ void utils::copyText(HWND hwnd, const wchar_t *text) return;
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
- mir_tstrcpy((wchar_t*)GlobalLock(hMem), text);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
+ mir_wstrcpy((wchar_t*)GlobalLock(hMem), text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h index 333860c1dd..eddd9fab45 100644 --- a/protocols/WhatsApp/src/utils.h +++ b/protocols/WhatsApp/src/utils.h @@ -28,7 +28,7 @@ public: std::string getLastErrorMsg();
__forceinline wchar_t* str2t(const std::string &str)
-{ return mir_utf8decodeT(str.c_str());
+{ return mir_utf8decodeW(str.c_str());
}
std::vector<std::string> split(const std::string &s, char delim);
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 34f68acc0a..93dbff7f38 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -596,17 +596,17 @@ void CYahooProto::request_avatar(const char* who) 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);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0))
CreateDirectoryTreeT(pszDest);
if (hContact != NULL) {
int ck_sum = getDword(hContact, "PictCK", 0);
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%lX", ck_sum);
}
else
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName);
+ tPathLen += mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar", m_szModuleName);
wcsncpy_s((pszDest + tPathLen), (cbLen - tPathLen), (type == 1 ? L".swf" : L".png"), _TRUNCATE);
}
@@ -750,7 +750,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (getDword("AvatarHash", 0)) {
if (!getTString("AvatarFile", &dbv)) {
if (_waccess(dbv.ptszVal, 0) == 0) {
- mir_tstrncpy(buffer, dbv.ptszVal, size - 1);
+ mir_wstrncpy(buffer, dbv.ptszVal, size - 1);
buffer[size - 1] = '\0';
ret = 0;
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index ce59ae92f6..486286857d 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -41,7 +41,7 @@ struct InviteChatReqParam CYahooProto* ppro;
InviteChatReqParam(const char* room, const char* who, const char* msg, CYahooProto* ppro)
- : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeT(msg)), ppro(ppro) {}
+ : room(mir_strdup(room)), who(mir_strdup(who)), msg(mir_utf8decodeW(msg)), ppro(ppro) {}
~InviteChatReqParam()
{ mir_free(room); mir_free(who); mir_free(msg); }
@@ -52,9 +52,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)
{
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"");
+ wchar_t *whot = mir_utf8decodeW(who);
+ wchar_t *msgt = mir_utf8decodeW(msg);
+ mir_snwprintf(info, TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : L"");
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info);
mir_free(msgt);
mir_free(whot);
@@ -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)
{
- wchar_t *msgt = utf8 ? mir_utf8decodeT(msg) : mir_a2t(msg);
+ wchar_t *msgt = utf8 ? mir_utf8decodeW(msg) : mir_a2u(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)
{
- wchar_t* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2u(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)
{
- wchar_t* idt = mir_a2t(room);
+ wchar_t* idt = mir_a2u(room);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -197,8 +197,8 @@ void CYahooProto::ChatLeaveAll(void) void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wchar_t* msg)
{
- wchar_t* idt = mir_a2t(room);
- wchar_t* snt = mir_a2t(who);
+ wchar_t* idt = mir_a2u(room);
+ wchar_t* snt = mir_a2u(who);
MCONTACT hContact = getbuddyH(who);
wchar_t* nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt;
@@ -225,8 +225,8 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0;
- char *room = mir_t2a(gch->pDest->ptszID);
- char *who = mir_t2a(gch->ptszUID);
+ char *room = mir_u2a(gch->pDest->ptszID);
+ char *who = mir_u2a(gch->ptszUID);
switch (gch->pDest->iType) {
case GC_SESSION_TERMINATE:
@@ -310,7 +310,7 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- char* id = mir_t2a(gcmi->pszUID);
+ char* id = mir_u2a(gcmi->pszUID);
if (!_stricmp(m_yahoo_id, id)) {
static const gc_item Items[] =
{
@@ -359,7 +359,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, YList* &who, c wchar_t buf[128] = L"";
SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- who = y_list_append(who, mir_t2a(buf));
+ who = y_list_append(who, mir_u2a(buf));
}
else {
DBVARIANT dbv;
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index c0620894dd..50156ddd5d 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -60,7 +60,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, MCONTACT hContact, cons for (YList *l = fs; l; l = l->next) {
yahoo_file_info *fi = (yahoo_file_info*)l->data;
- ft->pfts.ptszFiles[i++] = mir_utf8decodeT(fi->filename);
+ ft->pfts.ptszFiles[i++] = mir_utf8decodeW(fi->filename);
ft->pfts.totalBytes += fi->filesize;
}
@@ -297,7 +297,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char*, unsigned long si *
* Don't rely on workingDir to be right, since it's not used to check if file exists.
*/
- mir_sntprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
+ mir_snwprintf(filefull, L"%s\\%s", sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
FREE(sf->pfts.tszCurrentFile);
sf->pfts.tszCurrentFile = wcsdup(filefull);
@@ -721,7 +721,7 @@ HANDLE __cdecl CYahooProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* //LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user);
ft->pfts.tszWorkingDir = wcsdup(szPath);
- size_t len = mir_tstrlen(ft->pfts.tszWorkingDir) - 1;
+ size_t len = mir_wstrlen(ft->pfts.tszWorkingDir) - 1;
if (ft->pfts.tszWorkingDir[len] == '\\')
ft->pfts.tszWorkingDir[len] = 0;
diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index c42f3ce9ad..1eaeadaf44 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -63,7 +63,7 @@ static char* get_buddy(wchar_t ** arg) *arg = tok ? tok + 1 : NULL;
- return mir_t2a(buf);
+ return mir_u2a(buf);
}
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index 87d254bace..f7c04b8097 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -72,7 +72,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lp static int CompareProtos(const CYahooProto* p1, const CYahooProto* p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
LIST<CYahooProto> g_instances(1, CompareProtos);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index a2610c5f7b..56ad2d559e 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -67,7 +67,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu);
wchar_t tModuleDescr[100];
- mir_sntprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName);
+ mir_snwprintf(tModuleDescr, TranslateT("%s plugin connections"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -541,7 +541,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(MCONTACT hContact) int __cdecl CYahooProto::SetAwayMsg(int status, const wchar_t* msg)
{
- char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL;
+ char *c = msg && msg[0] ? mir_utf8encodeW(msg) : NULL;
debugLogA("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c);
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index d08a08df66..5b0427d2a4 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -24,7 +24,7 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) {
wchar_t *id = (wchar_t *)snsearch;
- if (mir_tstrlen(id) < 4) {
+ if (mir_wstrlen(id) < 4) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK);
return;
@@ -161,7 +161,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) wchar_t searchid[128];
GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid));
- if (mir_tstrlen(searchid) == 0) {
+ if (mir_wstrlen(searchid) == 0) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
MessageBoxA(NULL, "Please enter a valid ID to search for.", "Search", MB_OK);
return;
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 44584763b6..4e792b6162 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -112,8 +112,8 @@ int CYahooProto::ShowPopup(const wchar_t* nickname, const wchar_t* msg, const ch POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- mir_tstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
+ mir_wstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
+ mir_wstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
if (szURL != NULL) {
ppd.lchIcon = LoadIconEx(!mir_strcmpi(szURL, "http://mail.yahoo.com") ? "mail" : "calendar");
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index b9aca199e2..ec97c1c3f1 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -217,8 +217,8 @@ void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const wchar_t * T2Utf u_msg(msg);
ptrA ident(getStringA(hContact, "MyIdentity"));
- ptrT fname(getTStringA(NULL, "FirstName"));
- ptrT lname(getTStringA(NULL, "LastName"));
+ ptrW fname(getTStringA(NULL, "FirstName"));
+ ptrW lname(getTStringA(NULL, "LastName"));
SetStringUtf(hContact, "YGroup", group);
@@ -529,7 +529,7 @@ void CYahooProto::ext_got_calendar(const char *url, int type, const char *msg, i {
LOG(("[ext_got_calendar] URL:%s type: %d msg: %s svc: %d", url, type, msg, svc));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszMsg(mir_utf8decodeW(msg));
if (!ShowPopup(TranslateT("Calendar Reminder"), tszMsg, url))
ShowNotification(TranslateT("Calendar Reminder"), tszMsg, NIIF_INFO);
}
@@ -672,11 +672,11 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) }
else LOG(("[ext_rejected] Buddy not on our buddy list"));
- ptrT tszWho(mir_utf8decodeT(who));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszWho(mir_utf8decodeW(who));
+ ptrW tszMsg(mir_utf8decodeW(msg));
wchar_t buff[1024];
- mir_sntprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho);
+ mir_snwprintf(buff, TranslateT("%s has rejected your request and sent the following message:"), (wchar_t*)tszWho);
MessageBox(NULL, tszMsg, buff, MB_OK | MB_ICONINFORMATION);
}
@@ -926,15 +926,15 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) wchar_t z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
if (from == NULL) {
- mir_sntprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail"));
- mir_sntprintf(z, TranslateT("You have %i unread messages"), cnt);
+ mir_snwprintf(title, L"%s: %s", m_tszUserName, TranslateT("New Mail"));
+ mir_snwprintf(z, TranslateT("You have %i unread messages"), cnt);
}
else {
- mir_sntprintf(title, TranslateT("New Mail (%i messages)"), cnt);
+ mir_snwprintf(title, TranslateT("New Mail (%i messages)"), cnt);
- ptrT tszFrom(mir_utf8decodeT(from));
- ptrT tszSubj(mir_utf8decodeT(subj));
- mir_sntprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj);
+ ptrW tszFrom(mir_utf8decodeW(from));
+ ptrW tszSubj(mir_utf8decodeW(subj));
+ mir_snwprintf(z, TranslateT("From: %s\nSubject: %s"), (wchar_t*)tszFrom, (wchar_t*)tszSubj);
}
if (!ShowPopup(title, z, "http://mail.yahoo.com"))
@@ -950,8 +950,8 @@ void CYahooProto::ext_system_message(const char *me, const char *who, const char {
LOG(("[ext_system_message] System Message to: %s from: %s msg: %s", me, who, msg));
- ptrT tszWho(mir_utf8decodeT(who));
- ptrT tszMsg(mir_utf8decodeT(msg));
+ ptrW tszWho(mir_utf8decodeW(who));
+ ptrW tszMsg(mir_utf8decodeW(msg));
ShowPopup((who != NULL) ? tszWho : TranslateT("Yahoo System Message"), tszMsg, NULL);
}
@@ -1010,7 +1010,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) if (errormsg) {
LOG(("[ext_got_ping] Error msg: %s", errormsg));
- ptrT tszMsg(mir_utf8decodeT(errormsg));
+ ptrW tszMsg(mir_utf8decodeW(errormsg));
ShowError(TranslateT("Yahoo Ping Error"), tszMsg);
return;
}
@@ -1065,33 +1065,33 @@ void CYahooProto::ext_login_response(int succ, const char *url) }
if (succ == YAHOO_LOGIN_UNAME) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed."));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - username not recognized. Please verify that your username is correctly typed."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
}
else if (succ == YAHOO_LOGIN_PASSWD) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed."));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
}
else if (succ == YAHOO_LOGIN_LOCK) {
- mir_sntprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url));
+ mir_snwprintf(buff, TranslateT("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), _A2T(url));
}
else if (succ == YAHOO_LOGIN_DUPL) {
- mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login."));
+ mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service, possibly due to a duplicate login."));
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
}
else if (succ == YAHOO_LOGIN_LOGOFF) {
- //mir_sntprintf(buff, TranslateT("You have been logged out of the Yahoo service."));
+ //mir_snwprintf(buff, TranslateT("You have been logged out of the Yahoo service."));
//ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
return; // we logged out.. so just sign-off..
}
else if (succ == -1) {
/// Can't Connect or got disconnected.
if (m_iStatus == ID_STATUS_CONNECTING)
- mir_sntprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings."));
+ mir_snwprintf(buff, TranslateT("Could not connect to the Yahoo service. Check your server/port and proxy settings."));
else
return;
}
- else mir_sntprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ);
+ else mir_snwprintf(buff, TranslateT("Could not log in, unknown reason: %d."), succ);
delSetting(YAHOO_PWTOKEN);
@@ -1110,35 +1110,35 @@ 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));
+ ptrW tszErr(mir_utf8decodeW(err));
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"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Unknown error %s"), (wchar_t*)tszErr);
break;
case E_CUSTOM:
- mir_sntprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Custom error %s"), (wchar_t*)tszErr);
break;
case E_CONFNOTAVAIL:
- mir_sntprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is not available for the conference"), (wchar_t*)tszErr);
break;
case E_IGNOREDUP:
- mir_sntprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is already ignored"), (wchar_t*)tszErr);
break;
case E_IGNORENONE:
- mir_sntprintf(buff, TranslateT("%s is not in the ignore list"), (wchar_t*)tszErr);
+ mir_snwprintf(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"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("%s is in buddy list - cannot ignore"), (wchar_t*)tszErr);
break;
case E_SYSTEM:
- mir_sntprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("System Error: %s"), (wchar_t*)tszErr);
break;
case E_CONNECTION:
- mir_sntprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr);
+ mir_snwprintf(buff, TranslateT("Server Connection Error: %s"), (wchar_t*)tszErr);
debugLogA("Error: %S", buff);
return;
}
|