virtual void OnModCommand(const CString& sCommand)
	{
		CString sCmdName = sCommand.Token(0);
		CString sChannel = sCommand.Token(1);
		sChannel.MakeLower();
		if ((sCmdName == "stick") && (!sChannel.empty()))
		{
			SetNV(sChannel, sCommand.Token(2));
			PutModule("Stuck " + sChannel);
		}
		else if ((sCmdName == "unstick") && (!sChannel.empty()))
		{
			MCString::iterator it = FindNV(sChannel);
			if (it != EndNV())
				DelNV(it);

			PutModule("UnStuck " + sChannel);
		}
		else if ((sCmdName == "list") && (sChannel.empty()))
		{
			int i = 1;
			for (MCString::iterator it = BeginNV(); it != EndNV(); ++it, i++)
			{
				if (it->second.empty())
					PutModule(CString(i) + ": " + it->first);
				else
					PutModule(CString(i) + ": " + it->first + " (" + it->second + ")");
			}
			PutModule(" -- End of List");
		}
		else
		{
			PutModule("USAGE: [un]stick #channel [key], list");
		}
	}
	virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
		if (sPageName.empty() || sPageName == "index") {
			bool bSubmitted = (WebSock.GetParam("submitted").ToInt() != 0);

			const vector<CChan*>& Channels = m_pUser->GetChans();
			for (unsigned int c = 0; c < Channels.size(); c++) {
				const CString sChan = Channels[c]->GetName();
				bool bStick = FindNV(sChan) != EndNV();

				if(bSubmitted) {
					bool bNewStick = WebSock.GetParam("stick_" + sChan).ToBool();
					if(bNewStick && !bStick)
						SetNV(sChan, ""); // no password support for now unless chansaver is active too
					else if(!bNewStick && bStick) {
						MCString::iterator it = FindNV(sChan);
						if(it != EndNV())
							DelNV(it);
					}
					bStick = bNewStick;
				}

				CTemplate& Row = Tmpl.AddRow("ChannelLoop");
				Row["Name"] = sChan;
				Row["Sticky"] = CString(bStick);
			}

			if(bSubmitted) {
				WebSock.GetSession()->AddSuccess("Changes have been saved!");
			}

			return true;
		}

		return false;
	}
示例#3
0
文件: crypt.cpp 项目: ConorOG/znc
	virtual void OnModCommand(const CString& sCommand) {
		CString sCmd = sCommand.Token(0);

		if (sCmd.Equals("DELKEY")) {
			CString sTarget = sCommand.Token(1);

			if (!sTarget.empty()) {
				if (DelNV(sTarget.AsLower())) {
					PutModule("Target [" + sTarget + "] deleted");
				} else {
					PutModule("Target [" + sTarget + "] not found");
				}
			} else {
				PutModule("Usage DelKey <#chan|Nick>");
			}
		} else if (sCmd.Equals("SETKEY")) {
			CString sTarget = sCommand.Token(1);
			CString sKey = sCommand.Token(2, true);

			// Strip "cbc:" from beginning of string incase someone pastes directly from mircryption
			sKey.TrimPrefix("cbc:");

			if (!sKey.empty()) {
				SetNV(sTarget.AsLower(), sKey);
				PutModule("Set encryption key for [" + sTarget + "] to [" + sKey + "]");
			} else {
				PutModule("Usage: SetKey <#chan|Nick> <Key>");
			}
		} else if (sCmd.Equals("LISTKEYS")) {
			if (BeginNV() == EndNV()) {
				PutModule("You have no encryption keys set.");
			} else {
				CTable Table;
				Table.AddColumn("Target");
				Table.AddColumn("Key");

				for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
					Table.AddRow();
					Table.SetCell("Target", it->first);
					Table.SetCell("Key", it->second);
				}

				MCString::iterator it = FindNV(NICK_PREFIX_KEY);
				if (it == EndNV()) {
					Table.AddRow();
					Table.SetCell("Target", NICK_PREFIX_KEY);
					Table.SetCell("Key", NickPrefix());
				}

				PutModule(Table);
			}
		} else if (sCmd.Equals("HELP")) {
			PutModule("Try: SetKey, DelKey, ListKeys");
		} else {
			PutModule("Unknown command, try 'Help'");
		}
	}
