[evolution-patches] Patch for eds to support Shared Folders



Hi, 
I am sending a patch for the changes in the eds to support shared
folders functionality.
In e-gw-connection.[ch] I have included a method to share a folder.
In e-gw-container.[ch] I have included some methods to set and get the
properties on a container if it represents a shared folder.
Thanks,

Vivek Jain
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.79
diff -u -p -r1.79 ChangeLog
--- ChangeLog	6 Dec 2004 01:31:31 -0000	1.79
+++ ChangeLog	15 Dec 2004 04:27:57 -0000
@@ -1,3 +1,34 @@
+2004-12-14  Vivek Jain <jvivek novell com>
+
+	* e-gw-connection.[ch] : added a function to share a folder
+	(e_gw_connection_share_folder)
+	
+	*e-gw-container.[ch] : Added One structure for reperenting a user
+	corresponding to a folder (EShUsers),
+	Added functions 
+	(e_gw_container_get_user_list) : gets list of users for a folder
+	(e_gw_container_get_email): gets the nth email id in the user list
+	(e_gw_container_get_length): gets the uselist length
+	(e_gw_container_get_owner): gets owner of the folder
+	(e_gw_container_get_modified) : gets when modified last
+	(e_gw_container_get_sequence) : gets the sequence of the folder
+	(e_gw_container_get_is_shared_by_me)
+	(e_gw_container_get_is_shared_to_me)
+	(e_gw_container_get_rights)
+	(e_gw_container_get_length)
+
+	and for setting these the following static methods in 
+	* e-gw-container.c 
+	(e_gw_container_set_user_list)
+	(e_gw_container_set_email)
+	(e_gw_container_set_owner)
+	(e_gw_container_set_modified)
+	(e_gw_container_set_sequence) 
+	(e_gw_container_set_is_shared_by_me)
+	(e_gw_container_set_is_shared_to_me)
+	(e_gw_container_set_rights)
+
+
 2004-12-05  Sivaiah Nallagatla <snallagatla novell com>
 
 	* e-gw-connection.[ch] : (e_gw_connection_get_item) :
Index: e-gw-container.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-container.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-gw-container.c
--- e-gw-container.c	6 Dec 2004 01:31:31 -0000	1.6
+++ e-gw-container.c	15 Dec 2004 04:27:57 -0000
@@ -29,14 +29,28 @@
 
 struct _EGwContainerPrivate {
 	char *name;
+	int sequence;
 	char *id;
+	char *owner;
 	char *parent ;
+	GList *user_list;	
+	const char *modified;
 	gboolean is_root ;
 	gboolean is_writable;
 	gboolean is_frequent_contacts; /*indicates  whether this folder is frequent contacts or not */
+	gboolean is_shared_by_me;   
+	gboolean is_shared_to_me;
 };
 
 static GObjectClass *parent_class = NULL;
+static void e_gw_container_set_email(EShUsers *user, const char *email);
+static void e_gw_container_set_sequence (EGwContainer *container, int sequence);
+static void e_gw_container_set_modified (EGwContainer *container, const char *modified);
+static void e_gw_container_set_owner(EGwContainer *container, const char *owner);
+static void e_gw_container_set_rights (EShUsers *user, int rights);
+static void e_gw_container_set_email (EShUsers *user, const char *email);
+static void e_gw_container_set_is_shared_by_me (EGwContainer *container, gboolean is_shared_by_me);
+static void e_gw_container_set_is_shared_to_me (EGwContainer *container, gboolean is_shared_to_me);
 
 static void
 e_gw_container_dispose (GObject *object)
