1 // opermotd module by typobox43
9 #include "helperfuncs.h"
11 /* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */
16 void do_opermotd(char** parameters, int pcnt, userrec* user);
21 ConfigReader* conf = new ConfigReader;
24 filename = conf->ReadValue("opermotd","file",0);
26 opermotd->LoadFile(filename);
30 void ShowOperMOTD(userrec* user)
32 if(!opermotd->FileSize())
34 Srv->SendServ(user->fd,std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
38 Srv->SendServ(user->fd,std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
40 for(int i=0; i != opermotd->FileSize(); i++)
42 Srv->SendServ(user->fd,std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
45 Srv->SendServ(user->fd,std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
49 void do_opermotd(char** parameters, int pcnt, userrec* user)
54 class ModuleOpermotd : public Module
61 Srv->AddCommand("OPERMOTD",do_opermotd,'o',0,"m_opermotd.so");
62 opermotd = new FileReader();
66 virtual ~ModuleOpermotd()
71 virtual Version GetVersion()
73 return Version(1,0,0,1,VF_VENDOR);
76 virtual void OnOper(userrec* user, std::string opertype)
81 virtual void OnRehash()
88 class ModuleOpermotdFactory : public ModuleFactory
91 ModuleOpermotdFactory()
95 ~ModuleOpermotdFactory()
99 virtual Module* CreateModule()
101 return new ModuleOpermotd;
106 extern "C" void* init_module(void)
108 return new ModuleOpermotdFactory;