X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_globops.cpp;h=f0a879d4baf13f8aafdb86ab584667bc1924ff9a;hb=d54fd9b1e6b31f69332a9241b5f17330c0ad61e0;hp=6d00d5889994fb8267fcbcee4b7793a8ad6f79b4;hpb=0757a4a495daabf661ac3b7ab79f0a5ee423abe8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 6d00d5889..f0a879d4b 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -27,80 +27,49 @@ using namespace std; /* $ModDesc: Provides support for GLOBOPS and user mode +g */ -static Server *Srv; + class cmd_globops : public command_t { public: - cmd_globops () : command_t("GLOBOPS",'o',1) + cmd_globops (InspIRCd* Instance) : command_t(Instance,"GLOBOPS",'o',1) { this->source = "m_globops.so"; + syntax = ""; } - + void Handle (const char** parameters, int pcnt, userrec *user) { - std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": "; + std::string line = "From " + std::string(user->nick) + ": "; for (int i = 0; i < pcnt; i++) { line = line + std::string(parameters[i]) + " "; } - Srv->SendToModeMask("og",WM_AND,line); - } -}; - -class ModeGlobops : public ModeHandler -{ - public: - ModeGlobops() : ModeHandler('g', 0, 0, false, MODETYPE_USER, true) { } - - ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) - { - if (adding) - { - if (!dest->IsModeSet('g')) - { - dest->SetMode('P',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('g')) - { - dest->SetMode('P',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; + ServerInstance->SNO->WriteToSnoMask('g',line); } }; - class ModuleGlobops : public Module { cmd_globops* mycommand; - ModeGlobops* mg; public: - ModuleGlobops(Server* Me) + ModuleGlobops(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - mg = new ModeGlobops(); - Srv->AddMode(mg, 'g'); - mycommand = new cmd_globops(); - Srv->AddCommand(mycommand); + mycommand = new cmd_globops(ServerInstance); + ServerInstance->AddCommand(mycommand); + ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); } virtual ~ModuleGlobops() { + ServerInstance->SNO->DisableSnomask('g'); DELETE(mycommand); - DELETE(mg); } virtual Version GetVersion() { - return Version(1,0,0,1,VF_STATIC|VF_VENDOR); + return Version(1,0,0,1,VF_VENDOR); } void Implements(char* List) @@ -119,7 +88,7 @@ class ModuleGlobopsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleGlobops(Me); }