#include "extnotify.h"
eNextState EvaluateResult(AsyncIO *IO);
+eNextState ExtNotifyTerminate(AsyncIO *IO);
/*
* \brief Sends a message to the Funambol server notifying
IO = (AsyncIO*) malloc(sizeof(AsyncIO));
memset(IO, 0, sizeof(AsyncIO));
- IO->CitContext = CC;
+ IO->CitContext = CloneContext(CC);
snprintf(msgnumstr, 128, "%ld", MsgNum);
snprintf(buf, SIZ,
"Cannot load template file %s [%s]won't send notification\r\n",
file_funambol_msg, strerror(errno));
- CtdlLogPrintf(CTDL_ERR, buf);
+ syslog(LOG_ERR, "%s", buf);
CtdlAideMessage(buf, "External notifier unable to find message template!");
goto abort;
snprintf(buf, SIZ,
"Cannot load template file %s; won't send notification\r\n",
file_funambol_msg);
- CtdlLogPrintf(CTDL_ERR, buf);
+ syslog(LOG_ERR, "%s", buf);
CtdlAideMessage(buf, "External notifier unable to load message template!");
goto abort;
// Ctx,
NULL,
"Citadel ExtNotify",
- EvaluateResult))
+ EvaluateResult,
+ ExtNotifyTerminate))
{
- CtdlLogPrintf(CTDL_ALERT, "Unable to initialize libcurl.\n");
+ syslog(LOG_ALERT, "Unable to initialize libcurl.\n");
goto abort;
}
chnd = IO->HttpReq.chnd;
OPT(INTERFACE, config.c_ip_addr);
}
- evcurl_handle_start(IO);
+ QueueCurlContext(IO);
return 0;
abort:
if (IO->HttpReq.httpcode != 200) {
StrBuf *ErrMsg;
- CtdlLogPrintf(CTDL_ALERT, "libcurl error %ld: %s\n",
+ syslog(LOG_ALERT, "libcurl error %ld: %s\n",
IO->HttpReq.httpcode,
IO->HttpReq.errdesc);
+
ErrMsg = NewStrBufPlain(HKEY("Error sending your Notification\n"));
StrBufAppendPrintf(ErrMsg, "\nlibcurl error %ld: \n\t\t%s\n",
IO->HttpReq.httpcode,
CtdlAideMessage(ChrPtr(ErrMsg), "External notifier unable to load message template!");
}
- CtdlLogPrintf(CTDL_DEBUG, "Funambol notified\n");
+ syslog(LOG_DEBUG, "Funambol notified\n");
/*
while ((Ctx.NotifyHostList != NULL) && (Ctx.NotifyHostList[i] != NULL))
FreeStrBuf(&Ctx.NotifyHostList[i]);
///FreeStrBuf (&ReplyBuf);
return 0;
}
+
+eNextState ExtNotifyTerminate(AsyncIO *IO)
+{
+ free(IO);
+ return eAbort;
+}