]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/control.c
DRY fetch of msglists.
[citadel.git] / citadel / server / control.c
index 27bc05b01e52ceded4715719327b59281520ecdd..173ea61d4ce6d76fbbe17424834e3ae423a267e9 100644 (file)
@@ -14,6 +14,7 @@
 #include "config.h"
 #include "citserver.h"
 #include "user_ops.h"
+#include "room_ops.h"
 
 long control_highest_user = 0;
 
@@ -47,7 +48,6 @@ struct cfh {
 // 2 = show inconsistencies but don't repair them, continue execution
 void control_find_highest(struct ctdlroom *qrbuf, void *data) {
        struct cfh *cfh = (struct cfh *)data;
-       struct cdbdata *cdbfr;
        long *msglist;
        int num_msgs=0;
        int c;
@@ -57,13 +57,9 @@ void control_find_highest(struct ctdlroom *qrbuf, void *data) {
        }
 
        // Load the message list
-       cdbfr = cdb_fetch(CDB_MSGLISTS, &qrbuf->QRnumber, sizeof(long));
-       if (cdbfr != NULL) {
-               msglist = (long *) cdbfr->ptr;
-               num_msgs = cdbfr->len / sizeof(long);
-       }
-       else {
-               return; // No messages at all?  No further action.
+       num_msgs = CtdlFetchMsgList(qrbuf->QRnumber, &msglist);
+       if (num_msgs < 0) {
+               return; // No msglists record?  No further action.
        }
 
        if (num_msgs > 0) {
@@ -74,7 +70,7 @@ void control_find_highest(struct ctdlroom *qrbuf, void *data) {
                }
        }
 
-       cdb_free(cdbfr);
+       free(msglist);
 }