summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-27 17:55:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-27 17:55:08 +0000
commitd6fcf2726e4075fb323010e067964c84044cbf08 (patch)
treee0735ea4d6d1aaf8ed1bb83a1dabb338f4c03f15
parentcdec3807363564c6608909c3a345cedf44183647 (diff)
Add support for hiding listmode lists such as +beI from unprivileged users.
See bug #258 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6849 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--docs/inspircd.conf.example6
-rw-r--r--include/configreader.h6
-rw-r--r--src/configreader.cpp3
-rw-r--r--src/mode.cpp6
4 files changed, 20 insertions, 1 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index a6900e3b8..9d9d0fc8c 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -853,6 +853,11 @@
# authentication, this option can be used to turn it #
# off. #
# #
+# hidemodes - If this option is enabled, then listmodes, for #
+# example +beI, will be hidden from users below #
+# halfop. This is not recommended, as it may break #
+# some features in popular clients such as mIRC. #
+# #
<options prefixquit="Quit: "
loglevel="default"
@@ -880,6 +885,7 @@
announcets="yes"
disablehmac="no"
hostintopic="yes"
+ hidemodes="no"
allowhalfop="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#- TIME SYNC OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/include/configreader.h b/include/configreader.h
index 514e5e9b3..838814cc4 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -349,6 +349,12 @@ class ServerConfig : public Extensible
*/
bool AllowHalfop;
+ /** If this is set to true, then mode lists (e.g
+ * MODE #chan b) are hidden from unprivileged
+ * users.
+ */
+ bool HideModeLists;
+
/** The number of seconds the DNS subsystem
* will wait before timing out any request.
*/
diff --git a/src/configreader.cpp b/src/configreader.cpp
index dbed24ae5..2ebc21233 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -30,7 +30,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
*UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = *SuffixQuit = '\0';
WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
log_file = NULL;
- NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = UndernetMsgPrefix = false;
+ HideModeLists = NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = UndernetMsgPrefix = false;
CycleHosts = writelog = AllowHalfop = true;
dns_timeout = DieDelay = 5;
MaxTargets = 20;
@@ -602,6 +602,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "ircumsgprefix","0", new ValueContainerBool (&this->UndernetMsgPrefix), DT_BOOLEAN, NoValidation},
{"options", "announceinvites", "1", new ValueContainerBool (&this->AnnounceInvites), DT_BOOLEAN, NoValidation},
{"options", "hostintopic", "1", new ValueContainerBool (&this->FullHostInTopic), DT_BOOLEAN, NoValidation},
+ {"options", "hidemodes", "0", new ValueContainerBool (&this->HideModeLists), DT_BOOLEAN, NoValidation},
{"pid", "file", "", new ValueContainerChar (this->PID), DT_CHARPTR, NoValidation},
{"whowas", "groupsize", "10", new ValueContainerInt (&this->WhoWasGroupSize), DT_INTEGER, NoValidation},
{"whowas", "maxgroups", "10240", new ValueContainerInt (&this->WhoWasMaxGroups), DT_INTEGER, NoValidation},
diff --git a/src/mode.cpp b/src/mode.cpp
index ef3801ab6..5e384ad9a 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -294,6 +294,12 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
continue;
}
+ if (ServerInstance->Config->HideModeLists && (targetchannel->GetStatus(user) < STATUS_HOP))
+ {
+ user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
+ continue;
+ }
+
ModeHandler *mh = this->FindMode(*mode, MODETYPE_CHANNEL);
bool display = true;