[evolution-patches] patch backend part of send options [calendar]



Hi,
   Have attached the patch for the backend implementation of the send
options. Added the required X- properties to store the send options info
into the ical. Added the required functions need in the backend which
will be common for mail and calendar.

thanks, chenthill
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.356
diff -u -p -r1.356 ChangeLog
--- calendar/ChangeLog	9 Dec 2004 15:52:35 -0000	1.356
+++ calendar/ChangeLog	10 Dec 2004 07:34:43 -0000
@@ -1,3 +1,15 @@
+2004-12-10  Chenthill Palanisamy <pchenthill novell com>
+
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(add_send_options_data_to_item),
+	(set_properties_from_cal_component):Added a new local function
+	for reading the properties  for send options.
+	* backends/groupwise/e-cal-backend-groupwise.c:
+	(e_cal_backend_groupwise_get_static_capabilities): Checked for new 
+	static capabilities.
+	* libecal/e-cal-util.h: Defined two new static capabilities required for 
+	send options.
+
 2004-12-09  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #70267
Index: calendar/libecal/e-cal-util.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-util.h,v
retrieving revision 1.5
diff -u -p -r1.5 e-cal-util.h
--- calendar/libecal/e-cal-util.h	5 Sep 2004 13:04:19 -0000	1.5
+++ calendar/libecal/e-cal-util.h	10 Dec 2004 07:34:43 -0000
@@ -123,6 +123,8 @@ gboolean e_cal_util_event_dates_match (i
 #define CAL_STATIC_CAPABILITY_SAVE_SCHEDULES              "save-schedules"
 #define CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK	  "no-conv-to-assign-task"
 #define CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR		  "no-conv-to-recur"
+#define CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS		  "no-general-options"
+#define CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS		  "require-send-options"
 
 /* Recurrent events. Management for instances */
 icalcomponent *e_cal_util_construct_instance (icalcomponent *icalcomp,
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.106
diff -u -p -r1.106 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	2 Dec 2004 13:19:00 -0000	1.106
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	10 Dec 2004 07:34:43 -0000
@@ -676,6 +676,7 @@ e_cal_backend_groupwise_get_static_capab
 				  CAL_STATIC_CAPABILITY_NO_THISANDFUTURE "," \
 				  CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK "," \
 				  CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR "," \
+				  CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS "," \
 				  CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
 
 	return GNOME_Evolution_Calendar_Success;
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.41
diff -u -p -r1.41 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	6 Dec 2004 04:09:22 -0000	1.41
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	10 Dec 2004 07:34:43 -0000
@@ -116,6 +116,107 @@ set_categories_for_gw_item (EGwItem *ite
              e_gw_item_set_categories (item, category_ids);
 }
 
+static void
+add_send_options_data_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default_zone)
+{
+	const char *x_val;
+	const char *x_name;
+	icalcomponent *icalcomp;
+	icalproperty *icalprop;
+	struct icaltimetype temp;
+
+	icalcomp = e_cal_component_get_icalcomponent (comp);
+	icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+
+	while (icalprop) {
+
+		x_name = icalproperty_get_x_name (icalprop);
+
+		if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-REPLY")) {
+			e_gw_item_set_reply_request (item, TRUE);
+			x_val = icalproperty_get_x (icalprop);
+			if (strcmp (x_val, "convenient"))
+				e_gw_item_set_reply_within (item, (char *) x_val);	
+		}
+	       	else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-EXPIRE")) {
+			char *expire = NULL;
+			x_val = icalproperty_get_x (icalprop);
+			temp = icaltime_current_time_with_zone (default_zone ? default_zone : icaltimezone_get_utc_timezone ());
+			icaltime_adjust (&temp, atoi (x_val), 0, 0, 0); 
+			icaltime_set_timezone (&temp, default_zone);
+			temp = icaltime_convert_to_zone (temp, icaltimezone_get_utc_timezone ());
+			expire = icaltime_as_ical_string (temp);
+			e_gw_item_set_expires (item, (char *) expire);
+			g_free (expire);
+
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DELAY")) {
+			char *delay = NULL;
+			x_val = icalproperty_get_x (icalprop);
+			temp = icaltime_from_string (x_val);
+			icaltime_set_timezone (&temp, default_zone);
+			temp = icaltime_convert_to_zone (temp, icaltimezone_get_utc_timezone ());
+			delay = icaltime_as_ical_string (temp);
+			e_gw_item_set_delay_until (item, (char *) delay);
+			g_free (delay);
+					
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-TRACKINFO")) {
+			x_val = icalproperty_get_x (icalprop);
+			switch (atoi (x_val)) {
+				case 1: e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED);
+					break;
+				case 2:	e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED_OPENED);
+					break;
+				case 3: e_gw_item_set_track_info (item, E_GW_ITEM_ALL);
+					break;
+				default: e_gw_item_set_track_info (item, E_GW_ITEM_NONE);
+					 break;
+			}
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-OPENED")) {
+			int i = 0;
+			x_val = icalproperty_get_x (icalprop);
+			i = atoi (x_val);
+			switch (i) {
+				case 0: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_NONE);
+					break;
+				case 1: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_MAIL);
+			}
+			
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-ACCEPTED")) {
+			int i = 0;
+			x_val = icalproperty_get_x (icalprop);
+			i = atoi (x_val);
+			switch (i) {
+				case 0: e_gw_item_set_notify_accepted (item, E_GW_ITEM_NOTIFY_NONE);
+					break;
+				case 1: e_gw_item_set_notify_accepted (item, E_GW_ITEM_NOTIFY_MAIL);
+			}
+
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DECLINED")) {
+			int i = 0;
+			x_val = icalproperty_get_x (icalprop);
+			i = atoi (x_val);
+			switch (i) {
+				case 0: e_gw_item_set_notify_declined (item, E_GW_ITEM_NOTIFY_NONE);
+					break;
+				case 1: e_gw_item_set_notify_declined (item, E_GW_ITEM_NOTIFY_MAIL);
+			}
+
+		} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-COMPLETED")) {
+			int i = 0;
+			x_val = icalproperty_get_x (icalprop);
+			i = atoi (x_val);
+			switch (i) {
+				case 0: e_gw_item_set_notify_completed (item, E_GW_ITEM_NOTIFY_NONE);
+					break;
+				case 1: e_gw_item_set_notify_completed (item, E_GW_ITEM_NOTIFY_MAIL);
+			}
+		}
+
+		icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+	}
+
+}
+
 static EGwItem *
 set_properties_from_cal_component (EGwItem *item, ECalComponent *comp, ECalBackendGroupwise *cbgw)
 {
@@ -132,7 +233,7 @@ set_properties_from_cal_component (EGwIt
 	
 	default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
 
-	g_return_if_fail (default_zone != NULL);
+	g_return_val_if_fail ((default_zone != NULL), NULL);
 	
 	/* first set specific properties */
 	switch (e_cal_component_get_vtype (comp)) {
@@ -192,23 +293,7 @@ set_properties_from_cal_component (EGwIt
 			e_gw_item_set_due_date (item, icaltime_as_ical_string (itt_utc));
 		}
 
-		/* priority */
-		priority = NULL;
-		e_cal_component_get_priority (comp, &priority);
-		if (priority && *priority) {
-			if (*priority >= 7)
-				e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_LOW);
-			else if (*priority >= 5)
-				e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_STANDARD);
-			else if (*priority >= 1)
-				e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_HIGH);
-			else
-				e_gw_item_set_priority (item, NULL);
-
-			e_cal_component_free_priority (priority);
-		}
-
-		/* completed */
+			/* completed */
 		e_cal_component_get_completed (comp, &dt.value);
 		if (dt.value) {
 			e_gw_item_set_completed (item, TRUE);
@@ -253,6 +338,22 @@ set_properties_from_cal_component (EGwIt
 		e_cal_component_free_text_list (slist);
 	}
 
+	/* priority */
+	priority = NULL;
+	e_cal_component_get_priority (comp, &priority);
+	if (priority && *priority) {
+		if (*priority >= 7)
+			e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_LOW);
+		else if (*priority >= 5)
+			e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_STANDARD);
+		else if (*priority >= 1)
+			e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_HIGH);
+		else
+			e_gw_item_set_priority (item, NULL);
+
+		e_cal_component_free_priority (priority);
+	}
+
 	/* start date */
 	e_cal_component_get_dtstart (comp, &dt);
 	if (dt.value) {
@@ -331,6 +432,10 @@ set_properties_from_cal_component (EGwIt
 		}
 				
 		e_gw_item_set_recipient_list (item, recipient_list);
+
+		/* Send Options */
+		add_send_options_data_to_item (item, comp, default_zone);
+
 	}
 
 	if (e_cal_component_has_organizer (comp)) {
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.79
diff -u -p -r1.79 ChangeLog
--- servers/groupwise/ChangeLog	6 Dec 2004 01:31:31 -0000	1.79
+++ servers/groupwise/ChangeLog	10 Dec 2004 07:34:43 -0000
@@ -1,3 +1,23 @@
+2004-12-10  Chenthill Palanisamy <pchenthill novell com>
+
+	* e-gw-item.c: (e_gw_item_dispose), (e_gw_item_init),
+	(e_gw_item_set_reply_request), (e_gw_item_get_reply_request),
+	(e_gw_item_set_reply_within), (e_gw_item_get_reply_within),
+	(e_gw_item_set_track_info), (e_gw_item_get_track_info),
+	(e_gw_item_set_autodelete), (e_gw_item_get_autodelete),
+	(e_gw_item_set_notify_completed), (e_gw_item_get_notify_completed),
+	(e_gw_item_set_notify_accepted), (e_gw_item_get_notify_accepted),
+	(e_gw_item_set_notify_declined), (e_gw_item_get_notify_declined),
+	(e_gw_item_set_notify_opened), (e_gw_item_get_notify_opened),
+	(e_gw_item_set_notify_deleted), (e_gw_item_get_notify_deleted),
+	(e_gw_item_set_expires), (e_gw_item_get_expires),
+	(e_gw_item_set_delay_until), (e_gw_item_get_delay_until),
+	(add_return_notification), (append_gw_item_options),
+	(add_distribution_to_soap_message),
+	(e_gw_item_set_calendar_item_elements),
+	(e_gw_item_append_to_soap_message):
+	* e-gw-item.h: Added the needed functions for implementing send options
+
 2004-12-05  Sivaiah Nallagatla <snallagatla novell com>
 
 	* e-gw-connection.[ch] : (e_gw_connection_get_item) :
Index: servers/groupwise/e-gw-item.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.h,v
retrieving revision 1.22
diff -u -p -r1.22 e-gw-item.h
--- servers/groupwise/e-gw-item.h	6 Dec 2004 01:31:31 -0000	1.22
+++ servers/groupwise/e-gw-item.h	10 Dec 2004 07:34:43 -0000
@@ -125,6 +125,18 @@ typedef struct {
 	char *date ;
 } EGwItemAttachment ;
 
+typedef enum {
+	E_GW_ITEM_NOTIFY_NONE,
+	E_GW_ITEM_NOTIFY_MAIL
+} EGwItemReturnNotify;
+
+typedef enum {
+	E_GW_ITEM_NONE,
+	E_GW_ITEM_DELIVERED,
+	E_GW_ITEM_DELIVERED_OPENED,
+	E_GW_ITEM_ALL
+} EGwItemTrack;
+
 GType       e_gw_item_get_type (void);
 EGwItem    *e_gw_item_new_empty (void);
 EGwItem    *e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param);
