Back to index

webcit  8.12-dfsg
dav_report.c
Go to the documentation of this file.
00001 /*
00002  * Handles GroupDAV REPORT requests.
00003  *
00004  * Copyright (c) 2005-2012 by the citadel.org team
00005  *
00006  * This program is open source software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License version 3.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 
00016 /* SAMPLE QUERIES TO WORK WITH *
00017 
00018 REPORT /groupdav/calendar/ HTTP/1.1
00019 Content-type: application/xml
00020 Content-length: 349
00021 
00022 <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
00023   <D:prop>
00024     <D:getetag/>
00025   </D:prop>
00026   <C:filter>
00027     <C:comp-filter name="VCALENDAR">
00028       <C:comp-filter name="VEVENT">
00029         <C:time-range start="20111129T231445Z" end="20120207T231445Z"/>
00030       </C:comp-filter>
00031     </C:comp-filter>
00032   </C:filter>
00033 </C:calendar-query>
00034 
00035 
00036 REPORT /groupdav/calendar/ HTTP/1.1
00037 Content-type: application/xml
00038 Content-length: 255
00039 
00040 <C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
00041   <D:prop>
00042     <D:getetag/>
00043   </D:prop>
00044   <C:filter>
00045     <C:comp-filter name="VCALENDAR">
00046       <C:comp-filter name="VEVENT"/>
00047     </C:comp-filter>
00048   </C:filter>
00049 </C:calendar-query>
00050 
00051 */
00052 
00053 #include "webcit.h"
00054 #include "webserver.h"
00055 #include "dav.h"
00056 
00057 
00058 /*
00059  * The pathname is always going to be /groupdav/room_name/msg_num
00060  */
00061 void dav_report(void) 
00062 {
00063        char datestring[256];
00064        time_t now = time(NULL);
00065 
00066        http_datestring(datestring, sizeof datestring, now);
00067        const char *req = ChrPtr(WC->upload);
00068 
00069        syslog(LOG_DEBUG, "REPORT: \033[31m%s\033[0m", req);
00070 
00071        hprintf("HTTP/1.1 500 Internal Server Error\r\n");
00072        dav_common_headers();
00073        hprintf("Date: %s\r\n", datestring);
00074        hprintf("Content-Type: text/plain\r\n");
00075        wc_printf("An internal error has occurred at %s:%d.\r\n", __FILE__ , __LINE__ );
00076        end_burst();
00077        return;
00078 }
00079 
00080 
00081 
00082 extern int ParseMessageListHeaders_EUID(StrBuf *Line, 
00083                              const char **pos, 
00084                              message_summary *Msg, 
00085                              StrBuf *ConversionBuffer);
00086 
00087 extern int DavUIDL_GetParamsGetServerCall(SharedMessageStatus *Stat, 
00088                                      void **ViewSpecific, 
00089                                      long oper, 
00090                                      char *cmd, 
00091                                      long len,
00092                                      char *filter,
00093                                      long flen);
00094 
00095 extern int DavUIDL_RenderView_or_Tail(SharedMessageStatus *Stat, 
00096                             void **ViewSpecific, 
00097                             long oper);
00098 
00099 extern int DavUIDL_Cleanup(void **ViewSpecific);
00100 
00101 
00102 
00103 void 
00104 InitModule_REPORT
00105 (void)
00106 {
00107        RegisterReadLoopHandlerset(
00108               eReadEUIDS,
00109               DavUIDL_GetParamsGetServerCall,
00110               NULL,
00111               NULL,
00112               ParseMessageListHeaders_EUID,
00113               NULL,
00114               DavUIDL_RenderView_or_Tail,
00115               DavUIDL_Cleanup
00116        );
00117 
00118 }