f5efe9deebd2fbc9ea7baef1f4e4fe080a6cb87b
[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     0x0001
49 #define JUPE_LOCAL      0x0002
50 #define JUPE_LDEACT     0x0004  /* locally deactivated */
51
52 #define JUPE_MASK       (JUPE_ACTIVE | JUPE_LOCAL)
53 #define JUPE_ACTMASK    (JUPE_ACTIVE | JUPE_LDEACT)
54
55 #define JupeIsActive(j)         (((j)->ju_flags & JUPE_ACTMASK) == JUPE_ACTIVE)
56 #define JupeIsRemActive(j)      ((j)->ju_flags & JUPE_ACTIVE)
57 #define JupeIsLocal(j)          ((j)->ju_flags & JUPE_LOCAL)
58
59 #define JupeServer(j)           ((j)->ju_server)
60 #define JupeReason(j)           ((j)->ju_reason)
61 #define JupeLastMod(j)          ((j)->ju_lastmod)
62
63 extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
64                     char *reason, time_t expire, time_t lastmod,
65                     unsigned int flags);
66 extern int jupe_activate(struct Client *cptr, struct Client *sptr,
67                          struct Jupe *jupe, time_t lastmod,
68                          unsigned int flags);
69 extern int jupe_deactivate(struct Client *cptr, struct Client *sptr,
70                            struct Jupe *jupe, time_t lastmod,
71                            unsigned int flags);
72 extern struct Jupe* jupe_find(char *server);
73 extern void jupe_free(struct Jupe *jupe);
74 extern void jupe_burst(struct Client *cptr);
75 extern int jupe_resend(struct Client *cptr, struct Jupe *jupe);
76 extern int jupe_list(struct Client *sptr, char *server);
77
78 #endif /* INCLUDED_jupe_h */