@@ -179,6 +191,28 @@ void e_gw_item_set_change (EGwItem *item
 gboolean e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
 void e_gw_item_set_category_name (EGwItem *item, char *cateogry_name);
 char* e_gw_item_get_category_name (EGwItem *item);
+void e_gw_item_set_reply_request (EGwItem *item, gboolean set);
+gboolean e_gw_item_get_reply_request (EGwItem *item);
+void e_gw_item_set_reply_within (EGwItem *item, char *reply_within);
+char *e_gw_item_get_reply_within (EGwItem *item);
+void e_gw_item_set_track_info (EGwItem *item, EGwItemTrack track_info);
+EGwItemTrack e_gw_item_get_track_info (EGwItem *item);
+void e_gw_item_set_autodelete (EGwItem *item, gboolean set);
+gboolean e_gw_item_get_autodelete (EGwItem *item);
+void e_gw_item_set_notify_completed (EGwItem *item, EGwItemReturnNotify notify);
+EGwItemReturnNotify e_gw_item_get_notify_completed (EGwItem *item);
+void e_gw_item_set_notify_accepted (EGwItem *item, EGwItemReturnNotify notify);
+EGwItemReturnNotify e_gw_item_get_notify_accepted (EGwItem *item);
+void e_gw_item_set_notify_declined (EGwItem *item, EGwItemReturnNotify notify);
+EGwItemReturnNotify e_gw_item_get_notify_declined (EGwItem *item);
+void e_gw_item_set_notify_opened (EGwItem *item, EGwItemReturnNotify notify);
+EGwItemReturnNotify e_gw_item_get_notify_opened (EGwItem *item);
+void e_gw_item_set_notify_deleted (EGwItem *item, EGwItemReturnNotify notify);
+EGwItemReturnNotify e_gw_item_get_notify_deleted (EGwItem *item);
+void e_gw_item_set_expires (EGwItem *item, char *expires);
+char *e_gw_item_get_expires (EGwItem *item);
+void e_gw_item_set_delay_until (EGwItem *item, char *delay_until);
+char *e_gw_item_get_delay_until (EGwItem *item);
 
 
 #define E_GW_ITEM_CLASSIFICATION_PUBLIC       "Public"
Index: servers/groupwise/e-gw-item.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.c,v
retrieving revision 1.49
diff -u -p -r1.49 e-gw-item.c
--- servers/groupwise/e-gw-item.c	6 Dec 2004 01:31:31 -0000	1.49
+++ servers/groupwise/e-gw-item.c	10 Dec 2004 07:34:44 -0000
@@ -82,6 +82,29 @@ struct _EGwItemPrivate {
 	GList *member_list;
 	GHashTable *addresses;
 
+	/***** Send Options *****/
+	
+	/* Reply Request */
+	char *reply_within;
+	gboolean reply_request_set;
+	
+	/* Status Tracking through sent Item */
+	EGwItemTrack track_info;
+	gboolean autodelete;
+
+	/* Return Notification */
+	EGwItemReturnNotify notify_completed;
+	EGwItemReturnNotify notify_accepted;
+	EGwItemReturnNotify notify_declined;
+	EGwItemReturnNotify notify_opened;
+	EGwItemReturnNotify notify_deleted;
+
+	/* Expiration Date */
+	char *expires;
+
+	/* Delay delivery */
+	char *delay_until;
+
 	/* changes */
 	GHashTable *additions;
 	GHashTable *updates;
@@ -273,6 +296,21 @@ e_gw_item_dispose (GObject *object)
 			priv->icalid = NULL;
 		}
 
+		if (priv->reply_within) {
+			g_free (priv->reply_within);
+			priv->reply_within = NULL;
+		}
+
+		if (priv->expires) {
+			g_free (priv->expires);
+			priv->expires = NULL;
+		}
+
+		if (priv->delay_until) {
+			g_free (priv->delay_until);
+			priv->delay_until = NULL;
+		}
+
 		if (priv->recipient_list) {
 			g_slist_foreach (priv->recipient_list, (GFunc) free_recipient, NULL);
 			g_slist_free (priv->recipient_list);
@@ -387,6 +425,11 @@ e_gw_item_init (EGwItem *item, EGwItemCl
 	priv->email_list = NULL;
 	priv->member_list = NULL;
 	priv->category_list = NULL;
+	priv->reply_within = NULL;
+	priv->reply_request_set = FALSE;
+	priv->autodelete = FALSE;
+	priv->expires = NULL;
+	priv->delay_until = NULL;
 	priv->attach_list = NULL ;
 	priv->simple_fields = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
 	priv->full_name = g_new0(FullName, 1);
@@ -1996,6 +2039,7 @@ e_gw_item_set_trigger (EGwItem *item, in
 	item->priv->trigger = trigger;
 }
 
+
 void 
 e_gw_item_set_to (EGwItem *item, const char *to)
 {
@@ -2017,10 +2061,231 @@ e_gw_item_get_msg_content_type (EGwItem 
 	return item->priv->content_type ;
 }
 
+void
+e_gw_item_set_reply_request (EGwItem *item, gboolean set)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->reply_request_set = set;
+}
+
+gboolean
+e_gw_item_get_reply_request (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->reply_request_set;
+}
+
+void
+e_gw_item_set_reply_within (EGwItem *item, char *reply_within)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->reply_within = g_strdup (reply_within);
+}
+
+char *
+e_gw_item_get_reply_within (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
+
+	return item->priv->reply_within;
+}
+
+void
+e_gw_item_set_track_info (EGwItem *item, EGwItemTrack track_info)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->track_info = track_info;
+}
+
+EGwItemTrack
+e_gw_item_get_track_info (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_ITEM_NONE);
+
+	return item->priv->track_info;
+}
+
+
+void
+e_gw_item_set_autodelete (EGwItem *item, gboolean set)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->autodelete = set;
+}
+
+gboolean
+e_gw_item_get_autodelete (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->autodelete;
+}
+
+void 
+e_gw_item_set_notify_completed (EGwItem *item, EGwItemReturnNotify notify)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->notify_completed = notify;
+}
+
+EGwItemReturnNotify 
+e_gw_item_get_notify_completed (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->notify_completed;
+}
+
+void 
+e_gw_item_set_notify_accepted (EGwItem *item, EGwItemReturnNotify notify)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->notify_accepted = notify;
+}
+
+EGwItemReturnNotify 
+e_gw_item_get_notify_accepted (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->notify_accepted;
+}
+
+void 
+e_gw_item_set_notify_declined (EGwItem *item, EGwItemReturnNotify notify)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->notify_declined = notify;
+}
+
+EGwItemReturnNotify 
+e_gw_item_get_notify_declined (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->notify_declined;
+}
+
+void 
+e_gw_item_set_notify_opened (EGwItem *item, EGwItemReturnNotify notify)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->notify_opened = notify;
+}
+
+EGwItemReturnNotify 
+e_gw_item_get_notify_opened (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->notify_opened;
+}
+
+void 
+e_gw_item_set_notify_deleted (EGwItem *item, EGwItemReturnNotify notify)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->notify_deleted = notify;
+}
+
+EGwItemReturnNotify 
+e_gw_item_get_notify_deleted (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
+
+	return item->priv->notify_deleted;
+}
+
+void
+e_gw_item_set_expires (EGwItem *item, char *expires)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->expires = g_strdup (expires);
+}
+
+char *
+e_gw_item_get_expires (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
+
+	return item->priv->expires;
+}
+
+void
+e_gw_item_set_delay_until (EGwItem *item, char *delay_until)
+{
+	g_return_if_fail (E_IS_GW_ITEM (item));
+
+	item->priv->delay_until = g_strdup (delay_until);
+}
+
+char *
+e_gw_item_get_delay_until (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
+
+	return item->priv->delay_until;
+}
+
+static void
+add_return_notification (SoupSoapMessage *msg, char *option, EGwItemReturnNotify value)
+{
+	soup_soap_message_start_element (msg, option, NULL, NULL);
+
+	switch (value) {
+		case E_GW_ITEM_NOTIFY_MAIL:
+			e_gw_message_write_string_parameter (msg, "mail", NULL, "1");
+			break;
+		case E_GW_ITEM_NOTIFY_NONE:
+			e_gw_message_write_string_parameter (msg, "mail", NULL, "0");
+	}
+	
+	soup_soap_message_end_element (msg);	
+}
+
+static void 
+append_gw_item_options (SoupSoapMessage *msg, EGwItem *item) 
+{
+	EGwItemPrivate *priv;
+
+	priv = item->priv;
+	
+	soup_soap_message_start_element (msg, "options", NULL, NULL);
+	
+	/* Priority */
+	e_gw_message_write_string_parameter (msg, "priority", NULL, priv->priority ? priv->priority : "");
+
+	/* Expiration date */
+	e_gw_message_write_string_parameter (msg, "expires", NULL, priv->expires ? priv->expires : "");
+	
+	/* Delay delivery */
+	e_gw_message_write_string_parameter (msg, "delayDeliveryUntil", NULL, priv->delay_until ? priv->delay_until : "");
+
+	soup_soap_message_end_element (msg);
+}
+
 static void
