]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_globops.cpp
Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists
[user/henk/code/inspircd.git] / src / modules / m_globops.cpp
index add0306a707bc8586042eb3a70c43d3c54a800e0..f0a879d4baf13f8aafdb86ab584667bc1924ff9a 100644 (file)
@@ -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 = "<any-text>";
        }
-       
-       void Handle (char **parameters, int pcnt, userrec *user)
+
+       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 &parameter, 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);
        }