1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU Lesser General Public License as published by
4  * the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful, but
7  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9  * for more details.
10  *
11  * You should have received a copy of the GNU Lesser General Public License
12  * along with this program; if not, see <http://www.gnu.org/licenses/>.
13  *
14  *
15  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
16  *
17  */
18 
19 #ifndef ITIP_UTILS_H
20 #define ITIP_UTILS_H
21 
22 #include <string.h>
23 #include <libecal/libecal.h>
24 #include <calendar/gui/e-cal-model.h>
25 
26 G_BEGIN_DECLS
27 
28 typedef enum {
29 	E_ITIP_SEND_COMPONENT_FLAG_NONE				= 0,
30 	E_ITIP_SEND_COMPONENT_FLAG_STRIP_ALARMS			= 1 << 0,
31 	E_ITIP_SEND_COMPONENT_FLAG_ONLY_NEW_ATTENDEES		= 1 << 1,
32 	E_ITIP_SEND_COMPONENT_FLAG_ENSURE_MASTER_OBJECT		= 1 << 2,
33 	E_ITIP_SEND_COMPONENT_FLAG_SAVE_RESPONSE_ACCEPTED	= 1 << 3,
34 	E_ITIP_SEND_COMPONENT_FLAG_SAVE_RESPONSE_DECLINED	= 1 << 4,
35 	E_ITIP_SEND_COMPONENT_FLAG_SAVE_RESPONSE_TENTATIVE	= 1 << 5
36 } EItipSendComponentFlags;
37 
38 struct CalMimeAttach {
39 	gchar *filename;
40 	gchar *content_type;
41 	gchar *content_id;
42 	gchar *description;
43 	gchar *encoded_data;
44 	gboolean disposition;
45 	guint length;
46 };
47 
48 void		itip_cal_mime_attach_free	(gpointer ptr); /* struct CalMimeAttach * */
49 
50 gboolean	itip_get_default_name_and_address
51 						(ESourceRegistry *registry,
52 						 gchar **name,
53 						 gchar **address);
54 gchar **	itip_get_user_identities	(ESourceRegistry *registry);
55 gchar *		itip_get_fallback_identity	(ESourceRegistry *registry);
56 gboolean	itip_address_is_user		(ESourceRegistry *registry,
57 						 const gchar *address);
58 gboolean	itip_organizer_is_user		(ESourceRegistry *registry,
59 						 ECalComponent *comp,
60 						 ECalClient *cal_client);
61 gboolean	itip_organizer_is_user_ex	(ESourceRegistry *registry,
62 						 ECalComponent *comp,
63 						 ECalClient *cal_client,
64 						 gboolean skip_cap_test);
65 gboolean	itip_sentby_is_user		(ESourceRegistry *registry,
66 						 ECalComponent *comp,
67 						 ECalClient *cal_client);
68 gboolean	itip_has_any_attendees		(ECalComponent *comp);
69 const gchar *	itip_strip_mailto		(const gchar *address);
70 gboolean	itip_attendee_is_user		(ESourceRegistry *registry,
71 						 ECalComponent *comp,
72 						 ECalClient *cal_client);
73 gchar *		itip_get_comp_attendee		(ESourceRegistry *registry,
74 						 ECalComponent *comp,
75 						 ECalClient *cal_client);
76 gboolean	itip_send_comp_sync		(ESourceRegistry *registry,
77 						 ICalPropertyMethod method,
78 						 ECalComponent *send_comp,
79 						 ECalClient *cal_client,
80 						 ICalComponent *zones,
81 						 GSList *attachments_list,
82 						 GSList *users,
83 						 gboolean strip_alarms,
84 						 gboolean only_new_attendees,
85 						 GCancellable *cancellable,
86 						 GError **error);
87 void		itip_send_component_with_model	(ECalModel *model,
88 						 ICalPropertyMethod method,
89 						 ECalComponent *send_comp,
90 						 ECalClient *cal_client,
91 						 ICalComponent *zones,
92 						 GSList *attachments_list,
93 						 GSList *users,
94 						 EItipSendComponentFlags flags);
95 void		itip_send_component		(ESourceRegistry *registry,
96 						 ICalPropertyMethod method,
97 						 ECalComponent *send_comp,
98 						 ECalClient *cal_client,
99 						 ICalComponent *zones,
100 						 GSList *attachments_list,
101 						 GSList *users,
102 						 EItipSendComponentFlags flags,
103 						 GCancellable *cancellable,
104 						 GAsyncReadyCallback callback,
105 						 gpointer user_data);
106 gboolean	itip_send_component_finish	(GAsyncResult *result,
107 						 GError **error);
108 gboolean	itip_publish_begin		(ECalComponent *pub_comp,
109 						 ECalClient *cal_client,
110 						 gboolean cloned,
111 						 ECalComponent **clone);
112 gboolean	reply_to_calendar_comp		(ESourceRegistry *registry,
113 						 ICalPropertyMethod method,
114 						 ECalComponent *send_comp,
115 						 ECalClient *cal_client,
116 						 gboolean reply_all,
117 						 ICalComponent *zones,
118 						 GSList *attachments_list);
119 gboolean	itip_is_component_valid		(ICalComponent *icomp);
120 gboolean	itip_component_has_recipients	(ECalComponent *comp);
121 void		itip_utils_update_cdo_replytime	(ICalComponent *icomp);
122 gboolean	itip_utils_remove_all_but_attendee
123 						(ICalComponent *icomp,
124 						 const gchar *attendee);
125 ICalProperty *	itip_utils_find_attendee_property
126 						(ICalComponent *icomp,
127 						 const gchar *address);
128 void		itip_utils_prepare_attendee_response
129 						(ESourceRegistry *registry,
130 						 ICalComponent *icomp,
131 						 const gchar *address,
132 						 ICalParameterPartstat partstat);
133 
134 G_END_DECLS
135 
136 #endif /* ITIP_UTILS_H */
137