- prefMsg = CtdlFetchMessage(configMsgNum, 1);
- strncpy(configMsg, prefMsg->cm_fields['M'], strlen(prefMsg->cm_fields['M']));
- CtdlFreeMessage(prefMsg);
+
+ if (doing_queue) return;
+ doing_queue = 1;
+
+ become_session(&extnotify_queue_CC);
+
+ pthread_setspecific(MyConKey, (void *)&extnotify_queue_CC);
+
+ /*
+ * Go ahead and run the queue
+ */
+ syslog(LOG_DEBUG, "serv_extnotify: processing notify queue\n");
+
+ memset(&Ctx, 0, sizeof(NotifyContext));
+ if ((GetNotifyHosts(&Ctx) > 0) &&
+ (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0))
+ {
+ syslog(LOG_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+ if (Ctx.nNotifyHosts > 0)
+ {
+ for (i = 0; i < Ctx.nNotifyHosts * 2; i++)
+ FreeStrBuf(&Ctx.NotifyHostList[i]);
+ free(Ctx.NotifyHostList);
+ }
+ return;
+ }
+ CtdlForEachMessage(MSGS_ALL, 0L, NULL,
+ SPOOLMIME, NULL, process_notify, &Ctx);
+ syslog(LOG_DEBUG, "serv_extnotify: queue run completed\n");
+ doing_queue = 0;
+ if (Ctx.nNotifyHosts > 0)
+ {
+ for (i = 0; i < Ctx.nNotifyHosts * 2; i++)
+ FreeStrBuf(&Ctx.NotifyHostList[i]);
+ free(Ctx.NotifyHostList);
+ }