0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-09 11:31:11 +01:00
construct/extensions/chm_operonly_compat.c
Jason Volk ea53aab823 Refactor repository layout.
* librb is no longer a separately configured subproject.
* charybdis is now a standalone directory with a binary.
* Include path layout now requires a directory ircd/ rb/ etc.
2016-07-21 20:51:02 -07:00

57 lines
1.5 KiB
C

/*
* Treat cmode +-O as +-iI $o.
*/
#include <ircd/stdinc.h>
#include <ircd/modules.h>
#include <ircd/client.h>
#include <ircd/hook.h>
#include <ircd/ircd.h>
#include <ircd/chmode.h>
static const char chm_operonly_compat[] =
"Adds an emulated channel mode +O which is converted into mode +i and +I $o";
static int _modinit(void);
static void _moddeinit(void);
static void chm_operonly(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_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat);
static int
_modinit(void)
{
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = CHM_D;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = 0;
}
static void
chm_operonly(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[] = { "$o" };
if (MyClient(source_p)) {
chm_simple(source_p, chptr, alevel, parc, parn, parv,
errors, dir, 'i', MODE_INVITEONLY);
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'I', CHFL_INVEX);
} else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}