[evolution-patches] Re: patch for junk-api implementation (eds/servers/groupwise)



Here is the patch with more generic implementation of api's.

Thanks,
Vivek Jain
On Tue, 2005-06-21 at 06:49 +0000, Vivek Jain(Jain Vivek) wrote:
> Hi,
> 
> This patch adds some methods to e-gw-connection.c that implement the
> junk handling APIs for groupwise. 
> 
> Thanks,
> Vivek Jain
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.141
diff -u -p -r1.141 ChangeLog
--- ChangeLog	8 Jun 2005 05:42:43 -0000	1.141
+++ ChangeLog	24 Jun 2005 09:59:20 -0000
@@ -1,3 +1,12 @@
+2005-06-24  Vivek Jain <jvivek novell com>
+	
+	* e-gw-connection.[ch]: added functions
+	(e_gw_connection_modify_junk_mail_settings):to set/modify junk mail
+	settings
+	(e_gw_connection_create_junk_entry): to create a junk entry 
+	(e_gw_connection_get_junk_entries) : to get junk entries stored at
+	server
+
 2005-06-08  Srinivasa Ragavan <sragavan novell com>
 
 	* e-gw-connection.[ch] :Added function to retrive deltainfo and delta
Index: e-gw-connection.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.59
diff -u -p -r1.59 e-gw-connection.h
--- e-gw-connection.h	8 Jun 2005 05:42:43 -0000	1.59
+++ e-gw-connection.h	24 Jun 2005 09:59:20 -0000
@@ -147,6 +147,9 @@ EGwConnectionStatus e_gw_connection_purg
 EGwConnectionStatus e_gw_connection_mark_read(EGwConnection *cnc, GList *item_ids) ;
 EGwConnectionStatus e_gw_connection_mark_unread(EGwConnection *cnc, GList *item_ids) ;
 EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const char *id, const char *view, EGwItem **item) ;
+EGwConnectionStatus e_gw_connection_create_junk_entry (EGwConnection *cnc, const char *value, const char *match_type , const char *list_type);
+EGwConnectionStatus e_gw_connection_modify_junk_settings (EGwConnection *cnc, int value, int persistence);
+EGwConnectionStatus e_gw_connection_get_junk_entries (EGwConnection *cnc);
 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.118
diff -u -p -r1.118 e-gw-connection.c
--- e-gw-connection.c	8 Jun 2005 05:42:43 -0000	1.118
+++ e-gw-connection.c	24 Jun 2005 09:59:20 -0000
@@ -2901,3 +2901,132 @@ e_gw_connection_reply_item (EGwConnectio
 
         return E_GW_CONNECTION_STATUS_OK;
 }
+
+/* e_gw_connection_create_junk_entry :creates a junk entry in the list
+ * @cnc
+ * @value : to be added in the list 
+ * @match_type : "email"/"domain" default: email
+ * @list_type : "junk"/"trust"/"block" default: junk
+ * */
+
+EGwConnectionStatus
+e_gw_connection_create_junk_entry (EGwConnection *cnc, const char *value, const char *match_type, const char *list_type) 
+{
+	SoupSoapMessage *msg;
+        SoupSoapResponse *response;
+        EGwConnectionStatus status;
+        
+	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
+	g_return_val_if_fail (value != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
+	
+	/* build the SOAP message */
+        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "createJunkEntryRequest");
+        if (!msg) {
+                g_warning (G_STRLOC ": Could not build SOAP message");
+                return E_GW_CONNECTION_STATUS_UNKNOWN;
+        }
+	soup_soap_message_start_element (msg, "entry", NULL, NULL);
+	e_gw_message_write_string_parameter (msg, "match", NULL, value);
+	e_gw_message_write_string_parameter (msg, "matchType", NULL, match_type);
+	e_gw_message_write_string_parameter (msg, "listType", NULL, list_type);
+	soup_soap_message_end_element (msg);
+	e_gw_message_write_footer (msg);
+	response =  e_gw_connection_send_message (cnc, msg);
+	
+	if (!response) {
+		g_object_unref (msg);
+		return E_GW_CONNECTION_STATUS_NO_RESPONSE;
+	}
+
+	status = e_gw_connection_parse_response_status (response);
+	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+		reauthenticate (cnc);
+	/* free memory */
+	g_object_unref (response);
+	g_object_unref (msg);
+
+	return status;
+}
+
+/* e_gw_connection_modify_junk_settings: creates/removes junk mail settings
+ * @cnc
+ * @value 0 : disable spam learning 1: enable
+ * @persistence :
+ * */
+ 
+EGwConnectionStatus
+e_gw_connection_modify_junk_settings (EGwConnection *cnc, int value, int persistence)
+{
+	SoupSoapMessage *msg;
+        SoupSoapResponse *response;
+        EGwConnectionStatus status;
+        
+	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
+	
+	/* build the SOAP message */
+        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "modifyJunkMailSettingsRequest");
+        if (!msg) {
+                g_warning (G_STRLOC ": Could not build SOAP message");
+                return E_GW_CONNECTION_STATUS_UNKNOWN;
+        }
+	
+	soup_soap_message_start_element (msg, "settings", NULL, NULL);
+	soup_soap_message_start_element (msg, "setting", NULL, NULL);
+	e_gw_message_write_string_parameter (msg, "field", NULL, "useJunkList");
+	e_gw_message_write_int_parameter (msg, "value", NULL, value);
+	soup_soap_message_end_element (msg);
+	soup_soap_message_start_element (msg, "setting", NULL, NULL);
+	e_gw_message_write_string_parameter (msg, "field", NULL, "persistence");
+	e_gw_message_write_int_parameter (msg, "value", NULL, persistence);
+	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);
+	
+	if (!response) {
+		g_object_unref (msg);
+		return E_GW_CONNECTION_STATUS_NO_RESPONSE;
+	}
+
+	status = e_gw_connection_parse_response_status (response);
+	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+		reauthenticate (cnc);
+	/* free memory */
+	g_object_unref (response);
+	g_object_unref (msg);
+
+	return status;
+}
+
+EGwConnectionStatus
+e_gw_connection_get_junk_entries (EGwConnection *cnc)
+{
+	SoupSoapMessage *msg;
+        SoupSoapResponse *response;
+        EGwConnectionStatus status;
+        
+	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
+	
+	/* build the SOAP message */
+        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getJunkEntriesRequest");
+        if (!msg) {
+                g_warning (G_STRLOC ": Could not build SOAP message");
+                return E_GW_CONNECTION_STATUS_UNKNOWN;
+        }
+	e_gw_message_write_footer (msg);
+	response =  e_gw_connection_send_message (cnc, msg);
+	
+	if (!response) {
+		g_object_unref (msg);
+		return E_GW_CONNECTION_STATUS_NO_RESPONSE;
+	}
+
+	status = e_gw_connection_parse_response_status (response);
+	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+		reauthenticate (cnc);
+	/* free memory */
+	g_object_unref (response);
+	g_object_unref (msg);
+
+	return status;
+}


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