]> jfr.im git - solanum.git/commitdiff
extensions: add the ability to hide uncommon channels in WHOIS, like in ircd-seven...
authorWilliam Pitcock <redacted>
Wed, 6 Jan 2016 00:44:17 +0000 (18:44 -0600)
committerWilliam Pitcock <redacted>
Wed, 6 Jan 2016 00:45:07 +0000 (18:45 -0600)
extensions/Makefile.in
extensions/hide_uncommon_channels.c [new file with mode: 0644]

index defab61e931dc0590fa8e0ddf8b36e6a5a2ff2eb..83927d1aaa0ed68d74c424c78095be54973eb362 100644 (file)
@@ -79,6 +79,7 @@ SRCS =                          \
   m_webirc.c                   \
   m_remove.c                   \
   m_roleplay.c                 \
+  hide_uncommon_channels.c     \
   no_kill_services.c           \
   no_locops.c                  \
   no_oper_invis.c              \
diff --git a/extensions/hide_uncommon_channels.c b/extensions/hide_uncommon_channels.c
new file mode 100644 (file)
index 0000000..3ba6b3e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Override WHOIS logic to hide channel memberships that are not common.
+ *   -- kaniini
+ */
+
+#include "stdinc.h"
+#include "modules.h"
+#include "client.h"
+#include "hook.h"
+#include "ircd.h"
+#include "send.h"
+#include "s_conf.h"
+#include "s_newconf.h"
+
+static void h_huc_doing_whois_channel_visibility(hook_data_client *);
+
+mapi_hfn_list_av1 huc_hfnlist[] = {
+       { "doing_whois_channel_visibility", (hookfn) h_huc_doing_whois_channel_visibility },
+       { NULL, NULL }
+};
+
+DECLARE_MODULE_AV1(hide_uncommon_channels, NULL, NULL, NULL, NULL, huc_hfnlist, "");
+
+static void
+h_huc_doing_whois_channel_visibility(hook_data_client *hdata)
+{
+       hdata->approved = ((PubChannel(hdata->chptr) && !IsInvisible(hdata->target)) || IsMember((hdata->client), (hdata->chptr)));
+}