@@ -146,7 +160,14 @@ gboolean
 e_gw_container_set_from_soap_parameter (EGwContainer *container, SoupSoapParameter *param)
 {
 	char *value;
+	int int_value;
+	int rights = 0;
+	gboolean byme = FALSE;
+	gboolean tome = FALSE;
 	SoupSoapParameter *subparam;
+	SoupSoapParameter *entry_subparam;
+	SoupSoapParameter *email_rt_subparam;
+	SoupSoapParameter *rights_subparam;
 
 	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
 	g_return_val_if_fail (param != NULL, FALSE);
@@ -181,15 +202,304 @@ e_gw_container_set_from_soap_parameter (
 		e_gw_container_set_parent_id (container, "");
 		container->priv->is_root = TRUE ;
 	} else {
-
 		value = soup_soap_parameter_get_string_value (subparam);
 		e_gw_container_set_parent_id (container, (const char *) value);
 		g_free (value) ;
 	}
+/* Is shared by me*/
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "isSharedByMe");
+	if (!subparam) {
+		e_gw_container_set_is_shared_by_me(container, FALSE);
+
+	} else {
+		value = soup_soap_parameter_get_string_value (subparam);
+		if (value) {
+			e_gw_container_set_is_shared_by_me (container, TRUE);
+			byme = TRUE;
+		} else {
+			e_gw_container_set_is_shared_by_me (container, FALSE);
+			byme = FALSE;
+		}
+
+		g_free (value);
+	}
+	/* is shared to me*/
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "isSharedToMe");
+	if (!subparam) {
+		e_gw_container_set_is_shared_to_me (container, FALSE);
+
+	} else {
+		value = soup_soap_parameter_get_string_value (subparam);
+		if (value) {
+			e_gw_container_set_is_shared_to_me (container, TRUE);
+			tome = TRUE;
+		} else { 
+			e_gw_container_set_is_shared_to_me (container, FALSE);
+			tome = FALSE;
+		}
+		
+		g_free (value);
+	}
+	/*Retrieve email add of the sharing person*/
+	if (tome || byme) {
+		subparam = soup_soap_parameter_get_first_child_by_name (param, "acl");
+		if (!subparam){
+			g_warning (G_STRLOC ": No ACL");
+		}
+		else {
+			for (entry_subparam = soup_soap_parameter_get_first_child_by_name (subparam, "entry");
+					entry_subparam != NULL;
+					entry_subparam = soup_soap_parameter_get_next_child_by_name (entry_subparam, "entry")) {
+
+				EShUsers *user = g_new0(EShUsers , 1);
+				email_rt_subparam = soup_soap_parameter_get_first_child_by_name (entry_subparam, "email");
+				if (!email_rt_subparam) {
+					g_warning (G_STRLOC ":Email Tag Not Available");
+				} else {
+					value = soup_soap_parameter_get_string_value (email_rt_subparam);
+					if (value) {
+						e_gw_container_set_email (user, value);
+					}	
+					g_free (value);	
+				}	
+				/* Retrieve Rights*/
+				email_rt_subparam = soup_soap_parameter_get_first_child_by_name (entry_subparam, "rights");
+
+				if (!email_rt_subparam)
+					break;
+				else {
+					rights = 0;
+					rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "add");	
+					if (rights_subparam) {	
+						rights = rights | 0x1;
+					}
+					rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "edit");	
+					if (rights_subparam) {
+						rights = rights | 0x2;
+					}
+
+					rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "delete");	
+					if (rights_subparam) {	
+						rights = rights | 0x4;
+					}
+					e_gw_container_set_rights (user, rights);
+
+				}
+
+				container->priv->user_list = g_list_append (container->priv->user_list, user);
+
+			} 
+
+		}
+
+	}
+
+		/*Retrieve owner*/
+		subparam = soup_soap_parameter_get_first_child_by_name (param, "owner");
+		if ( !subparam);
+		else
+		{
+			value = soup_soap_parameter_get_string_value (subparam);
+			e_gw_container_set_owner (container, value);
+			g_free (value);
+		}
+
+	/* shared folder*/
+	/*Retrieve When Modified last*/
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "modified");
+	if (!subparam) {
+		;
+	} else {
+		value = soup_soap_parameter_get_string_value (subparam);
+		e_gw_container_set_modified (container, (const char *) value);
+		g_free (value);
+	}
+
+	/*retrieve sequence*/
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "sequence");
+	if (!subparam); 
+
+	else{
+		int_value = soup_soap_parameter_get_int_value (subparam);
+		e_gw_container_set_sequence (container, int_value);		
+	}
 
 	return TRUE;
 }
 
