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);
20 ConfigReader* conf = new ConfigReader;
23 filename = conf->ReadValue("opermotd","file",0);
25 opermotd->LoadFile(filename);
29 void ShowOperMOTD(userrec* user)
31 if(!opermotd->FileSize())
33 Srv->SendServ(user->fd,std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
37 Srv->SendServ(user->fd,std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
39 for(int i=0; i != opermotd->FileSize(); i++)
41 Srv->SendServ(user->fd,std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
44 Srv->SendServ(user->fd,std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
48 void do_opermotd(char** parameters, int pcnt, userrec* user)
53 class ModuleOpermotd : public Module
56 ModuleOpermotd(Server* Me)
61 Srv->AddCommand("OPERMOTD",do_opermotd,'o',0,"m_opermotd.so");
62 opermotd = new FileReader();
66 virtual ~ModuleOpermotd()
70 virtual Version GetVersion()
72 return Version(1,0,0,1,VF_VENDOR);
75 virtual void OnOper(userrec* user, std::string opertype)
80 virtual void OnRehash(std::string parameter)
87 class ModuleOpermotdFactory : public ModuleFactory
90 ModuleOpermotdFactory()
94 ~ModuleOpermotdFactory()
98 virtual Module* CreateModule(Server* Me)
100 return new ModuleOpermotd(Me);
105 extern "C" void* init_module(void)
107 return new ModuleOpermotdFactory;