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 * ---------------------------------------------------
24 /* $ModDesc: Sets (and unsets) modes on opers when they oper up */
26 class ModuleModesOnOper : public Module
34 ModuleModesOnOper(Server* Me)
38 Conf = new ConfigReader;
41 void Implements(char* List)
46 virtual ~ModuleModesOnOper()
51 virtual Version GetVersion()
53 return Version(1,0,0,1,VF_VENDOR);
56 virtual void OnOper(userrec* user, std::string opertype)
58 // whenever a user opers, go through the oper types, find their <type:modes>,
59 // and if they have one apply their modes. The mode string can contain +modes
60 // to add modes to the user or -modes to take modes from the user.
61 for (int j =0; j < Conf->Enumerate("type"); j++)
63 std::string typen = Conf->ReadValue("type","name",j);
64 if (!strcmp(typen.c_str(),user->oper))
66 std::string ThisOpersModes = Conf->ReadValue("type","modes",j);
67 if (ThisOpersModes != "")
70 modes[0] = user->nick;
71 modes[1] = (char*)ThisOpersModes.c_str();
72 Srv->SendMode(modes,2,user);
80 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
82 class ModuleModesOnOperFactory : public ModuleFactory
85 ModuleModesOnOperFactory()
89 ~ModuleModesOnOperFactory()
93 virtual Module * CreateModule(Server* Me)
95 return new ModuleModesOnOper(Me);
101 extern "C" void * init_module( void )
103 return new ModuleModesOnOperFactory;