2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Channel extban type: matches users who are in a certain public channel
|
|
|
|
* -- jilles
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "hash.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char extb_desc[] = "Channel ($c) extban type";
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
|
|
|
static int eb_channel(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
|
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
DECLARE_MODULE_AV2(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
|
|
|
extban_table['c'] = eb_channel;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
|
|
|
extban_table['c'] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int eb_channel(const char *data, struct Client *client_p,
|
|
|
|
struct Channel *chptr, long mode_type)
|
|
|
|
{
|
|
|
|
struct Channel *chptr2;
|
|
|
|
|
|
|
|
(void)chptr;
|
|
|
|
(void)mode_type;
|
|
|
|
if (data == NULL)
|
|
|
|
return EXTBAN_INVALID;
|
|
|
|
chptr2 = find_channel(data);
|
|
|
|
if (chptr2 == NULL)
|
|
|
|
return EXTBAN_INVALID;
|
|
|
|
/* require consistent target */
|
|
|
|
if (chptr->chname[0] == '#' && data[0] == '&')
|
|
|
|
return EXTBAN_INVALID;
|
|
|
|
/* privacy! don't allow +s/+p channels to influence another channel */
|
2014-06-21 21:48:37 +02:00
|
|
|
if (!PubChannel(chptr2) && chptr2 != chptr)
|
2007-01-25 07:40:21 +01:00
|
|
|
return EXTBAN_INVALID;
|
|
|
|
return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
|
|
|
|
}
|