]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/m_oaccept.c
Recommend EFNet's RBL instead of DroneBL due to trustworthiness issues.
[irc/rqf/shadowircd.git] / extensions / m_oaccept.c
CommitLineData
1fbf6db6
G
1#include "stdinc.h"
2#include "ircd.h"
3#include "client.h"
4#include "modules.h"
5#include "send.h"
6#include "numeric.h"
76db4b42 7#include "hash.h"
1fbf6db6 8
2c0c6904 9static int mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
1fbf6db6
G
10
11struct Message oaccept_msgtab = {
12 "OACCEPT", 0, 0, 0, MFLG_SLOW,
13 {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
14};
15
16mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
17
7bf7fc16 18DECLARE_MODULE_AV1(oaccept, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
1fbf6db6 19
2c0c6904 20static int
1fbf6db6
G
21mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
22{
23 struct Metadata *md;
bc4764ae 24 struct DictionaryIter iter;
1fbf6db6 25 struct Client *target_p;
2498a1b5 26 char text[10];
1fbf6db6
G
27
28 if(!(target_p = find_client(parv[1])))
29 {
30 sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
2c0c6904 31 return 0;
1fbf6db6
G
32 }
33
2498a1b5 34 rb_snprintf(text, sizeof(text), "O%s", source_p->id);
bc4764ae 35
2498a1b5
G
36 /* Provide a nice error message if you try to OACCEPT someone
37 * who you've already OACCEPTed. */
bc4764ae
G
38 DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
39 {
40 if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
75a9b0c8
G
41 {
42 sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
2c0c6904 43 return 0;
75a9b0c8 44 }
bc4764ae 45 }
1fbf6db6 46
bc4764ae 47 user_metadata_add(target_p, text, "OACCEPT", 1);
1fbf6db6
G
48
49 sendto_wallops_flags(UMODE_WALLOP, &me,
50 "OACCEPT called for %s by %s!%s@%s",
51 target_p->name,
52 source_p->name, source_p->username, source_p->host);
18e4f177
G
53 sendto_server(NULL, NULL, NOCAPS, NOCAPS,
54 ":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
55 me.name, target_p->name, source_p->name, source_p->username,
56 source_p->host);
2c0c6904 57 return 0;
1fbf6db6 58}