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