Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / include / jupe.h
1 #ifndef INCLUDED_jupe_h
2 #define INCLUDED_jupe_h
3 /*
4  * IRC - Internet Relay Chat, include/jupe.h
5  * Copyright (C) 1990 Jarkko Oikarinen and
6  *                    University of Oulu, Computing Center
7  * Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id$
24  */
25 #ifndef INCLUDED_config_h
26 #include "config.h"
27 #endif
28 #ifndef INCLUDED_sys_types_h
29 #include <sys/types.h>
30 #define INCLUDED_sys_types_h
31 #endif
32
33
34 struct Client;
35
36 #define JUPE_MAX_EXPIRE 604800  /* max expire: 7 days */
37
38 struct Jupe {
39   struct Jupe*   ju_next;
40   struct Jupe**  ju_prev_p;
41   char*          ju_server;
42   char*          ju_reason;
43   time_t         ju_expire;
44   time_t         ju_lastmod;
45   unsigned int   ju_flags;
46 };
47
48 #define JUPE_ACTIVE     1
49 #define JUPE_LOCAL      2
50
51 #define JupeIsActive(j)         ((j)->ju_flags & JUPE_ACTIVE)
52 #define JupeIsLocal(j)          ((j)->ju_flags & JUPE_LOCAL)
53
54 #define JupeServer(j)           ((j)->ju_server)
55 #define JupeReason(j)           ((j)->ju_reason)
56 #define JupeLastMod(j)          ((j)->ju_lastmod)
57
58 extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
59                     char *reason, time_t expire, time_t lastmod,
60                     unsigned int flags);
61 extern int jupe_activate(struct Client *cptr, struct Client *sptr,
62                          struct Jupe *jupe, time_t lastmod,
63                          unsigned int flags);
64 extern int jupe_deactivate(struct Client *cptr, struct Client *sptr,
65                            struct Jupe *jupe, time_t lastmod,
66                            unsigned int flags);
67 extern struct Jupe* jupe_find(char *server);
68 extern void jupe_free(struct Jupe *jupe);
69 extern void jupe_burst(struct Client *cptr);
70 extern int jupe_resend(struct Client *cptr, struct Jupe *jupe);
71 extern int jupe_list(struct Client *sptr, char *server);
72
73 #endif /* INCLUDED_jupe_h */