]> code.citadel.org Git - citadel.git/blobdiff - citadel/server.h
Changeover to new room structure. See ChangeLog for details.
[citadel.git] / citadel / server.h
index a58b74bf14f301dea7f009e8e53246a6afae92af..615ec37370b59bfec17d16b81e3f87683e898c4d 100644 (file)
@@ -1,4 +1,3 @@
-
 typedef pthread_t THREAD;
 
 
@@ -26,7 +25,6 @@ struct CitContext {
        int num_msgs;
 
         char curr_user[32];            /* name of current user */
-        int curr_rm;                   /* index of current room */
         int logged_in;                 /* logged in */
         int internal_pgm;              /* authenticated as internal program */
         char temp[32];                 /* temp file name */
@@ -69,6 +67,8 @@ struct CitContext {
        char fake_roomname[20];         /* Name of the fake room <bc>        */
        char last_pager[32];            /* The username of the last pager    */
 
+       int FloorBeingSearched;         /* This is used by cmd_lrms() etc.   */
+
        int CtdlErrno;                  /* Error return for CitadelAPI calls */
        };
 
@@ -122,13 +122,14 @@ struct ChatLine {
 /*
  * Citadel DataBases (define one for each cdb we need to open)
  */
-#define CDB_MSGMAIN    0       /* message base */
-#define CDB_USERSUPP   1       /* user file */
-#define CDB_QUICKROOM  2       /* room index */
-#define CDB_FLOORTAB   3       /* floor index */
-#define CDB_MSGLISTS   4       /* room message lists */
-#define CDB_MAILBOXES  5       /* mailbox message lists */
-#define MAXCDB         6       /* total number of CDB's defined */
+#define CDB_MSGMAIN    0       /* message base                  */
+#define CDB_USERSUPP   1       /* user file                     */
+#define CDB_QUICKROOM  2       /* room index                    */
+#define CDB_FLOORTAB   3       /* floor index                   */
+#define CDB_MSGLISTS   4       /* room message lists            */
+#define CDB_MAILBOXES  5       /* mailbox message lists         */
+#define CDB_VISIT      6       /* user/room relationships       */
+#define MAXCDB         7       /* total number of CDB's defined */
 
 struct cdbdata {
        size_t len;
@@ -144,22 +145,39 @@ struct CleanupFunctionHook {
        };
 extern struct CleanupFunctionHook *CleanupHookTable;
 
-struct NewRoomFunctionHook {
-       struct NewRoomFunctionHook *next;
-       void *(*h_function_pointer) (char *);
-       };
-extern struct NewRoomFunctionHook *NewRoomHookTable;
 
+/*
+ * SessionFunctionHook extensions are used for any type of hook for which
+ * the context in which it's being called (which is determined by the event
+ * type) will make it obvious for the hook function to know where to look for
+ * pertinent data.
+ */
 struct SessionFunctionHook {
        struct SessionFunctionHook *next;
-       void *(*h_function_pointer) (int);
-       int startstop;
+       void *(*h_function_pointer) (void);
+       int eventtype;
        };
 extern struct SessionFunctionHook *SessionHookTable;
 
-struct LoginFunctionHook {
-       struct LoginFunctionHook *next;
-       void *(*h_function_pointer) (void);
+#define EVT_STOP       0       /* Session is terminating */
+#define EVT_START      1       /* Session is starting */
+#define EVT_LOGIN      2       /* A user is logging in */
+#define EVT_NEWROOM    3       /* Changing rooms */
+#define EVT_LOGOUT     4       /* A user is logging out */
+#define EVT_SETPASS    5       /* Setting or changing password */
+
+
+/*
+ * UserFunctionHook extensions are used for any type of hook which implements
+ * an operation on a user or username (potentially) other than the one
+ * operating the current session.
+ */
+struct UserFunctionHook {
+       struct UserFunctionHook *next;
+       void *(*h_function_pointer) (char *username, long usernum);
+       int eventtype;
        };
-extern struct LoginFunctionHook *LoginHookTable;
+extern struct UserFunctionHook *UserHookTable;
 
+#define EVT_PURGEUSER  100     /* Deleting a user */
+#define EVT_OUTPUTMSG  101     /* Outputting a message */