本文整理汇总了C++中GetNV函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNV函数的具体用法?C++ GetNV怎么用?C++ GetNV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNV函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMessage
void HandleMessage(CNick& Nick, const CString& sMessage) {
CString sNickServName = (!GetNV("NickServName").empty()) ? GetNV("NickServName") : "NickServ";
if (!GetNV("Password").empty()
&& Nick.NickEquals(sNickServName)
&& (sMessage.find("msg") != CString::npos
|| sMessage.find("authenticate") != CString::npos
|| sMessage.find("choose a different nickname") != CString::npos
|| sMessage.find("please choose a different nick") != CString::npos
|| sMessage.find("If this is your nick, identify yourself with") != CString::npos
|| sMessage.find("If this is your nick, type") != CString::npos
|| sMessage.find("This is a registered nickname, please identify") != CString::npos
|| sMessage.StripControls_n().find("type /NickServ IDENTIFY password") != CString::npos)
&& sMessage.AsUpper().find("IDENTIFY") != CString::npos
&& sMessage.find("help") == CString::npos) {
MCString msValues;
msValues["password"] = GetNV("Password");
PutIRC(CString::NamedFormat(GetNV("IdentifyCmd"), msValues));
}
}
示例2: OnIRCConnecting
EModRet OnIRCConnecting(CIRCSock* pIRCSock) override {
if (m_pISpoofLockFile != nullptr) {
DEBUG("Aborting connection, ident spoof lock file exists");
PutModule(
t_s("Aborting connection, another user or network is currently "
"connecting and using the ident spoof file"));
return HALTCORE;
}
if (!WriteISpoof()) {
DEBUG("identfile [" + GetNV("File") + "] could not be written");
PutModule(
t_f("[{1}] could not be written, retrying...")(GetNV("File")));
return HALTCORE;
}
SetIRCSock(pIRCSock);
return CONTINUE;
}
示例3: SilentCommand
void SilentCommand(const CString& sLine) {
const CString sValue = sLine.Token(1);
if (!sValue.empty()) {
SetNV("silent_timeouts", sValue);
}
CString sPrefix = GetNV("silent_timeouts").ToBool() ? "dis" : "en";
PutModule("Timeout messages are " + sPrefix + "abled.");
}
示例4: CheckRequireAuth
bool CheckRequireAuth() {
if (!m_bAuthenticated && GetNV(NV_REQUIRE_AUTH).ToBool()) {
GetNetwork()->SetIRCConnectEnabled(false);
PutModule("Disabling network, we require authentication.");
PutModule("Use 'RequireAuth no' to disable.");
return true;
}
return false;
}
示例5: GetFake
CString GetFake(const CString& name) {
CString stored = GetNV(name);
if(stored.empty()) {
stored = IncIp();
SetNV(name, stored);
}
return CGIIRC_IP_PREFIX + stored;
}
示例6: GetMechanismsString
CString GetMechanismsString() const {
if (GetNV(NV_MECHANISMS).empty()) {
CString sDefaults = "";
for (size_t i = 0; SupportedMechanisms[i].szName != NULL; i++) {
if (SupportedMechanisms[i].bDefault) {
if (!sDefaults.empty()) {
sDefaults += " ";
}
sDefaults += SupportedMechanisms[i].szName;
}
}
return sDefaults;
}
return GetNV(NV_MECHANISMS);
}
示例7: DelCtcp
void DelCtcp(const CString& sCtcp) {
// Remove a ctcp request to the ctcp queries we're listening to.
CString sCtcpNotifier = sCtcp.Token(1).AsUpper();
if (!GetNV("ctcp_" + sCtcpNotifier).empty()) {
DelNV("ctcp_" + sCtcpNotifier);
PutModule("Deleted CTCP notifier: " + sCtcpNotifier);
} else {
PutModule("Could not find CTCP notifier: " + sCtcpNotifier);
}
}
示例8: AddCtcp
void AddCtcp(const CString& sCtcp) {
// Add a ctcp request from the ctcp queries we're listening to.
CString sCtcpNotifier = sCtcp.Token(1).AsUpper();
if (GetNV("ctcp_" + sCtcpNotifier).empty()) {
SetNV("ctcp_" + sCtcpNotifier, "y");
PutModule("Added CTCP notifier: " + sCtcpNotifier);
} else {
PutModule("CTCP notifier for " + sCtcpNotifier + " was already set.");
}
}
示例9: RequireAuthCommand
void RequireAuthCommand(const CString& sLine) {
if (!sLine.Token(1).empty()) {
SetNV(NV_REQUIRE_AUTH, sLine.Token(1));
}
if (GetNV(NV_REQUIRE_AUTH).ToBool()) {
PutModule("We require SASL negotiation to connect");
} else {
PutModule("We will connect even if SASL fails");
}
}
示例10: OnModCommand
virtual void OnModCommand(const CString& sCommand) {
CString sCmd = sCommand.Token(0);
if (sCmd.Equals("settoken")) {
CString sToken = sCommand.Token(1,true);
if (!sToken.empty()) {
if (SetNV("token",sToken)) {
PutModule("Token [" + sToken + "] setted");
} else {
PutModule("Token set error (?)");
}
} else {
//PutModule("Usage SetToken <token>");
if (DelNV("token")) PutModule("Token deleted.");
}
} else if (sCmd.Equals("setpassword")) {
CString sPassw = sCommand.Token(1,true);
if (!sPassw.empty()) {
if (SetNV("password",sPassw)) {
PutModule("Password setted");
} else {
PutModule("Password set error (?)");
}
} else {
//PutModule("Usage SetPassword <password>");
if (DelNV("password")) PutModule("Passwored deleted.");
}
} else if (sCmd.Equals("show")) {
PutModule("Token: [" + GetNV("token") + "]");
PutModule("Password: [" + GetNV("password") + "]");
} else if (sCmd.Equals("HELP")) {
PutModule("Try: Show, SetToken, SetPassword");
} else {
PutModule("Unknown command, try 'Help'");
}
}
示例11: OnLoad
virtual bool OnLoad(const CString& sArgs, CString& sMessage)
{
if (sArgs.empty())
m_sPass = GetNV("Password");
else {
m_sPass = sArgs;
SetNV("Password", m_sPass);
SetArgs("");
}
return true;
}
示例12: OnLoad
bool OnLoad(const CString& sArgs, CString& sMessage) override {
if (!sArgs.empty() && sArgs != "<hidden>") {
SetNV("Password", sArgs);
SetArgs("<hidden>");
}
if (GetNV("IdentifyCmd").empty()) {
SetNV("IdentifyCmd", "NICKSERV IDENTIFY {password}");
}
return true;
}
示例13: WriteISpoof
bool WriteISpoof() {
if (m_pISpoofLockFile != nullptr) {
return false;
}
m_pISpoofLockFile = new CFile;
if (!m_pISpoofLockFile->TryExLock(GetNV("File"), O_RDWR | O_CREAT)) {
delete m_pISpoofLockFile;
m_pISpoofLockFile = nullptr;
return false;
}
char buf[1024];
memset((char*)buf, 0, 1024);
m_pISpoofLockFile->Read(buf, 1024);
m_sOrigISpoof = buf;
if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) {
delete m_pISpoofLockFile;
m_pISpoofLockFile = nullptr;
return false;
}
CString sData = ExpandString(GetNV("Format"));
// If the format doesn't contain anything expandable, we'll
// assume this is an "old"-style format string.
if (sData == GetNV("Format")) {
sData.Replace("%", GetUser()->GetIdent());
}
DEBUG("Writing [" + sData + "] to ident spoof file [" +
m_pISpoofLockFile->GetLongName() + "] for user/network [" +
GetUser()->GetUserName() + "/" + GetNetwork()->GetName() + "]");
m_pISpoofLockFile->Write(sData + "\n");
return true;
}
示例14: GetReply
CString GetReply() {
CString sReply = GetNV("Reply");
if (sReply.empty()) {
sReply = "%nick% is currently away, try again later";
SetReply(sReply);
}
if (m_pNetwork) {
return m_pNetwork->ExpandString(sReply);
}
return m_pUser->ExpandString(sReply);
}
示例15: GetAwayReason
CString GetAwayReason() const {
CString sAway = GetNV("reason");
if (sAway.empty()) {
sAway = AWAY_DEFAULT_REASON;
}
if (m_pNetwork) {
return m_pNetwork->ExpandString(sAway);
}
return m_pUser->ExpandString(sAway);
}