1 // Globops and +g support module by C.J.Edwards
9 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
13 void handle_globops(char **parameters, int pcnt, userrec *user)
15 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
16 for (int i = 0; i < pcnt; i++)
18 line = line + std::string(parameters[i]) + " ";
20 Srv->SendToModeMask("og",WM_AND,line);
24 class ModuleGlobops : public Module
31 if (!Srv->AddExtendedMode('g',MT_CLIENT,true,0,0))
33 Srv->Log(DEFAULT,"*** m_globops: ERROR, failed to allocate user mode +g!");
34 printf("Could not claim usermode +g for this module!");
37 Srv->AddCommand("GLOBOPS",handle_globops,'o',1);
40 virtual ~ModuleGlobops()
45 virtual Version GetVersion()
47 return Version(1,0,0,1);
50 virtual bool OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
52 // check if this is our mode character...
53 if ((modechar == 'g') && (type == MT_CLIENT))
55 // we dont actually do anything with the mode in this module -
56 // just tell the core its been claimed and is ok to give users.
61 // this mode isn't ours, we have to bail and return 0 to not handle it.
66 virtual void OnOper(userrec* user)
68 char* modes[2]; // only two parameters
69 modes[0] = user->nick; // first parameter is the nick
70 modes[1] = "+g"; // second parameter is the mode
71 Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +g"
76 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
78 class ModuleGlobopsFactory : public ModuleFactory
81 ModuleGlobopsFactory()
85 ~ModuleGlobopsFactory()
89 virtual Module * CreateModule()
91 return new ModuleGlobops;
97 extern "C" void * init_module( void )
99 return new ModuleGlobopsFactory;