From e12e4e69560e2e0f7a225f581f331e628c8a8682 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 21 Aug 2013 23:20:05 -0400 Subject: Update readme --- docs/README | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/README b/docs/README index 8a455f03d..670508b93 100644 --- a/docs/README +++ b/docs/README @@ -118,9 +118,7 @@ Table of Contents Anope Web panel: - * Thomas Edwards - * Luke Thompson - * Matthew M. + * n0kS Phr33d0m 2) Presentation -- cgit From 0c1cc08e2832dbe59b5aaa9b654a11bafb373ab6 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 21 Aug 2013 23:22:27 -0400 Subject: Update readme more --- docs/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README b/docs/README index 670508b93..1419d3c07 100644 --- a/docs/README +++ b/docs/README @@ -118,7 +118,7 @@ Table of Contents Anope Web panel: - * n0kS Phr33d0m + * Denis M. (Phr33d0m) 2) Presentation -- cgit From ce7a32a994136fa4ffd8489f8e56dde7b678ee07 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 22 Aug 2013 01:13:28 -0400 Subject: Do not have cs_access try to represent non levels access entries as levels access entries. Sometimes it cant accurately be done and it confuses people. --- modules/commands/cs_access.cpp | 30 ++---------------------------- modules/commands/cs_flags.cpp | 15 +++++++-------- modules/commands/cs_xop.cpp | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 42 deletions(-) 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(data); } - - static int DetermineLevel(const ChanAccess *access) - { - if (access->provider->name == "access/access") - { - const AccessChanAccess *aaccess = anope_dynamic_static_cast(access); - return aaccess->level; - } - else - { - int highest = 1; - const std::vector &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 ¶ms) @@ -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 ¶ms) 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)); -- cgit From e8763d5b3ccf019f3da797f976af1fb90d300437 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 22 Aug 2013 01:48:17 -0400 Subject: Always set +o on users who have access for it, even if higher modes have a prefix --- src/channels.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/channels.cpp b/src/channels.cpp index 84e90792d..4e8520bde 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -795,21 +795,25 @@ 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; - bool given = false; + /* whether or not we are giving modes */ + bool giving = give_modes; 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) { + /* Always give op. If we have already given one mode, don't give more until it has a symbol */ + if (cm->name != "OP" && (!giving || !cm->symbol)) + continue; + 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; + giving = !cm->symbol; } else if (take_modes && !has_priv) { -- cgit From 5ac0c9a32732fde91844a9b8c64e676893ea7331 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 22 Aug 2013 17:33:16 -0400 Subject: Fix previous commit --- src/channels.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/channels.cpp b/src/channels.cpp index 4e8520bde..22f90e28f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -800,6 +800,8 @@ void Channel::SetCorrectModes(User *user, bool give_modes) /* 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]; @@ -808,12 +810,13 @@ void Channel::SetCorrectModes(User *user, bool give_modes) if (give_modes && has_priv) { /* Always give op. If we have already given one mode, don't give more until it has a symbol */ - if (cm->name != "OP" && (!giving || !cm->symbol)) - continue; - - 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; + 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) { -- cgit