1 // Main Citadel header file
3 // Copyright (c) 1987-2022 by the citadel.org team
5 // This program is open source software. Use, duplication, or disclosure
6 // is subject to the terms of the GNU General Public License, version 3.
7 // The program is distributed without any warranty, expressed or implied.
12 // Suppress these compiler warnings
13 #pragma GCC diagnostic ignored "-Wcast-qual"
14 #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
15 #pragma GCC diagnostic ignored "-Wformat-truncation"
19 #include "sysconfig.h"
27 // Text description of this software
28 // (We used to define this ourselves, but why bother when the build tools do it for us?)
29 #define CITADEL "Citadel" PACKAGE_VERSION
31 #define REV_LEVEL 955 // This version
32 #define REV_MIN 591 // Oldest compatible database
33 #define EXPORT_REV_MIN 931 // Oldest compatible export files
34 #define LIBCITADEL_MIN 951 // Minimum required version of libcitadel
35 #define SERVER_TYPE 0 // zero for stock Citadel; other developers please obtain SERVER_TYPE codes for your implementations
37 #ifdef LIBCITADEL_VERSION_NUMBER
38 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
39 #error libcitadel is too old. Please upgrade it before continuing.
43 // This is the user name and password for the default administrator account
44 // that is created when Citadel Server is started with an empty database.
45 #define DEFAULT_ADMIN_USERNAME "admin"
46 #define DEFAULT_ADMIN_PASSWORD "citadel"
48 // Various length constants
49 #define ROOMNAMELEN 128 // The size of a roomname string
50 #define USERNAME_SIZE 64 // The size of a username string
51 #define MAX_EDITORS 5 // number of external editors supported ; must be at least 1
53 // Message expiration policy stuff
54 typedef struct ExpirePolicy ExpirePolicy;
60 #define EXPIRE_NEXTLEVEL 0 // Inherit expiration policy
61 #define EXPIRE_MANUAL 1 // Don't expire messages at all
62 #define EXPIRE_NUMMSGS 2 // Keep only latest n messages
63 #define EXPIRE_AGE 3 // Expire messages after n days
66 typedef struct ctdluser ctdluser;
67 struct ctdluser { // User record
68 int version; // Citadel version which created this record
69 uid_t uid; // Associate with a unix account?
70 char password[32]; // password
71 unsigned flags; // See US_ flags below
72 long timescalled; // Total number of logins
73 long posted; // Number of messages ever submitted
74 cit_uint8_t axlevel; // Access level
75 long usernum; // User number (never recycled)
76 time_t lastcall; // Date/time of most recent login
77 int USuserpurge; // Purge time (in days) for user
78 char fullname[64]; // Display name (primary identifier)
79 long msgnum_bio; // msgnum of user's profile (bio)
80 long msgnum_pic; // msgnum of user's avatar (photo)
81 char emailaddrs[512]; // Internet email addresses
82 long msgnum_inboxrules; // msgnum of user's inbox filtering rules
83 long lastproc_inboxrules; // msgnum of last message filtered
86 // Bits which may appear in MMflags.
87 #define MM_VALID 4 // New users need validating
90 typedef struct ctdlroom ctdlroom;
92 char QRname[ROOMNAMELEN]; // Name of room
93 char QRpasswd[10]; // Only valid if it's a private rm
94 long QRroomaide; // User number of room aide
95 long QRhighest; // Highest message NUMBER in room
96 time_t QRgen; // Generation number of room
97 unsigned QRflags; // See flag values below
98 char QRdirname[15]; // Directory name, if applicable
99 long msgnum_info; // msgnum of room banner (info file)
100 char QRfloor; // Which floor this room is on
101 time_t QRmtime; // Date/time of last post
102 struct ExpirePolicy QRep; // Message expiration policy
103 long QRnumber; // Globally unique room number
104 char QRorder; // Sort key for room listing order
105 unsigned QRflags2; // Additional flags
106 int QRdefaultview; // How to display the contents
107 long msgnum_pic; // msgnum of room picture or icon
110 // Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
111 // or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
112 // flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
113 // flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
116 #define MES_NORMAL 65 // Normal message
117 #define MES_ANONONLY 66 // "****" header
118 #define MES_ANONOPT 67 // "Anonymous" header
120 // Floor record. The floor number is implicit in its location in the file.
121 typedef struct floor floor;
123 unsigned short f_flags; // flags
124 char f_name[256]; // name of floor
125 int f_ref_count; // reference count
126 struct ExpirePolicy f_ep; // default expiration policy
129 #define F_INUSE 1 // floor is in use
131 // Values used internally for function call returns, etc.
132 #define NEWREGISTER 0 // new user to register
133 #define REREGISTER 1 // existing user reregistering
135 // number of items which may be handled by the CONF command
136 #define NUM_CONFIGS 71
138 #define TRACE syslog(LOG_DEBUG, "\033[7m Checkpoint: %s : %d \033[0m", __FILE__, __LINE__)
141 #define LONG_MAX 2147483647L
144 // Authentication modes
145 #define AUTHMODE_NATIVE 0 // Native (self-contained or "black box")
146 #define AUTHMODE_HOST 1 // Authenticate against the host OS user database
147 #define AUTHMODE_LDAP 2 // Authenticate using LDAP server with POSIX schema
148 #define AUTHMODE_LDAP_AD 3 // Authenticate using LDAP server with Active Directory schema