+void 
+e_gw_container_get_user_list (EGwContainer *container, GList **user_list)
+{
+	g_return_if_fail (E_GW_CONTAINER (container));
+	*user_list = container->priv->user_list;
+
+}
+
+gint
+e_gw_container_get_length (EGwContainer *container)
+{
+	gint length = 0;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
+	length = g_list_length (container->priv->user_list);
+	return length;
+}
+
+int
+e_gw_container_get_sequence (EGwContainer *container)
+{
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
+	return (int)container->priv->sequence;
+}
+
+static  void 
+e_gw_container_set_sequence (EGwContainer *container, int sequence)
+{
+	g_return_if_fail (E_IS_GW_CONTAINER (container));
+	container->priv->sequence = sequence;
+}
+
+const char *
+e_gw_container_get_modified (EGwContainer *container)
+{
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
+
+	return (const char *) container->priv->modified;
+}
+
+static void
+e_gw_container_set_modified (EGwContainer *container, const char *modified)
+{
+	EGwContainerPrivate *priv;
+
+	g_return_if_fail (E_IS_GW_CONTAINER (container));
+	g_return_if_fail (modified != NULL);
+
+	priv = container->priv;
+
+	if (priv->modified)
+		g_free (priv->modified);
+	priv->modified = g_strdup (modified);
+}
+
+static void 
+e_gw_container_set_owner(EGwContainer *container, const char *owner)
+{
+	EGwContainerPrivate *priv;
+	g_return_if_fail (E_IS_GW_CONTAINER(container));
+	g_return_if_fail (owner!=NULL);
+	priv = container->priv;
+	if (priv->owner)
+		g_free (container->priv->owner);
+	container->priv->owner = g_strdup (owner);
+}
+
+const char *
+e_gw_container_get_owner (EGwContainer *container)
+{
+	g_return_val_if_fail (E_GW_CONTAINER (container), NULL);
+	return (const char *) container->priv->owner;
+}
+
+static void
+e_gw_container_set_rights (EShUsers *user, int rights)
+{
+	user->rights = rights;
+}
+
+int
+e_gw_container_get_rights (EGwContainer *container, gchar *email)
+{
+	EShUsers *user_list = NULL;
+	EShUsers *user = NULL;
+	GList *tmp;
+	gint i ;
+
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
+	user_list = container->priv->user_list;
+		if (user_list) {
+		tmp = g_list_first (user_list);
+		for(i=0; tmp  ; i++)
+		{
+			user= g_list_nth_data (tmp, 0);
+			if( !strcmp (user->email, email)){
+				return user->rights;
+			}
+			tmp = g_list_next(tmp);
+
+		}
+	}
+
+	return 0;
+}
+
+static void 
+e_gw_container_set_email (EShUsers *user, const char *email)
+{
+
+	gchar **head, **tail;
+	
+	g_return_if_fail (email!=NULL);
+	head = g_strsplit (email, ".", 2);
+	tail = g_strsplit (email, "@", 2);
+	email = g_strconcat (head[0],"@", tail[1], NULL);
+	user->email = g_strdup (email);
+	g_strfreev(head);
+	g_strfreev(tail);
+}
+
+gchar * 
+e_gw_container_get_email(EGwContainer *container, int count)
+{
+
+	EShUsers *user_list = NULL;
+	EShUsers *user = NULL;
+	EGwContainerPrivate *priv;
+	int length;
+	
+	priv = container->priv;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
+
+	user_list = priv->user_list;
+	length = g_list_length (user_list);
+	user = g_list_nth_data (user_list, count);
+	
+	return (gchar *) user->email;
+}
+
+
+gboolean
+e_gw_container_get_is_shared_by_me (EGwContainer *container)
+{
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
+	
+	return (gboolean) container->priv->is_shared_by_me;
+}
+
+static void
+e_gw_container_set_is_shared_by_me (EGwContainer *container, gboolean is_shared_by_me)
+{
+	g_return_if_fail (E_IS_GW_CONTAINER (container));
+	container->priv->is_shared_by_me = is_shared_by_me;
+}
+
+
+gboolean
+e_gw_container_get_is_shared_to_me (EGwContainer *container)
+{
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
+	
+	return (gboolean) container->priv->is_shared_to_me;
+}
+
+static void
+e_gw_container_set_is_shared_to_me (EGwContainer *container, gboolean is_shared_to_me)
+{
+	g_return_if_fail (E_IS_GW_CONTAINER (container));
+	container->priv->is_shared_to_me = is_shared_to_me;
+}
+
+
+
 const char *
 e_gw_container_get_name (EGwContainer *container)
 {
@@ -289,14 +599,13 @@ e_gw_container_get_is_frequent_contacts 
 void
 e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts)
 {
-        g_return_if_fail (E_IS_GW_CONTAINER (container));
-                                                                                                                             
-        container->priv->is_frequent_contacts = is_frequent_contacts;
+	g_return_if_fail (E_IS_GW_CONTAINER (container)) ;
+	container->priv->is_frequent_contacts = is_frequent_contacts ;
 }
 
 gboolean
 e_gw_container_is_root (EGwContainer *container)
 {
-	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE) ;
-	return container->priv->is_root ;
+	        g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE) ;
+		        return container->priv->is_root ;
 }
