mirror of
https://github.com/anope/anope.git
synced 2026-07-03 21:03:13 +02:00
Added options:botmodes to configure what modes BotServ bots should use in channels
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2778 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+4
-2
@@ -644,8 +644,10 @@ void bot_join(ChannelInfo * ci)
|
||||
ci->bi->nick.c_str(), ci->bi->nick.c_str());
|
||||
}
|
||||
ircdproto->SendJoin(ci->bi, ci->c->name.c_str(), ci->c->creation_time);
|
||||
ci->c->SetMode(NULL, CMODE_PROTECT, ci->bi->nick);
|
||||
ci->c->SetMode(NULL, CMODE_OP, ci->bi->nick);
|
||||
for (std::list<ChannelModeStatus *>::iterator it = BotModes.begin(); it != BotModes.end(); ++it)
|
||||
{
|
||||
ci->c->SetMode(ci->bi, *it, ci->bi->nick, false);
|
||||
}
|
||||
FOREACH_MOD(I_OnBotJoin, OnBotJoin(ci, ci->bi));
|
||||
}
|
||||
|
||||
|
||||
@@ -640,6 +640,7 @@ int ServerConfig::Read(bool bail)
|
||||
{"options", "ulineservers", "", new ValueContainerChar(&UlineServers), DT_CHARPTR, NoValidation},
|
||||
{"options", "enablelogchannel", "no", new ValueContainerBool(&LogChan), DT_BOOLEAN, NoValidation},
|
||||
{"options", "mlock", "+nrt", new ValueContainerString(&Config.MLock), DT_STRING, NoValidation},
|
||||
{"options", "botmodes", "", new ValueContainerString(&Config.BotModes), DT_STRING, NoValidation},
|
||||
{"nickserv", "nick", "NickServ", new ValueContainerChar(&Config.s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"nickserv", "description", "Nickname Registration Service", new ValueContainerChar(&Config.desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"nickserv", "emailregistration", "no", new ValueContainerBool(&Config.NSEmailReg), DT_BOOLEAN, NoValidation},
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
/* List of pairs of user/channels and their stacker info */
|
||||
std::list<std::pair<void *, StackerInfo *> > ModeManager::StackerObjects;
|
||||
|
||||
/* User modes */
|
||||
std::map<char, UserMode *> ModeManager::UserModesByChar;
|
||||
std::map<UserModeName, UserMode *> ModeManager::UserModesByName;
|
||||
/* Channel modes */
|
||||
@@ -31,6 +32,8 @@ std::bitset<128> DefMLockOn;
|
||||
std::bitset<128> DefMLockOff;
|
||||
/* Map for default mlocked mode parameters */
|
||||
std::map<ChannelModeName, std::string> DefMLockParams;
|
||||
/* Modes to set on bots when they join the channel */
|
||||
std::list<ChannelModeStatus *> BotModes;
|
||||
|
||||
/** Parse the mode string from the config file and set the default mlocked modes
|
||||
*/
|
||||
@@ -77,6 +80,18 @@ void SetDefaultMLock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set Bot Modes */
|
||||
BotModes.clear();
|
||||
for (unsigned i = 0; i < Config.BotModes.size(); ++i)
|
||||
{
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(Config.BotModes[i]);
|
||||
|
||||
if (cm && cm->Type == MODE_STATUS && std::find(BotModes.begin(), BotModes.end(), cm) == BotModes.end())
|
||||
{
|
||||
BotModes.push_back(dynamic_cast<ChannelModeStatus *>(cm));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Default constructor
|
||||
|
||||
Reference in New Issue
Block a user