aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-01-21 12:15:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-01-21 12:15:21 +0800
commite511bc95beadc682485d432312f50d9ae1be7566 (patch)
tree829e4d77569d12a3aa5a23cceac92519fa7dc8c0
parent93bd7f1d38c9a2ce00858c0e35b4dd39ad58e420 (diff)
downloadgsoc2013-evolution-e511bc95beadc682485d432312f50d9ae1be7566.tar.gz
gsoc2013-evolution-e511bc95beadc682485d432312f50d9ae1be7566.tar.zst
gsoc2013-evolution-e511bc95beadc682485d432312f50d9ae1be7566.zip
Added an exception to CamelFilterGetFolderFunc.
2001-01-21 Not Zed <NotZed@Ximian.com> * camel-filter-driver.h: Added an exception to CamelFilterGetFolderFunc. * camel-filter-driver.c (camel_filter_driver_filter_message): Remove source parameter, as it is determined elsewhere now. (camel_filter_driver_filter_folder): Same here. (camel_filter_driver_filter_mbox): And here. (do_move): If we cannot open a folder, quit, rather than ignoring it. (do_copy): Here too. (open_folder): Pass an exception into get_folder callback. (camel_filter_driver_filter_folder): Report that we're syncing, when we are. (camel_filter_driver_filter_mbox): And here too. (close_folder): And here. svn path=/trunk/; revision=7671
-rw-r--r--camel/ChangeLog18
-rw-r--r--camel/camel-filter-driver.c41
-rw-r--r--camel/camel-filter-driver.h8
3 files changed, 48 insertions, 19 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f3b4e4c5d3..fbe07b9cee 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,21 @@
+2001-01-21 Not Zed <NotZed@Ximian.com>
+
+ * camel-filter-driver.h: Added an exception to
+ CamelFilterGetFolderFunc.
+
+ * camel-filter-driver.c (camel_filter_driver_filter_message):
+ Remove source parameter, as it is determined elsewhere now.
+ (camel_filter_driver_filter_folder): Same here.
+ (camel_filter_driver_filter_mbox): And here.
+ (do_move): If we cannot open a folder, quit, rather than ignoring
+ it.
+ (do_copy): Here too.
+ (open_folder): Pass an exception into get_folder callback.
+ (camel_filter_driver_filter_folder): Report that we're syncing,
+ when we are.
+ (camel_filter_driver_filter_mbox): And here too.
+ (close_folder): And here.
+
2001-01-19 Jeffrey Stedfast <fejj@ximian.com>
* camel-filter-driver.c (camel_filter_driver_filter_message): Set
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index fc783c4c08..21055781f7 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -71,6 +71,7 @@ struct _CamelFilterDriverPrivate {
/* run-time data */
GHashTable *folders; /* folders that message has been copied to */
+ int closed; /* close count */
GHashTable *forwards; /* addresses that have been forwarded the message */
gboolean terminated; /* message processing was terminated */
@@ -359,7 +360,7 @@ do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
outbox = open_folder (driver, folder);
if (!outbox)
- continue;
+ break;
p->copied = TRUE;
camel_folder_append_message (outbox, p->message, p->info, p->ex);
@@ -390,7 +391,7 @@ do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
outbox = open_folder (driver, folder);
if (!outbox)
- continue;
+ break;
p->copied = TRUE;
p->deleted = TRUE; /* a 'move' is a copy & delete */
@@ -475,7 +476,7 @@ open_folder (CamelFilterDriver *driver, const char *folder_url)
if (camelfolder)
return camelfolder;
- camelfolder = p->get_folder (driver, folder_url, p->data);
+ camelfolder = p->get_folder (driver, folder_url, p->data, p->ex);
if (camelfolder) {
g_hash_table_insert (p->folders, g_strdup (folder_url), camelfolder);
@@ -492,6 +493,9 @@ close_folder (void *key, void *value, void *data)
CamelFilterDriver *driver = data;
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
+ report_status(driver, FILTER_STATUS_PROGRESS, g_hash_table_size(p->folders) * 100 / p->closed, "Syncing folders");
+ p->closed++;
+
g_free (key);
camel_folder_sync (folder, FALSE, p->ex);
camel_folder_thaw (folder);
@@ -504,6 +508,7 @@ close_folders (CamelFilterDriver *driver)
{
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
+ p->closed = 0;
g_hash_table_foreach (p->folders, close_folder, driver);
g_hash_table_destroy (p->folders);
p->folders = g_hash_table_new (g_str_hash, g_str_equal);
@@ -576,7 +581,7 @@ camel_filter_driver_log (CamelFilterDriver *driver, enum filter_log_t status, co
/* will filter only an mbox - is more efficient as it doesn't need to open the folder through camel directly */
void
-camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, const char *source, CamelException *ex)
+camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, CamelException *ex)
{
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
CamelMimeParser *mp = NULL;
@@ -620,7 +625,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, co
goto fail;
}
- camel_filter_driver_filter_message (driver, msg, NULL, source_url, source, ex);
+ camel_filter_driver_filter_message (driver, msg, NULL, source_url, ex);
camel_object_unref (CAMEL_OBJECT (msg));
if (camel_exception_is_set (ex)) {
report_status (driver, FILTER_STATUS_END, 100, "Failed message %d", i);
@@ -634,11 +639,13 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, co
camel_mime_parser_step (mp, 0, 0);
}
+ if (p->defaultfolder) {
+ report_status(driver, FILTER_STATUS_PROGRESS, 100, "Syncing folder");
+ camel_folder_sync(p->defaultfolder, FALSE, ex);
+ }
+
report_status (driver, FILTER_STATUS_END, 100, "Complete");
- if (p->defaultfolder)
- camel_folder_sync (p->defaultfolder, FALSE, ex);
-
fail:
g_free (source_url);
if (fd != -1)
@@ -649,7 +656,7 @@ fail:
/* will filter a folder */
void
-camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder, const char *source,
+camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder,
GPtrArray *uids, gboolean remove, CamelException *ex)
{
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
@@ -684,7 +691,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde
else
info = NULL;
- camel_filter_driver_filter_message (driver, message, info, source_url, source, ex);
+ camel_filter_driver_filter_message (driver, message, info, source_url, ex);
if (camel_folder_has_summary_capability (folder))
camel_folder_free_message_info (folder, info);
@@ -701,21 +708,25 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde
camel_object_unref (CAMEL_OBJECT (message));
}
- if (i == uids->len)
- report_status (driver, FILTER_STATUS_END, 100, "Complete");
-
if (freeuids)
camel_folder_free_uids (folder, uids);
+
- if (p->defaultfolder)
+ if (p->defaultfolder) {
+ report_status(driver, FILTER_STATUS_PROGRESS, 100, "Syncing folder");
camel_folder_sync (p->defaultfolder, FALSE, ex);
+ }
+
+ if (i == uids->len)
+ report_status (driver, FILTER_STATUS_END, 100, "Complete");
+
g_free (source_url);
}
void
camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source_url, const char *source, CamelException *ex)
+ const char *source_url, CamelException *ex)
{
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
ESExpResult *r;
diff --git a/camel/camel-filter-driver.h b/camel/camel-filter-driver.h
index aba2b587e7..a3ff6ab323 100644
--- a/camel/camel-filter-driver.h
+++ b/camel/camel-filter-driver.h
@@ -55,7 +55,7 @@ enum camel_filter_status_t {
FILTER_STATUS_END, /* end of message */
};
-typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *, const char *uri, void *data);
+typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *, const char *uri, void *data, CamelException *ex);
/* report status */
typedef void (CamelFilterStatusFunc)(CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, void *data);
@@ -71,9 +71,9 @@ void camel_filter_driver_add_rule (CamelFilterDriver *d, const char *name, con
/*void camel_filter_driver_set_global(CamelFilterDriver *, const char *name, const char *value);*/
void camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source_url, const char *source, CamelException *ex);
-void camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, const char *source, CamelException *ex);
-void camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder, const char *source,
+ const char *source_url, CamelException *ex);
+void camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, CamelException *ex);
+void camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder,
GPtrArray *uids, gboolean remove, CamelException *ex);
#if 0