]> code.citadel.org Git - citadel.git/blobdiff - webcit/context_loop.c
* migrate message creation to templates (citing still missing)
[citadel.git] / webcit / context_loop.c
index 932bb7c27b2110d553c864cb0a5bffc8ed13894e..7b646fbd4e8b8d555265554924d5110d1ff8c0d0 100644 (file)
@@ -22,15 +22,12 @@ pthread_key_t MyConKey;         /**< TSD key for MySession() */
 /*
  * free the memory used for viewing atachments
  */
-void free_attachments(struct wcsession *sess) {
-       struct wc_attachment *att;
-
-       while (sess->first_attachment != NULL) {
-               att = sess->first_attachment;
-               sess->first_attachment = sess->first_attachment->next;
-               free(att->data);
-               free(att);
-       }
+void free_attachment(void *vattach) {
+       wc_attachment *att = (wc_attachment*) vattach;
+       FreeStrBuf(&att->content_type);
+       FreeStrBuf(&att->filename);
+       free(att->data);
+       free(att);
 }
 
 
@@ -44,7 +41,7 @@ void DestroySession(struct wcsession **sessions_to_kill)
        if ((*sessions_to_kill)->cache_fold != NULL) {
                free((*sessions_to_kill)->cache_fold);
        }
-       free_attachments((*sessions_to_kill));
+       DeleteHash(&((*sessions_to_kill)->attachments));
        free_march_list((*sessions_to_kill));
        DeleteHash(&((*sessions_to_kill)->hash_prefs));
        DeleteHash(&((*sessions_to_kill)->IconBarSetttings));
@@ -319,7 +316,8 @@ void context_loop(int *sock)
        int nLine = 0;
        int LineLen;
        void *vLine;
-       StrBuf *Buf, *Line, *LastLine, *HeaderName, *ReqLine, *accept_language, *ReqType, *HTTPVersion;
+       StrBuf *Buf, *Line, *LastLine, *HeaderName, *ReqLine, *ReqType, *HTTPVersion;
+       StrBuf *accept_language = NULL;
        const char *pch, *pchs, *pche;
        HashList *HTTPHeaders;
 
@@ -446,8 +444,8 @@ void context_loop(int *sock)
        StrBufCutLeft(ReqLine, StrLength(ReqType) + 1);
        StrBufCutRight(ReqLine, StrLength(HTTPVersion) + 1);
 
-       if ((StrLength(ReqLine) >= 7) &&
-           (ptr = strstr(ChrPtr(ReqLine), "/webcit"),  /*< Handle "/webcit" */
+       if ((StrLength(ReqLine) >= 8) &&
+           (ptr = strstr(ChrPtr(ReqLine), "/webcit/"), /*< Handle "/webcit/" */
             (ptr != NULL))) {
                StrBufCutLeft(ReqLine, 7);
        }
@@ -599,6 +597,7 @@ void context_loop(int *sock)
 #ifdef ENABLE_NLS
        stop_selected_language();                               /* unset locale */
 #endif
+       DeleteHash(&TheSession->summ);
        DeleteHash(&TheSession->urlstrings);
        DeleteHash(&TheSession->vars);
        FreeStrBuf(&TheSession->WBuf);
@@ -620,7 +619,7 @@ void context_loop(int *sock)
        
 }
 
-void tmpl_nonce(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmpl_nonce(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
 {
        struct wcsession *WCC = WC;
        StrBufAppendPrintf(Target, "%ld",
@@ -631,5 +630,5 @@ void
 InitModule_CONTEXT
 (void)
 {
-       RegisterNamespace("NONCE", 0, 0, tmpl_nonce);
+       RegisterNamespace("NONCE", 0, 0, tmpl_nonce, 0);
 }