diff options
Diffstat (limited to 'protocols/IRCG/src')
-rw-r--r-- | protocols/IRCG/src/clist.cpp | 28 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 258 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 96 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 18 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.h | 32 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 32 | ||||
-rw-r--r-- | protocols/IRCG/src/options.cpp | 62 | ||||
-rw-r--r-- | protocols/IRCG/src/output.cpp | 10 | ||||
-rw-r--r-- | protocols/IRCG/src/scripting.cpp | 12 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 62 | ||||
-rw-r--r-- | protocols/IRCG/src/stdafx.h | 68 | ||||
-rw-r--r-- | protocols/IRCG/src/tools.cpp | 82 | ||||
-rw-r--r-- | protocols/IRCG/src/userinfo.cpp | 36 | ||||
-rw-r--r-- | protocols/IRCG/src/windows.cpp | 56 |
14 files changed, 426 insertions, 426 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index c4f076d1c7..8ef7cab404 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port)
+BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmask, unsigned long adr, int port)
{
MCONTACT hContact;
wchar_t szNick[256];
@@ -34,7 +34,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, 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;
+ CMStringW contactname = name; contactname += DCCSTRING;
CONTACT user = { (wchar_t*)contactname.c_str(), NULL, NULL, false, false, true };
hContact = CList_AddContact(&user, false, false);
@@ -89,7 +89,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) if (hContact) {
if (InList)
db_unset(hContact, "CList", "NotOnList");
- setTString(hContact, "Nick", user->name);
+ setWString(hContact, "Nick", user->name);
db_unset(hContact, "CList", "Hidden");
if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
@@ -106,8 +106,8 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) else
db_set_b(hContact, "CList", "NotOnList", 1);
db_unset(hContact, "CList", "Hidden");
- setTString(hContact, "Nick", user->name);
- setTString(hContact, "Default", user->name);
+ setWString(hContact, "Nick", user->name);
+ setWString(hContact, "Default", user->name);
setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
if (!InList && getByte("MirVerAutoRequestTemp", 0))
PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", user->name);
@@ -121,10 +121,10 @@ MCONTACT CIrcProto::CList_SetOffline(CONTACT *user) MCONTACT hContact = CList_FindContact(user);
if (hContact) {
DBVARIANT dbv;
- if (!getTString(hContact, "Default", &dbv)) {
+ if (!getWString(hContact, "Default", &dbv)) {
setString(hContact, "User", "");
setString(hContact, "Host", "");
- setTString(hContact, "Nick", dbv.ptszVal);
+ setWString(hContact, "Nick", dbv.ptszVal);
setWord(hContact, "Status", ID_STATUS_OFFLINE);
db_free(&dbv);
return hContact;
@@ -148,8 +148,8 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) if (ChatsToo)
setWord(hContact, "Status", ID_STATUS_OFFLINE);
}
- else if (!getTString(hContact, "Default", &dbv)) {
- setTString(hContact, "Nick", dbv.ptszVal);
+ else if (!getWString(hContact, "Default", &dbv)) {
+ setWString(hContact, "Nick", dbv.ptszVal);
setWord(hContact, "Status", ID_STATUS_OFFLINE);
db_free(&dbv);
}
@@ -173,11 +173,11 @@ MCONTACT CIrcProto::CList_FindContact(CONTACT *user) continue;
MCONTACT hContact_temp = NULL;
- ptrW DBNick(getTStringA(hContact, "Nick"));
- ptrW DBUser(getTStringA(hContact, "UUser"));
- ptrW DBHost(getTStringA(hContact, "UHost"));
- ptrW DBDefault(getTStringA(hContact, "Default"));
- ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBNick(getWStringA(hContact, "Nick"));
+ ptrW DBUser(getWStringA(hContact, "UUser"));
+ ptrW DBHost(getWStringA(hContact, "UHost"));
+ ptrW DBDefault(getWStringA(hContact, "Default"));
+ ptrW DBWildcard(getWStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index ab36e0d46e..cfd91e12b1 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -93,7 +93,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) return;
}
- CMString name = GetWord(ppro->m_channelsToWho.c_str(), 0);
+ CMStringW name = GetWord(ppro->m_channelsToWho.c_str(), 0);
if (name.IsEmpty()) {
ppro->m_channelsToWho = L"";
int count = (int)CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)ppro->m_szModuleName);
@@ -104,7 +104,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) gci.pszModule = ppro->m_szModuleName;
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM)
if (gci.iCount <= ppro->m_onlineNotificationLimit)
- ppro->m_channelsToWho += CMString(gci.pszName) + L" ";
+ ppro->m_channelsToWho += CMStringW(gci.pszName) + L" ";
}
}
@@ -115,7 +115,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) name = GetWord(ppro->m_channelsToWho.c_str(), 0);
ppro->DoUserhostWithReason(2, L"S" + name, true, L"%s", name.c_str());
- CMString temp = GetWordAddress(ppro->m_channelsToWho.c_str(), 1);
+ CMStringW temp = GetWordAddress(ppro->m_channelsToWho.c_str(), 1);
ppro->m_channelsToWho = temp;
if (ppro->m_iTempCheckTime)
ppro->SetChatTimer(ppro->OnlineNotifTimer3, ppro->m_iTempCheckTime * 1000, OnlineNotifTimerProc3);
@@ -136,8 +136,8 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) return;
}
- CMString name = GetWord(ppro->m_namesToWho.c_str(), 0);
- CMString name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0);
+ CMStringW name = GetWord(ppro->m_namesToWho.c_str(), 0);
+ CMStringW name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0);
if (name.IsEmpty() && name2.IsEmpty()) {
DBVARIANT dbv;
@@ -149,14 +149,14 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0);
if (bDCC || bHidden)
continue;
- if (ppro->getTString(hContact, "Default", &dbv))
+ if (ppro->getWString(hContact, "Default", &dbv))
continue;
BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0);
if (!bAdvanced) {
db_free(&dbv);
- if (!ppro->getTString(hContact, "Nick", &dbv)) {
- ppro->m_namesToUserhost += CMString(dbv.ptszVal) + L" ";
+ if (!ppro->getWString(hContact, "Nick", &dbv)) {
+ ppro->m_namesToUserhost += CMStringW(dbv.ptszVal) + L" ";
db_free(&dbv);
}
}
@@ -166,15 +166,15 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) wchar_t* DBNick = NULL;
wchar_t* DBWildcard = NULL;
- if (!ppro->getTString(hContact, "Nick", &dbv))
+ if (!ppro->getWString(hContact, "Nick", &dbv))
DBNick = dbv.ptszVal;
- if (!ppro->getTString(hContact, "UWildcard", &dbv2))
+ if (!ppro->getWString(hContact, "UWildcard", &dbv2))
DBWildcard = dbv2.ptszVal;
if (DBNick && (!DBWildcard || !WCCmp(CharLower(DBWildcard), CharLower(DBNick))))
- ppro->m_namesToWho += CMString(DBNick) + L" ";
+ ppro->m_namesToWho += CMStringW(DBNick) + L" ";
else if (DBWildcard)
- ppro->m_namesToWho += CMString(DBWildcard) + L" ";
+ ppro->m_namesToWho += CMStringW(DBWildcard) + L" ";
if (DBNick) db_free(&dbv);
if (DBWildcard) db_free(&dbv2);
@@ -189,7 +189,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) name = GetWord(ppro->m_namesToWho.c_str(), 0);
name2 = GetWord(ppro->m_namesToUserhost.c_str(), 0);
- CMString temp;
+ CMStringW temp;
if (!name.IsEmpty()) {
ppro->DoUserhostWithReason(2, L"S" + name, true, L"%s", name.c_str());
temp = GetWordAddress(ppro->m_namesToWho.c_str(), 1);
@@ -197,14 +197,14 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) }
if (!name2.IsEmpty()) {
- CMString params;
+ CMStringW params;
for (int i = 0; i < 3; i++) {
params = L"";
for (int j = 0; j < 5; j++)
params += GetWord(ppro->m_namesToUserhost, i * 5 + j) + L" ";
if (params[0] != ' ')
- ppro->DoUserhostWithReason(1, CMString(L"S") + params, true, params);
+ ppro->DoUserhostWithReason(1, CMStringW(L"S") + params, true, params);
}
temp = GetWordAddress(ppro->m_namesToUserhost.c_str(), 15);
ppro->m_namesToUserhost = temp;
@@ -221,7 +221,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg) if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
- CMString S = DoColorCodes(msg, TRUE, FALSE);
+ CMStringW S = DoColorCodes(msg, TRUE, FALSE);
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
@@ -274,7 +274,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
static wchar_t host[1024];
int i = 0;
- CMString word = GetWord(pmsg->parameters[1].c_str(), i);
+ CMStringW word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (wcschr(word.c_str(), '!') && wcschr(word.c_str(), '@')) {
mir_wstrncpy(host, word.c_str(), _countof(host));
@@ -293,7 +293,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHOTOOLONG(const CIrcMessage* pmsg)
{
- CMString command = GetNextUserhostReason(2);
+ CMStringW command = GetNextUserhostReason(2);
if (command[0] == 'U')
ShowMessage(pmsg);
@@ -357,7 +357,7 @@ bool CIrcProto::OnIrc_SETAWAY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_JOIN(const CIrcMessage* pmsg)
{
if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming && pmsg->prefix.sNick != m_info.sNick) {
- CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
+ CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_JOIN, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), NULL, L"Normal", host.c_str(), NULL, true, false);
DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
}
@@ -369,7 +369,7 @@ bool CIrcProto::OnIrc_JOIN(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming) {
- CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
+ CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_QUIT, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
struct CONTACT user = { (LPTSTR)pmsg->prefix.sNick.c_str(), (LPTSTR)pmsg->prefix.sUser.c_str(), (LPTSTR)pmsg->prefix.sHost.c_str(), false, false, false };
CList_SetOffline(&user);
@@ -387,10 +387,10 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg)
{
if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming) {
- CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
+ CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_PART, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
if (pmsg->prefix.sNick == m_info.sNick) {
- CMString S = MakeWndID(pmsg->parameters[0].c_str());
+ CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce);
@@ -409,7 +409,7 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) ShowMessage(pmsg);
if (pmsg->parameters[1] == m_info.sNick) {
- CMString S = MakeWndID(pmsg->parameters[0].c_str());
+ CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce);
@@ -429,8 +429,8 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_MODEQUERY(const CIrcMessage* pmsg)
{
if (pmsg->parameters.getCount() > 2 && pmsg->m_bIncoming && IsChannel(pmsg->parameters[1])) {
- CMString sPassword = L"";
- CMString sLimit = L"";
+ CMStringW sPassword = L"";
+ CMStringW sLimit = L"";
bool bAdd = false;
int iParametercount = 3;
@@ -464,8 +464,8 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) {
bool flag = false;
bool bContainsValidModes = false;
- CMString sModes = L"";
- CMString sParams = L"";
+ CMStringW sModes = L"";
+ CMStringW sParams = L"";
if (pmsg->parameters.getCount() > 1 && pmsg->m_bIncoming) {
if (IsChannel(pmsg->parameters[0])) {
@@ -495,7 +495,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) iParametercount++;
}
if (strchr(sUserModes.c_str(), (char)*p1)) {
- CMString sStatus = ModeToStatus(*p1);
+ CMStringW sStatus = ModeToStatus(*p1);
if ((int)pmsg->parameters.getCount() > iParametercount) {
if (!mir_wstrcmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
char cModeBit = -1;
@@ -535,7 +535,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) mir_snwprintf(temp, TranslateT("%s sets mode %s"),
pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
- CMString sMessage = temp;
+ CMStringW sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
sMessage += L" " + pmsg->parameters[i];
@@ -557,7 +557,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg) wchar_t temp[256];
mir_snwprintf(temp, TranslateT("%s sets mode %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str());
- CMString sMessage = temp;
+ CMStringW sMessage = temp;
for (int i = 2; i < (int)pmsg->parameters.getCount(); i++)
sMessage += L" " + pmsg->parameters[i];
@@ -576,10 +576,10 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) if (m_info.sNick == pmsg->prefix.sNick && pmsg->parameters.getCount() > 0) {
m_info.sNick = pmsg->parameters[0];
- setTString("Nick", m_info.sNick.c_str());
+ setWString("Nick", m_info.sNick.c_str());
}
- CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
+ CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
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);
@@ -588,9 +588,9 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) if (hContact) {
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
- setTString(hContact, "Nick", pmsg->parameters[0].c_str());
- setTString(hContact, "User", pmsg->prefix.sUser.c_str());
- setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
+ setWString(hContact, "Nick", pmsg->parameters[0].c_str());
+ setWString(hContact, "User", pmsg->prefix.sUser.c_str());
+ setWString(hContact, "Host", pmsg->prefix.sHost.c_str());
}
}
else ShowMessage(pmsg);
@@ -605,9 +605,9 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) return true;
if (!m_ignore || !IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'n')) {
- CMString S;
- CMString S2;
- CMString S3;
+ CMStringW S;
+ CMStringW S2;
+ CMStringW S3;
if (pmsg->prefix.sNick.GetLength() > 0)
S = pmsg->prefix.sNick;
else
@@ -620,11 +620,11 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) gci.Flags = GCF_BYID | GCF_TYPE;
gci.pszModule = m_szModuleName;
- CMString str = GetWord(pmsg->parameters[1].c_str(), 0);
+ CMStringW str = GetWord(pmsg->parameters[1].c_str(), 0);
if (str[0] == '[' && str[1] == '#' && str[str.GetLength() - 1] == ']') {
str.Delete(str.GetLength() - 1, 1);
str.Delete(0, 1);
- CMString Wnd = MakeWndID(str.c_str());
+ CMStringW Wnd = MakeWndID(str.c_str());
gci.pszID = Wnd.c_str();
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM)
S2 = GetWord(gci.pszID, 0);
@@ -685,7 +685,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) if (IsCTCP(pmsg))
return true;
- CMString mess = pmsg->parameters[1];
+ CMStringW mess = pmsg->parameters[1];
bool bIsChannel = IsChannel(pmsg->parameters[0]);
if (pmsg->m_bIncoming && !bIsChannel) {
@@ -708,8 +708,8 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) PROTORECVEVENT pre = { 0 };
pre.timestamp = (DWORD)time(NULL);
pre.szMessage = mir_utf8encodeW(mess.c_str());
- setTString(hContact, "User", pmsg->prefix.sUser.c_str());
- setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
+ setWString(hContact, "User", pmsg->prefix.sUser.c_str());
+ setWString(hContact, "Host", pmsg->prefix.sHost.c_str());
ProtoChainRecvMsg(hContact, &pre);
mir_free(pre.szMessage);
return true;
@@ -732,7 +732,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
{
// is it a ctcp command, i e is the first and last characer of a PRIVMSG or NOTICE text ASCII 1
- CMString mess = pmsg->parameters[1];
+ CMStringW mess = pmsg->parameters[1];
if (!(mess.GetLength() > 3 && mess[0] == 1 && mess[mess.GetLength() - 1] == 1))
return false;
@@ -749,8 +749,8 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
// extract the type of ctcp command
- CMString ocommand = GetWord(mess.c_str(), 0);
- CMString command = GetWord(mess.c_str(), 0);
+ CMStringW ocommand = GetWord(mess.c_str(), 0);
+ CMStringW command = GetWord(mess.c_str(), 0);
command.MakeLower();
// should it be ignored?
@@ -854,15 +854,15 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // incoming DCC request... lots of stuff happening here...
else if (pmsg->m_bIncoming && command == L"dcc") {
- CMString type = GetWord(mess.c_str(), 1);
+ CMStringW type = GetWord(mess.c_str(), 1);
type.MakeLower();
// components of a dcc message
- CMString sFile = L"";
+ CMStringW sFile = L"";
DWORD dwAdr = 0;
int iPort = 0;
unsigned __int64 dwSize = 0;
- CMString sToken = L"";
+ CMStringW sToken = L"";
bool bIsChat = (type == L"chat");
// 1. separate the dcc command into the correct pieces
@@ -878,7 +878,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
- CMString rest = mess.Mid(begin);
+ CMStringW rest = mess.Mid(begin);
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());
@@ -894,7 +894,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // look for the part of the ctcp command that contains adress, port and size
while (!bFlag && !GetWord(mess.c_str(), index).IsEmpty()) {
- CMString sTemp;
+ CMStringW sTemp;
if (type == L"chat")
sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index);
@@ -951,7 +951,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
- CMString rest = mess.Mid(begin);
+ CMStringW rest = mess.Mid(begin);
iPort = _wtoi(GetWord(rest.c_str(), 0).c_str());
dwSize = _wtoi(GetWord(rest.c_str(), 1).c_str());
sToken = GetWord(rest.c_str(), 2);
@@ -966,7 +966,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // look for the part of the ctcp command that contains adress, port and size
while (!bFlag && !GetWord(mess.c_str(), index).IsEmpty()) {
- CMString sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index);
+ CMStringW sTemp = GetWord(mess.c_str(), index - 1) + GetWord(mess.c_str(), index);
// if all characters are number it indicates we have found the adress, port and size parameters
int ind = 0;
@@ -1033,7 +1033,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
// remove path from the filename if the remote client (stupidly) sent it
- CMString sFileCorrected = sFile;
+ CMStringW sFileCorrected = sFile;
int i = sFile.ReverseFind('\\');
if (i != -1)
sFileCorrected = sFile.Mid(i + 1);
@@ -1055,7 +1055,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
// remove path from the filename if the remote client (stupidly) sent it
- CMString sFileCorrected = sFile;
+ CMStringW sFileCorrected = sFile;
int i = sFile.ReverseFind('\\');
if (i != -1)
sFileCorrected = sFile.Mid(i + 1);
@@ -1074,7 +1074,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) m_DCCChatIgnore == 2 && hContact &&
db_get_b(hContact, "CList", "NotOnList", 0) == 0 &&
db_get_b(hContact, "CList", "Hidden", 0) == 0) {
- CMString host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
+ CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
}
else {
@@ -1115,7 +1115,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) }
if (type == L"send") {
- CMString sTokenBackup = sToken;
+ CMStringW sTokenBackup = sToken;
bool bTurbo = false; // TDCC indicator
if (!sToken.IsEmpty() && sToken[sToken.GetLength() - 1] == 'T') {
@@ -1157,13 +1157,13 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) if (di->bReverse)
di->sToken = sTokenBackup;
- setTString(hContact, "User", pmsg->prefix.sUser.c_str());
- setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
+ setWString(hContact, "User", pmsg->prefix.sUser.c_str());
+ setWString(hContact, "Host", pmsg->prefix.sHost.c_str());
wchar_t* tszTemp = (wchar_t*)sFile.c_str();
PROTORECVFILET pre = { 0 };
- pre.dwFlags = PRFF_TCHAR;
+ pre.dwFlags = PRFF_UNICODE;
pre.timestamp = (DWORD)time(NULL);
pre.fileCount = 1;
pre.files.w = &tszTemp;
@@ -1191,7 +1191,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) 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));
+ setWString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE));
}
// if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
@@ -1244,7 +1244,7 @@ bool CIrcProto::OnIrc_NAMES(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
- CMString name = L"a";
+ CMStringW name = L"a";
int i = 0;
BOOL bFlag = false;
@@ -1270,7 +1270,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) sChanName++;
// Add a new chat window
- CMString sID = MakeWndID(sChanName);
+ CMStringW sID = MakeWndID(sChanName);
BYTE btOwnMode = 0;
GCSESSION gcw = { sizeof(gcw) };
@@ -1300,12 +1300,12 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) CallChatEvent(0, (LPARAM)&gce);
{
int k = 0;
- CMString sTemp = GetWord(sNamesList.c_str(), k);
+ CMStringW sTemp = GetWord(sNamesList.c_str(), k);
// Fill the nicklist
while (!sTemp.IsEmpty()) {
- CMString sStat;
- CMString sTemp2 = sTemp;
+ CMStringW sStat;
+ CMStringW sTemp2 = sTemp;
sStat = PrefixToStatus(sTemp[0]);
// fix for networks like freshirc where they allow more than one prefix
@@ -1386,16 +1386,16 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) gce.time = time(0);
gce.pDest = &gcd;
- if (!getTString("JTemp", &dbv)) {
- CMString command = L"a";
- CMString save = L"";
+ if (!getWString("JTemp", &dbv)) {
+ CMStringW command = L"a";
+ CMStringW save = L"";
int k = 0;
while (!command.IsEmpty()) {
command = GetWord(dbv.ptszVal, k);
k++;
if (!command.IsEmpty()) {
- CMString S = command.Mid(1);
+ CMStringW S = command.Mid(1);
if (!mir_wstrcmpi(sChanName, S))
break;
@@ -1422,7 +1422,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) if (save.IsEmpty())
db_unset(NULL, m_szModuleName, "JTemp");
else
- setTString("JTemp", save.c_str());
+ setWString("JTemp", save.c_str());
db_free(&dbv);
}
else CallChatEvent(SESSION_INITDONE, (LPARAM)&gce);
@@ -1533,7 +1533,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg) }
lvItem.iSubItem = 3;
- CMString S = DoColorCodes(temp, TRUE, FALSE);
+ CMStringW S = DoColorCodes(temp, TRUE, FALSE);
lvItem.pszText = (wchar_t*)S.c_str();
ListView_SetItem(hListView, &lvItem);
temp = save;
@@ -1587,7 +1587,7 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg) m_managerDlg->m_radio2.GetState() && pmsg->sCommand == L"346" ||
m_managerDlg->m_radio3.GetState() && pmsg->sCommand == L"348") &&
!m_managerDlg->m_radio1.Enabled() && !m_managerDlg->m_radio2.Enabled() && !m_managerDlg->m_radio3.Enabled()) {
- CMString S = pmsg->parameters[2];
+ CMStringW S = pmsg->parameters[2];
if (pmsg->parameters.getCount() > 3) {
S += L" - ";
S += pmsg->parameters[3];
@@ -1767,21 +1767,21 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) CONTACT user = { (wchar_t*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact) {
- AddOutgoingMessageToDB(hContact, (wchar_t*)((CMString)L"> " + pmsg->parameters[2] + (CMString)L": " + pmsg->parameters[1]).c_str());
+ AddOutgoingMessageToDB(hContact, (wchar_t*)((CMStringW)L"> " + pmsg->parameters[2] + (CMStringW)L": " + pmsg->parameters[1]).c_str());
DBVARIANT dbv;
- if (!getTString(hContact, "Default", &dbv)) {
- setTString(hContact, "Nick", dbv.ptszVal);
+ if (!getWString(hContact, "Default", &dbv)) {
+ setWString(hContact, "Nick", dbv.ptszVal);
DBVARIANT dbv2;
if (getByte(hContact, "AdvancedMode", 0) == 0)
- DoUserhostWithReason(1, ((CMString)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal);
+ DoUserhostWithReason(1, ((CMStringW)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal);
else {
- if (!getTString(hContact, "UWildcard", &dbv2)) {
- DoUserhostWithReason(2, ((CMString)L"S" + dbv2.ptszVal).c_str(), true, dbv2.ptszVal);
+ if (!getWString(hContact, "UWildcard", &dbv2)) {
+ DoUserhostWithReason(2, ((CMStringW)L"S" + dbv2.ptszVal).c_str(), true, dbv2.ptszVal);
db_free(&dbv2);
}
- else DoUserhostWithReason(2, ((CMString)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal);
+ else DoUserhostWithReason(2, ((CMStringW)L"S" + dbv.ptszVal).c_str(), true, dbv.ptszVal);
}
setString(hContact, "User", "");
setString(hContact, "Host", "");
@@ -1833,9 +1833,9 @@ bool CIrcProto::OnIrc_JOINERROR(const CIrcMessage* pmsg) {
if (pmsg->m_bIncoming) {
DBVARIANT dbv;
- if (!getTString("JTemp", &dbv)) {
- CMString command = L"a";
- CMString save = L"";
+ if (!getWString("JTemp", &dbv)) {
+ CMStringW command = L"a";
+ CMStringW save = L"";
int i = 0;
while (!command.IsEmpty()) {
@@ -1851,7 +1851,7 @@ bool CIrcProto::OnIrc_JOINERROR(const CIrcMessage* pmsg) if (save.IsEmpty())
db_unset(NULL, m_szModuleName, "JTemp");
else
- setTString("JTemp", save.c_str());
+ setWString("JTemp", save.c_str());
}
}
@@ -1899,7 +1899,7 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) msn.szProto = m_szModuleName;
msn.tszInfoTitle = TranslateT("IRC error");
- CMString S;
+ CMStringW S;
if (pmsg->parameters.getCount() > 0)
S = DoColorCodes(pmsg->parameters[0].c_str(), TRUE, FALSE);
else
@@ -1916,13 +1916,13 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg)
{
- CMString command = GetNextUserhostReason(2);
+ CMStringW command = GetNextUserhostReason(2);
if (command[0] == 'S') {
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
// is it a channel?
if (IsChannel(pmsg->parameters[1])) {
- CMString S;
- CMString User = GetWord(m_whoReply.c_str(), 0);
+ CMStringW S;
+ CMStringW User = GetWord(m_whoReply.c_str(), 0);
while (!User.IsEmpty()) {
if (GetWord(m_whoReply.c_str(), 3)[0] == 'G') {
S += User;
@@ -1931,7 +1931,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) }
else DoEvent(GC_EVENT_SETCONTACTSTATUS, pmsg->parameters[1].c_str(), User.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
- CMString SS = GetWordAddress(m_whoReply.c_str(), 4);
+ CMStringW SS = GetWordAddress(m_whoReply.c_str(), 4);
if (SS.IsEmpty())
break;
m_whoReply = SS;
@@ -1950,20 +1950,20 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) MCONTACT hContact = CList_FindContact(&ccUser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) {
- ptrW DBHost(getTStringA(hContact, "UHost"));
- ptrW DBNick(getTStringA(hContact, "Nick"));
- ptrW DBUser(getTStringA(hContact, "UUser"));
- ptrW DBDefault(getTStringA(hContact, "Default"));
- ptrW DBManUser(getTStringA(hContact, "User"));
- ptrW DBManHost(getTStringA(hContact, "Host"));
- ptrW DBWildcard(getTStringA(hContact, "UWildcard"));
+ ptrW DBHost(getWStringA(hContact, "UHost"));
+ ptrW DBNick(getWStringA(hContact, "Nick"));
+ ptrW DBUser(getWStringA(hContact, "UUser"));
+ ptrW DBDefault(getWStringA(hContact, "Default"));
+ ptrW DBManUser(getWStringA(hContact, "User"));
+ ptrW DBManHost(getWStringA(hContact, "Host"));
+ ptrW DBWildcard(getWStringA(hContact, "UWildcard"));
if (DBWildcard)
CharLower(DBWildcard);
- CMString nick;
- CMString user;
- CMString host;
- CMString away = GetWord(p1, 3);
+ CMStringW nick;
+ CMStringW user;
+ CMStringW host;
+ CMStringW away = GetWord(p1, 3);
while (!away.IsEmpty()) {
nick = GetWord(p1, 0);
@@ -1977,11 +1977,11 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) setWord(hContact, "Status", ID_STATUS_ONLINE);
if ((DBNick && mir_wstrcmpi(nick.c_str(), DBNick)) || !DBNick)
- setTString(hContact, "Nick", nick.c_str());
+ setWString(hContact, "Nick", nick.c_str());
if ((DBManUser && mir_wstrcmpi(user.c_str(), DBManUser)) || !DBManUser)
- setTString(hContact, "User", user.c_str());
+ setWString(hContact, "User", user.c_str());
if ((DBManHost && mir_wstrcmpi(host.c_str(), DBManHost)) || !DBManHost)
- setTString(hContact, "Host", host.c_str());
+ setWString(hContact, "Host", host.c_str());
return true;
}
p1 = GetWordAddress(p1, 4);
@@ -1989,9 +1989,9 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) }
if (DBWildcard && DBNick && !WCCmp(CharLower(DBWildcard), CharLower(DBNick))) {
- setTString(hContact, "Nick", DBDefault);
+ setWString(hContact, "Nick", DBDefault);
- DoUserhostWithReason(2, ((CMString)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard);
+ DoUserhostWithReason(2, ((CMStringW)L"S" + DBWildcard).c_str(), true, (wchar_t*)DBWildcard);
setString(hContact, "User", "");
setString(hContact, "Host", "");
@@ -2000,7 +2000,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
- setTString(hContact, "Nick", DBDefault);
+ setWString(hContact, "Nick", DBDefault);
setString(hContact, "User", "");
setString(hContact, "Host", "");
}
@@ -2013,7 +2013,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg)
{
- CMString command = PeekAtReasons(2);
+ CMStringW command = PeekAtReasons(2);
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 6 && command[0] == 'S') {
m_whoReply.AppendFormat(L"%s %s %s %s ", pmsg->parameters[5].c_str(), pmsg->parameters[2].c_str(), pmsg->parameters[3].c_str(), pmsg->parameters[6].c_str());
if (mir_wstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
@@ -2030,7 +2030,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_TRYAGAIN(const CIrcMessage* pmsg)
{
- CMString command = L"";
+ CMStringW command = L"";
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1) {
if (pmsg->parameters[1] == L"WHO")
command = GetNextUserhostReason(2);
@@ -2045,27 +2045,27 @@ bool CIrcProto::OnIrc_TRYAGAIN(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg)
{
- CMString command;
+ CMStringW command;
if (pmsg->m_bIncoming) {
command = GetNextUserhostReason(1);
if (!command.IsEmpty() && command != L"U" && pmsg->parameters.getCount() > 1) {
CONTACT finduser = { NULL, NULL, NULL, false, false, false };
int awaystatus = 0;
- CMString sTemp;
- CMString host;
- CMString user;
- CMString nick;
- CMString mask;
- CMString mess;
- CMString channel;
+ CMStringW sTemp;
+ CMStringW host;
+ CMStringW user;
+ CMStringW nick;
+ CMStringW mask;
+ CMStringW mess;
+ CMStringW channel;
// Status-check pre-processing: Setup check-list
- OBJLIST<CMString> checklist(10);
+ OBJLIST<CMStringW> checklist(10);
if (command[0] == 'S') {
sTemp = GetWord(command.c_str(), 0);
sTemp.Delete(0, 1);
for (int j = 1; !sTemp.IsEmpty(); j++) {
- checklist.insert(new CMString(sTemp));
+ checklist.insert(new CMStringW(sTemp));
sTemp = GetWord(command.c_str(), j);
}
}
@@ -2113,9 +2113,9 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) MCONTACT hContact = CList_FindContact(&finduser);
if (hContact && getByte(hContact, "AdvancedMode", 0) == 0) {
setWord(hContact, "Status", awaystatus == '-' ? ID_STATUS_AWAY : ID_STATUS_ONLINE);
- setTString(hContact, "User", user.c_str());
- setTString(hContact, "Host", host.c_str());
- setTString(hContact, "Nick", nick.c_str());
+ setWString(hContact, "User", user.c_str());
+ setWString(hContact, "Host", host.c_str());
+ setWString(hContact, "Nick", nick.c_str());
// If user found, remove from checklist
for (int i = 0; i < checklist.getCount(); i++)
@@ -2128,7 +2128,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) case 'I': // m_ignore
mess = L"/IGNORE %question=\"";
mess += TranslateT("Please enter the hostmask (nick!user@host)\nNOTE! Contacts on your contact list are never ignored");
- mess += (CMString)L"\",\"" + TranslateT("Ignore") + L"\",\"*!*@" + host + L"\"";
+ mess += (CMStringW)L"\",\"" + TranslateT("Ignore") + L"\",\"*!*@" + host + L"\"";
if (m_ignoreChannelDefault)
mess += L" +qnidcm";
else
@@ -2201,7 +2201,7 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg) DoOnConnect(pmsg);
if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 0) {
- CMString S;
+ CMStringW S;
for (int i = 0; i < pmsg->parameters.getCount(); i++) {
wchar_t* temp = mir_wstrdup(pmsg->parameters[i].c_str());
if (wcsstr(temp, L"CHANTYPES=")) {
@@ -2286,7 +2286,7 @@ void CIrcProto::OnIrcDisconnected() m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)Temp, ID_STATUS_OFFLINE);
- CMString sDisconn = L"\035\002";
+ CMStringW sDisconn = L"\035\002";
sDisconn += TranslateT("*Disconnected*");
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, sDisconn.c_str(), NULL, NULL, NULL, true, false);
@@ -2299,7 +2299,7 @@ void CIrcProto::OnIrcDisconnected() // restore the original nick, cause it might be changed
memcpy(m_nick, m_pNick, sizeof(m_nick));
- setTString("Nick", m_pNick);
+ setWString("Nick", m_pNick);
Menu_EnableItem(hMenuJoin, false);
Menu_EnableItem(hMenuList, false);
@@ -2393,7 +2393,7 @@ int CIrcProto::DoPerform(const char* event) sSetting.MakeUpper();
DBVARIANT dbv;
- if (!getTString(sSetting.c_str(), &dbv)) {
+ if (!getWString(sSetting.c_str(), &dbv)) {
if (!my_strstri(dbv.ptszVal, L"/away"))
PostIrcMessageWnd(NULL, NULL, dbv.ptszVal);
else
@@ -2404,12 +2404,12 @@ int CIrcProto::DoPerform(const char* event) return 0;
}
-int CIrcProto::IsIgnored(const CMString& nick, const CMString& address, const CMString& host, char type)
+int CIrcProto::IsIgnored(const CMStringW& nick, const CMStringW& address, const CMStringW& host, char type)
{
return IsIgnored(nick + L"!" + address + L"@" + host, type);
}
-int CIrcProto::IsIgnored(CMString user, char type)
+int CIrcProto::IsIgnored(CMStringW user, char type)
{
for (int i = 0; i < m_ignoreItems.getCount(); i++) {
const CIrcIgnoreItem& C = m_ignoreItems[i];
@@ -2440,7 +2440,7 @@ int CIrcProto::IsIgnored(CMString user, char type) 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));
+ m_ignoreItems.insert(new CIrcIgnoreItem(mask, (L"+" + CMStringW(flags)).c_str(), network));
RewriteIgnoreSettings();
if (m_ignoreDlg)
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index c8deea034a..cbe0852a7c 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -24,19 +24,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NICKSUBSTITUTE L"!_nick_!"
-void CIrcProto::FormatMsg(CMString& text)
+void CIrcProto::FormatMsg(CMStringW& text)
{
wchar_t temp[30];
mir_wstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
- CMString command = temp;
- CMString S = L"";
+ CMStringW command = temp;
+ CMStringW S = L"";
if (command == L"/quit" || command == L"/away")
S = GetWord(text.c_str(), 0) + L" :" + GetWordAddress(text.c_str(), 1);
else if (command == L"/privmsg" || command == L"/part" || command == L"/topic" || command == L"/notice") {
S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" :";
if (!GetWord(text.c_str(), 2).IsEmpty())
- S += CMString(GetWordAddress(text.c_str(), 2));
+ S += CMStringW(GetWordAddress(text.c_str(), 2));
}
else if (command == L"/kick") {
S = GetWord(text.c_str(), 0) + L" " + GetWord(text.c_str(), 1) + L" " + GetWord(text.c_str(), 2) + L" :" + GetWordAddress(text.c_str(), 3);
@@ -47,10 +47,10 @@ void CIrcProto::FormatMsg(CMString& text) S = GetWordAddress(text.c_str(), 0);
}
else {
- CMString sNewNick = GetWord(text.c_str(), 1);
+ CMStringW sNewNick = GetWord(text.c_str(), 1);
if (sNick4Perform == L"") {
DBVARIANT dbv;
- if (!getTString("PNick", &dbv)) {
+ if (!getWString("PNick", &dbv)) {
sNick4Perform = dbv.ptszVal;
db_free(&dbv);
}
@@ -66,15 +66,15 @@ void CIrcProto::FormatMsg(CMString& text) text = S;
}
-static void AddCR(CMString& text)
+static void AddCR(CMStringW& text)
{
text.Replace(L"\n", L"\r\n");
text.Replace(L"\r\r", L"\r");
}
-CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window)
+CMStringW CIrcProto::DoAlias(const wchar_t *text, wchar_t *window)
{
- CMString Messageout = L"";
+ CMStringW Messageout = L"";
const wchar_t* p1 = text;
const wchar_t* p2 = text;
bool LinebreakFlag = false, hasAlias = false;
@@ -82,7 +82,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) if (!p2)
p2 = wcschr(p1, '\0');
if (p1 == p2)
- return (CMString)text;
+ return (CMStringW)text;
do {
if (LinebreakFlag)
@@ -95,14 +95,14 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) test++;
if (*test == '/') {
mir_wstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
- CMString S = line;
+ CMStringW S = line;
delete[] line;
line = new wchar_t[S.GetLength() + 2];
mir_wstrncpy(line, S.c_str(), S.GetLength() + 1);
- CMString alias(m_alias);
+ CMStringW alias(m_alias);
const wchar_t* p3 = wcsstr(alias.c_str(), (GetWord(line, 0) + L" ").c_str());
if (p3 != alias.c_str()) {
- CMString str = L"\r\n";
+ CMStringW str = L"\r\n";
str += GetWord(line, 0) + L" ";
p3 = wcsstr(alias.c_str(), str.c_str());
if (p3)
@@ -115,7 +115,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) p4 = wcschr(p3, '\0');
*(wchar_t*)p4 = 0;
- CMString str = p3;
+ CMStringW str = p3;
str.Replace(L"##", window);
str.Replace(L"$?", L"%question");
@@ -125,7 +125,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
str.Replace(buf, GetWord(line, index).c_str());
else {
- CMString S1 = L"#";
+ CMStringW S1 = L"#";
S1 += GetWord(line, index);
str.Replace(buf, S1.c_str());
}
@@ -158,7 +158,7 @@ CMString CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) return hasAlias ? DoIdentifiers(Messageout, window) : Messageout;
}
-CMString CIrcProto::DoIdentifiers(CMString text, const wchar_t*)
+CMStringW CIrcProto::DoIdentifiers(CMStringW text, const wchar_t*)
{
SYSTEMTIME time;
wchar_t str[2];
@@ -209,13 +209,13 @@ static void __stdcall sttSetTimerOff(void* _pro) ppro->KillChatTimer(ppro->OnlineNotifTimer3);
}
-BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hContact)
+BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact)
{
- CMString command(GetWord(text, 0)); command.MakeLower();
- CMString one = GetWord(text, 1);
- CMString two = GetWord(text, 2);
- CMString three = GetWord(text, 3);
- CMString therest = GetWordAddress(text, 4);
+ CMStringW command(GetWord(text, 0)); command.MakeLower();
+ CMStringW one = GetWord(text, 1);
+ CMStringW two = GetWord(text, 2);
+ CMStringW three = GetWord(text, 3);
+ CMStringW therest = GetWordAddress(text, 4);
if (command == L"/servershow" || command == L"/serverhide") {
if (m_useServer) {
@@ -238,7 +238,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon }
if (command == L"/clear") {
- CMString S;
+ CMStringW S;
if (!one.IsEmpty()) {
if (one == L"server")
S = SERVERWINDOW;
@@ -258,7 +258,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/ignore") {
if (IsConnected()) {
- CMString IgnoreFlags;
+ CMStringW IgnoreFlags;
wchar_t temp[500];
if (one.IsEmpty()) {
if (m_ignore)
@@ -296,7 +296,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon }
else IgnoreFlags = L"qnidc";
- CMString szNetwork;
+ CMStringW szNetwork;
if (three.IsEmpty())
szNetwork = m_info.sNetwork;
else
@@ -334,7 +334,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/joinx") {
if (!one.IsEmpty()) {
for (int i = 1;; i++) {
- CMString tmp = GetWord(text, i);
+ CMStringW tmp = GetWord(text, i);
if (tmp.IsEmpty())
break;
@@ -349,7 +349,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/joinm") {
if (!one.IsEmpty()) {
for (int i = 1;; i++) {
- CMString tmp = GetWord(text, i);
+ CMStringW tmp = GetWord(text, i);
if (tmp.IsEmpty())
break;
@@ -363,7 +363,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (command == L"/nusers") {
wchar_t szTemp[40];
- CMString S = MakeWndID(window);
+ CMStringW S = MakeWndID(window);
GC_INFO gci = { 0 };
gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT;
gci.pszModule = m_szModuleName;
@@ -474,7 +474,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon return true;
}
- CMString S = MakeWndID(window);
+ CMStringW S = MakeWndID(window);
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
@@ -492,7 +492,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon int minutes = (int)m_noOfChannels / 4000;
int minutes2 = (int)m_noOfChannels / 9000;
- CMString szMsg(FORMAT, TranslateT("This command is not recommended on a network of this size!\r\nIt will probably cause high CPU usage and/or high bandwidth\r\nusage for around %u to %u minute(s).\r\n\r\nDo you want to continue?"), minutes2, minutes);
+ CMStringW szMsg(FORMAT, TranslateT("This command is not recommended on a network of this size!\r\nIt will probably cause high CPU usage and/or high bandwidth\r\nusage for around %u to %u minute(s).\r\n\r\nDo you want to continue?"), minutes2, minutes);
if (m_noOfChannels < 4000 || (m_noOfChannels >= 4000 && MessageBox(NULL, szMsg, TranslateT("IRC warning"), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)) {
ListView_DeleteAllItems(GetDlgItem(m_listDlg->GetHwnd(), IDC_INFO_LISTVIEW));
PostIrcMessage(L"/lusers");
@@ -516,7 +516,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty())
return true;
- CMString S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
+ CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
@@ -526,7 +526,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (one.IsEmpty())
return true;
- CMString S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
+ CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
@@ -554,14 +554,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon DoUserhostWithReason(1, (L"S" + one).c_str(), true, one.c_str());
else {
DBVARIANT dbv1;
- if (!getTString(hContact, "UWildcard", &dbv1)) {
- CMString S = L"S";
+ if (!getWString(hContact, "UWildcard", &dbv1)) {
+ CMStringW S = L"S";
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal);
db_free(&dbv1);
}
else {
- CMString S = L"S";
+ CMStringW S = L"S";
S += one;
DoUserhostWithReason(2, S.c_str(), true, one.c_str());
}
@@ -623,14 +623,14 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon CONTACT user = { (wchar_t*)two.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
if (ccNew) {
- CMString s;
+ CMStringW s;
if (getByte(ccNew, "AdvancedMode", 0) == 0)
DoUserhostWithReason(1, (L"S" + two).c_str(), true, two.c_str());
else {
DBVARIANT dbv1;
- CMString S = L"S";
- if (!getTString(ccNew, "UWildcard", &dbv1)) {
+ CMStringW S = L"S";
+ if (!getWString(ccNew, "UWildcard", &dbv1)) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal);
db_free(&dbv1);
@@ -644,7 +644,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon if (three.IsEmpty())
CallService(MS_FILE_SENDFILE, ccNew, 0);
else {
- CMString temp = GetWordAddress(text.c_str(), 3);
+ CMStringW temp = GetWordAddress(text.c_str(), 3);
wchar_t* pp[2];
wchar_t* p = (wchar_t*)temp.c_str();
pp[0] = p;
@@ -670,7 +670,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, wchar_t *window, MCONTACT hCon ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
if (ulAdr) {
- CMString contact = two; contact += DCCSTRING;
+ CMStringW contact = two; contact += DCCSTRING;
CONTACT user = { (wchar_t*)contact.c_str(), NULL, NULL, false, false, true };
MCONTACT ccNew = CList_AddContact(&user, false, false);
setByte(ccNew, "DCC", 1);
@@ -733,7 +733,7 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par) wchar_t* infotext = NULL;
wchar_t* title = NULL;
wchar_t* defaulttext = NULL;
- CMString command = (wchar_t*)str;
+ CMStringW command = (wchar_t*)str;
wchar_t* p = wcsstr((wchar_t*)str, L"%question");
if (p[9] == '=' && p[10] == '\"') {
infotext = &p[11];
@@ -810,7 +810,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (!IsConnected() && !bDCC || !szBuf || mir_wstrlen(szBuf) < 1)
return 0;
- if (hContact && !getTString(hContact, "Nick", &dbv)) {
+ if (hContact && !getWString(hContact, "Nick", &dbv)) {
mir_wstrncpy(windowname, dbv.ptszVal, 255);
db_free(&dbv);
}
@@ -826,7 +826,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha }
// remove unecessary linebreaks, and do the aliases
- CMString Message = szBuf;
+ CMStringW Message = szBuf;
AddCR(Message);
RemoveLinebreaks(Message);
if (!hContact && IsConnected()) {
@@ -851,7 +851,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha while (!Message.IsEmpty()) {
// split the text into lines, and do an automatic textsplit on long lies as well
bool flag = false;
- CMString DoThis = L"";
+ CMStringW DoThis = L"";
int index = Message.Find(L"\r\n", 0);
if (index == -1)
index = Message.GetLength();
@@ -868,7 +868,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if (GetWord(DoThis.c_str(), 1).IsEmpty())
continue;
- CMString S = GetWordAddress(DoThis.c_str(), 1);
+ CMStringW S = GetWordAddress(DoThis.c_str(), 1);
SendIrcMessage(S.c_str(), true, cp);
continue;
}
@@ -877,11 +877,11 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha if ((GetWord(DoThis.c_str(), 0)[0] != '/') || // not a command
((GetWord(DoThis.c_str(), 0)[0] == '/') && (GetWord(DoThis.c_str(), 0)[1] == '/')) || // or double backslash at the beginning
hContact) {
- CMString S = L"/PRIVMSG ";
+ CMStringW S = L"/PRIVMSG ";
if (mir_wstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
S += m_info.sServerName + L" " + DoThis;
else
- S += CMString(windowname) + L" " + DoThis;
+ S += CMStringW(windowname) + L" " + DoThis;
DoThis = S;
flag = true;
@@ -902,7 +902,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha CDccSession* dcc = FindDCCSession(hContact);
if (dcc) {
FormatMsg(DoThis);
- CMString mess = GetWordAddress(DoThis.c_str(), 2);
+ CMStringW mess = GetWordAddress(DoThis.c_str(), 2);
if (mess[0] == ':')
mess.Delete(0, 1);
mess += '\n';
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index ab4430ad42..d734c12ee4 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -59,7 +59,7 @@ CIrcMessage::CIrcMessage(const CIrcMessage& m) : prefix.sHost = m.prefix.sHost; for (int i = 0; i < m.parameters.getCount(); i++) - parameters.insert(new CMString(m.parameters[i])); + parameters.insert(new CMStringW(m.parameters[i])); } CIrcMessage::~CIrcMessage() @@ -145,14 +145,14 @@ end_of_prefix: // seek end-of-message while (*p2) ++p2; - parameters.insert(new CMString(p1, p2 - p1)); + parameters.insert(new CMStringW(p1, p2 - p1)); break; } else { // seek end of parameter while (*p2 && *p2 != ' ') ++p2; - parameters.insert(new CMString(p1, p2 - p1)); + parameters.insert(new CMStringW(p1, p2 - p1)); // see next parameter while (*p2 && *p2 == ' ') ++p2; @@ -232,11 +232,11 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) NLSend("PASS %s\r\n", info.sPassword.c_str()); NLSend(L"NICK %s\r\n", info.sNick.c_str()); - CMString userID = GetWord(info.sUserID.c_str(), 0); + CMStringW userID = GetWord(info.sUserID.c_str(), 0); wchar_t szHostName[MAX_PATH]; DWORD cbHostName = _countof(szHostName); GetComputerName(szHostName, &cbHostName); - CMString HostName = GetWord(szHostName, 0); + CMStringW HostName = GetWord(szHostName, 0); if (userID.IsEmpty()) userID = L"Miranda"; if (HostName.IsEmpty()) @@ -525,7 +525,7 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const wchar_t* szNam for (int i = 0; i < m_dcc_xfers.getCount(); i++) { CDccSession* p = m_dcc_xfers[i]; DBVARIANT dbv; - if (!getTString(p->di->hContact, "Nick", &dbv)) { + if (!getWString(p->di->hContact, "Nick", &dbv)) { if (p->di->iType == DCC_SEND && !p->di->bSender && !mir_wstrcmpi(szName, dbv.ptszVal) && iPort == p->di->iPort) { db_free(&dbv); return p; @@ -548,7 +548,7 @@ CDccSession* CIrcProto::FindPassiveDCCSend(int iToken) return 0; } -CDccSession* CIrcProto::FindPassiveDCCRecv(CMString sName, CMString sToken) +CDccSession* CIrcProto::FindPassiveDCCRecv(CMStringW sName, CMStringW sToken) { mir_cslock lck(m_dcc); @@ -867,7 +867,7 @@ int CDccSession::SetupConnection() 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.flags = PFTS_UNICODE + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); pfts.totalFiles = 1; pfts.currentFileNumber = 0; pfts.totalBytes = di->dwSize; @@ -974,7 +974,7 @@ int CDccSession::SetupConnection() di->iPort = nb.wPort; // store the port internally so it is possible to search for it (for resuming of filetransfers purposes) - CMString sFileWithQuotes = di->sFile; + CMStringW sFileWithQuotes = di->sFile; // if spaces in the filename surround with quotes if (sFileWithQuotes.Find(' ', 0) != -1) { diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 069c545a12..4e46810551 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -38,18 +38,18 @@ struct DCCINFO : public MZeroedObject DWORD dwAdr;
unsigned __int64 dwSize;
DWORD iType;
- CMString sToken;
+ CMStringW sToken;
int iPort;
BOOL bTurbo;
BOOL bSSL;
BOOL bSender;
BOOL bReverse;
- CMString sPath;
- CMString sFile;
- CMString sFileAndPath;
- CMString sHostmask;
+ CMStringW sPath;
+ CMStringW sFile;
+ CMStringW sFileAndPath;
+ CMStringW sHostmask;
MCONTACT hContact;
- CMString sContactName;
+ CMStringW sContactName;
};
class CIrcMessage
@@ -57,13 +57,13 @@ class CIrcMessage public :
struct Prefix
{
- CMString sNick, sUser, sHost;
+ CMStringW sNick, sUser, sHost;
}
prefix;
CIrcProto* m_proto;
- CMString sCommand;
- OBJLIST<CMString> parameters;
+ CMStringW sCommand;
+ OBJLIST<CMStringW> parameters;
bool m_bIncoming;
bool m_bNotify;
int m_codePage;
@@ -87,13 +87,13 @@ private : struct CIrcSessionInfo
{
CMStringA sServer;
- CMString sServerName;
- CMString sNick;
- CMString sUserID;
- CMString sFullName;
+ CMStringW sServerName;
+ CMStringW sNick;
+ CMStringW sUserID;
+ CMStringW sFullName;
CMStringA sPassword;
- CMString sIdentServerType;
- CMString sNetwork;
+ CMStringW sIdentServerType;
+ CMStringW sNetwork;
bool bIdentServer;
bool bNickFlag;
int m_iSSL;
@@ -114,7 +114,7 @@ struct CIrcIgnoreItem CIrcIgnoreItem( int codepage, const char*, const char*, const char* );
~CIrcIgnoreItem();
- CMString mask, flags, network;
+ CMStringW mask, flags, network;
};
////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 2d3b16f50f..222691d3d7 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -179,13 +179,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) db_unset(NULL, m_szModuleName, "JTemp");
nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
+ nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = m_szModuleName;
mir_snwprintf(name, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
+ nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
char szTemp2[256];
mir_snprintf(szTemp2, "%s DCC", m_szModuleName);
nlu.szSettingsModule = szTemp2;
@@ -255,10 +255,10 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < performToConvert.getCount(); i++) {
CMStringA s = performToConvert[i];
DBVARIANT dbv;
- if (!getTString(s, &dbv)) {
+ if (!getWString(s, &dbv)) {
db_unset(NULL, m_szModuleName, s);
s.MakeUpper();
- setTString(s, dbv.ptszVal);
+ setWString(s, dbv.ptszVal);
db_free(&dbv);
}
}
@@ -275,13 +275,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) wchar_t szBuf[40];
if (mir_wstrlen(m_alternativeNick) == 0) {
mir_snwprintf(szBuf, L"%s%u", m_nick, rand() % 9999);
- setTString("AlernativeNick", szBuf);
+ setWString("AlernativeNick", szBuf);
mir_wstrncpy(m_alternativeNick, szBuf, 30);
}
if (mir_wstrlen(m_name) == 0) {
mir_snwprintf(szBuf, L"Miranda%u", rand() % 9999);
- setTString("Name", szBuf);
+ setWString("Name", szBuf);
mir_wstrncpy(m_name, szBuf, 200);
}
}
@@ -305,14 +305,14 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) if (hContact) {
DBVARIANT dbv1;
- CMString S = L"S";
+ CMStringW S = L"S";
if (getByte(hContact, "AdvancedMode", 0) == 0) {
S += user.name;
DoUserhostWithReason(1, S, true, user.name);
}
else {
- if (!getTString(hContact, "UWildcard", &dbv1)) {
+ if (!getWString(hContact, "UWildcard", &dbv1)) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S, true, dbv1.ptszVal);
db_free(&dbv1);
@@ -417,7 +417,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** if (_wstat64(di->sFileAndPath.c_str(), &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
dwPos = statbuf.st_size;
- CMString sFileWithQuotes = di->sFile;
+ CMStringW sFileWithQuotes = di->sFile;
// if spaces in the filename surround witrh quotes
if (sFileWithQuotes.Find(' ', 0) != -1) {
@@ -484,7 +484,7 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg) AckBasicSearchParam *param = (AckBasicSearchParam*)arg;
PROTOSEARCHRESULT psr = { sizeof(psr) };
- psr.flags = PSR_TCHAR;
+ psr.flags = PSR_UNICODE;
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);
@@ -550,7 +550,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** }
DBVARIANT dbv;
- if (!getTString(hContact, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
// set up a basic DCCINFO struct and pass it to a DCC object
dci = new DCCINFO;
dci->sFileAndPath = ppszFiles[index];
@@ -561,7 +561,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** dci->sFile = dci->sFileAndPath.Mid(i + 1);
}
- CMString sFileWithQuotes = dci->sFile;
+ CMStringW sFileWithQuotes = dci->sFile;
// if spaces in the filename surround witrh quotes
if (sFileWithQuotes.Find(' ', 0) != -1) {
@@ -583,7 +583,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** AddDCCSession(dci, dcc);
// need to make sure that %'s are doubled to avoid having chat interpret as color codes
- CMString sFileCorrect = dci->sFile;
+ CMStringW sFileCorrect = dci->sFile;
sFileCorrect.Replace(L"%", L"%%");
// is it an reverse filetransfer (receiver acts as server)
@@ -786,13 +786,13 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact) // bypass chat contacts.
if (!isChatRoom(hContact)) {
- if (hContact && !getTString(hContact, "Nick", &dbv)) {
+ if (hContact && !getWString(hContact, "Nick", &dbv)) {
int i = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (i != ID_STATUS_AWAY) {
db_free(&dbv);
return 0;
}
- CMString S = L"WHOIS ";
+ CMStringW S = L"WHOIS ";
S += dbv.ptszVal;
if (IsConnected())
SendIrcMessage(S.c_str(), false);
@@ -814,7 +814,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg) break;
default:
- CMString newStatus = msg;
+ CMStringW newStatus = msg;
newStatus.Replace(L"\r\n", L" ");
if (m_statusMessage.IsEmpty() || msg == NULL || m_statusMessage != newStatus) {
if (msg == NULL || *msg == 0)
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 9102b14c3a..940251a7ca 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -59,8 +59,8 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count) *(char**)ptr = NULL;
}
break;
- case DBVT_TCHAR:
- if (!getTString(p->name, &dbv)) {
+ case DBVT_WCHAR:
+ if (!getWString(p->name, &dbv)) {
if (p->size != -1) {
size_t len = min(p->size - 1, mir_wstrlen(dbv.ptszVal));
memcpy(ptr, dbv.pszVal, len*sizeof(wchar_t));
@@ -100,11 +100,11 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count ) setString(p->name, (char*)ptr);
break;
- case DBVT_TCHAR:
+ case DBVT_WCHAR:
if (p->size == -1)
- setTString(p->name, *(wchar_t**)ptr);
+ setWString(p->name, *(wchar_t**)ptr);
else
- setTString(p->name, (wchar_t*)ptr);
+ setWString(p->name, (wchar_t*)ptr);
break;
} } }
@@ -398,9 +398,9 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto> static TDbSetting ConnectSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, _countof(pZero->m_userID) },
- { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, _countof(pZero->m_identSystem) },
- { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, _countof(pZero->m_identPort) },
+ { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_WCHAR, _countof(pZero->m_userID) },
+ { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_WCHAR, _countof(pZero->m_identSystem) },
+ { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_WCHAR, _countof(pZero->m_identPort) },
{ FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, _countof(pZero->m_serverName) },
{ FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, _countof(pZero->m_portStart) },
@@ -412,10 +412,10 @@ static TDbSetting ConnectSettings[] = { FIELD_OFFSET(CIrcProto, m_onlineNotificationTime) , "OnlineNotificationTime", DBVT_WORD, 0, 30 },
{ FIELD_OFFSET(CIrcProto, m_onlineNotificationLimit) , "OnlineNotificationLimit", DBVT_WORD, 0, 50 },
{ FIELD_OFFSET(CIrcProto, m_channelAwayNotification), "ChannelAwayNotification", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, _countof(pZero->m_nick) },
- { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, _countof(pZero->m_pNick) },
- { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, _countof(pZero->m_alternativeNick) },
- { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, _countof(pZero->m_name) },
+ { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_WCHAR, _countof(pZero->m_nick) },
+ { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_WCHAR, _countof(pZero->m_pNick) },
+ { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_WCHAR, _countof(pZero->m_alternativeNick) },
+ { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_WCHAR, _countof(pZero->m_name) },
{ FIELD_OFFSET(CIrcProto, m_disableDefaultServer), "DisableDefaultServer", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_ident), "Ident", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_identTimer), "IdentTimer", DBVT_BYTE },
@@ -778,7 +778,7 @@ void CConnectPrefsDlg::OnApply() static TDbSetting CtcpSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, _countof(pZero->m_userInfo) },
+ { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_WCHAR, _countof(pZero->m_userInfo) },
{ FIELD_OFFSET(CIrcProto, m_DCCPacketSize), "DccPacketSize", DBVT_WORD, 0, 4096 },
{ FIELD_OFFSET(CIrcProto, m_DCCPassive), "DccPassive", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_DCCMode), "DCCMode", DBVT_BYTE },
@@ -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: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
+ CMStringW s = (CMStringW)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: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMStringW s = (CMStringW)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: ") + (wchar_t*)_A2T(m_proto->m_myHost) + L">";
+ CMStringW s = (CMStringW)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: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
+ CMStringW s = (CMStringW)TranslateT("<Local IP: ") + (wchar_t*)_A2T(m_proto->m_myLocalHost) + L">";
m_ip.SetText(s.c_str());
}
else m_ip.SetText(TranslateT("<Automatic>"));
@@ -925,8 +925,8 @@ void CCtcpPrefsDlg::OnApply() static TDbSetting OtherSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, _countof(pZero->m_quitMessage) },
- { FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_TCHAR, -1 },
+ { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_WCHAR, _countof(pZero->m_quitMessage) },
+ { FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_WCHAR, -1 },
{ FIELD_OFFSET(CIrcProto, m_codepage), "Codepage", DBVT_DWORD, 0, CP_ACP },
{ FIELD_OFFSET(CIrcProto, m_utfAutodetect), "UtfAutodetect", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_perform), "Perform", DBVT_BYTE },
@@ -1160,7 +1160,7 @@ void COtherPrefsDlg::OnApply() continue;
if (!pPerf->mText.IsEmpty())
- m_proto->setTString(pPerf->mSetting.c_str(), pPerf->mText.c_str());
+ m_proto->setWString(pPerf->mSetting.c_str(), pPerf->mText.c_str());
else
db_unset(NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
}
@@ -1175,7 +1175,7 @@ void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName) PERFORM_INFO* pPref;
DBVARIANT dbv;
- if (!m_proto->getTString(sSetting.c_str(), &dbv)) {
+ if (!m_proto->getWString(sSetting.c_str(), &dbv)) {
pPref = new PERFORM_INFO(sSetting.c_str(), dbv.ptszVal);
db_free(&dbv);
}
@@ -1218,7 +1218,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*) {
wchar_t szMask[500];
wchar_t szNetwork[500];
- CMString flags;
+ CMStringW flags;
if (IsDlgButtonChecked(m_hwnd, IDC_Q) == BST_CHECKED) flags += 'q';
if (IsDlgButtonChecked(m_hwnd, IDC_N) == BST_CHECKED) flags += 'n';
if (IsDlgButtonChecked(m_hwnd, IDC_I) == BST_CHECKED) flags += 'i';
@@ -1229,7 +1229,7 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*) GetDlgItemText(m_hwnd, IDC_MASK, szMask, _countof(szMask));
GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, _countof(szNetwork));
- CMString Mask = GetWord(szMask, 0);
+ CMStringW Mask = GetWord(szMask, 0);
if (Mask.GetLength() != 0) {
if (!wcschr(Mask.c_str(), '!') && !wcschr(Mask.c_str(), '@'))
Mask += L"!*@*";
@@ -1357,12 +1357,12 @@ void CIrcProto::InitIgnore(void) mir_snprintf(settingName, "IGNORE:%d", idx++);
DBVARIANT dbv;
- if (getTString(settingName, &dbv))
+ if (getWString(settingName, &dbv))
break;
- CMString mask = GetWord(dbv.ptszVal, 0);
- CMString flags = GetWord(dbv.ptszVal, 1);
- CMString network = GetWord(dbv.ptszVal, 2);
+ CMStringW mask = GetWord(dbv.ptszVal, 0);
+ CMStringW flags = GetWord(dbv.ptszVal, 1);
+ CMStringW network = GetWord(dbv.ptszVal, 2);
m_ignoreItems.insert(new CIrcIgnoreItem(mask.c_str(), flags.c_str(), network.c_str()));
db_free(&dbv);
}
@@ -1383,7 +1383,7 @@ void CIrcProto::RewriteIgnoreSettings(void) mir_snprintf(settingName, "IGNORE:%d", i);
CIrcIgnoreItem& C = m_ignoreItems[i];
- setTString(settingName, (C.mask + L" " + C.flags + L" " + C.network).c_str());
+ setWString(settingName, (C.mask + L" " + C.flags + L" " + C.network).c_str());
}
}
@@ -1638,7 +1638,7 @@ int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.pwszTitle = m_tszUserName;
odp.pwszGroup = LPGENW("Network");
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.pwszTab = LPGENW("Account");
odp.pDialog = new CConnectPrefsDlg(this);
@@ -1690,12 +1690,12 @@ void CIrcProto::InitPrefs(void) if (m_pNick[0] == 0) {
if (m_nick[0] != 0) {
memcpy(m_pNick, m_nick, sizeof(m_pNick));
- setTString("PNick", m_nick);
+ setWString("PNick", m_nick);
}
}
else {
memcpy(m_nick, m_pNick, sizeof(m_nick));
- setTString("Nick", m_nick);
+ setWString("Nick", m_nick);
}
m_mySpecifiedHostIP[0] = 0;
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp index eacf4c785b..9eb5181e91 100644 --- a/protocols/IRCG/src/output.cpp +++ b/protocols/IRCG/src/output.cpp @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static CMString FormatOutput(const CIrcMessage* pmsg)
+static CMStringW FormatOutput(const CIrcMessage* pmsg)
{
- CMString sMessage;
+ CMStringW sMessage;
if (pmsg->m_bIncoming) { // Is it an incoming message?
if (pmsg->sCommand == L"WALLOPS" && pmsg->parameters.getCount() > 0) {
@@ -85,10 +85,10 @@ static CMString FormatOutput(const CIrcMessage* pmsg) int l = pmsg->parameters[1].GetLength();
if (l > 3 && pmsg->parameters[1][0] == 1 && pmsg->parameters[1][l - 1] == 1) {
// CTCP reply
- CMString tempstr = pmsg->parameters[1];
+ CMStringW tempstr = pmsg->parameters[1];
tempstr.Delete(0, 1);
tempstr.Delete(tempstr.GetLength() - 1, 1);
- CMString type = GetWord(tempstr.c_str(), 0);
+ CMStringW type = GetWord(tempstr.c_str(), 0);
if (mir_wstrcmpi(type.c_str(), L"ping") == 0)
mir_snwprintf(temp, TranslateT("CTCP %s reply sent to %s"), type.c_str(), pmsg->parameters[0].c_str());
else
@@ -131,7 +131,7 @@ THE_END: BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg)
{
- CMString mess = FormatOutput(pmsg);
+ CMStringW mess = FormatOutput(pmsg);
if (!pmsg->m_bIncoming)
mess.Replace(L"%%", L"%");
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 9813630002..a2586f1258 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -92,7 +92,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) gchook->ptszUID = NULL;
if (gch->pDest->ptszID) {
- CMString S = MakeWndID(gch->pDest->ptszID);
+ CMStringW S = MakeWndID(gch->pDest->ptszID);
gchook->pDest->ptszID = wcsdup(S.c_str());
}
else gchook->pDest->ptszID = NULL;
@@ -112,7 +112,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) {
if (m_scriptingEnabled && lparam) {
CMStringA sString = (char*)lparam, sRequest;
- CMString sOutput, sChannel;
+ CMStringW sOutput, sChannel;
int i = sString.Find("|");
if (i != -1) {
@@ -142,7 +142,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) (m_IPFromServer) ? m_myHost : m_myLocalHost);
else if (sRequest == "usercount" && !sChannel.IsEmpty()) {
- CMString S = MakeWndID(sChannel.c_str());
+ CMStringW S = MakeWndID(sChannel.c_str());
GC_INFO gci = { 0 };
gci.Flags = GCF_BYID | GCF_COUNT;
gci.pszModule = m_szModuleName;
@@ -154,7 +154,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) }
}
else if (sRequest == "userlist" && !sChannel.IsEmpty()) {
- CMString S = MakeWndID(sChannel.c_str());
+ CMStringW S = MakeWndID(sChannel.c_str());
GC_INFO gci = { 0 };
gci.Flags = GCF_BYID | GCF_USERS;
gci.pszModule = m_szModuleName;
@@ -163,7 +163,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) return (INT_PTR)mir_strdup(gci.pszUsers);
}
else if (sRequest == "channellist") {
- CMString S = L"";
+ CMStringW S = L"";
int n = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName);
if (n >= 0) {
int j = 0;
@@ -174,7 +174,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.iItem = j;
if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
if (mir_wstrcmpi(gci.pszID, SERVERWINDOW)) {
- CMString S1 = gci.pszID;
+ CMStringW S1 = gci.pszID;
int k = S1.Find(L" ");
if (k != -1)
S1 = S1.Mid(0, k);
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index a05b6d0b17..e97a5abae5 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -198,10 +198,10 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) return 0;
DBVARIANT dbv;
- if (!getTString(hContact, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
int type = getByte(hContact, "ChatRoom", 0);
if (type != 0) {
- CMString S = L"";
+ CMStringW S = L"";
if (type == GCW_CHATROOM)
S = MakeWndID(dbv.ptszVal);
if (type == GCW_SERVER)
@@ -232,7 +232,7 @@ INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM) return 0;
DBVARIANT dbv;
- if (!getTString((MCONTACT)wp, "Nick", &dbv)) {
+ if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM)
PostIrcMessage(L"/JOIN %s", dbv.ptszVal);
db_free(&dbv);
@@ -246,11 +246,11 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM) return 0;
DBVARIANT dbv;
- if (!getTString((MCONTACT)wp, "Nick", &dbv)) {
+ if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) {
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
- CMString S = MakeWndID(dbv.ptszVal);
+ CMStringW S = MakeWndID(dbv.ptszVal);
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
@@ -267,7 +267,7 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM) MCONTACT hContact = (MCONTACT)wp;
DBVARIANT dbv;
- if (!getTString(hContact, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
PostIrcMessageWnd(dbv.ptszVal, NULL, L"/CHANNELMANAGER");
db_free(&dbv);
}
@@ -281,7 +281,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) DBVARIANT dbv;
- if (!getTString((MCONTACT)wp, "Nick", &dbv)) {
+ if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
PostIrcMessage(L"/WHOIS %s %s", dbv.ptszVal, dbv.ptszVal);
db_free(&dbv);
}
@@ -303,7 +303,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM) MCONTACT hContact = (MCONTACT)wp;
DBVARIANT dbv;
- if (!getTString(hContact, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
if (!isChatRoom(hContact)) {
char* host = NULL;
DBVARIANT dbv1;
@@ -481,7 +481,7 @@ static void DoChatFormatting(wchar_t* pszText) int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
- CMString S = L"";
+ CMStringW S = L"";
mir_cslock lock(m_gchook);
@@ -574,7 +574,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) case 9: // nickserv remind password
{
DBVARIANT dbv;
- if (!getTString("Nick", &dbv)) {
+ if (!getWString("Nick", &dbv)) {
PostIrcMessage(L"/nickserv SENDPASS %s", dbv.ptszVal);
db_free(&dbv);
}
@@ -670,13 +670,13 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) p1, gch->ptszUID, TranslateT("Please enter the reason"), TranslateT("Kick"), TranslateT("Jerk"));
break;
case 7:
- DoUserhostWithReason(1, L"B" + (CMString)p1, true, L"%s", gch->ptszUID);
+ DoUserhostWithReason(1, L"B" + (CMStringW)p1, true, L"%s", gch->ptszUID);
break;
case 8:
- DoUserhostWithReason(1, L"K" + (CMString)p1, true, L"%s", gch->ptszUID);
+ DoUserhostWithReason(1, L"K" + (CMStringW)p1, true, L"%s", gch->ptszUID);
break;
case 9:
- DoUserhostWithReason(1, L"L" + (CMString)p1, true, L"%s", gch->ptszUID);
+ DoUserhostWithReason(1, L"L" + (CMStringW)p1, true, L"%s", gch->ptszUID);
break;
case 10:
PostIrcMessage(L"/WHOIS %s %s", gch->ptszUID, gch->ptszUID);
@@ -723,28 +723,28 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel"));
break;
case 30:
- {
- PROTOSEARCHRESULT psr = { 0 };
- psr.cbSize = sizeof(psr);
- psr.flags = PSR_TCHAR;
- psr.id.w = gch->ptszUID;
- psr.nick.w = gch->ptszUID;
-
- ADDCONTACTSTRUCT acs = { 0 };
- acs.handleType = HANDLE_SEARCHRESULT;
- acs.szProto = m_szModuleName;
- acs.psr = &psr;
- CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
- }
+ {
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_UNICODE;
+ psr.id.w = gch->ptszUID;
+ psr.nick.w = gch->ptszUID;
+
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.handleType = HANDLE_SEARCHRESULT;
+ acs.szProto = m_szModuleName;
+ acs.psr = &psr;
+ CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
+ }
break;
case 31: //slap
- PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/slap %s", gch->ptszUID));
+ PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/slap %s", gch->ptszUID));
break;
case 32: //nickserv info
- PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID));
+ PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID));
break;
case 33: //nickserv ghost
- PostIrcMessageWnd(p1, NULL, CMString(FORMAT, L"/nickserv GHOST %s", gch->ptszUID));
+ PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv GHOST %s", gch->ptszUID));
break;
}
break;
@@ -923,7 +923,7 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM hContact, LPARAM) Menu_ShowItem(hUMenuChanSettings, true);
// context menu for contact
- else if (!getTString(hContact, "Default", &dbv)) {
+ else if (!getWString(hContact, "Default", &dbv)) {
Menu_ShowItem(hUMenuChanSettings, false);
// for DCC contact
@@ -966,7 +966,7 @@ int __cdecl CIrcProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szSetting, "NotOnList")) {
DBVARIANT dbv;
- if (!getTString(hContact, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
if (getByte("MirVerAutoRequest", 1))
PostIrcMessage(L"/PRIVMSG %s \001VERSION\001", dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 460b5a54f2..4e8670af7f 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -152,7 +152,7 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks {}
CMStringA mSetting;
- CMString mText;
+ CMStringW mText;
};
struct CONTACT // Contains info about users
@@ -319,15 +319,15 @@ struct CIrcProto : public PROTO<CIrcProto> COLORREF colors[16];
HICON hIcon[13];
- OBJLIST<CMString> vUserhostReasons;
- OBJLIST<CMString> vWhoInProgress;
+ OBJLIST<CMStringW> vUserhostReasons;
+ OBJLIST<CMStringW> vWhoInProgress;
mir_cs cs;
mir_cs m_gchook;
mir_cs m_resolve;
HANDLE m_evWndCreate;
- CMString m_statusMessage;
+ CMStringW m_statusMessage;
int m_iTempCheckTime;
CIrcSessionInfo si;
@@ -354,7 +354,7 @@ struct CIrcProto : public PROTO<CIrcProto> int m_noOfChannels, m_manualWhoisCount;
CMStringA sChannelModes, sUserModes;
- CMString sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
+ CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
//clist.cpp
MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline);
@@ -363,7 +363,7 @@ struct CIrcProto : public PROTO<CIrcProto> bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type ) ;
MCONTACT CList_FindContact(CONTACT *user);
- BOOL CList_AddDCCChat(const CMString &name, const CMString &hostmask, unsigned long adr, int port) ;
+ BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port) ;
//commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
@@ -374,15 +374,15 @@ struct CIrcProto : public PROTO<CIrcProto> void __cdecl ResolveIPThread(void *di);
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);
+ int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type) ;
+ int IsIgnored(CMStringW user, char type);
bool RemoveIgnore(const wchar_t *mask) ;
//input.cpp
- 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);
+ CMStringW DoAlias( const wchar_t *text, wchar_t *window);
+ BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
+ CMStringW DoIdentifiers(CMStringW text, const wchar_t *window);
+ void FormatMsg(CMStringW &text);
bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
bool PostIrcMessage(const wchar_t *fmt, ...);
@@ -404,14 +404,14 @@ struct CIrcProto : public PROTO<CIrcProto> OBJLIST<CIrcIgnoreItem> m_ignoreItems;
int m_channelNumber;
- CMString m_whoReply;
- CMString sNamesList;
- CMString sTopic;
- CMString sTopicName;
- CMString sTopicTime;
- CMString m_namesToWho;
- CMString m_channelsToWho;
- CMString m_namesToUserhost;
+ CMStringW m_whoReply;
+ CMStringW sNamesList;
+ CMStringW sTopic;
+ CMStringW sTopicName;
+ CMStringW sTopicTime;
+ CMStringW m_namesToWho;
+ CMStringW m_channelsToWho;
+ CMStringW m_namesToUserhost;
void InitPrefs(void);
void InitIgnore(void);
@@ -439,25 +439,25 @@ struct CIrcProto : public PROTO<CIrcProto> void __cdecl DisconnectServerThread( void* );
//tools.cpp
- 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);
+ void AddToJTemp(wchar_t op, CMStringW& sCommand);
+ bool AddWindowItemData(CMStringW 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 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 FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
bool IsChannel(const char* sName);
bool IsChannel(const wchar_t* sName);
void KillChatTimer(UINT_PTR &nIDEvent);
- CMString MakeWndID(const wchar_t* sWindow);
- CMString ModeToStatus(int sMode);
- CMString PrefixToStatus(int cPrefix);
- int SetChannelSBText(CMString sWindow, CHANNELINFO * wi);
+ CMStringW MakeWndID(const wchar_t* sWindow);
+ CMStringW ModeToStatus(int sMode);
+ CMStringW PrefixToStatus(int cPrefix);
+ int SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi);
void SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc);
void ClearUserhostReasons(int type);
- void DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...);
- CMString GetNextUserhostReason(int type);
- CMString PeekAtReasons(int type);
+ void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...);
+ CMStringW GetNextUserhostReason(int type);
+ CMStringW PeekAtReasons(int type);
// userinfo.cpp
void __cdecl AckUserInfoSearch( void* hContact );
@@ -475,7 +475,7 @@ struct CIrcProto : public PROTO<CIrcProto> CDccSession* FindDCCSendByPort(int iPort);
CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName);
CDccSession* FindPassiveDCCSend(int iToken);
- CDccSession* FindPassiveDCCRecv(CMString sName, CMString sToken);
+ CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken);
void DisconnectAllDCCSessions(bool Shutdown);
void CheckDCCTimeout(void);
@@ -575,7 +575,7 @@ private : PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
void OnIrcMessage(const CIrcMessage* pmsg);
- CMString sNick4Perform;
+ CMStringW sNick4Perform;
};
// map actual member functions to their associated IRC command.
@@ -619,9 +619,9 @@ HANDLE GetIconHandle(int iconId); //tools.cpp
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);
+CMStringW __stdcall GetWord(const wchar_t* text, int index);
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
-void __stdcall RemoveLinebreaks( CMString& Message );
+void __stdcall RemoveLinebreaks( CMStringW& Message );
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);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 4869720b3f..eb3068d7de 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -23,13 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand)
+void CIrcProto::AddToJTemp(wchar_t op, CMStringW& sCommand)
{
- CMString res;
+ CMStringW res;
int pos = 0;
for (;;) {
- CMString tmp = sCommand.Tokenize(L",", pos);
+ CMStringW tmp = sCommand.Tokenize(L",", pos);
if (pos == -1)
break;
@@ -41,15 +41,15 @@ void CIrcProto::AddToJTemp(wchar_t op, CMString& sCommand) }
DBVARIANT dbv;
- if (!getTString("JTemp", &dbv)) {
- res = CMString(dbv.ptszVal) + L" " + res;
+ if (!getWString("JTemp", &dbv)) {
+ res = CMStringW(dbv.ptszVal) + L" " + res;
db_free(&dbv);
}
- setTString("JTemp", res.c_str());
+ setWString("JTemp", res.c_str());
}
-CMString __stdcall GetWord(const wchar_t* text, int index)
+CMStringW __stdcall GetWord(const wchar_t* text, int index)
{
if (text && *text) {
wchar_t* p1 = (wchar_t*)text;
@@ -75,11 +75,11 @@ CMString __stdcall GetWord(const wchar_t* text, int index) p2 = wcschr(p1, '\0');
if (p1 != p2)
- return CMString(p1, p2 - p1);
+ return CMStringW(p1, p2 - p1);
}
}
- return CMString();
+ return CMStringW();
}
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index)
@@ -108,7 +108,7 @@ const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index) return temp;
}
-void __stdcall RemoveLinebreaks(CMString &Message)
+void __stdcall RemoveLinebreaks(CMStringW &Message)
{
while (Message.Find(L"\r\n\r\n", 0) != -1)
Message.Replace(L"\r\n\r\n", L"\r\n");
@@ -386,8 +386,8 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
GCDEST gcd = { m_szModuleName, NULL, iEvent };
- CMString sID;
- CMString sText = L"";
+ CMStringW sID;
+ CMStringW sText = L"";
if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho)
return false;
@@ -401,7 +401,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* if (pszWindow) {
if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
- sID = pszWindow + (CMString)L" - " + m_info.sNetwork;
+ sID = pszWindow + (CMStringW)L" - " + m_info.sNetwork;
else
sID = pszWindow;
gcd.ptszID = (wchar_t*)sID.c_str();
@@ -430,29 +430,29 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* return CallChatEvent(0, (LPARAM)&gce);
}
-CMString CIrcProto::ModeToStatus(int sMode)
+CMStringW CIrcProto::ModeToStatus(int sMode)
{
if (sUserModes.Find(sMode) != -1) {
switch (sMode) {
case 'q':
- return (CMString)L"Owner";
+ return (CMStringW)L"Owner";
case 'o':
- return (CMString)L"Op";
+ return (CMStringW)L"Op";
case 'v':
- return (CMString)L"Voice";
+ return (CMStringW)L"Voice";
case 'h':
- return (CMString)L"Halfop";
+ return (CMStringW)L"Halfop";
case 'a':
- return (CMString)L"Admin";
+ return (CMStringW)L"Admin";
default:
- return (CMString)L"Unknown";
+ return (CMStringW)L"Unknown";
}
}
- return (CMString)L"Normal";
+ return (CMStringW)L"Normal";
}
-CMString CIrcProto::PrefixToStatus(int cPrefix)
+CMStringW CIrcProto::PrefixToStatus(int cPrefix)
{
const wchar_t* p = wcschr(sUserModePrefixes.c_str(), cPrefix);
if (p) {
@@ -460,7 +460,7 @@ CMString CIrcProto::PrefixToStatus(int cPrefix) return ModeToStatus(sUserModes[index]);
}
- return (CMString)L"Normal";
+ return (CMStringW)L"Normal";
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -531,9 +531,9 @@ void CIrcProto::KillChatTimer(UINT_PTR &nIDEvent) /////////////////////////////////////////////////////////////////////////////////////////
-int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi)
+int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi)
{
- CMString sTemp = L"";
+ CMStringW sTemp = L"";
if (wi->pszMode) {
sTemp += L"[";
sTemp += wi->pszMode;
@@ -545,14 +545,14 @@ 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 wchar_t* sWindow)
+CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow)
{
wchar_t buf[200];
mir_snwprintf(buf, L"%s - %s", sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
- return CMString(buf);
+ return CMStringW(buf);
}
-bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis)
+bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis)
{
CHANNELINFO *wi;
if (!wis)
@@ -570,7 +570,7 @@ bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis) return false;
}
-bool CIrcProto::AddWindowItemData(CMString window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic)
+bool CIrcProto::AddWindowItemData(CMStringW 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) {
@@ -610,10 +610,10 @@ void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber }
}
-void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...)
+void CIrcProto::DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...)
{
wchar_t temp[4096];
- CMString S = L"";
+ CMStringW S = L"";
switch (type) {
case 1:
S = L"USERHOST";
@@ -633,22 +633,22 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman // Add reason
if (type == 1)
- vUserhostReasons.insert(new CMString(reason));
+ vUserhostReasons.insert(new CMStringW(reason));
else if (type == 2)
- vWhoInProgress.insert(new CMString(reason));
+ vWhoInProgress.insert(new CMStringW(reason));
// Do command
if (IsConnected() && bSendCommand)
SendIrcMessage(temp, false);
}
-CMString CIrcProto::GetNextUserhostReason(int type)
+CMStringW CIrcProto::GetNextUserhostReason(int type)
{
- CMString reason = L"";
+ CMStringW reason = L"";
switch (type) {
case 1:
if (!vUserhostReasons.getCount())
- return CMString();
+ return CMStringW();
// Get reason
reason = vUserhostReasons[0];
@@ -656,7 +656,7 @@ CMString CIrcProto::GetNextUserhostReason(int type) break;
case 2:
if (!vWhoInProgress.getCount())
- return CMString();
+ return CMStringW();
// Get reason
reason = vWhoInProgress[0];
@@ -667,21 +667,21 @@ CMString CIrcProto::GetNextUserhostReason(int type) return reason;
}
-CMString CIrcProto::PeekAtReasons(int type)
+CMStringW CIrcProto::PeekAtReasons(int type)
{
switch (type) {
case 1:
if (!vUserhostReasons.getCount())
- return CMString();
+ return CMStringW();
return vUserhostReasons[0];
case 2:
if (!vWhoInProgress.getCount())
- return CMString();
+ return CMStringW();
return vWhoInProgress[0];
}
- return CMString();
+ return CMStringW();
}
void CIrcProto::ClearUserhostReasons(int type)
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 0079e410e0..68b3705a5f 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -63,26 +63,26 @@ 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, TranslateTS(STR_BASIC));
- if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_BASIC));
+ if (!p->ppro->getWString(p->hContact, "Default", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
}
else {
- SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateTS(STR_ADVANCED));
- if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_ADVANCED));
+ if (!p->ppro->getWString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
}
- if (!p->ppro->getTString(p->hContact, "UUser", &dbv)) {
+ if (!p->ppro->getWString(p->hContact, "UUser", &dbv)) {
SetDlgItemText(m_hwnd, IDC_USER, dbv.ptszVal);
db_free(&dbv);
}
- if (!p->ppro->getTString(p->hContact, "UHost", &dbv)) {
+ if (!p->ppro->getWString(p->hContact, "UHost", &dbv)) {
SetDlgItemText(m_hwnd, IDC_HOST, dbv.ptszVal);
db_free(&dbv);
}
@@ -107,18 +107,18 @@ 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, TranslateTS(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(NULL, TranslateW(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return FALSE;
}
DBVARIANT dbv;
- if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
- CMString S = STR_ERROR;
+ if (!p->ppro->getWString(p->hContact, "Default", &dbv)) {
+ CMStringW S = STR_ERROR;
S += L" (";
S += dbv.ptszVal;
S += L")";
if ((mir_wstrlen(temp) < 4 && mir_wstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
- MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ MessageBox(NULL, TranslateW(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
db_free(&dbv);
return FALSE;
}
@@ -127,7 +127,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
if (mir_wstrlen(GetWord(temp, 0).c_str()))
- p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
+ p->ppro->setWString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
}
@@ -136,13 +136,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp));
if (mir_wstrlen(GetWord(temp, 0).c_str()))
- p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
+ p->ppro->setWString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp));
if (mir_wstrlen(GetWord(temp, 0).c_str()))
- p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
+ p->ppro->setWString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
@@ -162,10 +162,10 @@ 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, TranslateTS(STR_BASIC));
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_BASIC));
DBVARIANT dbv;
- if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
+ if (!p->ppro->getWString(p->hContact, "Default", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
@@ -174,8 +174,8 @@ 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, TranslateTS(STR_ADVANCED));
- if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateW(STR_ADVANCED));
+ if (!p->ppro->getWString(p->hContact, "UWildcard", &dbv)) {
SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
@@ -200,7 +200,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) return 0;
DBVARIANT dbv;
- if (!getTString(hContact, "Default", &dbv)) {
+ if (!getWString(hContact, "Default", &dbv)) {
if (IsChannel(dbv.ptszVal)) {
db_free(&dbv);
return 0;
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 494000553c..40c30af560 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -211,7 +211,7 @@ void CNickDlg::OnInitDialog() Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_RENAME));
DBVARIANT dbv;
- if (!m_proto->getTString("RecentNicks", &dbv)) {
+ if (!m_proto->getWString("RecentNicks", &dbv)) {
for (int i = 0; i < 10; i++)
if (!GetWord(dbv.ptszVal, i).IsEmpty())
SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str());
@@ -232,17 +232,17 @@ void CNickDlg::OnOk(CCtrlButton*) m_Enick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(L"/NICK %s", szTemp);
- CMString S = szTemp;
+ CMStringW S = szTemp;
DBVARIANT dbv;
- if (!m_proto->getTString("RecentNicks", &dbv)) {
+ if (!m_proto->getWString("RecentNicks", &dbv)) {
for (int i = 0; i < 10; i++) {
- CMString s = GetWord(dbv.ptszVal, i);
+ CMStringW s = GetWord(dbv.ptszVal, i);
if (!s.IsEmpty() && s != szTemp)
S += L" " + s;
}
db_free(&dbv);
}
- m_proto->setTString("RecentNicks", S.c_str());
+ m_proto->setWString("RecentNicks", S.c_str());
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -503,10 +503,10 @@ void CJoinDlg::OnInitDialog() CCoolIrcDlg::OnInitDialog();
DBVARIANT dbv;
- if (!m_proto->getTString("RecentChannels", &dbv)) {
+ if (!m_proto->getWString("RecentChannels", &dbv)) {
for (int i = 0; i < 20; i++) {
if (!GetWord(dbv.ptszVal, i).IsEmpty()) {
- CMString S = GetWord(dbv.ptszVal, i);
+ CMStringW S = GetWord(dbv.ptszVal, i);
S.Replace(L"%newl", L" ");
SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str());
}
@@ -530,20 +530,20 @@ void CJoinDlg::OnOk(CCtrlButton*) else
m_proto->PostIrcMessage(L"/JOIN #%s", szTemp);
- CMString S = szTemp;
+ CMStringW S = szTemp;
S.Replace(L" ", L"%newl");
- CMString SL = S;
+ CMStringW SL = S;
DBVARIANT dbv;
- if (!m_proto->getTString("RecentChannels", &dbv)) {
+ if (!m_proto->getWString("RecentChannels", &dbv)) {
for (int i = 0; i < 20; i++) {
- CMString W = GetWord(dbv.ptszVal, i);
+ CMStringW W = GetWord(dbv.ptszVal, i);
if (!W.IsEmpty() && W != SL)
S += L" " + W;
}
db_free(&dbv);
}
- m_proto->setTString("RecentChannels", S.c_str());
+ m_proto->setWString("RecentChannels", S.c_str());
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -756,7 +756,7 @@ void CQuestionDlg::OnOk(CCtrlButton*) else *p1 = '\0';
}
- CMString S('\0', j + 2);
+ CMStringW S('\0', j + 2);
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1);
S.Replace(text, l);
m_proto->PostIrcMessageWnd(NULL, NULL, S);
@@ -909,11 +909,11 @@ void CManagerDlg::OnClose() wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- CMString S = L"";
+ CMStringW S = L"";
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;
+ CMStringW S1 = temp;
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
S1.Replace(L" ", L"%¤");
@@ -925,7 +925,7 @@ void CManagerDlg::OnClose() if (!S.IsEmpty() && m_proto->IsConnected()) {
mir_snwprintf(temp, L"Topic%s%s", window, m_proto->m_info.sNetwork.c_str());
char* p = mir_u2a(temp);
- m_proto->setTString(p, S.c_str());
+ m_proto->setWString(p, S.c_str());
mir_free(p);
}
DestroyWindow(m_hwnd);
@@ -978,7 +978,7 @@ void CManagerDlg::OnEdit(CCtrlButton*) int i = m_list.GetCurSel();
if (i != LB_ERR) {
wchar_t* m = m_list.GetItemText(i);
- CMString user = GetWord(m, 0);
+ CMStringW user = GetWord(m, 0);
mir_free(m);
wchar_t temp[100];
@@ -1027,7 +1027,7 @@ void CManagerDlg::OnRemove(CCtrlButton*) wchar_t temp[100], mode[3];
wchar_t* m = m_list.GetItemText(i, temp, _countof(temp));
- CMString user = GetWord(m, 0);
+ CMStringW user = GetWord(m, 0);
if (m_radio1.GetState()) {
mir_wstrcpy(mode, L"-b");
@@ -1083,8 +1083,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (wi) {
wchar_t toadd[10]; *toadd = '\0';
wchar_t toremove[10]; *toremove = '\0';
- CMString appendixadd = L"";
- CMString appendixremove = L"";
+ CMStringW appendixadd = L"";
+ CMStringW appendixremove = L"";
if (wi->pszMode && wcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
mir_wstrcat(toremove, L"t");
@@ -1134,12 +1134,12 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) else if (m_check9.GetState())
mir_wstrcat(toadd, L"c");
- CMString Key = L"";
- CMString Limit = L"";
+ CMStringW Key = L"";
+ CMStringW Limit = L"";
if (wi->pszMode && wi->pszPassword && wcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
mir_wstrcat(toremove, L"k");
- appendixremove += L" " + CMString(wi->pszPassword);
+ appendixremove += L" " + CMStringW(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
wchar_t temp[400];
@@ -1148,8 +1148,8 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) if (Key != temp) {
mir_wstrcat(toremove, L"k");
mir_wstrcat(toadd, L"k");
- appendixadd += L" " + CMString(temp);
- appendixremove += L" " + CMString(wi->pszPassword);
+ appendixadd += L" " + CMStringW(temp);
+ appendixremove += L" " + CMStringW(wi->pszPassword);
}
}
}
@@ -1170,7 +1170,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*) GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
if (wi->pszLimit && mir_wstrcmpi(wi->pszLimit, temp)) {
mir_wstrcat(toadd, L"l");
- appendixadd += L" " + CMString(temp);
+ appendixadd += L" " + CMStringW(temp);
}
}
}
@@ -1283,9 +1283,9 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window) char* p = mir_u2a(temp);
DBVARIANT dbv;
- if (!m_proto->getTString(p, &dbv)) {
+ if (!m_proto->getWString(p, &dbv)) {
for (int i = 0; i < 5; i++) {
- CMString S = GetWord(dbv.ptszVal, i);
+ CMStringW S = GetWord(dbv.ptszVal, i);
if (!S.IsEmpty()) {
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
|