]> jfr.im git - irc/evilnet/x3.git/blame - src/shun.h
Return an error if an extended ban is invalid
[irc/evilnet/x3.git] / src / shun.h
CommitLineData
d914d1cb 1/* shun.h - Shun database
2 * Copyright 2001-2004 srvx Development Team
3 *
4 * This file is part of x3.
5 *
d0f04f71 6 * x3 is free software; you can redistribute it and/or modify
d914d1cb 7 * it under the terms of the GNU General Public License as published by
348683aa 8 * the Free Software Foundation; either version 3 of the License, or
d914d1cb 9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 */
20
21#ifndef SHUN_H
22#define SHUN_H
23
24#include "hash.h"
25
26struct shun {
27 time_t issued;
1136f709 28 time_t lastmod;
d914d1cb 29 time_t expires;
30 char *issuer;
31 char *target;
32 char *reason;
33};
34
35struct shun_discrim {
36 unsigned int limit;
37 enum { SSUBSET, SEXACT, SSUPERSET } target_mask_type;
38 char *issuer_mask;
39 char *target_mask;
40 char *alt_target_mask;
41 char *reason_mask;
42 time_t max_issued;
43 time_t min_expire;
1136f709 44 time_t min_lastmod;
45 time_t max_lastmod;
d914d1cb 46};
47
48void shun_init(void);
1136f709 49struct shun *shun_add(const char *issuer, const char *target, unsigned long duration, const char *reason, time_t issued, time_t lastmod, int announce);
d914d1cb 50struct shun *shun_find(const char *target);
51int shun_remove(const char *target, int announce);
52void shun_refresh_server(struct server *srv);
53void shun_refresh_all(void);
54unsigned int shun_count(void);
55
56typedef void (*shun_search_func)(struct shun *shun, void *extra);
57struct shun_discrim *shun_discrim_create(struct userNode *user, struct userNode *src, unsigned int argc, char *argv[]);
58unsigned int shun_discrim_search(struct shun_discrim *discrim, shun_search_func gsf, void *data);
59
60#endif /* !defined(SHUN_H) */