Exemple #1
0
	void OnLog(Logger *logger) override
	{
		User *user = logger->GetUser();
		ChanServ::Channel *channel = logger->GetCi();
		Command *command = logger->GetCommand();
		CommandSource *source = logger->GetSource();

		if (logger->GetType() != LogType::COMMAND || user == nullptr || command == nullptr || channel == nullptr || !Me || !Me->IsSynced())
			return;

		Channel *c = channel->GetChannel();

		for (LogSetting *log : channel->GetRefs<LogSetting *>())
		{
			/* wrong command */
			if (log->GetServiceName() != command->GetName())
				continue;

			/* if a command name is given check the service and the command */
			if (!log->GetCommandName().empty())
			{
				/* wrong service (only check if not a fantasy command, though) */
				if (!source->c && log->GetCommandService() != source->service->nick)
					continue;

				if (!log->GetCommandName().equals_ci(source->GetCommand()))
					continue;
			}

			const Anope::string &buffer = logger->GetMaskedMessage();

			if (log->GetMethod().equals_ci("MEMO") && memoserv && channel->WhoSends() != NULL)
				memoserv->Send(channel->WhoSends()->nick, channel->GetName(), buffer, true);
			else if (source->c)
				/* Sending a channel message or notice in response to a fantasy command */;
			else if (log->GetMethod().equals_ci("MESSAGE") && c)
			{
				IRCD->SendPrivmsg(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer);
#warning "fix idletimes"
				//l->ci->WhoSends()->lastmsg = Anope::CurTime;
			}
			else if (log->GetMethod().equals_ci("NOTICE") && c)
				IRCD->SendNotice(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer);
		}
	}
Exemple #2
0
	bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
	{
		source.Reply(_("The {0} command allows users to configure logging settings for \037channel\037."
		               " If no parameters are given this command lists the current logging methods in place on \037channel\037."
		               " Otherwise, \037command\037 must be a command name, and \037method\037 must be one of the following logging methods:\n"
		               "\n"
		               " MESSAGE [status], NOTICE [status], MEMO\n"
		               "\n"
		               "Which are used to message, notice, and memo the channel respectively."
		               " With MESSAGE or NOTICE you must have a service bot assigned to and joined to your channel."
		               " Status may be a channel status such as @ or +.\n"
	                       "\n"
		               "To remove a logging method use the same syntax as you would to add it.\n"
		               "\n"
		               "Use of this command requires the \002{1}\002 privilege on \037channel\037."
		               "\n"
		               "Example:\n"
		               "         {command} #anope chanserv/access MESSAGE @\n"
		               "         Would message any channel operators of \"#anope\" whenever someone used the \"ACCESS\" command on ChanServ for \"#anope\"."),
		               source.GetCommand(), "SET");
		return true;
	}