anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

ms_staff.cpp (1581B)

      1 /* MemoServ core functions
      2  *
      3  * (C) 2003-2022 Anope Team
      4  * Contact us at team@anope.org
      5  *
      6  * Please read COPYING and README for further details.
      7  *
      8  * Based on the original code of Epona by Lara.
      9  * Based on the original code of Services by Andy Church.
     10  */
     11 
     12 #include "module.h"
     13 
     14 namespace
     15 {
     16 	ServiceReference<MemoServService> memoserv("MemoServService", "MemoServ");
     17 }
     18 
     19 class CommandMSStaff : public Command
     20 {
     21  public:
     22 	CommandMSStaff(Module *creator) : Command(creator, "memoserv/staff", 1, 1)
     23 	{
     24 		this->SetDesc(_("Send a memo to all opers/admins"));
     25 		this->SetSyntax(_("\037memo-text\037"));
     26 	}
     27 
     28 	void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
     29 	{
     30 		if (!memoserv)
     31 			return;
     32 
     33 		const Anope::string &text = params[0];
     34 
     35 		for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
     36 		{
     37 			const NickCore *nc = it->second;
     38 
     39 			if (source.nc != nc && nc->IsServicesOper())
     40 				memoserv->Send(source.GetNick(), nc->display, text, true);
     41 		}
     42 	}
     43 
     44 	bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
     45 	{
     46 		this->SendSyntax(source);
     47 		source.Reply(" ");
     48 		source.Reply(_("Sends all services staff a memo containing \037memo-text\037."));
     49 
     50 		return true;
     51 	}
     52 };
     53 
     54 class MSStaff : public Module
     55 {
     56 	CommandMSStaff commandmsstaff;
     57 
     58  public:
     59 	MSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
     60 		commandmsstaff(this)
     61 	{
     62 		if (!memoserv)
     63 			throw ModuleException("No MemoServ!");
     64 	}
     65 };
     66 
     67 MODULE_INIT(MSStaff)