]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/m_oaccept.c
97748af8336da200115e710ee00c56229b928982
[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 /* Don't allow someone to pointlessly fill up someone's metadata
32 * with identical OACCEPT entries. */
33 if((md = user_metadata_find(target_p, "OACCEPT")))
34 if(!strcmp(source_p->id, md->value))
35 {
36 sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
37 return;
38 }
39
40 user_metadata_add(target_p, "OACCEPT", source_p->id, 1);
41
42 sendto_wallops_flags(UMODE_WALLOP, &me,
43 "OACCEPT called for %s by %s!%s@%s",
44 target_p->name,
45 source_p->name, source_p->username, source_p->host);
46 }