1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 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
28 /* $ModDesc: Provides support for GLOBOPS and user mode +g */
32 class cmd_globops : public command_t
35 cmd_globops () : command_t("GLOBOPS",'o',1)
37 this->source = "m_globops.so";
40 void Handle (const char** parameters, int pcnt, userrec *user)
42 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
43 for (int i = 0; i < pcnt; i++)
45 line = line + std::string(parameters[i]) + " ";
47 Srv->SendToModeMask("og",WM_AND,line);
51 class ModeGlobops : public ModeHandler
54 ModeGlobops() : ModeHandler('g', 0, 0, false, MODETYPE_USER, true) { }
56 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
60 if (!dest->IsModeSet('g'))
62 dest->SetMode('P',true);
63 return MODEACTION_ALLOW;
68 if (dest->IsModeSet('g'))
70 dest->SetMode('P',false);
71 return MODEACTION_ALLOW;
75 return MODEACTION_DENY;
80 class ModuleGlobops : public Module
82 cmd_globops* mycommand;
85 ModuleGlobops(Server* Me)
89 mg = new ModeGlobops();
90 Srv->AddMode(mg, 'g');
91 mycommand = new cmd_globops();
92 Srv->AddCommand(mycommand);
95 virtual ~ModuleGlobops()
101 virtual Version GetVersion()
103 return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
106 void Implements(char* List)
111 class ModuleGlobopsFactory : public ModuleFactory
114 ModuleGlobopsFactory()
118 ~ModuleGlobopsFactory()
122 virtual Module * CreateModule(Server* Me)
124 return new ModuleGlobops(Me);
130 extern "C" void * init_module( void )
132 return new ModuleGlobopsFactory;