Debian Codegraph @

modules/contrib/src/cs_kickdots.c

raw
1 /*
2 * Copyright (c) 2006 William Pitcock
3 * Rights to this code are as documented in doc/LICENSE.
4 *
5 * Kicks people saying "..." on channels with "kickdots" metadata set.
6 */
7
8 #include "atheme-compat.h"
9
10 static void
11 on_channel_message(hook_cmessage_data_t *data)
12 {
13 if (data != NULL && data->msg != NULL && !strncmp(data->msg, "...", 3))
14 {
15 mychan_t *mc = mychan_from(data->c);
16
17 if (mc == NULL)
18 return;
19
20 if (metadata_find(mc, "kickdots"))
21 {
22 kick(chansvs.me->me, data->c, data->u, data->msg);
23 }
24 }
25 }
26
27 static void
28 mod_init(module_t *const restrict m)
29 {
30 hook_add_event("channel_message");
31 hook_add_channel_message(on_channel_message);
32 }
33
34 static void
35 mod_deinit(const module_unload_intent_t intent)
36 {
37 hook_del_channel_message(on_channel_message);
38 }
39
40 VENDOR_DECLARE_MODULE_V1("contrib/cs_kickdots", MODULE_UNLOAD_CAPABILITY_OK, CONTRIB_VENDOR_NENOLOD)