]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/extnotify/funambol65.c
finalize allocation & freeing of rss stuff
[citadel.git] / citadel / modules / extnotify / funambol65.c
index 6049b179d2fbd8877286a476551a4a209eb094da..f81b41dbfadcdc5adba62d58ab25f4437b464c39 100644 (file)
@@ -48,6 +48,7 @@
 #include "extnotify.h"
 
 eNextState EvaluateResult(AsyncIO *IO);
+eNextState ExtNotifyTerminate(AsyncIO *IO);
 
 /*
 * \brief Sends a message to the Funambol server notifying 
@@ -67,12 +68,13 @@ int notify_http_server(char *remoteurl,
        char *SOAPMessage = NULL;
        char *contenttype = NULL;
        StrBuf *ReplyBuf;
+       StrBuf *Buf;
        CURL *chnd;
        AsyncIO *IO;
 
        IO = (AsyncIO*) malloc(sizeof(AsyncIO));
        memset(IO, 0, sizeof(AsyncIO));
-       IO->CitContext = CC;
+       IO->CitContext = CloneContext(CC);
 
        snprintf(msgnumstr, 128, "%ld", MsgNum);
 
@@ -145,13 +147,16 @@ int notify_http_server(char *remoteurl,
                IO->HttpReq.headers = curl_slist_append(IO->HttpReq.headers, "Pragma: no-cache");
        }
 
-       ParseURL(&IO->ConnectMe, NewStrBufPlain (remoteurl, -1), 80);
+       Buf = NewStrBufPlain (remoteurl, -1);
+       ParseURL(&IO->ConnectMe, Buf, 80);
+       FreeStrBuf(&Buf); /* TODO: this is uncool... */
        CurlPrepareURL(IO->ConnectMe);
        if (! evcurl_init(IO, 
 //                       Ctx, 
                          NULL,
                          "Citadel ExtNotify",
-                         EvaluateResult))
+                         EvaluateResult, 
+                         ExtNotifyTerminate))
        {
                CtdlLogPrintf(CTDL_ALERT, "Unable to initialize libcurl.\n");
                goto abort;
@@ -253,3 +258,9 @@ eNextState EvaluateResult(AsyncIO *IO)
        ///FreeStrBuf (&ReplyBuf);
        return 0;
 }
+
+eNextState ExtNotifyTerminate(AsyncIO *IO)
+{
+       free(IO);
+       return eAbort;
+}