-add_distribution_to_soap_message (EGwItemOrganizer *organizer, GSList *recipient_list, SoupSoapMessage *msg)
+add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
 {
 	GSList *rl;
+	EGwItemPrivate *priv;
+	EGwItemOrganizer *organizer;
+	GSList *recipient_list;
+
+	priv = item->priv;
+	organizer = priv->organizer;
+	recipient_list = priv->recipient_list;
 	
 	/* start distribution element */
 	soup_soap_message_start_element (msg, "distribution", NULL, NULL);
@@ -2065,10 +2330,59 @@ add_distribution_to_soap_message (EGwIte
 	}
 	
 	soup_soap_message_end_element (msg);
+	
+	soup_soap_message_start_element (msg, "sendoptions", NULL, NULL);
+	
+	if (priv->reply_request_set) {
+		
+		soup_soap_message_start_element (msg, "requestReply", NULL, NULL);
+		
+		if (priv->reply_within)
+			e_gw_message_write_string_parameter (msg, "withinNDays", NULL, priv->reply_within);
+		
+		soup_soap_message_end_element (msg);
+	}
+
+	soup_soap_message_start_element (msg, "statusTracking", NULL, NULL);
+	
+	soup_soap_message_add_attribute (msg, "autoDelete", priv->autodelete ? "1" : "0", NULL, NULL);
+
+	switch (priv->track_info) {
+		case E_GW_ITEM_DELIVERED : soup_soap_message_write_string (msg, "Delivered");
+			 break;
+		case E_GW_ITEM_DELIVERED_OPENED : soup_soap_message_write_string (msg, "DeliveredAndOpened");
+			 break;
+		case E_GW_ITEM_ALL : soup_soap_message_write_string (msg, "All");
+			 break;
+		default: soup_soap_message_write_string (msg, "None");
+	}
+	
+	soup_soap_message_end_element (msg);
+
+	soup_soap_message_start_element (msg, "notification", NULL, NULL);
+	switch (priv->item_type) {
+	
+	/* TODO Uncomment this after the completed element is available in shemas */
+	case E_GW_ITEM_TYPE_TASK :
+//		add_return_notification (msg, "completed", priv->notify_completed);
+		
+	case E_GW_ITEM_TYPE_APPOINTMENT:
+		add_return_notification (msg, "accepted", priv->notify_accepted);
+		add_return_notification (msg, "declined", priv->notify_declined);
+		add_return_notification (msg, "opened", priv->notify_opened);
+		break;
+		
+	default:
+		add_return_notification (msg, "opened", priv->notify_opened);
+		add_return_notification (msg, "deleted", priv->notify_deleted);
+	}
+	soup_soap_message_end_element (msg);
+
+	soup_soap_message_end_element (msg);
 	soup_soap_message_end_element (msg);
 }
 
