4 * Copyright 2016 Michael Rasmussen <mir@datanom.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
38 guint status
; /* Status code from the request */
39 GSList
* headers
; /* List of headers in the response */
40 gpointer data
; /* Either gchar* or GSList* (Calendar) or GSList* (options). */
41 /* If adding or updating a component a successful */
42 /* request will return the ETag in data */
67 typedef guint (*Executor
)(gpointer runtime
);
69 FILE* file
; /* Where to write output. If file is NULL only output will be in 'output' */
70 gchar
* username
; /* Account to use */
71 gchar
* password
; /* Password for the account */
72 gchar
* url
; /* URL to caldav server */
73 gboolean debug
; /* Show debug */
74 Operation
* operation
; /* Which operation to execute */
75 CaldavResponse
* output
; /* Structure containing the response */
76 Executor executor
; /* Function which executes the request */
77 gboolean default_executor
; /* Using default executors or custom executors */
78 gchar
* etag
; /* For If-Match */
79 gchar
* component
; /* The data for UPDATEOBJECTS or ADDOBJECTS */
80 GSList
* hrefs
; /* For GETOBJECTS: list of HrefData */
81 GSList
* options
; /* List of supported options by this caldav server */
82 GDateTime
* start
; /* Start time interval in ISO 8601 local time. */
83 /* 2017-01-13T13:13:13. For freebusy or get operations */
84 GDateTime
* finish
; /* End time interval in ISO 8601 local time. */
85 /* 2017-01-13T13:13:13. For freebusy or get operations */
92 GSList
* components
; /* list of Components */
96 * Return a new Runtime structure all zeroed out.
97 * @return NULL or a new Runtime
99 Runtime
* runtime_new();
102 * Free a previously created Runtime structure.
105 void runtime_free(Runtime
* runtime
);
108 * Make a deep copy of a Runtime.
112 Runtime
* runtime_copy(Runtime
* runtime
);
115 * Execute the Runtime
119 guint
execute(Runtime
* runtime
);
122 * Make a deep copy of a Calendar structure
124 * @return a deep copy of the Calendar
126 Calendar
* calendar_copy(Calendar
* cal
);
129 * Free previously created Calendar.
132 void calendar_free(Calendar
* cal
);
135 * Dump Calendar to FILE.
139 void calendar_dump(FILE* file
, Calendar
* cal
);
142 * Test whether Component is equal to Component
145 * @return TRUE or FALSE
147 gboolean
is_component(const gchar
* value
, Component component
);
150 * Convert Component to its string representation
154 gchar
* component_to_string(Component component
);
157 * Convert a String representation of a component to Component.
161 Component
string_to_component(const gchar
* value
);
164 * Get error as String from Runtime.
168 gchar
* status_str(Runtime
* runtime
);
171 * Deep copy of a GSList containing Strings to another GSList.
175 GSList
* slist_copy_gchar(GSList
* list
);
178 * Free a GSList of Strings.
181 void slist_free_gchar(GSList
* list
);
184 * Create a new HrefData structure.
189 HrefData
* href_data_new(const gchar
* href
, const gchar
* data
);
192 * Free a HrefData structure.
195 void href_data_free(HrefData
* href_data
);
198 * Find HTTP header in GSList of HTTP headers.
203 gchar
* find_header(GSList
* list
, const gchar
* header
);
206 * Test whether caldav server supports option.
209 * @return TRUE or FALSE
211 gboolean
has_option(Runtime
* runtime
, const gchar
* option
);
214 * Convert a string representation of an ISO 8601 date to GDateTime.
218 GDateTime
* get_date_time_from_string(const gchar
* datetime
);