Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / servers / groupwise / e-gw-item.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* 
3  * Authors : 
4  *  JP Rosevear <jpr@ximian.com>
5  *  Rodrigo Moya <rodrigo@ximian.com>
6  *
7  * Copyright 2003, Novell, Inc.
8  *
9  * This program is free software; you can redistribute it and/or 
10  * modify it under the terms of version 2 of the GNU Lesser General Public 
11  * License as published by the Free Software Foundation.
12  *
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 Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21  * USA
22  */
23
24 #ifndef E_GW_ITEM_H
25 #define E_GW_ITEM_H
26
27 #include <libsoup/soup-soap-message.h>
28 #include <libsoup/soup-soap-response.h>
29 #include "e-gw-recur-utils.h"
30
31 G_BEGIN_DECLS
32
33 #define E_TYPE_GW_ITEM            (e_gw_item_get_type ())
34 #define E_GW_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_ITEM, EGwItem))
35 #define E_GW_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_ITEM, EGwItemClass))
36 #define E_IS_GW_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_ITEM))
37 #define E_IS_GW_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_ITEM))
38
39 typedef struct _EGwItem        EGwItem;
40 typedef struct _EGwItemClass   EGwItemClass;
41 typedef struct _EGwItemPrivate EGwItemPrivate;
42
43 typedef enum {
44         E_GW_ITEM_TYPE_MAIL,
45         E_GW_ITEM_TYPE_APPOINTMENT,
46         E_GW_ITEM_TYPE_TASK,
47         E_GW_ITEM_TYPE_CONTACT,
48         E_GW_ITEM_TYPE_GROUP,
49         E_GW_ITEM_TYPE_ORGANISATION,
50         E_GW_ITEM_TYPE_RESOURCE,
51         E_GW_ITEM_TYPE_CATEGORY,
52         E_GW_ITEM_TYPE_NOTIFICATION, 
53         E_GW_ITEM_TYPE_NOTE,
54         E_GW_ITEM_TYPE_UNKNOWN
55
56 } EGwItemType;
57
58
59 typedef enum {
60         E_GW_ITEM_CHANGE_TYPE_ADD,
61         E_GW_ITEM_CHANGE_TYPE_UPDATE,
62         E_GW_ITEM_CHANGE_TYPE_DELETE,
63         E_GW_ITEM_CHNAGE_TYPE_UNKNOWN
64
65 } EGwItemChangeType;
66
67 typedef enum {
68         E_GW_ITEM_STAT_ACCEPTED = 1<<0,
69         E_GW_ITEM_STAT_COMPLETED = 1<<1,
70         E_GW_ITEM_STAT_DELEGATED = 1<<2,
71         E_GW_ITEM_STAT_DELETED   = 1<<3,
72         E_GW_ITEM_STAT_FORWARDED = 1<<4,
73         E_GW_ITEM_STAT_OPENED    = 1<<5,
74         E_GW_ITEM_STAT_READ      = 1<<6,
75         E_GW_ITEM_STAT_REPLIED   = 1<<7,
76         E_GW_ITEM_STAT_DECLINED  = 1<<8,
77         E_GW_ITEM_STAT_NONE      = 1<<31
78 } EGwItemStatus;
79
80 struct _EGwItem {
81         GObject parent;
82         EGwItemPrivate *priv;
83 };
84
85 struct _EGwItemClass {
86         GObjectClass parent_class;
87 };
88
89 /* structures defined to hold contact item fields */
90 typedef struct {
91         char *name_prefix;
92         char *first_name;
93         char *middle_name;
94         char *last_name;
95         char *name_suffix;
96 } FullName;
97
98 typedef struct {
99         char *street_address;
100         char *location;
101         char *city;
102         char *state;
103         char *postal_code;
104         char *country;
105 } PostalAddress;
106
107 typedef struct {
108
109         char *service;
110         char *address;
111 }IMAddress;
112
113 typedef struct {
114         char *id;
115         char *email;
116         char *name;
117 } EGroupMember;
118
119 typedef struct {
120         char *email;
121         char *display_name;
122 } EGwItemOrganizer;
123
124 typedef struct {
125         char *id ;
126         char *name ;
127         char *item_reference;
128         char *contentid;
129         char *contentType ;
130         int size ;
131         char *date ;
132         char *data ;
133 } EGwItemAttachment ;
134
135 typedef enum {
136         E_GW_ITEM_NOTIFY_NONE,
137         E_GW_ITEM_NOTIFY_MAIL
138 } EGwItemReturnNotify;
139
140 typedef enum {
141         E_GW_ITEM_NONE,
142         E_GW_ITEM_DELIVERED,
143         E_GW_ITEM_DELIVERED_OPENED,
144         E_GW_ITEM_ALL
145 } EGwItemTrack;
146
147 typedef struct {
148         char *id;
149         char *type;
150         char *thread;
151 } EGwItemLinkInfo;
152
153 typedef struct {
154         char *item_id;
155         char *ical_id;
156         char *recur_key;
157 } EGwItemCalId;
158
159 GType       e_gw_item_get_type (void);
160 EGwItem    *e_gw_item_new_empty (void);
161 EGwItem    *e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param);
162
163 EGwItemType e_gw_item_get_item_type (EGwItem *item);
164 void        e_gw_item_set_item_type (EGwItem *item, EGwItemType new_type);
165 const char *e_gw_item_get_container_id (EGwItem *item);
166 void        e_gw_item_set_container_id (EGwItem *item, const char *new_id);
167 const char *e_gw_item_get_icalid (EGwItem *item);
168 void        e_gw_item_set_icalid (EGwItem *item, const char *new_icalid);
169 const char *e_gw_item_get_id (EGwItem *item);
170 void        e_gw_item_set_id (EGwItem *item, const char *new_id);
171 char       *e_gw_item_get_creation_date (EGwItem *item);
172 void        e_gw_item_set_creation_date (EGwItem *item, const char *new_date);
173 char       *e_gw_item_get_delivered_date (EGwItem *item);
174 void        e_gw_item_set_delivered_date (EGwItem *item, const char *new_date);
175 char       *e_gw_item_get_start_date (EGwItem *item);
176 void        e_gw_item_set_start_date (EGwItem *item, const char *new_date);
177 char       *e_gw_item_get_completed_date (EGwItem *item);
178 void        e_gw_item_set_completed_date (EGwItem *item, const char *new_date);
179 char       *e_gw_item_get_end_date (EGwItem *item);
180 void        e_gw_item_set_end_date (EGwItem *item, const char *new_date);
181 char       *e_gw_item_get_due_date (EGwItem *item);
182 void        e_gw_item_set_due_date (EGwItem *item, const char *new_date);
183 const char *e_gw_item_get_subject (EGwItem *item);
184 void        e_gw_item_set_subject (EGwItem *item, const char *new_subject);
185 const char *e_gw_item_get_message (EGwItem *item);
186 void        e_gw_item_set_message (EGwItem *item, const char *new_message);
187 const char *e_gw_item_get_place (EGwItem *item);
188 void        e_gw_item_set_place (EGwItem *item, const char *new_place);
189 void        e_gw_item_set_security (EGwItem *item, const char *new_class);
190 gboolean    e_gw_item_get_completed (EGwItem *item);
191 void        e_gw_item_set_completed (EGwItem *item, gboolean new_completed);
192 gboolean    e_gw_item_get_is_allday_event (EGwItem *item);
193 void        e_gw_item_set_is_allday_event (EGwItem *item, gboolean is_allday);  
194 char*       e_gw_item_get_field_value (EGwItem *item, char *field_name);
195 void        e_gw_item_set_field_value (EGwItem *item, char *field_name, char* field_value);
196 GList*      e_gw_item_get_email_list (EGwItem *item);
197 void        e_gw_item_set_email_list (EGwItem *item, GList *email_list);
198 FullName*   e_gw_item_get_full_name (EGwItem *item);
199 void        e_gw_item_set_full_name (EGwItem *item, FullName* full_name);
200 GList*      e_gw_item_get_member_list (EGwItem *item);
201 void        e_gw_item_set_member_list (EGwItem *item, GList *list);
202 PostalAddress* e_gw_item_get_address (EGwItem *item, char *address_type);
203 void        e_gw_item_set_address (EGwItem *item, char *addres_type, PostalAddress *address);
204 GList*      e_gw_item_get_im_list (EGwItem *item);
205 void        e_gw_item_set_im_list (EGwItem *item, GList *im_list);
206 void        e_gw_item_set_categories (EGwItem *item, GList *category_list);
207 GList*      e_gw_item_get_categories (EGwItem *item);
208 void        e_gw_item_set_to (EGwItem *item, const char *to) ;
209 const char* e_gw_item_get_to (EGwItem *item) ;
210 const char *e_gw_item_get_msg_content_type (EGwItem *item) ;
211 guint32     e_gw_item_get_item_status (EGwItem *item);
212 void        e_gw_item_set_content_type (EGwItem *item, const char *content_type) ;
213 void        e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info);
214 EGwItemLinkInfo *e_gw_item_get_link_info (EGwItem *item);
215 char        *e_gw_item_get_content_type (EGwItem *item) ;
216 const char *e_gw_item_get_msg_body_id (EGwItem *item);
217 int         e_gw_item_get_mail_size (EGwItem *item);
218 void e_gw_item_set_change (EGwItem *item, EGwItemChangeType change_type, char *field_name, gpointer field_value);
219 gboolean e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
220 void e_gw_item_set_category_name (EGwItem *item, char *cateogry_name);
221 char* e_gw_item_get_category_name (EGwItem *item);
222 void e_gw_item_set_sendoptions (EGwItem *item, gboolean set);
223 void e_gw_item_set_reply_request (EGwItem *item, gboolean set);
224 gboolean e_gw_item_get_reply_request (EGwItem *item);
225 void e_gw_item_set_reply_within (EGwItem *item, char *reply_within);
226 char *e_gw_item_get_reply_within (EGwItem *item);
227 void e_gw_item_set_track_info (EGwItem *item, EGwItemTrack track_info);
228 EGwItemTrack e_gw_item_get_track_info (EGwItem *item);
229 void e_gw_item_set_autodelete (EGwItem *item, gboolean set);
230 gboolean e_gw_item_get_autodelete (EGwItem *item);
231 void e_gw_item_set_notify_completed (EGwItem *item, EGwItemReturnNotify notify);
232 EGwItemReturnNotify e_gw_item_get_notify_completed (EGwItem *item);
233 void e_gw_item_set_notify_accepted (EGwItem *item, EGwItemReturnNotify notify);
234 EGwItemReturnNotify e_gw_item_get_notify_accepted (EGwItem *item);
235 void e_gw_item_set_notify_declined (EGwItem *item, EGwItemReturnNotify notify);
236 EGwItemReturnNotify e_gw_item_get_notify_declined (EGwItem *item);
237 void e_gw_item_set_notify_opened (EGwItem *item, EGwItemReturnNotify notify);
238 EGwItemReturnNotify e_gw_item_get_notify_opened (EGwItem *item);
239 void e_gw_item_set_notify_deleted (EGwItem *item, EGwItemReturnNotify notify);
240 EGwItemReturnNotify e_gw_item_get_notify_deleted (EGwItem *item);
241 void e_gw_item_set_expires (EGwItem *item, char *expires);
242 char *e_gw_item_get_expires (EGwItem *item);
243 void e_gw_item_set_delay_until (EGwItem *item, char *delay_until);
244 char *e_gw_item_get_delay_until (EGwItem *item);
245 void e_gw_item_free_cal_id (EGwItemCalId *calid);
246
247
248 #define E_GW_ITEM_CLASSIFICATION_PUBLIC       "Public"
249 #define E_GW_ITEM_CLASSIFICATION_PRIVATE      "Private"
250 #define E_GW_ITEM_CLASSIFICATION_CONFIDENTIAL "Confidential"
251
252 const char *e_gw_item_get_classification (EGwItem *item);
253 void        e_gw_item_set_classification (EGwItem *item, const char *new_class);
254
255 #define E_GW_ITEM_ACCEPT_LEVEL_BUSY          "Busy"
256 #define E_GW_ITEM_ACCEPT_LEVEL_OUT_OF_OFFICE "OutOfOffice"
257 #define E_GW_ITEM_ACCEPT_LEVEL_FREE          "Free"     
258
259 const char *e_gw_item_get_accept_level (EGwItem *item);
260 void        e_gw_item_set_accept_level (EGwItem *item, const char *new_level);
261
262 #define E_GW_ITEM_PRIORITY_HIGH     "High"
263 #define E_GW_ITEM_PRIORITY_STANDARD "Standard"
264 #define E_GW_ITEM_PRIORITY_LOW      "Low"
265
266 const char *e_gw_item_get_priority (EGwItem *item);
267 void        e_gw_item_set_priority (EGwItem *item, const char *new_priority);
268
269 const char *e_gw_item_get_task_priority (EGwItem *item);
270 void        e_gw_item_set_task_priority (EGwItem *item, const char *new_priority);
271
272 GSList *e_gw_item_get_recipient_list (EGwItem *item);
273 void e_gw_item_set_recipient_list (EGwItem *item, GSList *new_recipient_list);
274
275 EGwItemOrganizer *e_gw_item_get_organizer (EGwItem *item);
276 void e_gw_item_set_organizer (EGwItem  *item, EGwItemOrganizer *organizer);
277
278 GSList * e_gw_item_get_attach_id_list (EGwItem *item) ;
279 void e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list) ;
280
281
282 GSList *e_gw_item_get_recurrence_dates (EGwItem *item);
283 void e_gw_item_set_recurrence_dates (EGwItem  *item, GSList *new_recurrence_dates);
284
285 GSList *e_gw_item_get_exdate_list (EGwItem *item);
286 void e_gw_item_set_exdate_list (EGwItem  *item, GSList *new_exdate_list);
287
288 void e_gw_item_set_rrule (EGwItem *item, EGwItemRecurrenceRule *rrule);
289 EGwItemRecurrenceRule *e_gw_item_get_rrule (EGwItem *item);
290                 
291 int e_gw_item_get_recurrence_key (EGwItem *item);
292 void e_gw_item_set_recurrence_key (EGwItem *item, int recurrence_key);
293
294 GSList * e_gw_item_get_attach_id_list (EGwItem *item) ;
295 void e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list) ;
296
297 void e_gw_item_set_source (EGwItem *item, char *source) ;
298
299 int e_gw_item_get_trigger (EGwItem *item);
300 void e_gw_item_set_trigger (EGwItem *item, int trigger);
301
302 gboolean e_gw_item_has_attachment (EGwItem *item);
303
304 typedef struct {
305         char *email;
306         char *display_name;
307         gboolean status_enabled;
308         char *delivered_date;
309         char *opened_date;
310         char *accepted_date;
311         char *deleted_date;
312         char *declined_date;
313         char *completed_date;
314         char *undelivered_date;
315         enum {
316                 E_GW_ITEM_RECIPIENT_TO,
317                 E_GW_ITEM_RECIPIENT_CC,
318                 E_GW_ITEM_RECIPIENT_BC,
319                 E_GW_ITEM_RECIPIENT_NONE
320         } type;
321
322         EGwItemStatus status;
323 } EGwItemRecipient;
324
325 gboolean    e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
326 void e_gw_item_add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
327 G_END_DECLS
328
329 #endif