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


C++ CIRCNetwork::GetUser方法代码示例

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


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

示例1: RemoveNetwork

	void RemoveNetwork(CIRCNetwork& network) {
		const CUser *user = network.GetUser();
		const CString& sUsername = user->GetUserName();

		std::map<CString, VCString>::iterator it = m_msvsNetworks.find(sUsername);
		if (it != m_msvsNetworks.end()) {
			VCString &networks = it->second;

			for (VCString::iterator it2 = networks.begin(); it2 != networks.end(); ++it2) {
				CString &name = *it2;

				if (name.Equals(network.GetName())) {
					networks.erase(it2);
					break;
				}
			}

			if (networks.empty()) {
				m_msvsNetworks.erase(it);
			}
		}
	}
开发者ID:sjoness,项目名称:znc-palaver,代码行数:22,代码来源:palaver.cpp

示例2: HasNetwork

	bool HasNetwork(CIRCNetwork& network) {
		bool hasNetwork = false;

		const CUser *user = network.GetUser();
		const CString& sUsername = user->GetUserName();

		std::map<CString, VCString>::iterator it = m_msvsNetworks.find(sUsername);
		if (it != m_msvsNetworks.end()) {
			VCString &networks = it->second;

			for (VCString::iterator it2 = networks.begin(); it2 != networks.end(); ++it2) {
				CString &name = *it2;

				if (name.Equals(network.GetName())) {
					hasNetwork = true;
					break;
				}
			}
		}

		return hasNetwork;
	}
开发者ID:sjoness,项目名称:znc-palaver,代码行数:22,代码来源:palaver.cpp

示例3: OnWebRequest

	virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
		CSmartPtr<CWebSession> spSession = WebSock.GetSession();

		if (sPageName == "settings") {
			// Admin Check
			if (!spSession->IsAdmin()) {
				return false;
			}

			return SettingsPage(WebSock, Tmpl);
		} else if (sPageName == "adduser") {
			// Admin Check
			if (!spSession->IsAdmin()) {
				return false;
			}

			return UserPage(WebSock, Tmpl);
		} else if (sPageName == "addnetwork") {
			CUser* pUser = SafeGetUserFromParam(WebSock);

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) {
				return false;
			}

			if (pUser) {
				return NetworkPage(WebSock, Tmpl, pUser);
			}

			WebSock.PrintErrorPage("No such username");
			return true;
		} else if (sPageName == "editnetwork") {
			CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
				return false;
			}

			if (!pNetwork) {
				WebSock.PrintErrorPage("No such username or network");
				return true;
			}

			return NetworkPage(WebSock, Tmpl, pNetwork->GetUser(), pNetwork);

		} else if (sPageName == "delnetwork") {
			CUser* pUser = CZNC::Get().FindUser(WebSock.GetParam("user", false));

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) {
				return false;
			}

			return DelNetwork(WebSock, pUser);
		} else if (sPageName == "editchan") {
			CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
				return false;
			}

			if (!pNetwork) {
				WebSock.PrintErrorPage("No such username or network");
				return true;
			}

			CString sChan = WebSock.GetParam("name");
			if(sChan.empty() && !WebSock.IsPost()) {
				sChan = WebSock.GetParam("name", false);
			}
			CChan* pChan = pNetwork->FindChan(sChan);
			if (!pChan) {
				WebSock.PrintErrorPage("No such channel");
				return true;
			}

			return ChanPage(WebSock, Tmpl, pNetwork, pChan);
		} else if (sPageName == "addchan") {
			CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
				return false;
			}

			if (pNetwork) {
				return ChanPage(WebSock, Tmpl, pNetwork);
			}

			WebSock.PrintErrorPage("No such username or network");
			return true;
		} else if (sPageName == "delchan") {
			CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);

			// Admin||Self Check
			if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
				return false;
			}
//.........这里部分代码省略.........
开发者ID:luser,项目名称:znc,代码行数:101,代码来源:webadmin.cpp

示例4: AddNetwork

	void AddNetwork(CIRCNetwork& network) {
		CUser *user = network.GetUser();
		const CString& sUsername = user->GetUserName();

		m_msvsNetworks[sUsername].push_back(network.GetName());
	}
开发者ID:sjoness,项目名称:znc-palaver,代码行数:6,代码来源:palaver.cpp

示例5: OnDeleteNetwork

	virtual EModRet OnDeleteNetwork(CIRCNetwork& Network) {
		DelNV("Enabled_" + Network.GetUser()->GetUserName() + "/" + Network.GetName());
	
		return CONTINUE;
	}
开发者ID:lavery98,项目名称:cgiirc,代码行数:5,代码来源:cgiirc.cpp


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