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_sys_types_h
26 #include <sys/types.h>
27 #define INCLUDED_sys_types_h
28 #endif
29
30
31 struct Client;
32
33 #define JUPE_MAX_EXPIRE 604800  /* max expire: 7 days */
34
35 struct Jupe {
36   struct Jupe*   ju_next;
37   struct Jupe**  ju_prev_p;
38   char*          ju_server;
39   char*          ju_reason;
40   time_t         ju_expire;
41   time_t         ju_lastmod;
42   unsigned int   ju_flags;
43 };
44
45 #define JUPE_ACTIVE     0x0001
46 #define JUPE_LOCAL      0x0002
47 #define JUPE_LDEACT     0x0004  /* locally deactivated */
48
49 #define JUPE_MASK       (JUPE_ACTIVE | JUPE_LOCAL)
50 #define JUPE_ACTMASK    (JUPE_ACTIVE | JUPE_LDEACT)
51
52 #define JupeIsActive(j)         (((j)->ju_flags & JUPE_ACTMASK) == JUPE_ACTIVE)
53 #define JupeIsRemActive(j)      ((j)->ju_flags & JUPE_ACTIVE)
54 #define JupeIsLocal(j)          ((j)->ju_flags & JUPE_LOCAL)
55
56 #define JupeServer(j)           ((j)->ju_server)
57 #define JupeReason(j)           ((j)->ju_reason)
58 #define JupeLastMod(j)          ((j)->ju_lastmod)
59
60 extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
61                     char *reason, time_t expire, time_t lastmod,
62                     unsigned int flags);
63 extern int jupe_activate(struct Client *cptr, struct Client *sptr,
64                          struct Jupe *jupe, time_t lastmod,
65                          unsigned int flags);
66 extern int jupe_deactivate(struct Client *cptr, struct Client *sptr,
67                            struct Jupe *jupe, time_t lastmod,
68                            unsigned int flags);
69 extern struct Jupe* jupe_find(char *server);
70 extern void jupe_free(struct Jupe *jupe);
71 extern void jupe_burst(struct Client *cptr);
72 extern int jupe_resend(struct Client *cptr, struct Jupe *jupe);
73 extern int jupe_list(struct Client *sptr, char *server);
74
75 #endif /* INCLUDED_jupe_h */