diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-28 06:19:27 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-28 06:19:27 +0800 |
commit | 9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb (patch) | |
tree | ad4f88940c1479874000a4631dd9d7f1a8285936 /mail/mail-ops.c | |
parent | 98a3ac0e6c55a4bcb3c043b916c5df1faff98f7c (diff) | |
download | gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar.gz gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar.bz2 gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar.lz gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar.xz gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.tar.zst gsoc2013-evolution-9deac0edb915ff7c83bd5a26f2bc36b3ea52cffb.zip |
Note: We need a configuration option to specify whether to log filtering
2000-09-27 Jeffrey Stedfast <fejj@helixcode.com>
Note: We need a configuration option to specify whether to log
filtering actions or not.
* mail-ops.c (do_filter_ondemand): Updated to pass a log file
pointer to filter_driver_run.
(do_fetch_mail): Same.
(mail_do_fetch_mail): Fixed a compiler warning.
svn path=/trunk/; revision=5604
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index d7edad424b..cf31506d89 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -127,6 +127,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) FilterDriver *filter; GPtrArray *uids, *new_uids; char *url, *p, *filename; + FILE *logfile; int i; userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); @@ -158,6 +159,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) g_free (url); cache = camel_uid_cache_new (filename); + g_free (filename); if (cache) { /* determine the new uids */ @@ -167,6 +169,14 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) } } + /* FIXME: find out if we want to log or not - config option */ + if (TRUE /* perform_logging */) { + filename = g_strdup_printf ("%s/evolution-filter-log", evolution_dir); + logfile = fopen (filename, "a+"); + g_free (filename); + } else + logfile = NULL; + /* get/filter the new messages */ for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; @@ -188,7 +198,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) } filter_driver_run (filter, message, info, input->destination, - FILTER_SOURCE_INCOMING, ex); + FILTER_SOURCE_INCOMING, logfile, ex); if (free_info) camel_message_info_free (info); @@ -204,6 +214,10 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) camel_object_unref (CAMEL_OBJECT (message)); } + /* close the log file */ + if (logfile) + fclose (logfile); + gtk_object_unref (GTK_OBJECT (filter)); camel_folder_sync (folder, TRUE, ex); @@ -270,7 +284,7 @@ mail_do_fetch_mail (const gchar *source_url, gboolean keep_on_server, g_return_if_fail (source_url != NULL); g_return_if_fail (destination == NULL || - CAMEL_IS_FOLDER (input->destination)); + CAMEL_IS_FOLDER (destination)); input = g_new (fetch_mail_input_t, 1); input->source_url = g_strdup (source_url); @@ -321,6 +335,8 @@ do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) if (camel_folder_get_message_count (input->source) != 0) { FilterDriver *driver; GPtrArray *uids; + char *filename; + FILE *logfile; int i; uids = camel_folder_get_uids (input->source); @@ -329,6 +345,14 @@ do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) driver = filter_driver_new (input->context, mail_tool_filter_get_folder_func, NULL); + /* FIXME: find out if we want to log or not - config option */ + if (TRUE /* perform_logging */) { + filename = g_strdup_printf ("%s/evolution-filter-log", evolution_dir); + logfile = fopen (filename, "a+"); + g_free (filename); + } else + logfile = NULL; + for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; CamelMessageInfo *info; @@ -355,7 +379,7 @@ do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) } filtered = filter_driver_run (driver, message, info, NULL, - FILTER_SOURCE_DEMAND, ex); + FILTER_SOURCE_DEMAND, logfile, ex); if (free_info) camel_message_info_free (info); @@ -373,6 +397,10 @@ do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) camel_object_unref (CAMEL_OBJECT (message)); } + /* close the log file */ + if (logfile) + fclose (logfile); + gtk_object_unref (GTK_OBJECT (driver)); /* FIXME: when we hide deleted msgs, we may want to not expunge? */ |