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";
38 syntax = "<any-text>";
41 void Handle (const char** parameters, int pcnt, userrec *user)
43 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
44 for (int i = 0; i < pcnt; i++)
46 line = line + std::string(parameters[i]) + " ";
48 Srv->SendToModeMask("og",WM_AND,line);
52 class ModeGlobops : public ModeHandler
55 ModeGlobops() : ModeHandler('g', 0, 0, false, MODETYPE_USER, true) { }
57 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
61 if (!dest->IsModeSet('g'))
63 dest->SetMode('P',true);
64 return MODEACTION_ALLOW;
69 if (dest->IsModeSet('g'))
71 dest->SetMode('P',false);
72 return MODEACTION_ALLOW;
76 return MODEACTION_DENY;
81 class ModuleGlobops : public Module
83 cmd_globops* mycommand;
86 ModuleGlobops(Server* Me)
90 mg = new ModeGlobops();
91 Srv->AddMode(mg, 'g');
92 mycommand = new cmd_globops();
93 Srv->AddCommand(mycommand);
96 virtual ~ModuleGlobops()
102 virtual Version GetVersion()
104 return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
107 void Implements(char* List)
112 class ModuleGlobopsFactory : public ModuleFactory
115 ModuleGlobopsFactory()
119 ~ModuleGlobopsFactory()
123 virtual Module * CreateModule(Server* Me)
125 return new ModuleGlobops(Me);
131 extern "C" void * init_module( void )
133 return new ModuleGlobopsFactory;