sending http requests instant now.
[citadel.git] / citadel / modules / extnotify / extnotify_main.c
index b772bbb09070913433b3041cdc2b6c94b6dcd01f..7432a0ee286f6f6bdcc9815fb8115a15af18aa54 100644 (file)
 #include "config.h"
 #include "control.h"
 #include "user_ops.h"
-#include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "internet_addressing.h"
 #include "domain.h"
 #include "clientsocket.h"
+#include "event_client.h"
 #include "extnotify.h"
 
 #include "ctdl_module.h"
@@ -137,11 +137,11 @@ StrBuf** GetNotifyHosts(void)
 }
 
 
-/*! \brief Create the notify message queue. We use the exact same room
- *                     as the Funambol module.
+/* Create the notify message queue. We use the exact same room
+ * as the Funambol module.
  *
- *     Run at server startup, creates FNBL_QUEUE_ROOM if it doesn't exist
- *     and sets as system room.
+ * Run at server startup, creates FNBL_QUEUE_ROOM if it doesn't exist
+ * and sets as system room.
  */
 void create_extnotify_queue(void) {
        struct ctdlroom qrbuf;
@@ -162,9 +162,10 @@ void create_extnotify_queue(void) {
  */
 void do_extnotify_queue(void) 
 {
+
        NotifyContext Ctx;
        static int doing_queue = 0;
-       int i = 0;
+       //int i = 0;
     
        /*
         * This is a simple concurrency check to make sure only one queue run
@@ -174,7 +175,7 @@ void do_extnotify_queue(void)
         */
        if (doing_queue) return;
        doing_queue = 1;
-    
+
        /*
         * Go ahead and run the queue
         */
@@ -184,11 +185,12 @@ 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,
                           SPOOLMIME, NULL, process_notify, &Ctx);
-
+/*
        while ((Ctx.NotifyHostList != NULL) && (Ctx.NotifyHostList[i] != NULL))
                FreeStrBuf(&Ctx.NotifyHostList[i]);
 
@@ -211,12 +213,13 @@ void do_extnotify_queue(void)
                DeleteHashPos(&It);
                DeleteHash(&Ctx.NotifyErrors);
        }
-
+*/
        CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
        doing_queue = 0;
 }
-/*!
- * \brief Process messages in the external notification queue
+
+/*
+ * Process messages in the external notification queue
  */
 void process_notify(long NotifyMsgnum, void *usrdata) 
 {
@@ -365,9 +368,9 @@ long extNotify_getConfigMessage(char *username) {
        int a;
 
        // Get the user
-       getuser(&user, username);
+       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 +410,5 @@ CTDL_MODULE_INIT(extnotify)
                CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER);
        }
        /* return our Subversion id for the Log */
-        return "$Id$";
+        return "extnotify";
 }