[evolution-data-server] Rewrite Camel's junk plugin interface.



commit 5075ef94919d77dbda1449f04af14e8c58d2e847
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jul 10 21:49:16 2011 -0400

    Rewrite Camel's junk plugin interface.
    
    Replace CamelJunkPlugin with a proper GInterface and add a "junk-filter"
    property to CamelSession with corresponding get/set functions.  The new
    interface includes GCancellable and GError parameters.

 camel/Makefile.am                                |    4 +-
 camel/camel-filter-search.c                      |   15 +++-
 camel/camel-folder.c                             |   47 ++++++++---
 camel/camel-junk-filter.c                        |  103 ++++++++++++++++++++++
 camel/camel-junk-filter.h                        |  103 ++++++++++++++++++++++
 camel/camel-junk-plugin.c                        |   85 ------------------
 camel/camel-junk-plugin.h                        |   71 ---------------
 camel/camel-session.c                            |   86 ++++++++++++++++++
 camel/camel-session.h                            |    8 +-
 camel/camel.h                                    |    2 +-
 docs/reference/camel/camel-docs.sgml             |    2 +-
 docs/reference/camel/camel-sections.txt          |   35 +++++---
 docs/reference/camel/camel.types                 |    1 +
 docs/reference/camel/tmpl/camel-junk-filter.sgml |   85 ++++++++++++++++++
 docs/reference/camel/tmpl/camel-junk-plugin.sgml |   96 --------------------
 docs/reference/camel/tmpl/camel-session.sgml     |   23 +++++
 16 files changed, 481 insertions(+), 285 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index d4b2dd0..f5b6ad3 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -172,7 +172,7 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-iconv.c				\
 	camel-index.c				\
 	camel-internet-address.c		\
-	camel-junk-plugin.c			\
+	camel-junk-filter.c			\
 	camel-list-utils.c			\
 	camel-lock.c				\
 	camel-medium.c				\
@@ -240,7 +240,7 @@ libcamelinclude_HEADERS =			\
 	camel-iconv.h				\
 	camel-index.h				\
 	camel-internet-address.h		\
