Debian Codegraph @

src/EWS/common/e-ews-item.h

raw
1 /*
2 * SPDX-FileCopyrightText: (C) 1999-2008 Novell, Inc. (www.novell.com)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6 #ifndef E_EWS_ITEM_H
7 #define E_EWS_ITEM_H
8
9 #include "e-soap-request.h"
10 #include "e-soap-response.h"
11 #include "e-ews-request.h"
12
13 G_BEGIN_DECLS
14
15 #define E_TYPE_EWS_ITEM (e_ews_item_get_type ())
16 #define E_EWS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_EWS_ITEM, EEwsItem))
17 #define E_EWS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_EWS_ITEM, EEwsItemClass))
18 #define E_IS_EWS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_EWS_ITEM))
19 #define E_IS_EWS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_EWS_ITEM))
20
21 typedef struct _EEwsItem EEwsItem;
22 typedef struct _EEwsItemClass EEwsItemClass;
23 typedef struct _EEwsItemPrivate EEwsItemPrivate;
24
25 typedef enum {
26 E_EWS_BODY_TYPE_ANY,
27 E_EWS_BODY_TYPE_BEST,
28 E_EWS_BODY_TYPE_HTML,
29 E_EWS_BODY_TYPE_TEXT
30 } EEwsBodyType;
31
32 typedef enum {
33 E_EWS_ITEM_TYPE_UNKNOWN,
34 E_EWS_ITEM_TYPE_MESSAGE,
35 E_EWS_ITEM_TYPE_POST_ITEM,
36 E_EWS_ITEM_TYPE_EVENT,
37 E_EWS_ITEM_TYPE_CONTACT,
38 E_EWS_ITEM_TYPE_GROUP,
39 E_EWS_ITEM_TYPE_MEETING_MESSAGE,
40 E_EWS_ITEM_TYPE_MEETING_REQUEST,
41 E_EWS_ITEM_TYPE_MEETING_RESPONSE,
42 E_EWS_ITEM_TYPE_MEETING_CANCELLATION,
43 E_EWS_ITEM_TYPE_TASK,
44 E_EWS_ITEM_TYPE_MEMO,
45 E_EWS_ITEM_TYPE_GENERIC_ITEM,
46 E_EWS_ITEM_TYPE_ERROR
47 } EEwsItemType;
48
49 typedef enum {
50 EWS_ITEM_LOW,
51 EWS_ITEM_NORMAL,
52 EWS_ITEM_HIGH
53 } EwsImportance;
54
55 struct _EEwsItem {
56 GObject parent;
57 EEwsItemPrivate *priv;
58 };
59
60 struct _EEwsItemClass {
61 GObjectClass parent_class;
62 };
63
64 typedef struct {
65 gchar *id;
66 gchar *change_key;
67 } EwsId;
68
69 typedef struct {
70 gchar *name;
71 gchar *email;
72 gchar *routing_type;
73 gchar *mailbox_type;
74 EwsId *item_id;
75 } EwsMailbox;
76
77 typedef struct {
78 EwsMailbox *mailbox;
79 gchar *attendeetype;
80 gchar *responsetype;
81 } EwsAttendee;
82
83 typedef struct {
84 gchar *title;
85 gchar *first_name;
86 gchar *middle_name;
87 gchar *last_name;
88 gchar *suffix;
89 gchar *initials;
90 gchar *full_name;
91 gchar *nick_name;
92 gchar *yomi_first_name;
93 gchar *yomi_last_name;
94 } EwsCompleteName;
95
96 typedef struct {
97 gchar *street;
98 gchar *city;
99 gchar *state;
100 gchar *country;
101 gchar *postal_code;
102 } EwsAddress;
103
104 typedef struct {
105 gchar *filename;
106 gchar *mime_type;
107 gsize length;
108 gchar *data;
109 } EEwsAttachmentInline;
110
111 typedef enum {
112 E_EWS_ATTACHMENT_INFO_TYPE_INLINED,
113 E_EWS_ATTACHMENT_INFO_TYPE_URI
114 } EEwsAttachmentInfoType;
115
116 typedef struct {
117 EEwsAttachmentInfoType type;
118 union {
119 EEwsAttachmentInline inlined;
120 gchar *uri;
121 } data;
122 gchar *prefer_filename;
123 gchar *id;
124 } EEwsAttachmentInfo;
125
126 typedef enum {
127 E_EWS_PERMISSION_BIT_FREE_BUSY_DETAILED = 0x00001000,
128 E_EWS_PERMISSION_BIT_FREE_BUSY_SIMPLE = 0x00000800,
129 E_EWS_PERMISSION_BIT_FOLDER_VISIBLE = 0x00000400,
130 E_EWS_PERMISSION_BIT_FOLDER_CONTACT = 0x00000200,
131 E_EWS_PERMISSION_BIT_FOLDER_OWNER = 0x00000100,
132 E_EWS_PERMISSION_BIT_CREATE_SUBFOLDER = 0x00000080,
133 E_EWS_PERMISSION_BIT_DELETE_ANY = 0x00000040,
134 E_EWS_PERMISSION_BIT_EDIT_ANY = 0x00000020,
135 E_EWS_PERMISSION_BIT_DELETE_OWNED = 0x00000010,
136 E_EWS_PERMISSION_BIT_EDIT_OWNED = 0x00000008,
137 E_EWS_PERMISSION_BIT_CREATE = 0x00000002,
138 E_EWS_PERMISSION_BIT_READ_ANY = 0x00000001
139 } EEwsPermissionBits;
140
141 typedef enum {
142 E_EWS_PERMISSION_USER_TYPE_NONE = 0,
143 E_EWS_PERMISSION_USER_TYPE_ANONYMOUS = 1 << 1, /* anonymous user */
144 E_EWS_PERMISSION_USER_TYPE_DEFAULT = 1 << 2, /* default rights for any users */
145 E_EWS_PERMISSION_USER_TYPE_REGULAR = 1 << 3 /* regular user, the EEwsPermission::user_smtp member is valid */
146 } EEwsPermissionUserType;
147
148 typedef struct {
149 EEwsPermissionUserType user_type; /* whether is distinguished name, if 'true' */
150 gchar *display_name; /* display name for a user */
151 gchar *primary_smtp; /* valid only for E_EWS_PERMISSION_USER_TYPE_REGULAR */
152 gchar *sid; /* security identifier (SID), if any */
153 guint32 rights; /* EEwsPermissionBits for the user */
154 } EEwsPermission;
155
156 typedef enum {
157 E_EWS_RECURRENCE_UNKNOWN = 0,
158 E_EWS_RECURRENCE_RELATIVE_YEARLY,
159 E_EWS_RECURRENCE_ABSOLUTE_YEARLY,
160 E_EWS_RECURRENCE_RELATIVE_MONTHLY,
161 E_EWS_RECURRENCE_ABSOLUTE_MONTHLY,
162 E_EWS_RECURRENCE_WEEKLY,
163 E_EWS_RECURRENCE_DAILY,
164 E_EWS_RECURRENCE_DAILY_REGENERATION,
165 E_EWS_RECURRENCE_WEEKLY_REGENERATION,
166 E_EWS_RECURRENCE_MONTHLY_REGENERATION,
167 E_EWS_RECURRENCE_YEARLY_REGENERATION
168 } EEwsRecurrenceType;
169
170 typedef enum {
171 E_EWS_RECURRENCE_DAYS_OF_WEEK_UNKNOWN = 0,
172 E_EWS_RECURRENCE_DAYS_OF_WEEK_SUNDAY = 1 << 0,
173 E_EWS_RECURRENCE_DAYS_OF_WEEK_MONDAY = 1 << 1,
174 E_EWS_RECURRENCE_DAYS_OF_WEEK_TUESDAY = 1 << 2,
175 E_EWS_RECURRENCE_DAYS_OF_WEEK_WEDNESDAY = 1 << 3,
176 E_EWS_RECURRENCE_DAYS_OF_WEEK_THURSDAY = 1 << 4,
177 E_EWS_RECURRENCE_DAYS_OF_WEEK_FRIDAY = 1 << 5,
178 E_EWS_RECURRENCE_DAYS_OF_WEEK_SATURDAY = 1 << 6,
179 E_EWS_RECURRENCE_DAYS_OF_WEEK_DAY = 1 << 7,
180 E_EWS_RECURRENCE_DAYS_OF_WEEK_WEEKDAY = 1 << 8,
181 E_EWS_RECURRENCE_DAYS_OF_WEEK_WEEKENDDAY = 1 << 9
182 } EEwsRecurrenceDaysOfWeek;
183
184 typedef enum {
185 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_UNKNOWN = 0,
186 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_FIRST,
187 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_SECOND,
188 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_THIRD,
189 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_FOURTH,
190 E_EWS_RECURRENCE_DAY_OF_WEEK_INDEX_LAST
191 } EEwsRecurrenceDayOfWeekIndex;
192
193 typedef enum {
194 E_EWS_RECURRENCE_END_UNKNOWN = 0,
195 E_EWS_RECURRENCE_END_NO_END,
196 E_EWS_RECURRENCE_END_DATE,
197 E_EWS_RECURRENCE_END_NUMBERED
198 } EEwsRecurrenceEndType;
199
200 typedef struct {
201 EEwsRecurrenceType type;
202 union _recur {
203 struct _relative_yearly {
204 guint32 days_of_week; /* bit-or of EEwsRecurrenceDaysOfWeek */
205 EEwsRecurrenceDayOfWeekIndex day_of_week_index;
206 GDateMonth month; /* 1..12 */
207 } relative_yearly;
208
209 struct _absolute_yearly {
210 gint day_of_month; /* 1..31 */
211 GDateMonth month; /* 1..12 */
212 } absolute_yearly;
213
214 struct _relative_monthly {
215 gint interval; /* 1..99 */
216 guint32 days_of_week; /* bit-or of EEwsRecurrenceDaysOfWeek */
217 EEwsRecurrenceDayOfWeekIndex day_of_week_index;
218 } relative_monthly;
219
220 struct _absolute_monthly {
221 gint interval; /* 1..99 */
222 gint day_of_month; /* 1..31 */
223 } absolute_monthly;
224
225 struct _weekly {
226 gint interval; /* 1..99 */
227 guint32 days_of_week; /* bit-or of EEwsRecurrenceDaysOfWeek */
228 GDateWeekday first_day_of_week; /* Exchange 2013 server and above */
229 } weekly;
230
231 /* Used for daily, daily_regeneration, weekly_regeneration, monthly_regeneration and yearly_regeneration */
232 gint interval; /* 1..999 */
233 } recur;
234
235 EEwsRecurrenceEndType end_type;
236 time_t utc_start_date;
237 union _end {
238 time_t utc_end_date;
239 gint number_of_occurrences;
240 } end;
241 } EEwsRecurrence;
242
243 GType e_ews_item_get_type (void);
244 EEwsItem * e_ews_item_new_from_soap_parameter
245 (ESoapParameter *param);
246 EEwsItem * e_ews_item_new_from_error (const GError *error);
247
248 EEwsItemType e_ews_item_get_item_type (EEwsItem *item);
249 void e_ews_item_set_item_type (EEwsItem *item,
250 EEwsItemType new_type);
251 const GError * e_ews_item_get_error (EEwsItem *item);
252 void e_ews_item_set_error (EEwsItem *item,
253 const GError *error);
254 const gchar * e_ews_item_get_subject (EEwsItem *item);
255 void e_ews_item_set_subject (EEwsItem *item,
256 const gchar *new_subject);
257 const gchar * e_ews_item_get_mime_content (EEwsItem *item);
258 void e_ews_item_set_mime_content (EEwsItem *item,
259 const gchar *new_mime_content);
260 const EwsId * e_ews_item_get_id (EEwsItem *item);
261 const EwsId * e_ews_item_get_attachment_id (EEwsItem *item);
262 gsize e_ews_item_get_size (EEwsItem *item);
263 const gchar * e_ews_item_get_msg_id (EEwsItem *item);
264 const gchar * e_ews_item_get_uid (EEwsItem *item);
265 const gchar * e_ews_item_get_in_replyto (EEwsItem *item);
266 const gchar * e_ews_item_get_references (EEwsItem *item);
267 const gchar * e_ews_item_get_preview (EEwsItem *item);
268 const gchar * e_ews_item_get_date_header (EEwsItem *item);
269 time_t e_ews_item_get_date_received (EEwsItem *item);
270 time_t e_ews_item_get_date_sent (EEwsItem *item);
271 time_t e_ews_item_get_date_created (EEwsItem *item);
272 time_t e_ews_item_get_last_modified_time
273 (EEwsItem *item);
274 gboolean e_ews_item_has_attachments (EEwsItem *item,
275 gboolean *has_attachments);
276 gboolean e_ews_item_is_read (EEwsItem *item,
277 gboolean *is_read);
278 gboolean e_ews_item_is_forwarded (EEwsItem *item,
279 gboolean *is_forwarded);
280 gboolean e_ews_item_is_answered (EEwsItem *item,
281 gboolean *is_answered);
282 guint32 e_ews_item_get_message_flags (EEwsItem *item);
283 const GSList * e_ews_item_get_to_recipients (EEwsItem *item);
284 const GSList * e_ews_item_get_cc_recipients (EEwsItem *item);
285 const GSList * e_ews_item_get_bcc_recipients (EEwsItem *item);
286 const EwsMailbox *
287 e_ews_item_get_sender (EEwsItem *item);
288 const EwsMailbox *
289 e_ews_item_get_from (EEwsItem *item);
290 EwsImportance
291 e_ews_item_get_importance (EEwsItem *item);
292 const GSList *
293 e_ews_item_get_categories (EEwsItem *item);
294 gboolean e_ews_item_get_reminder_is_set (EEwsItem *item);
295 time_t e_ews_item_get_reminder_due_by (EEwsItem *item);
296 gint e_ews_item_get_reminder_minutes_before_start
297 (EEwsItem *item);
298 gboolean e_ews_item_get_recurrence (EEwsItem *item,
299 EEwsRecurrence *out_recurrence);
300 EwsMailbox *
301 e_ews_item_mailbox_from_soap_param
302 (ESoapParameter *param);
303 void e_ews_mailbox_free (EwsMailbox *mailbox);
304
305 gboolean e_ews_item_get_is_meeting (EEwsItem *item);
306 gboolean e_ews_item_get_is_response_requested
307 (EEwsItem *item);
308 const GSList * e_ews_item_get_modified_occurrences
309 (EEwsItem *item);
310 gchar * e_ews_embed_attachment_id_in_uri (const gchar *olduri, const gchar *attach_id);
311 GSList * e_ews_item_get_attachments_ids
312 (EEwsItem *item);
313 const gchar * e_ews_item_get_extended_tag (EEwsItem *item,
314 guint32 prop_tag);
315 const gchar * e_ews_item_get_extended_distinguished_tag
316 (EEwsItem *item,
317 const gchar *set_id,
318 guint32 prop_id);
319 gboolean e_ews_item_get_extended_property_as_boolean
320 (EEwsItem *item,
321 const gchar *set_id,
322 guint32 prop_id_or_tag,
323 gboolean *found);
324 gint e_ews_item_get_extended_property_as_int
325 (EEwsItem *item,
326 const gchar *set_id,
327 guint32 prop_id_or_tag,
328 gboolean *found);
329 gdouble e_ews_item_get_extended_property_as_double
330 (EEwsItem *item,
331 const gchar *set_id,
332 guint32 prop_id_or_tag,
333 gboolean *found);
334 const gchar * e_ews_item_get_extended_property_as_string
335 (EEwsItem *item,
336 const gchar *set_id,
337 guint32 prop_id_or_tag,
338 gboolean *found);
339 time_t e_ews_item_get_extended_property_as_time
340 (EEwsItem *item,
341 const gchar *set_id,
342 guint32 prop_id_or_tag,
343 gboolean *found);
344
345 EEwsAttachmentInfo *
346 e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gchar *cache, const gchar *comp_uid);
347
348 EEwsAttachmentInfo *
349 e_ews_item_dump_mime_content (EEwsItem *item, const gchar *cache);
350
351 const gchar * e_ews_item_get_my_response_type (EEwsItem *item);
352 const GSList * e_ews_item_get_attendees (EEwsItem *item);
353
354 const EwsId * e_ews_item_get_calendar_item_accept_id
355 (EEwsItem *item);
356
357 EEwsAttachmentInfo *
358 e_ews_attachment_info_new (EEwsAttachmentInfoType type);
359 void e_ews_attachment_info_free (EEwsAttachmentInfo *info);
360 EEwsAttachmentInfoType
361 e_ews_attachment_info_get_type (EEwsAttachmentInfo *info);
362 const gchar * e_ews_attachment_info_get_prefer_filename
363 (EEwsAttachmentInfo *info);
364 void e_ews_attachment_info_set_prefer_filename
365 (EEwsAttachmentInfo *info,
366 const gchar *prefer_filename);
367 const gchar * e_ews_attachment_info_get_inlined_data
368 (EEwsAttachmentInfo *info,
369 gsize *len);
370 void e_ews_attachment_info_set_inlined_data
371 (EEwsAttachmentInfo *info,
372 const guchar *data,
373 gsize len);
374 const gchar * e_ews_attachment_info_get_mime_type
375 (EEwsAttachmentInfo *info);
376 void e_ews_attachment_info_set_mime_type
377 (EEwsAttachmentInfo *info,
378 const gchar *mime_type);
379 const gchar * e_ews_attachment_info_get_filename
380 (EEwsAttachmentInfo *info);
381 void e_ews_attachment_info_set_filename
382 (EEwsAttachmentInfo *info,
383 const gchar *filename);
384 const gchar * e_ews_attachment_info_get_uri (EEwsAttachmentInfo *info);
385 void e_ews_attachment_info_set_uri (EEwsAttachmentInfo *info,
386 const gchar *uri);
387 const gchar * e_ews_attachment_info_get_id (EEwsAttachmentInfo *info);
388 void e_ews_attachment_info_set_id (EEwsAttachmentInfo *info,
389 const gchar *id);
390
391
392 /* Contact fields */
393 const gchar * e_ews_item_get_fileas (EEwsItem *item);
394 const EwsCompleteName *
395 e_ews_item_get_complete_name (EEwsItem *item);
396 const gchar * e_ews_item_get_display_name (EEwsItem *item);
397 GHashTable * e_ews_item_get_email_addresses (EEwsItem *item);
398 const gchar * e_ews_item_get_email_address (EEwsItem *item, const gchar *type);
399 const EwsAddress *
400 e_ews_item_get_physical_address (EEwsItem *item, const gchar *type);
401 const gchar * e_ews_item_get_phone_number (EEwsItem *item, const gchar *type);
402 const gchar * e_ews_item_get_im_address (EEwsItem *item, const gchar *type);
403
404 const gchar * e_ews_item_get_company_name (EEwsItem *item);
405 const gchar * e_ews_item_get_department (EEwsItem *item);
406 const gchar * e_ews_item_get_job_title (EEwsItem *item);
407 const gchar * e_ews_item_get_assistant_name (EEwsItem *item);
408 const gchar * e_ews_item_get_manager (EEwsItem *item);
409 const gchar * e_ews_item_get_office_location (EEwsItem *item);
410 const gchar * e_ews_item_get_business_homepage
411 (EEwsItem *item);
412 time_t e_ews_item_get_birthday (EEwsItem *item,
413 gboolean *out_exists);
414 time_t e_ews_item_get_wedding_anniversary
415 (EEwsItem *item,
416 gboolean *out_exists);
417 const gchar * e_ews_item_get_profession (EEwsItem *item);
418 const gchar * e_ews_item_get_spouse_name (EEwsItem *item);
419 const gchar * e_ews_item_get_culture (EEwsItem *item);
420 const gchar * e_ews_item_get_surname (EEwsItem *item);
421 const gchar * e_ews_item_get_givenname (EEwsItem *item);
422 const gchar * e_ews_item_get_middlename (EEwsItem *item);
423 const gchar * e_ews_item_get_notes (EEwsItem *item);
424 const guchar * e_ews_item_get_user_certificate (EEwsItem *item,
425 gsize *out_len);
426 const guchar * e_ews_item_get_msexchange_certificate
427 (EEwsItem *item,
428 gsize *out_len);
429
430 /*Task fields*/
431 const gchar * e_ews_item_get_status (EEwsItem *item);
432 const gchar * e_ews_item_get_percent_complete (EEwsItem *item);
433 const gchar * e_ews_item_get_sensitivity (EEwsItem *item);
434 const gchar * e_ews_item_get_body (EEwsItem *item);
435 EEwsBodyType e_ews_item_get_body_type (EEwsItem *item);
436 const gchar * e_ews_item_get_owner (EEwsItem *item);
437 const gchar * e_ews_item_get_delegator (EEwsItem *item);
438 time_t e_ews_item_get_due_date (EEwsItem *item);
439 time_t e_ews_item_get_start_date (EEwsItem *item);
440 time_t e_ews_item_get_complete_date (EEwsItem *item);
441 gboolean e_ews_item_task_has_start_date (EEwsItem *item,
442 gboolean *has_date);
443 gboolean e_ews_item_task_has_due_date (EEwsItem *item,
444 gboolean *has_date);
445 gboolean e_ews_item_task_has_complete_date
446 (EEwsItem * item,
447 gboolean * has_date);
448 const gchar * e_ews_item_get_tzid (EEwsItem *item);
449 const gchar * e_ews_item_get_start_tzid (EEwsItem *item);
450 const gchar * e_ews_item_get_end_tzid (EEwsItem *item);
451 time_t e_ews_item_get_start (EEwsItem *item);
452 time_t e_ews_item_get_end (EEwsItem *item);
453 const gchar * e_ews_item_get_contact_photo_id (EEwsItem *item);
454 const gchar * e_ews_item_get_iana_start_time_zone
455 (EEwsItem *item);
456 const gchar * e_ews_item_get_iana_end_time_zone
457 (EEwsItem *item);
458 const gchar * e_ews_item_get_event_url (EEwsItem *item);
459
460 /* Folder Permissions */
461 EEwsPermission *e_ews_permission_new (EEwsPermissionUserType user_type,
462 const gchar *display_name,
463 const gchar *primary_smtp,
464 const gchar *sid,
465 guint32 rights);
466 void e_ews_permission_free (EEwsPermission *perm);
467
468 const gchar * e_ews_permission_rights_to_level_name
469 (guint32 rights);
470 guint32 e_ews_permission_level_name_to_rights
471 (const gchar *level_name);
472
473 GSList * e_ews_permissions_from_soap_param
474 (ESoapParameter *param);
475 void e_ews_permissions_free (GSList *permissions);
476
477 /* Utility functions */
478 const gchar * e_ews_item_util_strip_ex_address
479 (const gchar *ex_address);
480 EwsId * e_ews_id_copy (const EwsId *ews_id);
481 void e_ews_id_free (EwsId *ews_id);
482
483 G_END_DECLS
484
485 #endif