From 0865b537a0e4190d026f4d0f67ad8cd21ab6a3b4 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 27 Jul 2008 12:47:40 +0400 Subject: [PATCH] SSL only channel mode extension - might be useful if server owner prefer not to use extended bans, or to make server feel like ircd-ratbox3 --- extensions/Makefile.in | 1 + extensions/chm_sslonly.c | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 extensions/chm_sslonly.c diff --git a/extensions/Makefile.in b/extensions/Makefile.in index 04a69ea..761e02a 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -30,6 +30,7 @@ SRCS = \ chm_operonly.c \ chm_operonly_compat.c \ chm_quietunreg_compat.c \ + chm_sslonly.c \ chm_sslonly_compat.c \ createauthonly.c \ createoperonly.c \ diff --git a/extensions/chm_sslonly.c b/extensions/chm_sslonly.c new file mode 100644 index 0000000..197aac6 --- /dev/null +++ b/extensions/chm_sslonly.c @@ -0,0 +1,53 @@ +#include "stdinc.h" +#include "modules.h" +#include "hook.h" +#include "client.h" +#include "ircd.h" +#include "send.h" +#include "s_conf.h" +#include "s_user.h" +#include "s_serv.h" +#include "numeric.h" +#include "chmode.h" + +static void h_can_join(hook_data_channel *); + +mapi_hfn_list_av1 sslonly_hfnlist[] = { + { "can_join", (hookfn) h_can_join }, + { NULL, NULL } +}; + +static int +_modinit(void) +{ + chmode_table['S'].mode_type = find_cflag_slot(); + chmode_table['S'].set_func = chm_simple; + + construct_noparam_modes(); + + return 0; +} + + +static void +_moddeinit(void) +{ + chmode_table['S'].mode_type = 0; + + construct_noparam_modes(); +} + +DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, "$Revision$"); + +static void +h_can_join(hook_data_channel *data) +{ + struct Client *source_p = data->client; + struct Channel *chptr = data->chptr; + + if((chptr->mode.mode & chmode_flags['S']) && !IsSSLClient(source_p)) { + sendto_one_notice(source_p, ":Only users using SSL could join this channel!"); + data->approved = ERR_CUSTOM; + } +} +