summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/bs_assign.cpp8
-rw-r--r--modules/commands/bs_badwords.cpp12
-rw-r--r--modules/commands/bs_control.cpp4
-rw-r--r--modules/commands/bs_info.cpp2
-rw-r--r--modules/commands/bs_kick.cpp8
-rw-r--r--modules/commands/bs_set.cpp4
-rw-r--r--modules/commands/cs_access.cpp22
-rw-r--r--modules/commands/cs_akick.cpp18
-rw-r--r--modules/commands/cs_appendtopic.cpp4
-rw-r--r--modules/commands/cs_ban.cpp4
-rw-r--r--modules/commands/cs_clearusers.cpp2
-rw-r--r--modules/commands/cs_clone.cpp2
-rw-r--r--modules/commands/cs_drop.cpp4
-rw-r--r--modules/commands/cs_enforce.cpp2
-rw-r--r--modules/commands/cs_flags.cpp4
-rw-r--r--modules/commands/cs_getkey.cpp4
-rw-r--r--modules/commands/cs_info.cpp2
-rw-r--r--modules/commands/cs_invite.cpp2
-rw-r--r--modules/commands/cs_kick.cpp4
-rw-r--r--modules/commands/cs_mode.cpp12
-rw-r--r--modules/commands/cs_modes.cpp2
-rw-r--r--modules/commands/cs_saset_noexpire.cpp2
-rw-r--r--modules/commands/cs_set_bantype.cpp2
-rw-r--r--modules/commands/cs_set_description.cpp2
-rw-r--r--modules/commands/cs_set_founder.cpp4
-rw-r--r--modules/commands/cs_set_keeptopic.cpp2
-rw-r--r--modules/commands/cs_set_opnotice.cpp2
-rw-r--r--modules/commands/cs_set_peace.cpp2
-rw-r--r--modules/commands/cs_set_persist.cpp2
-rw-r--r--modules/commands/cs_set_private.cpp2
-rw-r--r--modules/commands/cs_set_restricted.cpp2
-rw-r--r--modules/commands/cs_set_secure.cpp2
-rw-r--r--modules/commands/cs_set_securefounder.cpp2
-rw-r--r--modules/commands/cs_set_secureops.cpp2
-rw-r--r--modules/commands/cs_set_signkick.cpp2
-rw-r--r--modules/commands/cs_set_successor.cpp4
-rw-r--r--modules/commands/cs_set_topiclock.cpp2
-rw-r--r--modules/commands/cs_tban.cpp2
-rw-r--r--modules/commands/cs_topic.cpp4
-rw-r--r--modules/commands/cs_unban.cpp2
-rw-r--r--modules/commands/cs_xop.cpp10
-rw-r--r--modules/commands/ms_del.cpp2
-rw-r--r--modules/commands/ms_ignore.cpp3
-rw-r--r--modules/commands/ms_info.cpp2
-rw-r--r--modules/commands/ms_list.cpp2
-rw-r--r--modules/commands/ms_read.cpp2
-rw-r--r--modules/commands/ms_set.cpp2
-rw-r--r--modules/commands/ns_ajoin.cpp4
48 files changed, 100 insertions, 97 deletions
diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp
index 803368994..5f0cdc21f 100644
--- a/modules/commands/bs_assign.cpp
+++ b/modules/commands/bs_assign.cpp
@@ -49,7 +49,7 @@ class CommandBSAssign : public Command
return;
}
- if (ci->botflags.HasFlag(BS_NOBOT) || (!ci->HasPriv(u, CA_ASSIGN) && !u->HasPriv("botserv/administration")))
+ if (ci->botflags.HasFlag(BS_NOBOT) || (!ci->AccessFor(u).HasPriv(CA_ASSIGN) && !u->HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
return;
@@ -67,7 +67,7 @@ class CommandBSAssign : public Command
return;
}
- bool override = !ci->HasPriv(u, CA_ASSIGN);
+ bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick;
bi->Assign(u, ci);
@@ -111,7 +111,7 @@ class CommandBSUnassign : public Command
return;
}
- if (!u->HasPriv("botserv/administration") && !ci->HasPriv(u, CA_ASSIGN))
+ if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv(CA_ASSIGN))
{
source.Reply(ACCESS_DENIED);
return;
@@ -129,7 +129,7 @@ class CommandBSUnassign : public Command
return;
}
- bool override = !ci->HasPriv(u, CA_ASSIGN);
+ bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << ci->bi->nick;
ci->bi->UnAssign(u, ci);
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index a27dca2d4..c2ca13723 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -60,7 +60,7 @@ class BadwordsDelCallback : public NumberList
public:
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0), override(false)
{
- if (!ci->HasPriv(source.u, CA_BADWORDS) && source.u->HasPriv("botserv/administration"))
+ if (!ci->AccessFor(source.u).HasPriv(CA_BADWORDS) && source.u->HasPriv("botserv/administration"))
this->override = true;
}
@@ -90,7 +90,7 @@ class CommandBSBadwords : public Command
private:
void DoList(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
{
- bool override = !ci->HasPriv(source.u, CA_BADWORDS);
+ bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "LIST";
if (!ci->GetBadWordCount())
@@ -167,7 +167,7 @@ class CommandBSBadwords : public Command
}
}
- bool override = !ci->HasPriv(source.u, CA_BADWORDS);
+ bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "ADD " << realword;
ci->AddBadWord(realword, type);
@@ -203,7 +203,7 @@ class CommandBSBadwords : public Command
return;
}
- bool override = !ci->HasPriv(source.u, CA_BADWORDS);
+ bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "DEL " << badword->word;
source.Reply(_("\002%s\002 deleted from %s bad words list."), badword->word.c_str(), ci->name.c_str());
@@ -216,7 +216,7 @@ class CommandBSBadwords : public Command
void DoClear(CommandSource &source, ChannelInfo *ci)
{
- bool override = !ci->HasPriv(source.u, CA_BADWORDS);
+ bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "CLEAR";
ci->ClearBadWords();
@@ -254,7 +254,7 @@ class CommandBSBadwords : public Command
}
- if (!ci->HasPriv(u, CA_BADWORDS) && (!need_args || !u->HasPriv("botserv/administration")))
+ if (!ci->AccessFor(u).HasPriv(CA_BADWORDS) && (!need_args || !u->HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp
index 16a5b372a..a798c6171 100644
--- a/modules/commands/bs_control.cpp
+++ b/modules/commands/bs_control.cpp
@@ -35,7 +35,7 @@ class CommandBSSay : public Command
return;
}
- if (!ci->HasPriv(u, CA_SAY))
+ if (!ci->AccessFor(u).HasPriv(CA_SAY))
{
source.Reply(ACCESS_DENIED);
return;
@@ -98,7 +98,7 @@ class CommandBSAct : public Command
return;
}
- if (!ci->HasPriv(u, CA_SAY))
+ if (!ci->AccessFor(u).HasPriv(CA_SAY))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp
index b48a0b296..3f1b107f2 100644
--- a/modules/commands/bs_info.cpp
+++ b/modules/commands/bs_info.cpp
@@ -70,7 +70,7 @@ class CommandBSInfo : public Command
}
else if ((ci = cs_findchan(query)))
{
- if (!ci->HasPriv(u, CA_FOUNDER) && !u->HasPriv("botserv/administration"))
+ if (!ci->AccessFor(u).HasPriv(CA_FOUNDER) && !u->HasPriv("botserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp
index 3f433f773..ac0420dce 100644
--- a/modules/commands/bs_kick.cpp
+++ b/modules/commands/bs_kick.cpp
@@ -41,13 +41,13 @@ class CommandBSKick : public Command
this->OnSyntaxError(source, "");
else if (!value.equals_ci("ON") && !value.equals_ci("OFF"))
this->OnSyntaxError(source, "");
- else if (!ci->HasPriv(u, CA_SET) && !u->HasPriv("botserv/administration"))
+ else if (!ci->AccessFor(u).HasPriv(CA_SET) && !u->HasPriv("botserv/administration"))
source.Reply(ACCESS_DENIED);
else if (!ci->bi)
source.Reply(BOT_NOT_ASSIGNED);
else
{
- bool override = !ci->HasPriv(u, CA_SET);
+ bool override = !ci->AccessFor(u).HasPriv(CA_SET);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << option << " " << value;
if (option.equals_ci("BADWORDS"))
@@ -768,7 +768,7 @@ class BSKick : public Module
return;
bool Allow = true;
- if (ci->HasPriv(u, CA_NOKICK))
+ if (ci->AccessFor(u).HasPriv(CA_NOKICK))
Allow = false;
else if (ci->botflags.HasFlag(BS_DONTKICKOPS) && (c->HasUserStatus(u, CMODE_HALFOP) || c->HasUserStatus(u, CMODE_OP) || c->HasUserStatus(u, CMODE_PROTECT) || c->HasUserStatus(u, CMODE_OWNER)))
Allow = false;
@@ -993,7 +993,7 @@ class BSKick : public Module
Channel *chan = (*it)->chan;
++it;
- if (chan->ci != NULL && chan->ci->botflags.HasFlag(BS_KICK_AMSGS) && !chan->ci->HasPriv(u, CA_NOKICK))
+ if (chan->ci != NULL && chan->ci->botflags.HasFlag(BS_KICK_AMSGS) && !chan->ci->AccessFor(u).HasPriv(CA_NOKICK))
{
check_ban(chan->ci, u, TTB_AMSGS);
bot_kick(chan->ci, u, _("Don't use AMSGs!"));
diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp
index 2591ca5a5..97bdf9525 100644
--- a/modules/commands/bs_set.cpp
+++ b/modules/commands/bs_set.cpp
@@ -59,11 +59,11 @@ class CommandBSSet : public Command
}
else if (!(ci = cs_findchan(chan)))
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
- else if (!u->HasPriv("botserv/administration") && !ci->HasPriv(u, CA_SET))
+ else if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv(CA_SET))
source.Reply(ACCESS_DENIED);
else
{
- bool override = !ci->HasPriv(u, CA_SET);
+ bool override = !ci->AccessFor(u).HasPriv(CA_SET);
Log(override ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << option << " " << value;
if (option.equals_ci("DONTKICKOPS"))
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index fa23658c8..7c444b52c 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -121,6 +121,8 @@ class AccessChanAccess : public ChanAccess
for (int i = 0; defaultLevels[i].priv != CA_SIZE; ++i)
if (access->ci->levels[defaultLevels[i].priv] > highest && access->HasPriv(defaultLevels[i].priv))
highest = access->ci->levels[defaultLevels[i].priv];
+ if (highest >= ACCESS_FOUNDER)
+ highest = ACCESS_FOUNDER - 1;
return highest;
}
}
@@ -230,7 +232,7 @@ class AccessDelCallback : public NumberList
public:
AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), Deleted(0), Denied(false)
{
- if (!ci->HasPriv(source.u, CA_ACCESS_CHANGE) && source.u->HasPriv("chanserv/access/modify"))
+ if (!ci->AccessFor(source.u).HasPriv(CA_ACCESS_CHANGE) && source.u->HasPriv("chanserv/access/modify"))
this->override = true;
}
@@ -305,7 +307,7 @@ class CommandCSAccess : public Command
AccessGroup u_access = ci->AccessFor(u);
ChanAccess *highest = u_access.Highest();
int u_level = (highest ? AccessChanAccess::DetermineLevel(highest) : 0);
- if (!ci->HasPriv(u, CA_FOUNDER) && level >= u_level && !u->HasPriv("chanserv/access/modify"))
+ if (level >= u_level && !u_access.Founder)
{
source.Reply(ACCESS_DENIED);
return;
@@ -316,7 +318,7 @@ class CommandCSAccess : public Command
return;
}
- bool override = !ci->HasPriv(u, CA_ACCESS_CHANGE) || level >= u_level;
+ bool override = !ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE) || level >= u_level;
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
@@ -393,7 +395,7 @@ class CommandCSAccess : public Command
else
{
source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str());
- bool override = !ci->HasPriv(u, CA_ACCESS_CHANGE) && !access->mask.equals_ci(u->Account()->display);
+ bool override = !ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE) && !access->mask.equals_ci(u->Account()->display);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DEL " << access->mask;
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, access));
@@ -542,9 +544,9 @@ class CommandCSAccess : public Command
bool has_access = false;
if (u->HasPriv("chanserv/access/modify"))
has_access = true;
- else if (is_list && ci->HasPriv(u, CA_ACCESS_LIST))
+ else if (is_list && ci->AccessFor(u).HasPriv(CA_ACCESS_LIST))
has_access = true;
- else if (ci->HasPriv(u, CA_ACCESS_CHANGE))
+ else if (ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE))
has_access = true;
else if (is_del)
{
@@ -683,7 +685,7 @@ class CommandCSLevels : public Command
ci->levels[l.priv] = level;
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, i, level));
- bool override = !ci->HasPriv(u, CA_FOUNDER);
+ bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "SET " << l.name << " to " << level;
if (level == ACCESS_FOUNDER)
@@ -717,7 +719,7 @@ class CommandCSLevels : public Command
ci->levels[l.priv] = ACCESS_INVALID;
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, i, l.priv));
- bool override = !ci->HasPriv(u, CA_FOUNDER);
+ bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DISABLE " << l.name;
source.Reply(_("\002%s\002 disabled on channel %s."), l.name.c_str(), ci->name.c_str());
@@ -767,7 +769,7 @@ class CommandCSLevels : public Command
reset_levels(ci);
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, -1, 0));
- bool override = !ci->HasPriv(u, CA_FOUNDER);
+ bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "RESET";
source.Reply(_("Access levels for \002%s\002 reset to defaults."), ci->name.c_str());
@@ -804,7 +806,7 @@ class CommandCSLevels : public Command
*/
if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty()))
this->OnSyntaxError(source, cmd);
- else if (!ci->HasPriv(u, CA_FOUNDER) && !u->HasPriv("chanserv/access/modify"))
+ else if (!ci->AccessFor(u).HasPriv(CA_FOUNDER) && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else if (cmd.equals_ci("SET"))
this->DoSet(source, ci, params);
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 437bf5572..11b4da62c 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -134,7 +134,7 @@ class AkickDelCallback : public NumberList
~AkickDelCallback()
{
User *u = source.u;
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, c, ci) << "DEL on " << Deleted << " users";
if (!Deleted)
@@ -213,7 +213,7 @@ class CommandCSAKick : public Command
AccessGroup nc_access = ci->AccessFor(nc), u_access = ci->AccessFor(u);
Entry entry_mask(CMODE_BEGIN, mask);
- if ((ci->HasPriv(u2, CA_FOUNDER) || nc_access >= u_access) && entry_mask.Matches(u2))
+ if ((ci->AccessFor(u2).HasPriv(CA_FOUNDER) || nc_access >= u_access) && entry_mask.Matches(u2))
{
source.Reply(ACCESS_DENIED);
return;
@@ -260,7 +260,7 @@ class CommandCSAKick : public Command
else
akick = ci->AddAkick(u->nick, mask, reason);
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask << ": " << reason;
FOREACH_MOD(I_OnAkickAdd, OnAkickAdd(u, ci, akick));
@@ -309,7 +309,7 @@ class CommandCSAKick : public Command
return;
}
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DEL " << mask;
ci->EraseAkick(i);
@@ -324,7 +324,7 @@ class CommandCSAKick : public Command
const Anope::string &mask = params.size() > 2 ? params[2] : "";
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "LIST";
if (!ci->GetAkickCount())
@@ -374,7 +374,7 @@ class CommandCSAKick : public Command
const Anope::string &mask = params.size() > 2 ? params[2] : "";
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "VIEW";
if (!ci->GetAkickCount())
@@ -438,7 +438,7 @@ class CommandCSAKick : public Command
++count;
}
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ENFORCE, affects " << count << " users";
source.Reply(_("AKICK ENFORCE for \002%s\002 complete; \002%d\002 users were affected."), ci->name.c_str(), count);
@@ -447,7 +447,7 @@ class CommandCSAKick : public Command
void DoClear(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
- bool override = !ci->HasPriv(u, CA_AKICK);
+ bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
ci->ClearAkick();
@@ -483,7 +483,7 @@ class CommandCSAKick : public Command
if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL")))
this->OnSyntaxError(source, cmd);
- else if (!ci->HasPriv(u, CA_AKICK) && !u->HasPriv("chanserv/access/modify"))
+ else if (!ci->AccessFor(u).HasPriv(CA_AKICK) && !u->HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && readonly)
source.Reply(_("Sorry, channel autokick list modification is temporarily disabled."));
diff --git a/modules/commands/cs_appendtopic.cpp b/modules/commands/cs_appendtopic.cpp
index 6d66d1724..63fb0a785 100644
--- a/modules/commands/cs_appendtopic.cpp
+++ b/modules/commands/cs_appendtopic.cpp
@@ -58,7 +58,7 @@ class CommandCSAppendTopic : public Command
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
else if (!c->ci)
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
- else if (!c->ci->HasPriv(u, CA_TOPIC))
+ else if (!c->ci->AccessFor(u).HasPriv(CA_TOPIC))
source.Reply(ACCESS_DENIED);
else
{
@@ -77,7 +77,7 @@ class CommandCSAppendTopic : public Command
if (has_topiclock)
c->ci->SetFlag(CI_TOPICLOCK);
- bool override = c->ci->HasPriv(u, CA_TOPIC);
+ bool override = c->ci->AccessFor(u).HasPriv(CA_TOPIC);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, c->ci) << "changed topic to " << topic;
}
return;
diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp
index 759649662..de506e3fe 100644
--- a/modules/commands/cs_ban.cpp
+++ b/modules/commands/cs_ban.cpp
@@ -46,7 +46,7 @@ class CommandCSBan : public Command
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
else if (!u2)
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
- else if (!ci->HasPriv(u, CA_BAN))
+ else if (!ci->AccessFor(u).HasPriv(CA_BAN))
source.Reply(ACCESS_DENIED);
else if (!is_same && ci->HasFlag(CI_PEACE) && u2_access >= u_access)
source.Reply(ACCESS_DENIED);
@@ -72,7 +72,7 @@ class CommandCSBan : public Command
if (!c->FindUser(u2))
return;
- if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->HasPriv(u, CA_SIGNKICK)))
+ if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->AccessFor(u).HasPriv(CA_SIGNKICK)))
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), u->nick.c_str());
else
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
diff --git a/modules/commands/cs_clearusers.cpp b/modules/commands/cs_clearusers.cpp
index 18dc75479..91dc68cc2 100644
--- a/modules/commands/cs_clearusers.cpp
+++ b/modules/commands/cs_clearusers.cpp
@@ -34,7 +34,7 @@ class CommandCSClearUsers : public Command
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
else if (!c->ci)
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
- else if (!c->ci->HasPriv(u, CA_FOUNDER))
+ else if (!c->ci->AccessFor(u).HasPriv(CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp
index f9cbe12d6..7e4579af0 100644
--- a/modules/commands/cs_clone.cpp
+++ b/modules/commands/cs_clone.cpp
@@ -36,7 +36,7 @@ public:
return;
}
- if (!ci->HasPriv(u, CA_SET))
+ if (!ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp
index eb01875db..aa41046a9 100644
--- a/modules/commands/cs_drop.cpp
+++ b/modules/commands/cs_drop.cpp
@@ -49,7 +49,7 @@ class CommandCSDrop : public Command
return;
}
- if ((ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER)) && !u->HasCommand("chanserv/chanserv/drop"))
+ if ((ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER)) && !u->HasCommand("chanserv/chanserv/drop"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -58,7 +58,7 @@ class CommandCSDrop : public Command
if (ci->c && ModeManager::FindChannelModeByName(CMODE_REGISTERED))
ci->c->RemoveMode(NULL, CMODE_REGISTERED, "", false);
- bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER));
+ bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "none");
delete ci;
diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp
index 395926a46..267a0a850 100644
--- a/modules/commands/cs_enforce.cpp
+++ b/modules/commands/cs_enforce.cpp
@@ -129,7 +129,7 @@ class CommandCSEnforce : public Command
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
else if (!c->ci)
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
- else if (!c->ci->HasPriv(u, CA_AKICK))
+ else if (!c->ci->AccessFor(u).HasPriv(CA_AKICK))
source.Reply(ACCESS_DENIED);
else
{
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 48f1a22f1..07a441141 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -361,9 +361,9 @@ class CommandCSFlags : public Command
bool has_access = false;
if (u->HasPriv("chanserv/access/modify"))
has_access = true;
- else if (is_list && ci->HasPriv(u, CA_ACCESS_LIST))
+ else if (is_list && ci->AccessFor(u).HasPriv(CA_ACCESS_LIST))
has_access = true;
- else if (ci->HasPriv(u, CA_ACCESS_CHANGE))
+ else if (ci->AccessFor(u).HasPriv(CA_ACCESS_CHANGE))
has_access = true;
if (!has_access)
diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp
index 4a6d62442..48d5cd2eb 100644
--- a/modules/commands/cs_getkey.cpp
+++ b/modules/commands/cs_getkey.cpp
@@ -35,7 +35,7 @@ class CommandCSGetKey : public Command
}
- if (!ci->HasPriv(u, CA_GETKEY) && !u->HasCommand("chanserv/chanserv/getkey"))
+ if (!ci->AccessFor(u).HasPriv(CA_GETKEY) && !u->HasCommand("chanserv/chanserv/getkey"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -48,7 +48,7 @@ class CommandCSGetKey : public Command
return;
}
- bool override = !ci->HasPriv(u, CA_GETKEY);
+ bool override = !ci->AccessFor(u).HasPriv(CA_GETKEY);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci);
source.Reply(_("Key for channel \002%s\002 is \002%s\002."), chan.c_str(), key.c_str());
diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp
index ef026563e..9f4a29852 100644
--- a/modules/commands/cs_info.cpp
+++ b/modules/commands/cs_info.cpp
@@ -50,7 +50,7 @@ class CommandCSInfo : public Command
bool show_all = false;
/* Should we show all fields? Only for sadmins and identified users */
- if (has_auspex || ci->HasPriv(u, CA_INFO))
+ if (has_auspex || ci->AccessFor(u).HasPriv(CA_INFO))
show_all = true;
source.Reply(CHAN_INFO_HEADER, chan.c_str());
diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp
index 27b4b03a3..9773ba332 100644
--- a/modules/commands/cs_invite.cpp
+++ b/modules/commands/cs_invite.cpp
@@ -42,7 +42,7 @@ class CommandCSInvite : public Command
return;
}
- if (!ci->HasPriv(u, CA_INVITE))
+ if (!ci->AccessFor(u).HasPriv(CA_INVITE))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp
index b98d0953d..312bb0859 100644
--- a/modules/commands/cs_kick.cpp
+++ b/modules/commands/cs_kick.cpp
@@ -42,7 +42,7 @@ class CommandCSKick : public Command
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
else if (!u2)
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
- else if (!ci->HasPriv(u, CA_KICK))
+ else if (!ci->AccessFor(u).HasPriv(CA_KICK))
source.Reply(ACCESS_DENIED);
else if (!is_same && (ci->HasFlag(CI_PEACE)) && u2_access >= u_access)
source.Reply(ACCESS_DENIED);
@@ -55,7 +55,7 @@ class CommandCSKick : public Command
// XXX
Log(LOG_COMMAND, u, this, ci) << "for " << u2->nick;
- if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->HasPriv(u, CA_SIGNKICK)))
+ if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->AccessFor(u).HasPriv(CA_SIGNKICK)))
ci->c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), u->nick.c_str());
else
ci->c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp
index e67abd85a..ce0976384 100644
--- a/modules/commands/cs_mode.cpp
+++ b/modules/commands/cs_mode.cpp
@@ -20,15 +20,15 @@ class CommandCSMode : public Command
switch (mode)
{
case CMODE_OWNER:
- return ci->HasPriv(u, CA_OWNER);
+ return ci->AccessFor(u).HasPriv(CA_OWNER);
case CMODE_PROTECT:
- return ci->HasPriv(u, CA_PROTECT);
+ return ci->AccessFor(u).HasPriv(CA_PROTECT);
case CMODE_OP:
- return ci->HasPriv(u, CA_OPDEOP);
+ return ci->AccessFor(u).HasPriv(CA_OPDEOP);
case CMODE_HALFOP:
- return ci->HasPriv(u, CA_HALFOP);
+ return ci->AccessFor(u).HasPriv(CA_HALFOP);
case CMODE_VOICE:
- return ci->HasPriv(u, CA_VOICE);
+ return ci->AccessFor(u).HasPriv(CA_VOICE);
default:
break;
}
@@ -311,7 +311,7 @@ class CommandCSMode : public Command
if (!ci || !ci->c)
source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str());
- else if (!ci->HasPriv(u, CA_MODE) && !u->HasCommand("chanserv/chanserv/mode"))
+ else if (!ci->AccessFor(u).HasPriv(CA_MODE) && !u->HasCommand("chanserv/chanserv/mode"))
source.Reply(ACCESS_DENIED);
else if (subcommand.equals_ci("LOCK"))
this->DoLock(source, ci, params);
diff --git a/modules/commands/cs_modes.cpp b/modules/commands/cs_modes.cpp
index cee2f9460..1fca13acd 100644
--- a/modules/commands/cs_modes.cpp
+++ b/modules/commands/cs_modes.cpp
@@ -32,7 +32,7 @@ class CommandModeBase : public Command
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
else if (!u2)
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
- else if (is_same ? !ci->HasPriv(u, levelself) : !ci->HasPriv(u, level))
+ else if (is_same ? !ci->AccessFor(u).HasPriv(levelself) : !ci->AccessFor(u).HasPriv(level))
source.Reply(ACCESS_DENIED);
else if (!set && !is_same && ci->HasFlag(CI_PEACE) && u2_access >= u_access)
source.Reply(ACCESS_DENIED);
diff --git a/modules/commands/cs_saset_noexpire.cpp b/modules/commands/cs_saset_noexpire.cpp
index 1e085496f..94335a200 100644
--- a/modules/commands/cs_saset_noexpire.cpp
+++ b/modules/commands/cs_saset_noexpire.cpp
@@ -32,7 +32,7 @@ class CommandCSSASetNoexpire : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_bantype.cpp b/modules/commands/cs_set_bantype.cpp
index 94d2aa151..7d7fea56e 100644
--- a/modules/commands/cs_set_bantype.cpp
+++ b/modules/commands/cs_set_bantype.cpp
@@ -32,7 +32,7 @@ class CommandCSSetBanType : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_description.cpp b/modules/commands/cs_set_description.cpp
index 5c2cd447d..3a1341f1a 100644
--- a/modules/commands/cs_set_description.cpp
+++ b/modules/commands/cs_set_description.cpp
@@ -32,7 +32,7 @@ class CommandCSSetDescription : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_founder.cpp b/modules/commands/cs_set_founder.cpp
index 2169af972..7587b36b8 100644
--- a/modules/commands/cs_set_founder.cpp
+++ b/modules/commands/cs_set_founder.cpp
@@ -32,13 +32,13 @@ class CommandCSSetFounder : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
- if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER)))
+ if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER)))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_keeptopic.cpp b/modules/commands/cs_set_keeptopic.cpp
index 05578a2e5..d0c5e5bd6 100644
--- a/modules/commands/cs_set_keeptopic.cpp
+++ b/modules/commands/cs_set_keeptopic.cpp
@@ -32,7 +32,7 @@ class CommandCSSetKeepTopic : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_opnotice.cpp b/modules/commands/cs_set_opnotice.cpp
index e27f03f8b..ddb5beb58 100644
--- a/modules/commands/cs_set_opnotice.cpp
+++ b/modules/commands/cs_set_opnotice.cpp
@@ -32,7 +32,7 @@ class CommandCSSetOpNotice : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_peace.cpp b/modules/commands/cs_set_peace.cpp
index 3a045fc6d..f64c06c7e 100644
--- a/modules/commands/cs_set_peace.cpp
+++ b/modules/commands/cs_set_peace.cpp
@@ -32,7 +32,7 @@ class CommandCSSetPeace : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_persist.cpp b/modules/commands/cs_set_persist.cpp
index d8c19d24c..8b13ae200 100644
--- a/modules/commands/cs_set_persist.cpp
+++ b/modules/commands/cs_set_persist.cpp
@@ -32,7 +32,7 @@ class CommandCSSetPersist : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_private.cpp b/modules/commands/cs_set_private.cpp
index 108b11569..1e6129a09 100644
--- a/modules/commands/cs_set_private.cpp
+++ b/modules/commands/cs_set_private.cpp
@@ -32,7 +32,7 @@ class CommandCSSetPrivate : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_restricted.cpp b/modules/commands/cs_set_restricted.cpp
index 5d675d2e7..b37ae8de4 100644
--- a/modules/commands/cs_set_restricted.cpp
+++ b/modules/commands/cs_set_restricted.cpp
@@ -31,7 +31,7 @@ class CommandCSSetRestricted : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_secure.cpp b/modules/commands/cs_set_secure.cpp
index 26e8c5768..7b5eb2ce6 100644
--- a/modules/commands/cs_set_secure.cpp
+++ b/modules/commands/cs_set_secure.cpp
@@ -32,7 +32,7 @@ class CommandCSSetSecure : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_securefounder.cpp b/modules/commands/cs_set_securefounder.cpp
index 7afc2e32d..584380244 100644
--- a/modules/commands/cs_set_securefounder.cpp
+++ b/modules/commands/cs_set_securefounder.cpp
@@ -33,7 +33,7 @@ class CommandCSSetSecureFounder : public Command
}
- if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
+ if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_secureops.cpp b/modules/commands/cs_set_secureops.cpp
index 4c3c54b05..d19107607 100644
--- a/modules/commands/cs_set_secureops.cpp
+++ b/modules/commands/cs_set_secureops.cpp
@@ -32,7 +32,7 @@ class CommandCSSetSecureOps : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_signkick.cpp b/modules/commands/cs_set_signkick.cpp
index 0d421576d..1d4508418 100644
--- a/modules/commands/cs_set_signkick.cpp
+++ b/modules/commands/cs_set_signkick.cpp
@@ -32,7 +32,7 @@ class CommandCSSetSignKick : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_successor.cpp b/modules/commands/cs_set_successor.cpp
index f7ed8dba9..eec276226 100644
--- a/modules/commands/cs_set_successor.cpp
+++ b/modules/commands/cs_set_successor.cpp
@@ -32,13 +32,13 @@ class CommandCSSetSuccessor : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
}
- if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))
+ if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv(CA_FOUNDER))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_set_topiclock.cpp b/modules/commands/cs_set_topiclock.cpp
index e670385ba..500e3db76 100644
--- a/modules/commands/cs_set_topiclock.cpp
+++ b/modules/commands/cs_set_topiclock.cpp
@@ -32,7 +32,7 @@ class CommandCSSetTopicLock : public Command
return;
}
- if (source.permission.empty() && !ci->HasPriv(u, CA_SET))
+ if (source.permission.empty() && !ci->AccessFor(u).HasPriv(CA_SET))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_tban.cpp b/modules/commands/cs_tban.cpp
index 5aa15acd8..6bc682efe 100644
--- a/modules/commands/cs_tban.cpp
+++ b/modules/commands/cs_tban.cpp
@@ -40,7 +40,7 @@ static bool CanBanUser(CommandSource &source, Channel *c, User *u2)
User *u = source.u;
ChannelInfo *ci = c->ci;
bool ok = false;
- if (!ci->HasPriv(u, CA_BAN))
+ if (!ci->AccessFor(u).HasPriv(CA_BAN))
source.Reply(ACCESS_DENIED);
else if (matches_list(c, u2, CMODE_EXCEPT))
source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str());
diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp
index 1b5de11c3..8ea19afcf 100644
--- a/modules/commands/cs_topic.cpp
+++ b/modules/commands/cs_topic.cpp
@@ -37,7 +37,7 @@ class CommandCSTopic : public Command
if (!ci->c)
source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str());
- else if (!ci->HasPriv(u, CA_TOPIC) && !u->HasCommand("chanserv/chanserv/topic"))
+ else if (!ci->AccessFor(u).HasPriv(CA_TOPIC) && !u->HasCommand("chanserv/chanserv/topic"))
source.Reply(ACCESS_DENIED);
else
{
@@ -47,7 +47,7 @@ class CommandCSTopic : public Command
if (has_topiclock)
ci->SetFlag(CI_TOPICLOCK);
- bool override = !ci->HasPriv(u, CA_TOPIC);
+ bool override = !ci->AccessFor(u).HasPriv(CA_TOPIC);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to change the topic to " << (!topic.empty() ? topic : "No topic");
}
return;
diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp
index cc3c68e91..b4d09068c 100644
--- a/modules/commands/cs_unban.cpp
+++ b/modules/commands/cs_unban.cpp
@@ -39,7 +39,7 @@ class CommandCSUnban : public Command
return;
}
- if (!ci->HasPriv(u, CA_UNBAN))
+ if (!ci->AccessFor(u).HasPriv(CA_UNBAN))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 0fa51a048..a6107be3c 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -316,7 +316,7 @@ class XOPBase : public Command
ChanAccess *highest = access.Highest();
int u_level = (highest ? XOPChanAccess::DetermineLevel(highest) : 0);
- if (((access.HasPriv(CA_FOUNDER) || level >= u_level) || !access.HasPriv(CA_ACCESS_CHANGE)) && !u->HasPriv("chanserv/access/modify"))
+ if ((!access.HasPriv(CA_FOUNDER) && !access.HasPriv(CA_ACCESS_CHANGE) && !u->HasPriv("chanserv/access/modify")) || (level <= u_level && !access.Founder))
{
source.Reply(ACCESS_DENIED);
return;
@@ -328,7 +328,7 @@ class XOPBase : public Command
if (a->mask.equals_ci(mask))
{
- if (XOPChanAccess::DetermineLevel(a) >= u_level && !u->HasPriv("chanserv/access/modify"))
+ if (XOPChanAccess::DetermineLevel(a) >= u_level && !access.Founder && !u->HasPriv("chanserv/access/modify"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -360,7 +360,7 @@ class XOPBase : public Command
acc->created = Anope::CurTime;
ci->AddAccess(acc);
- bool override = level >= u_level || !access.HasPriv(CA_ACCESS_CHANGE);
+ bool override = (level >= u_level && !access.Founder) || !access.HasPriv(CA_ACCESS_CHANGE);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask;
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, acc));
@@ -512,13 +512,13 @@ class XOPBase : public Command
return;
}
- if (!ci->HasPriv(u, CA_FOUNDER) && !u->HasPriv("chanserv/access/modify"))
+ if (!ci->AccessFor(u).HasPriv(CA_FOUNDER) && !u->HasPriv("chanserv/access/modify"))
{
source.Reply(ACCESS_DENIED);
return;
}
- bool override = !ci->HasPriv(u, CA_FOUNDER);
+ bool override = !ci->AccessFor(u).HasPriv(CA_FOUNDER);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp
index 991adff2b..b67fbc0cc 100644
--- a/modules/commands/ms_del.cpp
+++ b/modules/commands/ms_del.cpp
@@ -70,7 +70,7 @@ class CommandMSDel : public Command
source.Reply(READ_ONLY_MODE);
return;
}
- else if (!ci->HasPriv(u, CA_MEMO))
+ else if (!ci->AccessFor(u).HasPriv(CA_MEMO))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp
index c8b9c19e6..76075b299 100644
--- a/modules/commands/ms_ignore.cpp
+++ b/modules/commands/ms_ignore.cpp
@@ -40,9 +40,10 @@ class CommandMSIgnore : public Command
bool ischan;
MemoInfo *mi = memoserv->GetMemoInfo(channel, ischan);
+ ChannelInfo *ci = cs_findchan(channel);
if (!mi)
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str());
- else if (ischan && !cs_findchan(channel)->HasPriv(u, CA_MEMO))
+ else if (ischan && !ci->AccessFor(u).HasPriv(CA_MEMO))
source.Reply(ACCESS_DENIED);
else if (command.equals_ci("ADD") && !param.empty())
{
diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp
index 9fdb467c9..9562b63e4 100644
--- a/modules/commands/ms_info.cpp
+++ b/modules/commands/ms_info.cpp
@@ -50,7 +50,7 @@ class CommandMSInfo : public Command
source.Reply(CHAN_X_NOT_REGISTERED, nname.c_str());
return;
}
- else if (!ci->HasPriv(u, CA_MEMO))
+ else if (!ci->AccessFor(u).HasPriv(CA_MEMO))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp
index 26821a413..c0b5f910c 100644
--- a/modules/commands/ms_list.cpp
+++ b/modules/commands/ms_list.cpp
@@ -74,7 +74,7 @@ class CommandMSList : public Command
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
- else if (!ci->HasPriv(u, CA_MEMO))
+ else if (!ci->AccessFor(u).HasPriv(CA_MEMO))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp
index f275f8d7d..9e826fc88 100644
--- a/modules/commands/ms_read.cpp
+++ b/modules/commands/ms_read.cpp
@@ -108,7 +108,7 @@ class CommandMSRead : public Command
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
- else if (!ci->HasPriv(u, CA_MEMO))
+ else if (!ci->AccessFor(u).HasPriv(CA_MEMO))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp
index b1bda8339..02eb971ad 100644
--- a/modules/commands/ms_set.cpp
+++ b/modules/commands/ms_set.cpp
@@ -91,7 +91,7 @@ class CommandMSSet : public Command
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
- else if (!is_servadmin && !ci->HasPriv(u, CA_MEMO))
+ else if (!is_servadmin && !ci->AccessFor(u).HasPriv(CA_MEMO))
{
source.Reply(ACCESS_DENIED);
return;
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index 275f4c748..050470ec4 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -166,7 +166,7 @@ class NSAJoin : public Module
Anope::string k;
if (c->GetParam(CMODE_KEY, k))
{
- if (ci->HasPriv(u, CA_GETKEY))
+ if (ci->AccessFor(u).HasPriv(CA_GETKEY))
key = k;
else if (key != k)
need_invite = true;
@@ -191,7 +191,7 @@ class NSAJoin : public Module
if (need_invite)
{
BotInfo *bi = findbot(Config->NickServ);
- if (!bi || !ci->HasPriv(u, CA_INVITE))
+ if (!bi || !ci->AccessFor(u).HasPriv(CA_INVITE))
continue;
ircdproto->SendInvite(bi, channels[i].first, u->nick);
}