diff options
author | Adam <Adam@Anope.org> | 2010-05-25 00:57:25 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 21:04:07 -0400 |
commit | 4a2b9ebcf38d6c0a2860b966421b3af125438488 (patch) | |
tree | e4af4e59fd29352138db0fb0ff614d50233850b8 /src/core/ss_main.cpp | |
parent | 2fba686904e6f78ebab35df171c5757afeebf05d (diff) |
Renamed all of source files from .c to .cpp
Diffstat (limited to 'src/core/ss_main.cpp')
-rw-r--r-- | src/core/ss_main.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/core/ss_main.cpp b/src/core/ss_main.cpp new file mode 100644 index 000000000..d0578b16d --- /dev/null +++ b/src/core/ss_main.cpp @@ -0,0 +1,68 @@ +/* StatServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#include "module.h" + +BotInfo *statserv = NULL; + +class CommandSSHelp : public Command +{ + public: + CommandSSHelp() : Command("HELP", 0, 0) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + ircdproto->SendMessage(statserv, u->nick.c_str(), "This is a test of the emergency StatServ system."); + return MOD_CONT; + } +}; + +class SSMain : public Module +{ + public: + SSMain(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(CORE); + this->SetPermanent(true); + + statserv = findbot("StatServ"); + if (!statserv) + { + Alog() << "Creating SS"; + statserv = new BotInfo("StatServ", Config.ServiceUser, Config.ServiceHost, "Stats Service"); + } + Alog() << "Done creating SS"; + + this->AddCommand(statserv, new CommandSSHelp()); + } + + ~SSMain() + { + if (statserv) + { + for (std::map<ci::string, Command *>::iterator it = statserv->Commands.begin(); it != statserv->Commands.end(); ++it) + { + this->DelCommand(statserv, it->second); + } + + ircdproto->SendQuit(statserv, "Quit due to module unload."); + delete statserv; + } + } +}; + +MODULE_INIT(SSMain) |