evolution-data-server r8698 - in branches/gnome-2-22: camel/providers/groupwise servers/groupwise



Author: abharath
Date: Tue Apr 29 08:55:34 2008
New Revision: 8698
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8698&view=rev

Log:
Committing on behalf of Chenthill Palanisamy  <pchenthill novell com>

2008-04-29  Chenthill Palanisamy  <pchenthill novell com>

        ** Fixes #338330 (bnc)
           Internet Based Calendar Events Are Declined By Evolution/GroupWise


Modified:
   branches/gnome-2-22/camel/providers/groupwise/ChangeLog
   branches/gnome-2-22/camel/providers/groupwise/camel-groupwise-folder.c
   branches/gnome-2-22/servers/groupwise/ChangeLog
   branches/gnome-2-22/servers/groupwise/e-gw-item.c
   branches/gnome-2-22/servers/groupwise/e-gw-item.h

Modified: branches/gnome-2-22/camel/providers/groupwise/camel-groupwise-folder.c
==============================================================================
--- branches/gnome-2-22/camel/providers/groupwise/camel-groupwise-folder.c	(original)
+++ branches/gnome-2-22/camel/providers/groupwise/camel-groupwise-folder.c	Tue Apr 29 08:55:34 2008
@@ -1667,7 +1667,7 @@
 	int body_len = 0;
 	const char *uid = NULL;
 	gboolean is_text_html = FALSE;
-	gboolean has_mime_822 = FALSE;
+	gboolean has_mime_822 = FALSE, ignore_mime_822 = FALSE;
 	gboolean is_text_html_embed = FALSE;
 	gboolean is_base64_encoded = FALSE;
 	CamelStream *temp_stream;
@@ -1676,6 +1676,11 @@
 	cnc = cnc_lookup (priv);
 	container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name);
 
+	/* The item is already in calendar. We need to ignore the mime 822 since it would not have the item id of the appointmnet
+	   in calendar */
+	if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT && e_gw_item_is_from_internet (item))
+		ignore_mime_822 = TRUE;
+
 	attach_list = e_gw_item_get_attach_id_list (item);
 	if (attach_list) {
 		//int attach_count = g_slist_length (attach_list);
@@ -1704,52 +1709,54 @@
 			}//if attachment and len
 		} // if Mime.822 or TEXT.htm
 
