summaryrefslogtreecommitdiff
path: root/protocols/IRCG
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/IRCG')
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp34
-rw-r--r--protocols/IRCG/src/input.cpp72
-rw-r--r--protocols/IRCG/src/irc.h11
-rw-r--r--protocols/IRCG/src/irclib.cpp6
-rw-r--r--protocols/IRCG/src/irclib.h4
-rw-r--r--protocols/IRCG/src/ircproto.cpp28
-rw-r--r--protocols/IRCG/src/options.cpp30
-rw-r--r--protocols/IRCG/src/output.cpp2
-rw-r--r--protocols/IRCG/src/scripting.cpp8
-rw-r--r--protocols/IRCG/src/services.cpp40
-rw-r--r--protocols/IRCG/src/tools.cpp72
-rw-r--r--protocols/IRCG/src/ui_utils.cpp4
-rw-r--r--protocols/IRCG/src/userinfo.cpp8
-rw-r--r--protocols/IRCG/src/windows.cpp122
14 files changed, 205 insertions, 236 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 8f39d5aefe..5bc6b89aa5 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -53,7 +53,7 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
if (ppro->m_forceVisible)
ppro->PostIrcMessage(_T("/MODE %s -i"), ppro->m_info.sNick.c_str());
- if (lstrlenA(ppro->m_myHost) == 0 && ppro->IsConnected())
+ if (mir_strlen(ppro->m_myHost) == 0 && ppro->IsConnected())
ppro->DoUserhostWithReason(2, (_T("S") + ppro->m_info.sNick).c_str(), true, _T("%s"), ppro->m_info.sNick.c_str());
}
@@ -240,7 +240,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
{
mir_cslock lock(m_resolve);
- if (ipr != NULL && (ipr->iType == IP_AUTO && lstrlenA(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
+ if (ipr != NULL && (ipr->iType == IP_AUTO && mir_strlen(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
hostent* myhost = gethostbyname(ipr->sAddr.c_str());
if (myhost) {
IN_ADDR in;
@@ -275,7 +275,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg)
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
- lstrcpyn(host, word.c_str(), SIZEOF(host));
+ mir_tstrncpy(host, word.c_str(), SIZEOF(host));
TCHAR* p1 = _tcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -717,7 +717,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg)
if (bIsChannel) {
if (!(pmsg->m_bIncoming && m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'm'))) {
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
DoEvent(GC_EVENT_MESSAGE, pmsg->parameters[0].c_str(), pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
}
return true;
@@ -781,7 +781,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
if (mess.GetLength() > 1) {
mess.Delete(0, 1);
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
DoEvent(GC_EVENT_ACTION, pmsg->parameters[0].c_str(), pmsg->m_bIncoming ? pmsg->prefix.sNick.c_str() : m_info.sNick.c_str(), mess.c_str(), NULL, NULL, NULL, true, pmsg->m_bIncoming ? false : true);
}
@@ -844,7 +844,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
else if (pmsg->m_bIncoming && command == _T("time")) {
TCHAR temp[300];
time_t tim = time(NULL);
- lstrcpyn(temp, _tctime(&tim), 25);
+ mir_tstrncpy(temp, _tctime(&tim), 25);
PostIrcMessage(_T("/NOTICE %s \001TIME %s\001"), pmsg->prefix.sNick.c_str(), temp);
mir_sntprintf(temp, SIZEOF(temp), TranslateT("CTCP TIME requested by %s"), pmsg->prefix.sNick.c_str());
@@ -1518,7 +1518,7 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage* pmsg)
TCHAR* save = temp;
if (find == temp && find2 != NULL && find + 8 >= find2) {
temp = _tcsstr(temp, _T("]"));
- if (lstrlen(temp) > 1) {
+ if (mir_tstrlen(temp) > 1) {
temp++;
temp[0] = '\0';
lvItem.iSubItem = 2;
@@ -1568,8 +1568,8 @@ bool CIrcProto::OnIrc_LISTEND(const CIrcMessage* pmsg)
if (m_noOfChannels > 0)
percent = (int)(m_channelNumber * 100) / m_noOfChannels;
if (percent < 70) {
- lstrcat(text, _T(" "));
- lstrcat(text, TranslateT("(probably truncated by server)"));
+ mir_tstrcat(text, _T(" "));
+ mir_tstrcat(text, TranslateT("(probably truncated by server)"));
}
SetDlgItemText(m_listDlg->GetHwnd(), IDC_TEXT, text);
}
@@ -1593,7 +1593,7 @@ bool CIrcProto::OnIrc_BANLIST(const CIrcMessage* pmsg)
S += _T(" - ( ");
time_t time = StrToInt(pmsg->parameters[4].c_str());
S += _tctime(&time);
- ReplaceString(S, _T("\n"), _T(" "));
+ S.Replace(_T("\n"), _T(" "));
S += _T(")");
}
}
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming && m_whoisDlg && pmsg->parameters.getCount() > 2 && m_manualWhoisCount > 0) {
TCHAR temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
- lstrcat(temp, _T("%s\r\n"));
+ mir_tstrcat(temp, _T("%s\r\n"));
mir_sntprintf(temp2, 1020, temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
@@ -2016,7 +2016,7 @@ bool CIrcProto::OnIrc_WHO_REPLY(const CIrcMessage* pmsg)
m_whoReply.AppendFormat(_T("%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 (lstrcmpi(pmsg->parameters[5].c_str(), m_info.sNick.c_str()) == 0) {
TCHAR host[1024];
- lstrcpyn(host, pmsg->parameters[3].c_str(), 1024);
+ mir_tstrncpy(host, pmsg->parameters[3].c_str(), 1024);
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(host), IP_AUTO));
}
}
@@ -2187,8 +2187,8 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
TCHAR szAltPort[20];
if (pmsg->parameters.getCount() > 1 && _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szAltServer, &szAltPort) == 2) {
ShowMessage(pmsg);
- lstrcpynA(m_serverName, _T2A(szAltServer), 99);
- lstrcpynA(m_portStart, _T2A(szAltPort), 9);
+ mir_strncpy(m_serverName, _T2A(szAltServer), 99);
+ mir_strncpy(m_portStart, _T2A(szAltPort), 9);
m_noOfChannels = 0;
ConnectToServer();
@@ -2205,13 +2205,13 @@ bool CIrcProto::OnIrc_SUPPORT(const CIrcMessage* pmsg)
if (_tcsstr(temp, _T("CHANTYPES="))) {
TCHAR* p1 = _tcschr(temp, '=');
p1++;
- if (lstrlen(p1) > 0)
+ if (mir_tstrlen(p1) > 0)
sChannelPrefixes = p1;
}
if (_tcsstr(temp, _T("CHANMODES="))) {
TCHAR* p1 = _tcschr(temp, '=');
p1++;
- if (lstrlen(p1) > 0)
+ if (mir_tstrlen(p1) > 0)
sChannelModes = (char*)_T2A(p1);
}
if (_tcsstr(temp, _T("PREFIX="))) {
@@ -2390,7 +2390,7 @@ static void __cdecl AwayWarningThread(LPVOID)
int CIrcProto::DoPerform(const char* event)
{
- String sSetting = String("PERFORM:") + event;
+ CMStringA sSetting = CMStringA("PERFORM:") + event;
sSetting.MakeUpper();
DBVARIANT dbv;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 29d5b4c14b..019ac57cb2 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::FormatMsg(CMString& text)
{
TCHAR temp[30];
- lstrcpyn(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString S = _T("");
@@ -56,7 +56,7 @@ void CIrcProto::FormatMsg(CMString& text)
}
}
- ReplaceString(sNewNick, NICKSUBSTITUTE, sNick4Perform.c_str());
+ sNewNick.Replace(NICKSUBSTITUTE, sNick4Perform.c_str());
S = GetWord(text.c_str(), 0) + _T(" ") + sNewNick;
}
}
@@ -68,8 +68,8 @@ void CIrcProto::FormatMsg(CMString& text)
static void AddCR(CMString& text)
{
- ReplaceString(text, _T("\n"), _T("\r\n"));
- ReplaceString(text, _T("\r\r"), _T("\r"));
+ text.Replace(_T("\n"), _T("\r\n"));
+ text.Replace(_T("\r\r"), _T("\r"));
}
CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
@@ -89,16 +89,16 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
Messageout += _T("\r\n");
TCHAR* line = new TCHAR[p2 - p1 + 1];
- lstrcpyn(line, p1, p2 - p1 + 1);
+ mir_tstrncpy(line, p1, p2 - p1 + 1);
TCHAR* test = line;
while (*test == ' ')
test++;
if (*test == '/') {
- lstrcpyn(line, GetWordAddress(line, 0), p2 - p1 + 1);
+ mir_tstrncpy(line, GetWordAddress(line, 0), p2 - p1 + 1);
CMString S = line;
delete[] line;
line = new TCHAR[S.GetLength() + 2];
- lstrcpyn(line, S.c_str(), S.GetLength() + 1);
+ mir_tstrncpy(line, S.c_str(), S.GetLength() + 1);
CMString alias(m_alias);
const TCHAR* p3 = _tcsstr(alias.c_str(), (GetWord(line, 0) + _T(" ")).c_str());
if (p3 != alias.c_str()) {
@@ -116,29 +116,29 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
*(TCHAR*)p4 = 0;
CMString S = p3;
- ReplaceString(S, _T("##"), window);
- ReplaceString(S, _T("$?"), _T("%question"));
+ S.Replace(_T("##"), window);
+ S.Replace(_T("$?"), _T("%question"));
for (int index = 1; index < 8; index++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("#$%u"), index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
- ReplaceString(S, str, GetWord(line, index).c_str());
+ S.Replace(str, GetWord(line, index).c_str());
else {
CMString S1 = _T("#");
S1 += GetWord(line, index);
- ReplaceString(S, str, S1.c_str());
+ S.Replace(str, S1.c_str());
}
}
for (int index2 = 1; index2 < 8; index2++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("$%u-"), index2);
- ReplaceString(S, str, GetWordAddress(line, index2));
+ S.Replace(str, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
TCHAR str[5];
mir_sntprintf(str, SIZEOF(str), _T("$%u"), index3);
- ReplaceString(S, str, GetWord(line, index3).c_str());
+ S.Replace(str, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(S.c_str(), 1);
}
@@ -166,32 +166,32 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
TCHAR str[2];
GetLocalTime(&time);
- ReplaceString(text, _T("%mnick"), m_nick);
- ReplaceString(text, _T("%anick"), m_alternativeNick);
- ReplaceString(text, _T("%awaymsg"), m_statusMessage.c_str());
- ReplaceString(text, _T("%module"), _A2T(m_szModuleName));
- ReplaceString(text, _T("%name"), m_name);
- ReplaceString(text, _T("%newl"), _T("\r\n"));
- ReplaceString(text, _T("%network"), m_info.sNetwork.c_str());
- ReplaceString(text, _T("%me"), m_info.sNick.c_str());
+ text.Replace(_T("%mnick"), m_nick);
+ text.Replace(_T("%anick"), m_alternativeNick);
+ text.Replace(_T("%awaymsg"), m_statusMessage.c_str());
+ text.Replace(_T("%module"), _A2T(m_szModuleName));
+ text.Replace(_T("%name"), m_name);
+ text.Replace(_T("%newl"), _T("\r\n"));
+ text.Replace(_T("%network"), m_info.sNetwork.c_str());
+ text.Replace(_T("%me"), m_info.sNick.c_str());
char mirver[100];
CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(mirver), LPARAM(mirver));
- ReplaceString(text, _T("%mirver"), _A2T(mirver));
+ text.Replace(_T("%mirver"), _A2T(mirver));
- ReplaceString(text, _T("%version"), _T(__VERSION_STRING_DOTS));
+ text.Replace(_T("%version"), _T(__VERSION_STRING_DOTS));
str[0] = 3; str[1] = '\0';
- ReplaceString(text, _T("%color"), str);
+ text.Replace(_T("%color"), str);
str[0] = 2;
- ReplaceString(text, _T("%bold"), str);
+ text.Replace(_T("%bold"), str);
str[0] = 31;
- ReplaceString(text, _T("%underline"), str);
+ text.Replace(_T("%underline"), str);
str[0] = 22;
- ReplaceString(text, _T("%italics"), str);
+ text.Replace(_T("%italics"), str);
return text;
}
@@ -215,7 +215,7 @@ static void __stdcall sttSetTimerOff(void* _pro)
BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hContact)
{
TCHAR temp[30];
- lstrcpyn(temp, GetWord(text.c_str(), 0).c_str(), 29);
+ mir_tstrncpy(temp, GetWord(text.c_str(), 0).c_str(), 29);
CharLower(temp);
CMString command = temp;
CMString one = GetWord(text.c_str(), 1);
@@ -524,7 +524,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hConta
return true;
CMString S = _T("/ME ") + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
- ReplaceString(S, _T("%"), _T("%%"));
+ S.Replace(_T("%"), _T("%%"));
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
}
@@ -534,7 +534,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, MCONTACT hConta
return true;
CMString S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
- ReplaceString(S, _T("%"), _T("%%"));
+ S.Replace(_T("%"), _T("%%"));
DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
return true;
}
@@ -793,7 +793,7 @@ static void __stdcall DoInputRequestAliasApcStub(void* _par)
bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
{
- if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 4000)
+ if (!fmt || mir_tstrlen(fmt) < 1 || mir_tstrlen(fmt) > 4000)
return 0;
va_list marker;
@@ -814,17 +814,17 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR* window, MCONTACT hContact, const TCHAR*
if (hContact)
bDCC = getByte(hContact, "DCC", 0);
- if (!IsConnected() && !bDCC || !szBuf || lstrlen(szBuf) < 1)
+ if (!IsConnected() && !bDCC || !szBuf || mir_tstrlen(szBuf) < 1)
return 0;
if (hContact && !getTString(hContact, "Nick", &dbv)) {
- lstrcpyn(windowname, dbv.ptszVal, 255);
+ mir_tstrncpy(windowname, dbv.ptszVal, 255);
db_free(&dbv);
}
else if (window)
- lstrcpyn(windowname, window, 255);
+ mir_tstrncpy(windowname, window, 255);
else
- lstrcpyn(windowname, SERVERWINDOW, 255);
+ mir_tstrncpy(windowname, SERVERWINDOW, 255);
if (lstrcmpi(window, SERVERWINDOW) != 0) {
TCHAR* p1 = _tcschr(windowname, ' ');
@@ -844,7 +844,7 @@ bool CIrcProto::PostIrcMessageWnd(TCHAR* window, MCONTACT hContact, const TCHAR*
return 1;
}
- ReplaceString(Message, _T("%newl"), _T("\r\n"));
+ Message.Replace(_T("%newl"), _T("\r\n"));
RemoveLinebreaks(Message);
}
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h
index b74ff0b710..68df80a0d8 100644
--- a/protocols/IRCG/src/irc.h
+++ b/protocols/IRCG/src/irc.h
@@ -98,7 +98,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FILERESUME_CANCEL 11
struct CIrcProto;
-typedef CMStringA String;
// special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
@@ -121,7 +120,7 @@ struct IPRESOLVE // Contains info about the channels
~IPRESOLVE()
{}
- String sAddr;
+ CMStringA sAddr;
int iType;
};
@@ -158,7 +157,7 @@ struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
~PERFORM_INFO()
{}
- String mSetting;
+ CMStringA mSetting;
CMString mText;
};
@@ -379,7 +378,7 @@ struct CIrcProto : public PROTO<CIrcProto>
CIgnorePrefsDlg* m_ignoreDlg;
int m_noOfChannels, m_manualWhoisCount;
- String sChannelModes, sUserModes;
+ CMStringA sChannelModes, sUserModes;
CMString sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
CDlgBase::CreateParam OptCreateAccount, OptCreateConn, OptCreateIgnore, OptCreateOther;
@@ -652,14 +651,12 @@ void ReleaseIconEx(HICON hIcon);
int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string);
char* __stdcall IrcLoadFile(TCHAR * szPath);
CMString __stdcall GetWord(const TCHAR* text, int index);
-CMString& __stdcall ReplaceString (CMString& text, const TCHAR* replaceme, const TCHAR* newword);
const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index);
void __stdcall RemoveLinebreaks( CMString& Message );
TCHAR* __stdcall my_strstri(const TCHAR *s1, const TCHAR *s2) ;
TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent);
-String& __stdcall ReplaceString (String& text, const char* replaceme, const char* newword);
-String __stdcall GetWord(const char* text, int index);
+CMStringA __stdcall GetWord(const char* text, int index);
#pragma comment(lib,"comctl32.lib")
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index cae41d4668..9cea32cdf6 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -279,7 +279,7 @@ int CIrcProto::NLSend(const unsigned char* buf, int cbBuf)
if (!con || !buf)
return 0;
if (m_scriptingEnabled && cbBuf == 0)
- cbBuf = lstrlenA((const char *)buf);
+ cbBuf = mir_strlen((const char *)buf);
return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT);
}
@@ -702,7 +702,7 @@ unsigned long ConvertIPToInteger(char* IP)
IN_ADDR in;
IN_ADDR intemp;
- if (IP == 0 || lstrlenA(IP) == 0)
+ if (IP == 0 || mir_strlen(IP) == 0)
return 0;
intemp.S_un.S_addr = inet_addr(IP);
@@ -815,7 +815,7 @@ int CDccSession::NLReceive(const unsigned char* buf, int cbBuf)
int CDccSession::SendStuff(const TCHAR* fmt)
{
- String buf = _T2A(fmt, m_proto->getCodepage());
+ CMStringA buf = _T2A(fmt, m_proto->getCodepage());
return NLSend((const unsigned char*)buf.c_str(), buf.GetLength());
}
diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h
index 4fc6c9bff5..043a83ca76 100644
--- a/protocols/IRCG/src/irclib.h
+++ b/protocols/IRCG/src/irclib.h
@@ -86,12 +86,12 @@ private :
struct CIrcSessionInfo
{
- String sServer;
+ CMStringA sServer;
CMString sServerName;
CMString sNick;
CMString sUserID;
CMString sFullName;
- String sPassword;
+ CMStringA sPassword;
CMString sIdentServerType;
CMString sNetwork;
bool bIdentServer;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 2cb0fda304..dfacc49281 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -166,11 +166,11 @@ static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
static int sttCheckPerform(const char *szSetting, LPARAM lParam)
{
if (!_strnicmp(szSetting, "PERFORM:", 8)) {
- String s = szSetting;
+ CMStringA s = szSetting;
s.MakeUpper();
if (s != szSetting) {
- OBJLIST<String>* p = (OBJLIST<String>*)lParam;
- p->insert(new String(szSetting));
+ OBJLIST<CMStringA>* p = (OBJLIST<CMStringA>*)lParam;
+ p->insert(new CMStringA(szSetting));
}
}
return 0;
@@ -232,12 +232,12 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
while ((p1 = strstr(p2, "NETWORK: ")) != NULL) {
p1 += 9;
p2 = strchr(p1, '\n');
- String sNetwork(p1, int(p2 - p1 - 1));
+ CMStringA sNetwork(p1, int(p2 - p1 - 1));
sNetwork.MakeUpper();
p1 = p2;
p2 = strstr(++p1, "\nNETWORK: ");
if (!p2)
- p2 = p1 + lstrlenA(p1) - 1;
+ p2 = p1 + mir_strlen(p1) - 1;
if (p1 == p2)
break;
@@ -250,7 +250,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
mir_free(szLoadFileName);
if (!getByte("PerformConversionDone", 0)) {
- OBJLIST<String> performToConvert(10);
+ OBJLIST<CMStringA> performToConvert(10);
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttCheckPerform;
dbces.lParam = (LPARAM)&performToConvert;
@@ -258,7 +258,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
for (int i = 0; i < performToConvert.getCount(); i++) {
- String s = performToConvert[i];
+ CMStringA s = performToConvert[i];
DBVARIANT dbv;
if (!getTString(s, &dbv)) {
db_unset(NULL, m_szModuleName, s);
@@ -278,16 +278,16 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
if (m_nick[0]) {
TCHAR szBuf[40];
- if (lstrlen(m_alternativeNick) == 0) {
+ if (mir_tstrlen(m_alternativeNick) == 0) {
mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s%u"), m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
- lstrcpyn(m_alternativeNick, szBuf, 30);
+ mir_tstrncpy(m_alternativeNick, szBuf, 30);
}
- if (lstrlen(m_name) == 0) {
+ if (mir_tstrlen(m_name) == 0) {
mir_sntprintf(szBuf, SIZEOF(szBuf), _T("Miranda%u"), rand() % 9999);
setTString("Name", szBuf);
- lstrcpyn(m_name, szBuf, 200);
+ mir_tstrncpy(m_name, szBuf, 200);
}
}
@@ -532,7 +532,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const PROTOCHAR* szId)
if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
szId && szId[0] && !IsChannel(szId)) {
AckBasicSearchParam* param = new AckBasicSearchParam;
- lstrcpyn(param->buf, szId, 50);
+ mir_tstrncpy(param->buf, szId, 50);
ForkThread(&CIrcProto::AckBasicSearch, param);
return (HANDLE)1;
}
@@ -685,7 +685,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz
// need to make sure that %'s are doubled to avoid having chat interpret as color codes
CMString sFileCorrect = dci->sFile;
- ReplaceString(sFileCorrect, _T("%"), _T("%%"));
+ sFileCorrect.Replace(_T("%"), _T("%%"));
// is it an reverse filetransfer (receiver acts as server)
if (dci->bReverse) {
@@ -948,7 +948,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg)
default:
CMString newStatus = msg;
- ReplaceString(newStatus, _T("\r\n"), _T(" "));
+ newStatus.Replace(_T("\r\n"), _T(" "));
if (m_statusMessage.IsEmpty() || msg == NULL || m_statusMessage != newStatus) {
if (msg == NULL || *msg == 0)
m_statusMessage = STR_AWAYMESSAGE;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index ba57584a83..83e83cd725 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -76,7 +76,7 @@ void CIrcProto::ReadSettings(TDbSetting* sets, int count)
if (p->defStr == NULL)
*ptr = 0;
else
- lstrcpyn((TCHAR*)ptr, p->defStr, (int)p->size);
+ mir_tstrncpy((TCHAR*)ptr, p->defStr, (int)p->size);
}
else *(TCHAR**)ptr = mir_tstrdup(p->defStr);
}
@@ -133,14 +133,14 @@ static int sttServerEnum( const char* szSetting, LPARAM )
}
char* p2 = strchr(p1, ':');
pData->m_address = (char*)mir_alloc(p2 - p1 + 1);
- lstrcpynA(pData->m_address, p1, p2 - p1 + 1);
+ mir_strncpy(pData->m_address, p1, p2 - p1 + 1);
p1 = p2 + 1;
while (*p2 != 'G' && *p2 != '-')
p2++;
char* buf = (char*)alloca(p2 - p1 + 1);
- lstrcpynA(buf, p1, p2 - p1 + 1);
+ mir_strncpy(buf, p1, p2 - p1 + 1);
pData->m_portStart = atoi(buf);
if (*p2 == 'G')
@@ -149,14 +149,14 @@ static int sttServerEnum( const char* szSetting, LPARAM )
p1 = p2 + 1;
p2 = strchr(p1, 'G');
buf = (char*)alloca(p2 - p1 + 1);
- lstrcpynA(buf, p1, p2 - p1 + 1);
+ mir_strncpy(buf, p1, p2 - p1 + 1);
pData->m_portEnd = atoi(buf);
}
p1 = strchr(p2, ':') + 1;
p2 = strchr(p1, '\0');
pData->m_group = (char*)mir_alloc(p2 - p1 + 1);
- lstrcpynA(pData->m_group, p1, p2 - p1 + 1);
+ mir_strncpy(pData->m_group, p1, p2 - p1 + 1);
g_servers.insert(pData);
db_free(&dbv);
@@ -179,7 +179,7 @@ static void removeSpaces(TCHAR* p)
{
while (*p) {
if (*p == ' ')
- memmove(p, p + 1, sizeof(TCHAR)*lstrlen(p));
+ memmove(p, p + 1, sizeof(TCHAR)*mir_tstrlen(p));
p++;
}
}
@@ -762,9 +762,9 @@ void CConnectPrefsDlg::OnApply()
SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
if (pData && (INT_PTR)pData != CB_ERR) {
if (m_enableServer.GetState())
- lstrcpyA(m_proto->m_network, pData->m_group);
+ mir_strcpy(m_proto->m_network, pData->m_group);
else
- lstrcpyA(m_proto->m_network, "");
+ mir_strcpy(m_proto->m_network, "");
m_proto->m_iSSL = pData->m_iSSL;
}
@@ -927,8 +927,8 @@ void CCtcpPrefsDlg::OnApply()
if (m_enableIP.GetState()) {
char szTemp[500];
m_ip.GetTextA(szTemp, sizeof(szTemp));
- lstrcpynA(m_proto->m_mySpecifiedHost, GetWord(szTemp, 0).c_str(), 499);
- if (lstrlenA(m_proto->m_mySpecifiedHost))
+ mir_strncpy(m_proto->m_mySpecifiedHost, GetWord(szTemp, 0).c_str(), 499);
+ if (mir_strlen(m_proto->m_mySpecifiedHost))
m_proto->ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_proto->m_mySpecifiedHost, IP_MANUAL));
}
else m_proto->m_mySpecifiedHost[0] = 0;
@@ -1193,7 +1193,7 @@ void COtherPrefsDlg::OnApply()
void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
{
- String sSetting = String("PERFORM:") + szValueName;
+ CMStringA sSetting = CMStringA("PERFORM:") + szValueName;
sSetting.MakeUpper();
PERFORM_INFO* pPref;
@@ -1357,9 +1357,9 @@ void CIrcProto::InitIgnore(void)
pTemp--;
*++pTemp = 0;
- String mask = GetWord(p1, 0);
- String flags = GetWord(p1, 1);
- String network = GetWord(p1, 2);
+ CMStringA mask = GetWord(p1, 0);
+ CMStringA flags = GetWord(p1, 1);
+ CMStringA network = GetWord(p1, 2);
if (!mask.IsEmpty())
m_ignoreItems.insert(new CIrcIgnoreItem(getCodepage(), mask.c_str(), flags.c_str(), network.c_str()));
@@ -1892,7 +1892,7 @@ void InitServers()
if (serverFile) {
char* pszSvrs = (char*)LockResource(LoadResource(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), _T("TEXT"))));
if (pszSvrs)
- fwrite(pszSvrs, 1, lstrlenA(pszSvrs) + 1, serverFile);
+ fwrite(pszSvrs, 1, mir_strlen(pszSvrs) + 1, serverFile);
fclose(serverFile);
sttImportIni(szIniFile);
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp
index c67d884aaf..69a3c69335 100644
--- a/protocols/IRCG/src/output.cpp
+++ b/protocols/IRCG/src/output.cpp
@@ -134,7 +134,7 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg)
CMString mess = FormatOutput(pmsg);
if (!pmsg->m_bIncoming)
- ReplaceString(mess, _T("%%"), _T("%"));
+ mess.Replace(_T("%%"), _T("%"));
int iTemp = StrToInt(pmsg->sCommand.c_str());
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index 484a2b6739..3f2b63b4a6 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -39,9 +39,9 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawOut( WPARAM, LPARAM lParam )
{
char* pszRaw = (char*)lParam;
if (m_scriptingEnabled && pszRaw && IsConnected()) {
- String S = pszRaw;
- ReplaceString(S, "%", "%%%%");
- NLSendNoScript((const unsigned char *)S.c_str(), lstrlenA(S.c_str()));
+ CMStringA S = pszRaw;
+ S.Replace("%", "%%%%");
+ NLSendNoScript((const unsigned char *)S.c_str(), (int)mir_strlen(S.c_str()));
return 0;
}
@@ -110,7 +110,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
{
if (m_scriptingEnabled && lparam) {
- String sString = (char*)lparam, sRequest;
+ CMStringA sString = (char*)lparam, sRequest;
CMString sOutput, sChannel;
int i = sString.Find("|");
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 7579f1775e..b7a9f14381 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -328,7 +328,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM)
host = dbv1.pszVal;
if (host) {
- String S;
+ CMStringA S;
if (m_ignoreChannelDefault)
S = "+qnidcm";
else
@@ -421,47 +421,47 @@ static void DoChatFormatting(TCHAR* pszText)
switch (p1[1]) {
case 'B':
case 'b':
- lstrcpy(InsertThis, _T("\002"));
+ mir_tstrcpy(InsertThis, _T("\002"));
iRemoveChars = 2;
break;
case 'I':
case 'i':
- lstrcpy(InsertThis, _T("\026"));
+ mir_tstrcpy(InsertThis, _T("\026"));
iRemoveChars = 2;
break;
case 'U':
case 'u':
- lstrcpy(InsertThis, _T("\037"));
+ mir_tstrcpy(InsertThis, _T("\037"));
iRemoveChars = 2;
break;
case 'c':
{
- lstrcpy(InsertThis, _T("\003"));
+ mir_tstrcpy(InsertThis, _T("\003"));
iRemoveChars = 2;
TCHAR szTemp[3];
- lstrcpyn(szTemp, p1 + 2, 3);
+ mir_tstrncpy(szTemp, p1 + 2, 3);
iFG = _ttoi(szTemp);
}
break;
case 'C':
if (p1[2] == '%' && p1[3] == 'F') {
- lstrcpy(InsertThis, _T("\00399,99"));
+ mir_tstrcpy(InsertThis, _T("\00399,99"));
iRemoveChars = 4;
}
else {
- lstrcpy(InsertThis, _T("\00399"));
+ mir_tstrcpy(InsertThis, _T("\00399"));
iRemoveChars = 2;
}
iFG = -1;
break;
case 'f':
if (p1 - 3 >= pszText && p1[-3] == '\003')
- lstrcpy(InsertThis, _T(","));
+ mir_tstrcpy(InsertThis, _T(","));
else if (iFG >= 0)
mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\003%u,"), iFG);
else
- lstrcpy(InsertThis, _T("\00399,"));
+ mir_tstrcpy(InsertThis, _T("\00399,"));
iRemoveChars = 2;
break;
@@ -470,12 +470,12 @@ static void DoChatFormatting(TCHAR* pszText)
if (iFG >= 0)
mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\003%u,99"), iFG);
else
- lstrcpy(InsertThis, _T("\00399,99"));
+ mir_tstrcpy(InsertThis, _T("\00399,99"));
iRemoveChars = 2;
break;
case '%':
- lstrcpy(InsertThis, _T("%"));
+ mir_tstrcpy(InsertThis, _T("%"));
iRemoveChars = 2;
break;
@@ -484,10 +484,10 @@ static void DoChatFormatting(TCHAR* pszText)
break;
}
- MoveMemory(p1 + lstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(lstrlen(p1) - iRemoveChars + 1));
- CopyMemory(p1, InsertThis, sizeof(TCHAR)*lstrlen(InsertThis));
- if (iRemoveChars || lstrlen(InsertThis))
- p1 += lstrlen(InsertThis);
+ MoveMemory(p1 + mir_tstrlen(InsertThis), p1 + iRemoveChars, sizeof(TCHAR)*(mir_tstrlen(p1) - iRemoveChars + 1));
+ CopyMemory(p1, InsertThis, sizeof(TCHAR)*mir_tstrlen(InsertThis));
+ if (iRemoveChars || mir_tstrlen(InsertThis))
+ p1 += mir_tstrlen(InsertThis);
else
p1++;
}
@@ -517,8 +517,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch && gch->ptszText && *gch->ptszText) {
- TCHAR* pszText = new TCHAR[lstrlen(gch->ptszText) + 1000];
- lstrcpy(pszText, gch->ptszText);
+ TCHAR* pszText = new TCHAR[mir_tstrlen(gch->ptszText) + 1000];
+ mir_tstrcpy(pszText, gch->ptszText);
DoChatFormatting(pszText);
PostIrcMessageWnd(p1, NULL, pszText);
delete[]pszText;
@@ -877,8 +877,8 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
TCHAR stzChanName[100];
const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
- int len = min(((temp == NULL) ? lstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
- lstrcpyn(stzChanName, gcmi->pszID, len);
+ size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
+ mir_tstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL ? FALSE : TRUE;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 8046eebf0d..30c1e217f2 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -84,7 +84,7 @@ CMString __stdcall GetWord(const TCHAR* text, int index)
const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
{
- if (!text || !lstrlen(text))
+ if (!text || !mir_tstrlen(text))
return text;
const TCHAR* temp = text;
@@ -108,10 +108,10 @@ const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
return temp;
}
-void __stdcall RemoveLinebreaks(CMString& Message)
+void __stdcall RemoveLinebreaks(CMString &Message)
{
while (Message.Find(_T("\r\n\r\n"), 0) != -1)
- ReplaceString(Message, _T("\r\n\r\n"), _T("\r\n"));
+ Message.Replace(_T("\r\n\r\n"), _T("\r\n"));
if (Message.Find(_T("\r\n"), 0) == 0)
Message.Delete(0, 2);
@@ -120,34 +120,6 @@ void __stdcall RemoveLinebreaks(CMString& Message)
Message.Delete(Message.GetLength() - 2, 2);
}
-String& __stdcall ReplaceString(String& text, const char* replaceme, const char* newword)
-{
- if (!text.IsEmpty() && replaceme != NULL) {
- int i = 0;
- while ((i = text.Find(replaceme, i)) != -1) {
- text.Delete(i, lstrlenA(replaceme));
- text.Insert(i, newword);
- i = i + lstrlenA(newword);
- }
- }
-
- return text;
-}
-
-CMString& __stdcall ReplaceString(CMString& text, const TCHAR* replaceme, const TCHAR* newword)
-{
- if (!text.IsEmpty() && replaceme != NULL) {
- int i = 0;
- while ((i = text.Find(replaceme, i)) != -1) {
- text.Delete(i, lstrlen(replaceme));
- text.Insert(i, newword);
- i = i + lstrlen(newword);
- }
- }
-
- return text;
-}
-
char* __stdcall IrcLoadFile(TCHAR* szPath)
{
char * szContainer = NULL;
@@ -169,7 +141,7 @@ char* __stdcall IrcLoadFile(TCHAR* szPath)
int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
{
- if (wild == NULL || !lstrlen(wild) || string == NULL || !lstrlen(string))
+ if (wild == NULL || !mir_tstrlen(wild) || string == NULL || !mir_tstrlen(string))
return 1;
const TCHAR *cp = NULL, *mp = NULL;
@@ -210,7 +182,7 @@ bool CIrcProto::IsChannel(const TCHAR* sName)
return (sChannelPrefixes.Find(sName[0]) != -1);
}
-String __stdcall GetWord(const char* text, int index)
+CMStringA __stdcall GetWord(const char* text, int index)
{
if (text && text[0]) {
char* p1 = (char*)text;
@@ -236,11 +208,11 @@ String __stdcall GetWord(const char* text, int index)
p2 = strchr(p1, '\0');
if (p1 != p2)
- return String(p1, p2 - p1 + 1);
+ return CMStringA(p1, p2 - p1 + 1);
}
}
- return String();
+ return CMStringA();
}
bool CIrcProto::IsChannel(const char* sName)
@@ -337,10 +309,10 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
// fix foreground index
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- lstrcpyn(buf, text, 3);
+ mir_tstrncpy(buf, text, 3);
else
- lstrcpyn(buf, text, 2);
- text += lstrlen(buf);
+ mir_tstrncpy(buf, text, 2);
+ text += mir_tstrlen(buf);
iFG = _ttoi(buf);
// fix background color
@@ -348,10 +320,10 @@ TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePerce
text++;
if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
- lstrcpyn(buf, text, 3);
+ mir_tstrncpy(buf, text, 3);
else
- lstrcpyn(buf, text, 2);
- text += lstrlen(buf);
+ mir_tstrncpy(buf, text, 2);
+ text += mir_tstrlen(buf);
iBG = _ttoi(buf);
}
}
@@ -603,20 +575,20 @@ bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
if (pszLimit) {
- wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(lstrlen(pszLimit) + 1));
- lstrcpy(wi->pszLimit, pszLimit);
+ wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(mir_tstrlen(pszLimit) + 1));
+ mir_tstrcpy(wi->pszLimit, pszLimit);
}
if (pszMode) {
- wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(lstrlen(pszMode) + 1));
- lstrcpy(wi->pszMode, pszMode);
+ wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(mir_tstrlen(pszMode) + 1));
+ mir_tstrcpy(wi->pszMode, pszMode);
}
if (pszPassword) {
- wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(lstrlen(pszPassword) + 1));
- lstrcpy(wi->pszPassword, pszPassword);
+ wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(mir_tstrlen(pszPassword) + 1));
+ mir_tstrcpy(wi->pszPassword, pszPassword);
}
if (pszTopic) {
- wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(lstrlen(pszTopic) + 1));
- lstrcpy(wi->pszTopic, pszTopic);
+ wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(mir_tstrlen(pszTopic) + 1));
+ mir_tstrcpy(wi->pszTopic, pszTopic);
}
SetChannelSBText(window, wi);
@@ -633,7 +605,7 @@ void CIrcProto::FindLocalIP(HANDLE con) // inspiration from jabber
struct sockaddr_in saddr;
int len = sizeof(saddr);
getsockname(socket, (struct sockaddr *) &saddr, &len);
- lstrcpynA(m_myLocalHost, inet_ntoa(saddr.sin_addr), 49);
+ mir_strncpy(m_myLocalHost, inet_ntoa(saddr.sin_addr), 49);
m_myLocalPort = ntohs(saddr.sin_port);
}
}
diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp
index e02ab4ed5f..daaa364a14 100644
--- a/protocols/IRCG/src/ui_utils.cpp
+++ b/protocols/IRCG/src/ui_utils.cpp
@@ -314,7 +314,7 @@ TCHAR* CCtrlCombo::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, CB_GETLBTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, CB_GETLBTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
@@ -402,7 +402,7 @@ TCHAR* CCtrlListBox::GetItemText(int index, TCHAR *buf, int size)
{
TCHAR *result = (TCHAR *)_alloca(sizeof(TCHAR) * (SendMessage(m_hwnd, LB_GETTEXTLEN, index, 0) + 1));
SendMessage(m_hwnd, LB_GETTEXT, index, (LPARAM)result);
- lstrcpyn(buf, result, size);
+ mir_tstrncpy(buf, result, size);
return buf;
}
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index 38ea133fb6..c5389d8607 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -117,7 +117,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
S += _T(" (");
S += dbv.ptszVal;
S += _T(")");
- if ((lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
+ if ((mir_tstrlen(temp) < 4 && mir_tstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
db_free(&dbv);
return FALSE;
@@ -126,7 +126,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
}
GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
@@ -135,13 +135,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
GetDlgItemText(m_hwnd, IDC_USER, temp, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText(m_hwnd, IDC_HOST, temp, SIZEOF(temp));
- if (lstrlen(GetWord(temp, 0).c_str()))
+ if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 52b9d32726..0e48fc7432 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -282,10 +282,10 @@ void CListDlg::OnInitDialog()
lvC.cx = COLUMNS_SIZES[index];
switch (index) {
- case 0: lstrcpy(szBuffer, TranslateT("Channel")); break;
- case 1: lstrcpy(szBuffer, _T("#")); break;
- case 2: lstrcpy(szBuffer, TranslateT("Mode")); break;
- case 3: lstrcpy(szBuffer, TranslateT("Topic")); break;
+ case 0: mir_tstrcpy(szBuffer, TranslateT("Channel")); break;
+ case 1: mir_tstrcpy(szBuffer, _T("#")); break;
+ case 2: mir_tstrcpy(szBuffer, TranslateT("Mode")); break;
+ case 3: mir_tstrcpy(szBuffer, TranslateT("Topic")); break;
}
lvC.pszText = szBuffer;
m_list.InsertColumn(index, &lvC);
@@ -433,7 +433,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
lvm.pszText = temp2;
param->pList->GetItem(&lvm);
if (param->iSubItem != 1) {
- if (lstrlen(temp1) != 0 && lstrlen(temp2) != 0)
+ if (mir_tstrlen(temp1) != 0 && mir_tstrlen(temp2) != 0)
return lstrcmpi(temp1, temp2);
return (*temp1 == 0) ? 1 : -1;
@@ -511,7 +511,7 @@ void CJoinDlg::OnInitDialog()
for (int i = 0; i < 20; i++) {
if (!GetWord(dbv.ptszVal, i).IsEmpty()) {
CMString S = GetWord(dbv.ptszVal, i);
- ReplaceString(S, _T("%newl"), _T(" "));
+ S.Replace(_T("%newl"), _T(" "));
SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str());
}
}
@@ -535,7 +535,7 @@ void CJoinDlg::OnOk(CCtrlButton*)
m_proto->PostIrcMessage(_T("/JOIN #%s"), szTemp);
CMString S = szTemp;
- ReplaceString(S, _T(" "), _T("%newl"));
+ S.Replace(_T(" "), _T("%newl"));
CMString SL = S;
DBVARIANT dbv;
@@ -626,7 +626,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
int i = m_serverCombo.GetCurSel();
SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
if (pData && (INT_PTR)pData != CB_ERR) {
- lstrcpyA(m_proto->m_network, pData->m_group);
+ mir_strcpy(m_proto->m_network, pData->m_group);
pData->m_iSSL = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_SSL_ON))
pData->m_iSSL = 2;
@@ -761,7 +761,7 @@ void CQuestionDlg::OnOk(CCtrlButton*)
TCHAR* n = (TCHAR*)alloca(sizeof(TCHAR)*(j + 2));
GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, n, j + 1);
CMString S(n);
- ReplaceString(S, text, l);
+ S.Replace(text, l);
m_proto->PostIrcMessageWnd(NULL, NULL, (TCHAR*)S.c_str());
delete[]m;
@@ -919,7 +919,7 @@ void CManagerDlg::OnClose()
CMString S1 = temp;
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
- ReplaceString(S1, _T(" "), _T("%¤"));
+ S1.Replace(_T(" "), _T("%¤"));
#endif
S += _T(" ") + S1;
}
@@ -945,16 +945,16 @@ void CManagerDlg::OnAdd(CCtrlButton*)
TCHAR temp[100];
TCHAR mode[3];
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("+b"));
- lstrcpyn(temp, TranslateT("Add ban"), 100);
+ mir_tstrcpy(mode, _T("+b"));
+ mir_tstrncpy(temp, TranslateT("Add ban"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("+I"));
- lstrcpyn(temp, TranslateT("Add invite"), 100);
+ mir_tstrcpy(mode, _T("+I"));
+ mir_tstrncpy(temp, TranslateT("Add invite"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("+e"));
- lstrcpyn(temp, TranslateT("Add exception"), 100);
+ mir_tstrcpy(mode, _T("+e"));
+ mir_tstrncpy(temp, TranslateT("Add exception"), 100);
}
m_add.Disable();
@@ -987,16 +987,16 @@ void CManagerDlg::OnEdit(CCtrlButton*)
TCHAR temp[100];
TCHAR mode[3];
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("b"));
- lstrcpyn(temp, TranslateT("Edit ban"), 100);
+ mir_tstrcpy(mode, _T("b"));
+ mir_tstrncpy(temp, TranslateT("Edit ban"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("I"));
- lstrcpyn(temp, TranslateT("Edit invite?"), 100);
+ mir_tstrcpy(mode, _T("I"));
+ mir_tstrncpy(temp, TranslateT("Edit invite?"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("e"));
- lstrcpyn(temp, TranslateT("Edit exception?"), 100);
+ mir_tstrcpy(mode, _T("e"));
+ mir_tstrncpy(temp, TranslateT("Edit exception?"), 100);
}
CQuestionDlg* dlg = new CQuestionDlg(m_proto, this);
@@ -1033,16 +1033,16 @@ void CManagerDlg::OnRemove(CCtrlButton*)
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
- lstrcpy(mode, _T("-b"));
- lstrcpyn(temp, TranslateT("Remove ban?"), 100);
+ mir_tstrcpy(mode, _T("-b"));
+ mir_tstrncpy(temp, TranslateT("Remove ban?"), 100);
}
if (m_radio2.GetState()) {
- lstrcpy(mode, _T("-I"));
- lstrcpyn(temp, TranslateT("Remove invite?"), 100);
+ mir_tstrcpy(mode, _T("-I"));
+ mir_tstrncpy(temp, TranslateT("Remove invite?"), 100);
}
if (m_radio3.GetState()) {
- lstrcpy(mode, _T("-e"));
- lstrcpyn(temp, TranslateT("Remove exception?"), 100);
+ mir_tstrcpy(mode, _T("-e"));
+ mir_tstrncpy(temp, TranslateT("Remove exception?"), 100);
}
TCHAR window[256];
@@ -1090,58 +1090,58 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
CMString appendixremove = _T("");
if (wi->pszMode && _tcschr(wi->pszMode, 't')) {
if (!m_check1.GetState())
- lstrcat(toremove, _T("t"));
+ mir_tstrcat(toremove, _T("t"));
}
else if (m_check1.GetState())
- lstrcat(toadd, _T("t"));
+ mir_tstrcat(toadd, _T("t"));
if (wi->pszMode && _tcschr(wi->pszMode, 'n')) {
if (!m_check2.GetState())
- lstrcat(toremove, _T("n"));
+ mir_tstrcat(toremove, _T("n"));
}
else if (m_check2.GetState())
- lstrcat(toadd, _T("n"));
+ mir_tstrcat(toadd, _T("n"));
if (wi->pszMode && _tcschr(wi->pszMode, 'i')) {
if (!m_check3.GetState())
- lstrcat(toremove, _T("i"));
+ mir_tstrcat(toremove, _T("i"));
}
else if (m_check3.GetState())
- lstrcat(toadd, _T("i"));
+ mir_tstrcat(toadd, _T("i"));
if (wi->pszMode && _tcschr(wi->pszMode, 'm')) {
if (!m_check4.GetState())
- lstrcat(toremove, _T("m"));
+ mir_tstrcat(toremove, _T("m"));
}
else if (m_check4.GetState())
- lstrcat(toadd, _T("m"));
+ mir_tstrcat(toadd, _T("m"));
if (wi->pszMode && _tcschr(wi->pszMode, 'p')) {
if (!m_check7.GetState())
- lstrcat(toremove, _T("p"));
+ mir_tstrcat(toremove, _T("p"));
}
else if (m_check7.GetState())
- lstrcat(toadd, _T("p"));
+ mir_tstrcat(toadd, _T("p"));
if (wi->pszMode && _tcschr(wi->pszMode, 's')) {
if (!m_check8.GetState())
- lstrcat(toremove, _T("s"));
+ mir_tstrcat(toremove, _T("s"));
}
else if (m_check8.GetState())
- lstrcat(toadd, _T("s"));
+ mir_tstrcat(toadd, _T("s"));
if (wi->pszMode && _tcschr(wi->pszMode, 'c')) {
if (!m_check9.GetState())
- lstrcat(toremove, _T("c"));
+ mir_tstrcat(toremove, _T("c"));
}
else if (m_check9.GetState())
- lstrcat(toadd, _T("c"));
+ mir_tstrcat(toadd, _T("c"));
CMString Key = _T("");
CMString Limit = _T("");
if (wi->pszMode && wi->pszPassword && _tcschr(wi->pszMode, 'k')) {
if (!m_check5.GetState()) {
- lstrcat(toremove, _T("k"));
+ mir_tstrcat(toremove, _T("k"));
appendixremove += _T(" ") + CMString(wi->pszPassword);
}
else if (GetWindowTextLength(m_key.GetHwnd())) {
@@ -1149,15 +1149,15 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
m_key.GetText(temp, 14);
if (Key != temp) {
- lstrcat(toremove, _T("k"));
- lstrcat(toadd, _T("k"));
+ mir_tstrcat(toremove, _T("k"));
+ mir_tstrcat(toadd, _T("k"));
appendixadd += _T(" ") + CMString(temp);
appendixremove += _T(" ") + CMString(wi->pszPassword);
}
}
}
else if (m_check5.GetState() && GetWindowTextLength(m_key.GetHwnd())) {
- lstrcat(toadd, _T("k"));
+ mir_tstrcat(toadd, _T("k"));
appendixadd += _T(" ");
TCHAR temp[400];
@@ -1167,18 +1167,18 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
if (_tcschr(wi->pszMode, 'l')) {
if (!m_check6.GetState())
- lstrcat(toremove, _T("l"));
+ mir_tstrcat(toremove, _T("l"));
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
TCHAR temp[15];
GetDlgItemText(m_hwnd, IDC_LIMIT, temp, SIZEOF(temp));
if (wi->pszLimit && lstrcmpi(wi->pszLimit, temp)) {
- lstrcat(toadd, _T("l"));
+ mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ") + CMString(temp);
}
}
}
else if (m_check6.GetState() && GetWindowTextLength(m_limit.GetHwnd())) {
- lstrcat(toadd, _T("l"));
+ mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ");
TCHAR temp[15];
@@ -1186,19 +1186,19 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += temp;
}
- if (lstrlen(toadd) || lstrlen(toremove)) {
+ if (mir_tstrlen(toadd) || mir_tstrlen(toremove)) {
TCHAR temp[500];
- lstrcpy(temp, _T("/mode "));
- lstrcat(temp, window);
- lstrcat(temp, _T(" "));
- if (lstrlen(toremove))
+ mir_tstrcpy(temp, _T("/mode "));
+ mir_tstrcat(temp, window);
+ mir_tstrcat(temp, _T(" "));
+ if (mir_tstrlen(toremove))
mir_sntprintf(temp, 499, _T("%s-%s"), temp, toremove);
- if (lstrlen(toadd))
+ if (mir_tstrlen(toadd))
mir_sntprintf(temp, 499, _T("%s+%s"), temp, toadd);
if (!appendixremove.IsEmpty())
- lstrcat(temp, appendixremove.c_str());
+ mir_tstrcat(temp, appendixremove.c_str());
if (!appendixadd.IsEmpty())
- lstrcat(temp, appendixadd.c_str());
+ mir_tstrcat(temp, appendixadd.c_str());
m_proto->PostIrcMessage(temp);
}
}
@@ -1249,11 +1249,11 @@ void CManagerDlg::ApplyQuestion()
GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
TCHAR mode[3];
- lstrcpy(mode, _T("+b"));
+ mir_tstrcpy(mode, _T("+b"));
if (m_radio2.GetState())
- lstrcpy(mode, _T("+I"));
+ mir_tstrcpy(mode, _T("+I"));
if (m_radio3.GetState())
- lstrcpy(mode, _T("+e"));
+ mir_tstrcpy(mode, _T("+e"));
m_list.ResetContent();
m_radio1.Disable();
m_radio2.Disable();
@@ -1292,7 +1292,7 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window)
if (!S.IsEmpty()) {
/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */
#if !defined(__GNUC__) || !defined(UNICODE)
- ReplaceString(S, _T("%¤"), _T(" "));
+ S.Replace(_T("%¤"), _T(" "));
#endif
m_topic.SendMsg(CB_ADDSTRING, 0, (LPARAM)S.c_str());
}