0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00
construct/extensions/extb_oper.cc
2016-08-23 15:25:09 -07:00

48 lines
1,000 B
C++

/*
* Oper extban type: matches opers
* -- jilles
*/
namespace mode = ircd::chan::mode;
namespace ext = mode::ext;
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;
}
return is(*client_p, umode::OPER) ? MATCH : NOMATCH;
}