-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcs_successor_freenodestaff.c
44 lines (37 loc) · 1.2 KB
/
cs_successor_freenodestaff.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
/*
* Copyright (c) 2012 Marien Zwart <[email protected]>.
* Rights to this code are as documented in doc/LICENSE.
*
* Forces the successor for single-# channels to be freenode-staff,
* if an account by that name exists.
*/
#include "fn-compat.h"
#include "atheme.h"
static void channel_pick_successor_hook(hook_channel_succession_req_t *req)
{
return_if_fail(req != NULL);
return_if_fail(req->mc != NULL);
/* Leave double-# channels alone. */
if (req->mc->name[0] == '#' && req->mc->name[1] == '#')
return;
/* Use freenode-staff if it exists.
* If myuser_find_ext returns NULL the normal successor logic is used.
* If some other user of this hook picked a successor
* we intentionally overrule it.
*/
req->mu = myuser_find_ext("?AAAAAAABB");
}
static void mod_init(module_t *m)
{
hook_add_first_channel_pick_successor(channel_pick_successor_hook);
}
static void mod_deinit(module_unload_intent_t intent)
{
hook_del_channel_pick_successor(channel_pick_successor_hook);
}
DECLARE_MODULE_V1
(
"freenode/cs_successor_freenodestaff", MODULE_UNLOAD_CAPABILITY_OK, mod_init, mod_deinit,
"$Id: cs_successor_freenodestaff.c 65 2012-06-09 12:25:31Z stephen $",
"freenode <http://freenode.net>"
);