1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */
21 static FileReader* opermotd;
23 CmdResult ShowOperMOTD(userrec* user)
25 if(!opermotd->FileSize())
27 user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
31 user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
33 for(int i=0; i != opermotd->FileSize(); i++)
35 user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
38 user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
46 class cmd_opermotd : public command_t
49 cmd_opermotd (InspIRCd* Instance) : command_t(Instance,"OPERMOTD", 'o', 0)
51 this->source = "m_opermotd.so";
52 syntax = "[<servername>]";
55 CmdResult Handle (const char** parameters, int pcnt, userrec* user)
57 return ShowOperMOTD(user);
62 class ModuleOpermotd : public Module
64 cmd_opermotd* mycommand;
69 ConfigReader* conf = new ConfigReader(ServerInstance);
71 filename = conf->ReadValue("opermotd","file",0);
77 opermotd = new FileReader(ServerInstance, filename);
81 ModuleOpermotd(InspIRCd* Me)
85 mycommand = new cmd_opermotd(ServerInstance);
86 ServerInstance->AddCommand(mycommand);
87 opermotd = new FileReader(ServerInstance);
91 virtual ~ModuleOpermotd()
95 virtual Version GetVersion()
97 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
100 void Implements(char* List)
102 List[I_OnRehash] = List[I_OnOper] = 1;
105 virtual void OnOper(userrec* user, const std::string &opertype)
110 virtual void OnRehash(userrec* user, const std::string ¶meter)
116 MODULE_INIT(ModuleOpermotd)