summaryrefslogtreecommitdiff
path: root/protocols/IRCG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /protocols/IRCG
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
less TCHARs:
- TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IRCG')
-rw-r--r--protocols/IRCG/src/clist.cpp10
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp232
-rw-r--r--protocols/IRCG/src/input.cpp127
-rw-r--r--protocols/IRCG/src/irc_dlg.h6
-rw-r--r--protocols/IRCG/src/irclib.cpp54
-rw-r--r--protocols/IRCG/src/irclib.h14
-rw-r--r--protocols/IRCG/src/ircproto.cpp50
-rw-r--r--protocols/IRCG/src/main.cpp2
-rw-r--r--protocols/IRCG/src/options.cpp156
-rw-r--r--protocols/IRCG/src/output.cpp14
-rw-r--r--protocols/IRCG/src/scripting.cpp14
-rw-r--r--protocols/IRCG/src/services.cpp154
-rw-r--r--protocols/IRCG/src/stdafx.h106
-rw-r--r--protocols/IRCG/src/tools.cpp78
-rw-r--r--protocols/IRCG/src/userinfo.cpp22
-rw-r--r--protocols/IRCG/src/windows.cpp128
16 files changed, 583 insertions, 584 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index 6a15e93456..3f3676869e 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -25,18 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port)
{
MCONTACT hContact;
- TCHAR szNick[256];
+ wchar_t szNick[256];
char szService[256];
bool bFlag = false;
- CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true };
+ CONTACT usertemp = { (wchar_t*)name.c_str(), NULL, NULL, false, false, true };
MCONTACT hc = CList_FindContact(&usertemp);
if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc, "CList", "Hidden", 0) == 0)
bFlag = true;
CMString contactname = name; contactname += DCCSTRING;
- CONTACT user = { (TCHAR*)contactname.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)contactname.c_str(), NULL, NULL, false, false, true };
hContact = CList_AddContact(&user, false, false);
setByte(hContact, "DCC", 1);
@@ -165,7 +165,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user)
if (!user || !user->name)
return 0;
- TCHAR* lowercasename = mir_tstrdup(user->name);
+ wchar_t* lowercasename = mir_tstrdup(user->name);
CharLower(lowercasename);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -198,7 +198,7 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user)
hContact_temp = hContact;
}
}
- else if (_tcschr(user->name, ' ') == 0) {
+ else if (wcschr(user->name, ' ') == 0) {
if ((DBDefault && !mir_tstrcmpi(DBDefault, user->name) || DBNick && !mir_tstrcmpi(DBNick, user->name) ||
DBWildcard && WCCmp(DBWildcard, lowercasename))
&& (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) {
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index f72796fde8..8a10cecca7 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -69,7 +69,7 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
return;
}
- TCHAR temp2[270];
+ wchar_t temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
mir_sntprintf(temp2, L"PING %s", ppro->m_info.sServerName.c_str());
else
@@ -164,8 +164,8 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
db_free(&dbv);
DBVARIANT dbv2;
- TCHAR* DBNick = NULL;
- TCHAR* DBWildcard = NULL;
+ wchar_t* DBNick = NULL;
+ wchar_t* DBWildcard = NULL;
if (!ppro->getTString(hContact, "Nick", &dbv))
DBNick = dbv.ptszVal;
if (!ppro->getTString(hContact, "UWildcard", &dbv2))
@@ -216,7 +216,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
ppro->SetChatTimer(ppro->OnlineNotifTimer, ppro->m_onlineNotificationTime * 1000, OnlineNotifTimerProc);
}
-int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, TCHAR* msg)
+int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg)
{
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
@@ -260,7 +260,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
- TCHAR szResponse[100];
+ wchar_t szResponse[100];
mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
@@ -272,13 +272,13 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg)
m_info.sNick = pmsg->parameters[0];
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
- static TCHAR host[1024];
+ static wchar_t host[1024];
int i = 0;
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
- if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
+ if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) {
mir_tstrncpy(host, word.c_str(), _countof(host));
- TCHAR* p1 = _tcschr(host, '@');
+ wchar_t* p1 = wcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
}
@@ -531,7 +531,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
}
if (m_oldStyleModes) {
- TCHAR temp[256];
+ wchar_t temp[256];
mir_sntprintf(temp, TranslateT("%s sets mode %s"),
pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
@@ -545,7 +545,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
for (int i = iParametercount; i < (int)pmsg->parameters.getCount(); i++)
sParams += L" " + pmsg->parameters[i];
- TCHAR temp[4000];
+ wchar_t temp[4000];
mir_sntprintf(temp, TranslateT("%s sets mode %s%s"), pmsg->prefix.sNick.c_str(), sModes.c_str(), sParams.c_str());
DoEvent(GC_EVENT_INFORMATION, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
@@ -554,7 +554,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
PostIrcMessage(L"/MODE %s", pmsg->parameters[0].c_str());
}
else {
- TCHAR temp[256];
+ wchar_t temp[256];
mir_sntprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
CMString sMessage = temp;
@@ -583,7 +583,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg)
DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, host.c_str(), NULL, true, bIsMe);
DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false);
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
@@ -644,9 +644,9 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_YOURHOST(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming) {
- static const TCHAR* lpszFmt = L"Your host is %99[^ \x5b,], running version %99s";
- TCHAR szHostName[100], szVersion[100];
- if (_stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0)
+ static const wchar_t* lpszFmt = L"Your host is %99[^ \x5b,], running version %99s";
+ wchar_t szHostName[100], szVersion[100];
+ if (swscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0)
m_info.sServerName = szHostName;
if (pmsg->parameters[0] != m_info.sNick)
m_info.sNick = pmsg->parameters[0];
@@ -671,7 +671,7 @@ bool CIrcProto::OnIrc_INVITE(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->sCommand == L"PING") {
- TCHAR szResponse[100];
+ wchar_t szResponse[100];
mir_sntprintf(szResponse, L"PONG %s", pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -691,7 +691,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming && !bIsChannel) {
mess = DoColorCodes(mess.c_str(), TRUE, FALSE);
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
if (CallService(MS_IGNORE_ISIGNORED, NULL, IGNOREEVENT_MESSAGE))
if (!CList_FindContact(&user))
@@ -742,7 +742,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// exploit???
if (mess.Find(1) != -1 || mess.Find(L"%newl") != -1) {
- TCHAR temp[4096];
+ wchar_t temp[4096];
mir_sntprintf(temp, TranslateT("CTCP ERROR: Malformed CTCP command received from %s!%s@%s. Possible attempt to take control of your IRC client registered"), pmsg->prefix.sNick.c_str(), pmsg->prefix.sUser.c_str(), pmsg->prefix.sHost.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
return true;
@@ -800,16 +800,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == L"finger") {
PostIrcMessage(L"/NOTICE %s \001FINGER %s (%s)\001", pmsg->prefix.sNick.c_str(), m_name, m_userID);
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP FINGER requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
// incoming VERSION
else if (pmsg->m_bIncoming && command == L"version") {
- PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _T(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
+ PostIrcMessage(L"/NOTICE %s \001VERSION Miranda NG %%mirver (IRC v.%%version)" L", " _A2W(__COPYRIGHT) L"\001", pmsg->prefix.sNick.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -818,7 +818,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == L"source") {
PostIrcMessage(L"/NOTICE %s \001SOURCE Get Miranda IRC here: http://miranda-ng.org/ \001", pmsg->prefix.sNick.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP SOURCE requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -827,7 +827,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == L"userinfo") {
PostIrcMessage(L"/NOTICE %s \001USERINFO %s\001", pmsg->prefix.sNick.c_str(), m_userInfo);
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP USERINFO requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -836,16 +836,16 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == L"ping") {
PostIrcMessage(L"/NOTICE %s \001%s\001", pmsg->prefix.sNick.c_str(), mess.c_str());
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP PING requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
// incoming TIME
else if (pmsg->m_bIncoming && command == L"time") {
- TCHAR temp[300];
+ wchar_t temp[300];
time_t tim = time(NULL);
- mir_tstrncpy(temp, _tctime(&tim), 25);
+ mir_tstrncpy(temp, _wctime(&tim), 25);
PostIrcMessage(L"/NOTICE %s \001TIME %s\001", pmsg->prefix.sNick.c_str(), temp);
mir_sntprintf(temp, TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
@@ -879,9 +879,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
begin = mess.Find(' ', end);
if (begin >= 0) {
CMString rest = mess.Mid(begin);
- dwAdr = _tcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10);
- iPort = _ttoi(GetWord(rest.c_str(), 1).c_str());
- dwSize = _ttoi64(GetWord(rest.c_str(), 2).c_str());
+ dwAdr = wcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10);
+ iPort = _wtoi(GetWord(rest.c_str(), 1).c_str());
+ dwSize = _wtoi64(GetWord(rest.c_str(), 2).c_str());
sToken = GetWord(rest.c_str(), 3);
}
}
@@ -904,7 +904,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// if all characters are number it indicates we have found the adress, port and size parameters
int ind = 0;
while (sTemp[ind] != '\0') {
- if (!_istdigit(sTemp[ind]))
+ if (!iswdigit(sTemp[ind]))
break;
ind++;
}
@@ -915,8 +915,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
}
if (bFlag) {
- TCHAR* p1 = _tcsdup(GetWordAddress(mess.c_str(), 2));
- TCHAR* p2 = (TCHAR*)GetWordAddress(p1, index - 5);
+ wchar_t* p1 = wcsdup(GetWordAddress(mess.c_str(), 2));
+ wchar_t* p2 = (wchar_t*)GetWordAddress(p1, index - 5);
if (type == L"send") {
if (p2 > p1) {
@@ -932,9 +932,9 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
free(p1);
- dwAdr = _tcstoul(GetWord(mess.c_str(), index - (bIsChat ? 2 : 3)).c_str(), NULL, 10);
- iPort = _ttoi(GetWord(mess.c_str(), index - (bIsChat ? 1 : 2)).c_str());
- dwSize = _ttoi64(GetWord(mess.c_str(), index - 1).c_str());
+ dwAdr = wcstoul(GetWord(mess.c_str(), index - (bIsChat ? 2 : 3)).c_str(), NULL, 10);
+ iPort = _wtoi(GetWord(mess.c_str(), index - (bIsChat ? 1 : 2)).c_str());
+ dwSize = _wtoi64(GetWord(mess.c_str(), index - 1).c_str());
sToken = GetWord(mess.c_str(), index);
}
}
@@ -952,8 +952,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
begin = mess.Find(' ', end);
if (begin >= 0) {
CMString rest = mess.Mid(begin);
- iPort = _ttoi(GetWord(rest.c_str(), 0).c_str());
- dwSize = _ttoi(GetWord(rest.c_str(), 1).c_str());
+ iPort = _wtoi(GetWord(rest.c_str(), 0).c_str());
+ dwSize = _wtoi(GetWord(rest.c_str(), 1).c_str());
sToken = GetWord(rest.c_str(), 2);
}
}
@@ -972,7 +972,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
int ind = 0;
while (sTemp[ind] != '\0') {
- if (!_istdigit(sTemp[ind]))
+ if (!iswdigit(sTemp[ind]))
break;
ind++;
}
@@ -982,8 +982,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
index++;
}
if (bFlag) {
- TCHAR* p1 = _tcsdup(GetWordAddress(mess.c_str(), 2));
- TCHAR* p2 = (TCHAR*)GetWordAddress(p1, index - 4);
+ wchar_t* p1 = wcsdup(GetWordAddress(mess.c_str(), 2));
+ wchar_t* p2 = (wchar_t*)GetWordAddress(p1, index - 4);
if (p2 > p1) {
p2--;
@@ -996,8 +996,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
free(p1);
- iPort = _ttoi(GetWord(mess.c_str(), index - 2).c_str());
- dwSize = _ttoi64(GetWord(mess.c_str(), index - 1).c_str());
+ iPort = _wtoi(GetWord(mess.c_str(), index - 2).c_str());
+ dwSize = _wtoi64(GetWord(mess.c_str(), index - 1).c_str());
sToken = GetWord(mess.c_str(), index);
}
}
@@ -1006,7 +1006,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// 2. Check for malformed dcc commands or other errors
if (bIsChat || type == L"send") {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
szTemp[0] = '\0';
unsigned long ulAdr = 0;
@@ -1040,7 +1040,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
sFile = sFileCorrected;
}
else if (type == L"accept" || type == L"resume") {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
szTemp[0] = '\0';
if (type == L"resume" && !m_DCCFileEnabled)
@@ -1066,7 +1066,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// incoming chat request
if (bIsChat) {
- CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), 0, 0, false, false, true };
+ CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), 0, 0, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
// check if it should be ignored
@@ -1078,7 +1078,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
}
else {
- TCHAR szTemp[512];
+ wchar_t szTemp[512];
mir_sntprintf(szTemp, TranslateT("DCC: Chat request from %s denied"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, 0, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
}
@@ -1090,7 +1090,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
if (sToken.IsEmpty())
dcc = FindDCCSendByPort(iPort);
else
- dcc = FindPassiveDCCSend(_ttoi(sToken.c_str())); // reverse ft
+ dcc = FindPassiveDCCSend(_wtoi(sToken.c_str())); // reverse ft
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, (long)FILERESUME_RESUME);
@@ -1128,14 +1128,14 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// a reverse filetransfer. The plugin should connect to that computer
// and start sedning the file (if the token is valid). Compare to DCC RECV
if (!sToken.IsEmpty() && iPort) {
- CDccSession* dcc = FindPassiveDCCSend(_ttoi(sToken.c_str()));
+ CDccSession* dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
if (dcc) {
dcc->SetupPassive(dwAdr, iPort);
dcc->Connect();
}
}
else {
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
if (CallService(MS_IGNORE_ISIGNORED, NULL, IGNOREEVENT_FILE))
if (!CList_FindContact(&user))
return true;
@@ -1160,13 +1160,13 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
setTString(hContact, "User", pmsg->prefix.sUser.c_str());
setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
- TCHAR* tszTemp = (TCHAR*)sFile.c_str();
+ wchar_t* tszTemp = (wchar_t*)sFile.c_str();
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
pre.timestamp = (DWORD)time(NULL);
pre.fileCount = 1;
- pre.files.t = &tszTemp;
+ pre.files.w = &tszTemp;
pre.lParam = (LPARAM)di;
ProtoChainRecvFile(hContact, &pre);
}
@@ -1175,7 +1175,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// end type == "send"
}
else if (pmsg->m_bIncoming) {
- TCHAR temp[300];
+ wchar_t temp[300];
mir_sntprintf(temp, TranslateT("CTCP %s requested by %s"), ocommand.c_str(), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
}
@@ -1183,12 +1183,12 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// handle incoming ctcp in notices. This technique is used for replying to CTCP queries
else if (pmsg->sCommand == L"NOTICE") {
- TCHAR szTemp[300];
+ wchar_t szTemp[300];
szTemp[0] = '\0';
//if we got incoming CTCP Version for contact in CList - then write its as MirVer for that contact!
if (pmsg->m_bIncoming && command == L"version") {
- struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false };
+ struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
setTString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE));
@@ -1205,8 +1205,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
}
if (pmsg->m_bIncoming && command == L"ping") {
SetActiveWindow(m_whoisDlg->GetHwnd());
- int s = (int)time(0) - (int)_ttol(GetWordAddress(mess.c_str(), 1));
- TCHAR szTmp[30];
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
+ wchar_t szTmp[30];
if (s == 1)
mir_sntprintf(szTmp, TranslateT("%u second"), s);
else
@@ -1220,7 +1220,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
//... else show the reply in the current window
if (pmsg->m_bIncoming && command == L"ping") {
- int s = (int)time(0) - (int)_ttol(GetWordAddress(mess.c_str(), 1));
+ int s = (int)time(0) - (int)_wtol(GetWordAddress(mess.c_str(), 1));
mir_sntprintf(szTemp, TranslateT("CTCP PING reply from %s: %u sec(s)"), pmsg->prefix.sNick.c_str(), s);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
}
@@ -1254,7 +1254,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
i++;
if (!name.IsEmpty()) {
int index = 0;
- while (_tcschr(sUserModePrefixes.c_str(), name[index]))
+ while (wcschr(sUserModePrefixes.c_str(), name[index]))
index++;
if (!mir_tstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
@@ -1265,7 +1265,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
}
if (bFlag) {
- const TCHAR* sChanName = pmsg->parameters[1].c_str();
+ const wchar_t* sChanName = pmsg->parameters[1].c_str();
if (sChanName[0] == '@' || sChanName[0] == '*' || sChanName[0] == '=')
sChanName++;
@@ -1372,7 +1372,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
sTopicTime = L"";
} }
- gcd.ptszID = (TCHAR*)sID.c_str();
+ gcd.ptszID = (wchar_t*)sID.c_str();
gcd.iType = GC_EVENT_CONTROL;
gce.cbSize = sizeof(GCEVENT);
gce.dwFlags = 0;
@@ -1454,11 +1454,11 @@ bool CIrcProto::OnIrc_INITIALTOPIC(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_INITIALTOPICNAME(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 3) {
- TCHAR tTimeBuf[128], *tStopStr;
+ wchar_t tTimeBuf[128], *tStopStr;
time_t ttTopicTime;
sTopicName = pmsg->parameters[2];
- ttTopicTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
- _tcsftime(tTimeBuf, 128, L"%#c", localtime(&ttTopicTime));
+ ttTopicTime = wcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
+ wcsftime(tTimeBuf, 128, L"%#c", localtime(&ttTopicTime));
sTopicTime = tTimeBuf;
}
ShowMessage(pmsg);
@@ -1506,20 +1506,20 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg)
lvItem.iItem = ListView_GetItemCount(hListView);
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
- lvItem.pszText = (TCHAR*)pmsg->parameters[1].c_str();
+ lvItem.pszText = (wchar_t*)pmsg->parameters[1].c_str();
lvItem.lParam = lvItem.iItem;
lvItem.iItem = ListView_InsertItem(hListView, &lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
- lvItem.pszText = (TCHAR*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
+ lvItem.pszText = (wchar_t*)pmsg->parameters[pmsg->parameters.getCount() - 2].c_str();
ListView_SetItem(hListView, &lvItem);
- TCHAR* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
- TCHAR* find = _tcsstr(temp, L"[+");
- TCHAR* find2 = _tcsstr(temp, L"]");
- TCHAR* save = temp;
+ wchar_t* temp = mir_tstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
+ wchar_t* find = wcsstr(temp, L"[+");
+ wchar_t* find2 = wcsstr(temp, L"]");
+ wchar_t* save = temp;
if (find == temp && find2 != NULL && find + 8 >= find2) {
- temp = _tcsstr(temp, L"]");
+ temp = wcsstr(temp, L"]");
if (mir_tstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
@@ -1534,7 +1534,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg)
lvItem.iSubItem = 3;
CMString S = DoColorCodes(temp, TRUE, FALSE);
- lvItem.pszText = (TCHAR*)S.c_str();
+ lvItem.pszText = (wchar_t*)S.c_str();
ListView_SetItem(hListView, &lvItem);
temp = save;
mir_free(temp);
@@ -1543,7 +1543,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg)
if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
- TCHAR text[100];
+ wchar_t text[100];
if (percent < 100)
mir_sntprintf(text, TranslateT("Downloading list (%u%%) - %u channels"), percent, m_channelNumber);
else
@@ -1564,7 +1564,7 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg)
ListView_SetColumnWidth(GetDlgItem(m_listDlg->GetHwnd(), IDC_INFO_LISTVIEW), 3, LVSCW_AUTOSIZE);
m_listDlg->UpdateList();
- TCHAR text[100];
+ wchar_t text[100];
mir_sntprintf(text, TranslateT("Done: %u channels"), m_channelNumber);
int percent = 100;
if (m_noOfChannels > 0)
@@ -1593,8 +1593,8 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg)
S += pmsg->parameters[3];
if (pmsg->parameters.getCount() > 4) {
S += L" - ( ";
- time_t time = _ttoi(pmsg->parameters[4].c_str());
- S += _tctime(&time);
+ time_t time = _wtoi(pmsg->parameters[4].c_str());
+ S += _wctime(&time);
S.Replace(L"\n", L" ");
S += L")";
}
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_AWAY(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
- TCHAR temp[1024], temp2[1024];
+ wchar_t temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
mir_tstrcat(temp, L"%s\r\n");
mir_sntprintf(temp2, temp, pmsg->parameters[2].c_str());
@@ -1689,7 +1689,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1 && m_manualWhoisCount < 1) {
- CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, true };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)WhoisAwayReply.c_str());
@@ -1705,7 +1705,7 @@ bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
- int S = _ttoi(pmsg->parameters[2].c_str());
+ int S = _wtoi(pmsg->parameters[2].c_str());
int D = S / (60 * 60 * 24);
S -= (D * 60 * 60 * 24);
int H = S / (60 * 60);
@@ -1713,7 +1713,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
int M = S / 60;
S -= (M * 60);
- TCHAR temp[100];
+ wchar_t temp[100];
if (D)
mir_sntprintf(temp, TranslateT("%ud, %uh, %um, %us"), D, H, M, S);
else if (H)
@@ -1725,10 +1725,10 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
else
temp[0] = 0;
- TCHAR temp3[256];
- TCHAR tTimeBuf[128], *tStopStr;
- time_t ttTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
- _tcsftime(tTimeBuf, 128, L"%c", localtime(&ttTime));
+ wchar_t temp3[256];
+ wchar_t tTimeBuf[128], *tStopStr;
+ time_t ttTime = wcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
+ wcsftime(tTimeBuf, 128, L"%c", localtime(&ttTime));
mir_sntprintf(temp3, TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
@@ -1764,10 +1764,10 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg)
if (m_whoisDlg)
m_whoisDlg->ShowMessageNoUser(pmsg);
- CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
- AddOutgoingMessageToDB(hContact, (TCHAR*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str());
+ AddOutgoingMessageToDB(hContact, (wchar_t*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str());
DBVARIANT dbv;
if (!getTString(hContact, "Default", &dbv)) {
@@ -1814,7 +1814,7 @@ bool CIrcProto::OnIrc_NICK_ERR(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming) {
if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_tstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
- TCHAR m[200];
+ wchar_t m[200];
mir_sntprintf(m, L"NICK %s", m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
@@ -1882,7 +1882,7 @@ bool CIrcProto::OnIrc_ENDMOTD(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_NOOFCHANNELS(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1)
- m_noOfChannels = _ttoi(pmsg->parameters[1].c_str());
+ m_noOfChannels = _wtoi(pmsg->parameters[1].c_str());
if (pmsg->m_bIncoming && !bPerformDone)
DoOnConnect(pmsg);
@@ -1905,7 +1905,7 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg)
else
S = TranslateT("Unknown");
- msn.tszInfo = (TCHAR*)S.c_str();
+ msn.tszInfo = (wchar_t*)S.c_str();
msn.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE;
msn.uTimeout = 15000;
CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn);
@@ -1944,9 +1944,9 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg)
/// if it is not a channel
ptrT UserList(mir_tstrdup(m_whoReply.c_str()));
- const TCHAR* p1 = UserList;
+ const wchar_t* p1 = UserList;
m_whoReply = L"";
- CONTACT ccUser = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false };
+ CONTACT ccUser = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false };
MCONTACT hContact = CList_FindContact(&ccUser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) {
@@ -1991,7 +1991,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg)
if (DBWildcard && DBNick && !WCCmp(CharLower(DBWildcard), CharLower(DBNick))) {
setTString(hContact, "Nick", DBDefault);
- DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (TCHAR*)DBWildcard);
+ DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard);
setString(hContact, "User", "");
setString(hContact, "Host", "");
@@ -2017,7 +2017,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 6 && command[0] == 'S') {
m_whoReply.AppendFormat(L"%s %s %s %s ", pmsg->parameters[5].c_str(), pmsg->parameters[2].c_str(), pmsg->parameters[3].c_str(), pmsg->parameters[6].c_str());
if (mir_tstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
- TCHAR host[1024];
+ wchar_t host[1024];
mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
@@ -2076,16 +2076,16 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg)
if (sTemp.IsEmpty())
break;
- TCHAR *p1 = mir_tstrdup(sTemp.c_str());
+ wchar_t *p1 = mir_tstrdup(sTemp.c_str());
// Pull out host, user and nick
- TCHAR *p2 = _tcschr(p1, '@');
+ wchar_t *p2 = wcschr(p1, '@');
if (p2) {
*p2 = '\0';
p2++;
host = p2;
}
- p2 = _tcschr(p1, '=');
+ p2 = wcschr(p1, '=');
if (p2) {
if (*(p2 - 1) == '*')
*(p2 - 1) = '\0'; // remove special char for IRCOps
@@ -2106,9 +2106,9 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg)
// Do command
switch (command[0]) {
case 'S': // Status check
- finduser.name = (TCHAR*)nick.c_str();
- finduser.host = (TCHAR*)host.c_str();
- finduser.user = (TCHAR*)user.c_str();
+ finduser.name = (wchar_t*)nick.c_str();
+ finduser.host = (wchar_t*)host.c_str();
+ finduser.user = (wchar_t*)user.c_str();
{
MCONTACT hContact = CList_FindContact(&finduser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 0) {
@@ -2167,7 +2167,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg)
// Status-check post-processing: make buddies in ckeck-list offline
if (command[0] == 'S') {
for (int i = 0; i < checklist.getCount(); i++) {
- finduser.name = (TCHAR*)checklist[i].c_str();
+ finduser.name = (wchar_t*)checklist[i].c_str();
finduser.ExactNick = true;
CList_SetOffline(&finduser);
}
@@ -2184,10 +2184,10 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg)
bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
{
- static const TCHAR *lpszFmt = L"Try server %99[^ ,], port %19s";
- TCHAR szAltServer[100];
- TCHAR szAltPort[20];
- if (pmsg->parameters.getCount() > 1 && _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
+ static const wchar_t *lpszFmt = L"Try server %99[^ ,], port %19s";
+ wchar_t szAltServer[100];
+ wchar_t szAltPort[20];
+ if (pmsg->parameters.getCount() > 1 && swscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
ShowMessage(pmsg);
mir_strncpy(m_serverName, _T2A(szAltServer), 99);
mir_strncpy(m_portStart, _T2A(szAltPort), 9);
@@ -2203,22 +2203,22 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 0) {
CMString S;
for (int i = 0; i < pmsg->parameters.getCount(); i++) {
- TCHAR* temp = mir_tstrdup(pmsg->parameters[i].c_str());
- if (_tcsstr(temp, L"CHANTYPES=")) {
- TCHAR* p1 = _tcschr(temp, '=');
+ wchar_t* temp = mir_tstrdup(pmsg->parameters[i].c_str());
+ if (wcsstr(temp, L"CHANTYPES=")) {
+ wchar_t* p1 = wcschr(temp, '=');
p1++;
if (mir_tstrlen(p1) > 0)
sChannelPrefixes = p1;
}
- if (_tcsstr(temp, L"CHANMODES=")) {
- TCHAR* p1 = _tcschr(temp, '=');
+ if (wcsstr(temp, L"CHANMODES=")) {
+ wchar_t* p1 = wcschr(temp, '=');
p1++;
if (mir_tstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
- if (_tcsstr(temp, L"PREFIX=")) {
- TCHAR* p1 = _tcschr(temp, '(');
- TCHAR* p2 = _tcschr(temp, ')');
+ if (wcsstr(temp, L"PREFIX=")) {
+ wchar_t* p1 = wcschr(temp, '(');
+ wchar_t* p2 = wcschr(temp, ')');
if (p1 && p2) {
p1++;
if (p1 != p2)
@@ -2229,7 +2229,7 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
sUserModePrefixes = p2;
}
else {
- p1 = _tcschr(temp, '=');
+ p1 = wcschr(temp, '=');
p1++;
sUserModePrefixes = p1;
for (int n = 0; n < sUserModePrefixes.GetLength() + 1; n++) {
@@ -2417,13 +2417,13 @@ int CIrcProto::IsIgnored(CMString user, char type)
if (type == 0 && !mir_tstrcmpi(user.c_str(), C.mask.c_str()))
return i + 1;
- bool bUserContainsWild = (_tcschr(user.c_str(), '*') != NULL || _tcschr(user.c_str(), '?') != NULL);
+ bool bUserContainsWild = (wcschr(user.c_str(), '*') != NULL || wcschr(user.c_str(), '?') != NULL);
if (!bUserContainsWild && WCCmp(C.mask.c_str(), user.c_str()) ||
bUserContainsWild && !mir_tstrcmpi(user.c_str(), C.mask.c_str())) {
if (C.flags.IsEmpty() || C.flags[0] != '+')
continue;
- if (!_tcschr(C.flags.c_str(), type))
+ if (!wcschr(C.flags.c_str(), type))
continue;
if (C.network.IsEmpty())
@@ -2437,7 +2437,7 @@ int CIrcProto::IsIgnored(CMString user, char type)
return 0;
}
-bool CIrcProto::AddIgnore(const TCHAR* mask, const TCHAR* flags, const TCHAR* network)
+bool CIrcProto::AddIgnore(const wchar_t* mask, const wchar_t* flags, const wchar_t* network)
{
RemoveIgnore(mask);
m_ignoreItems.insert(new CIrcIgnoreItem(mask, (L"+" + CMString(flags)).c_str(), network));
@@ -2448,7 +2448,7 @@ bool CIrcProto::AddIgnore(const TCHAR* mask, const TCHAR* flags, const TCHAR* ne
return true;
}
-bool CIrcProto::RemoveIgnore(const TCHAR* mask)
+bool CIrcProto::RemoveIgnore(const wchar_t* mask)
{
int idx;
while ((idx = IsIgnored(mask, '\0')) != 0)
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index d8204e63dc..aef90b870e 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::FormatMsg(CMString& text)
{
- TCHAR temp[30];
+ wchar_t temp[30];
mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
@@ -42,7 +42,7 @@ void CIrcProto::FormatMsg(CMString& text)
S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" " + GetWord(text.c_str(), 2) + L" :" + GetWordAddress(text.c_str(), 3);
}
else if (command == L"/nick") {
- if (!_tcsstr(GetWord(text.c_str(), 1).c_str(), NICKSUBSTITUTE)) {
+ if (!wcsstr(GetWord(text.c_str(), 1).c_str(), NICKSUBSTITUTE)) {
sNick4Perform = GetWord(text.c_str(), 1);
S = GetWordAddress(text.c_str(), 0);
}
@@ -72,15 +72,15 @@ static void AddCR(CMString& text)
text.Replace(L"\r\r", L"\r");
}
-CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
+CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window)
{
CMString Messageout = L"";
- const TCHAR* p1 = text;
- const TCHAR* p2 = text;
+ const wchar_t* p1 = text;
+ const wchar_t* p2 = text;
bool LinebreakFlag = false, hasAlias = false;
- p2 = _tcsstr(p1, L"\r\n");
+ p2 = wcsstr(p1, L"\r\n");
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
if (p1 == p2)
return (CMString)text;
@@ -88,38 +88,38 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
if (LinebreakFlag)
Messageout += L"\r\n";
- TCHAR* line = new TCHAR[p2 - p1 + 1];
+ wchar_t* line = new wchar_t[p2 - p1 + 1];
mir_tstrncpy(line, p1, p2 - p1 + 1);
- TCHAR* test = line;
+ wchar_t* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
- line = new TCHAR[S.GetLength() + 2];
+ line = new wchar_t[S.GetLength() + 2];
mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
- const TCHAR* p3 = _tcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
+ const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
if (p3 != alias.c_str()) {
CMString str = L"\r\n";
str += GetWord(line, 0) + L" ";
- p3 = _tcsstr(alias.c_str(), str.c_str());
+ p3 = wcsstr(alias.c_str(), str.c_str());
if (p3)
p3 += 2;
}
if (p3 != NULL) {
hasAlias = true;
- const TCHAR* p4 = _tcsstr(p3, L"\r\n");
+ const wchar_t* p4 = wcsstr(p3, L"\r\n");
if (!p4)
- p4 = _tcschr(p3, '\0');
+ p4 = wcschr(p3, '\0');
- *(TCHAR*)p4 = 0;
+ *(wchar_t*)p4 = 0;
CMString str = p3;
str.Replace(L"##", window);
str.Replace(L"$?", L"%question");
- TCHAR buf[5];
+ wchar_t buf[5];
for (int index = 1; index < 8; index++) {
mir_sntprintf(buf, L"#$%u", index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
@@ -147,9 +147,9 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
p1 = p2;
if (*p1 == '\r')
p1 += 2;
- p2 = _tcsstr(p1, L"\r\n");
+ p2 = wcsstr(p1, L"\r\n");
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
delete[] line;
LinebreakFlag = true;
}
@@ -158,10 +158,10 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
return hasAlias ? DoIdentifiers(Messageout, window) : Messageout;
}
-CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
+CMString CIrcProto::DoIdentifiers(CMString text, const wchar_t*)
{
SYSTEMTIME time;
- TCHAR str[2];
+ wchar_t str[2];
GetLocalTime(&time);
text.Replace(L"%mnick", m_nick);
@@ -176,8 +176,7 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
char mirver[100];
CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(mirver), LPARAM(mirver));
text.Replace(L"%mirver", _A2T(mirver));
-
- text.Replace(L"%version", _T(__VERSION_STRING_DOTS));
+ text.Replace(L"%version", _A2T(__VERSION_STRING_DOTS));
str[0] = 3; str[1] = '\0';
text.Replace(L"%color", str);
@@ -210,7 +209,7 @@ static void __stdcall sttSetTimerOff(void* _pro)
ppro->KillChatTimer(ppro->OnlineNotifTimer3);
}
-BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hContact)
+BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact)
{
CMString command(GetWord(text, 0)); command.MakeLower();
CMString one = GetWord(text, 1);
@@ -230,7 +229,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
else if (command == L"/sleep" || command == L"/wait") {
if (!one.IsEmpty()) {
int ms;
- if (_stscanf(one.c_str(), L"%d", &ms) == 1 && ms > 0 && ms <= 4000)
+ if (swscanf(one.c_str(), L"%d", &ms) == 1 && ms > 0 && ms <= 4000)
Sleep(ms);
else
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Incorrect parameters. Usage: /sleep [ms], ms should be greater than 0 and less than 4000."), NULL, NULL, NULL, true, false);
@@ -260,7 +259,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (command == L"/ignore") {
if (IsConnected()) {
CMString IgnoreFlags;
- TCHAR temp[500];
+ wchar_t temp[500];
if (one.IsEmpty()) {
if (m_ignore)
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is enabled"), NULL, NULL, NULL, true, false);
@@ -278,21 +277,21 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("Ignore system is disabled"), NULL, NULL, NULL, true, false);
return true;
}
- if (!_tcschr(one.c_str(), '!') && !_tcschr(one.c_str(), '@'))
+ if (!wcschr(one.c_str(), '!') && !wcschr(one.c_str(), '@'))
one += L"!*@*";
if (!two.IsEmpty() && two[0] == '+') {
- if (_tcschr(two.c_str(), 'q'))
+ if (wcschr(two.c_str(), 'q'))
IgnoreFlags += 'q';
- if (_tcschr(two.c_str(), 'n'))
+ if (wcschr(two.c_str(), 'n'))
IgnoreFlags += 'n';
- if (_tcschr(two.c_str(), 'i'))
+ if (wcschr(two.c_str(), 'i'))
IgnoreFlags += 'i';
- if (_tcschr(two.c_str(), 'd'))
+ if (wcschr(two.c_str(), 'd'))
IgnoreFlags += 'd';
- if (_tcschr(two.c_str(), 'c'))
+ if (wcschr(two.c_str(), 'c'))
IgnoreFlags += 'c';
- if (_tcschr(two.c_str(), 'm'))
+ if (wcschr(two.c_str(), 'm'))
IgnoreFlags += 'm';
}
else IgnoreFlags = L"qnidc";
@@ -312,10 +311,10 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
}
if (command == L"/unignore") {
- if (!_tcschr(one.c_str(), '!') && !_tcschr(one.c_str(), '@'))
+ if (!wcschr(one.c_str(), '!') && !wcschr(one.c_str(), '@'))
one += L"!*@*";
- TCHAR temp[500];
+ wchar_t temp[500];
if (RemoveIgnore(one.c_str()))
mir_sntprintf(temp, TranslateT("%s is not ignored now"), one.c_str());
else
@@ -363,7 +362,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
}
if (command == L"/nusers") {
- TCHAR szTemp[40];
+ wchar_t szTemp[40];
CMString S = MakeWndID(window);
GC_INFO gci = { 0 };
gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT;
@@ -412,14 +411,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
CallFunctionAsync(sttSetTimerOff, this);
}
if (!mir_tstrcmpi(one.c_str(), L"time") && !two.IsEmpty()) {
- m_iTempCheckTime = _ttoi(two.c_str());
+ m_iTempCheckTime = _wtoi(two.c_str());
if (m_iTempCheckTime < 10 && m_iTempCheckTime != 0)
m_iTempCheckTime = 10;
if (m_iTempCheckTime == 0)
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), TranslateT("The time interval for the buddy check function is now at default setting"), NULL, NULL, NULL, true, false);
else {
- TCHAR temp[200];
+ wchar_t temp[200];
mir_sntprintf(temp, TranslateT("The time interval for the buddy check function is now %u seconds"), m_iTempCheckTime);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), temp, NULL, NULL, NULL, true, false);
}
@@ -507,7 +506,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (one.IsEmpty())
return true;
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"\001ACTION %s\001", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
return true;
@@ -537,7 +536,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (one.IsEmpty() || two.IsEmpty())
return true;
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
@@ -548,7 +547,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (one.IsEmpty() || IsChannel(one.c_str()))
return true;
- CONTACT user = { (TCHAR*)one.c_str(), NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)one.c_str(), NULL, NULL, false, false, false };
MCONTACT hContact2 = CList_AddContact(&user, false, false);
if (hContact2) {
if (getByte(hContact, "AdvancedMode", 0) == 0)
@@ -572,7 +571,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
}
if (!two.IsEmpty()) {
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/PRIVMSG %s", GetWordAddress(text.c_str(), 1));
PostIrcMessageWnd(window, hContact, szTemp);
}
@@ -583,7 +582,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (one.IsEmpty() || two.IsEmpty())
return true;
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
ulAdr = ConvertIPToInteger(m_mySpecifiedHostIP);
@@ -612,7 +611,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
return true;
if (mir_tstrcmpi(one.c_str(), L"send") == 0) {
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
@@ -621,7 +620,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (ulAdr) {
- CONTACT user = { (TCHAR*)two.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)two.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
if (ccNew) {
CMString s;
@@ -646,8 +645,8 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
CallService(MS_FILE_SENDFILE, ccNew, 0);
else {
CMString temp = GetWordAddress(text.c_str(), 3);
- TCHAR* pp[2];
- TCHAR* p = (TCHAR*)temp.c_str();
+ wchar_t* pp[2];
+ wchar_t* p = (wchar_t*)temp.c_str();
pp[0] = p;
pp[1] = NULL;
CallService(MS_FILE_SENDSPECIFICFILEST, ccNew, (LPARAM)pp);
@@ -662,7 +661,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
}
if (mir_tstrcmpi(one.c_str(), L"chat") == 0) {
- TCHAR szTemp[1000];
+ wchar_t szTemp[1000];
unsigned long ulAdr = 0;
if (m_manualHost)
@@ -672,7 +671,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
if (ulAdr) {
CMString contact = two; contact += DCCSTRING;
- CONTACT user = { (TCHAR*)contact.c_str(), NULL, NULL, false, false, true };
+ CONTACT user = { (wchar_t*)contact.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
setByte(ccNew, "DCC", 1);
@@ -716,43 +715,43 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hConta
struct DoInputRequestParam
{
- DoInputRequestParam(CIrcProto* _pro, const TCHAR* _str) :
+ DoInputRequestParam(CIrcProto* _pro, const wchar_t* _str) :
ppro(_pro),
str(mir_tstrdup(_str))
{}
CIrcProto *ppro;
- TCHAR* str;
+ wchar_t* str;
};
static void __stdcall DoInputRequestAliasApcStub(void* _par)
{
DoInputRequestParam* param = (DoInputRequestParam*)_par;
CIrcProto *ppro = param->ppro;
- TCHAR* str = param->str;
+ wchar_t* str = param->str;
- TCHAR* infotext = NULL;
- TCHAR* title = NULL;
- TCHAR* defaulttext = NULL;
- CMString command = (TCHAR*)str;
- TCHAR* p = _tcsstr((TCHAR*)str, L"%question");
+ wchar_t* infotext = NULL;
+ wchar_t* title = NULL;
+ wchar_t* defaulttext = NULL;
+ CMString command = (wchar_t*)str;
+ wchar_t* p = wcsstr((wchar_t*)str, L"%question");
if (p[9] == '=' && p[10] == '\"') {
infotext = &p[11];
- p = _tcschr(infotext, '\"');
+ p = wcschr(infotext, '\"');
if (p) {
*p = '\0';
p++;
if (*p == ',' && p[1] == '\"') {
p++; p++;
title = p;
- p = _tcschr(title, '\"');
+ p = wcschr(title, '\"');
if (p) {
*p = '\0';
p++;
if (*p == ',' && p[1] == '\"') {
p++; p++;
defaulttext = p;
- p = _tcschr(defaulttext, '\"');
+ p = wcschr(defaulttext, '\"');
if (p)
*p = '\0';
}
@@ -785,24 +784,24 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par)
delete param;
}
-bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
+bool CIrcProto::PostIrcMessage(const wchar_t* fmt, ...)
{
if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
return 0;
va_list marker;
va_start(marker, fmt);
- static TCHAR szBuf[4 * 1024];
+ static wchar_t szBuf[4 * 1024];
mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
}
-bool CIrcProto::PostIrcMessageWnd(TCHAR *window, MCONTACT hContact, const TCHAR *szBuf)
+bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wchar_t *szBuf)
{
DBVARIANT dbv;
- TCHAR windowname[256];
+ wchar_t windowname[256];
BYTE bDCC = 0;
if (hContact)
@@ -821,7 +820,7 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR *window, MCONTACT hContact, const TCHAR
mir_tstrncpy(windowname, SERVERWINDOW, 255);
if (mir_tstrcmpi(window, SERVERWINDOW) != 0) {
- TCHAR* p1 = _tcschr(windowname, ' ');
+ wchar_t* p1 = wcschr(windowname, ' ');
if (p1)
*p1 = '\0';
}
diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h
index 327130838f..a9610a97f3 100644
--- a/protocols/IRCG/src/irc_dlg.h
+++ b/protocols/IRCG/src/irc_dlg.h
@@ -165,7 +165,7 @@ struct CManagerDlg : public CCoolIrcDlg
void ApplyQuestion();
void CloseQuestion();
- void InitManager(int mode, const TCHAR* window);
+ void InitManager(int mode, const wchar_t* window);
};
struct CQuestionDlg : public CCoolIrcDlg
@@ -302,9 +302,9 @@ struct CAddIgnoreDlg : public CProtoDlgBase < CIrcProto >
CCtrlButton m_Ok;
CIgnorePrefsDlg* m_owner;
- TCHAR szOldMask[500];
+ wchar_t szOldMask[500];
- CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* parent);
+ CAddIgnoreDlg(CIrcProto* _pro, const wchar_t* mask, CIgnorePrefsDlg* parent);
virtual void OnInitDialog();
virtual void OnClose();
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index bac5fd2d2b..3828a45f5f 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -36,7 +36,7 @@ OBJLIST<CIrcHandler> CIrcProto::m_handlers( 30, CompareHandlers );
////////////////////////////////////////////////////////////////////
-CIrcMessage::CIrcMessage( CIrcProto* _pro, const TCHAR* lpszCmdLine, int codepage, bool bIncoming, bool bNotify ) :
+CIrcMessage::CIrcMessage( CIrcProto* _pro, const wchar_t* lpszCmdLine, int codepage, bool bIncoming, bool bNotify ) :
m_proto( _pro ),
m_bIncoming( bIncoming ),
m_bNotify( bNotify ),
@@ -89,29 +89,29 @@ CIrcMessage& CIrcMessage::operator = (const CIrcMessage& m)
return *this;
}
-CIrcMessage& CIrcMessage::operator = (const TCHAR* lpszCmdLine)
+CIrcMessage& CIrcMessage::operator = (const wchar_t* lpszCmdLine)
{
Reset();
ParseIrcCommand(lpszCmdLine);
return *this;
}
-void CIrcMessage::ParseIrcCommand(const TCHAR* lpszCmdLine)
+void CIrcMessage::ParseIrcCommand(const wchar_t* lpszCmdLine)
{
- const TCHAR* p1 = lpszCmdLine;
- const TCHAR* p2 = lpszCmdLine;
+ const wchar_t* p1 = lpszCmdLine;
+ const wchar_t* p2 = lpszCmdLine;
// prefix exists ?
if (*p1 == ':') {
// break prefix into its components (nick!user@host)
p2 = ++p1;
- while (*p2 && !_tcschr(L" !", *p2))
+ while (*p2 && !wcschr(L" !", *p2))
++p2;
prefix.sNick.SetString(p1, p2 - p1);
if (*p2 != '!')
goto end_of_prefix;
p1 = ++p2;
- while (*p2 && !_tcschr(L" @", *p2))
+ while (*p2 && !wcschr(L" @", *p2))
++p2;
prefix.sUser.SetString(p1, p2 - p1);
if (*p2 != '@')
@@ -168,7 +168,7 @@ int CIrcProto::getCodepage() const
return (con != NULL) ? codepage : CP_ACP;
}
-void CIrcProto::SendIrcMessage(const TCHAR* msg, bool bNotify, int cp)
+void CIrcProto::SendIrcMessage(const wchar_t* msg, bool bNotify, int cp)
{
if (cp == -1)
cp = getCodepage();
@@ -200,7 +200,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
ncon.wPort = info.iPort;
con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
if (con == NULL) {
- TCHAR szTemp[300];
+ wchar_t szTemp[300];
mir_sntprintf(szTemp, L"\0035%s \002%s\002 (%S: %u).",
TranslateT("Failed to connect to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
@@ -233,7 +233,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
NLSend(L"NICK %s\r\n", info.sNick.c_str());
CMString userID = GetWord(info.sUserID.c_str(), 0);
- TCHAR szHostName[MAX_PATH];
+ wchar_t szHostName[MAX_PATH];
DWORD cbHostName = _countof(szHostName);
GetComputerName(szHostName, &cbHostName);
CMString HostName = GetWord(szHostName, 0);
@@ -283,12 +283,12 @@ int CIrcProto::NLSend(const unsigned char* buf, int cbBuf)
return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT);
}
-int CIrcProto::NLSend(const TCHAR* fmt, ...)
+int CIrcProto::NLSend(const wchar_t* fmt, ...)
{
va_list marker;
va_start(marker, fmt);
- TCHAR szBuf[1024 * 4];
+ wchar_t szBuf[1024 * 4];
mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
@@ -332,7 +332,7 @@ void CIrcProto::KillIdent()
}
}
-void CIrcProto::InsertIncomingEvent(TCHAR* pszRaw)
+void CIrcProto::InsertIncomingEvent(wchar_t* pszRaw)
{
CIrcMessage msg(this, pszRaw, true);
Notify(&msg);
@@ -341,7 +341,7 @@ void CIrcProto::InsertIncomingEvent(TCHAR* pszRaw)
void CIrcProto::createMessageFromPchar(const char* p)
{
- TCHAR* ptszMsg;
+ wchar_t* ptszMsg;
if (codepage != CP_UTF8 && m_utfAutodetect) {
if (mir_utf8decodecp(NEWSTR_ALLOCA(p), codepage, &ptszMsg) == NULL)
ptszMsg = mir_a2t_cp(p, codepage);
@@ -518,7 +518,7 @@ CDccSession* CIrcProto::FindDCCSendByPort(int iPort)
return 0;
}
-CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const TCHAR* szName)
+CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szName)
{
mir_cslock lck(m_dcc);
@@ -589,7 +589,7 @@ void CIrcProto::CheckDCCTimeout(void)
////////////////////////////////////////////////////////////////////
-CIrcIgnoreItem::CIrcIgnoreItem(const TCHAR* _mask, const TCHAR* _flags, const TCHAR* _network) :
+CIrcIgnoreItem::CIrcIgnoreItem(const wchar_t* _mask, const wchar_t* _flags, const wchar_t* _network) :
mask(_mask),
flags(_flags),
network(_network)
@@ -597,9 +597,9 @@ CIrcIgnoreItem::CIrcIgnoreItem(const TCHAR* _mask, const TCHAR* _flags, const TC
}
CIrcIgnoreItem::CIrcIgnoreItem(int codepage, const char* _mask, const char* _flags, const char* _network) :
- mask((TCHAR*)_A2T(_mask, codepage)),
- flags((TCHAR*)_A2T(_flags, codepage)),
- network((TCHAR*)_A2T(_network, codepage))
+ mask((wchar_t*)_A2T(_mask, codepage)),
+ flags((wchar_t*)_A2T(_flags, codepage)),
+ network((wchar_t*)_A2T(_network, codepage))
{
}
@@ -673,7 +673,7 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg)
else OnIrcDisconnected();
}
-PfnIrcMessageHandler CIrcProto::FindMethod(const TCHAR* lpszName)
+PfnIrcMessageHandler CIrcProto::FindMethod(const wchar_t* lpszName)
{
CIrcHandler temp(lpszName, NULL);
CIrcHandler* p = m_handlers.find(&temp);
@@ -814,7 +814,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf)
return n;
}
-int CDccSession::SendStuff(const TCHAR* fmt)
+int CDccSession::SendStuff(const wchar_t* fmt)
{
CMStringA buf = _T2A(fmt, m_proto->getCodepage());
return NLSend((const unsigned char*)buf.c_str(), buf.GetLength());
@@ -861,11 +861,11 @@ int CDccSession::SetupConnection()
// Set up stuff needed for the filetransfer dialog (if it is a filetransfer)
if (di->iType == DCC_SEND) {
- file[0] = (TCHAR*)di->sFileAndPath.c_str();
+ file[0] = (wchar_t*)di->sFileAndPath.c_str();
file[1] = 0;
- pfts.tszCurrentFile = (TCHAR*)di->sFileAndPath.c_str();
- pfts.tszWorkingDir = (TCHAR*)di->sPath.c_str();
+ pfts.tszCurrentFile = (wchar_t*)di->sFileAndPath.c_str();
+ pfts.tszWorkingDir = (wchar_t*)di->sPath.c_str();
pfts.hContact = di->hContact;
pfts.flags = PFTS_TCHAR + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING);
pfts.totalFiles = 1;
@@ -967,7 +967,7 @@ int CDccSession::SetupConnection()
hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_proto->hNetlibDCC, (LPARAM)&nb);
if (hBindPort == NULL) {
- m_proto->DoEvent(GC_EVENT_INFORMATION, 0, m_proto->m_info.sNick.c_str(), LPGENT("DCC ERROR: Unable to bind local port for passive file transfer"), NULL, NULL, NULL, true, false);
+ m_proto->DoEvent(GC_EVENT_INFORMATION, 0, m_proto->m_info.sNick.c_str(), LPGENW("DCC ERROR: Unable to bind local port for passive file transfer"), NULL, NULL, NULL, true, false);
delete this; // dcc objects destroy themselves when the connection has been closed or failed for some reasson.
return 0;
}
@@ -1083,7 +1083,7 @@ void CDccSession::DoSendFile()
// is there a connection?
if (con) {
// open the file for reading
- int hFile = _topen(di->sFileAndPath.c_str(), _O_RDONLY | _O_BINARY, _S_IREAD);
+ int hFile = _wopen(di->sFileAndPath.c_str(), _O_RDONLY | _O_BINARY, _S_IREAD);
if (hFile >= 0) {
unsigned __int64 dwLastAck = 0;
@@ -1226,7 +1226,7 @@ void CDccSession::DoReceiveFile()
ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (void *)di, 0);
// open the file for writing (and reading in case it is a resume)
- int hFile = _topen(di->sFileAndPath.c_str(),
+ int hFile = _wopen(di->sFileAndPath.c_str(),
(dwWhatNeedsDoing == FILERESUME_RESUME ? _O_APPEND : _O_TRUNC | _O_CREAT) | _O_RDWR | _O_BINARY,
_S_IREAD | _S_IWRITE);
if (hFile >= 0) {
diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h
index 043a83ca76..069c545a12 100644
--- a/protocols/IRCG/src/irclib.h
+++ b/protocols/IRCG/src/irclib.h
@@ -69,17 +69,17 @@ public :
int m_codePage;
//CIrcMessage( CIrcProto* ); // default constructor
- CIrcMessage( CIrcProto*, const TCHAR* lpszCmdLine, int codepage, bool bIncoming=false, bool bNotify = true); // parser constructor
+ CIrcMessage( CIrcProto*, const wchar_t* lpszCmdLine, int codepage, bool bIncoming=false, bool bNotify = true); // parser constructor
CIrcMessage( const CIrcMessage& m ); // copy constructor
~CIrcMessage();
void Reset();
CIrcMessage& operator = (const CIrcMessage& m);
- CIrcMessage& operator = (const TCHAR* lpszCmdLine);
+ CIrcMessage& operator = (const wchar_t* lpszCmdLine);
private :
- void ParseIrcCommand(const TCHAR* lpszCmdLine);
+ void ParseIrcCommand(const wchar_t* lpszCmdLine);
};
////////////////////////////////////////////////////////////////////
@@ -110,7 +110,7 @@ struct CIrcSessionInfo
struct CIrcIgnoreItem
{
- CIrcIgnoreItem( const TCHAR*, const TCHAR*, const TCHAR* );
+ CIrcIgnoreItem( const wchar_t*, const wchar_t*, const wchar_t* );
CIrcIgnoreItem( int codepage, const char*, const char*, const char* );
~CIrcIgnoreItem();
@@ -132,7 +132,7 @@ protected:
int iGlobalToken;
PROTOFILETRANSFERSTATUS pfts; // structure used to setup and update the filetransfer dialogs of miranda
- TCHAR* file[2];
+ wchar_t* file[2];
int SetupConnection();
void DoSendFile();
@@ -154,7 +154,7 @@ public:
HANDLE hEvent; // Manual object
long dwWhatNeedsDoing; // Set to indicate what FILERESUME_ action is chosen by the user
- TCHAR* NewFileName; // contains new file name if FILERESUME_RENAME chosen
+ wchar_t* NewFileName; // contains new file name if FILERESUME_RENAME chosen
unsigned __int64 dwResumePos; // position to resume from if FILERESUME_RESUME
int iToken; // used to identify (find) objects in reverse dcc filetransfers
@@ -163,7 +163,7 @@ public:
int Connect();
void SetupPassive( DWORD adr, DWORD port );
- int SendStuff(const TCHAR* fmt);
+ int SendStuff(const wchar_t* fmt);
int IncomingConnection(HANDLE hConnection, DWORD dwIP);
int Disconnect();
};
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index eaa7f8541b..dc17feab0a 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -31,7 +31,7 @@ static int CompareSessions(const CDccSession* p1, const CDccSession* p2)
return INT_PTR(p1->di->hContact) - INT_PTR(p2->di->hContact);
}
-CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) :
+CIrcProto::CIrcProto(const char* szModuleName, const wchar_t* tszUserName) :
PROTO<CIrcProto>(szModuleName, tszUserName),
m_dcc_chats(10, CompareSessions),
m_dcc_xfers(10, CompareSessions),
@@ -174,7 +174,7 @@ static int sttCheckPerform(const char *szSetting, LPARAM lParam)
int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
{
NETLIBUSER nlu = { 0 };
- TCHAR name[128];
+ wchar_t name[128];
db_unset(NULL, m_szModuleName, "JTemp");
@@ -208,7 +208,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
gcw.iType = GCW_SERVER;
gcw.ptszID = SERVERWINDOW;
gcw.pszModule = m_szModuleName;
- gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network));
+ gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
@@ -218,9 +218,9 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
else
CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
- TCHAR szTemp[MAX_PATH];
+ wchar_t szTemp[MAX_PATH];
mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
- TCHAR *szLoadFileName = Utils_ReplaceVarsT(szTemp);
+ wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszPerformData = IrcLoadFile(szLoadFileName);
if (pszPerformData != NULL) {
char *p1 = pszPerformData, *p2 = pszPerformData;
@@ -240,7 +240,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
setString(("PERFORM:" + sNetwork).c_str(), rtrim(p1));
}
delete[] pszPerformData;
- ::_tremove(szLoadFileName);
+ ::_wremove(szLoadFileName);
}
mir_free(szLoadFileName);
@@ -272,7 +272,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
HookProtoEvent(ME_OPT_INITIALISE, &CIrcProto::OnInitOptionsPages);
if (m_nick[0]) {
- TCHAR szBuf[40];
+ wchar_t szBuf[40];
if (mir_tstrlen(m_alternativeNick) == 0) {
mir_sntprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
@@ -297,7 +297,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr)
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
- TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t;
+ wchar_t *id = psr->id.w ? psr->id.w : psr->nick.w;
id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)id) : mir_a2t((char*)id);
CONTACT user = { id, NULL, NULL, true, false, false };
@@ -341,7 +341,7 @@ int __cdecl CIrcProto::Authorize(MEVENT)
////////////////////////////////////////////////////////////////////////////////////////
// AuthDeny - handles the unsuccessful authorization
-int __cdecl CIrcProto::AuthDeny(MEVENT, const TCHAR*)
+int __cdecl CIrcProto::AuthDeny(MEVENT, const wchar_t*)
{
return 0;
}
@@ -349,7 +349,7 @@ int __cdecl CIrcProto::AuthDeny(MEVENT, const TCHAR*)
////////////////////////////////////////////////////////////////////////////////////////
// FileAllow - starts a file transfer
-HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
+HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -386,7 +386,7 @@ int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer)
////////////////////////////////////////////////////////////////////////////////////////
// FileDeny - denies a file transfer
-int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*)
+int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
{
DCCINFO* di = (DCCINFO*)hTransfer;
delete di;
@@ -396,7 +396,7 @@ int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR*)
////////////////////////////////////////////////////////////////////////////////////////
// FileResume - processes file renaming etc
-int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -406,7 +406,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, i);
if (*action == FILERESUME_RENAME) {
- TCHAR* szTemp = _tcsdup(*szFilename);
+ wchar_t* szTemp = wcsdup(*szFilename);
InterlockedExchangePointer((PVOID*)&dcc->NewFileName, szTemp);
}
@@ -414,7 +414,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s
unsigned __int64 dwPos = 0;
struct _stati64 statbuf;
- if (_tstati64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
+ if (_wstat64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
dwPos = statbuf.st_size;
CMString sFileWithQuotes = di->sFile;
@@ -475,7 +475,7 @@ DWORD_PTR __cdecl CIrcProto::GetCaps(int type, MCONTACT)
struct AckBasicSearchParam
{
- TCHAR buf[50];
+ wchar_t buf[50];
};
void __cdecl CIrcProto::AckBasicSearch(void *arg)
@@ -485,13 +485,13 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg)
AckBasicSearchParam *param = (AckBasicSearchParam*)arg;
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id.t = psr.nick.t = param->buf;
+ psr.id.w = psr.nick.w = param->buf;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
delete param;
}
-HANDLE __cdecl CIrcProto::SearchBasic(const TCHAR* szId)
+HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId)
{
if (szId) {
if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
@@ -509,7 +509,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const TCHAR* szId)
////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppszFiles)
+HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
{
DCCINFO* dci = NULL;
int iPort = 0;
@@ -537,7 +537,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
//get file size
while (ppszFiles[index]) {
struct _stati64 statbuf;
- if (_tstati64(ppszFiles[index], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
+ if (_wstat64(ppszFiles[index], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0) {
size = statbuf.st_size;
break;
}
@@ -588,7 +588,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
// is it an reverse filetransfer (receiver acts as server)
if (dci->bReverse) {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
PostIrcMessage(L"/CTCP %s DCC SEND %s 200 0 %I64u %u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), dci->dwSize, dcc->iToken);
@@ -607,7 +607,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
else { // ... normal filetransfer.
iPort = dcc->Connect();
if (iPort) {
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
PostIrcMessage(L"/CTCP %s DCC SEND %s %u %u %I64u",
dci->sContactName.c_str(), sFileWithQuotes.c_str(), ulAdr, iPort, dci->dwSize);
@@ -619,7 +619,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
if (m_sendNotice) {
mir_sntprintf(szTemp,
L"/NOTICE %s I am sending the file '\002%s\002' (%I64u kB) to you, please accept it. [IP: %s]",
- dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024, (TCHAR*)_A2T(ConvertIntegerToIP(ulAdr)));
+ dci->sContactName.c_str(), sFileCorrect.c_str(), dci->dwSize / 1024, (wchar_t*)_A2T(ConvertIntegerToIP(ulAdr)));
PostIrcMessage(szTemp);
}
}
@@ -630,7 +630,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
// fix for sending multiple files
index++;
while (ppszFiles[index]) {
- if (_taccess(ppszFiles[index], 0) == 0) {
+ if (_waccess(ppszFiles[index], 0) == 0) {
PostIrcMessage(L"/DCC SEND %s %S", dci->sContactName.c_str(), ppszFiles[index]);
}
index++;
@@ -692,7 +692,7 @@ int __cdecl CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
return 0;
}
- TCHAR *result;
+ wchar_t *result;
mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &result);
PostIrcMessageWnd(NULL, hContact, result);
mir_free(result);
@@ -806,7 +806,7 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact)
////////////////////////////////////////////////////////////////////////////////////////
// SetAwayMsg - sets the away status message
-int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg)
+int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg)
{
switch (status) {
case ID_STATUS_ONLINE: case ID_STATUS_INVISIBLE: case ID_STATUS_FREECHAT:
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index 549e9dc8ed..d82a0e9b6c 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -73,7 +73,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
-static CIrcProto* ircProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+static CIrcProto* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
{
CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 608cd844bb..3dee470d0d 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -63,10 +63,10 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count)
if (!getTString(p->name, &dbv)) {
if (p->size != -1) {
size_t len = min(p->size - 1, mir_tstrlen(dbv.ptszVal));
- memcpy(ptr, dbv.pszVal, len*sizeof(TCHAR));
- *(TCHAR*)&ptr[len*sizeof(TCHAR)] = 0;
+ memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t));
+ *(wchar_t*)&ptr[len*sizeof(wchar_t)] = 0;
}
- else *(TCHAR**)ptr = mir_tstrdup(dbv.ptszVal);
+ else *(wchar_t**)ptr = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
else {
@@ -74,9 +74,9 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count)
if (p->defStr == NULL)
*ptr = 0;
else
- mir_tstrncpy((TCHAR*)ptr, p->defStr, (int)p->size);
+ mir_tstrncpy((wchar_t*)ptr, p->defStr, (int)p->size);
}
- else *(TCHAR**)ptr = mir_tstrdup(p->defStr);
+ else *(wchar_t**)ptr = mir_tstrdup(p->defStr);
}
break;
} } }
@@ -102,9 +102,9 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count )
case DBVT_TCHAR:
if (p->size == -1)
- setTString(p->name, *(TCHAR**)ptr);
+ setTString(p->name, *(wchar_t**)ptr);
else
- setTString(p->name, (TCHAR*)ptr);
+ setTString(p->name, (wchar_t*)ptr);
break;
} } }
@@ -173,11 +173,11 @@ void RereadServers()
/////////////////////////////////////////////////////////////////////////////////////////
-static void removeSpaces(TCHAR* p)
+static void removeSpaces(wchar_t* p)
{
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(TCHAR)*mir_tstrlen(p));
+ memmove(p, p + 1, sizeof(wchar_t)*mir_tstrlen(p));
p++;
}
}
@@ -231,36 +231,36 @@ HANDLE GetIconHandle(int iconId)
/////////////////////////////////////////////////////////////////////////////////////////
// code page handler
-struct { UINT cpId; TCHAR *cpName; } static cpTable[] =
-{
- { 874, LPGENT("Thai") },
- { 932, LPGENT("Japanese") },
- { 936, LPGENT("Simplified Chinese") },
- { 949, LPGENT("Korean") },
- { 950, LPGENT("Traditional Chinese") },
- { 1250, LPGENT("Central European") },
- { 1251, LPGENT("Cyrillic (Windows)") },
- { 20866, LPGENT("Cyrillic (KOI8R)") },
- { 1252, LPGENT("Latin I") },
- { 1253, LPGENT("Greek") },
- { 1254, LPGENT("Turkish") },
- { 1255, LPGENT("Hebrew") },
- { 1256, LPGENT("Arabic") },
- { 1257, LPGENT("Baltic") },
- { 1258, LPGENT("Vietnamese") },
- { 1361, LPGENT("Korean (Johab)") }
+struct { UINT cpId; wchar_t *cpName; } static cpTable[] =
+{
+ { 874, LPGENW("Thai") },
+ { 932, LPGENW("Japanese") },
+ { 936, LPGENW("Simplified Chinese") },
+ { 949, LPGENW("Korean") },
+ { 950, LPGENW("Traditional Chinese") },
+ { 1250, LPGENW("Central European") },
+ { 1251, LPGENW("Cyrillic (Windows)") },
+ { 20866, LPGENW("Cyrillic (KOI8R)") },
+ { 1252, LPGENW("Latin I") },
+ { 1253, LPGENW("Greek") },
+ { 1254, LPGENW("Turkish") },
+ { 1255, LPGENW("Hebrew") },
+ { 1256, LPGENW("Arabic") },
+ { 1257, LPGENW("Baltic") },
+ { 1258, LPGENW("Vietnamese") },
+ { 1361, LPGENW("Korean (Johab)") }
};
static CCtrlCombo* sttCombo;
-static BOOL CALLBACK sttLangAddCallback(TCHAR *str)
+static BOOL CALLBACK sttLangAddCallback(wchar_t *str)
{
- UINT cp = _ttoi(str);
+ UINT cp = _wtoi(str);
CPINFOEX cpinfo;
if (GetCPInfoEx(cp, 0, &cpinfo)) {
- TCHAR* b = _tcschr(cpinfo.CodePageName, '(');
+ wchar_t* b = wcschr(cpinfo.CodePageName, '(');
if (b) {
- TCHAR* e = _tcsrchr(cpinfo.CodePageName, ')');
+ wchar_t* e = wcsrchr(cpinfo.CodePageName, ')');
if (e) {
*e = 0;
sttCombo->AddString(b + 1, cp);
@@ -601,8 +601,8 @@ void CConnectPrefsDlg::OnDeleteServer(CCtrlButton*)
m_del.Disable();
SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
- TCHAR temp[200];
- mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (TCHAR*)_A2T(pData->m_name));
+ wchar_t temp[200];
+ mir_sntprintf(temp, TranslateT("Do you want to delete\r\n%s"), (wchar_t*)_A2T(pData->m_name));
if (MessageBox(m_hwnd, temp, TranslateT("Delete server"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
g_servers.remove(pData);
@@ -693,7 +693,7 @@ void CConnectPrefsDlg::OnApply()
m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
+ wcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
@@ -827,7 +827,7 @@ void CCtcpPrefsDlg::OnInitDialog()
m_combo.AddStringA("4096");
m_combo.AddStringA("8192");
- TCHAR szTemp[10];
+ wchar_t szTemp[10];
mir_sntprintf(szTemp, L"%u", m_proto->m_DCCPacketSize);
int i = m_combo.SelectString(szTemp);
if (i == CB_ERR)
@@ -849,14 +849,14 @@ void CCtcpPrefsDlg::OnInitDialog()
else {
if (m_proto->m_IPFromServer) {
if (m_proto->m_myHost[0]) {
- CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + L">";
+ CMString s = (CMString)TranslateT("<Resolved IP: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
if (m_proto->m_myLocalHost[0]) {
- CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMString s = (CMString)TranslateT("<Local IP: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
@@ -874,14 +874,14 @@ void CCtcpPrefsDlg::OnClicked(CCtrlData*)
else {
if (m_fromServer.GetState()) {
if (m_proto->m_myHost[0]) {
- CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + L">";
+ CMString s = (CMString)TranslateT("<Resolved IP: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
if (m_proto->m_myLocalHost[0]) {
- CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMString s = (CMString)TranslateT("<Local IP: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
@@ -1089,7 +1089,7 @@ void COtherPrefsDlg::OnPerform(CCtrlData*)
void COtherPrefsDlg::OnAdd(CCtrlButton*)
{
- TCHAR* temp = m_pertormEdit.GetText();
+ wchar_t* temp = m_pertormEdit.GetText();
if (my_strstri(temp, L"/away"))
MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
@@ -1186,7 +1186,7 @@ void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
/////////////////////////////////////////////////////////////////////////////////////////
// 'add ignore' preferences dialog
-CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner)
+CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const wchar_t* mask, CIgnorePrefsDlg* _owner)
: CProtoDlgBase<CIrcProto>(_pro, IDD_ADDIGNORE, false),
m_Ok(this, IDOK),
m_owner(_owner)
@@ -1196,7 +1196,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg
if (mask == NULL)
szOldMask[0] = 0;
else
- _tcsncpy(szOldMask, mask, _countof(szOldMask));
+ wcsncpy(szOldMask, mask, _countof(szOldMask));
m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk);
}
@@ -1216,8 +1216,8 @@ void CAddIgnoreDlg::OnInitDialog()
void CAddIgnoreDlg::OnOk(CCtrlButton*)
{
- TCHAR szMask[500];
- TCHAR szNetwork[500];
+ wchar_t szMask[500];
+ wchar_t szNetwork[500];
CMString flags;
if (IsDlgButtonChecked(m_hwnd, IDC_Q) == BST_CHECKED) flags += 'q';
if (IsDlgButtonChecked(m_hwnd, IDC_N) == BST_CHECKED) flags += 'n';
@@ -1231,7 +1231,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*)
CMString Mask = GetWord(szMask, 0);
if (Mask.GetLength() != 0) {
- if (!_tcschr(Mask.c_str(), '!') && !_tcschr(Mask.c_str(), '@'))
+ if (!wcschr(Mask.c_str(), '!') && !wcschr(Mask.c_str(), '@'))
Mask += L"!*@*";
if (!flags.IsEmpty()) {
@@ -1265,8 +1265,8 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam
if (!hwndDlg->GetHwnd())
return 1;
- TCHAR temp1[512];
- TCHAR temp2[512];
+ wchar_t temp1[512];
+ wchar_t temp2[512];
LVITEM lvm;
lvm.mask = LVIF_TEXT;
@@ -1315,9 +1315,9 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
void CIrcProto::InitIgnore(void)
{
- TCHAR szTemp[MAX_PATH];
+ wchar_t szTemp[MAX_PATH];
mir_sntprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_ignore.ini", m_szModuleName);
- TCHAR *szLoadFileName = Utils_ReplaceVarsT(szTemp);
+ wchar_t *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
if (pszIgnoreData != NULL) {
char *p1 = pszIgnoreData;
@@ -1347,7 +1347,7 @@ void CIrcProto::InitIgnore(void)
RewriteIgnoreSettings();
delete[] pszIgnoreData;
- ::_tremove(szLoadFileName);
+ ::_wremove(szLoadFileName);
}
mir_free(szLoadFileName);
@@ -1432,7 +1432,7 @@ void CIgnorePrefsDlg::OnInitDialog()
lvC.iSubItem = index;
lvC.cx = COLUMNS_SIZES[index];
- TCHAR* text = NULL;
+ wchar_t* text = NULL;
switch (index) {
case 0: text = TranslateT("Ignore mask"); break;
case 1: text = TranslateT("Flags"); break;
@@ -1492,9 +1492,9 @@ void CIgnorePrefsDlg::OnEdit(CCtrlButton*)
if (!m_add.Enabled())
return;
- TCHAR szMask[512];
- TCHAR szFlags[512];
- TCHAR szNetwork[512];
+ wchar_t szMask[512];
+ wchar_t szFlags[512];
+ wchar_t szNetwork[512];
int i = m_list.GetSelectionMark();
m_list.GetItemText(i, 0, szMask, 511);
m_list.GetItemText(i, 1, szFlags, 511);
@@ -1504,17 +1504,17 @@ void CIgnorePrefsDlg::OnEdit(CCtrlButton*)
HWND hWnd = dlg->GetHwnd();
SetWindowText(hWnd, TranslateT("Edit ignore"));
if (szFlags[0]) {
- if (_tcschr(szFlags, 'q'))
+ if (wcschr(szFlags, 'q'))
CheckDlgButton(hWnd, IDC_Q, BST_CHECKED);
- if (_tcschr(szFlags, 'n'))
+ if (wcschr(szFlags, 'n'))
CheckDlgButton(hWnd, IDC_N, BST_CHECKED);
- if (_tcschr(szFlags, 'i'))
+ if (wcschr(szFlags, 'i'))
CheckDlgButton(hWnd, IDC_I, BST_CHECKED);
- if (_tcschr(szFlags, 'd'))
+ if (wcschr(szFlags, 'd'))
CheckDlgButton(hWnd, IDC_D, BST_CHECKED);
- if (_tcschr(szFlags, 'c'))
+ if (wcschr(szFlags, 'c'))
CheckDlgButton(hWnd, IDC_C, BST_CHECKED);
- if (_tcschr(szFlags, 'm'))
+ if (wcschr(szFlags, 'm'))
CheckDlgButton(hWnd, IDC_M, BST_CHECKED);
}
SetDlgItemText(hWnd, IDC_MASK, szMask);
@@ -1529,7 +1529,7 @@ void CIgnorePrefsDlg::OnDelete(CCtrlButton*)
if (!m_del.Enabled())
return;
- TCHAR szMask[512];
+ wchar_t szMask[512];
int i = m_list.GetSelectionMark();
m_list.GetItemText(i, 0, szMask, _countof(szMask));
m_proto->RemoveIgnore(szMask);
@@ -1558,7 +1558,7 @@ void CIgnorePrefsDlg::OnDestroy()
int i = m_list.GetItemCount();
for (int j = 0; j < i; j++) {
- TCHAR szMask[512], szFlags[40], szNetwork[100];
+ wchar_t szMask[512], szFlags[40], szNetwork[100];
m_list.GetItemText(j, 0, szMask, _countof(szMask));
m_list.GetItemText(j, 1, szFlags, _countof(szFlags));
m_list.GetItemText(j, 2, szNetwork, _countof(szNetwork));
@@ -1595,17 +1595,17 @@ void CIgnorePrefsDlg::RebuildList()
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.lParam = lvItem.iItem;
- lvItem.pszText = (TCHAR*)C.mask.c_str();
+ lvItem.pszText = (wchar_t*)C.mask.c_str();
lvItem.iItem = m_list.InsertItem(&lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
- lvItem.pszText = (TCHAR*)C.flags.c_str();
+ lvItem.pszText = (wchar_t*)C.flags.c_str();
m_list.SetItem(&lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 2;
- lvItem.pszText = (TCHAR*)C.network.c_str();
+ lvItem.pszText = (wchar_t*)C.network.c_str();
m_list.SetItem(&lvItem);
}
@@ -1636,23 +1636,23 @@ void CIgnorePrefsDlg::UpdateList()
int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.ptszTitle = m_tszUserName;
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszTab = LPGENT("Account");
+ odp.pwszTab = LPGENW("Account");
odp.pDialog = new CConnectPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("DCC and CTCP");
+ odp.pwszTab = LPGENW("DCC and CTCP");
odp.pDialog = new CCtcpPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Advanced");
+ odp.pwszTab = LPGENW("Advanced");
odp.pDialog = new COtherPrefsDlg(this);
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Ignore");
+ odp.pwszTab = LPGENW("Ignore");
odp.pDialog = new CIgnorePrefsDlg(this);
Options_AddPage(wParam, &odp);
return 0;
@@ -1782,7 +1782,7 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto>
m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
- _tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
+ wcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
@@ -1819,9 +1819,9 @@ INT_PTR CIrcProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// Initialize servers list
-static void sttImportIni(const TCHAR* szIniFile)
+static void sttImportIni(const wchar_t* szIniFile)
{
- FILE* serverFile = _tfopen(szIniFile, L"r");
+ FILE* serverFile = _wfopen(szIniFile, L"r");
if (serverFile == NULL)
return;
@@ -1842,20 +1842,20 @@ static void sttImportIni(const TCHAR* szIniFile)
db_set_s(NULL, SERVERSMODULE, buf2, p1);
}
fclose(serverFile);
- ::_tremove(szIniFile);
+ ::_wremove(szIniFile);
}
void InitServers()
{
- TCHAR *szTemp = Utils_ReplaceVarsT(L"%miranda_path%\\Plugins\\IRC_servers.ini");
+ wchar_t *szTemp = Utils_ReplaceVarsT(L"%miranda_path%\\Plugins\\IRC_servers.ini");
sttImportIni(szTemp);
mir_free(szTemp);
RereadServers();
if (g_servers.getCount() == 0) {
- TCHAR *szIniFile = Utils_ReplaceVarsT(L"%temp%\\default_servers.ini");
- FILE *serverFile = _tfopen(szIniFile, L"a");
+ wchar_t *szIniFile = Utils_ReplaceVarsT(L"%temp%\\default_servers.ini");
+ FILE *serverFile = _wfopen(szIniFile, L"a");
if (serverFile) {
char* pszSvrs = (char*)LockResource(LoadResource(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), L"TEXT")));
if (pszSvrs)
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp
index 8ff9d2a7b8..711b164e22 100644
--- a/protocols/IRCG/src/output.cpp
+++ b/protocols/IRCG/src/output.cpp
@@ -27,7 +27,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming) { // Is it an incoming message?
if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) {
- TCHAR temp[200]; *temp = '\0';
+ wchar_t temp[200]; *temp = '\0';
mir_sntprintf(temp, TranslateT("WallOps from %s: "), pmsg->prefix.sNick.c_str());
sMessage = temp;
for (int i = 0; i < (int)pmsg->parameters.getCount(); i++) {
@@ -39,7 +39,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg)
}
if (pmsg->sCommand == L"INVITE" && pmsg->parameters.getCount() > 1) {
- TCHAR temp[256]; *temp = '\0';
+ wchar_t temp[256]; *temp = '\0';
mir_sntprintf(temp, TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
@@ -50,9 +50,9 @@ static CMString FormatOutput(const CIrcMessage* pmsg)
goto THE_END;
}
- int index = _ttoi(pmsg->sCommand.c_str());
+ int index = _wtoi(pmsg->sCommand.c_str());
if (index == 301 && pmsg->parameters.getCount() > 0) {
- TCHAR temp[500]; *temp = '\0';
+ wchar_t temp[500]; *temp = '\0';
mir_sntprintf(temp, TranslateT("%s is away"), pmsg->parameters[1].c_str());
sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++) {
@@ -80,7 +80,7 @@ static CMString FormatOutput(const CIrcMessage* pmsg)
return pmsg->parameters[2] + L": " + pmsg->parameters[1];
}
else if (pmsg->sCommand == L"NOTICE" && pmsg->parameters.getCount() > 1) {
- TCHAR temp[500]; *temp = '\0';
+ wchar_t temp[500]; *temp = '\0';
int l = pmsg->parameters[1].GetLength();
if (l > 3 && pmsg->parameters[1][0] == 1 && pmsg->parameters[1][l - 1] == 1) {
@@ -136,13 +136,13 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg)
if (!pmsg->m_bIncoming)
mess.Replace(L"%%", L"%");
- int iTemp = _ttoi(pmsg->sCommand.c_str());
+ int iTemp = _wtoi(pmsg->sCommand.c_str());
//To active window
if ((iTemp > 400 || iTemp < 500) && pmsg->sCommand[0] == '4' //all error messages
|| pmsg->sCommand == L"303" //ISON command
|| pmsg->sCommand == L"INVITE"
- || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (_tcsstr(pmsg->parameters[1].c_str(), L"\001") == NULL) : false)) // CTCP answers should go to m_network Log window!
+ || ((pmsg->sCommand == L"NOTICE") && ((pmsg->parameters.getCount() > 2) ? (wcsstr(pmsg->parameters[1].c_str(), L"\001") == NULL) : false)) // CTCP answers should go to m_network Log window!
|| pmsg->sCommand == L"515") //chanserv error
{
DoEvent(GC_EVENT_INFORMATION, NULL, pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index ef968fb631..1620b46e24 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -26,7 +26,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam)
char* pszRaw = (char*)lParam;
if (m_scriptingEnabled && pszRaw && IsConnected()) {
- TCHAR* p = mir_a2t(pszRaw);
+ wchar_t* p = mir_a2t(pszRaw);
InsertIncomingEvent(p);
mir_free(p);
return 0;
@@ -83,17 +83,17 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
gchook->dwData = gch->dwData;
gchook->pDest->iType = gch->pDest->iType;
if (gch->ptszText)
- gchook->ptszText = _tcsdup(gch->ptszText);
+ gchook->ptszText = wcsdup(gch->ptszText);
else gchook->ptszText = NULL;
if (gch->ptszUID)
- gchook->ptszUID = _tcsdup(gch->ptszUID);
+ gchook->ptszUID = wcsdup(gch->ptszUID);
else
gchook->ptszUID = NULL;
if (gch->pDest->ptszID) {
CMString S = MakeWndID(gch->pDest->ptszID);
- gchook->pDest->ptszID = _tcsdup(S.c_str());
+ gchook->pDest->ptszID = wcsdup(S.c_str());
}
else gchook->pDest->ptszID = NULL;
@@ -117,7 +117,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
int i = sString.Find("|");
if (i != -1) {
sRequest = sString.Mid(0, i);
- TCHAR* p = mir_a2t(sString.Mid(i + 1));
+ wchar_t* p = mir_a2t(sString.Mid(i + 1));
sChannel = p;
mir_free(p);
}
@@ -148,7 +148,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- TCHAR szTemp[40];
+ wchar_t szTemp[40];
mir_sntprintf(szTemp, L"%u", gci.iCount);
sOutput = szTemp;
}
@@ -186,7 +186,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
}
if (!S.IsEmpty())
- sOutput = (TCHAR*)S.c_str();
+ sOutput = (wchar_t*)S.c_str();
}
// send it to mbot
if (!sOutput.IsEmpty())
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 559e3bf29d..2f7e814455 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -181,7 +181,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam)
CMessageBoxDlg* dlg = new CMessageBoxDlg(this, pdci);
dlg->Show();
HWND hWnd = dlg->GetHwnd();
- TCHAR szTemp[500];
+ wchar_t szTemp[500];
mir_sntprintf(szTemp, TranslateT("%s (%s) is requesting a client-to-client chat connection."),
pdci->sContactName.c_str(), pdci->sHostmask.c_str());
SetDlgItemText(hWnd, IDC_TEXT, szTemp);
@@ -389,12 +389,12 @@ INT_PTR __cdecl CIrcProto::OnChangeNickMenuCommand(WPARAM, LPARAM)
return 0;
}
-static void DoChatFormatting(TCHAR* pszText)
+static void DoChatFormatting(wchar_t* pszText)
{
- TCHAR* p1 = pszText;
+ wchar_t* p1 = pszText;
int iFG = -1;
int iRemoveChars;
- TCHAR InsertThis[50];
+ wchar_t InsertThis[50];
while (*p1 != '\0') {
iRemoveChars = 0;
@@ -422,9 +422,9 @@ static void DoChatFormatting(TCHAR* pszText)
mir_tstrcpy(InsertThis, L"\003");
iRemoveChars = 2;
- TCHAR szTemp[3];
+ wchar_t szTemp[3];
mir_tstrncpy(szTemp, p1 + 2, 3);
- iFG = _ttoi(szTemp);
+ iFG = _wtoi(szTemp);
}
break;
case 'C':
@@ -467,8 +467,8 @@ static void DoChatFormatting(TCHAR* pszText)
break;
}
- memmove(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(mir_tstrlen(p1) - iRemoveChars + 1));
- memcpy(p1, InsertThis, sizeof(TCHAR)*mir_tstrlen(InsertThis));
+ memmove(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(wchar_t)*(mir_tstrlen(p1) - iRemoveChars + 1));
+ memcpy(p1, InsertThis, sizeof(wchar_t)*mir_tstrlen(InsertThis));
if (iRemoveChars || mir_tstrlen(InsertThis))
p1 += mir_tstrlen(InsertThis);
else
@@ -488,8 +488,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
// handle the hook
if (gch) {
if (!mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) {
- TCHAR *p1 = mir_tstrdup(gch->pDest->ptszID);
- TCHAR *p2 = _tcsstr(p1, L" - ");
+ wchar_t *p1 = mir_tstrdup(gch->pDest->ptszID);
+ wchar_t *p2 = wcsstr(p1, L" - ");
if (p2)
*p2 = '\0';
@@ -500,7 +500,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- TCHAR* pszText = new TCHAR[mir_tstrlen(gch->ptszText) + 1000];
+ wchar_t* pszText = new wchar_t[mir_tstrlen(gch->ptszText) + 1000];
mir_tstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
@@ -514,7 +514,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
case GC_USER_PRIVMESS:
{
- TCHAR szTemp[4000];
+ wchar_t szTemp[4000];
mir_sntprintf(szTemp, L"/QUERY %s", gch->ptszUID);
PostIrcMessageWnd(p1, NULL, szTemp);
}
@@ -566,7 +566,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\"");
SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
(LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
- SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0);
+ SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
SetFocus(hEditCtrl);
dlg->Activate();
}
@@ -727,8 +727,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = gch->ptszUID;
- psr.nick.t = gch->ptszUID;
+ psr.id.w = gch->ptszUID;
+ psr.nick.w = gch->ptszUID;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
@@ -759,74 +759,74 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
static gc_item logItems[] = {
- { LPGENT("&Change your nickname"), 1, MENU_ITEM, FALSE },
- { LPGENT("Channel &settings"), 2, MENU_ITEM, FALSE },
+ { LPGENW("&Change your nickname"), 1, MENU_ITEM, FALSE },
+ { LPGENW("Channel &settings"), 2, MENU_ITEM, FALSE },
{ L"", 0, MENU_SEPARATOR, FALSE },
- { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Register nick"), 5, MENU_POPUPITEM, TRUE },
- { LPGENT("Auth nick"), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("Delete nick"), 7, MENU_POPUPITEM, FALSE },
- { LPGENT("Identify nick"), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Remind password"), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("Set new password"), 10, MENU_POPUPITEM, TRUE },
- { LPGENT("Set language"), 11, MENU_POPUPITEM, FALSE },
- { LPGENT("Set homepage"), 12, MENU_POPUPITEM, FALSE },
- { LPGENT("Set e-mail"), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Set info"), 14, MENU_POPUPITEM, FALSE },
+ { LPGENW("NickServ"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Register nick"), 5, MENU_POPUPITEM, TRUE },
+ { LPGENW("Auth nick"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENW("Delete nick"), 7, MENU_POPUPITEM, FALSE },
+ { LPGENW("Identify nick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENW("Remind password"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set new password"), 10, MENU_POPUPITEM, TRUE },
+ { LPGENW("Set language"), 11, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set homepage"), 12, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set e-mail"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set info"), 14, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE },
+ { LPGENW("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Set security for nick"), 22, MENU_POPUPITEM, FALSE },
- { LPGENT("Remove security for nick"), 23, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set security for nick"), 22, MENU_POPUPITEM, FALSE },
+ { LPGENW("Remove security for nick"), 23, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Link nick to current"), 24, MENU_POPUPITEM, FALSE },
- { LPGENT("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE },
- { LPGENT("Set main nick"), 26, MENU_POPUPITEM, FALSE },
- { LPGENT("List all your nicks"), 27, MENU_POPUPITEM, FALSE },
- { LPGENT("List your channels"), 28, MENU_POPUPITEM, FALSE },
+ { LPGENW("Link nick to current"), 24, MENU_POPUPITEM, FALSE },
+ { LPGENW("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE },
+ { LPGENW("Set main nick"), 26, MENU_POPUPITEM, FALSE },
+ { LPGENW("List all your nicks"), 27, MENU_POPUPITEM, FALSE },
+ { LPGENW("List your channels"), 28, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENW("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide nick from list"), 18, MENU_POPUPITEM, FALSE },
- { LPGENT("Show nick to list"), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Show the server &window"), 4, MENU_ITEM, FALSE },
+ { LPGENW("Hide nick from list"), 18, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show nick to list"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENW("Show the server &window"), 4, MENU_ITEM, FALSE },
{ L"", 0, MENU_SEPARATOR, FALSE },
- { LPGENT("&Leave the channel"), 3, MENU_ITEM, FALSE }
+ { LPGENW("&Leave the channel"), 3, MENU_ITEM, FALSE }
};
static gc_item nickItems[] = {
- { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
- { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE },
- { LPGENT("Send &notice"), 22, MENU_ITEM, FALSE },
- { LPGENT("&Slap"), 31, MENU_ITEM, FALSE },
- { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE },
- { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
- { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
- { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
- { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE },
- { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
- { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
+ { LPGENW("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
+ { LPGENW("&Invite to channel"), 23, MENU_ITEM, FALSE },
+ { LPGENW("Send &notice"), 22, MENU_ITEM, FALSE },
+ { LPGENW("&Slap"), 31, MENU_ITEM, FALSE },
+ { LPGENW("Nickserv info"), 32, MENU_ITEM, FALSE },
+ { LPGENW("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
+ { LPGENW("&Control"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
+ { LPGENW("Take Owner"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give Admin"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
+ { LPGENW("Give &Op"), 1, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take O&p"), 2, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENW("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
+ { LPGENW("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
+ { LPGENW("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
{ L"", 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE },
- { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
- { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
- { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE },
+ { LPGENW("&Kick"), 5, MENU_POPUPITEM, FALSE },
+ { LPGENW("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENW("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
+ { LPGENW("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENW("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENW("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENW("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENW("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
+ { LPGENW("Add to &ignore list"), 15, MENU_ITEM, FALSE },
{ L"", 12, MENU_SEPARATOR, FALSE },
- { LPGENT("&Add User"), 30, MENU_ITEM, FALSE }
+ { LPGENW("&Add User"), 30, MENU_ITEM, FALSE }
};
int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
@@ -843,7 +843,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
}
if (gcmi->Type == MENU_ON_NICKLIST) {
- CONTACT user = { (TCHAR*)gcmi->pszUID, NULL, NULL, false, false, false };
+ CONTACT user = { (wchar_t*)gcmi->pszUID, NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
gcmi->nItems = _countof(nickItems);
@@ -858,8 +858,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; //DCC submenu
- TCHAR stzChanName[100];
- const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
+ wchar_t stzChanName[100];
+ const wchar_t* temp = wcschr(gcmi->pszID, ' ');
size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_tstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
@@ -1036,7 +1036,7 @@ void CIrcProto::ConnectToServer(void)
si.sFullName = m_name;
si.sPassword = m_password;
si.bIdentServer = ((m_ident) ? (true) : (false));
- si.iIdentServerPort = _ttoi(m_identPort);
+ si.iIdentServerPort = _wtoi(m_identPort);
si.sIdentServerType = m_identSystem;
si.m_iSSL = m_iSSL;
si.sNetwork = m_network;
@@ -1055,7 +1055,7 @@ void CIrcProto::ConnectToServer(void)
else if (m_bConnectRequested < 1)
InterlockedIncrement((long *)&m_bConnectRequested);
- TCHAR szTemp[300];
+ wchar_t szTemp[300];
mir_sntprintf(szTemp, L"\033%s \002%s\002 (%S: %u)",
TranslateT("Connecting to"), si.sNetwork.c_str(), si.sServer.c_str(), si.iPort);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
@@ -1080,7 +1080,7 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam)
if ((int)wParam != m_iStatus)
return 0;
- const TCHAR* p = m_statusMessage.c_str();
+ const wchar_t* p = m_statusMessage.c_str();
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(p) : (INT_PTR)mir_t2a(p);
}
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index 2fa3ab877b..460b5a54f2 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -120,10 +120,10 @@ struct IPRESOLVE // Contains info about the channels
struct CHANNELINFO // Contains info about the channels
{
- TCHAR* pszTopic;
- TCHAR* pszMode;
- TCHAR* pszPassword;
- TCHAR* pszLimit;
+ wchar_t* pszTopic;
+ wchar_t* pszMode;
+ wchar_t* pszPassword;
+ wchar_t* pszLimit;
BYTE OwnMode; /* own mode on the channel. Bitmask:
0: voice
1: halfop
@@ -143,7 +143,7 @@ struct SERVER_INFO // Contains info about different servers
struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
{
- PERFORM_INFO( const char* szSetting, const TCHAR* value ) :
+ PERFORM_INFO( const char* szSetting, const wchar_t* value ) :
mSetting( szSetting ),
mText( value )
{}
@@ -157,9 +157,9 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
struct CONTACT // Contains info about users
{
- TCHAR* name;
- TCHAR* user;
- TCHAR* host;
+ wchar_t* name;
+ wchar_t* user;
+ wchar_t* host;
bool ExactOnly;
bool ExactWCOnly;
bool ExactNick;
@@ -174,7 +174,7 @@ struct TDbSetting
union
{
int defValue;
- TCHAR* defStr;
+ wchar_t* defStr;
};
};
@@ -189,18 +189,18 @@ typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage* pmsg);
struct CIrcHandler
{
- CIrcHandler( const TCHAR* _name, PfnIrcMessageHandler _handler ) :
+ CIrcHandler( const wchar_t* _name, PfnIrcMessageHandler _handler ) :
m_name( _name ),
m_handler( _handler )
{}
- const TCHAR* m_name;
+ const wchar_t* m_name;
PfnIrcMessageHandler m_handler;
};
struct CIrcProto : public PROTO<CIrcProto>
{
- CIrcProto(const char*, const TCHAR*);
+ CIrcProto(const char*, const wchar_t*);
~CIrcProto();
// Protocol interface
@@ -208,24 +208,24 @@ struct CIrcProto : public PROTO<CIrcProto>
virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath);
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason);
- virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const TCHAR **szFilename);
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
+ virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const wchar_t **szFilename);
virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg);
+ virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
@@ -262,24 +262,24 @@ struct CIrcProto : public PROTO<CIrcProto>
char m_serverName[100];
char m_password [500];
- TCHAR m_identSystem[10];
+ wchar_t m_identSystem[10];
char m_network[30];
char m_portStart[10];
char m_portEnd[10];
int m_iSSL;
- TCHAR m_identPort[10];
- TCHAR m_nick[30], m_pNick[30];
- TCHAR m_alternativeNick[30];
- TCHAR m_name[200];
- TCHAR m_userID[200];
- TCHAR m_quitMessage[400];
- TCHAR m_userInfo[500];
+ wchar_t m_identPort[10];
+ wchar_t m_nick[30], m_pNick[30];
+ wchar_t m_alternativeNick[30];
+ wchar_t m_name[200];
+ wchar_t m_userID[200];
+ wchar_t m_quitMessage[400];
+ wchar_t m_userInfo[500];
char m_myHost[50];
char m_mySpecifiedHost[500];
char m_mySpecifiedHostIP[50];
char m_myLocalHost[50];
WORD m_myLocalPort;
- TCHAR* m_alias;
+ wchar_t* m_alias;
int m_serverComboSelection;
int m_quickComboSelection;
int m_onlineNotificationTime;
@@ -368,27 +368,27 @@ struct CIrcProto : public PROTO<CIrcProto>
//commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
- int AddOutgoingMessageToDB(MCONTACT hContact, TCHAR *msg);
+ int AddOutgoingMessageToDB(MCONTACT hContact, wchar_t *msg);
bool DoOnConnect(const CIrcMessage *pmsg);
int DoPerform(const char *event);
void __cdecl ResolveIPThread(void *di);
- bool AddIgnore(const TCHAR *mask, const TCHAR *mode, const TCHAR *network) ;
+ bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network) ;
int IsIgnored(const CMString &nick, const CMString &address, const CMString &host, char type) ;
int IsIgnored(CMString user, char type);
- bool RemoveIgnore(const TCHAR *mask) ;
+ bool RemoveIgnore(const wchar_t *mask) ;
//input.cpp
- CMString DoAlias( const TCHAR *text, TCHAR *window);
- BOOL DoHardcodedCommand(CMString text, TCHAR *window, MCONTACT hContact);
- CMString DoIdentifiers(CMString text, const TCHAR *window);
+ CMString DoAlias( const wchar_t *text, wchar_t *window);
+ BOOL DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact);
+ CMString DoIdentifiers(CMString text, const wchar_t *window);
void FormatMsg(CMString &text);
- bool PostIrcMessageWnd(TCHAR *pszWindow, MCONTACT hContact, const TCHAR *szBuf);
- bool PostIrcMessage(const TCHAR *fmt, ...);
+ bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
+ bool PostIrcMessage(const wchar_t *fmt, ...);
// irclib.cpp
UINT_PTR DCCTimer;
- void SendIrcMessage(const TCHAR*, bool bNotify = true, int codepage = -1);
+ void SendIrcMessage(const wchar_t*, bool bNotify = true, int codepage = -1);
// ircproto.cpp
void __cdecl AckBasicSearch(void* param);
@@ -439,16 +439,16 @@ struct CIrcProto : public PROTO<CIrcProto>
void __cdecl DisconnectServerThread( void* );
//tools.cpp
- void AddToJTemp(TCHAR op, CMString& sCommand);
- bool AddWindowItemData(CMString window, const TCHAR* pszLimit, const TCHAR* pszMode, const TCHAR* pszPassword, const TCHAR* pszTopic);
+ void AddToJTemp(wchar_t op, CMString& sCommand);
+ bool AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic);
INT_PTR CallChatEvent(WPARAM wParam, LPARAM lParam);
- INT_PTR DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick, const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
+ INT_PTR DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick, const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
void FindLocalIP(HANDLE con);
bool FreeWindowItemData(CMString window, CHANNELINFO* wis);
bool IsChannel(const char* sName);
- bool IsChannel(const TCHAR* sName);
+ bool IsChannel(const wchar_t* sName);
void KillChatTimer(UINT_PTR &nIDEvent);
- CMString MakeWndID(const TCHAR* sWindow);
+ CMString MakeWndID(const wchar_t* sWindow);
CMString ModeToStatus(int sMode);
CMString PrefixToStatus(int cPrefix);
int SetChannelSBText(CMString sWindow, CHANNELINFO * wi);
@@ -473,7 +473,7 @@ struct CIrcProto : public PROTO<CIrcProto>
CDccSession* FindDCCSession(MCONTACT hContact);
CDccSession* FindDCCSession(DCCINFO* pdci);
CDccSession* FindDCCSendByPort(int iPort);
- CDccSession* FindDCCRecvByPortAndName(int iPort, const TCHAR* szName);
+ CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName);
CDccSession* FindPassiveDCCSend(int iToken);
CDccSession* FindPassiveDCCRecv(CMString sName, CMString sToken);
@@ -484,12 +484,12 @@ struct CIrcProto : public PROTO<CIrcProto>
void Disconnect(void);
void KillIdent(void);
- int NLSend(const TCHAR* fmt, ...);
+ int NLSend(const wchar_t* fmt, ...);
int NLSend(const char* fmt, ...);
int NLSend(const unsigned char* buf, int cbBuf);
int NLSendNoScript( const unsigned char* buf, int cbBuf);
int NLReceive(unsigned char* buf, int cbBuf);
- void InsertIncomingEvent(TCHAR* pszRaw);
+ void InsertIncomingEvent(wchar_t* pszRaw);
__inline bool IsConnected() const { return con != NULL; }
@@ -572,7 +572,7 @@ private :
static OBJLIST<CIrcHandler> m_handlers;
- PfnIrcMessageHandler FindMethod(const TCHAR* lpszName);
+ PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
void OnIrcMessage(const CIrcMessage* pmsg);
CMString sNick4Perform;
@@ -581,7 +581,7 @@ private :
// map actual member functions to their associated IRC command.
// put any number of this macro in the class's constructor.
#define IRC_MAP_ENTRY(name, member) \
- m_handlers.insert( new CIrcHandler( _T(name), &CIrcProto::OnIrc_##member ));
+ m_handlers.insert( new CIrcHandler( L##name, &CIrcProto::OnIrc_##member ));
/////////////////////////////////////////////////////////////////////////////////////////
// Functions
@@ -617,13 +617,13 @@ HICON LoadIconEx(int iIndex, bool big = false);
HANDLE GetIconHandle(int iconId);
//tools.cpp
-int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string);
-char* __stdcall IrcLoadFile(TCHAR * szPath);
-CMString __stdcall GetWord(const TCHAR* text, int index);
-const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index);
+int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
+char* __stdcall IrcLoadFile(wchar_t * szPath);
+CMString __stdcall GetWord(const wchar_t* text, int index);
+const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
void __stdcall RemoveLinebreaks( CMString& Message );
-TCHAR* __stdcall my_strstri(const TCHAR *s1, const TCHAR *s2) ;
-TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent);
+wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2) ;
+wchar_t* __stdcall DoColorCodes (const wchar_t* text, bool bStrip, bool bReplacePercent);
CMStringA __stdcall GetWord(const char* text, int index);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index cfae12a301..6a2af3446e 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
-void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
+void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand)
{
CMString res;
@@ -49,20 +49,20 @@ void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
setTString("JTemp", res.c_str());
}
-CMString __stdcall GetWord(const TCHAR* text, int index)
+CMString __stdcall GetWord(const wchar_t* text, int index)
{
if (text && *text) {
- TCHAR* p1 = (TCHAR*)text;
- TCHAR* p2 = NULL;
+ wchar_t* p1 = (wchar_t*)text;
+ wchar_t* p2 = NULL;
while (*p1 == ' ')
p1++;
if (*p1 != '\0') {
for (int i = 0; i < index; i++) {
- p2 = _tcschr(p1, ' ');
+ p2 = wcschr(p1, ' ');
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
else
while (*p2 == ' ')
p2++;
@@ -70,9 +70,9 @@ CMString __stdcall GetWord(const TCHAR* text, int index)
p1 = p2;
}
- p2 = _tcschr(p1, ' ');
+ p2 = wcschr(p1, ' ');
if (!p2)
- p2 = _tcschr(p1, '\0');
+ p2 = wcschr(p1, '\0');
if (p1 != p2)
return CMString(p1, p2 - p1);
@@ -82,12 +82,12 @@ CMString __stdcall GetWord(const TCHAR* text, int index)
return CMString();
}
-const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
+const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index)
{
if (!text || !mir_tstrlen(text))
return text;
- const TCHAR* temp = text;
+ const wchar_t* temp = text;
while (*temp == ' ')
temp++;
@@ -96,9 +96,9 @@ const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
return temp;
for (int i = 0; i < index; i++) {
- temp = _tcschr(temp, ' ');
+ temp = wcschr(temp, ' ');
if (!temp)
- temp = (TCHAR*)_tcschr(text, '\0');
+ temp = (wchar_t*)wcschr(text, '\0');
else
while (*temp == ' ')
temp++;
@@ -120,11 +120,11 @@ void __stdcall RemoveLinebreaks(CMString &Message)
Message.Delete(Message.GetLength() - 2, 2);
}
-char* __stdcall IrcLoadFile(TCHAR* szPath)
+char* __stdcall IrcLoadFile(wchar_t* szPath)
{
char * szContainer = NULL;
DWORD dwSiz = 0;
- FILE *hFile = _tfopen(szPath, L"rb");
+ FILE *hFile = _wfopen(szPath, L"rb");
if (hFile != NULL) {
fseek(hFile, 0, SEEK_END); // seek to end
dwSiz = ftell(hFile); // size
@@ -139,12 +139,12 @@ char* __stdcall IrcLoadFile(TCHAR* szPath)
return 0;
}
-int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
+int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string)
{
if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
return 1;
- const TCHAR *cp = NULL, *mp = NULL;
+ const wchar_t *cp = NULL, *mp = NULL;
while ((*string) && (*wild != '*')) {
if ((*wild != *string) && (*wild != '?'))
return 0;
@@ -177,7 +177,7 @@ int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
return !*wild;
}
-bool CIrcProto::IsChannel(const TCHAR* sName)
+bool CIrcProto::IsChannel(const wchar_t* sName)
{
return (sChannelPrefixes.Find(sName[0]) != -1);
}
@@ -220,21 +220,21 @@ bool CIrcProto::IsChannel(const char* sName)
return (sChannelPrefixes.Find(sName[0]) != -1);
}
-TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2)
+wchar_t* __stdcall my_strstri(const wchar_t* s1, const wchar_t* s2)
{
int i, j, k;
for (i = 0; s1[i]; i++)
- for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ for (j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++)
if (!s2[k + 1])
- return (TCHAR*)(s1 + i);
+ return (wchar_t*)(s1 + i);
return NULL;
}
-TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePercent)
+wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent)
{
- static TCHAR szTemp[4000]; szTemp[0] = '\0';
- TCHAR* p = szTemp;
+ static wchar_t szTemp[4000]; szTemp[0] = '\0';
+ wchar_t* p = szTemp;
bool bBold = false;
bool bUnderline = false;
bool bItalics = false;
@@ -305,7 +305,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
break;
}
else { // some colors should be set... need to find out who
- TCHAR buf[3];
+ wchar_t buf[3];
// fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
@@ -313,7 +313,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
else
mir_tstrncpy(buf, text, 2);
text += mir_tstrlen(buf);
- iFG = _ttoi(buf);
+ iFG = _wtoi(buf);
// fix background color
if (*text == ',' && text[1] > 47 && text[1] < 58 && text[1] != '\0') {
@@ -324,7 +324,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
else
mir_tstrncpy(buf, text, 2);
text += mir_tstrlen(buf);
- iBG = _ttoi(buf);
+ iBG = _wtoi(buf);
}
}
@@ -337,7 +337,7 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
// create tag for chat.dll
if (!bStrip) {
- TCHAR buf[10];
+ wchar_t buf[10];
if (iFG >= 0 && iFG != 99) {
*p++ = '%';
*p++ = 'c';
@@ -381,8 +381,8 @@ INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, LPARAM lParam)
return CallServiceSync(MS_GC_EVENT, wParam, (LPARAM)lParam);
}
-INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick,
- const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo,
+INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick,
+ const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
GCDEST gcd = { m_szModuleName, NULL, iEvent };
@@ -404,7 +404,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszN
sID = pszWindow + (CMString)L" - " + m_info.sNetwork;
else
sID = pszWindow;
- gcd.ptszID = (TCHAR*)sID.c_str();
+ gcd.ptszID = (wchar_t*)sID.c_str();
}
else gcd.ptszID = NULL;
@@ -454,7 +454,7 @@ CMString CIrcProto::ModeToStatus(int sMode)
CMString CIrcProto::PrefixToStatus(int cPrefix)
{
- const TCHAR* p = _tcschr(sUserModePrefixes.c_str(), cPrefix);
+ const wchar_t* p = wcschr(sUserModePrefixes.c_str(), cPrefix);
if (p) {
int index = int(p - sUserModePrefixes.c_str());
return ModeToStatus(sUserModes[index]);
@@ -545,9 +545,9 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi)
return DoEvent(GC_EVENT_SETSBTEXT, sWindow.c_str(), NULL, sTemp.c_str(), NULL, NULL, NULL, FALSE, FALSE, 0);
}
-CMString CIrcProto::MakeWndID(const TCHAR* sWindow)
+CMString CIrcProto::MakeWndID(const wchar_t* sWindow)
{
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
return CMString(buf);
}
@@ -570,24 +570,24 @@ bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis)
return false;
}
-bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const TCHAR* pszMode, const TCHAR* pszPassword, const TCHAR* pszTopic)
+bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic)
{
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(mir_tstrlen(pszLimit) + 1));
+ wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_tstrlen(pszLimit) + 1));
mir_tstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(mir_tstrlen(pszMode) + 1));
+ wi->pszMode = (wchar_t*)realloc(wi->pszMode, sizeof(wchar_t)*(mir_tstrlen(pszMode) + 1));
mir_tstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(mir_tstrlen(pszPassword) + 1));
+ wi->pszPassword = (wchar_t*)realloc(wi->pszPassword, sizeof(wchar_t)*(mir_tstrlen(pszPassword) + 1));
mir_tstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(mir_tstrlen(pszTopic) + 1));
+ wi->pszTopic = (wchar_t*)realloc(wi->pszTopic, sizeof(wchar_t)*(mir_tstrlen(pszTopic) + 1));
mir_tstrcpy(wi->pszTopic, pszTopic);
}
@@ -612,7 +612,7 @@ void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber
void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...)
{
- TCHAR temp[4096];
+ wchar_t temp[4096];
CMString S = L"";
switch (type) {
case 1:
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index dd557e25d1..6237ceaa31 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -35,10 +35,10 @@ struct UserDetailsDlgProcParam
MCONTACT hContact;
};
-#define STR_BASIC LPGEN("Faster! Searches the network for an exact match of the nickname only. The hostmask is optional and provides further security if used. Wildcards (? and *) are allowed.")
-#define STR_ADVANCED LPGEN("Slower! Searches the network for nicknames matching a wildcard string. The hostmask is mandatory and a minimum of 4 characters is necessary in the \"Nick\" field. Wildcards (? and *) are allowed.")
-#define STR_ERROR LPGEN("Settings could not be saved!\n\nThe \"Nick\" field must contain at least four characters including wildcards,\n and it must also match the default nickname for this contact.")
-#define STR_ERROR2 LPGEN("Settings could not be saved!\n\nA full hostmask must be set for this online detection mode to work.")
+const wchar_t *STR_BASIC = LPGENW("Faster! Searches the network for an exact match of the nickname only. The hostmask is optional and provides further security if used. Wildcards (? and *) are allowed.");
+const wchar_t *STR_ADVANCED = LPGENW("Slower! Searches the network for nicknames matching a wildcard string. The hostmask is mandatory and a minimum of 4 characters is necessary in the \"Nick\" field. Wildcards (? and *) are allowed.");
+const wchar_t *STR_ERROR = LPGENW("Settings could not be saved!\n\nThe \"Nick\" field must contain at least four characters including wildcards,\n and it must also match the default nickname for this contact.");
+const wchar_t *STR_ERROR2 = LPGENW("Settings could not be saved!\n\nA full hostmask must be set for this online detection mode to work.");
INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -63,14 +63,14 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), bAdvanced);
if (!bAdvanced) {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC));
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
}
else {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED));
if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
@@ -99,7 +99,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON2), true);
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON) {
- TCHAR temp[500];
+ wchar_t temp[500];
GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
BYTE bAdvanced = IsDlgButtonChecked(m_hwnd, IDC_RADIO1) ? 0 : 1;
@@ -107,13 +107,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_WILDCARD)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_USER)) == 0 ||
GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HOST)) == 0) {
- MessageBox(NULL, TranslateT(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(NULL, TranslateTS(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return FALSE;
}
DBVARIANT dbv;
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
- CMString S = _T(STR_ERROR);
+ CMString S = STR_ERROR;
S += L" (";
S += dbv.ptszVal;
S += L")";
@@ -162,7 +162,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
}
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO1) {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_BASIC));
DBVARIANT dbv;
if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
@@ -174,7 +174,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO2) {
DBVARIANT dbv;
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED));
if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index e41020e7d1..de14672a0a 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -109,21 +109,21 @@ void CWhoisDlg::OnDestroy()
void CWhoisDlg::OnGo(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/WHOIS %s %s", szTemp, szTemp);
}
void CWhoisDlg::OnQuery(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/QUERY %s", szTemp);
}
void CWhoisDlg::OnPing(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001PING %u\001", szTemp, time(0));
@@ -131,7 +131,7 @@ void CWhoisDlg::OnPing(CCtrlButton*)
void CWhoisDlg::OnUserInfo(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001USERINFO\001", szTemp);
@@ -139,7 +139,7 @@ void CWhoisDlg::OnUserInfo(CCtrlButton*)
void CWhoisDlg::OnTime(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001TIME\001", szTemp);
@@ -147,7 +147,7 @@ void CWhoisDlg::OnTime(CCtrlButton*)
void CWhoisDlg::OnVersion(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", szTemp);
@@ -228,7 +228,7 @@ void CNickDlg::OnDestroy()
void CNickDlg::OnOk(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_Enick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/NICK %s", szTemp);
@@ -269,7 +269,7 @@ void CListDlg::OnInitDialog()
SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0);
LVCOLUMN lvC;
int COLUMNS_SIZES[4] = { 200, 50, 50, 2000 };
- TCHAR szBuffer[32];
+ wchar_t szBuffer[32];
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.fmt = LVCFMT_LEFT;
@@ -302,8 +302,8 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
::KillTimer(m_hwnd, m_timer); m_timer = 0;
// Retrieve the input text
- TCHAR strFilterText[255];
- TCHAR newTitle[255];
+ wchar_t strFilterText[255];
+ wchar_t newTitle[255];
m_filter.GetText(strFilterText, _countof(strFilterText));
if (strFilterText[0]) {
@@ -316,7 +316,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
m_list2.DeleteAllItems();
LVITEM lvm;
- TCHAR text[255];
+ wchar_t text[255];
lvm.pszText = text; // Set buffer for texts
lvm.cchTextMax = _countof(text);
lvm.mask = LVIF_TEXT;
@@ -326,12 +326,12 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
m_list.GetItem(&lvm);
// Match the text?
- TCHAR* t = _tcsstr(lvm.pszText, strFilterText);
+ wchar_t* t = wcsstr(lvm.pszText, strFilterText);
if (t == NULL) { // If no, then Check if in the topics
m_list.GetItem(&lvm);
// Match the text?
- t = _tcsstr(lvm.pszText, strFilterText);
+ t = wcsstr(lvm.pszText, strFilterText);
}
if (t) {
@@ -416,8 +416,8 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
if (!param->pList->GetHwnd())
return 0;
- TCHAR temp1[512];
- TCHAR temp2[512];
+ wchar_t temp1[512];
+ wchar_t temp2[512];
LVITEM lvm;
lvm.mask = LVIF_TEXT;
lvm.iItem = lParam1;
@@ -435,7 +435,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
return (*temp1 == 0) ? 1 : -1;
}
- return (_ttoi(temp1) < _ttoi(temp2)) ? 1 : -1;
+ return (_wtoi(temp1) < _wtoi(temp2)) ? 1 : -1;
}
int CListDlg::Resizer(UTILRESIZECONTROL *urc)
@@ -463,7 +463,7 @@ void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo *ev)
void CListDlg::OnJoin(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
m_filter.GetText(szTemp, _countof(szTemp));
if (szTemp[0])
@@ -523,7 +523,7 @@ void CJoinDlg::OnDestroy()
void CJoinDlg::OnOk(CCtrlButton*)
{
- TCHAR szTemp[255];
+ wchar_t szTemp[255];
GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, _countof(szTemp));
if (m_proto->IsChannel(szTemp))
m_proto->PostIrcMessage(L"/JOIN %s", szTemp);
@@ -631,7 +631,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
m_proto->m_iSSL = pData->m_iSSL;
}
- TCHAR windowname[20];
+ wchar_t windowname[20];
GetWindowText(m_hwnd, windowname, _countof(windowname));
if (mir_tstrcmpi(windowname, L"Miranda IRC") == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
@@ -727,22 +727,22 @@ void CQuestionDlg::OnOk(CCtrlButton*)
{
int i = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_EDIT));
if (i > 0) {
- TCHAR* l = new TCHAR[i + 2];
+ wchar_t* l = new wchar_t[i + 2];
GetDlgItemText(m_hwnd, IDC_EDIT, l, i + 1);
int j = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HIDDENEDIT));
- TCHAR *m = new TCHAR[j + 2];
+ wchar_t *m = new wchar_t[j + 2];
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, m, j + 1);
- TCHAR *text = _tcsstr(m, L"%question");
- TCHAR *p1 = text;
- TCHAR *p2 = NULL;
+ wchar_t *text = wcsstr(m, L"%question");
+ wchar_t *p1 = text;
+ wchar_t *p2 = NULL;
if (p1) {
p1 += 9;
if (*p1 == '=' && p1[1] == '\"') {
p1 += 2;
for (int k = 0; k < 3; k++) {
- p2 = _tcschr(p1, '\"');
+ p2 = wcschr(p1, '\"');
if (p2) {
p2++;
if (k == 2 || (*p2 != ',' || (*p2 == ',' && p2[1] != '\"')))
@@ -756,7 +756,7 @@ void CQuestionDlg::OnOk(CCtrlButton*)
else *p1 = '\0';
}
- CMString S(_T('\0'), j + 2);
+ CMString S('\0', j + 2);
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1);
S.Replace(text, l);
m_proto->PostIrcMessageWnd(NULL, NULL, S);
@@ -907,10 +907,10 @@ void CManagerDlg::OnClose()
}
}
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CMString S = L"";
- TCHAR temp[1000];
+ wchar_t temp[1000];
for (int i = 0; i < 5; i++) {
if (m_topic.SendMsg(CB_GETLBTEXT, i, (LPARAM)temp) != LB_ERR) {
CMString S1 = temp;
@@ -939,8 +939,8 @@ void CManagerDlg::OnDestroy()
void CManagerDlg::OnAdd(CCtrlButton*)
{
- TCHAR temp[100];
- TCHAR mode[3];
+ wchar_t temp[100];
+ wchar_t mode[3];
if (m_radio1.GetState()) {
mir_tstrcpy(mode, L"+b");
mir_tstrncpy(temp, TranslateT("Add ban"), 100);
@@ -964,8 +964,8 @@ void CManagerDlg::OnAdd(CCtrlButton*)
SetDlgItemText(addban_hWnd, IDC_CAPTION, temp);
SetDlgItemText(addban_hWnd, IDC_TEXT, TranslateT("Please enter the hostmask (nick!user@host)"));
- TCHAR temp2[450];
- TCHAR window[256];
+ wchar_t temp2[450];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
mir_sntprintf(temp2, L"/MODE %s %s %s", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
@@ -977,12 +977,12 @@ void CManagerDlg::OnEdit(CCtrlButton*)
if (BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_NOTOP)) {
int i = m_list.GetCurSel();
if (i != LB_ERR) {
- TCHAR* m = m_list.GetItemText(i);
+ wchar_t* m = m_list.GetItemText(i);
CMString user = GetWord(m, 0);
mir_free(m);
- TCHAR temp[100];
- TCHAR mode[3];
+ wchar_t temp[100];
+ wchar_t mode[3];
if (m_radio1.GetState()) {
mir_tstrcpy(mode, L"b");
mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
@@ -1007,8 +1007,8 @@ void CManagerDlg::OnEdit(CCtrlButton*)
m_edit.Disable();
m_remove.Disable();
- TCHAR temp2[450];
- TCHAR window[256];
+ wchar_t temp2[450];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
mir_sntprintf(temp2, L"/MODE %s -%s %s%s/MODE %s +%s %s", window, mode, user.c_str(), L"%newl", window, mode, L"%question");
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
@@ -1025,8 +1025,8 @@ void CManagerDlg::OnRemove(CCtrlButton*)
m_edit.Disable();
m_remove.Disable();
- TCHAR temp[100], mode[3];
- TCHAR* m = m_list.GetItemText(i, temp, _countof(temp));
+ wchar_t temp[100], mode[3];
+ wchar_t* m = m_list.GetItemText(i, temp, _countof(temp));
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
@@ -1042,7 +1042,7 @@ void CManagerDlg::OnRemove(CCtrlButton*)
mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
}
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
if (MessageBox(m_hwnd, user.c_str(), temp, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
m_proto->PostIrcMessage(L"/MODE %s %s %s", window, mode, user.c_str());
@@ -1077,57 +1077,57 @@ void CManagerDlg::OnChangeTopic(CCtrlData*)
void CManagerDlg::OnApplyModes(CCtrlButton*)
{
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
- TCHAR toadd[10]; *toadd = '\0';
- TCHAR toremove[10]; *toremove = '\0';
+ wchar_t toadd[10]; *toadd = '\0';
+ wchar_t toremove[10]; *toremove = '\0';
CMString appendixadd = L"";
CMString appendixremove = L"";
- if (wi->pszMode && _tcschr(wi->pszMode, 't')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
mir_tstrcat(toremove, L"t");
}
else if (m_check1.GetState())
mir_tstrcat(toadd, L"t");
- if (wi->pszMode && _tcschr(wi->pszMode, 'n')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
mir_tstrcat(toremove, L"n");
}
else if (m_check2.GetState())
mir_tstrcat(toadd, L"n");
- if (wi->pszMode && _tcschr(wi->pszMode, 'i')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
mir_tstrcat(toremove, L"i");
}
else if (m_check3.GetState())
mir_tstrcat(toadd, L"i");
- if (wi->pszMode && _tcschr(wi->pszMode, 'm')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
mir_tstrcat(toremove, L"m");
}
else if (m_check4.GetState())
mir_tstrcat(toadd, L"m");
- if (wi->pszMode && _tcschr(wi->pszMode, 'p')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
mir_tstrcat(toremove, L"p");
}
else if (m_check7.GetState())
mir_tstrcat(toadd, L"p");
- if (wi->pszMode && _tcschr(wi->pszMode, 's')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
mir_tstrcat(toremove, L"s");
}
else if (m_check8.GetState())
mir_tstrcat(toadd, L"s");
- if (wi->pszMode && _tcschr(wi->pszMode, 'c')) {
+ if (wi->pszMode && wcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
mir_tstrcat(toremove, L"c");
}
@@ -1136,13 +1136,13 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
CMString Key = L"";
CMString Limit = L"";
- if (wi->pszMode && wi->pszPassword && _tcschr(wi->pszMode, 'k')) {
+ if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
mir_tstrcat(toremove, L"k");
appendixremove += L" " + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
- TCHAR temp[400];
+ wchar_t temp[400];
m_key.GetText(temp, 14);
if (Key != temp) {
@@ -1157,16 +1157,16 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
mir_tstrcat(toadd, L"k");
appendixadd += L" ";
- TCHAR temp[400];
+ wchar_t temp[400];
m_key.GetText(temp, _countof(temp));
appendixadd += temp;
}
- if (_tcschr(wi->pszMode, 'l')) {
+ if (wcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
mir_tstrcat(toremove, L"l");
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
- TCHAR temp[15];
+ wchar_t temp[15];
GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
if (wi->pszLimit && mir_tstrcmpi(wi->pszLimit, temp)) {
mir_tstrcat(toadd, L"l");
@@ -1178,13 +1178,13 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
mir_tstrcat(toadd, L"l");
appendixadd += L" ";
- TCHAR temp[15];
+ wchar_t temp[15];
m_limit.GetText(temp, _countof(temp));
appendixadd += temp;
}
if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
- TCHAR temp[500];
+ wchar_t temp[500];
mir_tstrcpy(temp, L"/mode ");
mir_tstrcat(temp, window);
mir_tstrcat(temp, L" ");
@@ -1205,8 +1205,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
void CManagerDlg::OnApplyTopic(CCtrlButton*)
{
- TCHAR temp[470];
- TCHAR window[256];
+ wchar_t temp[470];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
m_topic.GetText(temp, _countof(temp));
m_proto->PostIrcMessage(L"/TOPIC %s %s", window, temp);
@@ -1242,10 +1242,10 @@ void CManagerDlg::OnRadio(CCtrlData*)
void CManagerDlg::ApplyQuestion()
{
- TCHAR window[256];
+ wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- TCHAR mode[3];
+ wchar_t mode[3];
mir_tstrcpy(mode, L"+b");
if (m_radio2.GetState())
mir_tstrcpy(mode, L"+I");
@@ -1270,14 +1270,14 @@ void CManagerDlg::CloseQuestion()
}
}
-void CManagerDlg::InitManager(int mode, const TCHAR* window)
+void CManagerDlg::InitManager(int mode, const wchar_t* window)
{
SetDlgItemText(m_hwnd, IDC_CAPTION, window);
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (m_proto->IsConnected()) {
- TCHAR temp[1000];
+ wchar_t temp[1000];
mir_sntprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
char* p = mir_t2a(temp);
@@ -1306,7 +1306,7 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window)
m_add.Enable();
bool add = false;
- TCHAR* p1 = wi->pszMode;
+ wchar_t* p1 = wi->pszMode;
if (p1) {
while (*p1 != '\0' && *p1 != ' ') {
if (*p1 == '+')