Use CString::Equals() everywhere.

* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
kroimon
2008-09-30 15:15:59 +00:00
parent 18ce52e32d
commit 5237a24747
34 changed files with 401 additions and 411 deletions
+4 -4
View File
@@ -58,7 +58,7 @@ public:
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
if (sCommand.CaseCmp("ADD") == 0) {
if (sCommand.Equals("ADD")) {
CString sChan = sLine.Token(1);
if (AlreadyAdded(sChan)) {
@@ -68,14 +68,14 @@ public:
} else {
PutModule("Usage: Add [!]<#chan>");
}
} else if (sCommand.CaseCmp("DEL") == 0) {
} else if (sCommand.Equals("DEL")) {
CString sChan = sLine.Token(1);
if (Del(sChan))
PutModule("Removed " + sChan + " from list");
else
PutModule("Usage: Del [!]<#chan>");
} else if (sCommand.CaseCmp("LIST") == 0) {
} else if (sCommand.Equals("LIST")) {
CTable Table;
Table.AddColumn("Chan");
@@ -94,7 +94,7 @@ public:
} else {
PutModule("You have no entries.");
}
} else if (sCommand.CaseCmp("HELP") == 0) {
} else if (sCommand.Equals("HELP")) {
CTable Table;
Table.AddColumn("Command");
Table.AddColumn("Description");
+5 -5
View File
@@ -42,7 +42,7 @@ public:
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
if (sCommand.CaseCmp("ADD") == 0) {
if (sCommand.Equals("ADD")) {
CString sChan = sLine.Token(1);
if (AlreadyAdded(sChan)) {
@@ -52,14 +52,14 @@ public:
} else {
PutModule("Usage: Add [!]<#chan>");
}
} else if (sCommand.CaseCmp("DEL") == 0) {
} else if (sCommand.Equals("DEL")) {
CString sChan = sLine.Token(1);
if (Del(sChan))
PutModule("Removed " + sChan + " from list");
else
PutModule("Usage: Del [!]<#chan>");
} else if (sCommand.CaseCmp("LIST") == 0) {
} else if (sCommand.Equals("LIST")) {
CTable Table;
Table.AddColumn("Chan");
@@ -78,7 +78,7 @@ public:
} else {
PutModule("You have no entries.");
}
} else if (sCommand.CaseCmp("HELP") == 0) {
} else if (sCommand.Equals("HELP")) {
CTable Table;
Table.AddColumn("Command");
Table.AddColumn("Description");
@@ -127,7 +127,7 @@ protected:
// Is that person us and we don't have op?
const CNick* pNick = Channel.GetNicks().begin()->second;
if (!pNick->HasPerm(CChan::Op) && pNick->GetNick().CaseCmp(m_pUser->GetCurNick()) == 0)
if (!pNick->HasPerm(CChan::Op) && pNick->GetNick().Equals(m_pUser->GetCurNick()))
Channel.Cycle();
}
+11 -11
View File
@@ -163,7 +163,7 @@ public:
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
// and the nick who joined is a valid user
if (it->second->HostMatches(Nick.GetHostMask()) && it->second->ChannelMatches(Channel.GetName())) {
if (it->second->GetUserKey().CaseCmp("__NOKEY__") == 0) {
if (it->second->GetUserKey().Equals("__NOKEY__")) {
PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick());
} else {
// then insert this nick into the queue, the timer does the rest
@@ -195,15 +195,15 @@ public:
}
virtual EModRet OnPrivNotice(CNick& Nick, CString& sMessage) {
if (sMessage.Token(0).CaseCmp("!ZNCAO") != 0) {
if (!sMessage.Token(0).Equals("!ZNCAO")) {
return CONTINUE;
}
CString sCommand = sMessage.Token(1);
if (sCommand.CaseCmp("CHALLENGE") == 0) {
if (sCommand.Equals("CHALLENGE")) {
ChallengeRespond(Nick, sMessage.Token(2));
} else if (sCommand.CaseCmp("RESPONSE") == 0) {
} else if (sCommand.Equals("RESPONSE")) {
VerifyResponse(Nick, sMessage.Token(2));
}
@@ -213,16 +213,16 @@ public:
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0).AsUpper();
if (sCommand.CaseCmp("HELP") == 0) {
if (sCommand.Equals("HELP")) {
PutModule("Commands are: ListUsers, AddChans, DelChans, AddUser, DelUser");
} else if (sCommand.CaseCmp("TIMERS") == 0) {
} else if (sCommand.Equals("TIMERS")) {
ListTimers();
} else if (sCommand.CaseCmp("ADDUSER") == 0 || sCommand.CaseCmp("DELUSER") == 0) {
} else if (sCommand.Equals("ADDUSER") || sCommand.Equals("DELUSER")) {
CString sUser = sLine.Token(1);
CString sHost = sLine.Token(2);
CString sKey = sLine.Token(3);
if (sCommand.CaseCmp("ADDUSER") == 0) {
if (sCommand.Equals("ADDUSER")) {
if (sHost.empty()) {
PutModule("Usage: " + sCommand + " <user> <hostmask> <key> [channels]");
} else {
@@ -236,7 +236,7 @@ public:
DelUser(sUser);
DelNV(sUser);
}
} else if (sCommand.CaseCmp("LISTUSERS") == 0) {
} else if (sCommand.Equals("LISTUSERS")) {
if (m_msUsers.empty()) {
PutModule("There are no users defined");
return;
@@ -258,7 +258,7 @@ public:
}
PutModule(Table);
} else if (sCommand.CaseCmp("ADDCHANS") == 0 || sCommand.CaseCmp("DELCHANS") == 0) {
} else if (sCommand.Equals("ADDCHANS") || sCommand.Equals("DELCHANS")) {
CString sUser = sLine.Token(1);
CString sChans = sLine.Token(2, true);
@@ -274,7 +274,7 @@ public:
return;
}
if (sCommand.CaseCmp("ADDCHANS") == 0) {
if (sCommand.Equals("ADDCHANS")) {
pUser->AddChans(sChans);
PutModule("Channel(s) added to user [" + pUser->GetUsername() + "]");
} else {
+9 -7
View File
@@ -76,7 +76,7 @@ public:
if (pIRCSock) {
CString sConfNick = m_pUser->GetNick();
if (pIRCSock->GetNick().CaseCmp(GetAwayNick().Left(pIRCSock->GetNick().length())) == 0) {
if (pIRCSock->GetNick().Equals(GetAwayNick().Left(pIRCSock->GetNick().length()))) {
RemTimer("BackNickTimer");
AddTimer(new CBackNickTimer(*this));
}
@@ -104,11 +104,13 @@ public:
}
}
virtual void OnModCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "TIMERS") == 0) {
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
if (sCommand.Equals("TIMERS")) {
ListTimers();
} else if (sCommand.Token(0).CaseCmp("SET") == 0) {
CString sFormat(sCommand.Token(1));
}
else if (sCommand.Equals("SET")) {
CString sFormat = sLine.Token(1);
if (!sFormat.empty()) {
m_sFormat = sFormat;
@@ -125,7 +127,7 @@ public:
PutModule(sMsg);
}
} else if (sCommand.Token(0).CaseCmp("SHOW") == 0) {
} else if (sCommand.Equals("SHOW")) {
if (m_pUser) {
CString sExpanded = GetAwayNick();
CString sMsg = "AwayNick is set to [" + m_sFormat + "]";
@@ -136,7 +138,7 @@ public:
PutModule(sMsg);
}
} else if (sCommand.Token(0).CaseCmp("HELP") == 0) {
} else if (sCommand.Equals("HELP")) {
PutModule("Commands are: show, timers, set [awaynick]");
}
}
+5 -7
View File
@@ -91,7 +91,7 @@ public:
virtual void OnModCommand(const CString& sCommand) {
CString sCmd = sCommand.Token(0);
if (sCmd.CaseCmp("DELKEY") == 0) {
if (sCmd.Equals("DELKEY")) {
CString sTarget = sCommand.Token(1);
if (!sTarget.empty()) {
@@ -103,14 +103,12 @@ public:
} else {
PutModule("Usage DelKey <#chan|Nick>");
}
} else if (sCmd.CaseCmp("SETKEY") == 0) {
} else if (sCmd.Equals("SETKEY")) {
CString sTarget = sCommand.Token(1);
CString sKey = sCommand.Token(2, true);
// Strip "cbc:" from beginning of string incase someone pastes directly from mircryption
if (sKey.Left(4).CaseCmp("cbc:") == 0) {
sKey.LeftChomp(4);
}
sKey.TrimPrefix("cbc:");
if (!sKey.empty()) {
SetNV(sTarget.AsLower(), sKey);
@@ -118,7 +116,7 @@ public:
} else {
PutModule("Usage: SetKey <#chan|Nick> <Key>");
}
} else if (sCmd.CaseCmp("LISTKEYS") == 0) {
} else if (sCmd.Equals("LISTKEYS")) {
if (BeginNV() == EndNV()) {
PutModule("You have no encryption keys set.");
} else {
@@ -134,7 +132,7 @@ public:
PutModule(Table);
}
} else if (sCmd.CaseCmp("HELP") == 0) {
} else if (sCmd.Equals("HELP")) {
PutModule("Try: SetKey, DelKey, ListKeys");
} else {
PutModule("Unknown command, try 'Help'");
+2 -2
View File
@@ -182,9 +182,9 @@ public:
if (sLine.empty())
break; // out of the headers
if (strncasecmp(sLine.c_str(), "From: ", 6) == 0)
if (sLine.Equals("From: ", false, 6))
tmp.sFrom = sLine.substr(6, CString::npos);
else if (strncasecmp(sLine.c_str(), "Subject: ", 9) == 0)
else if (sLine.Equals("Subject: ", false, 9))
tmp.sSubject = sLine.substr(9, CString::npos);
if ((!tmp.sFrom.empty()) && (!tmp.sSubject.empty()))
+1 -1
View File
@@ -137,7 +137,7 @@ void CIMAPSock::ReadLine(const CString& sLine) {
} else {
CUser* pUser = CZNC::Get().FindUser(m_spAuth->GetUsername());
if (pUser && sLine.Left(7).CaseCmp("AUTH OK") == 0) {
if (pUser && sLine.Equals("AUTH OK", false, 7)) {
m_spAuth->AcceptLogin(*pUser);
m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text
DEBUG_ONLY(cerr << "+++ Successful IMAP lookup" << endl);
+9 -9
View File
@@ -50,7 +50,7 @@ public:
return;
// Do we already have the nick we want?
if (pIRCSock->GetNick().CaseCmp(GetNick()) == 0)
if (pIRCSock->GetNick().Equals(GetNick()))
return;
PutIRC("NICK " + GetNick());
@@ -69,12 +69,12 @@ public:
void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) {
if (sNewNick == GetUser()->GetIRCSock()->GetNick()) {
// We are changing our own nick
if (Nick.GetNick().CaseCmp(GetNick()) == 0) {
if (Nick.GetNick().Equals(GetNick())) {
// We are changing our nick away from the conf setting.
// Let's assume the user wants this and disable
// this module (to avoid fighting nickserv).
Disable();
} else if (sNewNick.CaseCmp(GetNick()) == 0) {
} else if (sNewNick.Equals(GetNick())) {
// We are changing our nick to the conf setting,
// so we don't need that timer anymore.
Disable();
@@ -83,14 +83,14 @@ public:
}
// If the nick we want is free now, be fast and get the nick
if (Nick.GetNick().CaseCmp(GetNick()) == 0) {
if (Nick.GetNick().Equals(GetNick())) {
KeepNick();
}
}
void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {
// If someone with the nick we want quits, be fast and get the nick
if (Nick.GetNick().CaseCmp(GetNick()) == 0) {
if (Nick.GetNick().Equals(GetNick())) {
KeepNick();
}
}
@@ -101,7 +101,7 @@ public:
}
void OnIRCConnected() {
if (GetUser()->GetIRCSock()->GetNick().CaseCmp(GetNick()) != 0) {
if (!GetUser()->GetIRCSock()->GetNick().Equals(GetNick())) {
// We don't have the nick we want, try to get it
Enable();
}
@@ -130,7 +130,7 @@ public:
return CONTINUE;
// We are trying to get the config nick and this is a /nick?
if (!m_pTimer || sLine.Token(0).CaseCmp("NICK") != 0)
if (!m_pTimer || !sLine.Token(0).Equals("NICK"))
return CONTINUE;
// Is the nick change for the nick we are trying to get?
@@ -140,7 +140,7 @@ public:
if (sNick.Left(1) == ":")
sNick.LeftChomp();
if (sNick.CaseCmp(GetNick()) != 0)
if (!sNick.Equals(GetNick()))
return CONTINUE;
// Indeed trying to change to this nick, generate a 433 for it.
@@ -153,7 +153,7 @@ public:
virtual EModRet OnRaw(CString& sLine) {
// Are we trying to get our primary nick and we caused this error?
// :irc.server.net 433 mynick badnick :Nickname is already in use.
if (m_pTimer && sLine.Token(1) == "433" && sLine.Token(3).CaseCmp(GetNick()) == 0)
if (m_pTimer && sLine.Token(1) == "433" && sLine.Token(3).Equals(GetNick()))
return HALT;
return CONTINUE;
+1 -1
View File
@@ -96,7 +96,7 @@ public:
}
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& pChan, const CString& sMessage) {
if (m_pUser->GetCurNick().CaseCmp(sKickedNick) == 0) {
if (m_pUser->GetCurNick().Equals(sKickedNick)) {
if (!delay) {
PutIRC("JOIN " + pChan.GetName() + " " + pChan.GetKey());
pChan.Enable();
+4 -4
View File
@@ -260,7 +260,7 @@ public:
virtual EModRet OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan)
{
if ((sName.CaseCmp("loadperlmodule") == 0) && (pUser))
if (sName.Equals("loadperlmodule") && pUser)
{
m_pUser = pUser;
if (sValue.Right(3) == ".pm")
@@ -475,14 +475,14 @@ public:
{
CString sCommand = sLine.Token(0);
if (sCommand.CaseCmp("loadperlmod", 11) == 0 || sCommand.CaseCmp("unloadperlmod", 13) == 0 || sCommand.CaseCmp("reloadperlmod", 13) == 0)
if (sCommand.Equals("loadperlmod", false, 11) || sCommand.Equals("unloadperlmod", false, 13) || sCommand.Equals("reloadperlmod", false, 13))
{
CString sModule = sLine.Token(1);
if (sModule.Right(3) != ".pm")
sModule += ".pm";
if (sCommand.CaseCmp("loadperlmod", 11) == 0)
if (sCommand.Equals("loadperlmod", false, 11))
LoadPerlMod(sModule);
else if (sCommand.CaseCmp("unloadperlmod", 13) == 0)
else if (sCommand.Equals("unloadperlmod", false, 13))
UnloadPerlMod(sModule);
else
{
+1 -1
View File
@@ -52,7 +52,7 @@ public:
void HandleMessage(CNick& Nick, const CString& sMessage)
{
if (!m_sPass.empty()
&& Nick.GetNick().CaseCmp("NickServ") == 0
&& Nick.GetNick().Equals("NickServ")
&& sMessage.find("msg") != CString::npos
&& sMessage.AsUpper().find("IDENTIFY") != CString::npos
&& sMessage.find("help") == CString::npos) {
+10 -12
View File
@@ -219,17 +219,15 @@ public:
}
virtual EModRet OnUserRaw(CString& sLine) {
if (sLine.Left(5).CaseCmp("WHO ~") == 0) {
if (sLine.Equals("WHO ~", false, 5)) {
return HALT;
} else if (sLine.Left(6).CaseCmp("MODE ~") == 0) {
} else if (sLine.Equals("MODE ~", false, 6)) {
return HALT;
} else if (sLine.Left(8).CaseCmp("TOPIC ~#") == 0) {
} else if (sLine.Equals("TOPIC ~#", false, 8)) {
CString sChannel = sLine.Token(1);
CString sTopic = sLine.Token(2, true);
if (sTopic.Left(1) == ":") {
sTopic.LeftChomp();
}
sTopic.TrimPrefix(":");
CPartylineChannel* pChannel = FindChannel(sChannel);
@@ -391,7 +389,7 @@ public:
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
if (sCommand.CaseCmp("HELP") == 0) {
if (sCommand.Equals("HELP")) {
CTable Table;
Table.AddColumn("Command");
Table.AddColumn("Arguments");
@@ -428,7 +426,7 @@ public:
Table.SetCell("Description", "Show which users can not part this channel");
PutModule(Table);
} else if (sCommand.CaseCmp("LIST") == 0) {
} else if (sCommand.Equals("LIST")) {
if (!m_ssChannels.size()) {
PutModule("There are no open channels.");
return;
@@ -447,7 +445,7 @@ public:
}
PutModule(Table);
} else if (sCommand.CaseCmp("ADDFIXCHAN") == 0) {
} else if (sCommand.Equals("ADDFIXCHAN")) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
@@ -474,7 +472,7 @@ public:
SaveFixedChans(pUser);
PutModule("Fixed " + sUser + " to channel " + sChan);
} else if (sCommand.CaseCmp("DELFIXCHAN") == 0) {
} else if (sCommand.Equals("DELFIXCHAN")) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
@@ -499,7 +497,7 @@ public:
SaveFixedChans(pUser);
PutModule("Removed " + sUser + " from " + sChan);
} else if (sCommand.CaseCmp("LISTFIXCHANS") == 0) {
} else if (sCommand.Equals("LISTFIXCHANS")) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
@@ -517,7 +515,7 @@ public:
}
}
PutModule("--- End of list");
} else if (sCommand.CaseCmp("LISTFIXUSERS") == 0) {
} else if (sCommand.Equals("LISTFIXUSERS")) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
+3 -3
View File
@@ -41,12 +41,12 @@ public:
if (sPerf.Left(1) == "/")
sPerf.LeftChomp();
if (sPerf.Token(0).CaseCmp("MSG") == 0) {
if (sPerf.Token(0).Equals("MSG")) {
sPerf = "PRIVMSG " + sPerf.Token(1, true);
}
if ((sPerf.Token(0).CaseCmp("PRIVMSG") == 0 ||
sPerf.Token(0).CaseCmp("NOTICE") == 0) &&
if ((sPerf.Token(0).Equals("PRIVMSG") ||
sPerf.Token(0).Equals("NOTICE")) &&
sPerf.Token(2).Left(1) != ":") {
sPerf = sPerf.Token(0) + " " + sPerf.Token(1)
+ " :" + sPerf.Token(2, true);
+6 -6
View File
@@ -303,7 +303,7 @@ private:
}
EModRet HandleMessage(const CNick& Nick, CString sMessage) {
if (Nick.GetNick().CaseCmp("Q") != 0 || Nick.GetHost().CaseCmp("CServe.quakenet.org") != 0)
if (!Nick.GetNick().Equals("Q") || !Nick.GetHost().Equals("CServe.quakenet.org"))
return CONTINUE;
sMessage.Trim();
@@ -330,14 +330,14 @@ private:
m_msChanModes[sChannel] = sFlags;
}
else if (m_bRequestedWhoami && m_bCatchResponse
&& (sMessage.CaseCmp("End of list.") == 0
|| sMessage.CaseCmp("account, or HELLO to create an account.") == 0)) {
&& (sMessage.Equals("End of list.")
|| sMessage.Equals("account, or HELLO to create an account."))) {
m_bRequestedWhoami = m_bCatchResponse = false;
return HALT;
}
// AUTH
else if (sMessage.CaseCmp("Username or password incorrect.") == 0) {
else if (sMessage.Equals("Username or password incorrect.")) {
m_bAuthed = false;
PutModule("Auth failed: " + sMessage);
return HALT;
@@ -348,7 +348,7 @@ private:
WhoAmI();
return HALT;
}
else if (m_bRequestedChallenge && sMessage.Token(0).CaseCmp("CHALLENGE") == 0) {
else if (m_bRequestedChallenge && sMessage.Token(0).Equals("CHALLENGE")) {
m_bRequestedChallenge = false;
if (sMessage.find("not available once you have authed") != CString::npos) {
m_bAuthed = true;
@@ -409,7 +409,7 @@ private:
}
bool IsSelf(const CNick& Nick) {
return Nick.GetNick().CaseCmp(m_pUser->GetCurNick()) == 0;
return Nick.GetNick().Equals(m_pUser->GetCurNick());
}
bool PackHex(const CString& sHex, CString& sPackedHex) {
+2 -2
View File
@@ -205,13 +205,13 @@ public:
}
virtual void OnModCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "TIMERS") == 0) {
if (sCommand.Equals("TIMERS")) {
ListTimers();
}
}
virtual EModRet OnStatusCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "SAMPLE") == 0) {
if (sCommand.Equals("SAMPLE")) {
PutModule("Hi, I'm your friendly sample module.");
return HALT;
}
+11 -18
View File
@@ -157,30 +157,23 @@ public:
}
}
virtual void OnModCommand(const CString& sCommand)
virtual void OnModCommand(const CString& sCmdLine)
{
CString::size_type iPos = sCommand.find(" ");
CString sCom, sArgs;
if (iPos == CString::npos)
sCom = sCommand;
else
{
sCom = sCommand.substr(0, iPos);
sArgs = sCommand.substr(iPos + 1, CString::npos);
}
CString sCommand = sCmdLine.Token(0);
CString sArgs = sCmdLine.Token(1, true);
if (strcasecmp(sCom.c_str(), "setpass") == 0)
if (sCommand.Equals("setpass"))
{
PutModule("Password set to [" + sArgs + "]");
m_sPassword = CBlowfish::MD5(sArgs);
} else if (strcasecmp(sCom.c_str(), "dumpbuff") == 0)
} else if (sCommand.Equals("dumpbuff"))
{
CString sFile;
if (DecryptChannel(sArgs, sFile))
{
CString sLine;
iPos = 0;
CString::size_type iPos = 0;
while (ReadLine(sFile, sLine, iPos))
{
sLine.Trim();
@@ -188,12 +181,12 @@ public:
}
}
PutModule("//!-- EOF " + sArgs);
} else if (strcasecmp(sCom.c_str(), "replay") == 0)
} else if (sCommand.Equals("replay"))
{
Replay(sArgs);
PutModule("Replayed " + sArgs);
} else if (strcasecmp(sCom.c_str(), "save") == 0)
} else if (sCommand.Equals("save"))
{
SaveBufferToDisk();
PutModule("Done.");
@@ -247,7 +240,7 @@ public:
continue;
vChans[a]->AddBuffer(SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage));
}
if (cNick.GetNick().CaseCmp(m_pUser->GetNick()) == 0)
if (cNick.GetNick().Equals(m_pUser->GetNick()))
SaveBufferToDisk(); // need to force a save here to see this!
}
@@ -268,7 +261,7 @@ public:
}
virtual void OnJoin(const CNick& cNick, CChan& cChannel)
{
if ((cNick.GetNick().CaseCmp(m_pUser->GetNick()) == 0) && (cChannel.GetBuffer().empty()))
if (cNick.GetNick().Equals(m_pUser->GetNick()) && cChannel.GetBuffer().empty())
{
BootStrap((CChan *)&cChannel);
if (!cChannel.GetBuffer().empty())
@@ -283,7 +276,7 @@ public:
if (!cChannel.KeepBuffer())
return;
((CChan &)cChannel).AddBuffer(SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " PART"));
if (cNick.GetNick().CaseCmp(m_pUser->GetNick()) == 0)
if (cNick.GetNick().Equals(m_pUser->GetNick()))
SaveBufferToDisk(); // need to force a save here to see this!
}
+13 -13
View File
@@ -161,12 +161,12 @@ public:
virtual EModRet OnUserRaw(CString & sLine)
{
if (sLine.CaseCmp("schat ", 6) == 0)
if (sLine.Equals("schat ", false, 6))
{
OnModCommand("chat " + sLine.substr(6));
return(HALT);
} else if (sLine.CaseCmp("schat") == 0)
} else if (sLine.Equals("schat"))
{
PutModule("SChat User Area ...");
OnModCommand("help");
@@ -184,7 +184,7 @@ public:
sCom = sCommand.Token(0);
sArgs = sCommand.Token(1, true);
if ((sCom.CaseCmp("chat") == 0) && (!sArgs.empty())) {
if (sCom.Equals("chat") && !sArgs.empty()) {
CString sSockName = "SCHAT::" + m_pUser->GetUserName();
CString sNick = "(s)" + sArgs;
for (u_int a= 0; a < m_pManager->size(); a++)
@@ -193,7 +193,7 @@ public:
continue;
CSChatSock *pSock = (CSChatSock *)(*m_pManager)[a];
if (pSock->GetChatNick().CaseCmp(sNick.c_str()) == 0)
if (pSock->GetChatNick().Equals(sNick))
{
PutModule("Already Connected to [" + sArgs + "]");
return;
@@ -223,7 +223,7 @@ public:
PutIRC(s.str());
} else if (sCom.CaseCmp("list") == 0)
} else if (sCom.Equals("list"))
{
CString sName = "SCHAT::" + m_pUser->GetUserName();
CTable Table;
@@ -272,7 +272,7 @@ public:
} else
PutModule("No SDCCs currently in session");
} else if (sCom.CaseCmp("close") == 0)
} else if (sCom.Equals("close"))
{
CString sName = "SCHAT::" + m_pUser->GetUserName();
for (u_int a = 0; a < m_pManager->size(); a++)
@@ -281,17 +281,17 @@ public:
continue;
CSChatSock *pSock = (CSChatSock *)(*m_pManager)[a];
if (sArgs.CaseCmp("(s)", 3) != 0)
if (!sArgs.Equals("(s)", false, 3))
sArgs = "(s)" + sArgs;
if (sArgs.CaseCmp(pSock->GetChatNick()) == 0)
if (sArgs.Equals(pSock->GetChatNick()))
{
pSock->Close();
return;
}
}
PutModule("No Such Chat [" + sArgs + "]");
} else if (sCom.CaseCmp("showsocks") == 0)
} else if (sCom.Equals("showsocks"))
{
CTable Table;
Table.AddColumn("SockName");
@@ -344,7 +344,7 @@ public:
else
PutModule("Error Finding Sockets");
} else if (sCom.CaseCmp("help") == 0)
} else if (sCom.Equals("help"))
{
PutModule("Commands are: ");
PutModule(" help - This text.");
@@ -353,7 +353,7 @@ public:
PutModule(" close <nick> - Close a chat to a nick.");
PutModule(" timers - Shows related timers.");
PutModule(" showsocks - Shows all socket connections.");
} else if (sCom.CaseCmp("timers") == 0)
} else if (sCom.Equals("timers"))
ListTimers();
else
PutModule("Unknown command [" + sCom + "] [" + sArgs + "]");
@@ -361,7 +361,7 @@ public:
virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage)
{
if (sMessage.CaseCmp("DCC SCHAT ", 10) == 0)
if (sMessage.Equals("DCC SCHAT ", false, 10))
{
// chat ip port
unsigned long iIP = sMessage.Token(3).ToULong();
@@ -413,7 +413,7 @@ public:
if (it != m_siiWaitingChats.end())
{
if (sMessage.CaseCmp("yes") != 0)
if (!sMessage.Equals("yes"))
SendToUser(sTarget + "!" + sTarget + "@" +
CUtils::GetIP(it->second.first),
"Refusing to accept DCC SCHAT!");
+13 -11
View File
@@ -60,9 +60,11 @@ public:
return true;
}
virtual void OnModCommand(const CString& sCommand) {
if ((strcasecmp(sCommand.c_str(), "cd") == 0) || (strncasecmp(sCommand.c_str(), "cd ", 3) == 0)) {
CString sPath = CDir::ChangeDir(m_sPath, ((sCommand.length() == 2) ? CString(CZNC::Get().GetHomePath()) : CString(sCommand.substr(3))), CZNC::Get().GetHomePath());
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
if (sCommand.Equals("cd")) {
CString sArg = sCommand.Token(1, true);
CString sPath = CDir::ChangeDir(m_sPath, (sArg.empty() ? CString(CZNC::Get().GetHomePath()) : sArg), CZNC::Get().GetHomePath());
CFile Dir(sPath);
if (Dir.IsDir()) {
@@ -74,9 +76,9 @@ public:
}
PutShell("znc$");
} else if (strcasecmp(sCommand.Token(0).c_str(), "SEND") == 0) {
CString sToNick = sCommand.Token(1);
CString sFile = sCommand.Token(2);
} else if (sCommand.Equals("SEND")) {
CString sToNick = sLine.Token(1);
CString sFile = sLine.Token(2);
if ((sToNick.empty()) || (sFile.empty())) {
PutShell("usage: Send <nick> <file>");
@@ -91,8 +93,8 @@ public:
m_pUser->SendFile(sToNick, sFile, GetModName());
}
}
} else if (strcasecmp(sCommand.Token(0).c_str(), "GET") == 0) {
CString sFile = sCommand.Token(1);
} else if (sCommand.Equals("GET")) {
CString sFile = sLine.Token(1);
if (sFile.empty()) {
PutShell("usage: Get <file>");
@@ -108,12 +110,12 @@ public:
}
}
} else {
RunCommand(sCommand);
RunCommand(sLine);
}
}
virtual EModRet OnStatusCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "SHELL") == 0) {
if (sCommand.Equals("SHELL")) {
PutShell("-- ZNC Shell Service --");
return HALT;
}
@@ -122,7 +124,7 @@ public:
}
virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) {
if (strcasecmp(RemoteNick.GetNick().c_str(), CString(GetModNick()).c_str()) == 0) {
if (RemoteNick.GetNick().Equals(GetModNick())) {
CString sLocalFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());
m_pUser->GetFile(m_pUser->GetCurNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize, GetModName());
+1 -1
View File
@@ -112,7 +112,7 @@ public:
const CString sCmd = sLine.Token(0);
const CString sArg = sLine.Token(1, true).Trim_n(" ");
if (sCmd.CaseCmp("AWAY") != 0)
if (!sCmd.Equals("AWAY"))
return CONTINUE;
// When a client sets us away, we don't touch that away message
+1 -1
View File
@@ -23,7 +23,7 @@ public:
{
for (MCString::iterator it = BeginNV(); it != EndNV(); it++)
{
if (sChannel.CaseCmp(it->first) == 0)
if (sChannel.Equals(it->first))
{
CChan* pChan = m_pUser->FindChan(sChannel);
+14 -14
View File
@@ -84,9 +84,9 @@ public:
}
bool operator ==(const CWatchEntry& WatchEntry) {
return (strcasecmp(GetHostMask().c_str(), WatchEntry.GetHostMask().c_str()) == 0
&& strcasecmp(GetTarget().c_str(), WatchEntry.GetTarget().c_str()) == 0
&& strcasecmp(GetPattern().c_str(), WatchEntry.GetPattern().c_str()) == 0
return (GetHostMask().Equals(WatchEntry.GetHostMask())
&& GetTarget().Equals(WatchEntry.GetTarget())
&& GetPattern().Equals(WatchEntry.GetPattern())
);
}
@@ -229,15 +229,15 @@ public:
virtual void OnModCommand(const CString& sCommand) {
CString sCmdName = sCommand.Token(0);
if (strcasecmp(sCmdName.c_str(), "ADD") == 0 || strcasecmp(sCmdName.c_str(), "WATCH") == 0) {
if (sCmdName.Equals("ADD") || sCmdName.Equals("WATCH")) {
Watch(sCommand.Token(1), sCommand.Token(2), sCommand.Token(3, true));
} else if (strcasecmp(sCmdName.c_str(), "HELP") == 0) {
} else if (sCmdName.Equals("HELP")) {
Help();
} else if (strcasecmp(sCmdName.c_str(), "LIST") == 0) {
} else if (sCmdName.Equals("LIST")) {
List();
} else if (strcasecmp(sCmdName.c_str(), "DUMP") == 0) {
} else if (sCmdName.Equals("DUMP")) {
Dump();
} else if (strcasecmp(sCmdName.c_str(), "ENABLE") == 0) {
} else if (sCmdName.Equals("ENABLE")) {
CString sTok = sCommand.Token(1);
if (sTok == "*") {
@@ -245,7 +245,7 @@ public:
} else {
SetDisabled(atoi(sTok.c_str()), false);
}
} else if (strcasecmp(sCmdName.c_str(), "DISABLE") == 0) {
} else if (sCmdName.Equals("DISABLE")) {
CString sTok = sCommand.Token(1);
if (sTok == "*") {
@@ -253,12 +253,12 @@ public:
} else {
SetDisabled(atoi(sTok.c_str()), true);
}
} else if (strcasecmp(sCmdName.c_str(), "SETSOURCES") == 0) {
} else if (sCmdName.Equals("SETSOURCES")) {
SetSources(atoi(sCommand.Token(1).c_str()), sCommand.Token(2, true));
} else if (strcasecmp(sCmdName.c_str(), "CLEAR") == 0) {
} else if (sCmdName.Equals("CLEAR")) {
m_lsWatchers.clear();
PutModule("All entries cleared.");
} else if (strcasecmp(sCmdName.c_str(), "BUFFER") == 0) {
} else if (sCmdName.Equals("BUFFER")) {
CString sCount = sCommand.Token(1);
if (sCount.size()) {
@@ -266,10 +266,10 @@ public:
}
PutModule("Buffer count is set to [" + CString(m_Buffer.GetLineCount()) + "]");
} else if (strcasecmp(sCmdName.c_str(), "DEL") == 0) {
} else if (sCmdName.Equals("DEL")) {
Remove(atoi(sCommand.Token(1).c_str()));
} else {
PutModule("Unknown command: [" + sCommand.Token(0) + "]");
PutModule("Unknown command: [" + sCmdName + "]");
}
}
+5 -5
View File
@@ -136,9 +136,9 @@ public:
sOpt = sArgs.Token(0);
sArgs = sArgs.Token(1, true);
if (sOpt.CaseCmp("-IPV6") == 0) {
if (sOpt.Equals("-IPV6")) {
bIPv6 = true;
} else if (sOpt.CaseCmp("-IPV4") == 0) {
} else if (sOpt.Equals("-IPV4")) {
bIPv6 = false;
} else {
sMessage = "Unknown option [" + sOpt + "] valid options are -ipv4 or -ipv6";
@@ -362,15 +362,15 @@ bool CWebAdminSock::OnPageRequest(const CString& sURI, CString& sPageRet) {
m_Template["Title"] = "Main Page";
m_Template["Action"] = "home";
PrintPage(sPageRet, "Main.tmpl");
} else if (sURI.Left(5).CaseCmp("/css/") == 0) {
} else if (sURI.Equals("/css/", false, 5)) {
SetDocRoot(GetSkinDir() + "/css");
PrintFile(sURI.substr(5), "text/css");
return false;
} else if (sURI.Left(5).CaseCmp("/img/") == 0) {
} else if (sURI.Equals("/img/", false, 5)) {
SetDocRoot(GetSkinDir() + "/img");
PrintFile(sURI.substr(5));
return false;
} else if (sURI.Left(4).CaseCmp("/js/") == 0) {
} else if (sURI.Equals("/js/", false, 4)) {
SetDocRoot(GetSkinDir() + "/js");
PrintFile(sURI.substr(4), "application/x-javascript");
return false;