示例#4
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		// Load the chans from the command line
		unsigned int a = 0;
		VCString vsChans;
		sArgs.Split(" ", vsChans, false);

		for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) {
			CString sName = "Args";
			sName += CString(a);
			AddUser(sName, "*", *it);
		}

		// 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;
	}
示例#5
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		VCString vsChans;
		sArgs.Split(" ", vsChans, false);

		for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) {
			CString sAdd = *it;
			bool bNegated = sAdd.TrimPrefix("!");
			CString sChan = sAdd.Token(0);
			CString sHost = sAdd.Token(1, true);

			if (!Add(bNegated, sChan, sHost)) {
				PutModule("Unable to add [" + *it + "]");
			}
		}

		// Load our saved settings, ignore errors
		MCString::iterator it;
		for (it = BeginNV(); it != EndNV(); ++it) {
			CString sAdd = it->first;
			bool bNegated = sAdd.TrimPrefix("!");
			CString sChan = sAdd.Token(0);
			CString sHost = sAdd.Token(1, true);

			Add(bNegated, sChan, sHost);
		}

		return true;
	}
示例#6
0
文件: crypt.cpp 项目: jpnurmi/znc
	EModRet OnUserNotice(CString& sTarget, CString& sMessage) override {
		sTarget.TrimPrefix(NickPrefix());

		if (sMessage.TrimPrefix("``")) {
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			CChan* pChan = GetNetwork()->FindChan(sTarget);
			CString sNickMask = GetNetwork()->GetIRCNick().GetNickMask();
			if (pChan) {
				if (!pChan->AutoClearChanBuffer())
					pChan->AddBuffer(":" + NickPrefix() + _NAMEDFMT(sNickMask) + " NOTICE " + _NAMEDFMT(sTarget) + " :{text}", sMessage);
				GetUser()->PutUser(":" + NickPrefix() + sNickMask + " NOTICE " + sTarget + " :" + sMessage, NULL, GetClient());
			}

			CString sMsg = MakeIvec() + sMessage;
			sMsg.Encrypt(it->second);
			sMsg.Base64Encode();
			sMsg = "+OK *" + sMsg;

			PutIRC("NOTICE " + sTarget + " :" + sMsg);
			return HALTCORE;
		}

		return CONTINUE;
	}
示例#7
0
文件: certauth.cpp 项目: HaleBob/znc
	virtual bool OnBoot() {
		const vector<CListener*>& vListeners = CZNC::Get().GetListeners();
		vector<CListener*>::const_iterator it;

		// We need the SSL_VERIFY_PEER flag on all listeners, or else
		// the client doesn't send a ssl cert
		for (it = vListeners.begin(); it != vListeners.end(); it++)
			(*it)->GetRealListener()->SetRequireClientCertFlags(SSL_VERIFY_PEER);

		MCString::iterator it1;
		for (it1 = BeginNV(); it1 != EndNV(); it1++) {
			VCString vsKeys;
			VCString::iterator it2;

			if (CZNC::Get().FindUser(it1->first) == NULL) {
				DEBUG("Unknown user in saved data [" + it1->first + "]");
				continue;
			}

			it1->second.Split(" ", vsKeys, false);
			for (it2 = vsKeys.begin(); it2 != vsKeys.end(); it2++) {
				m_PubKeys[it1->first].insert(*it2);
			}
		}

		return true;
	}
	virtual void RunJob()
	{
		if (!m_pUser->GetIRCSock())
			return;

		for (MCString::iterator it = BeginNV(); it != EndNV(); ++it)
		{
			CChan *pChan = m_pUser->FindChan(it->first);
			if (!pChan) {
				pChan = new CChan(it->first, m_pUser, true);
				if (!it->second.empty())
					pChan->SetKey(it->second);
				if (!m_pUser->AddChan(pChan)) {
					/* AddChan() deleted that channel */
					PutModule("Could not join [" + it->first
							+ "] (# prefix missing?)");
					continue;
				}
			}
			if (!pChan->IsOn()) {
				PutModule("Joining [" + pChan->GetName() + "]");
				PutIRC("JOIN " + pChan->GetName() + (pChan->GetKey().empty()
							? "" : " " + pChan->GetKey()));
			}
		}
	}
