From 6d1a8b6edad94db114d222f4f3e5f49a056a23af Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Tue, 8 Apr 2008 21:29:19 +0400 Subject: [PATCH] chm_sslonly_compat, this adds +S channel mode, which means ssl only channel --- extensions/Makefile.in | 1 + extensions/chm_sslonly_compat.c | 58 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 extensions/chm_sslonly_compat.c diff --git a/extensions/Makefile.in b/extensions/Makefile.in index 5b54fbb99..052903c20 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -28,6 +28,7 @@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@ SRCS = \ chm_quietunreg_compat.c \ + chm_sslonly_compat.c \ createauthonly.c \ createoperonly.c \ extb_account.c \ diff --git a/extensions/chm_sslonly_compat.c b/extensions/chm_sslonly_compat.c new file mode 100644 index 000000000..3f91e08b3 --- /dev/null +++ b/extensions/chm_sslonly_compat.c @@ -0,0 +1,58 @@ +/* + * Treat cmode +-S as +-b $~z. + */ + +#include "stdinc.h" +#include "modules.h" +#include "client.h" +#include "hook.h" +#include "ircd.h" + +/* XXX prototypes */ +void chm_ban(struct Client *source_p, struct Channel *chptr, + int alevel, int parc, int *parn, + const char **parv, int *errors, int dir, char c, long mode_type); +void chm_nosuch(struct Client *source_p, struct Channel *chptr, + int alevel, int parc, int *parn, + const char **parv, int *errors, int dir, char c, long mode_type); +/* end yucky prototypes */ + +static int _modinit(void); +static void _moddeinit(void); +static void chm_sslonly(struct Client *source_p, struct Channel *chptr, + int alevel, int parc, int *parn, + const char **parv, int *errors, int dir, char c, long mode_type); + +DECLARE_MODULE_AV1(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$"); + +static int +_modinit(void) +{ + chmode_table['S'].set_func = chm_sslonly; + chmode_table['S'].mode_type = 0; + + return 0; +} + +static void +_moddeinit(void) +{ + chmode_table['S'].set_func = chm_nosuch; + chmode_table['S'].mode_type = 0; +} + +static void +chm_sslonly(struct Client *source_p, struct Channel *chptr, + int alevel, int parc, int *parn, + const char **parv, int *errors, int dir, char c, long mode_type) +{ + int newparn = 0; + const char *newparv[] = { "$~z" }; + + if (MyClient(source_p)) + chm_ban(source_p, chptr, alevel, 1, &newparn, newparv, + errors, dir, 'b', CHFL_BAN); + else + chm_nosuch(source_p, chptr, alevel, parc, parn, parv, + errors, dir, c, mode_type); +}