本文整理汇总了C++中CString::Equals方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Equals方法的具体用法?C++ CString::Equals怎么用?C++ CString::Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnModCommand
virtual void OnModCommand(const CString& sLine) {
CString sCommand = sLine.Token(0);
CString sArg = sLine.Token(1, true);
if (sCommand.Equals("LIST")) {
bool bShowHosts = true;
if (sArg.Equals("-n")) {
bShowHosts = false;
}
ShowSocks(bShowHosts);
} else {
PutModule("Use 'list' to view a list of active sockets");
PutModule("Use 'list -n' if you want IP addresses to be displayed");
}
}
示例2: OnPrivNotice
virtual EModRet OnPrivNotice(CNick& Nick, CString& sMessage) {
if (!sMessage.Token(0).Equals("!ZNCAO")) {
return CONTINUE;
}
CString sCommand = sMessage.Token(1);
if (sCommand.Equals("CHALLENGE")) {
ChallengeRespond(Nick, sMessage.Token(2));
} else if (sCommand.Equals("RESPONSE")) {
VerifyResponse(Nick, sMessage.Token(2));
}
return HALTCORE;
}
示例3: OnLoad
virtual bool OnLoad(const CString & sArgs, CString & sMessage) {
CString sTarget = GetNV("target");
if (sTarget.Equals("syslog"))
m_eLogMode = LOG_TO_SYSLOG;
else if (sTarget.Equals("both"))
m_eLogMode = LOG_TO_BOTH;
else if (sTarget.Equals("file"))
m_eLogMode = LOG_TO_FILE;
else
m_eLogMode = LOG_TO_FILE;
m_sLogFile = GetSavePath() + "/znc.log";
Log("Logging started. ZNC PID[" + CString(getpid()) + "] UID/GID[" + CString(getuid()) + ":" + CString(getgid()) + "]");
return true;
}
示例4: ReadLine
void CIMAPSock::ReadLine(const CString& sLine) {
if (!m_bSentLogin) {
CString sUsername = m_spAuth->GetUsername();
m_bSentLogin = true;
const CString& sFormat = m_pIMAPMod->GetUserFormat();
if (!sFormat.empty()) {
if (sFormat.find('%') != CString::npos) {
sUsername = sFormat.Replace_n("%", sUsername);
} else {
sUsername += sFormat;
}
}
Write("AUTH LOGIN " + sUsername + " " + m_spAuth->GetPassword() + "\r\n");
} else if (sLine.Left(5) == "AUTH ") {
CUser* pUser = CZNC::Get().FindUser(m_spAuth->GetUsername());
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("+++ Successful IMAP lookup");
} else {
m_spAuth->RefuseLogin("Invalid Password");
DEBUG("--- FAILED IMAP lookup");
}
m_bSentReply = true;
Close();
}
}
示例5: OnPrivCTCP
virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage)
{
if (sMessage.Equals("DCC SCHAT ", false, 10)) {
// chat ip port
unsigned long iIP = sMessage.Token(3).ToULong();
unsigned short iPort = sMessage.Token(4).ToUShort();
if (iIP > 0 && iPort > 0) {
pair<u_long, u_short> pTmp;
CString sMask;
pTmp.first = iIP;
pTmp.second = iPort;
sMask = "(s)" + Nick.GetNick() + "!" + "(s)" +
Nick.GetNick() + "@" + CUtils::GetIP(iIP);
m_siiWaitingChats["(s)" + Nick.GetNick()] = pTmp;
SendToUser(sMask, "*** Incoming DCC SCHAT, Accept ? (yes/no)");
CRemMarkerJob *p = new CRemMarkerJob(this, 60, 1,
"Remove (s)" + Nick.GetNick(),
"Removes this nicks entry for waiting DCC.");
p->SetNick("(s)" + Nick.GetNick());
AddTimer(p);
return(HALT);
}
}
return(CONTINUE);
}
示例6: OnUserMsg
virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage)
{
if (sTarget.Left(3) == "(s)") {
CString sSockName = GetModName().AsUpper() + "::" + sTarget;
CSChatSock *p = (CSChatSock *)FindSocket(sSockName);
if (!p) {
map< CString,pair< u_long,u_short > >::iterator it;
it = m_siiWaitingChats.find(sTarget);
if (it != m_siiWaitingChats.end()) {
if (!sMessage.Equals("yes"))
SendToUser(sTarget + "!" + sTarget + "@" +
CUtils::GetIP(it->second.first),
"Refusing to accept DCC SCHAT!");
else
AcceptSDCC(sTarget, it->second.first, it->second.second);
m_siiWaitingChats.erase(it);
return(HALT);
}
PutModule("No such SCHAT to [" + sTarget + "]");
} else
p->Write(sMessage + "\n");
return(HALT);
}
return(CONTINUE);
}
示例7:
CChan::CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig, CConfig *pConfig) {
m_sName = sName.Token(0);
m_sKey = sName.Token(1);
m_pNetwork = pNetwork;
if (!m_pNetwork->IsChan(m_sName)) {
m_sName = "#" + m_sName;
}
m_bInConfig = bInConfig;
m_Nick.SetNetwork(m_pNetwork);
m_bDetached = false;
m_uBufferCount = m_pNetwork->GetUser()->GetBufferCount();
m_bKeepBuffer = m_pNetwork->GetUser()->KeepBuffer();
m_bDisabled = false;
Reset();
if (pConfig) {
CString sValue;
if (pConfig->FindStringEntry("buffer", sValue))
SetBufferCount(sValue.ToUInt(), true);
if (pConfig->FindStringEntry("keepbuffer", sValue))
SetKeepBuffer(sValue.ToBool());
if (pConfig->FindStringEntry("detached", sValue))
SetDetached(sValue.ToBool());
if (pConfig->FindStringEntry("autocycle", sValue))
if (sValue.Equals("true"))
CUtils::PrintError("WARNING: AutoCycle has been removed, instead try -> LoadModule = autocycle " + sName);
if (pConfig->FindStringEntry("key", sValue))
SetKey(sValue);
if (pConfig->FindStringEntry("modes", sValue))
SetDefaultModes(sValue);
}
}
示例8: OnLoad
bool OnLoad(const CString & sArgs, CString & sMessage) override {
CString sTarget = GetNV("target");
if (sTarget.Equals("syslog"))
m_eLogMode = LOG_TO_SYSLOG;
else if (sTarget.Equals("both"))
m_eLogMode = LOG_TO_BOTH;
else if (sTarget.Equals("file"))
m_eLogMode = LOG_TO_FILE;
else
m_eLogMode = LOG_TO_FILE;
SetLogFilePath(GetNV("path"));
Log("Logging started. ZNC PID[" + CString(getpid()) + "] UID/GID[" + CString(getuid()) + ":" + CString(getgid()) + "]");
return true;
}
示例9: OnRaw
virtual EModRet OnRaw(CString& sLine) {
// We do the same as ZNC would without the OnRaw hook,
// except we do not forward 305's or 306's to clients
CString sCmd = sLine.Token(1);
if (sCmd.Equals("305")) {
m_pNetwork->SetIRCAway(false);
return HALTCORE;
} else if (sCmd.Equals("306")) {
m_pNetwork->SetIRCAway(true);
return HALTCORE;
}
return CONTINUE;
}
示例10: OnUserRaw
virtual EModRet OnUserRaw(CString& sLine) {
// We dont care if we are not connected to IRC
if (!m_pNetwork->IsIRCConnected())
return CONTINUE;
// We are trying to get the config nick and this is a /nick?
if (!m_pTimer || !sLine.Token(0).Equals("NICK"))
return CONTINUE;
// Is the nick change for the nick we are trying to get?
CString sNick = sLine.Token(1);
// Don't even think of using spaces in your nick!
if (sNick.Left(1) == ":")
sNick.LeftChomp();
if (!sNick.Equals(GetNick()))
return CONTINUE;
// Indeed trying to change to this nick, generate a 433 for it.
// This way we can *always* block incoming 433s from the server.
PutUser(":" + m_pNetwork->GetIRCServer() + " 433 " + m_pNetwork->GetIRCNick().GetNick()
+ " " + sNick + " :ZNC is already trying to get this nickname");
return CONTINUE;
}
示例11: OnUserRaw
virtual EModRet OnUserRaw(CString& sLine)
{
CAlias current_alias;
try
{
if (sLine.Equals("ZNC-CLEAR-ALL-ALIASES!"))
{
ListCommand("");
PutModule("Clearing all of them!");
ClearNV();
return HALT;
}
else if (CAlias::AliasGet(current_alias, this, sLine))
{
VCString rawLines;
current_alias.Imprint(sLine).Split("\n", rawLines, false);
for (size_t i = 0; i < rawLines.size(); ++i) PutIRC(rawLines[i]);
return HALT;
}
}
catch (std::exception &e)
{
CString my_nick = (GetNetwork() == NULL ? "" : GetNetwork()->GetCurNick());
if (my_nick.empty()) my_nick = "*";
PutUser(CString(":znc.in 461 " + my_nick + " " + current_alias.GetName() + " :ZNC alias error: ") + e.what());
return HALTCORE;
}
return CONTINUE;
}
示例12: OnOtherMessage
bool CClient::OnOtherMessage(CMessage& Message) {
const CString& sCommand = Message.GetCommand();
if (sCommand.Equals("ZNC")) {
CString sTarget = Message.GetParam(0);
CString sModCommand;
if (sTarget.TrimPrefix(m_pUser->GetStatusPrefix())) {
sModCommand = Message.GetParams(1);
} else {
sTarget = "status";
sModCommand = Message.GetParams(0);
}
if (sTarget.Equals("status")) {
if (sModCommand.empty())
PutStatus("Hello. How may I help you?");
else
UserCommand(sModCommand);
} else {
if (sModCommand.empty())
CALLMOD(sTarget, this, m_pUser, m_pNetwork,
PutModule("Hello. How may I help you?"))
else
CALLMOD(sTarget, this, m_pUser, m_pNetwork,
OnModCommand(sModCommand))
}
return true;
} else if (sCommand.Equals("ATTACH")) {
示例13: OnModCommand
void OnModCommand(const CString& sCmdLine) override
{
CString sCommand = sCmdLine.Token(0);
CString sArgs = sCmdLine.Token(1, true);
if (sCommand.Equals("dumpbuff")) {
// for testing purposes - hidden from help
CString sFile;
CString sName;
if (DecryptBuffer(GetPath(sArgs), sFile, sName))
{
VCString vsLines;
VCString::iterator it;
sFile.Split("\n", vsLines);
for (it = vsLines.begin(); it != vsLines.end(); ++it) {
CString sLine(*it);
sLine.Trim();
PutModule("[" + sLine + "]");
}
}
PutModule("//!-- EOF " + sArgs);
} else {
HandleCommand(sCmdLine);
}
}
示例14: IsCtcpNotifier
bool IsCtcpNotifier(const CString& sCtcp) {
// Return true if we want all ctcps notified to us, or if "ctcp_"+sCtcp exists.
// CTCP ACTIONs are the only CTCP query we choose to ignore all the time.
if (sCtcp.Equals("ACTION"))
return false;
return !GetNV("ctcp_showall").empty() || !GetNV("ctcp_" + sCtcp.AsUpper()).empty();
}
示例15: OnStatusCommand
virtual EModRet OnStatusCommand(CString& sCommand) {
if (sCommand.Equals("SAMPLE")) {
PutModule("Hi, I'm your friendly sample module.");
return HALT;
}
return CONTINUE;
}