當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetNV函數代碼示例

本文整理匯總了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));
		}
	}
開發者ID:Brijen,項目名稱:znc,代碼行數:19,代碼來源:nickserv.cpp

示例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;
    }
開發者ID:BtbN,項目名稱:znc,代碼行數:19,代碼來源:identfile.cpp

示例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.");
	}
開發者ID:Brijen,項目名稱:znc,代碼行數:10,代碼來源:route_replies.cpp

示例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;
	}
開發者ID:ConorOG,項目名稱:znc,代碼行數:10,代碼來源:sasl.cpp

示例5: GetFake

	CString GetFake(const CString& name) {
		CString stored = GetNV(name);
		
		if(stored.empty()) {
			stored = IncIp();
			SetNV(name, stored);
		}
		
		return CGIIRC_IP_PREFIX + stored;
	}
開發者ID:Googolplexed,項目名稱:znc,代碼行數:10,代碼來源:cgiirc.cpp

示例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);
	}
開發者ID:ConorOG,項目名稱:znc,代碼行數:19,代碼來源:sasl.cpp

示例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);
        }
    }
開發者ID:ChaoticDividend,項目名稱:znc-modules,代碼行數:11,代碼來源:ctcp_notifier.cpp

示例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.");
        }
    }
開發者ID:ChaoticDividend,項目名稱:znc-modules,代碼行數:11,代碼來源:ctcp_notifier.cpp

示例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");
        }
    }
開發者ID:DreamBNC,項目名稱:znc,代碼行數:11,代碼來源:sasl.cpp

示例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'");
		}
	}
開發者ID:asturel,項目名稱:znc_modules,代碼行數:41,代碼來源:notifier.cpp

示例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;
	}
開發者ID:ZachBeta,項目名稱:znc,代碼行數:12,代碼來源:nickserv.cpp

示例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;
    }
開發者ID:sctigercat1,項目名稱:znc,代碼行數:12,代碼來源:nickserv.cpp

示例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;
    }
開發者ID:BtbN,項目名稱:znc,代碼行數:39,代碼來源:identfile.cpp

示例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);
	}
開發者ID:jimloco,項目名稱:znc,代碼行數:13,代碼來源:autoreply.cpp

示例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);
	}
開發者ID:rask330,項目名稱:znc-contrib,代碼行數:13,代碼來源:clientaway.cpp


注:本文中的GetNV函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。