0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-10 20:11:07 +01:00
construct/extensions/chm_quietunreg_compat.cc

52 lines
1.3 KiB
C++
Raw Normal View History

/*
* Treat cmode +-R as +-q $~a.
* -- jilles
*/
namespace mode = ircd::chan::mode;
using namespace mode;
2016-08-13 05:05:54 +02:00
using namespace ircd;
static const char chm_quietunreg_compat_desc[] =
"Adds an emulated channel mode +R which is converted into mode +q $~a";
static int _modinit(void);
static void _moddeinit(void);
static void chm_quietunreg(client::client *source_p, chan::chan *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, type type);
2016-03-07 06:48:27 +01:00
DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc);
static int
_modinit(void)
{
table['R'].type = type(0);
table['R'].category = category::D;
table['R'].set_func = chm_quietunreg;
return 0;
}
static void
_moddeinit(void)
{
table['R'].type = type(0);
table['R'].category = category(0);
table['R'].set_func = functor::nosuch;
}
static void
chm_quietunreg(client::client *source_p, chan::chan *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, type type)
{
int newparn = 0;
const char *newparv[] = { "$~a" };
2016-08-23 04:33:36 +02:00
if (my(*source_p))
functor::ban(source_p, chptr, alevel, 1, &newparn, newparv, errors, dir, 'q', QUIET);
else
functor::nosuch(source_p, chptr, alevel, parc, parn, parv, errors, dir, c, type);
}