mirror of
https://github.com/anope/anope.git
synced 2026-07-06 16:53:12 +02:00
Added os_forbid
This commit is contained in:
+6
-6
@@ -14,8 +14,6 @@
|
||||
|
||||
channel_map ChannelList;
|
||||
|
||||
static const Anope::string ChannelFlagString[] = { "CH_PERSIST", "CH_SYNCING", "CH_LOGCHAN", "" };
|
||||
|
||||
/** Default constructor
|
||||
* @param name The channel name
|
||||
* @param ts The time the channel was created
|
||||
@@ -191,7 +189,7 @@ void Channel::DeleteUser(User *user)
|
||||
return;
|
||||
|
||||
/* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */
|
||||
if (this->ci && this->ci->HasFlag(CI_INHABIT))
|
||||
if (this->HasFlag(CH_INHABIT))
|
||||
return;
|
||||
|
||||
/* check for BSMinUsers and part the BotServ bot from the channel
|
||||
@@ -791,6 +789,8 @@ void Channel::KickInternal(const Anope::string &source, const Anope::string &nic
|
||||
if (target->FindChannel(this))
|
||||
{
|
||||
FOREACH_MOD(I_OnUserKicked, OnUserKicked(this, target, source, reason));
|
||||
if (bi)
|
||||
this->SetFlag(CH_INHABIT);
|
||||
this->DeleteUser(target);
|
||||
}
|
||||
else
|
||||
@@ -798,7 +798,10 @@ void Channel::KickInternal(const Anope::string &source, const Anope::string &nic
|
||||
|
||||
/* Bots get rejoined */
|
||||
if (bi)
|
||||
{
|
||||
bi->Join(this, &Config->BotModeList);
|
||||
this->UnsetFlag(CH_INHABIT);
|
||||
}
|
||||
}
|
||||
|
||||
/** Kick a user from the channel
|
||||
@@ -1110,9 +1113,6 @@ void chan_set_correct_modes(User *user, Channel *c, int give_modes)
|
||||
if (!c || !(ci = c->ci))
|
||||
return;
|
||||
|
||||
if (ci->HasFlag(CI_FORBIDDEN) || c->name[0] == '+')
|
||||
return;
|
||||
|
||||
Log(LOG_DEBUG) << "Setting correct user modes for " << user->nick << " on " << c->name << " (" << (give_modes ? "" : "not ") << "giving modes)";
|
||||
|
||||
if (give_modes && (!user->Account() || user->Account()->HasFlag(NI_AUTOOP)))
|
||||
|
||||
+5
-6
@@ -367,10 +367,9 @@ Anope::string get_xop_level(int level)
|
||||
|
||||
ChanServTimer::ChanServTimer(Channel *chan) : Timer(Config->CSInhabit), c(chan)
|
||||
{
|
||||
if (!chanserv)
|
||||
if (!chanserv || !c)
|
||||
return;
|
||||
if (c->ci)
|
||||
c->ci->SetFlag(CI_INHABIT);
|
||||
c->SetFlag(CH_INHABIT);
|
||||
if (!c->ci || !c->ci->bi)
|
||||
chanserv->Bot()->Join(c);
|
||||
else if (!c->FindUser(c->ci->bi))
|
||||
@@ -379,12 +378,12 @@ ChanServTimer::ChanServTimer(Channel *chan) : Timer(Config->CSInhabit), c(chan)
|
||||
|
||||
void ChanServTimer::Tick(time_t)
|
||||
{
|
||||
if (!c || !c->ci)
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
c->ci->UnsetFlag(CI_INHABIT);
|
||||
c->UnsetFlag(CH_INHABIT);
|
||||
|
||||
if (!c->ci->bi)
|
||||
if (!c->ci || !c->ci->bi)
|
||||
{
|
||||
if (chanserv)
|
||||
chanserv->Bot()->Part(c);
|
||||
|
||||
@@ -1049,7 +1049,6 @@ ConfigItems::ConfigItems(ServerConfig *conf)
|
||||
{"nickserv", "resenddelay", "0", new ValueContainerTime(&conf->NSResendDelay), DT_TIME, NoValidation},
|
||||
{"nickserv", "expire", "21d", new ValueContainerTime(&conf->NSExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "suspendexpire", "0", new ValueContainerTime(&conf->NSSuspendExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "forbidexpire", "0", new ValueContainerTime(&conf->NSForbidExpire), DT_TIME, NoValidation},
|
||||
{"nickserv", "unconfirmedexpire", "0", new ValueContainerTime(&conf->NSUnconfirmedExpire), DT_TIME, ValidateEmailReg},
|
||||
{"nickserv", "maxaliases", "0", new ValueContainerUInt(&conf->NSMaxAliases), DT_UINTEGER, NoValidation},
|
||||
{"nickserv", "accessmax", "0", new ValueContainerUInt(&conf->NSAccessMax), DT_UINTEGER, ValidateNotZero},
|
||||
|
||||
+2
-2
@@ -386,7 +386,7 @@ bool IRCdMessage::OnPrivmsg(const Anope::string &source, const std::vector<Anope
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(receiver);
|
||||
/* Some paranoia checks */
|
||||
if (ci && !ci->HasFlag(CI_FORBIDDEN) && ci->c)
|
||||
if (ci && ci->c)
|
||||
{
|
||||
FOREACH_MOD(I_OnPrivmsg, OnPrivmsg(u, ci, message));
|
||||
}
|
||||
@@ -459,7 +459,7 @@ bool IRCdMessage::OnQuit(const Anope::string &source, const std::vector<Anope::s
|
||||
Log(user, "quit") << "quit (Reason: " << (!reason.empty() ? reason : "no reason") << ")";
|
||||
|
||||
NickAlias *na = findnick(user->nick);
|
||||
if (na && !na->HasFlag(NS_FORBIDDEN) && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified(true)))
|
||||
if (na && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified(true)))
|
||||
{
|
||||
na->last_seen = Anope::CurTime;
|
||||
na->last_quit = reason;
|
||||
|
||||
+4
-4
@@ -789,10 +789,10 @@ bool ChannelInfo::CheckKick(User *user)
|
||||
do_kick = true;
|
||||
|
||||
Anope::string mask, reason;
|
||||
if (!user->HasMode(UMODE_OPER) && (this->HasFlag(CI_SUSPENDED) || this->HasFlag(CI_FORBIDDEN)))
|
||||
if (!user->HasMode(UMODE_OPER) && this->HasFlag(CI_SUSPENDED))
|
||||
{
|
||||
get_idealban(this, user, mask);
|
||||
reason = this->forbidreason.empty() ? GetString(user->Account(), _("This channel may not be used.")) : this->forbidreason;
|
||||
reason = GetString(user->Account(), _("This channel may not be used."));
|
||||
set_modes = true;
|
||||
do_kick = true;
|
||||
}
|
||||
@@ -850,9 +850,9 @@ bool ChannelInfo::CheckKick(User *user)
|
||||
* ChanServ always enforces channels like this to keep people from deleting bots etc
|
||||
* that are holding channels.
|
||||
*/
|
||||
if (this->c->users.size() == (this->bi && this->c->FindUser(this->bi) ? 2 : 1) && !this->HasFlag(CI_INHABIT) && !this->c->HasFlag(CH_SYNCING))
|
||||
if (this->c->users.size() == (this->bi && this->c->FindUser(this->bi) ? 2 : 1) && !this->c->HasFlag(CH_INHABIT) && !this->c->HasFlag(CH_SYNCING))
|
||||
{
|
||||
/* If channel was forbidden, etc, set it +si to prevent rejoin */
|
||||
/* Set +si to prevent rejoin */
|
||||
if (set_modes)
|
||||
{
|
||||
c->SetMode(NULL, CMODE_NOEXTERNAL);
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ Server::~Server()
|
||||
if (u->server == this)
|
||||
{
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (na && !na->HasFlag(NS_FORBIDDEN) && (!na->nc->HasFlag(NI_SUSPENDED)) && (u->IsRecognized() || u->IsIdentified()))
|
||||
if (na && !na->nc->HasFlag(NI_SUSPENDED) && (u->IsRecognized() || u->IsIdentified()))
|
||||
{
|
||||
na->last_seen = Anope::CurTime;
|
||||
na->last_quit = this->QReason;
|
||||
|
||||
+10
-4
@@ -315,13 +315,19 @@ void User::Collide(NickAlias *na)
|
||||
{
|
||||
Anope::string guestnick;
|
||||
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
guestnick = Config->NSGuestNickPrefix + stringify(getrandom16());
|
||||
} while (finduser(guestnick));
|
||||
} while (finduser(guestnick) && i++ < 10);
|
||||
|
||||
this->SendMessage(nickserv->Bot(), _("Your nickname is now being changed to \002%s\002"), guestnick.c_str());
|
||||
ircdproto->SendForceNickChange(this, guestnick, Anope::CurTime);
|
||||
if (i == 11)
|
||||
this->Kill(Config->s_NickServ, "Services nickname-enforcer kill");
|
||||
else
|
||||
{
|
||||
this->SendMessage(nickserv->Bot(), _("Your nickname is now being changed to \002%s\002"), guestnick.c_str());
|
||||
ircdproto->SendForceNickChange(this, guestnick, Anope::CurTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
this->Kill(Config->s_NickServ, "Services nickname-enforcer kill");
|
||||
@@ -883,7 +889,7 @@ void do_kill(User *user, const Anope::string &msg)
|
||||
Log(user, "killed") << "was killed (Reason: " << msg << ")";
|
||||
|
||||
NickAlias *na = findnick(user->nick);
|
||||
if (na && !na->HasFlag(NS_FORBIDDEN) && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified(true)))
|
||||
if (na && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified(true)))
|
||||
{
|
||||
na->last_seen = Anope::CurTime;
|
||||
na->last_quit = msg;
|
||||
|
||||
Reference in New Issue
Block a user