]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/extnotify/extnotify_main.c
More removal of $Id$ tags
[citadel.git] / citadel / modules / extnotify / extnotify_main.c
index 3255f4b16a5730689b6c3bea1b5cb3d170152de6..1ceca2ca8a80c90d972ed8268437704553bbb869 100644 (file)
@@ -58,7 +58,6 @@
 #include "config.h"
 #include "control.h"
 #include "user_ops.h"
-#include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "internet_addressing.h"
@@ -162,9 +161,11 @@ void create_extnotify_queue(void) {
  */
 void do_extnotify_queue(void) 
 {
+
        NotifyContext Ctx;
        static int doing_queue = 0;
        int i = 0;
+       CitContext extnotifyCC;
     
        /*
         * This is a simple concurrency check to make sure only one queue run
@@ -174,6 +175,10 @@ void do_extnotify_queue(void)
         */
        if (doing_queue) return;
        doing_queue = 1;
+
+       /* Give this thread its own private CitContext */
+       CtdlFillSystemContext(&extnotifyCC, "extnotify");
+       citthread_setspecific(MyConKey, (void *)&extnotifyCC );
     
        /*
         * Go ahead and run the queue
@@ -184,6 +189,7 @@ void do_extnotify_queue(void)
        Ctx.NotifyHostList = GetNotifyHosts();
        if (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
                CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+               CtdlClearSystemContext();
                return;
        }
        CtdlForEachMessage(MSGS_ALL, 0L, NULL,
@@ -214,6 +220,7 @@ void do_extnotify_queue(void)
 
        CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
        doing_queue = 0;
+       CtdlClearSystemContext();
 }
 /*!
  * \brief Process messages in the external notification queue
@@ -367,7 +374,7 @@ long extNotify_getConfigMessage(char *username) {
        // Get the user
        CtdlGetUser(&user, username);
     
-       MailboxName(configRoomName, sizeof configRoomName, &user, USERCONFIGROOM);
+       CtdlMailboxName(configRoomName, sizeof configRoomName, &user, USERCONFIGROOM);
        // Fill qrbuf
        CtdlGetRoom(&qrbuf, configRoomName);
        /* Do something really, really stoopid here. Raid the room on ourselves,
@@ -407,5 +414,5 @@ CTDL_MODULE_INIT(extnotify)
                CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER);
        }
        /* return our Subversion id for the Log */
-        return "$Id$";
+        return "extnotify";
 }