1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */
18 static FileReader* opermotd;
20 CmdResult ShowOperMOTD(User* user)
22 if(!opermotd->FileSize())
24 user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
28 user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
30 for(int i=0; i != opermotd->FileSize(); i++)
32 user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
35 user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
43 class CommandOpermotd : public Command
46 CommandOpermotd(Module* Creator) : Command(Creator,"OPERMOTD", 0)
48 flags_needed = 'o'; syntax = "[<servername>]";
51 CmdResult Handle (const std::vector<std::string>& parameters, User* user)
53 return ShowOperMOTD(user);
58 class ModuleOpermotd : public Module
68 filename = conf.ReadValue("opermotd","file",0);
70 opermotd = new FileReader(filename);
71 onoper = conf.ReadFlag("opermotd","onoper","yes",0);
78 ServerInstance->AddCommand(&cmd);
79 opermotd = new FileReader;
81 Implementation eventlist[] = { I_OnRehash, I_OnOper };
82 ServerInstance->Modules->Attach(eventlist, this, 2);
85 virtual ~ModuleOpermotd()
89 virtual Version GetVersion()
91 return Version("Shows a message to opers after oper-up, adds /opermotd", VF_VENDOR);
95 virtual void OnOper(User* user, const std::string &opertype)
101 virtual void OnRehash(User* user)
107 MODULE_INIT(ModuleOpermotd)