Add extensions/m_oaccept , a module to allow opers to bypass +gGR with a command.
This commit is contained in:
parent
5b453fee2a
commit
1fbf6db662
|
@ -31,6 +31,7 @@ loadmodule "extensions/ip_cloaking.so";
|
||||||
loadmodule "extensions/m_identify.so";
|
loadmodule "extensions/m_identify.so";
|
||||||
loadmodule "extensions/m_mkpasswd.so";
|
loadmodule "extensions/m_mkpasswd.so";
|
||||||
#loadmodule "extensions/m_adminwall.so";
|
#loadmodule "extensions/m_adminwall.so";
|
||||||
|
#loadmodule "extensions/m_oaccept.so";
|
||||||
#loadmodule "extensions/m_opme.so";
|
#loadmodule "extensions/m_opme.so";
|
||||||
#loadmodule "extensions/m_ojoin.so";
|
#loadmodule "extensions/m_ojoin.so";
|
||||||
#loadmodule "extensions/m_omode.so";
|
#loadmodule "extensions/m_omode.so";
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
* /identify support -- m_identify.so
|
* /identify support -- m_identify.so
|
||||||
* /mkpassword support -- m_mkpasswd.so
|
* /mkpassword support -- m_mkpasswd.so
|
||||||
* Send message to all admins network-wide -- m_adminwall.so
|
* Send message to all admins network-wide -- m_adminwall.so
|
||||||
|
* /oaccept - add to target's accept list, oper only -- m_oaccepet.so
|
||||||
* /opme - op self in opless channels, admin only -- m_opme.so
|
* /opme - op self in opless channels, admin only -- m_opme.so
|
||||||
* /ojoin - join despite restrictions, admin only -- m_ojoin.so
|
* /ojoin - join despite restrictions, admin only -- m_ojoin.so
|
||||||
* /omode - force modes in channels, admin only -- m_omode.so
|
* /omode - force modes in channels, admin only -- m_omode.so
|
||||||
|
@ -98,6 +99,7 @@ loadmodule "extensions/ip_cloaking.so";
|
||||||
loadmodule "extensions/m_identify.so";
|
loadmodule "extensions/m_identify.so";
|
||||||
loadmodule "extensions/m_mkpasswd.so";
|
loadmodule "extensions/m_mkpasswd.so";
|
||||||
#loadmodule "extensions/m_adminwall.so";
|
#loadmodule "extensions/m_adminwall.so";
|
||||||
|
#loadmodule "extensions/m_oaccept.so";
|
||||||
#loadmodule "extensions/m_opme.so";
|
#loadmodule "extensions/m_opme.so";
|
||||||
#loadmodule "extensions/m_ojoin.so";
|
#loadmodule "extensions/m_ojoin.so";
|
||||||
#loadmodule "extensions/m_omode.so";
|
#loadmodule "extensions/m_omode.so";
|
||||||
|
|
|
@ -57,6 +57,7 @@ SRCS = \
|
||||||
m_force.c \
|
m_force.c \
|
||||||
m_identify.c \
|
m_identify.c \
|
||||||
m_mkpasswd.c \
|
m_mkpasswd.c \
|
||||||
|
m_oaccept.c \
|
||||||
m_ojoin.c \
|
m_ojoin.c \
|
||||||
m_olist.c \
|
m_olist.c \
|
||||||
m_okick.c \
|
m_okick.c \
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include "stdinc.h"
|
||||||
|
#include "ircd.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "modules.h"
|
||||||
|
#include "send.h"
|
||||||
|
#include "numeric.h"
|
||||||
|
|
||||||
|
void mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||||
|
|
||||||
|
struct Message oaccept_msgtab = {
|
||||||
|
"OACCEPT", 0, 0, 0, MFLG_SLOW,
|
||||||
|
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
|
||||||
|
};
|
||||||
|
|
||||||
|
mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
|
||||||
|
|
||||||
|
DECLARE_MODULE_AV1(omode, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
|
||||||
|
|
||||||
|
void
|
||||||
|
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||||
|
{
|
||||||
|
struct Metadata *md;
|
||||||
|
struct Client *target_p;
|
||||||
|
|
||||||
|
if(!(target_p = find_client(parv[1])))
|
||||||
|
{
|
||||||
|
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* only allow one OACCEPT entry per user, so if there's an old one clear it */
|
||||||
|
if(!(md = user_metadata_find(target_p, "OACCEPT")))
|
||||||
|
user_metadata_delete(target_p, "OACCEPT", 1);
|
||||||
|
|
||||||
|
user_metadata_add(target_p, "OACCEPT", source_p->name, 1);
|
||||||
|
|
||||||
|
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||||
|
"OACCEPT called for %s by %s!%s@%s",
|
||||||
|
target_p->name,
|
||||||
|
source_p->name, source_p->username, source_p->host);
|
||||||
|
}
|
|
@ -712,6 +712,7 @@ msg_client(int p_or_n, const char *command,
|
||||||
struct Client *source_p, struct Client *target_p, const char *text)
|
struct Client *source_p, struct Client *target_p, const char *text)
|
||||||
{
|
{
|
||||||
int do_floodcount = 0;
|
int do_floodcount = 0;
|
||||||
|
struct Metadata *md;
|
||||||
|
|
||||||
if(MyClient(source_p))
|
if(MyClient(source_p))
|
||||||
{
|
{
|
||||||
|
@ -767,13 +768,14 @@ msg_client(int p_or_n, const char *command,
|
||||||
form_str(ERR_NOCTCP),
|
form_str(ERR_NOCTCP),
|
||||||
target_p->name);
|
target_p->name);
|
||||||
}
|
}
|
||||||
/* XXX Controversial? allow opers always to send through a +g */
|
/* If opers want to go through +g, they should load oaccept.*/
|
||||||
else if(!IsServer(source_p) && (IsSetCallerId(target_p) ||
|
else if(!IsServer(source_p) && (IsSetCallerId(target_p) ||
|
||||||
(IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) ||
|
(IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) ||
|
||||||
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])))
|
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])))
|
||||||
{
|
{
|
||||||
|
md = user_metadata_find(target_p, "OACCEPT");
|
||||||
/* Here is the anti-flood bot/spambot code -db */
|
/* Here is the anti-flood bot/spambot code -db */
|
||||||
if(accept_message(source_p, target_p) || IsOper(source_p))
|
if(accept_message(source_p, target_p))
|
||||||
{
|
{
|
||||||
add_reply_target(target_p, source_p);
|
add_reply_target(target_p, source_p);
|
||||||
sendto_one(target_p, ":%s!%s@%s %s %s :%s",
|
sendto_one(target_p, ":%s!%s@%s %s %s :%s",
|
||||||
|
@ -781,6 +783,18 @@ msg_client(int p_or_n, const char *command,
|
||||||
source_p->username,
|
source_p->username,
|
||||||
source_p->host, command, target_p->name, text);
|
source_p->host, command, target_p->name, text);
|
||||||
}
|
}
|
||||||
|
/* slightly ugly, meh. if anyone can think of a cleaner way to do this, by all means, do it. */
|
||||||
|
else if(md)
|
||||||
|
{
|
||||||
|
if(!strcmp(md->value, source_p->name))
|
||||||
|
{
|
||||||
|
add_reply_target(target_p, source_p);
|
||||||
|
sendto_one(target_p, ":%s!%s@%s %s %s :%s",
|
||||||
|
source_p->name,
|
||||||
|
source_p->username,
|
||||||
|
source_p->host, command, target_p->name, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])
|
else if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])
|
||||||
{
|
{
|
||||||
if (p_or_n != NOTICE)
|
if (p_or_n != NOTICE)
|
||||||
|
|
Loading…
Reference in New Issue