Skip to content

Commit 2c287e3

Browse files
committed
move privset extban to $O and add $o extban for oper name
1 parent 5a1b54f commit 2c287e3

File tree

3 files changed

+53
-8
lines changed

3 files changed

+53
-8
lines changed

extensions/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ extension_LTLIBRARIES = \
2020
extb_canjoin.la \
2121
extb_channel.la \
2222
extb_hostmask.la \
23-
extb_oper.la \
23+
extb_operpriv.la \
24+
extb_opername.la \
2425
extb_server.la \
2526
extb_ssl.la \
2627
extb_realname.la \

extensions/extb_opername.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Oper name extban type: matches oper names
3+
* -- jilles
4+
*/
5+
6+
#include "stdinc.h"
7+
#include "modules.h"
8+
#include "client.h"
9+
#include "privilege.h"
10+
#include "s_newconf.h"
11+
#include "ircd.h"
12+
13+
static const char extb_desc[] = "Oper name ($o) extban type";
14+
15+
static int _modinit(void);
16+
static void _moddeinit(void);
17+
static int eb_opername(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
18+
19+
DECLARE_MODULE_AV2(extb_opername, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
20+
21+
static int
22+
_modinit(void)
23+
{
24+
extban_table['o'] = eb_opername;
25+
26+
return 0;
27+
}
28+
29+
static void
30+
_moddeinit(void)
31+
{
32+
extban_table['o'] = NULL;
33+
}
34+
35+
static int eb_opername(const char *data, struct Client *client_p,
36+
struct Channel *chptr, long mode_type)
37+
{
38+
39+
if (data != NULL)
40+
return match(client_p->user->opername, data)? EXTBAN_MATCH : EXTBAN_NOMATCH;
41+
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
42+
}
43+

extensions/extb_oper.c renamed to extensions/extb_operpriv.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Oper extban type: matches opers
2+
* Oper priv extban type: matches oper privs and privsets
33
* -- jilles
44
*/
55

@@ -10,29 +10,29 @@
1010
#include "s_newconf.h"
1111
#include "ircd.h"
1212

13-
static const char extb_desc[] = "Oper ($o) extban type";
13+
static const char extb_desc[] = "Oper privilege ($O) extban type";
1414

1515
static int _modinit(void);
1616
static void _moddeinit(void);
17-
static int eb_oper(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
17+
static int eb_operpriv(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
1818

19-
DECLARE_MODULE_AV2(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
19+
DECLARE_MODULE_AV2(extb_operpriv, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
2020

2121
static int
2222
_modinit(void)
2323
{
24-
extban_table['o'] = eb_oper;
24+
extban_table['O'] = eb_operpriv;
2525

2626
return 0;
2727
}
2828

2929
static void
3030
_moddeinit(void)
3131
{
32-
extban_table['o'] = NULL;
32+
extban_table['O'] = NULL;
3333
}
3434

35-
static int eb_oper(const char *data, struct Client *client_p,
35+
static int eb_operpriv(const char *data, struct Client *client_p,
3636
struct Channel *chptr, long mode_type)
3737
{
3838

@@ -51,3 +51,4 @@ static int eb_oper(const char *data, struct Client *client_p,
5151

5252
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
5353
}
54+

0 commit comments

Comments
 (0)