-	camel-junk-plugin.h			\
+	camel-junk-filter.h			\
 	camel-list-utils.h			\
 	camel-lock-client.h			\
 	camel-lock.h				\
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index cf8ef83..5c32882 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -692,9 +692,12 @@ junk_test (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMessag
 	ESExpResult *r;
 	gboolean retval = FALSE;
 	CamelMessageInfo *info = fms->info;
+	CamelJunkFilter *junk_filter;
+
+	junk_filter = camel_session_get_junk_filter (fms->session);
 
 	d(printf("doing junk test for message from '%s'\n", camel_message_info_from (fms->info)));
-	if (fms->session->junk_plugin != NULL && (camel_message_info_flags (info) & (CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK)) == 0) {
+	if (junk_filter != NULL && (camel_message_info_flags (info) & (CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK)) == 0) {
 		const GHashTable *ht = camel_session_get_junk_headers (fms->session);
 		const struct _camel_header_param *node = camel_message_info_headers (info);
 
@@ -716,14 +719,20 @@ junk_test (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMessag
 				printf("Sender '%s' in book? %d\n", camel_message_info_from (info), !retval);
 
 			if (retval) /* Not in book. Could be spam. So check for it*/ {
+				CamelMimeMessage *message;
+				CamelJunkStatus status;
+				gboolean success;
+
 				d(printf("filtering message\n"));
-				retval = camel_junk_plugin_check_junk (fms->session->junk_plugin, camel_filter_search_get_message (fms, f));
+				message = camel_filter_search_get_message (fms, f);
+				success = camel_junk_filter_classify (junk_filter, message, &status, NULL, NULL);
+				retval = success && (status == CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK);
 			}
 		}
 
 		if (camel_debug ("junk"))
 			printf("junk filter => %s\n", retval ? "*JUNK*" : "clean");
-	} else if (fms->session->junk_plugin != NULL && camel_debug ("junk")) {
+	} else if (junk_filter != NULL && camel_debug ("junk")) {
 		if (camel_message_info_flags (info) & CAMEL_MESSAGE_JUNK)
 			printf ("Message has a Junk flag set already, skipping junk test...\n");
 		else if (camel_message_info_flags (info) & CAMEL_MESSAGE_NOTJUNK)
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index f819d73..4159b6c 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -221,14 +221,21 @@ folder_filter (CamelSession *session,
 	CamelMessageInfo *info;
 	CamelStore *parent_store;
 	gint i, status = 0;
-	CamelJunkPlugin *csp;
+	CamelJunkFilter *junk_filter;
+	gboolean synchronize = FALSE;
 	const gchar *full_name;
 
 	full_name = camel_folder_get_full_name (data->folder);
 	parent_store = camel_folder_get_parent_store (data->folder);
-	csp = session->junk_plugin;
+	junk_filter = camel_session_get_junk_filter (session);
+
+	/* Keep the junk filter alive until we're done. */
+	if (junk_filter != NULL)
+		g_object_ref (junk_filter);
 
 	if (data->junk) {
+		gboolean success = TRUE;
+
 		/* Translators: The %s is replaced with the
 		 * folder name where the operation is running. */
 		camel_operation_push_message (
@@ -237,7 +244,7 @@ folder_filter (CamelSession *session,
 			"Learning new spam messages in '%s'",
 			data->junk->len), full_name);
 
-		for (i = 0; i < data->junk->len; i++) {
+		for (i = 0; success && i < data->junk->len; i++) {
 			CamelMimeMessage *message;
 			gint pc = 100 * i / data->junk->len;
 
@@ -253,17 +260,22 @@ folder_filter (CamelSession *session,
 				break;
 
 			camel_operation_progress (cancellable, pc);
-			camel_junk_plugin_report_junk (csp, message);
+			success = camel_junk_filter_learn_junk (
+				junk_filter, message, cancellable, error);
 			g_object_unref (message);
+
+			synchronize |= success;
 		}
 
 		camel_operation_pop_message (cancellable);
 	}
 
 	if (*error != NULL)
-		return;
+		goto exit;
 
 	if (data->notjunk) {
+		gboolean success = TRUE;
+
 		/* Translators: The %s is replaced with the
 		 * folder name where the operation is running. */
 		camel_operation_push_message (
@@ -272,7 +284,7 @@ folder_filter (CamelSession *session,
 			"Learning new ham messages in '%s'",
 			data->notjunk->len), full_name);
 
-		for (i = 0; i < data->notjunk->len; i++) {
+		for (i = 0; success && i < data->notjunk->len; i++) {
 			CamelMimeMessage *message;
 			gint pc = 100 * i / data->notjunk->len;
 
@@ -288,18 +300,25 @@ folder_filter (CamelSession *session,
 				break;
 
 			camel_operation_progress (cancellable, pc);
-			camel_junk_plugin_report_notjunk (csp, message);
+			success = camel_junk_filter_learn_not_junk (
+				junk_filter, message, cancellable, error);
 			g_object_unref (message);
+
+			synchronize |= success;
 		}
 
 		camel_operation_pop_message (cancellable);
 	}
 
 	if (*error != NULL)
-		return;
+		goto exit;
 
-	if (data->junk || data->notjunk)
-		camel_junk_plugin_commit_reports (csp);
+	if (synchronize)
+		camel_junk_filter_synchronize (
+			junk_filter, cancellable, error);
+
+	if (*error != NULL)
+		goto exit;
 
 	if (data->driver && data->recents) {
 		CamelService *service;
@@ -342,6 +361,10 @@ folder_filter (CamelSession *session,
 
 		camel_filter_driver_flush (data->driver, error);
 	}
+
+exit:
+	if (junk_filter != NULL)
+		g_object_unref (junk_filter);
 }
 
 static gint
@@ -1456,6 +1479,7 @@ folder_changed (CamelFolder *folder,
 	struct _CamelFolderChangeInfoPrivate *p = info->priv;
 	CamelSession *session;
 	CamelFilterDriver *driver = NULL;
+	CamelJunkFilter *junk_filter;
 	GPtrArray *junk = NULL;
 	GPtrArray *notjunk = NULL;
 	GPtrArray *recents = NULL;
@@ -1465,6 +1489,7 @@ folder_changed (CamelFolder *folder,
 
 	parent_store = camel_folder_get_parent_store (folder);
 	session = camel_service_get_session (CAMEL_SERVICE (parent_store));
+	junk_filter = camel_session_get_junk_filter (session);
 
 	camel_folder_lock (folder, CAMEL_FOLDER_CHANGE_LOCK);
 	if (folder->priv->frozen) {
@@ -1475,7 +1500,7 @@ folder_changed (CamelFolder *folder,
 	}
 	camel_folder_unlock (folder, CAMEL_FOLDER_CHANGE_LOCK);
 
-	if (session->junk_plugin && info->uid_changed->len) {
+	if (junk_filter != NULL && info->uid_changed->len) {
 		CamelMessageFlags flags;
 
 		for (i = 0; i < info->uid_changed->len; i++) {
diff --git a/camel/camel-junk-filter.c b/camel/camel-junk-filter.c
new file mode 100644
index 0000000..0805888
--- /dev/null
+++ b/camel/camel-junk-filter.c
@@ -0,0 +1,103 @@
+/*
+ * camel-junk-filter.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "camel-junk-filter.h"
+
+G_DEFINE_INTERFACE (CamelJunkFilter, camel_junk_filter, G_TYPE_OBJECT)
+
+static void
+camel_junk_filter_default_init (CamelJunkFilterInterface *interface)
+{
+}
+
+gboolean
+camel_junk_filter_classify (CamelJunkFilter *junk_filter,
+                            CamelMimeMessage *message,
+                            CamelJunkStatus *status,
+                            GCancellable *cancellable,
+                            GError **error)
+{
+	CamelJunkFilterInterface *interface;
+
+	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);
+}
+
+gboolean
+camel_junk_filter_learn_junk (CamelJunkFilter *junk_filter,
+                              CamelMimeMessage *message,
+                              GCancellable *cancellable,
+                              GError **error)
+{
+	CamelJunkFilterInterface *interface;
+
+	g_return_val_if_fail (CAMEL_IS_JUNK_FILTER (junk_filter), FALSE);
+	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
+
+	interface = CAMEL_JUNK_FILTER_GET_INTERFACE (junk_filter);
+	g_return_val_if_fail (interface->learn_junk != NULL, FALSE);
+
+	return interface->learn_junk (
+		junk_filter, message, cancellable, error);
+}
+
+gboolean
+camel_junk_filter_learn_not_junk (CamelJunkFilter *junk_filter,
+                                  CamelMimeMessage *message,
+                                  GCancellable *cancellable,
+                                  GError **error)
+{
+	CamelJunkFilterInterface *interface;
+
+	g_return_val_if_fail (CAMEL_IS_JUNK_FILTER (junk_filter), FALSE);
+	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
+
+	interface = CAMEL_JUNK_FILTER_GET_INTERFACE (junk_filter);
+	g_return_val_if_fail (interface->learn_not_junk != NULL, FALSE);
+
+	return interface->learn_not_junk (
+		junk_filter, message, cancellable, error);
+}
+
+gboolean
+camel_junk_filter_synchronize (CamelJunkFilter *junk_filter,
+                               GCancellable *cancellable,
+                               GError **error)
+{
+	CamelJunkFilterInterface *interface;
+	gboolean success = TRUE;
+
+	g_return_val_if_fail (CAMEL_IS_JUNK_FILTER (junk_filter), FALSE);
+
+	/* This method is optional. */
+	interface = CAMEL_JUNK_FILTER_GET_INTERFACE (junk_filter);
+
+	if (interface->synchronize != NULL)
+		success = interface->synchronize (
+			junk_filter, cancellable, error);
+
+	return success;
+}
+
diff --git a/camel/camel-junk-filter.h b/camel/camel-junk-filter.h
new file mode 100644
index 0000000..4338f83
--- /dev/null
+++ b/camel/camel-junk-filter.h
@@ -0,0 +1,103 @@
+/*
+ * camel-junk-filter.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
+#error "Only <camel/camel.h> can be included directly."
+#endif
+
+#ifndef CAMEL_JUNK_FILTER_H
+#define CAMEL_JUNK_FILTER_H
+
+#include <camel/camel-mime-message.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_JUNK_FILTER \
+	(camel_junk_filter_get_type ())
+#define CAMEL_JUNK_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), CAMEL_TYPE_JUNK_FILTER, CamelJunkFilter))
+#define CAMEL_JUNK_FILTER_INTERFACE(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), CAMEL_TYPE_JUNK_FILTER, CamelJunkFilterInterface))
+#define CAMEL_IS_JUNK_FILTER(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), CAMEL_TYPE_JUNK_FILTER))
+#define CAMEL_IS_JUNK_FILTER_INTERFACE(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), CAMEL_TYPE_JUNK_FILTER))
+#define CAMEL_JUNK_FILTER_GET_INTERFACE(obj) \
+	(G_TYPE_INSTANCE_GET_INTERFACE \
+	((obj), CAMEL_TYPE_JUNK_FILTER, CamelJunkFilterInterface))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelJunkFilter CamelJunkFilter;
+typedef struct _CamelJunkFilterInterface CamelJunkFilterInterface;
+
+typedef enum {
+	CAMEL_JUNK_STATUS_INCONCLUSIVE,
+	CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK,
+	CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK
+} CamelJunkStatus;
+
+struct _CamelJunkFilterInterface {
+	GTypeInterface parent_interface;
+
+	/* Required Methods */
+	gboolean	(*classify)		(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 CamelJunkStatus *status,
+						 GCancellable *cancellable,
+						 GError **error);
+	gboolean	(*learn_junk)		(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 GCancellable *cancellable,
+						 GError **error);
+	gboolean	(*learn_not_junk)	(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 GCancellable *cancellable,
+						 GError **error);
+
+	/* Optional Methods */
+	gboolean	(*synchronize)		(CamelJunkFilter *junk_filter,
+						 GCancellable *cancellable,
+						 GError **error);
+};
+
+GType		camel_junk_filter_get_type	(void) G_GNUC_CONST;
+gboolean	camel_junk_filter_classify	(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 CamelJunkStatus *status,
+						 GCancellable *cancellable,
+						 GError **error);
+gboolean	camel_junk_filter_learn_junk	(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 GCancellable *cancellable,
+						 GError **error);
+gboolean	camel_junk_filter_learn_not_junk
+						(CamelJunkFilter *junk_filter,
+						 CamelMimeMessage *message,
+						 GCancellable *cancellable,
+						 GError **error);
+gboolean	camel_junk_filter_synchronize	(CamelJunkFilter *junk_filter,
+						 GCancellable *cancellable,
+						 GError **error);
+
+G_END_DECLS
+
+#endif /* CAMEL_JUNK_FILTER_H */
diff --git a/camel/camel-session.c b/camel/camel-session.c
index d09a93d..cea1ec6 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -66,6 +66,7 @@ struct _CamelSessionPrivate {
 
 	GHashTable *services;
 	GHashTable *junk_headers;
+	CamelJunkFilter *junk_filter;
 
 	GMainContext *context;
 
@@ -88,6 +89,7 @@ struct _JobData {
 enum {
 	PROP_0,
 	PROP_CHECK_JUNK,
+	PROP_JUNK_FILTER,
 	PROP_NETWORK_AVAILABLE,
 	PROP_ONLINE,
 	PROP_USER_DATA_DIR,
@@ -204,6 +206,12 @@ session_set_property (GObject *object,
 				g_value_get_boolean (value));
 			return;
 
+		case PROP_JUNK_FILTER:
+			camel_session_set_junk_filter (
+				CAMEL_SESSION (object),
+				g_value_get_object (value));
+			return;
+
 		case PROP_NETWORK_AVAILABLE:
 			camel_session_set_network_available (
 				CAMEL_SESSION (object),
@@ -239,6 +247,12 @@ session_get_property (GObject *object,
 				CAMEL_SESSION (object)));
 			return;
 
+		case PROP_JUNK_FILTER:
+			g_value_set_object (
+				value, camel_session_get_junk_filter (
+				CAMEL_SESSION (object)));
+			return;
+
 		case PROP_NETWORK_AVAILABLE:
 			g_value_set_boolean (
 				value, camel_session_get_network_available (
@@ -270,6 +284,11 @@ session_dispose (GObject *object)
 
 	g_hash_table_remove_all (priv->services);
 
+	if (priv->junk_filter != NULL) {
+		g_object_unref (priv->junk_filter);
+		priv->junk_filter = NULL;
+	}
+
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (camel_session_parent_class)->dispose (object);
 }
@@ -400,6 +419,17 @@ camel_session_class_init (CamelSessionClass *class)
 
 	g_object_class_install_property (
 		object_class,
+		PROP_JUNK_FILTER,
+		g_param_spec_object (
+			"junk-filter",
+			"Junk Filter",
+			"Classifies messages as junk or not junk",
+			CAMEL_TYPE_JUNK_FILTER,
+			G_PARAM_READWRITE |
+			G_PARAM_STATIC_STRINGS));
+
+	g_object_class_install_property (
+		object_class,
 		PROP_NETWORK_AVAILABLE,
 		g_param_spec_boolean (
 			"network-available",
@@ -920,6 +950,62 @@ camel_session_get_filter_driver (CamelSession *session,
 }
 
 /**
+ * camel_session_get_junk_filter:
+ * @session: a #CamelSession
+ *
+ * Returns the #CamelJunkFilter instance used to classify messages as
+ * junk or not junk during filtering.
+ *
+ * Note that #CamelJunkFilter itself is just an interface.  The application
+ * must implement the interface and install a #CamelJunkFilter instance for
+ * junk filtering to take place.
+ *
+ * Returns: a #CamelJunkFilter, or %NULL
+ *
+ * Since: 3.2
+ **/
+CamelJunkFilter *
+camel_session_get_junk_filter (CamelSession *session)
+{
+	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+
+	return session->priv->junk_filter;
+}
+
+/**
+ * camel_session_set_junk_filter:
+ * @session: a #CamelSession
+ * @junk_filer: a #CamelJunkFilter, or %NULL
+ *
+ * Installs the #CamelJunkFilter instance used to classify messages as
+ * junk or not junk during filtering.
+ *
+ * Note that #CamelJunkFilter itself is just an interface.  The application
+ * must implement the interface and install a #CamelJunkFilter instance for
+ * junk filtering to take place.
+ *
+ * Since: 3.2
+ **/
+void
+camel_session_set_junk_filter (CamelSession *session,
+                               CamelJunkFilter *junk_filter)
+{
+	g_return_if_fail (CAMEL_IS_SESSION (session));
+
+	if (junk_filter != NULL) {
+		g_return_if_fail (CAMEL_IS_JUNK_FILTER (junk_filter));
+		g_object_ref (junk_filter);
+	}
+
+	if (session->priv->junk_filter != NULL)
+		g_object_unref (session->priv->junk_filter);
+
+	session->priv->junk_filter = junk_filter;
+
+	g_object_notify (G_OBJECT (session), "junk-filter");
+}
+
+/**
  * camel_session_submit_job:
  * @session: a #CamelSession
  * @callback: a #CamelSessionCallback
diff --git a/camel/camel-session.h b/camel/camel-session.h
index 0018adf..071a3c5 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -31,7 +31,7 @@
 #define CAMEL_SESSION_H
 
 #include <camel/camel-filter-driver.h>
-#include <camel/camel-junk-plugin.h>
+#include <camel/camel-junk-filter.h>
 #include <camel/camel-msgport.h>
 #include <camel/camel-provider.h>
 #include <camel/camel-service.h>
@@ -87,8 +87,6 @@ typedef enum {
 struct _CamelSession {
 	CamelObject parent;
 	CamelSessionPrivate *priv;
-
-	CamelJunkPlugin *junk_plugin;
 };
 
 /**
@@ -196,6 +194,10 @@ CamelFilterDriver *
 		camel_session_get_filter_driver	(CamelSession *session,
 						 const gchar *type,
 						 GError **error);
+CamelJunkFilter *
+		camel_session_get_junk_filter	(CamelSession *session);
+void		camel_session_set_junk_filter	(CamelSession *session,
+						 CamelJunkFilter *junk_filter);
 gboolean	camel_session_get_check_junk	(CamelSession *session);
 void		camel_session_set_check_junk	(CamelSession *session,
 						 gboolean check_junk);
diff --git a/camel/camel.h b/camel/camel.h
index 9119bdc..903ede9 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -51,7 +51,7 @@
 #include <camel/camel-iconv.h>
 #include <camel/camel-index.h>
 #include <camel/camel-internet-address.h>
-#include <camel/camel-junk-plugin.h>
+#include <camel/camel-junk-filter.h>
 #include <camel/camel-list-utils.h>
 #include <camel/camel-lock.h>
 #include <camel/camel-lock-client.h>
diff --git a/docs/reference/camel/camel-docs.sgml b/docs/reference/camel/camel-docs.sgml
index 24a88f9..e42ab83 100644
--- a/docs/reference/camel/camel-docs.sgml
+++ b/docs/reference/camel/camel-docs.sgml
@@ -100,6 +100,7 @@
       <title>Filters</title>
       <xi:include href="xml/camel-filter-driver.xml"/>
       <xi:include href="xml/camel-filter-search.xml"/>
+      <xi:include href="xml/camel-junk-filter.xml"/>
     </chapter>
 
     <chapter id="Folders">
@@ -172,7 +173,6 @@
       <xi:include href="xml/camel-charset-map.xml"/>
       <xi:include href="xml/camel-file-utils.xml"/>
       <xi:include href="xml/camel-iconv.xml"/>
-      <xi:include href="xml/camel-junk-plugin.xml"/>
       <xi:include href="xml/camel-list-utils.xml"/>
       <xi:include href="xml/camel-lock.xml"/>
       <xi:include href="xml/camel-lock-client.xml"/>
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 8faf5ce..4569e4d 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -840,6 +840,27 @@ camel_internet_address_get_type
 </SECTION>
 
 <SECTION>
+<FILE>camel-junk-filter</FILE>
+<TITLE>CamelJunkFilter</TITLE>
+CamelJunkFilter
+CamelJunkStatus
+camel_junk_filter_classify
+camel_junk_filter_learn_junk
+camel_junk_filter_learn_not_junk
+camel_junk_filter_synchronize
+<SUBSECTION Standard>
+CAMEL_JUNK_FILTER
+CAMEL_IS_JUNK_FILTER
+CAMEL_TYPE_JUNK_FILTER
+CAMEL_JUNK_FILTER_INTERFACE
+CAMEL_IS_JUNK_FILTER_INTERFACE
+CAMEL_JUNK_FILTER_GET_INTERFACE
+CamelJunkFilterInterface
+<SUBSECTION Private>
+camel_junk_filter_get_type
+</SECTION>
+
+<SECTION>
 <FILE>camel-medium</FILE>
 <TITLE>CamelMedium</TITLE>
 CamelMedium
@@ -1927,6 +1948,8 @@ camel_session_set_online
 camel_session_get_filter_driver
 camel_session_get_check_junk
 camel_session_set_check_junk
+camel_session_get_junk_filter
+camel_session_set_junk_filter
 CamelSessionCallback
 camel_session_submit_job
 camel_session_get_network_available
@@ -2609,18 +2632,6 @@ camel_iconv_close
 </SECTION>
 
 <SECTION>
-<FILE>camel-junk-plugin</FILE>
-CAMEL_JUNK_PLUGIN
-CamelJunkPlugin
-camel_junk_plugin_get_name
-camel_junk_plugin_check_junk
-camel_junk_plugin_report_junk
-camel_junk_plugin_report_notjunk
-camel_junk_plugin_commit_reports
-camel_junk_plugin_init
-</SECTION>
-
-<SECTION>
 <FILE>camel-list-utils</FILE>
 CamelDList
 CamelDListNode
diff --git a/docs/reference/camel/camel.types b/docs/reference/camel/camel.types
index e7ee97b..e1f2054 100644
--- a/docs/reference/camel/camel.types
+++ b/docs/reference/camel/camel.types
@@ -21,6 +21,7 @@ camel_index_cursor_get_type
 camel_index_name_get_type
 camel_index_get_type
 camel_internet_address_get_type
+camel_junk_filter_get_type
 camel_medium_get_type
 camel_mime_filter_basic_get_type
 camel_mime_filter_bestenc_get_type
diff --git a/docs/reference/camel/tmpl/camel-junk-filter.sgml b/docs/reference/camel/tmpl/camel-junk-filter.sgml
new file mode 100644
index 0000000..24407c6
--- /dev/null
+++ b/docs/reference/camel/tmpl/camel-junk-filter.sgml
@@ -0,0 +1,85 @@
+<!-- ##### SECTION Title ##### -->
+CamelJunkFilter
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### SECTION Image ##### -->
+
+
+<!-- ##### STRUCT CamelJunkFilter ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM CamelJunkStatus ##### -->
+<para>
+
+</para>
+
+ CAMEL_JUNK_STATUS_INCONCLUSIVE: 
+ CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK: 
+ CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK: 
+
+<!-- ##### FUNCTION camel_junk_filter_classify ##### -->
+<para>
+
+</para>
+
+ junk_filter: 
+ message: 
+ status: 
+ cancellable: 
+ error: 
+ Returns: 
+
+
+<!-- ##### FUNCTION camel_junk_filter_learn_junk ##### -->
+<para>
+
+</para>
+
+ junk_filter: 
+ message: 
+ cancellable: 
+ error: 
+ Returns: 
+
+
+<!-- ##### FUNCTION camel_junk_filter_learn_not_junk ##### -->
+<para>
+
+</para>
+
+ junk_filter: 
+ message: 
+ cancellable: 
+ error: 
+ Returns: 
+
+
+<!-- ##### FUNCTION camel_junk_filter_synchronize ##### -->
+<para>
+
+</para>
+
+ junk_filter: 
+ cancellable: 
+ error: 
+ Returns: 
+
+
diff --git a/docs/reference/camel/tmpl/camel-session.sgml b/docs/reference/camel/tmpl/camel-session.sgml
index 59e9a6e..be37afb 100644
--- a/docs/reference/camel/tmpl/camel-session.sgml
+++ b/docs/reference/camel/tmpl/camel-session.sgml
@@ -48,6 +48,11 @@ CamelSession
 
 </para>
 
+<!-- ##### ARG CamelSession:junk-filter ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG CamelSession:network-available ##### -->
 <para>
 
@@ -240,6 +245,24 @@ CamelSession
 @check_junk: 
 
 
+<!-- ##### FUNCTION camel_session_get_junk_filter ##### -->
+<para>
+
+</para>
+
+ session: 
+ Returns: 
+
+
+<!-- ##### FUNCTION camel_session_set_junk_filter ##### -->
+<para>
+
+</para>
+
+ session: 
+ junk_filter: 
+
+
 <!-- ##### USER_FUNCTION CamelSessionCallback ##### -->
 <para>
 



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