当前位置: 首页>>代码示例>>C++>>正文


C++ CNick::GetHostMask方法代码示例

本文整理汇总了C++中CNick::GetHostMask方法的典型用法代码示例。如果您正苦于以下问题:C++ CNick::GetHostMask方法的具体用法?C++ CNick::GetHostMask怎么用?C++ CNick::GetHostMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CNick的用法示例。


在下文中一共展示了CNick::GetHostMask方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VerifyResponse

	bool VerifyResponse(const CNick& Nick, const CString& sResponse) {
		MCString::iterator itQueue = m_msQueue.find(Nick.GetNick().AsLower());

		if (itQueue == m_msQueue.end()) {
			PutModule("[" + Nick.GetHostMask() + "] sent an unchallenged response.  This could be due to lag.");
			return false;
		}

		CString sChallenge = itQueue->second;
		m_msQueue.erase(itQueue);

		for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
			if (it->second->HostMatches(Nick.GetHostMask())) {
				if (sResponse == CString(it->second->GetUserKey() + "::" + sChallenge).MD5()) {
					OpUser(Nick, *it->second);
					return true;
				} else {
					PutModule("WARNING! [" + Nick.GetHostMask() + "] sent a bad response.  Please verify that you have their correct password.");
					return false;
				}
			}
		}

		PutModule("WARNING! [" + Nick.GetHostMask() + "] sent a response but did not match any defined users.");
		return false;
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:26,代码来源:autoop.cpp

示例2: ChallengeRespond

	bool ChallengeRespond(const CNick& Nick, const CString& sChallenge) {
		// Validate before responding - don't blindly trust everyone
		bool bValid = false;
		bool bMatchedHost = false;
		CAutoOpUser* pUser = NULL;

		for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
			pUser = it->second;

			// First verify that the guy who challenged us matches a user's host
			if (pUser->HostMatches(Nick.GetHostMask())) {
				const vector<CChan*>& Chans = m_pUser->GetChans();
				bMatchedHost = true;

				// Also verify that they are opped in at least one of the user's chans
				for (size_t a = 0; a < Chans.size(); a++) {
					const CChan& Chan = *Chans[a];

					CNick* pNick = Chan.FindNick(Nick.GetNick());

					if (pNick) {
						if (pNick->HasPerm(CChan::Op) && pUser->ChannelMatches(Chan.GetName())) {
							bValid = true;
							break;
						}
					}
				}

				if (bValid) {
					break;
				}
			}
		}

		if (!bValid) {
			if (bMatchedHost) {
				PutModule("[" + Nick.GetHostMask() + "] sent us a challenge but they are not opped in any defined channels.");
			} else {
				PutModule("[" + Nick.GetHostMask() + "] sent us a challenge but they do not match a defined user.");
			}

			return false;
		}

		if (sChallenge.length() != AUTOOP_CHALLENGE_LENGTH) {
			PutModule("WARNING! [" + Nick.GetHostMask() + "] sent an invalid challenge.");
			return false;
		}

		CString sResponse = pUser->GetUserKey() + "::" + sChallenge;
		PutIRC("NOTICE " + Nick.GetNick() + " :!ZNCAO RESPONSE " + sResponse.MD5());
		return false;
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:53,代码来源:autoop.cpp

示例3: CheckAutoVoice

	bool CheckAutoVoice(const CNick& Nick, CChan& Channel) {
		CAutoVoiceUser *pUser = FindUserByHost(Nick.GetHostMask(), Channel.GetName());
		if (!pUser) {
			return false;
		}

		PutIRC("MODE " + Channel.GetName() + " +v " + Nick.GetNick());
		return true;
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:9,代码来源:autovoice.cpp

示例4: OnJoin

	void OnJoin(const CNick& Nick, CChan& Channel) override {
		// If we have ops in this chan
		if (Channel.HasPerm(CChan::Op) || Channel.HasPerm(CChan::HalfOp)) {
			for (const auto& it : m_msUsers) {
				// and the nick who joined is a valid user
				if (it.second->HostMatches(Nick.GetHostMask()) && it.second->ChannelMatches(Channel.GetName())) {
					PutIRC("MODE " + Channel.GetName() + " +v " + Nick.GetNick());
					break;
				}
			}
		}
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:12,代码来源:autovoice.cpp

示例5: OnJoin

	virtual void OnJoin(const CNick& Nick, CChan& Channel) {
		// If we have ops in this chan
		if (Channel.HasPerm(CChan::Op) || Channel.HasPerm(CChan::HalfOp)) {
			for (map<CString, CAutoVoiceUser*>::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())) {
					PutIRC("MODE " + Channel.GetName() + " +v " + Nick.GetNick());
					break;
				}
			}
		}
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:12,代码来源:autovoice.cpp

示例6: CheckAutoOp

	bool CheckAutoOp(const CNick& Nick, CChan& Channel) {
		CAutoOpUser *pUser = FindUserByHost(Nick.GetHostMask(), Channel.GetName());

		if (pUser) {
			if (pUser->GetUserKey().Equals("__NOKEY__")) {
				PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick());
			} else {
				// then insert this nick into the queue, the timer does the rest
				CString sNick = Nick.GetNick().AsLower();
				if (m_msQueue.find(sNick) == m_msQueue.end()) {
					m_msQueue[sNick] = "";
				}
			}
		}

		return pUser;
	}
