Anope IRC Services  Version 2.0
bs_autoassign.cpp
Go to the documentation of this file.
1 /*
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  */
9 
10 #include "module.h"
11 
12 class BSAutoAssign : public Module
13 {
14  public:
15  BSAutoAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
16  {
17  }
18 
20  {
21  const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot");
22  if (bot.empty())
23  return;
24 
25  BotInfo *bi = BotInfo::Find(bot, true);
26  if (bi == NULL)
27  {
28  Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?";
29  return;
30  }
31 
32  bi->Assign(NULL, ci);
33  }
34 };
35 
Definition: bots.h:24
Definition: hashcomp.h:84
void Assign(User *u, ChannelInfo *ci)
Definition: bots.cpp:153
Definition: Config.cs:26
#define anope_override
Definition: services.h:56
bool empty() const
Definition: anope.h:126
#define MODULE_INIT(x)
Definition: modules.h:45
Definition: logger.h:53
void OnChanRegistered(ChannelInfo *ci) anope_override
BSAutoAssign(const Anope::string &modname, const Anope::string &creator)
static BotInfo * Find(const Anope::string &nick, bool nick_only=false)
Definition: bots.cpp:249