+struct CitContext extnotify_queue_CC;
+
+void ExtNotify_PutErrorMessage(NotifyContext *Ctx, StrBuf *ErrMsg)
+{
+ int nNext;
+ if (Ctx->NotifyErrors == NULL)
+ Ctx->NotifyErrors = NewHash(1, Flathash);
+
+ nNext = GetCount(Ctx->NotifyErrors) + 1;
+ Put(Ctx->NotifyErrors,
+ (char*)&nNext,
+ sizeof(int),
+ ErrMsg,
+ HFreeStrBuf);
+}
+
+StrBuf* GetNHBuf(int i, int allocit, StrBuf **NotifyHostList)
+{
+ if ((NotifyHostList[i] == NULL) && (allocit != 0))
+ NotifyHostList[i] = NewStrBuf();
+ return NotifyHostList[i];
+}
+
+
+int GetNotifyHosts(NotifyContext *Ctx)
+{
+ char NotifyHostsBuf[SIZ];
+ StrBuf *Host;
+ StrBuf *File;
+ StrBuf *NotifyBuf;
+ int notify;
+ const char *pchs, *pche;
+ const char *NextHost = NULL;
+
+ /* See if we have any Notification Hosts configured */
+ Ctx->nNotifyHosts = get_hosts(NotifyHostsBuf, "notify");
+ if (Ctx->nNotifyHosts < 1)
+ return 0;
+
+ Ctx->NotifyHostList = malloc(sizeof(StrBuf*) * 2 * (Ctx->nNotifyHosts + 1));
+ memset(Ctx->NotifyHostList, 0, sizeof(StrBuf*) * 2 * (Ctx->nNotifyHosts + 1));
+
+ NotifyBuf = NewStrBufPlain(NotifyHostsBuf, -1);
+ /* get all configured notifiers's */
+ for (notify=0; notify<Ctx->nNotifyHosts; notify++) {
+
+ Host = GetNHBuf(notify * 2, 1, Ctx->NotifyHostList);
+ StrBufExtract_NextToken(Host, NotifyBuf, &NextHost, '|');
+ pchs = ChrPtr(Host);
+ pche = strchr(pchs, ':');
+ if (pche == NULL) {
+ syslog(LOG_ERR,
+ "extnotify: filename of notification template not found in %s.\n",
+ pchs);
+ continue;
+ }
+ File = GetNHBuf(notify * 2 + 1, 1, Ctx->NotifyHostList);
+ StrBufPlain(File, pchs, pche - pchs);
+ StrBufCutLeft(Host, pche - pchs + 1);
+ }
+ FreeStrBuf(&NotifyBuf);
+ return Ctx->nNotifyHosts;
+}
+
+
+
+/*! \brief Get configuration message for pager/funambol system from the
+ * users "My Citadel Config" room