0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-03 04:18:55 +01:00
construct/extensions/extb_oper.cc

49 lines
1,000 B
C++
Raw Normal View History

/*
* Oper extban type: matches opers
* -- jilles
*/
namespace mode = ircd::chan::mode;
namespace ext = mode::ext;
2016-08-13 05:05:54 +02:00
using namespace ircd;
static const char extb_desc[] = "Oper ($o) extban type";
static int _modinit(void);
static void _moddeinit(void);
static int eb_oper(const char *data, client::client *client_p, chan::chan *chptr, mode::type);
DECLARE_MODULE_AV2(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
static int
_modinit(void)
{
ext::table['o'] = eb_oper;
return 0;
}
static void
_moddeinit(void)
{
ext::table['o'] = NULL;
}
static int
eb_oper(const char *data, client::client *client_p, chan::chan *chptr, mode::type type)
{
using namespace ext;
if (data != NULL)
{
struct PrivilegeSet *set = privilegeset_get(data);
if (set != NULL && client_p->localClient->privset == set)
return MATCH;
/* $o:admin or whatever */
return HasPrivilege(client_p, data) ? MATCH : NOMATCH;
}
2016-08-24 00:25:09 +02:00
return is(*client_p, umode::OPER) ? MATCH : NOMATCH;
}