From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/clist.cpp | 28 +++---- protocols/IRCG/src/commandmonitor.cpp | 146 +++++++++++++++++----------------- protocols/IRCG/src/input.cpp | 88 ++++++++++---------- protocols/IRCG/src/irclib.cpp | 16 ++-- protocols/IRCG/src/ircproto.cpp | 30 +++---- protocols/IRCG/src/options.cpp | 20 ++--- protocols/IRCG/src/output.cpp | 14 ++-- protocols/IRCG/src/scripting.cpp | 10 +-- protocols/IRCG/src/services.cpp | 54 ++++++------- protocols/IRCG/src/tools.cpp | 42 +++++----- protocols/IRCG/src/userinfo.cpp | 8 +- protocols/IRCG/src/windows.cpp | 136 +++++++++++++++---------------- 12 files changed, 296 insertions(+), 296 deletions(-) (limited to 'protocols/IRCG/src') 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 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)) { -- cgit v1.2.3