aboutsummaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorGravatar jesopo2022-01-01 21:35:47 +0000
committerGravatar jesopo2022-01-01 21:35:47 +0000
commit2c287e33a32cce4da255cc27ded0ac27b9b58d70 (patch)
tree972ca9b0835e7c576d655c098c6153f25c63c88c /extensions
parentchannel: always send chm_hidden modes to servers (diff)
downloadsolanum-jess/extb-opername.tar.gz
solanum-jess/extb-opername.tar.bz2
solanum-jess/extb-opername.zip
move privset extban to $O and add $o extban for oper name jess/extb-opername
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Makefile.am3
-rw-r--r--extensions/extb_opername.c43
-rw-r--r--extensions/extb_operpriv.c (renamed from extensions/extb_oper.c)15
3 files changed, 53 insertions, 8 deletions
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 5fe872dd..cad11375 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -20,7 +20,8 @@ extension_LTLIBRARIES = \
extb_canjoin.la \
extb_channel.la \
extb_hostmask.la \
- extb_oper.la \
+ extb_operpriv.la \
+ extb_opername.la \
extb_server.la \
extb_ssl.la \
extb_realname.la \
diff --git a/extensions/extb_opername.c b/extensions/extb_opername.c
new file mode 100644
index 00000000..01806ab2
--- /dev/null
+++ b/extensions/extb_opername.c
@@ -0,0 +1,43 @@
+/*
+ * Oper name extban type: matches oper names
+ * -- jilles
+ */
+
+#include "stdinc.h"
+#include "modules.h"
+#include "client.h"
+#include "privilege.h"
+#include "s_newconf.h"
+#include "ircd.h"
+
+static const char extb_desc[] = "Oper name ($o) extban type";
+
+static int _modinit(void);
+static void _moddeinit(void);
+static int eb_opername(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
+
+DECLARE_MODULE_AV2(extb_opername, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
+
+static int
+_modinit(void)
+{
+ extban_table['o'] = eb_opername;
+
+ return 0;
+}
+
+static void
+_moddeinit(void)
+{
+ extban_table['o'] = NULL;
+}
+
+static int eb_opername(const char *data, struct Client *client_p,
+ struct Channel *chptr, long mode_type)
+{
+
+ if (data != NULL)
+ return match(client_p->user->opername, data)? EXTBAN_MATCH : EXTBAN_NOMATCH;
+ return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
+}
+
diff --git a/extensions/extb_oper.c b/extensions/extb_operpriv.c
index 0400e724..8fdd0846 100644
--- a/extensions/extb_oper.c
+++ b/extensions/extb_operpriv.c
@@ -1,5 +1,5 @@
/*
- * Oper extban type: matches opers
+ * Oper priv extban type: matches oper privs and privsets
* -- jilles
*/
@@ -10,18 +10,18 @@
#include "s_newconf.h"
#include "ircd.h"
-static const char extb_desc[] = "Oper ($o) extban type";
+static const char extb_desc[] = "Oper privilege ($O) extban type";
static int _modinit(void);
static void _moddeinit(void);
-static int eb_oper(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
+static int eb_operpriv(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
-DECLARE_MODULE_AV2(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
+DECLARE_MODULE_AV2(extb_operpriv, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
static int
_modinit(void)
{
- extban_table['o'] = eb_oper;
+ extban_table['O'] = eb_operpriv;
return 0;
}
@@ -29,10 +29,10 @@ _modinit(void)
static void
_moddeinit(void)
{
- extban_table['o'] = NULL;
+ extban_table['O'] = NULL;
}
-static int eb_oper(const char *data, struct Client *client_p,
+static int eb_operpriv(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
{
@@ -51,3 +51,4 @@ static int eb_oper(const char *data, struct Client *client_p,
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
+