2007-07-16 17:30:04 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2008-01-10 13:27:07 +00:00
|
|
|
* InspIRCd: (C) 2002-2008 InspIRCd Development Team
|
2007-07-16 17:30:04 +00:00
|
|
|
* See: http://www.inspircd.org/wiki/index.php/Credits
|
|
|
|
*
|
|
|
|
* 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:
|
|
|
|
ModuleOperLog(InspIRCd* Me) : Module(Me)
|
|
|
|
{
|
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()
|
|
|
|
{
|
2008-03-24 13:41:25 +00:00
|
|
|
return Version(1,2,0,0,VF_VENDOR,API_VERSION);
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
2008-06-11 11:35:23 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2008-06-06 15:22:07 +00:00
|
|
|
virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *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)
|
|
|
|
return 0;
|
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-05-19 19:12:43 +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(), irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined().c_str());
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|