summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp12
-rw-r--r--src/config.cpp7
-rw-r--r--src/regchannel.cpp2
3 files changed, 14 insertions, 7 deletions
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;
}