示例#9
0
文件: crypt.cpp 项目: ConorOG/znc
	virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
		sTarget.TrimLeft(NickPrefix());

		if (sMessage.Left(2) == "``") {
			sMessage.LeftChomp(2);
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			CChan* pChan = m_pNetwork->FindChan(sTarget);
			if (pChan) {
				if (!pChan->AutoClearChanBuffer())
					pChan->AddBuffer(":" + NickPrefix() + _NAMEDFMT(m_pNetwork->GetIRCNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(sTarget) + " :{text}", sMessage);
				m_pUser->PutUser(":" + NickPrefix() + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
			}

			CString sMsg = MakeIvec() + sMessage;
			sMsg.Encrypt(it->second);
			sMsg.Base64Encode();
			sMsg = "+OK *" + sMsg;

			PutIRC("PRIVMSG " + sTarget + " :" + sMsg);
			return HALTCORE;
		}

		return CONTINUE;
	}
示例#10
0
	bool IsBlocked(const CString& sUser) {
		MCString::iterator it;
		for (it = BeginNV(); it != EndNV(); ++it) {
			if (sUser == it->first) {
				return true;
			}
		}
		return false;
	}
示例#11
0
文件: crypt.cpp 项目: jpnurmi/znc
	void FilterIncoming(const CString& sTarget, CNick& Nick, CString& sMessage) {
		if (sMessage.TrimPrefix("+OK *")) {
			MCString::iterator it = FindNV(sTarget.AsLower());

			if (it != EndNV()) {
				sMessage.Base64Decode();
				sMessage.Decrypt(it->second);
				sMessage.LeftChomp(8);
				sMessage = sMessage.c_str();
				Nick.SetNick(NickPrefix() + Nick.GetNick());
			}
		}

	}
示例#12
0
文件: crypt.cpp 项目: jpnurmi/znc
	void OnListKeysCommand(const CString& sCommand) {
		if (BeginNV() == EndNV()) {
			PutModule("You have no encryption keys set.");
		} else {
			CTable Table;
			Table.AddColumn("Target");
			Table.AddColumn("Key");

			for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
				Table.AddRow();
				Table.SetCell("Target", it->first);
				Table.SetCell("Key", it->second);
			}

			MCString::iterator it = FindNV(NICK_PREFIX_KEY);
			if (it == EndNV()) {
				Table.AddRow();
				Table.SetCell("Target", NICK_PREFIX_KEY);
				Table.SetCell("Key", NickPrefix());
			}

			PutModule(Table);
		}
	}
示例#13
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		AddTimer(new CAutoOpTimer(this));

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

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

		return true;
	}
示例#14
0
	virtual EModRet OnUserPart(CString& sChannel, CString& sMessage)
	{
		for (MCString::iterator it = BeginNV(); it != EndNV(); ++it)
		{
			if (sChannel.Equals(it->first))
			{
				CChan* pChan = m_pUser->FindChan(sChannel);

				if (pChan)
				{
					pChan->JoinUser(true, "", m_pClient);
					return HALT;
				}
			}
		}

		return CONTINUE;
	}
