mirror of
https://github.com/anope/anope.git
synced 2026-07-08 07:03:14 +02:00
Fixed botserv bots parting empty channels. This also allows setting bsminusers to 0, which keeps the botserv bot in the channel at all times.
This commit is contained in:
+2
-2
@@ -1184,8 +1184,8 @@ botserv
|
||||
|
||||
/*
|
||||
* The minimum number of users there must be in a channel before the bot joins it. The best
|
||||
* value for this setting is 1 or 2. This cannot be 0, otherwise topic retention and mode
|
||||
* lock and such other things won't work.
|
||||
* value for this setting is 1 or 2. This can be 0, the service bots will not part unless
|
||||
* specifically unassigned, and will keep the channel open.
|
||||
*/
|
||||
minusers = 1
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
class CommandNSSetAutoOp : public Command
|
||||
{
|
||||
public:
|
||||
CommandNSSetAutoOp() : Command("AUTOOP", 2)
|
||||
CommandNSSetAutoOp() : Command("AUTOOP", 1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -123,7 +123,7 @@ void Channel::JoinUser(User *user)
|
||||
* But don't join the bot if the channel is persistant - Adam
|
||||
* But join persistant channels when syncing with our uplink- DP
|
||||
**/
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && (!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() == Config.BSMinUsers)
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && (!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() >= Config.BSMinUsers && !this->FindUser(this->ci->bi))
|
||||
this->ci->bi->Join(this);
|
||||
/* Only display the greet if the main uplink we're connected
|
||||
* to has synced, or we'll get greet-floods when the net
|
||||
@@ -183,8 +183,10 @@ void Channel::DeleteUser(User *user)
|
||||
if (this->ci && this->ci->HasFlag(CI_INHABIT))
|
||||
return;
|
||||
|
||||
/* check for BSMinUsers and part the BotServ bot from the channel */
|
||||
if (this->users.size() < Config.BSMinUsers && !Config.s_BotServ.empty() && this->ci && this->ci->bi && this->FindUser(this->ci->bi))
|
||||
/* check for BSMinUsers and part the BotServ bot from the channel
|
||||
* Use <= because the bot is included in this->users.size()
|
||||
*/
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && this->users.size() <= Config.BSMinUsers && this->FindUser(this->ci->bi))
|
||||
this->ci->bi->Part(this->ci->c);
|
||||
else if (this->users.empty())
|
||||
delete this;
|
||||
@@ -1345,8 +1347,8 @@ void chan_set_correct_modes(User *user, Channel *c, int give_modes)
|
||||
else if (voice && check_access(user, ci, CA_AUTOVOICE))
|
||||
c->SetMode(NULL, CMODE_VOICE, user->nick);
|
||||
}
|
||||
/* If this channel has secureops or the user matches autodeop or the channel is syncing and this is the first user and they are not ulined, check to remove modes */
|
||||
if ((ci->HasFlag(CI_SECUREOPS) || check_access(user, ci, CA_AUTODEOP) || (c->HasFlag(CH_SYNCING) && c->users.size() == (ci->bi ? 2 : 1))) && !user->server->IsULined())
|
||||
/* If this channel has secureops or the user matches autodeop or the channel is syncing and they are not ulined, check to remove modes */
|
||||
if ((ci->HasFlag(CI_SECUREOPS) || check_access(user, ci, CA_AUTODEOP) || c->HasFlag(CH_SYNCING)) && !user->server->IsULined())
|
||||
{
|
||||
if (owner && c->HasUserStatus(user, CMODE_OWNER) && !check_access(user, ci, CA_FOUNDER))
|
||||
c->RemoveMode(NULL, CMODE_OWNER, user->nick);
|
||||
|
||||
+6
-1
@@ -233,11 +233,16 @@ bool ValidateBotServ(ServerConfig *, const Anope::string &tag, const Anope::stri
|
||||
if (data.GetValue().empty())
|
||||
throw ConfigException("The value for <" + tag + ":" + value + "> cannot be empty when BotServ is enabled!");
|
||||
}
|
||||
else if (value.equals_ci("minusers") || value.equals_ci("badwordsmax") || value.equals_ci("keepdata"))
|
||||
else if (value.equals_ci("badwordsmax") || value.equals_ci("keepdata"))
|
||||
{
|
||||
if (!data.GetInteger() && !dotime(data.GetValue()))
|
||||
throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when BotServ is enabled!");
|
||||
}
|
||||
else if (value.equals_ci("minusers"))
|
||||
{
|
||||
if (data.GetInteger() < 0)
|
||||
throw ConfigException("The value for <" + tag + ":" + value + "> must be greater than or equal to zero!");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ ChannelInfo::~ChannelInfo()
|
||||
|
||||
if (this->c)
|
||||
{
|
||||
if (this->bi && this->c->users.size() >= Config.BSMinUsers)
|
||||
if (this->bi && this->c->FindUser(this->bi))
|
||||
this->bi->Part(this->c);
|
||||
this->c->ci = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user