Add chm_quietunreg_compat extension, makes cmode +-R an alias for +-q $~a.

This commit is contained in:
Jilles Tjoelker 2007-12-25 13:56:05 +01:00
parent 6dc16f7e82
commit b50c1127d6
2 changed files with 60 additions and 0 deletions

View file

@ -27,6 +27,7 @@ INCLUDES = -I. -I../include -I../libcharybdis -I../adns $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@
SRCS = \
chm_quietunreg_compat.c \
createauthonly.c \
createoperonly.c \
extb_account.c \

View file

@ -0,0 +1,59 @@
/*
* Treat cmode +-R as +-q $~a.
* -- jilles
*/
#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_quietunreg(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_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
}
static void
chm_quietunreg(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[] = { "$~a" };
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'q', CHFL_QUIET);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}