1 /* groupserv - group services.
2  * Copyright (c) 2010 Atheme Development Group
3  */
4 
5 #include "groupserv_main.h"
6 
mygroup_chanacs_match_entity(chanacs_t * ca,myentity_t * mt)7 static chanacs_t *mygroup_chanacs_match_entity(chanacs_t *ca, myentity_t *mt)
8 {
9 	mygroup_t *mg;
10 
11 	mg = group(ca->entity);
12 
13 	return_val_if_fail(mg != NULL, NULL);
14 
15 	if (!isuser(mt))
16 		return NULL;
17 
18 	return groupacs_find(mg, mt, GA_CHANACS, true) != NULL ? ca : NULL;
19 }
20 
mygroup_can_register_channel(myentity_t * mt)21 static bool mygroup_can_register_channel(myentity_t *mt)
22 {
23 	mygroup_t *mg;
24 
25 	mg = group(mt);
26 
27 	return_val_if_fail(mg != NULL, false);
28 
29 	if (mg->flags & MG_REGNOLIMIT)
30 		return true;
31 
32 	return false;
33 }
34 
mygroup_allow_foundership(myentity_t * mt)35 static bool mygroup_allow_foundership(myentity_t *mt)
36 {
37 	return true;
38 }
39 
40 static entity_chanacs_validation_vtable_t mygroup_chanacs_validate = {
41 	.match_entity = mygroup_chanacs_match_entity,
42 	.can_register_channel = mygroup_can_register_channel,
43 	.allow_foundership = mygroup_allow_foundership,
44 };
45 
mygroup_set_chanacs_validator(myentity_t * mt)46 void mygroup_set_chanacs_validator(myentity_t *mt) {
47 	mt->chanacs_validate = &mygroup_chanacs_validate;
48 }
49