Don't reuse the exception if it has already been set.
2001-09-13 Jeffrey Stedfast <fejj@ximian.com> * camel-filter-driver.c (camel_filter_driver_filter_folder): Don't reuse the exception if it has already been set. (camel_filter_driver_filter_message): Same here. Also use the new return value from camel_filter_search_match(). * camel-filter-search.c (camel_filter_search_match): Return an integer (matched, no-match, or error). svn path=/trunk/; revision=12819
This commit is contained in:
committed by
Jeffrey Stedfast
parent
c109102df3
commit
0676d2890e
@ -1,5 +1,13 @@
|
||||
2001-09-13 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* camel-filter-driver.c (camel_filter_driver_filter_folder): Don't
|
||||
reuse the exception if it has already been set.
|
||||
(camel_filter_driver_filter_message): Same here. Also use the new
|
||||
return value from camel_filter_search_match().
|
||||
|
||||
* camel-filter-search.c (camel_filter_search_match): Return an
|
||||
integer (matched, no-match, or error).
|
||||
|
||||
* providers/local/camel-mbox-folder.c (mbox_append_message): Do
|
||||
error-checking based on function return values rather than
|
||||
exceptions as it's possible for them to be NULL.
|
||||
|
||||
@ -812,7 +812,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde
|
||||
|
||||
if (p->defaultfolder) {
|
||||
report_status (driver, CAMEL_FILTER_STATUS_PROGRESS, 100, _("Syncing folder"));
|
||||
camel_folder_sync (p->defaultfolder, FALSE, ex);
|
||||
camel_folder_sync (p->defaultfolder, FALSE, camel_exception_is_set (ex) ? NULL : ex);
|
||||
}
|
||||
|
||||
if (i == uids->len)
|
||||
@ -853,10 +853,11 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
|
||||
CamelException *ex)
|
||||
{
|
||||
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
|
||||
ESExpResult *r;
|
||||
struct _filter_rule *node;
|
||||
gboolean freeinfo = FALSE;
|
||||
gboolean filtered = FALSE;
|
||||
ESExpResult *r;
|
||||
int result;
|
||||
|
||||
if (info == NULL) {
|
||||
struct _header_raw *h = CAMEL_MIME_PART (message)->headers;
|
||||
@ -881,12 +882,15 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
|
||||
camel_mime_message_set_source (message, original_source_url);
|
||||
|
||||
node = (struct _filter_rule *)p->rules.head;
|
||||
while (node->next) {
|
||||
result = CAMEL_SEARCH_NOMATCH;
|
||||
while (node->next && result != CAMEL_SEARCH_ERROR) {
|
||||
d(fprintf (stderr, "applying rule %s\naction %s\n", node->match, node->action));
|
||||
|
||||
if (camel_filter_search_match (p->message, p->info,
|
||||
original_source_url ? original_source_url : source_url,
|
||||
node->match, p->ex)) {
|
||||
result = camel_filter_search_match (p->message, p->info,
|
||||
original_source_url ? original_source_url : source_url,
|
||||
node->match, p->ex);
|
||||
|
||||
if (result == CAMEL_SEARCH_MATCHED) {
|
||||
filtered = TRUE;
|
||||
camel_filter_driver_log (driver, FILTER_LOG_START, node->name);
|
||||
|
||||
@ -925,10 +929,13 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
|
||||
|
||||
uids = g_ptr_array_new ();
|
||||
g_ptr_array_add (uids, (char *) p->uid);
|
||||
camel_folder_copy_messages_to (p->source, uids, p->defaultfolder, p->ex);
|
||||
camel_folder_copy_messages_to (p->source, uids, p->defaultfolder,
|
||||
result == CAMEL_SEARCH_ERROR ? NULL : p->ex);
|
||||
g_ptr_array_free (uids, TRUE);
|
||||
} else
|
||||
camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex);
|
||||
} else {
|
||||
camel_folder_append_message (p->defaultfolder, p->message, p->info,
|
||||
result == CAMEL_SEARCH_ERROR ? NULL : p->ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (freeinfo)
|
||||
|
||||
@ -438,7 +438,18 @@ get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageS
|
||||
return r;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
/**
|
||||
* camel_filter_search_match:
|
||||
* @message:
|
||||
* @info:
|
||||
* @source:
|
||||
* @expression:
|
||||
* @ex:
|
||||
*
|
||||
* Returns one of CAMEL_SEARCH_MATCHED, CAMEL_SEARCH_NOMATCH, or CAMEL_SEARCH_ERROR.
|
||||
**/
|
||||
int
|
||||
camel_filter_search_match (CamelMimeMessage *message, CamelMessageInfo *info,
|
||||
const char *source, const char *expression, CamelException *ex)
|
||||
{
|
||||
@ -478,9 +489,9 @@ camel_filter_search_match (CamelMimeMessage *message, CamelMessageInfo *info,
|
||||
}
|
||||
|
||||
if (result->type == ESEXP_RES_BOOL)
|
||||
retval = result->value.bool;
|
||||
retval = result->value.bool ? CAMEL_SEARCH_MATCHED : CAMEL_SEARCH_NOMATCH;
|
||||
else
|
||||
retval = FALSE;
|
||||
retval = CAMEL_SEARCH_NOMATCH;
|
||||
|
||||
e_sexp_result_free (sexp, result);
|
||||
e_sexp_unref (sexp);
|
||||
@ -489,5 +500,5 @@ camel_filter_search_match (CamelMimeMessage *message, CamelMessageInfo *info,
|
||||
|
||||
error:
|
||||
e_sexp_unref (sexp);
|
||||
return FALSE;
|
||||
return CAMEL_SEARCH_ERROR;
|
||||
}
|
||||
|
||||
@ -34,8 +34,14 @@ extern "C" {
|
||||
#include <camel/camel-mime-message.h>
|
||||
#include <camel/camel-folder-summary.h>
|
||||
|
||||
gboolean camel_filter_search_match(CamelMimeMessage *message, CamelMessageInfo *info,
|
||||
const char *source, const char *expression, CamelException *ex);
|
||||
enum {
|
||||
CAMEL_SEARCH_ERROR = -1,
|
||||
CAMEL_SEARCH_NOMATCH = 0,
|
||||
CAMEL_SEARCH_MATCHED = 1,
|
||||
};
|
||||
|
||||
int camel_filter_search_match (CamelMimeMessage *message, CamelMessageInfo *info,
|
||||
const char *source, const char *expression, CamelException *ex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_NSS
|
||||
#include <nspr.h>
|
||||
#include <prthread.h>
|
||||
|
||||
Reference in New Issue
Block a user