final touches on dkim test harness
[citadel.git] / webcit / dav_propfind.c
index 66b2063e9139dfc3f1081b4ee9263035d00705ae..b09b52c175aa782a574a6125586984e67010ca02 100644 (file)
  * References:
  * http://www.ietf.org/rfc/rfc4791.txt
  * http://blogs.nologin.es/rickyepoderi/index.php?/archives/14-Introducing-CalDAV-Part-I.html
-
-Sample query:
-
-PROPFIND /groupdav/calendar/ HTTP/1.1
-Content-type: text/xml; charset=utf-8
-Content-length: 166
-
-<?xml version="1.0" encoding="UTF-8"?>
-<D:propfind xmlns:D="DAV:">
-  <D:prop>
-    <D:getcontenttype/>
-    <D:resourcetype/>
-    <D:getetag/>
-  </D:prop>
-</D:propfind>
-
+ * https://msdn.microsoft.com/en-us/library/aa142960(v=exchg.65).aspx
  *
- * Copyright (c) 2005-2012 by the citadel.org team
+ * Copyright (c) 2005-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 3.
@@ -42,7 +27,7 @@ Content-length: 166
  */
 
 #include "webcit.h"
-#include "webserver.h"
+
 #include "dav.h"
 
 /*
@@ -167,7 +152,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders)
                        {
                                DeleteHashPos(&itd);
                                
-                               syslog(0, "5\n");
+                               syslog(LOG_DEBUG, "5\n");
                                continue;
                        }
                        DeleteHashPos(&itd);
@@ -178,7 +163,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders)
                        {
                                DeleteHashPos(&itd);
                                
-                               syslog(0, "5\n");
+                               syslog(LOG_DEBUG, "5\n");
                                continue;
                        }
                        DeleteHashPos(&itfl);
@@ -723,14 +708,18 @@ void dav_propfind(void)
        
                        if (!IsEmptyStr(uid)) {
                                wc_printf("<D:response>");
-                                       wc_printf("<D:href>");
-                                               dav_identify_host();
-                                               wc_printf("/groupdav/");
-                                               urlescputs(ChrPtr(WCC->CurRoom.name));
-                                               euid_escapize(encoded_uid, uid);
-                                               wc_printf("/%s", encoded_uid);
-                                       wc_printf("</D:href>");
-                                       switch(WCC->CurRoom.defview) {
+                               wc_printf("<D:href>");
+                               dav_identify_host();
+                               wc_printf("/groupdav/");
+                               urlescputs(ChrPtr(WCC->CurRoom.name));
+                               euid_escapize(encoded_uid, uid);
+                               wc_printf("/%s", encoded_uid);
+                               wc_printf("</D:href>");
+                               wc_printf("<D:propstat>");
+                               wc_printf("<D:status>HTTP/1.1 200 OK</D:status>");
+                               wc_printf("<D:prop>");
+                               wc_printf("<D:getetag>\"%ld\"</D:getetag>", msgs[i]);
+                               switch(WCC->CurRoom.defview) {
                                        case VIEW_CALENDAR:
                                                wc_printf("<D:getcontenttype>text/x-ical</D:getcontenttype>");
                                                break;
@@ -740,19 +729,15 @@ void dav_propfind(void)
                                        case VIEW_ADDRESSBOOK:
                                                wc_printf("<D:getcontenttype>text/x-vcard</D:getcontenttype>");
                                                break;
-                                       }
-                                       wc_printf("<D:propstat>");
-                                               wc_printf("<D:status>HTTP/1.1 200 OK</D:status>");
-                                               wc_printf("<D:prop>");
-                                                       wc_printf("<D:getetag>\"%ld\"</D:getetag>", msgs[i]);
-                                               if (now > 0L) {
-                                                       http_datestring(datestring, sizeof datestring, now);
-                                                       wc_printf("<D:getlastmodified>");
-                                                       escputs(datestring);
-                                                       wc_printf("</D:getlastmodified>");
-                                               }
-                                               wc_printf("</D:prop>");
-                                       wc_printf("</D:propstat>");
+                               }
+                               if (now > 0L) {
+                                       http_datestring(datestring, sizeof datestring, now);
+                                       wc_printf("<D:getlastmodified>");
+                                       escputs(datestring);
+                                       wc_printf("</D:getlastmodified>");
+                               }
+                               wc_printf("</D:prop>");
+                               wc_printf("</D:propstat>");
                                wc_printf("</D:response>");
                        }
                }
@@ -772,7 +757,8 @@ void dav_propfind(void)
 int ParseMessageListHeaders_EUID(StrBuf *Line, 
                                 const char **pos, 
                                 message_summary *Msg, 
-                                StrBuf *ConversionBuffer)
+                                StrBuf *ConversionBuffer,
+                                void **ViewSpecific)
 {
        Msg->euid = NewStrBuf();
        StrBufExtract_NextToken(Msg->euid,  Line, pos, '|');
@@ -828,10 +814,11 @@ InitModule_PROPFIND
                eReadEUIDS,
                DavUIDL_GetParamsGetServerCall,
                NULL,
-               NULL, /// TODO: is this right?
+               NULL,
                ParseMessageListHeaders_EUID,
-               NULL, //// ""
+               NULL,
                DavUIDL_RenderView_or_Tail,
-               DavUIDL_Cleanup);
+               DavUIDL_Cleanup,
+               NULL);
 
 }