Index: e-gw-container.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-container.h,v
retrieving revision 1.5
diff -u -p -r1.5 e-gw-container.h
--- e-gw-container.h	6 Dec 2004 01:31:31 -0000	1.5
+++ e-gw-container.h	15 Dec 2004 04:27:57 -0000
@@ -37,6 +37,7 @@ G_BEGIN_DECLS
 typedef struct _EGwContainer        EGwContainer;
 typedef struct _EGwContainerClass   EGwContainerClass;
 typedef struct _EGwContainerPrivate EGwContainerPrivate;
+typedef struct _EShUsers            EShUsers;
 
 struct _EGwContainer {
 	GObject parent;
@@ -47,6 +48,11 @@ struct _EGwContainerClass {
 	GObjectClass parent_class;
 };
 
+struct _EShUsers {
+	char *email;
+	int rights;
+};
+
 GType         e_gw_container_get_type (void);
 EGwContainer *e_gw_container_new_from_soap_parameter (SoupSoapParameter *param);
 gboolean      e_gw_container_set_from_soap_parameter (EGwContainer *container,
@@ -59,10 +65,18 @@ const char   *e_gw_container_get_parent_
 void 	      e_gw_container_set_parent_id (EGwContainer *container, const char *parent_id) ;
 gboolean      e_gw_container_get_is_writable (EGwContainer *container);
 void          e_gw_container_set_is_writable (EGwContainer *container, gboolean writable);
-gboolean     e_gw_container_get_is_frequent_contacts (EGwContainer *container);
-void         e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts);
-gboolean    e_gw_container_is_root (EGwContainer *container) ;
-
+gboolean      e_gw_container_get_is_frequent_contacts (EGwContainer *container);
+void          e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts);
+gchar *       e_gw_container_get_email (EGwContainer *container, int count);
+const char *  e_gw_container_get_owner(EGwContainer *container);
+const char *  e_gw_container_get_modified(EGwContainer *container);
+int           e_gw_container_get_sequence(EGwContainer *container);
+gboolean      e_gw_container_get_is_shared_by_me(EGwContainer *container);
+gboolean      e_gw_container_get_is_shared_to_me(EGwContainer *container);
+int 	      e_gw_container_get_rights(EGwContainer *container, gchar *email);
+gint 	      e_gw_container_get_length(EGwContainer *container);
+void 	      e_gw_container_get_user_list(EGwContainer *container, GList **user_list);
+gboolean      e_gw_container_is_root (EGwContainer *container) ;
 G_END_DECLS
 
 #endif
