]>
Commit | Line | Data |
---|---|---|
03906030 AC |
1 | /* |
2 | * Channel creation notices | |
03906030 AC |
3 | */ |
4 | ||
5 | #include "stdinc.h" | |
6 | #include "modules.h" | |
7 | #include "client.h" | |
8 | #include "hook.h" | |
9 | #include "ircd.h" | |
10 | #include "send.h" | |
11 | #include "s_conf.h" | |
12 | #include "snomask.h" | |
fe037171 | 13 | #include "rb_lib.h" |
03906030 AC |
14 | |
15 | static int _modinit(void); | |
16 | static void _moddeinit(void); | |
17 | static void h_scc_channel_join(void *); | |
18 | ||
19 | mapi_hfn_list_av1 scc_hfnlist[] = { | |
20 | { "channel_join", (hookfn) h_scc_channel_join }, | |
21 | { NULL, NULL } | |
22 | }; | |
23 | ||
24 | DECLARE_MODULE_AV1(sno_channelcreate, _modinit, _moddeinit, NULL, NULL, scc_hfnlist, "$Revision: 639 $"); | |
25 | ||
26 | static int | |
27 | _modinit(void) | |
28 | { | |
29 | /* add the snomask to the available slot */ | |
30 | snomask_modes['l'] = find_snomask_slot(); | |
31 | ||
32 | return 0; | |
33 | } | |
34 | ||
35 | static void | |
36 | _moddeinit(void) | |
37 | { | |
38 | /* disable the snomask and remove it from the available list */ | |
39 | snomask_modes['l'] = 0; | |
40 | } | |
41 | ||
42 | ||
43 | static void | |
44 | h_scc_channel_join(void *vdata) | |
45 | { | |
46 | hook_data_channel_activity *data = (hook_data_channel_activity *)vdata; | |
47 | struct Channel *chptr = data->chptr; | |
48 | struct Client *source_p = data->client; | |
49 | ||
50 | /* If they just joined a channel, and it only has one member, then they just created it. */ | |
51 | if(rb_dlink_list_length(&chptr->members) == 1 && is_chanop(find_channel_membership(chptr, source_p))) | |
52 | { | |
53 | sendto_realops_snomask(snomask_modes['l'], L_NETWIDE, "%s is creating new channel %s", | |
54 | source_p->name, chptr->chname); | |
55 | } | |
56 | } |