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


C++ CUser::GetClients方法代码示例

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


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

示例1: Block

	bool Block(const CString& sUser) {
		CUser *pUser = CZNC::Get().FindUser(sUser);

		if (!pUser)
			return false;

		// Disconnect all clients
		vector<CClient*>& vpClients = pUser->GetClients();
		vector<CClient*>::iterator it;
		for (it = vpClients.begin(); it != vpClients.end(); ++it) {
			(*it)->PutStatusNotice(MESSAGE);
			(*it)->Close(Csock::CLT_AFTERWRITE);
		}

		// Disconnect from IRC...
		CIRCSock *pIRCSock = pUser->GetIRCSock();
		if (pIRCSock) {
			pIRCSock->Quit();
		}

		// ...and don't reconnect
		pUser->SetIRCConnectEnabled(false);

		SetNV(pUser->GetUserName(), "");
		return true;
	}
开发者ID:ZachBeta,项目名称:znc,代码行数:26,代码来源:blockuser.cpp

示例2: OnWebRequest

	virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
		if (sPageName == "index") {
			CModules& GModules = CZNC::Get().GetModules();
			Tmpl["WebAdminLoaded"] = CString(GModules.FindModule("webadmin") != NULL);

			MTimeMulti mmSorted;
			const MUsers& mUsers = CZNC::Get().GetUserMap();

			for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) {
				mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second));
			}

			for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) {
				CUser *pUser = it->second;
				CTemplate& Row = Tmpl.AddRow("UserLoop");

				Row["Username"] = pUser->GetUserName();
				Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser());
				Row["LastSeen"] = FormatLastSeen(pUser, "never");

				Row["Info"] = CString(pUser->GetClients().size()) +
					" client" + CString(pUser->GetClients().size() == 1 ? "" : "s");
				if (!pUser->IsIRCConnected()) {
					Row["Info"] += ", not connected to IRC";
				} else {
					unsigned int uChans = 0;
					const vector<CChan*>& vChans = pUser->GetChans();
					for (unsigned int a = 0; a < vChans.size(); ++a) {
						if (vChans[a]->IsOn()) ++uChans;
					}
					unsigned int n = uChans;
					Row["Info"] += ", joined to " + CString(uChans);
					if(uChans != vChans.size()) {
						Row["Info"] += " out of " + CString(vChans.size()) + " configured";
						n = vChans.size();
					}
					Row["Info"] += " channel" + CString(n == 1 ? "" : "s");
				}
			}

			return true;
		}

		return false;
	}
开发者ID:eatnumber1,项目名称:znc,代码行数:45,代码来源:lastseen.cpp

示例3: OnUserMsg

		virtual EModRet OnUserMsg( CString &target, CString &message ) {
			CUser *user = GetUser();
			if( user != NULL ) {
				bool targetIsChannel = false;
				for( std::vector< CChan * >::const_iterator it = user->GetChans().begin(); it != user->GetChans().end(); it++ ) {
					if( target == (*it)->GetName() ) {
						targetIsChannel = true;
						break;
					}
				}
				if( !targetIsChannel ) {
					std::vector< CClient * > &clients = user->GetClients();
					for( std::vector< CClient * >::iterator it = clients.begin(); it != clients.end(); it++ ) {
						if( *it != m_pClient ) {
							(*it)->PutClient( ":" + target + " PRIVMSG " + user->GetCurNick() + " :<" + user->GetCurNick() + "> " + message );
						}
					}
				}
			}
			return CONTINUE;
		}
开发者ID:mittwinter,项目名称:znc-modules,代码行数:21,代码来源:queryloop.cpp


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