Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "module.h"
00013
00014 class BSAutoAssign : public Module
00015 {
00016 Anope::string bot;
00017
00018 public:
00019 BSAutoAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED)
00020 {
00021 this->SetAuthor("Anope");
00022
00023 Implementation i[] = { I_OnChanRegistered, I_OnReload };
00024 ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
00025
00026 this->OnReload();
00027 }
00028
00029 void OnChanRegistered(ChannelInfo *ci) anope_override
00030 {
00031 if (this->bot.empty())
00032 return;
00033
00034 BotInfo *bi = BotInfo::Find(this->bot);
00035 if (bi == NULL)
00036 {
00037 Log(this) << "bs_autoassign is configured to assign bot " << this->bot << ", but it does not exist?";
00038 return;
00039 }
00040
00041 bi->Assign(NULL, ci);
00042 }
00043
00044 void OnReload() anope_override
00045 {
00046 ConfigReader config;
00047 this->bot = config.ReadValue("bs_autoassign", "bot", "", 0);
00048 }
00049 };
00050
00051 MODULE_INIT(BSAutoAssign)