inspircd

A modular C++ IRC daemon (ircd). https://www.inspircd.org/
Log | Files | Refs | README

commit 21f0718c4ae18f565895b5cc05c4af3942d0f8e5
parent d40ea20e6573b33d59cd9b68ab2790b4c990557d
Author: Peter Powell <petpow@saberuk.com>
Date:   Fri, 19 Apr 2019 00:39:57 +0100

Remove the 'noisy' mode for HasPrivPermission.

This was only used in one place.

Diffstat:
Minclude/users.h | 6++----
Msrc/modules/m_sajoin.cpp | 2+-
Msrc/modules/m_samode.cpp | 5++++-
Msrc/users.cpp | 16+++-------------
4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/include/users.h b/include/users.h @@ -463,10 +463,9 @@ class CoreExport User : public Extensible * all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc. * * @param privstr The priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file. - * @param noisy If set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent. * @return True if this user has the permission in question. */ - virtual bool HasPrivPermission(const std::string &privstr, bool noisy = false); + virtual bool HasPrivPermission(const std::string& privstr); /** Returns true or false if a user can set a privileged user or channel mode. * This is done by looking up their oper type from User::oper, then referencing @@ -840,10 +839,9 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local * all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc. * * @param privstr The priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file. - * @param noisy If set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent. * @return True if this user has the permission in question. */ - bool HasPrivPermission(const std::string &privstr, bool noisy = false) CXX11_OVERRIDE; + bool HasPrivPermission(const std::string& privstr) CXX11_OVERRIDE; /** Returns true or false if a user can set a privileged user or channel mode. * This is done by looking up their oper type from User::oper, then referencing diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp @@ -45,7 +45,7 @@ class CommandSajoin : public Command User* dest = ServerInstance->FindNick(nickname); if ((dest) && (dest->registered == REG_ALL)) { - if (user != dest && !user->HasPrivPermission("users/sajoin-others", false)) + if (user != dest && !user->HasPrivPermission("users/sajoin-others")) { user->WriteNotice("*** You are not allowed to /SAJOIN other users (the privilege users/sajoin-others is needed to /SAJOIN others)."); return CMD_FAILURE; diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp @@ -49,8 +49,11 @@ class CommandSamode : public Command } // Changing the modes of another user requires a special permission - if ((target != user) && (!user->HasPrivPermission("users/samode-usermodes", true))) + if ((target != user) && (!user->HasPrivPermission("users/samode-usermodes"))) + { + user->WriteNotice("*** You are not allowed to /SAMODE other users (the privilege users/samode-usermodes is needed to /SAMODE others)."); return CMD_FAILURE; + } } // XXX: Make ModeParser clear LastParse diff --git a/src/users.cpp b/src/users.cpp @@ -195,27 +195,17 @@ bool LocalUser::HasPermission(const std::string &command) return oper->AllowedOperCommands.Contains(command); } -bool User::HasPrivPermission(const std::string &privstr, bool noisy) +bool User::HasPrivPermission(const std::string& privstr) { return true; } -bool LocalUser::HasPrivPermission(const std::string &privstr, bool noisy) +bool LocalUser::HasPrivPermission(const std::string& privstr) { if (!this->IsOper()) - { - if (noisy) - this->WriteNotice("You are not an oper"); return false; - } - - if (oper->AllowedPrivs.Contains(privstr)) - return true; - - if (noisy) - this->WriteNotice("Oper type " + oper->name + " does not have access to priv " + privstr); - return false; + return oper->AllowedPrivs.Contains(privstr); } void UserIOHandler::OnDataReady()