]> code.citadel.org Git - citadel.git/blobdiff - citadel/server.h
* Replication fixes
[citadel.git] / citadel / server.h
index 02d650786882b7255ff253d4b6c5ed8107b62ffa..82113952da3b5eec272d77ac60ab4ba2d0ebc861 100644 (file)
@@ -6,6 +6,20 @@ typedef pthread_t THREAD;
  */
 #define DEBUG_MEMORY_LEAKS
 
+/*
+ * New format for a message in memory
+ */
+#define        CTDLMESSAGE_MAGIC               0x159d
+struct CtdlMessage {
+       int cm_magic;                   /* Self-check */
+       char cm_anon_type;              /* Anonymous or author-visible */
+       char cm_format_type;            /* Format type */
+       char *cm_fields[256];           /* Data fields */
+       unsigned int cm_flags;          /* How to handle (NOT SAVED TO DISK) */
+};
+
+#define        CM_SKIP_HOOKS   0x01            /* Don't run server-side handlers */
+
 
 /*
  * Generic per-session variable or data structure storage
@@ -22,6 +36,7 @@ struct CtdlSessData {
 enum {
        SYM_DESIRED_SECTION,            /* Used by the MIME parser */
        SYM_MA_INFO,                    /* Handles multipart/alternative */
+       SYM_REPL,                       /* Used for replication checking */
        SYM_MAX
 };
 
@@ -246,6 +261,20 @@ extern struct UserFunctionHook *UserHookTable;
 #define EVT_OUTPUTMSG  101     /* Outputting a message */
 
 
+/*
+ * MessageFunctionHook extensions are used for hooks which implement handlers
+ * for various types of message operations (save, read, etc.)
+ */
+struct MessageFunctionHook {
+       struct MessageFunctionHook *next;
+       int (*h_function_pointer) (struct CtdlMessage *msg);
+       int eventtype;
+};
+extern struct MessageFunctionHook *MessageHookTable;
+
+#define EVT_BEFOREREAD 200
+#define EVT_BEFORESAVE 201
+#define EVT_AFTERSAVE  202
 
 
 /*
@@ -339,17 +368,15 @@ extern struct TheHeap *heap;
 #endif
 
 
-/*
- * New format for a message in memory
+/* 
+ * Serialization routines use this struct to return a pointer and a length
  */
-#define        CTDLMESSAGE_MAGIC               0x159d
-struct CtdlMessage {
-       int cm_magic;                   /* Self-check */
-       char cm_anon_type;              /* Anonymous or author-visible */
-       char cm_format_type;            /* Format type */
-       char *cm_fields[256];           /* Data fields */
+struct ser_ret {
+        size_t len;
+        char *ser;
 };
 
+
 /* Preferred field order */
 /*               *********                     Important fields */
 /*                        ****************     Semi-important fields */