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 */
31 extern InspIRCd* ServerInstance;
33 class cmd_globops : public command_t
36 cmd_globops () : command_t("GLOBOPS",'o',1)
38 this->source = "m_globops.so";
39 syntax = "<any-text>";
42 void Handle (const char** parameters, int pcnt, userrec *user)
44 std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": ";
45 for (int i = 0; i < pcnt; i++)
47 line = line + std::string(parameters[i]) + " ";
49 ServerInstance->WriteMode("og",WM_AND,line.c_str());
53 class ModeGlobops : public ModeHandler
56 ModeGlobops(InspIRCd* Instance) : ModeHandler(Instance, 'g', 0, 0, false, MODETYPE_USER, true) { }
58 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
62 if (!dest->IsModeSet('g'))
64 dest->SetMode('P',true);
65 return MODEACTION_ALLOW;
70 if (dest->IsModeSet('g'))
72 dest->SetMode('P',false);
73 return MODEACTION_ALLOW;
77 return MODEACTION_DENY;
82 class ModuleGlobops : public Module
84 cmd_globops* mycommand;
87 ModuleGlobops(Server* Me)
91 mg = new ModeGlobops(ServerInstance);
92 Srv->AddMode(mg, 'g');
93 mycommand = new cmd_globops();
94 Srv->AddCommand(mycommand);
97 virtual ~ModuleGlobops()
103 virtual Version GetVersion()
105 return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
108 void Implements(char* List)
113 class ModuleGlobopsFactory : public ModuleFactory
116 ModuleGlobopsFactory()
120 ~ModuleGlobopsFactory()
124 virtual Module * CreateModule(Server* Me)
126 return new ModuleGlobops(Me);
132 extern "C" void * init_module( void )
134 return new ModuleGlobopsFactory;