]>
Commit | Line | Data |
---|---|---|
1e25cb1e G |
1 | #include "stdinc.h" |
2 | ||
3 | #include "send.h" | |
4 | #include "channel.h" | |
5 | #include "client.h" | |
6 | #include "common.h" | |
7 | #include "config.h" | |
8 | #include "ircd.h" | |
9 | #include "numeric.h" | |
10 | #include "s_conf.h" | |
11 | #include "s_newconf.h" | |
12 | #include "s_serv.h" | |
13 | #include "hash.h" | |
14 | #include "msg.h" | |
15 | #include "parse.h" | |
16 | #include "modules.h" | |
17 | #include "whowas.h" | |
18 | #include "monitor.h" | |
19 | ||
2c0c6904 | 20 | static int me_metadata(struct Client *, struct Client *, int, const char **); |
1e25cb1e G |
21 | |
22 | struct Message metadata_msgtab = { | |
23 | "METADATA", 0, 0, 0, MFLG_SLOW, | |
24 | {mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_metadata, 3}, mg_ignore} | |
25 | }; | |
26 | ||
27 | mapi_clist_av1 metadata_clist[] = { | |
28 | &metadata_msgtab, NULL | |
29 | }; | |
30 | ||
31 | DECLARE_MODULE_AV1(metadata, NULL, NULL, metadata_clist, NULL, NULL, "$Revision$"); | |
32 | ||
2c0c6904 | 33 | static int |
1e25cb1e G |
34 | me_metadata(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) |
35 | { | |
6f659342 G |
36 | if(parv[2][0] == '#') |
37 | { | |
38 | struct Channel *chptr; | |
1e25cb1e | 39 | |
6f659342 | 40 | if((chptr = find_channel(parv[2])) == NULL) |
2c0c6904 | 41 | return 0; |
1e25cb1e | 42 | |
6f659342 G |
43 | if(!strcmp(parv[1], "ADD") && parv[4] != NULL) |
44 | channel_metadata_add(chptr, parv[3], parv[4], 0); | |
45 | if(!strcmp(parv[1], "DELETE") && parv[3] != NULL) | |
46 | channel_metadata_delete(chptr, parv[3], 0); | |
47 | } | |
1e25cb1e | 48 | |
6f659342 G |
49 | else |
50 | { | |
51 | struct Client *target_p; | |
52 | ||
0fbe4a38 | 53 | if((target_p = find_id(parv[2])) == NULL) |
2c0c6904 | 54 | return 0; |
6f659342 G |
55 | |
56 | if(!target_p->user) | |
2c0c6904 | 57 | return 0; |
6f659342 G |
58 | |
59 | if(!strcmp(parv[1], "ADD") && parv[4] != NULL) | |
60 | user_metadata_add(target_p, parv[3], parv[4], 0); | |
61 | if(!strcmp(parv[1], "DELETE") && parv[3] != NULL) | |
62 | user_metadata_delete(target_p, parv[3], 0); | |
63 | } | |
2c0c6904 | 64 | return 0; |
6f659342 | 65 | } |