File: validation.c

package info (click to toggle)
atheme-services 7.2.12-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,256 kB
  • sloc: ansic: 95,899; sh: 8,462; php: 5,032; perl: 3,327; makefile: 1,279; sed: 16; ruby: 15; python: 3
file content (48 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (6)
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
/* groupserv - group services.
 * Copyright (c) 2010 Atheme Development Group
 */

#include "groupserv_main.h"

static chanacs_t *mygroup_chanacs_match_entity(chanacs_t *ca, myentity_t *mt)
{
	mygroup_t *mg;

	mg = group(ca->entity);

	return_val_if_fail(mg != NULL, NULL);

	if (!isuser(mt))
		return NULL;

	return groupacs_find(mg, mt, GA_CHANACS, true) != NULL ? ca : NULL;
}

static bool mygroup_can_register_channel(myentity_t *mt)
{
	mygroup_t *mg;

	mg = group(mt);

	return_val_if_fail(mg != NULL, false);

	if (mg->flags & MG_REGNOLIMIT)
		return true;

	return false;
}

static bool mygroup_allow_foundership(myentity_t *mt)
{
	return true;
}

static entity_chanacs_validation_vtable_t mygroup_chanacs_validate = {
	.match_entity = mygroup_chanacs_match_entity,
	.can_register_channel = mygroup_can_register_channel,
	.allow_foundership = mygroup_allow_foundership,
};

void mygroup_set_chanacs_validator(myentity_t *mt) {
	mt->chanacs_validate = &mygroup_chanacs_validate;
}