Warning fixes
[claws.git] / src / plugins / vcalendar / vcal_manager.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and 
4  * the Claws Mail team
5  *
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.
10  *
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.
15  *
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __VCAL_MANAGER_H__
22 #define __VCAL_MANAGER_H__
23
24 #include <glib.h>
25 #include <ical.h>
26 #include "prefs_account.h"
27 #include "folder.h"
28
29 #define EVENT_PAST_ID "past-events@vcal"
30 #define EVENT_TODAY_ID "today-events@vcal"
31 #define EVENT_TOMORROW_ID "tomorrow-events@vcal"
32 #define EVENT_THISWEEK_ID "thisweek-events@vcal"
33 #define EVENT_LATER_ID "later-events@vcal"
34 typedef struct _VCalEvent VCalEvent;
35
36 struct _VCalEvent 
37 {
38         gchar *uid;
39         gchar *organizer;
40         gchar *orgname;
41         gchar *start;
42         gchar *end;
43         gchar *dtstart;
44         gchar *dtend;
45         gchar *recur;
46         gchar *tzid;
47         gchar *location;
48         gchar *summary;
49         gchar *description;
50         GSList *answers;
51         enum icalproperty_method method;
52         gint sequence;  
53         gchar *url;
54         enum icalcomponent_kind type;
55         time_t postponed;
56         gboolean rec_occurence;
57 };
58
59 typedef struct _Answer Answer;
60
61 struct _Answer {
62         gchar *attendee;
63         gchar *name;
64         enum icalparameter_partstat answer;
65         enum icalparameter_cutype cutype;
66 };
67
68 typedef enum {
69         EVENT_PAST = 0,
70         EVENT_TODAY,
71         EVENT_TOMORROW,
72         EVENT_THISWEEK,
73         EVENT_LATER
74 } EventTime;
75 VCalEvent *vcal_manager_new_event       (const gchar    *uid, 
76                                          const gchar    *organizer,
77                                          const gchar    *orgname,
78                                          const gchar    *location,
79                                          const gchar    *summary,
80                                          const gchar    *description,
81                                          const gchar    *dtstart,
82                                          const gchar    *dtend,
83                                          const gchar    *recur,
84                                          const gchar    *tzid,
85                                          const gchar    *url,
86                                          enum icalproperty_method method,
87                                          gint            sequence,
88                                          enum icalproperty_kind type);
89                                          
90 void vcal_manager_free_event (VCalEvent *event);
91 void vcal_manager_save_event (VCalEvent *event, gboolean export_after);
92 void vcal_manager_update_answer (VCalEvent      *event, 
93                                  const gchar    *attendee,
94                                  const gchar    *name,
95                                  enum icalparameter_partstat ans,
96                                  enum icalparameter_cutype cutype);
97
98 VCalEvent *vcal_manager_load_event (const gchar *uid);
99 gboolean vcal_manager_reply (PrefsAccount       *account, 
100                              VCalEvent          *event);
101 gboolean vcal_manager_request (PrefsAccount     *account, 
102                                VCalEvent        *event);
103
104 GSList *vcal_manager_get_answers_emails(VCalEvent *event);
105 gchar *vcal_manager_get_attendee_name(VCalEvent *event, const gchar *attendee);
106 gchar *vcal_manager_get_reply_text_for_attendee(VCalEvent *event, const gchar *att);
107 gchar *vcal_manager_get_cutype_text_for_attendee(VCalEvent *event, const gchar *att);
108 enum icalparameter_partstat vcal_manager_get_reply_for_attendee(VCalEvent *event, const gchar *att);
109 enum icalparameter_partstat vcal_manager_get_cutype_for_attendee(VCalEvent *event, const gchar *att);
110 gchar *vcal_manager_get_event_path(void);
111 gchar *vcal_manager_get_event_file(const gchar *uid);
112 gchar *vcal_manager_event_dump(VCalEvent *event, gboolean change_date, gboolean
113                 change_from, icalcomponent *use_calendar, gboolean modif);
114 gchar *vcal_manager_icalevent_dump(icalcomponent *event, gchar *orga, icalcomponent *use_calendar);
115 gchar *vcal_manager_dateevent_dump(const gchar *uid, FolderItem *item);
116
117 gchar *vcal_manager_answer_get_text(enum icalparameter_partstat ans);
118 gchar *vcal_manager_cutype_get_text(enum icalparameter_cutype type);
119
120 PrefsAccount *vcal_manager_get_account_from_event(VCalEvent *event);
121
122 void vcal_manager_event_print(VCalEvent *event);
123 EventTime event_to_today(VCalEvent *event, time_t t);
124 const gchar *event_to_today_str(VCalEvent *event, time_t t);
125 void vcal_manager_copy_attendees(VCalEvent *src, VCalEvent *dest);
126 Answer *answer_new(const gchar *attendee, 
127                           const gchar *name,
128                           enum icalparameter_partstat ans,
129                           enum icalparameter_cutype cutype);
130 #endif