2 Convert Exchange appointments to ICAL
6 Copyright (C) Julien Kerihuel 2008
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __EXCHANGE2ICAL_H_
23 #define __EXCHANGE2ICAL_H_
25 #include "libmapi/libmapi.h"
26 #include <gen_ndr/ndr_property.h>
27 #include "utils/openchange-tools.h"
29 #include <libical/ical.h>
35 #define __BEGIN_DECLS extern "C" {
44 struct message_recipients {
45 struct SRowSet SRowSet;
46 struct SPropTagArray SPropTagArray;
49 enum exchange2ical_flags{
57 struct exchange2ical_check {
58 enum exchange2ical_flags eFlags;
61 struct GlobalObjectId *GlobalObjectId;
65 struct exchange2ical {
67 struct message_recipients Recipients;
68 enum icalproperty_method method;
69 enum icalparameter_partstat partstat;
70 uint32_t *ResponseStatus;
72 struct RecurrencePattern *RecurrencePattern;
73 struct TimeZoneStruct *TimeZoneStruct;
74 const char *TimeZoneDesc;
75 const struct StringArray_r *Keywords;
76 const struct StringArray_r *Contacts;
77 uint32_t *apptStateFlags;
78 uint32_t *sensitivity;
80 const struct FILETIME *created;
82 const struct FILETIME *apptStartWhole;
83 const struct FILETIME *apptEndWhole;
84 const struct FILETIME *OwnerCriticalChange;
85 const struct FILETIME *LastModified;
86 const struct FILETIME *ExceptionReplaceTime;
89 uint8_t *ResponseRequested;
90 const char *NonSendableBcc;
93 uint32_t *MessageLocaleId;
95 uint32_t *IntendedBusyStatus;
96 struct Binary_r *GlobalObjectId;
97 const struct FILETIME *AttendeeCriticalChange;
98 uint32_t *OwnerApptId;
99 const struct FILETIME *apptReplyTime;
100 uint8_t *NotAllowPropose;
101 uint8_t *AllowExternCheck;
102 uint32_t *apptLastSequence;
103 const struct FILETIME *apptSeqTime;
104 uint8_t *AutoFillLocation;
105 uint8_t *AutoStartCheck;
106 const char *CollaborateDoc;
109 const char *Directory;
111 const char *NetShowURL;
112 const char *OnlinePassword;
113 const char *OrgAlias;
114 const char *SenderName;
115 const char *SenderEmailAddress;
116 uint8_t *ReminderSet;
117 uint32_t *ReminderDelta;
118 icalcomponent *vcalendar;
119 icalcomponent *vevent;
120 icalcomponent *vtimezone;
121 icalcomponent *valarm;
122 mapi_object_t obj_message;
123 const char *bodyHTML;
125 struct AppointmentRecurrencePattern *AppointmentRecurrencePattern;
130 enum icalproperty_method method;
131 enum icalparameter_partstat partstat;
132 const char *PidTagMessageClass;
135 struct ical_calendartype {
137 const char *calendar;
141 enum icalrecurrencetype_weekday ical;
142 enum FirstDOW exchange;
149 enum icalproperty_class classtype;
153 #define OPENCHANGE_ICAL_PRODID "-//OpenChange Project/exchange2ical MIMEDIR//EN"
154 #define OPENCHANGE_ICAL_VERSION "2.0"
158 /* definitions from exchang2ical.c */
159 icalcomponent * _Exchange2Ical(mapi_object_t *, struct exchange2ical_check *);
162 /* definitions from exchange2ical_utils.c */
163 struct icaltimetype get_icaltime_from_FILETIME(const struct FILETIME *);
164 struct icaltimetype get_icaltime_from_FILETIME_UTC(const struct FILETIME *);
165 struct icaltimetype get_icaldate_from_FILETIME(const struct FILETIME *);
166 struct tm *get_tm_from_FILETIME(const struct FILETIME *);
167 struct icaltimetype get_icaldate_from_tm(struct tm *);
168 struct icaltimetype get_icaltimetype_from_tm_UTC(struct tm *);
169 struct icaltimetype get_icaltimetype_from_tm(struct tm *);
170 struct FILETIME get_FILETIME_from_string(const char *);
171 struct FILETIME get_FILETIME_from_icaltimetype(icaltimetype *);
172 struct tm get_tm_from_minutes(uint32_t);
173 struct tm get_tm_from_minutes_UTC(uint32_t);
174 struct icaltimetype get_icaldate_from_GlobalObjectId(struct GlobalObjectId *);
175 NTTIME FILETIME_to_NTTIME(struct FILETIME);
176 enum icalproperty_method get_ical_method(const char *);
177 enum icalparameter_partstat get_ical_partstat(const char *);
178 enum icalproperty_class get_ical_class(uint32_t);
179 enum icalparameter_partstat get_ical_partstat_from_status(uint32_t);
180 enum FirstDOW get_exchange_day_from_ical(enum icalrecurrencetype_weekday);
181 uint8_t set_exception_from_ExceptionInfo(struct exchange2ical *, struct exchange2ical_check *);
182 uint8_t set_exception_from_EmbeddedObj(struct exchange2ical *, struct exchange2ical_check *);
183 bool checkEvent(struct exchange2ical *, struct exchange2ical_check *, struct tm *);
184 bool compareGlobalObjectIds(struct GlobalObjectId *, struct GlobalObjectId *);
185 bool has_component_DAYLIGHT(struct exchange2ical *);
186 uint16_t get_exchange_calendartype(const char *);
187 uint32_t get_minutes_from_icaltimetype(icaltimetype);
188 uint32_t get_exchange_rdfDays_from_ical(enum icalrecurrencetype_weekday);
189 const char *get_ical_calendartype(uint16_t);
190 char *get_ical_date(TALLOC_CTX *, struct SYSTEMTIME *);
191 int compare_minutes(const void *, const void *);
193 /* definitions from exchange2ical_component.c */
194 void ical_component_VCALENDAR(struct exchange2ical *);
195 void ical_component_VEVENT(struct exchange2ical *);
196 void ical_component_VTIMEZONE(struct exchange2ical *);
197 void ical_component_STANDARD(struct exchange2ical *);
198 void ical_component_DAYLIGHT(struct exchange2ical *);
199 void ical_component_VALARM(struct exchange2ical *);
202 /* definitions from exchange2ical_property.c */
203 void ical_property_ATTACH(struct exchange2ical *);
204 void ical_property_ATTENDEE(struct exchange2ical *);
205 void ical_property_CATEGORIES(struct exchange2ical *);
206 void ical_property_CLASS(struct exchange2ical *);
207 void ical_property_CONTACT(struct exchange2ical *);
208 void ical_property_CREATED(struct exchange2ical *);
209 void ical_property_DTEND(struct exchange2ical *);
210 void ical_property_DTSTAMP(struct exchange2ical *);
211 void ical_property_DTSTART(struct exchange2ical *);
212 void ical_property_DESCRIPTION(struct exchange2ical *);
213 void ical_property_EXDATE(struct exchange2ical *);
214 void ical_property_LAST_MODIFIED(struct exchange2ical *);
215 void ical_property_LOCATION(struct exchange2ical *);
216 void ical_property_ORGANIZER(struct exchange2ical *);
217 void ical_property_PRIORITY(struct exchange2ical *);
218 void ical_property_RDATE(struct exchange2ical *);
219 void ical_property_RRULE_Daily(struct exchange2ical *);
220 void ical_property_RRULE_Weekly(struct exchange2ical *);
221 void ical_property_RRULE_Monthly(struct exchange2ical *);
222 void ical_property_RRULE_NthMonthly(struct exchange2ical *);
223 void ical_property_RRULE_Yearly(struct exchange2ical *);
224 void ical_property_RRULE_NthYearly(struct exchange2ical *);
225 void ical_property_RRULE(struct exchange2ical *);
226 void ical_property_RRULE_daylight_standard(icalcomponent*, struct SYSTEMTIME);
227 void ical_property_RECURRENCE_ID(struct exchange2ical *);
228 void ical_property_RESOURCES(struct exchange2ical *);
229 void ical_property_SEQUENCE(struct exchange2ical *);
230 void ical_property_SUMMARY(struct exchange2ical *);
231 void ical_property_TRANSP(struct exchange2ical *);
232 void ical_property_TRIGGER(struct exchange2ical *);
233 void ical_property_UID(struct exchange2ical *);
234 void ical_property_X_ALT_DESC(struct exchange2ical *);
235 void ical_property_X_MICROSOFT_CDO_ATTENDEE_CRITICAL_CHANGE(struct exchange2ical *);
236 void ical_property_X_MICROSOFT_CDO_BUSYSTATUS(struct exchange2ical *);
237 void ical_property_X_MICROSOFT_CDO_INTENDEDSTATUS(struct exchange2ical *);
238 void ical_property_X_MICROSOFT_CDO_OWNERAPPTID(struct exchange2ical *);
239 void ical_property_X_MICROSOFT_CDO_OWNER_CRITICAL_CHANGE(struct exchange2ical *);
240 void ical_property_X_MICROSOFT_CDO_REPLYTIME(struct exchange2ical *);
241 void ical_property_X_MICROSOFT_DISALLOW_COUNTER(struct exchange2ical *);
242 void ical_property_X_MS_OLK_ALLOWEXTERNCHECK(struct exchange2ical *);
243 void ical_property_X_MS_OLK_APPTLASTSEQUENCE(struct exchange2ical *);
244 void ical_property_X_MS_OLK_APPTSEQTIME(struct exchange2ical *);
245 void ical_property_X_MS_OLK_AUTOFILLLOCATION(struct exchange2ical *);
246 void ical_property_X_MS_OLK_AUTOSTARTCHECK(struct exchange2ical *);
247 void ical_property_X_MS_OLK_COLLABORATEDOC(struct exchange2ical *);
248 void ical_property_X_MS_OLK_CONFCHECK(struct exchange2ical *);
249 void ical_property_X_MS_OLK_CONFTYPE(struct exchange2ical *);
250 void ical_property_X_MS_OLK_DIRECTORY(struct exchange2ical *);
251 void ical_property_X_MS_OLK_MWSURL(struct exchange2ical *);
252 void ical_property_X_MS_OLK_NETSHOWURL(struct exchange2ical *);
253 void ical_property_X_MS_OLK_ONLINEPASSWORD(struct exchange2ical *);
254 void ical_property_X_MS_OLK_ORGALIAS(struct exchange2ical *);
255 void ical_property_X_MS_OLK_SENDER(struct exchange2ical *);
256 void ical_property_X_MICROSOFT_MSNCALENDAR_IMPORTANCE(struct exchange2ical *);
259 struct ical2exchange{
261 enum icalproperty_method method;
262 icalproperty *classProp;
263 icalproperty *commentProp;
264 icalproperty *descriptionProp;
265 icalproperty *dtendProp;
266 icalproperty *dtstampProp;
267 icalproperty *dtstartProp;
268 icalproperty *durationProp;
269 icalproperty *locationProp;
270 icalproperty *organizerProp;
271 icalproperty *priorityProp;
272 icalproperty *recurrenceidProp;
273 icalproperty *rruleProp;
274 icalproperty *sequenceProp;
275 icalproperty *statusProp;
276 icalproperty *summaryProp;
277 icalproperty *transpProp;
278 icalproperty *uidProp;
281 uint32_t exdateCount;
284 icalproperty *x_busystatusProp;
285 icalproperty *x_sequenceProp;
286 icalproperty *x_importanceProp;
287 icalproperty *x_intendedProp;
288 icalproperty *x_ownerapptidProp;
289 icalproperty *x_attendeecriticalchangeProp;
290 icalproperty *x_replytimeProp;
291 icalproperty *x_disallowcounterProp;
292 icalproperty *x_isdraftProp;
293 icalproperty *x_allowexterncheckProp;
294 icalproperty *x_apptlastsequenceProp;
295 icalproperty *x_apptseqtimeProp;
296 icalproperty *x_autofilllocationProp;
297 icalproperty *x_autostartcheckProp;
298 icalproperty *x_confcheckProp;
299 icalproperty *x_collaborateddocProp;
300 icalproperty *x_conftypeProp;
301 icalproperty *x_mwsurlProp;
302 icalproperty *x_netshowurlProp;
303 icalproperty *x_onlinepasswordProp;
304 icalproperty *x_originalstartProp;
305 icalproperty *x_originalendProp;
306 icalproperty *x_orgaliasProp;
307 icalproperty *x_ownercriticalchangeProp;
311 icalcomponent *attachEvent;
312 icalcomponent *attendeeEvent;
313 icalcomponent *categoriesEvent;
314 icalcomponent *contactEvent;
315 icalcomponent *exdateEvent;
316 icalcomponent *rdateEvent;
317 icalcomponent *resourcesEvent;
318 icalcomponent *valarmEvent;
320 mapi_object_t *obj_message;
321 struct SPropValue *lpProps;
327 /*ical2exchange file*/
328 void _IcalEvent2Exchange(mapi_object_t *, icalcomponent *);
331 /*ical2exchange_property*/
332 void ical2exchange_property_ATTACH(struct ical2exchange *);
333 //TODO ATTENDEE, ORGANIZER, x_ms_ok_sender
334 void ical2exchange_property_CATEGORIES(struct ical2exchange *);
335 void ical2exchange_property_CLASS(struct ical2exchange *);
336 void ical2exchange_property_COMMENT(struct ical2exchange *);
337 void ical2exchange_property_CONTACT(struct ical2exchange *);
338 void ical2exchange_property_DESCRIPTION(struct ical2exchange *);
339 void ical2exchange_property_DTSTAMP(struct ical2exchange *);
340 void ical2exchange_property_DTSTART_DTEND(struct ical2exchange *);
341 void ical2exchange_property_LOCATION(struct ical2exchange *);
342 void ical2exchange_property_PRIORITY(struct ical2exchange *);
343 void ical2exchange_property_RRULE_EXDATE_RDATE(struct ical2exchange *);
344 void ical2exchange_property_SEQUENCE(struct ical2exchange *);
345 void ical2exchange_property_STATUS(struct ical2exchange *);
346 void ical2exchange_property_SUMMARY(struct ical2exchange *);
347 void ical2exchange_property_VALARM(struct ical2exchange *);
348 void ical2exchange_property_X_ALLOWEXTERNCHECK(struct ical2exchange *);
349 void ical2exchange_property_X_APPTSEQTIME(struct ical2exchange *);
350 void ical2exchange_property_X_APPTLASTSEQUENCE(struct ical2exchange *);
351 void ical2exchange_property_X_ATTENDEE_CRITICAL_CHANGE(struct ical2exchange *);
352 void ical2exchange_property_X_AUTOFILLLOCATION(struct ical2exchange *);
353 void ical2exchange_property_X_AUTOSTARTCHECK(struct ical2exchange *);
354 void ical2exchange_property_X_COLLABORATEDDOC(struct ical2exchange *);
355 void ical2exchange_property_X_CONFCHECK(struct ical2exchange *);
356 void ical2exchange_property_X_CONFTYPE(struct ical2exchange *);
357 void ical2exchange_property_X_DISALLOW_COUNTER(struct ical2exchange *);
358 void ical2exchange_property_X_INTENDEDSTATUS(struct ical2exchange *);
359 void ical2exchange_property_X_ISDRAFT(struct ical2exchange *);
360 void ical2exchange_property_X_MWSURL(struct ical2exchange *);
361 void ical2exchange_property_X_NETSHOWURL(struct ical2exchange *);
362 void ical2exchange_property_X_ONLINEPASSWORD(struct ical2exchange *);
363 void ical2exchange_property_X_ORGALIAS(struct ical2exchange *);
364 void ical2exchange_property_X_ORIGINALEND_ORIGINALSTART(struct ical2exchange *);
365 void ical2exchange_property_X_OWNER_CRITICAL_CHANGE(struct ical2exchange *);
366 void ical2exchange_property_X_OWNERAPPTID(struct ical2exchange *);
367 void ical2exchange_property_X_REPLYTIME(struct ical2exchange *);
372 #endif /* __EXCHANGE2ICAL_H_ */