1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 #include "helperfuncs.h"
26 /* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */
28 class ModuleOperLog : public Module
33 ModuleOperLog(Server* Me) : Module::Module(Me)
38 virtual ~ModuleOperLog()
42 virtual Version GetVersion()
44 return Version(1,0,0,0,VF_VENDOR);
47 void Implements(char* List)
49 List[I_OnPreCommand] = List[I_On005Numeric] = 1;
52 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated)
54 /* If the command doesnt appear to be valid, we dont want to mess with it. */
58 if ((*user->oper) && (IS_LOCAL(user)) && (user->HasPermission(command)))
60 std::string plist = "";
61 for (int j = 0; j < pcnt; j++)
63 plist.append(std::string(" ")+std::string(parameters[j]));
65 log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
71 virtual void On005Numeric(std::string &output)
73 output.append(" OPERLOG");
80 /******************************************************************************************************/
82 class ModuleOperLogFactory : public ModuleFactory
85 ModuleOperLogFactory()
89 ~ModuleOperLogFactory()
93 virtual Module * CreateModule(Server* Me)
95 return new ModuleOperLog(Me);
100 extern "C" void * init_module( void )
102 return new ModuleOperLogFactory;