示例#15
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		VCString vsChans;
		sArgs.Split(" ", vsChans, false);

		for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) {
			if (!Add(*it)) {
				PutModule("Unable to add [" + *it + "]");
			}
		}

		// Load our saved settings, ignore errors
		MCString::iterator it;
		for (it = BeginNV(); it != EndNV(); ++it) {
			Add(it->first);
		}

		return true;
	}
示例#16
0
文件: crypt.cpp 项目: jpnurmi/znc
	EModRet OnUserTopic(CString& sTarget, CString& sMessage) override {
		sTarget.TrimPrefix(NickPrefix());

		if (sMessage.TrimPrefix("``")) {
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			sMessage = MakeIvec() + sMessage;
			sMessage.Encrypt(it->second);
			sMessage.Base64Encode();
			sMessage = "+OK *" + sMessage;
		}

		return CONTINUE;
	}
示例#17
0
	void OnModCommand(const CString& sCommand) {
		CString sCmd = sCommand.Token(0);

		if (!m_pUser->IsAdmin()) {
			PutModule("Access denied");
			return;
		}

		if (sCmd.Equals("list")) {
			CTable Table;
			MCString::iterator it;

			Table.AddColumn("Blocked user");

			for (it = BeginNV(); it != EndNV(); ++it) {
				Table.AddRow();
				Table.SetCell("Blocked user", it->first);
			}

			if (PutModule(Table) == 0)
				PutModule("No users blocked");
		} else if (sCmd.Equals("block")) {
			CString sUser = sCommand.Token(1, true);

			if (m_pUser->GetUserName().Equals(sUser)) {
				PutModule("You can't block yourself");
				return;
			}

			if (Block(sUser))
				PutModule("Blocked [" + sUser + "]");
			else
				PutModule("Could not block [" + sUser + "] (misspelled?)");
		} else if (sCmd.Equals("unblock")) {
			CString sUser = sCommand.Token(1, true);

			if (DelNV(sUser))
				PutModule("Unblocked [" + sUser + "]");
			else
				PutModule("This user is not blocked");
		} else {
			PutModule("Commands: list, block [user], unblock [user]");
		}
	}
示例#18
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		unsigned int a = 0;
		CString sChan = sArgs.Token(a++);

		while (!sChan.empty()) {
			if (!Add(sChan)) {
				PutModule("Unable to add [" + sChan + "]");
			}

			sChan = sArgs.Token(a++);
		}

		// Load our saved settings, ignore errors
		MCString::iterator it;
		for (it = BeginNV(); it != EndNV(); it++) {
			Add(it->first);
		}

		return true;
	}
示例#19
0
	virtual bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
		if (sPageName == "webadmin/channel") {
			CString sChan = Tmpl["ChanName"];
			bool bStick = FindNV(sChan) != EndNV();
			if (Tmpl["WebadminAction"].Equals("display")) {
				Tmpl["Sticky"] = CString(bStick);
			} else if (WebSock.GetParam("embed_stickychan_presented").ToBool()) {
				bool bNewStick = WebSock.GetParam("embed_stickychan_sticky").ToBool();
				if(bNewStick && !bStick) {
					SetNV(sChan, ""); // no password support for now unless chansaver is active too
					WebSock.GetSession()->AddSuccess("Channel become sticky!");
				} else if(!bNewStick && bStick) {
					DelNV(sChan);
					WebSock.GetSession()->AddSuccess("Channel stopped being sticky!");
				}
			}
			return true;
		}
		return false;
	}
示例#20
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		OnBoot();

		MCString::iterator it;
		for (it = BeginNV(); it != EndNV(); it++) {
			VCString vsKeys;
			VCString::iterator it2;

			if (CZNC::Get().FindUser(it->first) == NULL) {
				DEBUG("Unknown user in saved data [" + it->first + "]");
				continue;
			}

			it->second.Split(" ", vsKeys, false);
			for (it2 = vsKeys.begin(); it2 != vsKeys.end(); it2++) {
				m_PubKeys[it->first].insert(*it2);
			}
		}

		return true;
	}
