summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-05-06 18:02:53 -0400
committerAdam <Adam@anope.org>2011-05-16 04:10:18 -0400
commitfd4b52ec385167794eaadb18ee635bef757728ee (patch)
tree49d3e835b072a10887309d8d9155982a5aa61ed0 /src
parentb59602abf85d522bb2f188be70b6cb7c9556a856 (diff)
Added os_forbid
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp12
-rw-r--r--src/chanserv.cpp11
-rw-r--r--src/config.cpp1
-rw-r--r--src/protocol.cpp4
-rw-r--r--src/regchannel.cpp8
-rw-r--r--src/servers.cpp2
-rw-r--r--src/users.cpp14
7 files changed, 28 insertions, 24 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 1c852aae2..66066ce37 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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)))
diff --git a/src/chanserv.cpp b/src/chanserv.cpp
index f850b5f6a..393ad935d 100644
--- a/src/chanserv.cpp
+++ b/src/chanserv.cpp
@@ -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);
diff --git a/src/config.cpp b/src/config.cpp
index 288e33685..671cf3ed7 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -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},
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 4724559fb..dc1c5960d 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -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;
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 4d8dc8198..5a94027ae 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -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);
diff --git a/src/servers.cpp b/src/servers.cpp
index a1935c109..763fed707 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -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;
diff --git a/src/users.cpp b/src/users.cpp
index 0e986cc93..1b06461ed 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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;