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 virtual ~ModuleModesOnOper()
46 virtual Version GetVersion()
48 return Version(1,0,0,1,VF_VENDOR);
51 virtual void OnOper(userrec* user, std::string opertype)
53 // whenever a user opers, go through the oper types, find their <type:modes>,
54 // and if they have one apply their modes. The mode string can contain +modes
55 // to add modes to the user or -modes to take modes from the user.
56 for (int j =0; j < Conf->Enumerate("type"); j++)
58 std::string typen = Conf->ReadValue("type","name",j);
59 if (!strcmp(typen.c_str(),user->oper))
61 std::string ThisOpersModes = Conf->ReadValue("type","modes",j);
62 if (ThisOpersModes != "")
65 modes[0] = user->nick;
66 modes[1] = (char*)ThisOpersModes.c_str();
67 Srv->SendMode(modes,2,user);
75 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
77 class ModuleModesOnOperFactory : public ModuleFactory
80 ModuleModesOnOperFactory()
84 ~ModuleModesOnOperFactory()
88 virtual Module * CreateModule(Server* Me)
90 return new ModuleModesOnOper(Me);
96 extern "C" void * init_module( void )
98 return new ModuleModesOnOperFactory;