]> jfr.im git - solanum.git/blame - extensions/sno_channelcreate.c
Remove Windows support
[solanum.git] / extensions / sno_channelcreate.c
CommitLineData
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 14
eeabf33a
EM
15static const char sno_desc[] =
16 "Adds server notice mask +l that allows operators to receive channel creation notices";
17
03906030
AC
18static int _modinit(void);
19static void _moddeinit(void);
20static void h_scc_channel_join(void *);
21
22mapi_hfn_list_av1 scc_hfnlist[] = {
23 { "channel_join", (hookfn) h_scc_channel_join },
24 { NULL, NULL }
25};
26
84b4c058 27DECLARE_MODULE_AV2(sno_channelcreate, _modinit, _moddeinit, NULL, NULL, scc_hfnlist, NULL, NULL, sno_desc);
03906030
AC
28
29static int
30_modinit(void)
31{
32 /* add the snomask to the available slot */
33 snomask_modes['l'] = find_snomask_slot();
34
35 return 0;
36}
37
38static void
39_moddeinit(void)
40{
41 /* disable the snomask and remove it from the available list */
42 snomask_modes['l'] = 0;
43}
44
45
46static void
47h_scc_channel_join(void *vdata)
48{
49 hook_data_channel_activity *data = (hook_data_channel_activity *)vdata;
50 struct Channel *chptr = data->chptr;
51 struct Client *source_p = data->client;
52
53 /* If they just joined a channel, and it only has one member, then they just created it. */
54 if(rb_dlink_list_length(&chptr->members) == 1 && is_chanop(find_channel_membership(chptr, source_p)))
55 {
56 sendto_realops_snomask(snomask_modes['l'], L_NETWIDE, "%s is creating new channel %s",
57 source_p->name, chptr->chname);
58 }
59}