forked from atheme/atheme-contrib-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cs_kickdots.c
50 lines (42 loc) · 996 Bytes
/
cs_kickdots.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (c) 2006 William Pitcock
* Rights to this code are as documented in doc/LICENSE.
*
* Kicks people saying "..." on channels with "kickdots" metadata set.
*
*/
#include "atheme-compat.h"
DECLARE_MODULE_V1
(
"contrib/cs_kickdots", false, _modinit, _moddeinit,
PACKAGE_STRING,
"William Pitcock <nenolod -at- nenolod.net>"
);
static void
on_channel_message(hook_cmessage_data_t *data)
{
if (data != NULL && data->msg != NULL && !strncmp(data->msg, "...", 3))
{
mychan_t *mc = mychan_from(data->c);
if (mc == NULL)
return;
if (metadata_find(mc, "kickdots"))
{
kick(chansvs.me->me, data->c, data->u, data->msg);
}
}
}
void _modinit(module_t *m)
{
hook_add_event("channel_message");
hook_add_channel_message(on_channel_message);
}
void _moddeinit(module_unload_intent_t intent)
{
hook_del_channel_message(on_channel_message);
}
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
* vim:ts=8
* vim:sw=8
* vim:noexpandtab
*/