1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
19 // Globops and +g support module by C.J.Edwards
27 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
31 class cmd_globops : public command_t
34 cmd_globops () : command_t("GLOBOPS",'o',1)
36 this->source = "m_globops.so";
39 void Handle (char **parameters, int pcnt, userrec *user)
41 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
42 for (int i = 0; i < pcnt; i++)
44 line = line + std::string(parameters[i]) + " ";
46 Srv->SendToModeMask("og",WM_AND,line);
51 class ModuleGlobops : public Module
53 cmd_globops* mycommand;
55 ModuleGlobops(Server* Me)
60 if (!Srv->AddExtendedMode('g',MT_CLIENT,true,0,0))
62 Srv->Log(DEFAULT,"*** m_globops: ERROR, failed to allocate user mode +g!");
63 printf("Could not claim usermode +g for this module!");
68 mycommand = new cmd_globops();
69 Srv->AddCommand(mycommand);
73 virtual ~ModuleGlobops()
77 virtual Version GetVersion()
79 return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
82 void Implements(char* List)
84 List[I_OnExtendedMode] = 1;
87 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
89 // check if this is our mode character...
90 if ((modechar == 'g') && (type == MT_CLIENT))
92 // we dont actually do anything with the mode in this module -
93 // just tell the core its been claimed and is ok to give users.
98 // this mode isn't ours, we have to bail and return 0 to not handle it.
104 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
106 class ModuleGlobopsFactory : public ModuleFactory
109 ModuleGlobopsFactory()
113 ~ModuleGlobopsFactory()
117 virtual Module * CreateModule(Server* Me)
119 return new ModuleGlobops(Me);
125 extern "C" void * init_module( void )
127 return new ModuleGlobopsFactory;