summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example.conf4
-rw-r--r--modules/core/ns_set_autoop.cpp2
-rw-r--r--src/channels.cpp12
-rw-r--r--src/config.cpp7
-rw-r--r--src/regchannel.cpp2
5 files changed, 17 insertions, 10 deletions
diff --git a/data/example.conf b/data/example.conf
index cb60c3d16..ea45c70e0 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -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
diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp
index 408110239..1e6e0d812 100644
--- a/modules/core/ns_set_autoop.cpp
+++ b/modules/core/ns_set_autoop.cpp
@@ -16,7 +16,7 @@
class CommandNSSetAutoOp : public Command
{
public:
- CommandNSSetAutoOp() : Command("AUTOOP", 2)
+ CommandNSSetAutoOp() : Command("AUTOOP", 1)
{
}
diff --git a/src/channels.cpp b/src/channels.cpp
index caab1dcbc..782010c32 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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);
diff --git a/src/config.cpp b/src/config.cpp
index 725138516..7853196ad 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -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;
}
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 177e39e78..f08fa1cc4 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -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;
}