-		for (al = attach_list ; al != NULL ; al = al->next) {
-			EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
-			if (!g_ascii_strcasecmp (attach->name, "Mime.822")) {
-				if (attach->size > MAX_ATTACHMENT_SIZE) {
-					int t_len , offset = 0, t_offset = 0;
-					char *t_attach = NULL;
-					GString *gstr = g_string_new (NULL);
-
-					len = 0;
-					do {
-						status = e_gw_connection_get_attachment_base64 (cnc,
-								attach->id, t_offset, MAX_ATTACHMENT_SIZE,
-								(const char **)&t_attach, &t_len, &offset);
-						if (status == E_GW_CONNECTION_STATUS_OK) {
-
-							if (t_len) {
-								gsize len_iter = 0;
-								char *temp = NULL;
-
-								temp = g_base64_decode(t_attach, &len_iter);
-								gstr = g_string_append_len (gstr, temp, len_iter);
-								g_free (temp);
-								len += len_iter;
-								g_free (t_attach);
-								t_attach = NULL;
+		if (!ignore_mime_822) {
+			for (al = attach_list ; al != NULL ; al = al->next) {
+				EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
+				if (!g_ascii_strcasecmp (attach->name, "Mime.822")) {
+					if (attach->size > MAX_ATTACHMENT_SIZE) {
+						int t_len , offset = 0, t_offset = 0;
+						char *t_attach = NULL;
+						GString *gstr = g_string_new (NULL);
+
+						len = 0;
+						do {
+							status = e_gw_connection_get_attachment_base64 (cnc,
+									attach->id, t_offset, MAX_ATTACHMENT_SIZE,
+									(const char **)&t_attach, &t_len, &offset);
+							if (status == E_GW_CONNECTION_STATUS_OK) {
+	
+								if (t_len) {
+									gsize len_iter = 0;
+									char *temp = NULL;
+	
+									temp = g_base64_decode(t_attach, &len_iter);
+									gstr = g_string_append_len (gstr, temp, len_iter);
+									g_free (temp);
+									len += len_iter;
+									g_free (t_attach);
+									t_attach = NULL;
+								}
+								t_offset = offset;
 							}
-							t_offset = offset;
+						} while (t_offset);
+						body = gstr->str;
+						body_len = len;
+						g_string_free (gstr, FALSE);
+					} else {
+						status = e_gw_connection_get_attachment (cnc,
+								attach->id, 0, -1,
+								(const char **)&attachment, &len);
+						if (status != E_GW_CONNECTION_STATUS_OK) {
+							g_warning ("Could not get attachment\n");
+							camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
+							return NULL;
 						}
-					} while (t_offset);
-					body = gstr->str;
-					body_len = len;
-					g_string_free (gstr, FALSE);
-				} else {
-					status = e_gw_connection_get_attachment (cnc,
-							attach->id, 0, -1,
-							(const char **)&attachment, &len);
-					if (status != E_GW_CONNECTION_STATUS_OK) {
-						g_warning ("Could not get attachment\n");
-						camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
-						return NULL;
+						body = g_strdup (attachment);
+						body_len = len;
+						g_free (attachment);
 					}
-					body = g_strdup (attachment);
-					body_len = len;
-					g_free (attachment);
+					has_mime_822 = TRUE;
 				}
-				has_mime_822 = TRUE;
 			}
 		}
 
@@ -1822,9 +1829,11 @@
 
 			if (attach->contentid && (is_text_html_embed != TRUE))
 				is_text_html_embed = TRUE;
-			if ( !g_ascii_strcasecmp (attach->name, "TEXT.htm") ||
+
+			if ( (!g_ascii_strcasecmp (attach->name, "TEXT.htm") ||
 			     !g_ascii_strcasecmp (attach->name, "Mime.822") ||
-			     !g_ascii_strcasecmp (attach->name, "Header"))
+			     !g_ascii_strcasecmp (attach->name, "Header") ||
+			     !g_ascii_strcasecmp (attach->name, "meeting.ics")) && (attach->hidden == TRUE))
 				continue;
 
 			if ( (attach->item_reference) && (!g_ascii_strcasecmp (attach->item_reference, "1")) ) {

Modified: branches/gnome-2-22/servers/groupwise/e-gw-item.c
==============================================================================
--- branches/gnome-2-22/servers/groupwise/e-gw-item.c	(original)
+++ branches/gnome-2-22/servers/groupwise/e-gw-item.c	Tue Apr 29 08:55:34 2008
@@ -124,6 +124,9 @@
 	GHashTable *additions;
 	GHashTable *updates;
 	GHashTable *deletions;
+
+	gboolean internet;
+
 	/*padding*/
 	unsigned int padding[10];
 };
@@ -533,6 +536,7 @@
 	priv->link_info = NULL;
 	priv->msg_body_id = NULL;
 	priv->has_attachment = FALSE;
+	priv->internet = FALSE;
 	item->priv = priv;
 
 
@@ -1657,7 +1661,7 @@
 e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param)
 {
 	EGwItem *item;
-        char *item_type;
+        char *item_type, *internet_prop;
 	SoupSoapParameter *subparameter, *child, *category_param, *attachment_param;
 	gboolean is_group_item = TRUE;
 	GList *user_email = NULL;
@@ -1671,6 +1675,13 @@
 
 	item = g_object_new (E_TYPE_GW_ITEM, NULL);
 	item_type = soup_soap_parameter_get_property (param, "type");
+
+	internet_prop = soup_soap_parameter_get_property (param, "internet");
+
+	if (internet_prop && !g_ascii_strcasecmp (internet_prop, "1"))
+		item->priv->internet = TRUE;
+	g_free (internet_prop);
+
 	if (!g_ascii_strcasecmp (item_type, "Mail"))
 		item->priv->item_type = E_GW_ITEM_TYPE_MAIL ;
 	else if (!g_ascii_strcasecmp (item_type, "Appointment"))
@@ -1970,6 +1981,10 @@
 				if (temp)
 					attach->date = soup_soap_parameter_get_string_value (temp) ;
 
+				temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "hidden") ;
+				if (temp) 
+					if (soup_soap_parameter_get_int_value (temp) == 1)
+						attach->hidden = TRUE;
 
 				item->priv->attach_list = g_slist_append (item->priv->attach_list, attach) ;
 			}
@@ -2124,6 +2139,14 @@
 	return item->priv->has_attachment;
 }
 
+gboolean
+e_gw_item_is_from_internet (EGwItem *item)
+{
+	g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
+
+	return item->priv->internet;
+}
+
 char *
 e_gw_item_get_creation_date (EGwItem *item)
 {

Modified: branches/gnome-2-22/servers/groupwise/e-gw-item.h
==============================================================================
--- branches/gnome-2-22/servers/groupwise/e-gw-item.h	(original)
+++ branches/gnome-2-22/servers/groupwise/e-gw-item.h	Tue Apr 29 08:55:34 2008
@@ -130,6 +130,7 @@
 	int size ;
 	char *date ;
 	char *data ;
+	gboolean hidden;
 } EGwItemAttachment ;
 
 typedef enum {
@@ -301,6 +302,8 @@
 
 gboolean e_gw_item_has_attachment (EGwItem *item);
 
+gboolean e_gw_item_is_from_internet (EGwItem *item);
+
 typedef struct {
 	char *email;
 	char *display_name;



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