#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"
}
-/*! \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;
*/
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
*/
if (doing_queue) return;
doing_queue = 1;
-
+
/*
* Go ahead and run the queue
*/
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]);
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)
{
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,
CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER);
}
/* return our Subversion id for the Log */
- return "$Id$";
+ return "extnotify";
}