policy.c: added, moved GetExpirePolicy() from room_ops.c
authorArt Cancro <ajc@citadel.org>
Sat, 24 Oct 1998 00:12:05 +0000 (00:12 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 24 Oct 1998 00:12:05 +0000 (00:12 +0000)
citadel/ChangeLog
citadel/Makefile.in
citadel/citadel.h
citadel/policy.c [new file with mode: 0644]
citadel/policy.h [new file with mode: 0644]
citadel/room_ops.c
citadel/room_ops.h
citadel/serv_test.c

index bd92179100b667ce3f2b026c703fbd1ce6e2e7c3..449a2de75d8509b884c6ec9dc0f131a2d06ec5c6 100644 (file)
@@ -1,6 +1,7 @@
 Fri Oct 23 19:34:38 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * setup.c: default node name is now obtained from uname()
        * config.c: added put_config()
+       * policy.c: added, moved GetExpirePolicy() from room_ops.c
 
 Wed Oct 21 22:24:48 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Mail rooms now hide their owner-prefix from the client.
index 6e9709a58d12c1d67871f83472c3a89705ccd279..2b64808aa84f4babca2761f1a5826182c8c1099f 100644 (file)
@@ -58,12 +58,12 @@ netpoll: netpoll.o config.o ipc_c_tcp.o
 citserver: citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \
        msgbase.ro config.ro sysdep.ro locate_host.ro \
        housekeeping.ro database.ro control.ro logging.ro \
-       dynloader.ro $(SNPRINTF:.o=.ro)
+       policy.ro dynloader.ro $(SNPRINTF:.o=.ro)
        $(CC) \
                citserver.ro user_ops.ro room_ops.ro file_ops.ro support.ro \
                msgbase.ro config.ro sysdep.ro locate_host.ro \
                housekeeping.ro database.ro control.ro logging.ro \
-               dynloader.ro $(SNPRINTF:.o=.ro)\
+               policy.ro dynloader.ro $(SNPRINTF:.o=.ro)\
                $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) -o citserver
 
 %.ro: %.c
index 483e7a145e8bad5e4f08315165a682921cb01c33..c82702d1c8c5eac89d793ba8883daa88c500f3db 100644 (file)
@@ -34,13 +34,13 @@ typedef unsigned char CIT_UBYTE;
  */
 struct ExpirePolicy {
        int expire_mode;
-       long expire_value;
+       int expire_value;
        };
 
 #define EXPIRE_NEXTLEVEL       0       /* Inherit expiration policy    */
 #define EXPIRE_MANUAL          1       /* Don't expire messages at all */
 #define EXPIRE_NUMMSGS         2       /* Keep only latest n messages  */