Index: e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.89
diff -u -p -r1.89 e-gw-connection.c
--- e-gw-connection.c	6 Dec 2004 01:31:31 -0000	1.89
+++ e-gw-connection.c	15 Dec 2004 04:27:58 -0000
@@ -29,7 +29,6 @@
 #include <libgnome/gnome-i18n.h>
 #include <libsoup/soup-session-sync.h>
 #include <libsoup/soup-soap-message.h>
-#include <libsoup/soup-misc.h>
 #include "e-gw-connection.h"
 #include "e-gw-message.h"
 #include "e-gw-filter.h"
@@ -47,6 +46,10 @@ struct _EGwConnectionPrivate {
 	char *user_name;
 	char *user_email;
 	char *user_uuid;
+	char *uid ;
+	char *to ;
+	char *from ;
+	char *subject ;
 	GMutex *reauth_mutex;
 };
 
@@ -264,7 +267,10 @@ e_gw_connection_dispose (GObject *object
 			priv->user_email = NULL;
 		}
 
-	
+		if (priv->user_uuid) {
+			g_free (priv->user_uuid);
+			priv->user_uuid = NULL;
+		}
 		if (priv->reauth_mutex) {
 			g_mutex_free (priv->reauth_mutex);
 			priv->reauth_mutex = NULL;
@@ -408,7 +414,7 @@ e_gw_connection_new (const char *uri, co
 	cnc->priv->session_id = soup_soap_parameter_get_string_value (param);
 
 	/* retrieve user information */
-	param = soup_soap_response_get_first_parameter_by_name (response, "userinfo");
+	param = soup_soap_response_get_first_parameter_by_name (response, "UserInfo");
 	if (param) {
 		SoupSoapParameter *subparam;
 		const char *param_value;
@@ -475,7 +481,7 @@ e_gw_connection_logout (EGwConnection *c
 }
 
 EGwConnectionStatus
-e_gw_connection_get_container_list (EGwConnection *cnc, const char *top, GList **container_list)
+e_gw_connection_get_container_list (EGwConnection *cnc, const char *top,  GList **container_list)
 {
 	SoupSoapMessage *msg;
 	SoupSoapResponse *response;
@@ -491,8 +497,10 @@ e_gw_connection_get_container_list (EGwC
                 return E_GW_CONNECTION_STATUS_UNKNOWN;
         }
 
-	e_gw_message_write_string_parameter (msg, "parent", NULL, top);
+        e_gw_message_write_string_parameter (msg, "parent", NULL, top);
+
 	e_gw_message_write_string_parameter (msg, "recurse", NULL, "true");
+
 	e_gw_message_write_footer (msg);
 
         /* send message to server */
@@ -525,7 +533,7 @@ e_gw_connection_get_container_list (EGwC
 			EGwContainer *container;
 
 			container = e_gw_container_new_from_soap_parameter (subparam);
-			if (container) 
+			if (container)
 				*container_list = g_list_append (*container_list, container);
 		}
 	}
@@ -555,7 +563,7 @@ e_gw_connection_get_container_id (EGwCon
 	g_return_val_if_fail (name != NULL, NULL);
 
         status = e_gw_connection_get_container_list (cnc, "folders", &container_list);
-	if (status != E_GW_CONNECTION_STATUS_OK) {
+        if (status != E_GW_CONNECTION_STATUS_OK) {
 		e_gw_connection_free_container_list (container_list);
                 return NULL;
         }
@@ -1008,11 +1016,9 @@ e_gw_connection_get_item (EGwConnection 
                 return E_GW_CONNECTION_STATUS_UNKNOWN;
         }
       
-
-	e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
 	if (view)
-		e_gw_message_write_string_parameter (msg, "view", NULL, view) ;
+		e_gw_message_write_string_parameter (msg, "view", NULL, view) ;;
+	e_gw_message_write_string_parameter (msg, "id", NULL, id);
 	e_gw_message_write_footer (msg);
 
         /* send message to server */
@@ -1951,13 +1957,12 @@ EGwConnectionStatus e_gw_connection_get_
 
 }
 
-
 EGwConnectionStatus 
 e_gw_connection_create_folder(EGwConnection *cnc, const char *parent_name,const char *folder_name, char **container_id)
 {
 	SoupSoapMessage *msg;
 	SoupSoapResponse *response;
-	SoupSoapParameter *param ;
+	SoupSoapParameter *param, *subparam;
 	EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
 
 	msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id(cnc), "createItemRequest");
@@ -1993,7 +1998,6 @@ e_gw_connection_create_folder(EGwConnect
 	return status ;
 
 }
-
 /*
  * 
  */
@@ -2004,7 +2008,7 @@ e_gw_connection_get_attachment (EGwConne
 	SoupSoapMessage *msg;
         SoupSoapResponse *response;
         EGwConnectionStatus status;
-	SoupSoapParameter *param ;
+	SoupSoapParameter *param, *subparam;
 	char *buffer, *buf_length ;
 
         g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
@@ -2094,3 +2098,133 @@ e_gw_connection_add_item (EGwConnection 
 	return status;
 }
 
+EGwConnectionStatus 
+e_gw_connection_share_folder(EGwConnection *cnc, gchar *id, GList *new_list, const char *sub, const char *mesg ,int flag) 
+{
+	gboolean add = FALSE;
+	gboolean edit = FALSE;
+	gboolean del = FALSE;
+	gchar *email = NULL;
+	gint i,entries = 0;
+	SoupSoapMessage *msg;
+	SoupSoapResponse *response;
+	EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
+	EShUsers *user = NULL;
+
+	entries = g_list_length (new_list);
+	msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id (cnc), "modifyItemRequest");
+	/*id=g_strdup(e_gw_container_get_id(container));*/
+	e_gw_message_write_string_parameter (msg, "id", NULL, id);
+	soup_soap_message_start_element (msg, "notification", NULL, NULL);
+	e_gw_message_write_string_parameter (msg, "subject", NULL, sub);
+	e_gw_message_write_string_parameter (msg, "message", NULL, mesg);
+	soup_soap_message_end_element (msg);
+	soup_soap_message_start_element (msg, "updates", NULL, NULL);
+
+	if (flag == 1) {
+		soup_soap_message_start_element (msg, "delete", NULL, NULL);
+		soup_soap_message_start_element (msg, "acl", NULL, NULL);
+
+		for (i=0;i<entries;i++) {
+			add = edit = del = FALSE;
+			soup_soap_message_start_element (msg, "entry", NULL, NULL);
+			e_gw_message_write_string_parameter (msg, "displayName", NULL, "name");
+			user = g_list_nth_data (new_list,i);
+			email = g_strdup (user->email);	
+
+			if(user->rights & 0x1)
+				add = TRUE;
+			if(user->rights & 0x2)
+				edit = TRUE;
+			if(user->rights & 0x4)
+				del = TRUE;
+			e_gw_message_write_string_parameter (msg, "email", NULL, email);
+			soup_soap_message_start_element(msg, "rights", NULL, NULL);
+			e_gw_message_write_int_parameter (msg, "read", NULL, 1);
+			e_gw_message_write_int_parameter (msg, "add", NULL, add);
+			e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
+			e_gw_message_write_int_parameter (msg, "delete", NULL, del);
+
+			soup_soap_message_end_element (msg);
+			soup_soap_message_end_element (msg);
+
+		}
+		soup_soap_message_end_element (msg);
+		soup_soap_message_end_element (msg);
+
+	} else if (flag == 0) {	
+		soup_soap_message_start_element (msg, "add", NULL, NULL);
+		soup_soap_message_start_element (msg, "acl", NULL, NULL);
+
+		for (i=0;i<entries;i++) {
+			add=edit=del=FALSE;
+			soup_soap_message_start_element (msg, "entry", NULL, NULL);
+
+			/*check about this display name...shud work without this*/
+			e_gw_message_write_string_parameter (msg, "displayName", NULL,"");
+			user = g_list_nth_data (new_list, i);
+			email = g_strdup (user->email);	
+			if (user->rights & 0x1)
+				add = TRUE;
+			if (user->rights & 0x2)
+				edit = TRUE;
+			if (user->rights & 0x4)
+				del = TRUE;
+
+			e_gw_message_write_string_parameter (msg, "email", NULL, email);
+			soup_soap_message_start_element (msg, "rights", NULL, NULL);
+			e_gw_message_write_int_parameter (msg, "read", NULL, 1);
+			e_gw_message_write_int_parameter (msg, "add", NULL, add);
+			e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
+			e_gw_message_write_int_parameter (msg, "delete", NULL, del);
+
+			soup_soap_message_end_element (msg);
+			soup_soap_message_end_element (msg);
+		} 
+
+		soup_soap_message_end_element (msg);
+		soup_soap_message_end_element (msg);
+
+	} else if (flag == 2) {	
+		soup_soap_message_start_element (msg, "update", NULL, NULL);
+		soup_soap_message_start_element (msg, "acl", NULL, NULL);
+
+		for (i=0; i<entries; i++) {
+			add = edit = del = FALSE;
+			soup_soap_message_start_element (msg, "entry", NULL, NULL);
+
+			/*check about this display name...shud work without this*/
+			e_gw_message_write_string_parameter (msg, "displayName",NULL,"name");
+			user = g_list_nth_data (new_list, i);
+			email = g_strdup (user->email);	
+			if (user->rights & 0x1)
+				add = TRUE;
+			if (user->rights & 0x2)
+				edit = TRUE;
+			if (user->rights & 0x4)
+				del =TRUE;
+
+			e_gw_message_write_string_parameter (msg, "email", NULL, email);
+			soup_soap_message_start_element (msg, "rights", NULL, NULL);
+			e_gw_message_write_int_parameter (msg, "read", NULL, 1);
+			e_gw_message_write_int_parameter (msg, "add", NULL, add);
+			e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
+			e_gw_message_write_int_parameter (msg, "delete", NULL, del);
+
+			soup_soap_message_end_element (msg);
+			soup_soap_message_end_element (msg);
+		}
+
+		soup_soap_message_end_element (msg);
+		soup_soap_message_end_element (msg);
+
+	}
+
+	soup_soap_message_end_element (msg);	
+	e_gw_message_write_footer (msg);
+	response =  e_gw_connection_send_message (cnc, msg);
+	status = e_gw_connection_parse_response_status (response);
+
+	return status ;
+
+}
Index: e-gw-connection.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.39
diff -u -p -r1.39 e-gw-connection.h
--- e-gw-connection.h	6 Dec 2004 01:31:31 -0000	1.39
+++ e-gw-connection.h	15 Dec 2004 04:27:58 -0000
@@ -119,8 +119,8 @@ EGwConnectionStatus e_gw_connection_get_
 EGwConnectionStatus e_gw_connection_create_folder(EGwConnection *cnc, const char *parent_name,const char *folder_name, char **container_id) ;
 EGwConnectionStatus e_gw_connection_get_attachment (EGwConnection *cnc, const char *id, int offset, int length, const char **attachment, int *attach_lenght) ;
 EGwConnectionStatus e_gw_connection_add_item (EGwConnection *cnc, const char *container, const char *id) ;
-
-
+EGwConnectionStatus e_gw_connection_share_folder(EGwConnection *cnc, gchar *id, GList *new_list, const char *sub, const char *mesg ,int flag); 
+	
 G_END_DECLS
 
 #endif


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