summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn0kS Phr33d0m <god@politeia.in>2013-08-23 06:43:57 +0200
committern0kS Phr33d0m <god@politeia.in>2013-08-23 06:43:57 +0200
commit97930620079db049ee9ae5a53f0c6d4491ac0fb5 (patch)
tree5ed193e7fcf9940e815e9a518ddb7d7d2f803720
parentf86dc247e521b893d134b08329e69e17ccf34e1f (diff)
parent5ac0c9a32732fde91844a9b8c64e676893ea7331 (diff)
Merge branch '1.9' of github.com:anope/anope into 1.9
-rw-r--r--docs/README4
-rw-r--r--modules/commands/cs_access.cpp30
-rw-r--r--modules/commands/cs_flags.cpp15
-rw-r--r--modules/commands/cs_xop.cpp18
-rw-r--r--src/channels.cpp21
5 files changed, 36 insertions, 52 deletions
diff --git a/docs/README b/docs/README
index 8a455f03d..1419d3c07 100644
--- a/docs/README
+++ b/docs/README
@@ -118,9 +118,7 @@ Table of Contents
Anope Web panel:
- * Thomas Edwards <thomas.edwards@ilkotech.co.uk>
- * Luke Thompson <luke.thompson@ilkotech.co.uk>
- * Matthew M. <mcm@they-got.us>
+ * Denis M. (Phr33d0m) <god@politeia.in>
2) Presentation
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index 5d361043d..ab13b6e7d 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -43,32 +43,6 @@ class AccessChanAccess : public ChanAccess
{
this->level = convertTo<int>(data);
}
-
- static int DetermineLevel(const ChanAccess *access)
- {
- if (access->provider->name == "access/access")
- {
- const AccessChanAccess *aaccess = anope_dynamic_static_cast<const AccessChanAccess *>(access);
- return aaccess->level;
- }
- else
- {
- int highest = 1;
- const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
-
- for (unsigned i = 0; i < privs.size(); ++i)
- {
- const Privilege &p = privs[i];
- if (access->ci->GetLevel(p.name) > highest && access->HasPriv(p.name))
- highest = access->ci->GetLevel(p.name);
- }
-
- if (highest >= ACCESS_FOUNDER)
- highest = ACCESS_FOUNDER - 1;
-
- return highest;
- }
- }
};
class AccessAccessProvider : public AccessProvider
@@ -380,7 +354,7 @@ class CommandCSAccess : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
- entry["Level"] = stringify(AccessChanAccess::DetermineLevel(access));
+ entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->mask;
entry["By"] = access->creator;
entry["Last seen"] = timebuf;
@@ -417,7 +391,7 @@ class CommandCSAccess : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
- entry["Level"] = stringify(AccessChanAccess::DetermineLevel(access));
+ entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->mask;
entry["By"] = access->creator;
entry["Last seen"] = timebuf;
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 9b1721648..cc0f6798f 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -254,7 +254,7 @@ class CommandCSFlags : public Command
source.Reply(_("Privilege \2%s\2 removed from \2%s\2 on \2%s\2, new flags are +\2%s\2"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
else
- source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
+ source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
@@ -275,11 +275,10 @@ class CommandCSFlags : public Command
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
{
const ChanAccess *access = ci->GetAccess(i);
+ const Anope::string &flags = FlagsChanAccess::DetermineFlags(access);
if (!arg.empty())
{
- const Anope::string &flags = FlagsChanAccess::DetermineFlags(access);
-
if (arg[0] == '+')
{
bool pass = true;
@@ -297,7 +296,7 @@ class CommandCSFlags : public Command
++count;
entry["Number"] = stringify(i + 1);
entry["Mask"] = access->mask;
- entry["Flags"] = FlagsChanAccess::DetermineFlags(access);
+ entry["Flags"] = flags;
entry["Creator"] = access->creator;
entry["Created"] = Anope::strftime(access->created, source.nc, true);
list.AddEntry(entry);
@@ -340,7 +339,7 @@ class CommandCSFlags : public Command
}
public:
- CommandCSFlags(Module *creator) : Command(creator, "chanserv/flags", 2, 4)
+ CommandCSFlags(Module *creator) : Command(creator, "chanserv/flags", 1, 4)
{
this->SetDesc(_("Modify the list of privileged users"));
this->SetSyntax(_("\037channel\037 MODIFY \037mask\037 \037changes\037"));
@@ -351,7 +350,7 @@ class CommandCSFlags : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &chan = params[0];
- const Anope::string &cmd = params[1];
+ const Anope::string &cmd = params.size() > 1 ? params[1] : "";
ChannelInfo *ci = ChannelInfo::Find(chan);
if (ci == NULL)
@@ -360,7 +359,7 @@ class CommandCSFlags : public Command
return;
}
- bool is_list = cmd.equals_ci("LIST");
+ bool is_list = cmd.empty() || cmd.equals_ci("LIST");
bool has_access = false;
if (source.HasPriv("chanserv/access/modify"))
has_access = true;
@@ -375,7 +374,7 @@ class CommandCSFlags : public Command
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
else if (cmd.equals_ci("MODIFY"))
this->DoModify(source, ci, params);
- else if (cmd.equals_ci("LIST"))
+ else if (is_list)
this->DoList(source, ci, params);
else if (cmd.equals_ci("CLEAR"))
this->DoClear(source, ci);
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 10d28fc03..cd08a33a9 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -315,7 +315,7 @@ class CommandCSXOP : public Command
ChanAccess *caccess = ci->GetAccess(number - 1);
- if (this->source.command.upper() != XOPChanAccess::DetermineLevel(caccess))
+ if (caccess->provider->name != "access/xop" || this->source.command.upper() != caccess->AccessSerialize())
return;
++deleted;
@@ -338,7 +338,10 @@ class CommandCSXOP : public Command
{
ChanAccess *a = ci->GetAccess(i);
- if (a->mask.equals_ci(mask) && XOPChanAccess::DetermineLevel(a) == source.command.upper())
+ if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
+ continue;
+
+ if (a->mask.equals_ci(mask))
{
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->mask;
@@ -397,7 +400,7 @@ class CommandCSXOP : public Command
const ChanAccess *a = ci->GetAccess(Number - 1);
- if (this->source.command.upper() != XOPChanAccess::DetermineLevel(a))
+ if (a->provider->name != "access/xop" || this->source.command.upper() != a->AccessSerialize())
return;
ListFormatter::ListEntry entry;
@@ -414,7 +417,7 @@ class CommandCSXOP : public Command
{
const ChanAccess *a = ci->GetAccess(i);
- if (XOPChanAccess::DetermineLevel(a) != source.command.upper())
+ if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
continue;
else if (!nick.empty() && !Anope::Match(a->mask, nick))
continue;
@@ -465,8 +468,11 @@ class CommandCSXOP : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
const ChanAccess *access = ci->GetAccess(i - 1);
- if (XOPChanAccess::DetermineLevel(access) == source.command.upper())
- delete ci->EraseAccess(i - 1);
+
+ if (access->provider->name != "access/xop" || source.command.upper() != access->AccessSerialize())
+ continue;
+
+ delete ci->EraseAccess(i - 1);
}
FOREACH_MOD(OnAccessClear, (ci, source));
diff --git a/src/channels.cpp b/src/channels.cpp
index 84e90792d..22f90e28f 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -795,21 +795,28 @@ void Channel::SetCorrectModes(User *user, bool give_modes)
FOREACH_MOD(OnSetCorrectModes, (user, this, u_access, give_modes, take_modes));
/* Never take modes from ulines */
- take_modes &= !user->server->IsULined();
+ if (user->server->IsULined())
+ take_modes = false;
+ /* whether or not we are giving modes */
+ bool giving = give_modes;
+ /* whether or not we have given a mode */
bool given = false;
for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
{
ChannelModeStatus *cm = ModeManager::GetStatusChannelModesByRank()[i];
bool has_priv = u_access.HasPriv("AUTO" + cm->name);
- /* If we have already given one mode, don't give more until it has a symbol */
- if (give_modes && has_priv && (!given || cm->symbol))
+ if (give_modes && has_priv)
{
- this->SetMode(NULL, cm, user->GetUID());
- /* Now if this contains a symbol don't give any more modes, to prevent setting +qaohv etc on users */
- give_modes = !cm->symbol;
- given = true;
+ /* Always give op. If we have already given one mode, don't give more until it has a symbol */
+ if (cm->name == "OP" || !given || (giving && cm->symbol))
+ {
+ this->SetMode(NULL, cm, user->GetUID());
+ /* Now if this contains a symbol don't give any more modes, to prevent setting +qaohv etc on users */
+ giving = !cm->symbol;
+ given = true;
+ }
}
else if (take_modes && !has_priv)
{