开发者ID:FooBarWidget,项目名称:znc,代码行数:17,代码来源:autoop.cpp

示例7: OnJoin

	virtual void OnJoin(const CNick& Nick, CChan& Channel) {
		// If we have ops in this chan
		if (Channel.HasPerm(CChan::Op)) {
			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().Equals("__NOKEY__")) {
						PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick());
					} else {
						// then insert this nick into the queue, the timer does the rest
						m_msQueue[Nick.GetNick().AsLower()] = "";
					}

					break;
				}
			}
		}
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:18,代码来源:autoop.cpp

示例8: TryAttach

    void TryAttach(const CNick& Nick, CChan& Channel, CString& Message) {
        const CString& sChan = Channel.GetName();
        const CString& sHost = Nick.GetHostMask();
        const CString& sMessage = Message;
        VAttachIter it;

        if (!Channel.IsDetached()) return;

        // Any negated match?
        for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) {
            if (it->IsNegated() && it->IsMatch(sChan, sHost, sMessage)) return;
        }

        // Now check for a positive match
        for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) {
            if (!it->IsNegated() && it->IsMatch(sChan, sHost, sMessage)) {
                Channel.AttachUser();
                return;
            }
        }
    }
开发者ID:Adam-,项目名称:znc,代码行数:21,代码来源:autoattach.cpp

示例9: Message

    EModRet Message(const CNick& Nick, const CString& sMessage) {
        // We never block /me, because it doesn't cause a reply
        if (sMessage.Token(0).Equals("ACTION")) return CONTINUE;

        if (m_tLastCTCP + m_iThresholdSecs < time(nullptr)) {
            m_tLastCTCP = time(nullptr);
            m_iNumCTCP = 0;
        }

        m_iNumCTCP++;

        if (m_iNumCTCP < m_iThresholdMsgs)
            return CONTINUE;
        else if (m_iNumCTCP == m_iThresholdMsgs)
            PutModule(t_f("Limit reached by {1}, blocking all CTCP")(
                Nick.GetHostMask()));

        // Reset the timeout so that we continue blocking messages
        m_tLastCTCP = time(nullptr);

        return HALT;
    }
开发者ID:GLolol,项目名称:znc,代码行数:22,代码来源:ctcpflood.cpp

示例10: IsMatch

	bool IsMatch(const CNick& Nick, const CString& sType) const {
		return (GetType().Equals("all") || GetType().Equals(sType)) &&
			   (Nick.GetHostMask().WildCmp(m_sHostMask));
	}
开发者ID:Xe,项目名称:dotfiles,代码行数:4,代码来源:ignore.cpp

示例11: OnChanCTCP

    EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) {
        if (IsCtcpNotifier(sMessage.Token(0)))
            PutModule("Replying to CTCP " + sMessage.Token(0) + " by " + Nick.GetNick() + " (" + Nick.GetHostMask() + ") to " + Channel.GetName() + ".");

        return CONTINUE;
    }
开发者ID:ChaoticDividend,项目名称:znc-modules,代码行数:6,代码来源:ctcp_notifier.cpp

示例12: OnPrivCTCP

    EModRet OnPrivCTCP(CNick& Nick, CString& sMessage) {
        // if we either want to receive all ctcp messages or GetNV(ctcp) contains something, we notify the user.
        // CTCP ACTIONs are ignored.
        if (IsCtcpNotifier(sMessage.Token(0)))
            PutModule("Replying to CTCP " + sMessage.Token(0) + " by " + Nick.GetNick() + " (" + Nick.GetHostMask() + ").");

        return CONTINUE;
    }
开发者ID:ChaoticDividend,项目名称:znc-modules,代码行数:8,代码来源:ctcp_notifier.cpp

示例13: IsNickMatch

	bool IsNickMatch(const CNick& Nick) const {
		return Nick.GetHostMask().AsLower().WildCmp(m_sHostMask.AsLower());
	}
开发者ID:JeremiahDJordan,项目名称:znc-contrib,代码行数:3,代码来源:ignore.cpp


注:本文中的CNick::GetHostMask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。