2008-04-08 17:40:41 +00:00
|
|
|
/*
|
|
|
|
* Treat cmode +-O as +-iI $o.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "hook.h"
|
|
|
|
#include "ircd.h"
|
2008-04-08 19:39:35 +00:00
|
|
|
#include "chmode.h"
|
2008-04-08 17:40:41 +00:00
|
|
|
|
2016-03-09 07:29:41 +00:00
|
|
|
static const char chm_operonly_compat[] =
|
|
|
|
"Adds an emulated channel mode +O which is converted into mode +i and +I $o";
|
|
|
|
|
2008-04-08 17:40:41 +00:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2020-11-08 00:45:12 +00:00
|
|
|
static ChannelModeFunc chm_operonly;
|
2008-04-08 17:40:41 +00:00
|
|
|
|
2016-03-07 05:48:27 +00:00
|
|
|
DECLARE_MODULE_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat);
|
2008-04-08 17:40:41 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
2020-11-05 16:31:57 +00:00
|
|
|
chmode_table['O'] = (struct ChannelMode){chm_operonly, 0, 0};
|
2008-04-08 17:40:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2020-11-05 16:31:57 +00:00
|
|
|
chmode_table['O'] = (struct ChannelMode){chm_nosuch, 0, 0};
|
2008-04-08 17:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
chm_operonly(struct Client *source_p, struct Channel *chptr,
|
2020-11-05 16:31:57 +00:00
|
|
|
int alevel, const char *arg, int *errors, int dir, char c, long mode_type)
|
2008-04-08 17:40:41 +00:00
|
|
|
{
|
|
|
|
if (MyClient(source_p)) {
|
2020-11-05 16:31:57 +00:00
|
|
|
chm_simple(source_p, chptr, alevel, NULL,
|
2008-04-08 17:40:41 +00:00
|
|
|
errors, dir, 'i', MODE_INVITEONLY);
|
2020-11-05 16:31:57 +00:00
|
|
|
chm_ban(source_p, chptr, alevel, "$o",
|
2008-04-08 17:40:41 +00:00
|
|
|
errors, dir, 'I', CHFL_INVEX);
|
|
|
|
} else
|
2020-11-05 16:31:57 +00:00
|
|
|
chm_nosuch(source_p, chptr, alevel, NULL,
|
2008-04-08 17:40:41 +00:00
|
|
|
errors, dir, c, mode_type);
|
|
|
|
}
|