]> code.citadel.org Git - citadel.git/blobdiff - citadel/euidindex.c
Don't register commands twice, only register them before threading begins.
[citadel.git] / citadel / euidindex.c
index ce9ebd350d1f22ae4b14772c7570b675d0b704e0..d68718e16804c7bb04fd532d7dd64565c4cd5dfc 100644 (file)
@@ -44,6 +44,8 @@
 #include "control.h"
 #include "euidindex.h"
 
+#include "ctdl_module.h"
+
 /*
  * The structure of an euidindex record *key* is:
  *
@@ -169,7 +171,7 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) {
        struct RoomProcList *ptr;
        struct ctdlroom qr;
 
-       /* Lazy programming here.  Call this function as a ForEachRoom backend
+       /* Lazy programming here.  Call this function as a CtdlForEachRoom backend
         * in order to queue up the room names, or call it with a null room
         * to make it do the processing.
         */
@@ -185,12 +187,12 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) {
        }
 
        while (rplist != NULL) {
-               if (getroom(&qr, rplist->name) == 0) {
+               if (CtdlGetRoom(&qr, rplist->name) == 0) {
                        if (DoesThisRoomNeedEuidIndexing(&qr)) {
                                CtdlLogPrintf(CTDL_DEBUG,
                                        "Rebuilding EUID index for <%s>\n",
                                        rplist->name);
-                               usergoto(rplist->name, 0, 0, NULL, NULL);
+                               CtdlUserGoto(rplist->name, 0, 0, NULL, NULL);
                                CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
                                        rebuild_euid_index_for_msg, NULL);
                        }
@@ -207,7 +209,7 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) {
  */
 void rebuild_euid_index(void) {
        cdb_trunc(CDB_EUIDINDEX);               /* delete the old indices */
-       ForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate rm names */
+       CtdlForEachRoom(rebuild_euid_index_for_room, NULL);     /* enumerate rm names */
        rebuild_euid_index_for_room(NULL, NULL);        /* and index them */
 }
 
@@ -250,4 +252,11 @@ void cmd_euid(char *cmdbuf) {
        cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
 }
 
-
+CTDL_MODULE_INIT(euidindex)
+{
+       if (!threading) {
+               CtdlRegisterProtoHook(cmd_euid, "EUID", "Autoconverted. TODO: document me.");
+       }
+       /* return our Subversion id for the Log */
+       return "$Id$";
+}