1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 /* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */
22 class ModuleOperLog : public Module
27 ModuleOperLog(InspIRCd* Me) : Module::Module(Me)
32 virtual ~ModuleOperLog()
36 virtual Version GetVersion()
38 return Version(1,1,0,0,VF_VENDOR,API_VERSION);
41 void Implements(char* List)
43 List[I_OnPreCommand] = List[I_On005Numeric] = 1;
46 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
48 /* If the command doesnt appear to be valid, we dont want to mess with it. */
52 if ((*user->oper) && (IS_LOCAL(user)) && (user->HasPermission(command)))
54 command_t* thiscommand = ServerInstance->Parser->GetHandler(command);
55 if ((thiscommand) && (thiscommand->flags_needed = 'o'))
57 std::string plist = "";
58 for (int j = 0; j < pcnt; j++)
59 plist.append(std::string(" ")+std::string(parameters[j]));
61 ServerInstance->Log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
68 virtual void On005Numeric(std::string &output)
70 output.append(" OPERLOG");
77 /******************************************************************************************************/
79 class ModuleOperLogFactory : public ModuleFactory
82 ModuleOperLogFactory()
86 ~ModuleOperLogFactory()
90 virtual Module * CreateModule(InspIRCd* Me)
92 return new ModuleOperLog(Me);
97 extern "C" void * init_module( void )
99 return new ModuleOperLogFactory;