Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / calendar / libecal / e-cal-util.h
1 /* Evolution calendar utilities and types
2  *
3  * Copyright (C) 2000 Ximian, Inc.
4  * Copyright (C) 2000 Ximian, Inc.
5  *
6  * Author: Federico Mena-Quintero <federico@ximian.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2 of the GNU Lesser General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef E_CAL_UTIL_H
23 #define E_CAL_UTIL_H
24
25 #include <libical/ical.h>
26 #include <time.h>
27 #include <glib.h>
28 #include <libecal/e-cal-component.h>
29 #include <libecal/e-cal-recur.h>
30
31 G_BEGIN_DECLS
32
33 \f
34
35 /* Instance of a calendar object.  This can be an actual occurrence, a
36  * recurrence, or an alarm trigger of a `real' calendar object.
37  */
38 typedef struct {
39         char *uid;                      /* UID of the object */
40         time_t start;                   /* Start time of instance */
41         time_t end;                     /* End time of instance */
42 } CalObjInstance;
43
44 void cal_obj_instance_list_free (GList *list);
45
46 /* Used for modifying objects */
47 typedef enum {
48         CALOBJ_MOD_THIS          = 1 << 0,
49         CALOBJ_MOD_THISANDPRIOR  = 1 << 1,
50         CALOBJ_MOD_THISANDFUTURE = 1 << 2,
51         CALOBJ_MOD_ALL           = 0x07
52 } CalObjModType;
53
54 /* Used for mode stuff */
55 typedef enum {
56         CAL_MODE_INVALID = -1,
57         CAL_MODE_LOCAL   = 1 << 0,
58         CAL_MODE_REMOTE  = 1 << 1,
59         CAL_MODE_ANY     = 0x07
60 } CalMode;
61
62 #define cal_mode_to_corba(mode) \
63         (mode == CAL_MODE_LOCAL   ? GNOME_Evolution_Calendar_MODE_LOCAL  : \
64          mode == CAL_MODE_REMOTE  ? GNOME_Evolution_Calendar_MODE_REMOTE : \
65          GNOME_Evolution_Calendar_MODE_ANY)
66
67 void cal_obj_uid_list_free (GList *list);
68
69 icalcomponent *e_cal_util_new_top_level (void);
70 icalcomponent *e_cal_util_new_component (icalcomponent_kind kind);
71
72 icalcomponent *e_cal_util_parse_ics_string (const char *string);
73 icalcomponent *e_cal_util_parse_ics_file (const char *filename);
74
75 ECalComponentAlarms *e_cal_util_generate_alarms_for_comp (ECalComponent *comp,
76                                                        time_t start,
77                                                        time_t end,
78                                                        ECalComponentAlarmAction *omit,
79                                                        ECalRecurResolveTimezoneFn resolve_tzid,
80                                                        gpointer user_data,
81                                                        icaltimezone *default_timezone);
82 int e_cal_util_generate_alarms_for_list (GList *comps,
83                                        time_t start,
84                                        time_t end,
85                                        ECalComponentAlarmAction *omit,
86                                        GSList **comp_alarms,
87                                        ECalRecurResolveTimezoneFn resolve_tzid,
88                                        gpointer user_data,
89                                        icaltimezone *default_timezone);
90
91 char *e_cal_util_priority_to_string (int priority);
92 int e_cal_util_priority_from_string (const char *string);
93
94 void e_cal_util_add_timezones_from_component (icalcomponent *vcal_comp,
95                                             icalcomponent *icalcomp);
96
97 gboolean e_cal_util_component_is_instance (icalcomponent *icalcomp);
98 gboolean e_cal_util_component_has_alarms (icalcomponent *icalcomp);
99 gboolean e_cal_util_component_has_organizer (icalcomponent *icalcomp);
100 gboolean e_cal_util_component_has_recurrences (icalcomponent *icalcomp);
101 gboolean e_cal_util_component_has_rdates (icalcomponent *icalcomp);
102 gboolean e_cal_util_component_has_rrules (icalcomponent *icalcomp);
103 gboolean e_cal_util_component_has_attendee (icalcomponent *icalcomp);
104 gboolean e_cal_util_event_dates_match (icalcomponent *icalcomp1, icalcomponent *icalcomp2);
105 /* The static capabilities to be supported by backends */
106 #define CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT             "no-alarm-repeat"
107 #define CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS             "no-audio-alarms"
108 #define CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS           "no-display-alarms"
109 #define CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS             "no-email-alarms"
110 #define CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS         "no-procedure-alarms"
111 #define CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT          "no-task-assignment"
112 #define CAL_STATIC_CAPABILITY_NO_THISANDFUTURE            "no-thisandfuture"
113 #define CAL_STATIC_CAPABILITY_NO_THISANDPRIOR             "no-thisandprior"
114 #define CAL_STATIC_CAPABILITY_NO_TRANSPARENCY             "no-transparency"
115 #define CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY              "one-alarm-only"
116 #define CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND       "organizer-must-attend"
117 #define CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS "organizer-not-email-address"
118 #define CAL_STATIC_CAPABILITY_REMOVE_ALARMS               "remove-alarms"
119 #define CAL_STATIC_CAPABILITY_SAVE_SCHEDULES              "save-schedules"
120 #define CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK      "no-conv-to-assign-task"
121 #define CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR            "no-conv-to-recur"
122 #define CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS              "no-general-options"
123 #define CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS            "require-send-options"
124 #define CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER       "recurrences-no-master-object"
125 #define CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ACCEPT      "organizer-must-accept"
126 #define CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED         "delegate-support"
127 #define CAL_STATIC_CAPABILITY_NO_ORGANIZER               "no-organizer"
128 #define CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY           "delegate-to-many"
129 #define CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING     "has-unaccepted-meeting"
130
131 /* Recurrent events. Management for instances */
132 icalcomponent *e_cal_util_construct_instance (icalcomponent *icalcomp,
133                                             struct icaltimetype rid);
134 void           e_cal_util_remove_instances (icalcomponent *icalcomp,
135                                           struct icaltimetype rid,
136                                           CalObjModType mod);
137
138 G_END_DECLS
139
140 #endif
141