summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-09-10 14:59:00 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-09-10 14:59:00 +0200
commit02158b649035ba9d1e6fb36895d393580972b1e1 (patch)
tree3bcaeec3b2fe040ec30b0d414fcfe61c6e80920d
parentc2fb4e4b9d7dc6f2ecc5d8f0054350ae8c9be986 (diff)
m_hidelist Make minimum rank required to view lists configurable
-rw-r--r--docs/conf/modules.conf.example9
-rw-r--r--src/modules/m_hidelist.cpp13
2 files changed, 18 insertions, 4 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 0be7ee437..a5e9fde8f 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -837,12 +837,19 @@
#
# Each <hidelist> tag configures one listmode to hide.
# mode: Name of the listmode to hide.
+# rank: Minimum rank required to view the list. If set to 0, all
+# members of the channel may view the list, but non-members may not.
+# The rank of the built-in op and voice mode is 30000 and 10000,
+# respectively; the rank of other prefix modes is configurable.
+# Defaults to 20000.
#
# Hiding the ban list is not recommended because it may break some
# clients.
#
# Hide filter (+g) list:
-#<hidelist mode="filter">
+#<hidelist mode="filter" rank="30000">
+# Only show invite exceptions (+I) to channel members:
+#<hidelist mode="invex" rank="0">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Hide oper module: Allows opers to hide their oper status from non-
diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp
index f7a05ed0a..cde8371fc 100644
--- a/src/modules/m_hidelist.cpp
+++ b/src/modules/m_hidelist.cpp
@@ -21,9 +21,13 @@
class ListWatcher : public ModeWatcher
{
+ // Minimum rank required to view the list
+ const unsigned int minrank;
+
public:
- ListWatcher(Module* mod, const std::string& modename)
+ ListWatcher(Module* mod, const std::string& modename, unsigned int rank)
: ModeWatcher(mod, modename, MODETYPE_CHANNEL)
+ , minrank(rank)
{
}
@@ -36,7 +40,7 @@ class ListWatcher : public ModeWatcher
// If the user requesting the list is a member of the channel see if they have the
// rank required to view the list
Membership* memb = chan->GetUser(user);
- if ((memb) && (memb->getRank() >= HALFOP_VALUE))
+ if ((memb) && (memb->getRank() >= minrank))
return true;
if (user->HasPrivPermission("channels/auspex"))
@@ -62,7 +66,10 @@ class ModuleHideList : public Module
{
ConfigTag* tag = i->second;
std::string modename = tag->getString("mode");
- watchers.push_back(new ListWatcher(this, modename));
+ // If rank is set to 0 everyone inside the channel can view the list,
+ // but non-members may not
+ unsigned int rank = tag->getInt("rank", HALFOP_VALUE, 0);
+ watchers.push_back(new ListWatcher(this, modename, rank));
}
}