示例#21
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		VCString vArgs;
		VCString::iterator it;
		MCString::iterator it2;

		// Load saved settings
		for (it2 = BeginNV(); it2 != EndNV(); ++it2) {
			// Ignore errors
			Block(it2->first);
		}

		// Parse arguments, each argument is a user name to block
		sArgs.Split(" ", vArgs, false);

		for (it = vArgs.begin(); it != vArgs.end(); ++it) {
			if (!Block(*it)) {
				sMessage = "Could not block [" + *it + "]";
				return false;
			}
		}

		return true;
	}
示例#22
0
	bool OnLoad(const CString& sArgs, CString& sMessage)
	{
		if(ms_instance) return false;
		ms_instance = this;
		
		InitializeCriticalSection(&m_rcvdMsgLock);

		for(MCString::iterator it = BeginNV(); it != EndNV(); it++)
		{
			if(it->first.size() > 0 && it->first[0] == '#')
			{
				m_chanNameMap[it->first.AsLower()] = it->second;
			}
		}

		SkypeMessaging *l_msging = SkypeMessaging::GetInstance();
		m_queue = new CSkypeMsgQueue();

		if(!l_msging->Initialize(&CSkypeMsgQueue::SkypeMessagingCallback, m_queue))
		{
			PutModule("FATAL ERROR: Initializing Skype messaging failed!");
		}
		else
		{
			if(!l_msging->SendConnect())
			{
				PutModule("FATAL ERROR: Sending discovery signal failed!");
			}
			else
			{
				AddTimer(new CModSkypeTimer(this, 1, 0, "ModSkypeMessaging", "Timer for modskype to process pending events/messages."));
			}
		}

		return true;
	}
