1 // opermotd module by typobox43
8 /* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */
13 void do_opermotd(char** parameters, int pcnt, userrec* user);
17 ConfigReader* conf = new ConfigReader;
20 filename = conf->ReadValue("opermotd","file",0);
22 opermotd->LoadFile(filename);
26 void ShowOperMOTD(userrec* user) {
28 if(!opermotd->FileSize()) {
30 Srv->SendServ(user->fd,std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
35 Srv->SendServ(user->fd,std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
37 for(int i=0; i != opermotd->FileSize(); i++) {
39 Srv->SendServ(user->fd,std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
43 Srv->SendServ(user->fd,std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
47 void do_opermotd(char** parameters, int pcnt, userrec* user) {
53 class ModuleOpermotd : public Module {
61 Srv->AddCommand("OPERMOTD",do_opermotd,'o',0,"m_opermotd.so");
63 opermotd = new FileReader();
68 virtual ~ModuleOpermotd() {
74 virtual Version GetVersion() {
76 return Version(1,0,0,1,VF_VENDOR);
80 virtual void OnOper(userrec* user) {
86 virtual void OnRehash() {
94 class ModuleOpermotdFactory : public ModuleFactory {
98 ModuleOpermotdFactory() {
102 ~ModuleOpermotdFactory() {
106 virtual Module* CreateModule() {
108 return new ModuleOpermotd;
114 extern "C" void* init_module(void) {
116 return new ModuleOpermotdFactory;