1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 * ---------------------------------------------------
16 /* $ModDesc: A module which logs all oper commands to the ircd log at default loglevel. */
18 class ModuleOperLog : public Module
23 ModuleOperLog(InspIRCd* Me) : Module(Me)
26 Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric };
27 ServerInstance->Modules->Attach(eventlist, this, 2);
30 virtual ~ModuleOperLog()
34 virtual Version GetVersion()
36 return Version(1,2,0,0,VF_VENDOR,API_VERSION);
40 virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line)
42 /* If the command doesnt appear to be valid, we dont want to mess with it. */
46 if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command)))
48 Command* thiscommand = ServerInstance->Parser->GetHandler(command);
49 if ((thiscommand) && (thiscommand->flags_needed == 'o'))
52 for (int j = 0; j < pcnt; j++)
53 plist.append(std::string(" ")+std::string(parameters[j]));
55 ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
62 virtual void On005Numeric(std::string &output)
64 output.append(" OPERLOG");
70 MODULE_INIT(ModuleOperLog)