* When translating the input from a REGI command into a vCard, set the telephone...
[citadel.git] / citadel / citadel.h
blobd8ad296d41df387c3effedc0d1fe730f780bb31d
1 /*
2 * $Id$
4 * Main Citadel header file
5 * See copyright.txt for copyright information.
6 */
8 /* system customizations are in sysconfig.h */
10 #ifndef CITADEL_H
11 #define CITADEL_H
12 /* #include <dmalloc.h> uncomment if using dmalloc */
14 #include "sysdep.h"
15 #include <limits.h>
16 #include "sysconfig.h"
17 #include "typesize.h"
18 #include "ipcdef.h"
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
25 * Text description of this software
26 * (We used to define this ourselves, but why bother when
27 * the GNU build tools do it for us?)
29 #define CITADEL PACKAGE_STRING
32 * REV_LEVEL is the current version number (multiplied by 100 to avoid having
33 * to fiddle with the decimal). REV_MIN is the oldest version of Citadel
34 * whose data files are compatible with the current version. If the data files
35 * are older than REV_MIN, none of the programs will work until the setup
36 * program is run again to bring things up to date. EXPORT_REV_MIN is the
37 * oldest version of Citadel whose export files we can read. The latter is
38 * usually more strict because you're not really supposed to dump/load and
39 * upgrade at the same time.
41 #define REV_LEVEL 741 /* This version */
42 #define REV_MIN 591 /* Oldest compatible database */
43 #define EXPORT_REV_MIN 737 /* Oldest compatible export files */
44 #define LIBCITADEL_MIN 741 /* Minimum required version of libcitadel */
46 #define SERVER_TYPE 0 /* zero for stock Citadel; other developers please
47 obtain SERVER_TYPE codes for your implementations */
49 #ifdef LIBCITADEL_VERSION_NUMBER
50 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
51 #error libcitadel is too old. Please upgrade it before continuing.
52 #endif
53 #endif
55 /* Various length constants */
57 #define UGLISTLEN 100 /* you get a ungoto list of this size */
58 #define ROOMNAMELEN 128 /* The size of a roomname string */
59 #define NONCE_SIZE 128 /* Added by <bc> to allow for APOP auth
60 * it is BIG becuase there is a hostname
61 * in the nonce, as per the APOP RFC.
64 #define USERNAME_SIZE 64 /* The size of a username string */
65 #define MAX_EDITORS 5 /* # of external editors supported */
66 /* MUST be at least 1 */
69 * Message expiration policy stuff
71 typedef struct ExpirePolicy ExpirePolicy;
72 struct ExpirePolicy {
74 #include "datadefinitions.h"
75 #include "dtds/expirepolicy-defs.h"
76 #include "undef_data.h"
78 int expire_mode;
79 int expire_value;
82 #define EXPIRE_NEXTLEVEL 0 /* Inherit expiration policy */
83 #define EXPIRE_MANUAL 1 /* Don't expire messages at all */
84 #define EXPIRE_NUMMSGS 2 /* Keep only latest n messages */
85 #define EXPIRE_AGE 3 /* Expire messages after n days */
89 * This struct stores a list of rooms with new messages which the client
90 * fetches from the server. This allows the client to "march" through
91 * relevant rooms without having to ask the server each time where to go next.
93 typedef struct march march;
94 struct march {
96 #include "datadefinitions.h"
97 #include "dtds/march-defs.h"
98 #include "undef_data.h"
100 struct march *next;
101 char march_name[ROOMNAMELEN];
102 unsigned int march_flags;
103 char march_floor;
104 char march_order;
105 unsigned int march_flags2;
106 int march_access;
109 #define NODENAME config.c_nodename
110 #define FQDN config.c_fqdn
111 #define HUMANNODE config.c_humannode
112 #define PHONENUM config.c_phonenum
113 #define CTDLUID config.c_ctdluid
114 #define CREATAIDE config.c_creataide
115 #define REGISCALL config.c_regiscall
116 #define TWITDETECT config.c_twitdetect
117 #define TWITROOM config.c_twitroom
118 #define RESTRICT_INTERNET config.c_restrict
121 * User records.
123 typedef struct ctdluser ctdluser;
124 struct ctdluser { /* User record */
126 #include "datadefinitions.h"
127 #include "dtds/user-defs.h"
128 #include "undef_data.h"
130 int version; /* Cit vers. which created this rec */
131 uid_t uid; /* Associate with a unix account? */
132 char password[32]; /* password */
133 unsigned flags; /* See US_ flags below */
134 long timescalled; /* Total number of logins */
135 long posted; /* Number of messages ever submitted */
136 cit_uint8_t axlevel; /* Access level */
137 long usernum; /* User number (never recycled) */
138 time_t lastcall; /* Date/time of most recent login */
139 int USuserpurge; /* Purge time (in days) for user */
140 char fullname[64]; /* Display name (primary identifier) */
141 cit_uint8_t USscreenwidth; /* Screen width (for textmode users) */
142 cit_uint8_t USscreenheight; /* Screen height(for textmode users) */
146 /* Bits which may appear in CitControl.MMflags. Note that these don't
147 * necessarily pertain to the message base -- it's just a good place to
148 * store any global flags.
150 #define MM_VALID 4 /* New users need validating */
153 * Room records.
155 typedef struct ctdlroom ctdlroom;
156 struct ctdlroom {
158 #include "datadefinitions.h"
159 #include "dtds/room-defs.h"
160 #include "undef_data.h"
162 char QRname[ROOMNAMELEN]; /* Name of room */
163 char QRpasswd[10]; /* Only valid if it's a private rm */
164 long QRroomaide; /* User number of room aide */
165 long QRhighest; /* Highest message NUMBER in room */
166 time_t QRgen; /* Generation number of room */
167 unsigned QRflags; /* See flag values below */
168 char QRdirname[15]; /* Directory name, if applicable */
169 long QRinfo; /* Info file update relative to msgs*/
170 char QRfloor; /* Which floor this room is on */
171 time_t QRmtime; /* Date/time of last post */
172 struct ExpirePolicy QRep; /* Message expiration policy */
173 long QRnumber; /* Globally unique room number */
174 char QRorder; /* Sort key for room listing order */
175 unsigned QRflags2; /* Additional flags */
176 int QRdefaultview; /* How to display the contents */
179 /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
180 * or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
181 * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
182 * flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
186 * Miscellaneous
188 #define MES_NORMAL 65 /* Normal message */
189 #define MES_ANONONLY 66 /* "****" header */
190 #define MES_ANONOPT 67 /* "Anonymous" header */
192 #define MES_ERROR (-1) /* Can't send message due to bad address */
193 #define MES_LOCAL 0 /* Local message, do no network processing */
194 #define MES_INTERNET 1 /* Convert msg and send as Internet mail */
195 #define MES_IGNET 2 /* Process recipient and send via Cit net */
197 /****************************************************************************/
200 * Floor record. The floor number is implicit in its location in the file.
202 typedef struct floor floor;
203 struct floor {
205 #include "datadefinitions.h"
206 #include "dtds/floor-defs.h"
207 #include "undef_data.h"
209 unsigned short f_flags; /* flags */
210 char f_name[256]; /* name of floor */
211 int f_ref_count; /* reference count */
212 struct ExpirePolicy f_ep; /* default expiration policy */
215 #define F_INUSE 1 /* floor is in use */
219 * Values used internally for function call returns, etc.
222 #define NEWREGISTER 0 /* new user to register */
223 #define REREGISTER 1 /* existing user reregistering */
225 #define READ_HEADER 2
226 #define READ_MSGBODY 3
228 /* commands we can send to the stty_ctdl() routine */
229 #define SB_NO_INTR 0 /* set to Citadel client mode, i/q disabled */
230 #define SB_YES_INTR 1 /* set to Citadel client mode, i/q enabled */
231 #define SB_SAVE 2 /* save settings */
232 #define SB_RESTORE 3 /* restore settings */
233 #define SB_LAST 4 /* redo the last command sent */
235 #define NEXT_KEY 15
236 #define STOP_KEY 3
238 /* server exit codes */
239 #define EXIT_NORMAL 0 /* server terminated normally */
240 /* 1 through 63 reserved for signals */
241 #define EXIT_NULL 64 /* EOF on server command input */
243 /* citadel.rc stuff */
244 #define RC_NO 0 /* always no */
245 #define RC_YES 1 /* always yes */
246 #define RC_DEFAULT 2 /* setting depends on user config */
248 /* keepalives */
249 enum {
250 KA_NO, /* no keepalives */
251 KA_YES, /* full keepalives */
252 KA_HALF /* half keepalives */
255 /* for <;G>oto and <;S>kip commands */
256 #define GF_GOTO 0 /* <;G>oto floor mode */
257 #define GF_SKIP 1 /* <;S>kip floor mode */
258 #define GF_ZAP 2 /* <;Z>ap floor mode */
261 * MIME types used in Citadel for configuration stuff
263 #define SPOOLMIME "application/x-citadel-delivery-list"
264 #define INTERNETCFG "application/x-citadel-internet-config"
265 #define IGNETCFG "application/x-citadel-ignet-config"
266 #define IGNETMAP "application/x-citadel-ignet-map"
267 #define FILTERLIST "application/x-citadel-filter-list"
268 #define SIEVECONFIG "application/x-citadel-sieve-config"
270 #define TRACE CtdlLogPrintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
272 #ifndef LONG_MAX
273 #define LONG_MAX 2147483647L
274 #endif
277 * Authentication modes
279 #define AUTHMODE_NATIVE 0 /* Native (self-contained or "black box") */
280 #define AUTHMODE_HOST 1 /* Authenticate against the host OS user database */
281 #define AUTHMODE_LDAP 2 /* External LDAP authentication (NOT IMPLEMENTED) */
283 #ifdef __cplusplus
285 #endif
287 #endif /* CITADEL_H */