-#define EXPIRE_AGE             3       /* Expire messages by age       */
+#define EXPIRE_AGE             3       /* Expire messages after n days */
 
 
 /* 
diff --git a/citadel/policy.c b/citadel/policy.c
new file mode 100644 (file)
index 0000000..9ca62e5
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <pthread.h>
+#include <time.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include "database.h"
+#include "config.h"
+#include "room_ops.h"
+#include "sysdep_decls.h"
+#include "support.h"
+#include "user_ops.h"
+#include "msgbase.h"
+#include "serv_chat.h"
+#include "citserver.h"
+
+
+/*
+ * Retrieve the applicable expire policy for a specific room
+ */
+void GetExpirePolicy(struct ExpirePolicy *epbuf, struct quickroom *qrbuf) {
+       struct floor flbuf;
+
+       /* If the room has its own policy, return it */ 
+       if (qrbuf->QRep.expire_mode != 0) {
+               memcpy(epbuf, &qrbuf->QRep, sizeof(struct ExpirePolicy));
+               return;
+               }
+
+       /* Otherwise, if the floor has its own policy, return it */     
+       getfloor(&flbuf, qrbuf->QRfloor);
+       if (flbuf.f_ep.expire_mode != 0) {
+               memcpy(epbuf, &flbuf.f_ep, sizeof(struct ExpirePolicy));
+               return;
+               }
+
+       /* Otherwise, fall back on the system default */
+       memcpy(epbuf, &config.c_ep, sizeof(struct ExpirePolicy));
+       }
+
+
diff --git a/citadel/policy.h b/citadel/policy.h
new file mode 100644 (file)
index 0000000..2c019f8
--- /dev/null
@@ -0,0 +1 @@
+void GetExpirePolicy(struct ExpirePolicy *epbuf, struct quickroom *qrbuf);
index fe722e7825c45abe9505a0b03343c3a102c37cc7..9b2f3d6b021b1d5783842efee97b0d7f3e24ec77 100644 (file)
@@ -435,30 +435,6 @@ int is_noneditable(struct quickroom *qrbuf) {
 
 
 
-/*
- * Retrieve the applicable room policy for a specific room
- */
-void GetExpirePolicy(struct ExpirePolicy *epbuf, struct quickroom *qrbuf) {
-       struct floor flbuf;
-
-       /* If the room has its own policy, return it */ 
-       if (qrbuf->QRep.expire_mode != 0) {
-               memcpy(epbuf, &qrbuf->QRep, sizeof(struct ExpirePolicy));
-               return;
-               }
-
-       /* Otherwise, if the floor has its own policy, return it */     
-       getfloor(&flbuf, qrbuf->QRfloor);
-       if (flbuf.f_ep.expire_mode != 0) {
-               memcpy(epbuf, &flbuf.f_ep, sizeof(struct ExpirePolicy));
-               return;
-               }
-
-       /* Otherwise, fall back on the system default */
-       memcpy(epbuf, &config.c_ep, sizeof(struct ExpirePolicy));
-       }
-
-
 /*
  * Back-back-end for all room listing commands
  */
index a1305cb45a5a292e5fe39b4d4a89a9a868c763ee..d89a95206af9b099242cb726d1c8158bb73f17a0 100644 (file)
@@ -46,5 +46,4 @@ void cmd_eflr (char *argbuf);
 void ForEachRoom(void (*CallBack)(struct quickroom *EachRoom));
 void assoc_file_name(char *buf, struct quickroom *qrbuf, char *prefix);
 void delete_room(struct quickroom *qrbuf);
-void GetExpirePolicy(struct ExpirePolicy *epbuf, struct quickroom *qrbuf);
 void list_roomname(struct quickroom *qrbuf);
index b02fec4445a58acc641067fa1a7606dfda1f33ae..81f000fae86656d72882313c0792434110aeaa35 100644 (file)
@@ -28,15 +28,15 @@ extern struct CitContext *ContextList;
 #define MODULE_AUTHOR  "Art Cancro"
 #define MODULE_EMAIL   "ajc@uncnsrd.mt-kisco.ny.us"
 #define MAJOR_VERSION  0
-#define MINOR_VERSION  2
+#define MINOR_VERSION  3
 
 static struct DLModule_Info info = {
-  MODULE_NAME,
-  MODULE_AUTHOR,
-  MODULE_EMAIL,
-  MAJOR_VERSION,
-  MINOR_VERSION
-};
+       MODULE_NAME,
+       MODULE_AUTHOR,
+       MODULE_EMAIL,
+       MAJOR_VERSION,
+       MINOR_VERSION
+       };
 
 void CleanupTest(void) {
        lprintf(9, "--- test of adding an unload hook --- \n");
@@ -76,7 +76,7 @@ void DoPurgeMessages(struct quickroom *qrbuf) {
 
        GetExpirePolicy(&epbuf, qrbuf);
        
-       lprintf(9, "ExpirePolicy for <%s> is <%d> <%ld>\n",
+       lprintf(9, "ExpirePolicy for <%s> is <%d> <%d>\n",
                qrbuf->QRname, epbuf.expire_mode, epbuf.expire_value);
 
        /* If the room is set to never expire messages ... do nothing */
@@ -100,6 +100,10 @@ void DoPurgeMessages(struct quickroom *qrbuf) {
                        }
                }
 
+       /* If the room is set to expire by age...  FIX (write this!!) (/
+       if (epbuf.expire_mode == EXPIRE_AGE) {
+               }
+
        put_msglist(qrbuf);
        }