]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/m_oaccept.c
Add extensions/m_oaccept , a module to allow opers to bypass +gGR with a command.
[irc/rqf/shadowircd.git] / extensions / m_oaccept.c
1 #include "stdinc.h"
2 #include "ircd.h"
3 #include "client.h"
4 #include "modules.h"
5 #include "send.h"
6 #include "numeric.h"
7
8 void mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
9
10 struct Message oaccept_msgtab = {
11 "OACCEPT", 0, 0, 0, MFLG_SLOW,
12 {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
13 };
14
15 mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
16
17 DECLARE_MODULE_AV1(omode, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
18
19 void
20 mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
21 {
22 struct Metadata *md;
23 struct Client *target_p;
24
25 if(!(target_p = find_client(parv[1])))
26 {
27 sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
28 return;
29 }
30
31 /* only allow one OACCEPT entry per user, so if there's an old one clear it */
32 if(!(md = user_metadata_find(target_p, "OACCEPT")))
33 user_metadata_delete(target_p, "OACCEPT", 1);
34
35 user_metadata_add(target_p, "OACCEPT", source_p->name, 1);
36
37 sendto_wallops_flags(UMODE_WALLOP, &me,
38 "OACCEPT called for %s by %s!%s@%s",
39 target_p->name,
40 source_p->name, source_p->username, source_p->host);
41 }