-void 
+static void 
 e_gw_item_set_calendar_item_elements (EGwItem *item, SoupSoapMessage *msg)
 {
 	EGwItemPrivate *priv = item->priv;
@@ -2085,8 +2399,11 @@ e_gw_item_set_calendar_item_elements (EG
 		e_gw_message_write_string_parameter (msg, "class", NULL, "");
 
 	e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject ? priv->subject : "");
-	if (priv->recipient_list != NULL)
-		add_distribution_to_soap_message (priv->organizer, priv->recipient_list, msg);
+
+	if (priv->recipient_list != NULL) {
+		add_distribution_to_soap_message (item, msg);
+		append_gw_item_options (msg, item);
+	}
 
 	soup_soap_message_start_element (msg, "message", NULL, NULL);
 	if (priv->message) {
@@ -2160,7 +2477,10 @@ e_gw_item_append_to_soap_message (EGwIte
 		if (priv->subject)
 			e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject) ;
 		/*distribution*/
-		add_distribution_to_soap_message(priv->organizer, priv->recipient_list, msg) ;
+		add_distribution_to_soap_message(item, msg) ;
+		
+		/* item options */
+		append_gw_item_options (msg, item);
 		
 		/*message*/
 		soup_soap_message_start_element (msg, "message", NULL, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]