示例#23
0
void CUrlBufferModule::OnModCommand(const CString& sCommand) 
{
	CString command = sCommand.Token(0).AsLower().Trim_n();
	
	if (command == "help") 
	{
		CTable CmdTable;

		CmdTable.AddColumn("Command");
		CmdTable.AddColumn("Description");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "ENABLE");
		CmdTable.SetCell("Description", "Activates link buffering.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "DISABLE");
		CmdTable.SetCell("Description", "Deactivates link buffering.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "ENABLELOCAL");
		CmdTable.SetCell("Description", "Enables downloading of each link to local directory.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "DISABLELOCAL");
		CmdTable.SetCell("Description", "Disables downloading of each link to local directory.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command","ENABLEPUBLIC");
		CmdTable.SetCell("Description", "Enables the usage of !showlinks publicly, by other users.");

		CmdTable.AddRow();
        CmdTable.SetCell("Command","DISABLEPUBLIC");
        CmdTable.SetCell("Description", "Disables the usage of !showlinks publicly, by other users.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "DIRECTORY <#directory>");
		CmdTable.SetCell("Description", "Sets the local directory where the links will be saved.");
		
		CmdTable.AddRow();
		CmdTable.SetCell("Command", "CLEARBUFFER");
		CmdTable.SetCell("Description", "Empties the link buffer.");
		
		CmdTable.AddRow();
		CmdTable.SetCell("Command", "BUFFERSIZE <#size>");
		CmdTable.SetCell("Description", "Sets the size of the link buffer. Only integers >=0.");
		
		CmdTable.AddRow();
		CmdTable.SetCell("Command", "SHOWSETTINGS");
		CmdTable.SetCell("Description", "Prints all the settings.");

		CmdTable.AddRow();
        CmdTable.SetCell("Command", "BUFFERALLLINKS");
        CmdTable.SetCell("Description", "Toggles the buffering of all links or only image links.");

        CmdTable.AddRow();
        CmdTable.SetCell("Command", "REUPLOAD");
        CmdTable.SetCell("Description", "Toggles the reuploading of image links to imgur.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "SHOWLINKS <#number>");
		CmdTable.SetCell("Description", "Prints <#number> or <#buffersize> number of cached links.");

		CmdTable.AddRow();
		CmdTable.SetCell("Command", "HELP");
		CmdTable.SetCell("Description", "This help.");

		PutModule(CmdTable);
		return;
	} else if (command == "enable") 
	{
		SetNV("enable","true",true);
		PutModule("Enabled buffering");
	} else if (command == "disable") 
	{
		SetNV("enable","false",true);
		PutModule("Disabled buffering");
	} else if (command == "enablelocal")
	{
		if(GetNV("directory") == "")
		{
			PutModule("Directory is not set. First set a directory and then enable local caching");
			return;
		}
		SetNV("enablelocal","true",true);
		PutModule("Enabled local caching");
	} else if (command == "disablelocal")
	{
		SetNV("enablelocal", "false", true);
		PutModule("Disabled local caching");
	} else if (command == "enablepublic")
	{
		SetNV("enablepublic", "true", true);
		PutModule("Enabled public usage of showlinks.");
	} else if (command == "disablepublic")
        {
                SetNV("enablepublic", "false", true);
                PutModule("Disabled public usage of showlinks.");
        } else if (command == "directory") 
	{
		CString dir=sCommand.Token(1).Replace_n("//", "/").TrimRight_n("/") + "/";
		if (!isValidDir(dir))
		{
			PutModule("Error in directory name. Avoid using: | ; ! @ # ( ) < > \" ' ` ~ = & ^ <space> <tab>");
			return;
		}
		// Check if file exists and is directory
		if (dir.empty() || !CFile::Exists(dir) || !CFile::IsDir(dir, false))
		{
			PutModule("Invalid path or no write access to ["+ sCommand.Token(1) +"].");
			return;
		} 
		SetNV("directory", dir, true);
		PutModule("Directory for local caching set to " + GetNV("directory"));
	} else if (command == "clearbuffer")
	{
		lastUrls.clear();
		nicks.clear();
	} else if (command == "buffersize")
	{
		unsigned int bufSize = sCommand.Token(1).ToUInt();
		if(bufSize==0 || bufSize==UINT_MAX)
		{
			PutModule("Error in buffer size. Use only integers >= 0.");
			return;
		}
		SetNV("buffersize", CString(bufSize), true);
		PutModule("Buffer size set to " + GetNV("buffersize")); 
	} else if (command == "showsettings")
	{
		for(MCString::iterator it = BeginNV(); it != EndNV(); it++)
		{
			PutModule(it->first.AsUpper() + " : " + it->second);
		}
	} else if(command == "bufferalllinks"){
		SetNV("bufferalllinks", CString(!GetNV("bufferalllinks").ToBool()), true); 
		PutModule( CString(GetNV("bufferalllinks").ToBool()?"Enabled":"Disabled") + " buffering of all links.");
	} else if(command == "reupload"){
                SetNV("reupload", CString(!GetNV("reupload").ToBool()), true);
                PutModule( CString(GetNV("reupload").ToBool()?"Enabled":"Disabled") + " reuploading of images.");
    } else if (command == "showlinks")
	{
		 if(lastUrls.empty())
                        PutModule("No links were found...");
                 else
                 {
                        unsigned int maxLinks = GetNV("buffersize").ToUInt();
                        unsigned int size = sCommand.Token(1).ToUInt();
                        if(size!=0 && size<UINT_MAX) //if it was a valid number
                              maxLinks = size;
			unsigned int maxSize = lastUrls.size()-1;
			for(unsigned int i=0; i<=maxSize && i< maxLinks; i++)
		    {
                		PutModule(nicks[maxSize-i] + ": " + lastUrls[maxSize-i]);
            }
  		 }
	} else
	{
		PutModule("Unknown command! Try HELP.");
	}
}
示例#24
0
文件: crypt.cpp 项目: ConorOG/znc
	CString NickPrefix() {
		MCString::iterator it = FindNV(NICK_PREFIX_KEY);
		return it != EndNV() ? it->second : "*";
	}