]> 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 fd4e547783602b3f76024b177909e305775cc8e7..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;
@@ -136,24 +137,47 @@ struct cdbdata {
        };
 
 
+/* Structures and declarations for function hooks of various types */
+
+struct CleanupFunctionHook {
+       struct CleanupFunctionHook *next;
+       void *(*h_function_pointer) (void);
+       };
+extern struct CleanupFunctionHook *CleanupHookTable;
+
 
 /*
- * Loadable module hook types
+ * 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.
  */
-#define HOOK_START_SESSION     1
-#define HOOK_END_SESSION       2
-#define HOOK_SERVCMD           3
-#define HOOK_CRIT_GET          4
-#define HOOK_CRIT_GOT          5
-#define HOOK_CRIT_END          6
-#define HOOK_LOGIN             7
-#define HOOK_NEWROOM           8
-#define HOOK_CLEANUP           9
-
-struct FunctionHook {
-       struct FunctionHook *next;
+struct SessionFunctionHook {
+       struct SessionFunctionHook *next;
        void *(*h_function_pointer) (void);
-       int h_type;
+       int eventtype;
+       };
+extern struct SessionFunctionHook *SessionHookTable;
+
+#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 UserFunctionHook *UserHookTable;
 
-extern struct FunctionHook *HookTable;
+#define EVT_PURGEUSER  100     /* Deleting a user */
+#define EVT_OUTPUTMSG  101     /* Outputting a message */