]> code.citadel.org Git - citadel.git/blobdiff - citadel/euidindex.c
Began removing $Id$ tags. This will be an ongoing process.
[citadel.git] / citadel / euidindex.c
index ce9ebd350d1f22ae4b14772c7570b675d0b704e0..842fa1d782af43257535c8dfe1784441f8c7b281 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * $Id$
- *
  * Index messages by EUID per room.
- *
  */
 
 #include "sysdep.h"
@@ -44,6 +41,8 @@
 #include "control.h"
 #include "euidindex.h"
 
+#include "ctdl_module.h"
+
 /*
  * The structure of an euidindex record *key* is:
  *
@@ -89,6 +88,10 @@ int DoesThisRoomNeedEuidIndexing(struct ctdlroom *qrbuf) {
  * its message number.
  */
 long locate_message_by_euid(char *euid, struct ctdlroom *qrbuf) {
+       return CtdlLocateMessageByEuid (euid, qrbuf);
+}
+
+long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf) {
        char *key;
        int key_len;
        struct cdbdata *cdb_euid;
@@ -169,7 +172,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 +188,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 +210,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 */
 }
 
@@ -227,7 +230,7 @@ void cmd_euid(char *cmdbuf) {
        if (CtdlAccessCheck(ac_logged_in)) return;
 
        extract_token(euid, cmdbuf, 0, '|', sizeof euid);
-       msgnum = locate_message_by_euid(euid, &CC->room);
+       msgnum = CtdlLocateMessageByEuid(euid, &CC->room);
        if (msgnum <= 0L) {
                cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
                return;
@@ -250,4 +253,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 "euidindex";
+}