2 typedef pthread_t THREAD;
5 struct ExpressMessage {
6 struct ExpressMessage *next;
11 * Here's the big one... the Citadel context structure.
13 * This structure keeps track of all information relating to a running
14 * session on the server. We keep one of these for each session thread.
16 * Note that the first element is "*next" so that it may be used without
17 * modification in a linked list.
20 struct CitContext *next; /* Link to next session in the list */
22 struct usersupp usersupp; /* Database record buffers */
23 struct quickroom quickroom;
28 char curr_user[32]; /* name of current user */
29 int logged_in; /* logged in */
30 int internal_pgm; /* authenticated as internal program */
31 char temp[32]; /* temp file name */
32 int nologin; /* not allowed to log in */
37 struct ExpressMessage *FirstExpressMessage;
38 int cs_pid; /* session ID */
39 char cs_room[20]; /* current room */
40 time_t cs_lastupdt; /* time of last update */
41 time_t lastcmd; /* time of last command executed */
42 time_t lastidle; /* For computing idle time */
43 char lastcmdname[5]; /* name of last command executed */
44 unsigned cs_flags; /* miscellaneous flags */
46 /* feeping creaturisms... */
47 int cs_clientdev; /* client developer ID */
48 int cs_clienttyp; /* client type code */
49 int cs_clientver; /* client version number */
50 char cs_clientname[32]; /* name of client software */
51 char cs_host[25]; /* host logged in from */
53 FILE *download_fp; /* Fields relating to file transfer */
57 char upl_comment[256];
58 char upl_filedir[256];
59 char chat_room[20]; /* The chat room */
63 char ucache_name[32]; /* For a performance boost, we cache */
64 long ucache_pos; /* the position of the last user rec */
65 char fake_username[32]; /* Fake username <bc> */
66 char fake_postname[32]; /* Fake postname <bc> */
67 char fake_hostname[25]; /* Name of the fake hostname <bc> */
68 char fake_roomname[20]; /* Name of the fake room <bc> */
69 char last_pager[32]; /* The username of the last pager */
71 int FloorBeingSearched; /* This is used by cmd_lrms() etc. */
73 int CtdlErrno; /* Error return for CitadelAPI calls */
76 typedef struct CitContext t_context;
78 #define CS_STEALTH 1 /* stealth mode */
79 #define CS_CHAT 2 /* chat mode */
80 #define CS_POSTING 4 /* Posting */
82 struct CitContext *MyContext(void);
83 #define CC ((struct CitContext *)MyContext())
85 extern struct CitContext *ContextList;
86 extern int ScheduledShutdown;
87 extern struct CitControl CitControl;
90 struct ChatLine *next;
95 char chat_username[32];
99 * Various things we need to lock and unlock
102 #define S_USER_TRANS 1
103 #define S_QUICKROOM 2
106 #define S_SESSION_TABLE 5
108 #define S_CHATQUEUE 7
110 #define S_HOUSEKEEPING 9
111 #define MAX_SEMAPHORES 10
124 * Citadel DataBases (define one for each cdb we need to open)
126 #define CDB_MSGMAIN 0 /* message base */
127 #define CDB_USERSUPP 1 /* user file */
128 #define CDB_QUICKROOM 2 /* room index */
129 #define CDB_FLOORTAB 3 /* floor index */
130 #define CDB_MSGLISTS 4 /* room message lists */
131 #define CDB_VISIT 5 /* user/room relationships */
132 #define MAXCDB 6 /* total number of CDB's defined */
140 /* Structures and declarations for function hooks of various types */
142 struct CleanupFunctionHook {
143 struct CleanupFunctionHook *next;
144 void (*h_function_pointer) (void);
146 extern struct CleanupFunctionHook *CleanupHookTable;
150 * SessionFunctionHook extensions are used for any type of hook for which
151 * the context in which it's being called (which is determined by the event
152 * type) will make it obvious for the hook function to know where to look for
155 struct SessionFunctionHook {
156 struct SessionFunctionHook *next;
157 void (*h_function_pointer) (void);
160 extern struct SessionFunctionHook *SessionHookTable;
162 #define EVT_STOP 0 /* Session is terminating */
163 #define EVT_START 1 /* Session is starting */
164 #define EVT_LOGIN 2 /* A user is logging in */
165 #define EVT_NEWROOM 3 /* Changing rooms */
166 #define EVT_LOGOUT 4 /* A user is logging out */
167 #define EVT_SETPASS 5 /* Setting or changing password */
171 * UserFunctionHook extensions are used for any type of hook which implements
172 * an operation on a user or username (potentially) other than the one
173 * operating the current session.
175 struct UserFunctionHook {
176 struct UserFunctionHook *next;
177 void (*h_function_pointer) (char *username, long usernum);
180 extern struct UserFunctionHook *UserHookTable;
182 #define EVT_PURGEUSER 100 /* Deleting a user */
183 #define EVT_OUTPUTMSG 101 /* Outputting a message */
186 /* Defines the relationship of a user to a particular room */
188 char v_roomname[ROOMNAMELEN];
191 unsigned int v_flags;
194 #define V_FORGET 1 /* User has zapped this room */
195 #define V_LOCKOUT 2 /* User is locked out of this room */
196 #define V_ACCESS 4 /* Access is granted to this room */
199 #define UA_GOTOALLOWED 4
200 #define UA_HASNEWMSGS 8