- The big forward port. I probably broke lots of stuff, so please look over any
[ircu2.10.12-pk.git] / include / motd.h
1 #ifndef INCLUDED_motd_h
2 #define INCLUDED_motd_h
3 /*
4  * IRC - Internet Relay Chat, include/motd.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_time_h
26 #include <time.h>               /* struct tm */
27 #define INCLUDED_time_h
28 #endif
29 #ifndef INCLUDED_sys_types_h
30 #include <sys/types.h>
31 #define INCLUDED_sys_types_h
32 #endif
33
34
35 struct Client;
36 struct TRecord;
37 struct StatDesc;
38
39 struct Motd {
40   struct Motd*          next;
41   int                   type;
42   /* Used for classname if it is a class. */
43   char*         hostmask;
44   char*                 path;
45   int                   maxcount;
46   struct MotdCache*     cache;
47 };
48
49 #define MOTD_UNIVERSAL  0       /* MOTD selected by no criteria */
50 #define MOTD_HOSTMASK   1       /* MOTD selected by hostmask */
51 #define MOTD_CLASS      2       /* MOTD selected by connection class */
52
53 #define MOTD_LINESIZE   81      /* 80 chars + '\0' */
54 #define MOTD_MAXLINES   100
55 #define MOTD_MAXREMOTE  3
56
57 struct MotdCache {
58   struct MotdCache*     next; /* these fields let us read MOTDs only once */
59   struct MotdCache**    prev_p;
60   int                   ref;
61   char*                 path;
62   int                   maxcount;
63   struct tm             modtime;
64   int                   count;
65   char                  motd[1][MOTD_LINESIZE];
66 };
67
68 /* motd_send sends a MOTD off to a user */
69 int motd_send(struct Client* cptr);
70
71 /* motd_signon sends a MOTD off to a newly-registered user */
72 void motd_signon(struct Client* cptr);
73
74 /* motd_recache causes all the MOTD caches to be cleared */
75 void motd_recache(void);
76
77 /* motd_init initializes the MOTD routines, including reading the
78  * ircd.motd and remote.motd files into cache
79  */
80 void motd_init(void);
81
82 /* This routine adds a MOTD */
83 void motd_add(const char *hostmask, const char *path);
84
85 /* This routine clears the list of MOTDs */
86 void motd_clear(void);
87
88 /* This is called to report T-lines */
89 void motd_report(struct Client *to, struct StatDesc *sd, int stat,
90                  char *param);
91 void motd_memory_count(struct Client *cptr);
92
93 #endif /* INCLUDED_motd_h */