a7fb8ba1d3094032a85df3365612257ad67573b3
[citadel.git] / citadel / server / modules / calendar / calendar_report.c
1 // This is a handler for calendar "report" operations.
2 // It is expected that CALDAV REPORT operations should be able to use this directly.
3 //
4 // Copyright (c) 1987-2024 by the citadel.org team
5 //
6 // This program is open source software.  Use, duplication, or disclosure
7 // are subject to the terms of the GNU General Public License version 3.
8
9 #include <libical/ical.h>
10 #include "../../ctdl_module.h"
11 #include "../../msgbase.h"
12 #include "../../internet_addressing.h"
13 #include "../../room_ops.h"
14 #include "../../euidindex.h"
15 #include "../../default_timezone.h"
16 #include "../../config.h"
17 #include "serv_calendar.h"
18
19
20 // CtdlForEachMessage back end
21 void calendar_report_backend(long msgnum, void *data) {
22         syslog(LOG_DEBUG, "%ld", msgnum);
23 }
24
25
26 void calendar_report(void) {
27         char buf[SIZ];
28
29         // Only allow this operation if we're in a room containing a calendar or tasks view
30         if (    (CC->room.QRdefaultview != VIEW_CALENDAR)
31                 && (CC->room.QRdefaultview != VIEW_TASKS)
32         ) {
33                 cprintf("%d Not a calendar room\n", ERROR+NOT_HERE);
34                 return;         // This room does not contain a calendar.
35         }
36
37
38         // Now go through the room encapsulating all calendar items.
39         void *foo;
40         CtdlForEachMessage(MSGS_ALL, 0, NULL,
41                 NULL,
42                 NULL,
43                 calendar_report_backend,
44                 (void *) foo
45         );
46
47         cprintf("%d Not finished\n", ERROR);
48         //cprintf("%d Send query then receive response\n", SEND_THEN_RECV);
49         //while(client_getln(buf, sizeof buf) >= 0 && strcmp(buf,"000")) {
50         //}
51         //cprintf("000\n");
52 }
53
54