2007-07-16 17:30:04 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2010-01-11 03:07:32 +00:00
|
|
|
* InspIRCd: (C) 2002-2010 InspIRCd Development Team
|
2009-03-15 12:42:35 +00:00
|
|
|
* See: http://wiki.inspircd.org/Credits
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
|
|
|
* This program is free but copyrighted software; see
|
|
|
|
* the file COPYING for details.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2007-08-27 14:49:08 +00:00
|
|
|
#include "inspircd.h"
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */
|
|
|
|
|
|
|
|
class ModuleOperLog : public Module
|
|
|
|
{
|
|
|
|
private:
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
public:
|
2009-09-26 14:13:13 +00:00
|
|
|
ModuleOperLog() {
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-11-04 18:30:43 +00:00
|
|
|
Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric };
|
|
|
|
ServerInstance->Modules->Attach(eventlist, this, 2);
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
virtual ~ModuleOperLog()
|
|
|
|
{
|
|
|
|
}
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
virtual Version GetVersion()
|
|
|
|
{
|
2009-10-17 17:53:31 +00:00
|
|
|
return Version("A module which logs all oper commands to the ircd log at default loglevel.", VF_VENDOR);
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2010-01-18 17:35:55 +00:00
|
|
|
virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser *user, bool validated, const std::string &original_line)
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
|
|
|
/* If the command doesnt appear to be valid, we dont want to mess with it. */
|
|
|
|
if (!validated)
|
2009-09-02 00:49:36 +00:00
|
|
|
return MOD_RES_PASSTHRU;
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command)))
|
|
|
|
{
|
2007-10-15 20:55:55 +00:00
|
|
|
Command* thiscommand = ServerInstance->Parser->GetHandler(command);
|
2007-09-08 00:27:09 +00:00
|
|
|
if ((thiscommand) && (thiscommand->flags_needed == 'o'))
|
2008-07-12 20:24:06 +00:00
|
|
|
ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s %s",user->nick.c_str(), user->ident.c_str(), user->host.c_str(), command.c_str(), parameters.empty() ? "" : irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined().c_str());
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 00:49:36 +00:00
|
|
|
return MOD_RES_PASSTHRU;
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void On005Numeric(std::string &output)
|
|
|
|
{
|
|
|
|
output.append(" OPERLOG");
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2008-06-11 11:35:23 +00:00
|
|
|
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
MODULE_INIT(ModuleOperLog)
|