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


C++ CAutoVoiceUser类代码示例

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


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

示例1: OnLoad

	bool OnLoad(const CString& sArgs, CString& sMessage) override {
		// Load the chans from the command line
		unsigned int a = 0;
		VCString vsChans;
		sArgs.Split(" ", vsChans, false);

		for (const CString& sChan : vsChans) {
			CString sName = "Args";
			sName += CString(a);
			AddUser(sName, "*", sChan);
		}

		// Load the saved users
		for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
			const CString& sLine = it->second;
			CAutoVoiceUser* pUser = new CAutoVoiceUser;

			if (!pUser->FromString(sLine) || FindUser(pUser->GetUsername().AsLower())) {
				delete pUser;
			} else {
				m_msUsers[pUser->GetUsername().AsLower()] = pUser;
			}
		}

		return true;
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:26,代码来源:autovoice.cpp

示例2: FindUserByHost

	CAutoVoiceUser* FindUserByHost(const CString& sHostmask, const CString& sChannel = "") {
		for (const auto& it : m_msUsers) {
			CAutoVoiceUser* pUser = it.second;

			if (pUser->HostMatches(sHostmask) && (sChannel.empty() || pUser->ChannelMatches(sChannel))) {
				return pUser;
			}
		}

		return nullptr;
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:11,代码来源:autovoice.cpp

示例3: FindUserByHost

	CAutoVoiceUser* FindUserByHost(const CString& sHostmask, const CString& sChannel = "") {
		for (map<CString, CAutoVoiceUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
			CAutoVoiceUser* pUser = it->second;

			if (pUser->HostMatches(sHostmask) && (sChannel.empty() || pUser->ChannelMatches(sChannel))) {
				return pUser;
			}
		}

		return NULL;
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:11,代码来源:autovoice.cpp

示例4: OnAddUserCommand

	void OnAddUserCommand(const CString& sLine) {
		CString sUser = sLine.Token(1);
		CString sHost = sLine.Token(2);

		if (sHost.empty()) {
			PutModule("Usage: AddUser <user> <hostmask> [channels]");
		} else {
			CAutoVoiceUser* pUser = AddUser(sUser, sHost, sLine.Token(3, true));

			if (pUser) {
				SetNV(sUser, pUser->ToString());
			}
		}
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:14,代码来源:autovoice.cpp

示例5: OnDelChansCommand

	void OnDelChansCommand(const CString& sLine) {
		CString sUser = sLine.Token(1);
		CString sChans = sLine.Token(2, true);

		if (sChans.empty()) {
			PutModule("Usage: DelChans <user> <channel> [channel] ...");
			return;
		}

		CAutoVoiceUser* pUser = FindUser(sUser);

		if (!pUser) {
			PutModule("No such user");
			return;
		}

		pUser->DelChans(sChans);
		PutModule("Channel(s) Removed from user [" + pUser->GetUsername() + "]");

		SetNV(pUser->GetUsername(), pUser->ToString());
	}
开发者ID:BlaXpirit,项目名称:znc,代码行数:21,代码来源:autovoice.cpp

示例6: OnModCommand

	virtual void OnModCommand(const CString& sLine) {
		CString sCommand = sLine.Token(0).AsUpper();

		if (sCommand.Equals("HELP")) {
			PutModule("Commands are: ListUsers, AddChans, DelChans, AddUser, DelUser");
		} else if (sCommand.Equals("ADDUSER") || sCommand.Equals("DELUSER")) {
			CString sUser = sLine.Token(1);
			CString sHost = sLine.Token(2);

			if (sCommand.Equals("ADDUSER")) {
				if (sHost.empty()) {
					PutModule("Usage: " + sCommand + " <user> <hostmask> [channels]");
				} else {
					CAutoVoiceUser* pUser = AddUser(sUser, sHost, sLine.Token(3, true));

					if (pUser) {
						SetNV(sUser, pUser->ToString());
					}
				}
			} else {
				DelUser(sUser);
				DelNV(sUser);
			}
		} else if (sCommand.Equals("LISTUSERS")) {
			if (m_msUsers.empty()) {
				PutModule("There are no users defined");
				return;
			}

			CTable Table;

			Table.AddColumn("User");
			Table.AddColumn("Hostmask");
			Table.AddColumn("Channels");

			for (map<CString, CAutoVoiceUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
				Table.AddRow();
				Table.SetCell("User", it->second->GetUsername());
				Table.SetCell("Hostmask", it->second->GetHostmask());
				Table.SetCell("Channels", it->second->GetChannels());
			}

			PutModule(Table);
		} else if (sCommand.Equals("ADDCHANS") || sCommand.Equals("DELCHANS")) {
			CString sUser = sLine.Token(1);
			CString sChans = sLine.Token(2, true);

			if (sChans.empty()) {
				PutModule("Usage: " + sCommand + " <user> <channel> [channel] ...");
				return;
			}

			CAutoVoiceUser* pUser = FindUser(sUser);

			if (!pUser) {
				PutModule("No such user");
				return;
			}

			if (sCommand.Equals("ADDCHANS")) {
				pUser->AddChans(sChans);
				PutModule("Channel(s) added to user [" + pUser->GetUsername() + "]");
			} else {
				pUser->DelChans(sChans);
				PutModule("Channel(s) Removed from user [" + pUser->GetUsername() + "]");
			}

			SetNV(pUser->GetUsername(), pUser->ToString());
		} else {
			PutModule("Unknown command, try HELP");
		}
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:72,代码来源:autovoice.cpp


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