[evolution-data-server] Change camel_junk_filter_classify() signature.



commit 309275a9292366784f0338dfcf9ad02b9a1fe8df
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Oct 16 10:31:47 2012 -0400

    Change camel_junk_filter_classify() signature.
    
    Add CAMEL_JUNK_STATUS_ERROR to the CamelJunkStatus enum and have
    camel_junk_filter_classify() return the status directly, rather than
    forcing callers to check both a status value and a 'success' boolean.
    
    Minor API break, but should only affect Evolution.

 camel/camel-enums.h         |    3 +++
 camel/camel-filter-search.c |    5 +++--
 camel/camel-junk-filter.c   |   12 +++++-------
 camel/camel-junk-filter.h   |    6 ++----
 configure.ac                |    2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/camel/camel-enums.h b/camel/camel-enums.h
index b8e84ca..8d7bb95 100644
--- a/camel/camel-enums.h
+++ b/camel/camel-enums.h
@@ -176,6 +176,8 @@ typedef enum {
 
 /**
  * CamelJunkStatus:
+ * @CAMEL_JUNK_STATUS_ERROR:
+ *     An error occurred while invoking the junk filter.
  * @CAMEL_JUNK_STATUS_INCONCLUSIVE:
  *     The junk filter could not determine whether the message is junk.
  * @CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK:
@@ -186,6 +188,7 @@ typedef enum {
  * These are result codes used when passing messages through a junk filter.
  **/
 typedef enum {
+	CAMEL_JUNK_STATUS_ERROR,
 	CAMEL_JUNK_STATUS_INCONCLUSIVE,
 	CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK,
 	CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 268cb3d..0c5e3ad 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -917,8 +917,8 @@ junk_test (struct _CamelSExp *f,
 	/* Consult 3rd party junk filtering software. */
 
 	message = camel_filter_search_get_message (fms, f);
-	camel_junk_filter_classify (
-		junk_filter, message, &status, NULL, &error);
+	status = camel_junk_filter_classify (
+		junk_filter, message, NULL, &error);
 
 	if (error == NULL) {
 		const gchar *status_desc;
@@ -948,6 +948,7 @@ junk_test (struct _CamelSExp *f,
 				"Junk filter classification: %s\n",
 				status_desc);
 	} else {
+		g_warn_if_fail (status == CAMEL_JUNK_STATUS_ERROR);
 		g_warning ("%s: %s", G_STRFUNC, error->message);
 		g_error_free (error);
 		message_is_junk = FALSE;
diff --git a/camel/camel-junk-filter.c b/camel/camel-junk-filter.c
index d4932d0..484a1b7 100644
--- a/camel/camel-junk-filter.c
+++ b/camel/camel-junk-filter.c
@@ -29,22 +29,21 @@ camel_junk_filter_default_init (CamelJunkFilterInterface *interface)
  * camel_junk_filter_classify:
  * @junk_filter: a #CamelJunkFilter
  * @message: a #CamelMimeMessage
- * @status: location to write the #CamelJunkStatus
  * @cancellable: optional #GCancellable object, or %NULL
  * @error: return location for a #GError, or %NULL
  *
  * Classifies @message as junk, not junk or inconclusive.
  *
- * If an error occurs, the function sets @error and returns %FALSE.
+ * If an error occurs, the function sets @error and returns
+ * %CAMEL_JUNK_STATUS_ERROR.
  *
- * Returns: %TRUE if @message was successfully classified
+ * Returns: the junk status determined by @junk_filter
  *
  * Since: 3.2
  **/
-gboolean
+CamelJunkStatus
 camel_junk_filter_classify (CamelJunkFilter *junk_filter,
                             CamelMimeMessage *message,
-                            CamelJunkStatus *status,
                             GCancellable *cancellable,
                             GError **error)
 {
@@ -52,13 +51,12 @@ camel_junk_filter_classify (CamelJunkFilter *junk_filter,
 
 	g_return_val_if_fail (CAMEL_IS_JUNK_FILTER (junk_filter), FALSE);
 	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
-	g_return_val_if_fail (status != NULL, FALSE);
 
 	interface = CAMEL_JUNK_FILTER_GET_INTERFACE (junk_filter);
 	g_return_val_if_fail (interface->classify != NULL, FALSE);
 
 	return interface->classify (
-		junk_filter, message, status, cancellable, error);
+		junk_filter, message, cancellable, error);
 }
 
 /**
diff --git a/camel/camel-junk-filter.h b/camel/camel-junk-filter.h
index 7481b89..702c99b 100644
--- a/camel/camel-junk-filter.h
+++ b/camel/camel-junk-filter.h
@@ -59,9 +59,8 @@ struct _CamelJunkFilterInterface {
 	GTypeInterface parent_interface;
 
 	/* Required Methods */
-	gboolean	(*classify)		(CamelJunkFilter *junk_filter,
+	CamelJunkStatus	(*classify)		(CamelJunkFilter *junk_filter,
 						 CamelMimeMessage *message,
-						 CamelJunkStatus *status,
 						 GCancellable *cancellable,
 						 GError **error);
 	gboolean	(*learn_junk)		(CamelJunkFilter *junk_filter,
@@ -80,9 +79,8 @@ struct _CamelJunkFilterInterface {
 };
 
 GType		camel_junk_filter_get_type	(void) G_GNUC_CONST;
-gboolean	camel_junk_filter_classify	(CamelJunkFilter *junk_filter,
+CamelJunkStatus	camel_junk_filter_classify	(CamelJunkFilter *junk_filter,
 						 CamelMimeMessage *message,
-						 CamelJunkStatus *status,
 						 GCancellable *cancellable,
 						 GError **error);
 gboolean	camel_junk_filter_learn_junk	(CamelJunkFilter *junk_filter,
diff --git a/configure.ac b/configure.ac
index 9f38083..75adb87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,7 +111,7 @@ LIBEBOOK_CURRENT=17
 LIBEBOOK_REVISION=1
 LIBEBOOK_AGE=3
 
-LIBCAMEL_CURRENT=40
+LIBCAMEL_CURRENT=41
 LIBCAMEL_REVISION=0
 LIBCAMEL_AGE=0
 



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