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 * ---------------------------------------------------
25 /* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */
27 class ModuleOperLog : public Module
32 ModuleOperLog(InspIRCd* Me) : Module::Module(Me)
37 virtual ~ModuleOperLog()
41 virtual Version GetVersion()
43 return Version(1,0,0,0,VF_VENDOR,API_VERSION);
46 void Implements(char* List)
48 List[I_OnPreCommand] = List[I_On005Numeric] = 1;
51 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
53 /* If the command doesnt appear to be valid, we dont want to mess with it. */
57 if ((*user->oper) && (IS_LOCAL(user)) && (user->HasPermission(command)))
59 std::string plist = "";
60 for (int j = 0; j < pcnt; j++)
62 plist.append(std::string(" ")+std::string(parameters[j]));
64 ServerInstance->Log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
70 virtual void On005Numeric(std::string &output)
72 output.append(" OPERLOG");
79 /******************************************************************************************************/
81 class ModuleOperLogFactory : public ModuleFactory
84 ModuleOperLogFactory()
88 ~ModuleOperLogFactory()
92 virtual Module * CreateModule(InspIRCd* Me)
94 return new ModuleOperLog(Me);
99 extern "C" void * init_module( void )
101 return new ModuleOperLogFactory;