X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_operlevels.cpp;h=1d4302d21d41fab686d74fe07b9120433fa6c86d;hb=226a95aab09b9e1f43f61e78179bfa1135816c2d;hp=da506dd582e0c164cc240a68e4b24d9b483fa318;hpb=3af9c3f8950f864bcf9cdd56127cd4014827dece;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index da506dd58..1d4302d21 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -27,19 +27,9 @@ class ModuleOperLevels : public Module { public: - ModuleOperLevels() - { - Implementation eventlist[] = { I_OnRehash, I_OnKill }; - ServerInstance->Modules->Attach(eventlist, this, 2); - } - - virtual ~ModuleOperLevels() - { - } - - - virtual void OnRehash(User* user) + void init() { + ServerInstance->Modules->Attach(I_OnKill, this); } virtual Version GetVersion() @@ -50,22 +40,23 @@ class ModuleOperLevels : public Module virtual ModResult OnKill(User* source, User* dest, const std::string &reason) { // oper killing an oper? - if (IS_OPER(dest) && IS_OPER(source)) + if (dest->IsOper() && source->IsOper()) { - long dest_level = atol(dest->oper->getConfig("level").c_str()); - long source_level = atol(source->oper->getConfig("level").c_str()); + std::string level = dest->oper->getConfig("level"); + long dest_level = atol(level.c_str()); + level = source->oper->getConfig("level"); + long source_level = atol(level.c_str()); + if (dest_level > source_level) { if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str()); - dest->WriteServ("NOTICE %s :*** Oper %s attempted to /kill you!",dest->nick.c_str(),source->nick.c_str()); + dest->WriteNotice("*** Oper " + source->nick + " attempted to /kill you!"); source->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper %s is a higher level than you",source->nick.c_str(),dest->nick.c_str()); return MOD_RES_DENY; } } return MOD_RES_PASSTHRU; } - }; MODULE_INIT(ModuleOperLevels) -