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 * ---------------------------------------------------
17 // Globops and +g support module by C.J.Edwards
25 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
29 void handle_globops(char **parameters, int pcnt, userrec *user)
31 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
32 for (int i = 0; i < pcnt; i++)
34 line = line + std::string(parameters[i]) + " ";
36 Srv->SendToModeMask("og",WM_AND,line);
40 class ModuleGlobops : public Module
47 if (!Srv->AddExtendedMode('g',MT_CLIENT,true,0,0))
49 Srv->Log(DEFAULT,"*** m_globops: ERROR, failed to allocate user mode +g!");
50 printf("Could not claim usermode +g for this module!");
53 else Srv->AddCommand("GLOBOPS",handle_globops,'o',1,"m_globops.so");
56 virtual ~ModuleGlobops()
61 virtual Version GetVersion()
63 return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
66 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
68 // check if this is our mode character...
69 if ((modechar == 'g') && (type == MT_CLIENT))
71 // we dont actually do anything with the mode in this module -
72 // just tell the core its been claimed and is ok to give users.
77 // this mode isn't ours, we have to bail and return 0 to not handle it.
82 virtual void OnOper(userrec* user)
84 char* modes[2]; // only two parameters
85 modes[0] = user->nick; // first parameter is the nick
86 modes[1] = "+g"; // second parameter is the mode
87 Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +g"
92 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
94 class ModuleGlobopsFactory : public ModuleFactory
97 ModuleGlobopsFactory()
101 ~ModuleGlobopsFactory()
105 virtual Module * CreateModule()
107 return new ModuleGlobops;
113 extern "C" void * init_module( void )
115 return new ModuleGlobopsFactory;