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

This commit is contained in:
Valery Yatsko 2008-07-27 12:47:40 +04:00
parent 216574bec7
commit 80ce25befa
2 changed files with 54 additions and 0 deletions

View file

@ -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 \

53
extensions/chm_sslonly.c Normal file
View file

@ -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;
}
}