aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/camel-exception-list.def3
-rw-r--r--camel/camel-service.c126
-rw-r--r--camel/camel-service.h14
-rw-r--r--camel/camel-store.c3
-rw-r--r--camel/providers/imap/camel-imap-store.c44
-rw-r--r--camel/providers/nntp/camel-nntp-store.c17
-rw-r--r--camel/providers/pop3/camel-pop3-store.c61
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c23
-rw-r--r--filter/ChangeLog8
-rw-r--r--filter/filter-driver.c26
-rw-r--r--filter/filter-driver.h3
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/mail-callbacks.c8
-rw-r--r--mail/mail-config-gui.c9
-rw-r--r--mail/mail-tools.c64
-rw-r--r--mail/message-thread.h1
16 files changed, 278 insertions, 142 deletions
diff --git a/camel/camel-exception-list.def b/camel/camel-exception-list.def
index cdb95b1a81..e7ecd50ad5 100644
--- a/camel/camel-exception-list.def
+++ b/camel/camel-exception-list.def
@@ -33,4 +33,5 @@ CAMEL_EXCEPTION_SERVICE_NULL = 300,
CAMEL_EXCEPTION_SERVICE_INVALID,
CAMEL_EXCEPTION_SERVICE_URL_INVALID,
CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE
+CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED \ No newline at end of file
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 5631b6caf5..6554bad5cb 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -38,8 +38,8 @@ static CamelObjectClass *parent_class = NULL;
static gboolean service_connect(CamelService *service, CamelException *ex);
static gboolean service_disconnect(CamelService *service, CamelException *ex);
-static gboolean is_connected (CamelService *service);
-static GList * query_auth_types (CamelService *service, CamelException *ex);
+/*static gboolean is_connected (CamelService *service);*/
+static GList * query_auth_types_func (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char * get_name (CamelService *service, gboolean brief);
static gboolean check_url (CamelService *service, CamelException *ex);
@@ -53,8 +53,9 @@ camel_service_class_init (CamelServiceClass *camel_service_class)
/* virtual method definition */
camel_service_class->connect = service_connect;
camel_service_class->disconnect = service_disconnect;
- camel_service_class->is_connected = is_connected;
- camel_service_class->query_auth_types = query_auth_types;
+ /*camel_service_class->is_connected = is_connected;*/
+ camel_service_class->query_auth_types_connected = query_auth_types_func;
+ camel_service_class->query_auth_types_generic = query_auth_types_func;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
}
@@ -64,6 +65,19 @@ camel_service_finalize (CamelObject *object)
{
CamelService *camel_service = CAMEL_SERVICE (object);
+ if (camel_service->connected) {
+ CamelException ex;
+
+ /*g_warning ("camel_service_finalize: finalizing while still connected!");*/
+ camel_exception_init (&ex);
+ CSERV_CLASS (camel_service)->disconnect (camel_service, &ex);
+ if (camel_exception_is_set (&ex)) {
+ g_warning ("camel_service_finalize: silent disconnect failure: %s",
+ camel_exception_get_description(&ex));
+ }
+ camel_exception_clear (&ex);
+ }
+
if (camel_service->url)
camel_url_free (camel_service->url);
if (camel_service->session)
@@ -145,6 +159,9 @@ camel_service_new (CamelType type, CamelSession *session, CamelURL *url,
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
service = CAMEL_SERVICE (camel_object_new (type));
+
+ /*service->connect_level = 0;*/
+
service->url = url;
if (!url->empty && !check_url (service, ex)) {
camel_object_unref (CAMEL_OBJECT (service));
@@ -154,6 +171,17 @@ camel_service_new (CamelType type, CamelSession *session, CamelURL *url,
service->session = session;
camel_object_ref (CAMEL_OBJECT (session));
+ service->connected = FALSE;
+
+ if (!url->empty) {
+ if (CSERV_CLASS (service)->connect (service, ex) == FALSE) {
+ camel_object_unref (CAMEL_OBJECT (service));
+ return NULL;
+ }
+
+ service->connected = TRUE;
+ }
+
return service;
}
@@ -161,8 +189,10 @@ camel_service_new (CamelType type, CamelSession *session, CamelURL *url,
static gboolean
service_connect (CamelService *service, CamelException *ex)
{
- service->connected = TRUE;
- return TRUE;
+ /* Things like the CamelMboxStore can validly
+ * not define a connect function.
+ */
+ return TRUE;
}
/**
@@ -175,21 +205,31 @@ service_connect (CamelService *service, CamelException *ex)
*
* Return value: whether or not the connection succeeded
**/
-gboolean
-camel_service_connect (CamelService *service, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
- g_return_val_if_fail (service->session != NULL, FALSE);
- g_return_val_if_fail (service->url != NULL, FALSE);
-
- return CSERV_CLASS (service)->connect (service, ex);
-}
-
+/**
+ *gboolean
+ *camel_service_connect (CamelService *service, CamelException *ex)
+ *{
+ * g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
+ * g_return_val_if_fail (service->session != NULL, FALSE);
+ * g_return_val_if_fail (service->url != NULL, FALSE);
+ *
+ * if (service->connect_level > 0) {
+ * service->connect_level++;
+ * return TRUE;
+ * }
+ *
+ * return CSERV_CLASS (service)->connect (service, ex);
+ *}
+ **/
static gboolean
service_disconnect (CamelService *service, CamelException *ex)
{
- service->connected = FALSE;
+ /*service->connect_level--;*/
+
+ /* We let people get away with not having a disconnect
+ * function -- CamelMboxStore, for example.
+ */
return TRUE;
}
@@ -204,19 +244,27 @@ service_disconnect (CamelService *service, CamelException *ex)
* Return value: whether or not the disconnection succeeded without
* errors. (Consult @ex if %FALSE.)
**/
-gboolean
-camel_service_disconnect (CamelService *service, CamelException *ex)
-{
- return CSERV_CLASS (service)->disconnect (service, ex);
-}
-
-
-static gboolean
-is_connected (CamelService *service)
-{
- return service->connected;
-}
+/**
+ *gboolean
+ *camel_service_disconnect (CamelService *service, CamelException *ex)
+ *{
+ * if (service->connect_level < 1) {
+ * camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
+ * "Trying to disconnect from a service that isn't connected");
+ * return FALSE;
+ * }
+ *
+ * return CSERV_CLASS (service)->disconnect (service, ex);
+ *}
+ **/
+/**
+ *static gboolean
+ *is_connected (CamelService *service)
+ *{
+ * return (service->connect_level > 0);
+ *}
+ **/
/**
* camel_service_is_connected:
@@ -224,12 +272,13 @@ is_connected (CamelService *service)
*
* Return value: whether or not the service is connected
**/
-gboolean
-camel_service_is_connected (CamelService *service)
-{
- return CSERV_CLASS (service)->is_connected (service);
-}
-
+/**
+ *gboolean
+ *camel_service_is_connected (CamelService *service)
+ *{
+ * return CSERV_CLASS (service)->is_connected (service);
+ *}
+ **/
/**
* camel_service_get_url:
@@ -294,7 +343,7 @@ camel_service_get_session (CamelService *service)
GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_func (CamelService *service, CamelException *ex)
{
return NULL;
}
@@ -321,7 +370,10 @@ query_auth_types (CamelService *service, CamelException *ex)
GList *
camel_service_query_auth_types (CamelService *service, CamelException *ex)
{
- return CSERV_CLASS (service)->query_auth_types (service, ex);
+ if (service->connected)
+ return CSERV_CLASS (service)->query_auth_types_connected (service, ex);
+ else
+ return CSERV_CLASS (service)->query_auth_types_generic (service, ex);
}
diff --git a/camel/camel-service.h b/camel/camel-service.h
index 50f0c2d4b4..3558d5a72b 100644
--- a/camel/camel-service.h
+++ b/camel/camel-service.h
@@ -62,10 +62,12 @@ typedef struct {
gboolean (*disconnect) (CamelService *service,
CamelException *ex);
- gboolean (*is_connected) (CamelService *service);
+ /*gboolean (*is_connected) (CamelService *service);*/
- GList * (*query_auth_types) (CamelService *service,
- CamelException *ex);
+ GList * (*query_auth_types_connected) (CamelService *service,
+ CamelException *ex);
+ GList * (*query_auth_types_generic) (CamelService *service,
+ CamelException *ex);
void (*free_auth_types) (CamelService *service,
GList *authtypes);
@@ -110,12 +112,6 @@ CamelService * camel_service_new (CamelType type,
CamelURL *url,
CamelException *ex);
-gboolean camel_service_connect (CamelService *service,
- CamelException *ex);
-gboolean camel_service_disconnect (CamelService *service,
- CamelException *ex);
-gboolean camel_service_is_connected (CamelService *service);
-
char * camel_service_get_url (CamelService *service);
char * camel_service_get_name (CamelService *service,
gboolean brief);
diff --git a/camel/camel-store.c b/camel/camel-store.c
index dd2d5e41a0..a036d52694 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -268,9 +268,6 @@ camel_store_get_folder (CamelStore *store, const char *folder_name,
char *name;
CamelFolder *folder = NULL;
- if (!camel_service_is_connected (CAMEL_SERVICE (store)))
- camel_service_connect (CAMEL_SERVICE (store), ex);
-
name = CS_CLASS (store)->get_folder_name (store, folder_name, ex);
if (name) {
folder = get_folder_internal (store, name, create, ex);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 0a2be4f326..f7662ade84 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -60,7 +60,8 @@ static void finalize (CamelObject *object);
static gboolean imap_create (CamelFolder *folder, CamelException *ex);
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create,
@@ -84,7 +85,8 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
/* virtual method overload */
camel_service_class->connect = imap_connect;
camel_service_class->disconnect = imap_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -129,11 +131,14 @@ camel_imap_store_get_type (void)
static void
finalize (CamelObject *object)
{
- CamelException ex;
-
- camel_exception_init (&ex);
- imap_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /* Done for us now */
+ /*
+ *CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *imap_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
}
static CamelServiceAuthType password_authtype = {
@@ -178,17 +183,18 @@ try_connect (CamelService *service, CamelException *ex)
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
{
+#if 0
GList *ret = NULL;
gboolean passwd = TRUE;
-#if 0
+
if (service->url) {
passwd = try_connect (service, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
return NULL;
}
-#endif
+
if (passwd)
ret = g_list_append (ret, &password_authtype);
@@ -200,6 +206,16 @@ query_auth_types (CamelService *service, CamelException *ex)
}
return ret;
+#else
+ g_warning ("imap::query_auth_types_connected: not implemented. Defaulting.");
+ return query_auth_types_generic (service, ex);
+#endif
+}
+
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
+{
+ return g_list_append (NULL, &password_authtype);
}
static void
@@ -408,9 +424,11 @@ imap_disconnect (CamelService *service, CamelException *ex)
char *result;
int status;
- if (!service->connected)
- return TRUE;
-
+
+ /*if (!service->connected)
+ * return TRUE;
+ */
+
/* send the logout command */
status = camel_imap_command_extended (CAMEL_IMAP_STORE (service), NULL, &result, "LOGOUT");
if (status != CAMEL_IMAP_OK) {
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 74952015a4..c412c0f6a3 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -123,8 +123,9 @@ nntp_store_disconnect (CamelService *service, CamelException *ex)
{
CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
- if (!service->connected)
- return TRUE;
+ /*if (!service->connected)
+ * return TRUE;
+ */
camel_nntp_command (store, NULL, "QUIT");
@@ -188,11 +189,13 @@ nntp_store_get_folder_name (CamelStore *store, const char *folder_name,
static void
finalize (CamelObject *object)
{
- CamelException ex;
-
- camel_exception_init (&ex);
- nntp_store_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /* Done for us now */
+ /*CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *nntp_store_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
}
static void
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 78d7d106e5..c140ffd57a 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -62,7 +62,8 @@ static void finalize (CamelObject *object);
static gboolean pop3_connect (CamelService *service, CamelException *ex);
static gboolean pop3_disconnect (CamelService *service, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
@@ -88,7 +89,8 @@ camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class)
/* virtual method overload */
camel_service_class->connect = pop3_connect;
camel_service_class->disconnect = pop3_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -129,11 +131,12 @@ static void
finalize (CamelObject *object)
{
CamelPop3Store *pop3_store = CAMEL_POP3_STORE (object);
- CamelException ex;
+ /*CamelException ex;*/
- camel_exception_init (&ex);
- pop3_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /*camel_exception_init (&ex);
+ *pop3_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
if (pop3_store->apop_timestamp)
g_free (pop3_store->apop_timestamp);
@@ -315,7 +318,7 @@ connect_to_server (CamelService *service, gboolean real, CamelException *ex)
}
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
{
CamelPop3Store *store = CAMEL_POP3_STORE (service);
GList *ret = NULL;
@@ -362,6 +365,20 @@ query_auth_types (CamelService *service, CamelException *ex)
return ret;
}
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
+{
+ GList *ret;
+
+ ret = g_list_append (NULL, &password_authtype);
+ ret = g_list_append (ret, &apop_authtype);
+#ifdef HAVE_KRB4
+ ret = g_list_append (ret, &kpop_authtype);
+#endif
+
+ return ret;
+}
+
static void
free_auth_types (CamelService *service, GList *authtypes)
{
@@ -556,10 +573,12 @@ get_folder (CamelStore *store, const char *folder_name,
{
CamelService *service = CAMEL_SERVICE (store);
- if (!camel_service_is_connected (service)) {
- if (!camel_service_connect (service, ex))
- return NULL;
- }
+ /* if (!camel_service_is_connected (service)) {
+ * if (!camel_service_connect (service, ex))
+ * return NULL;
+ *}
+ */
+
return camel_pop3_folder_new (store, ex);
}
@@ -610,15 +629,17 @@ camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...)
va_list ap;
if (!store->ostream) {
- CamelException ex;
-
- camel_exception_init (&ex);
- if (!camel_service_connect (CAMEL_SERVICE (store), &ex)) {
- if (ret)
- *ret = g_strdup (camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return CAMEL_POP3_FAIL;
- }
+ /*CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *if (!camel_service_connect (CAMEL_SERVICE (store), &ex)) {
+ * if (ret)
+ * *ret = g_strdup (camel_exception_get_description (&ex));
+ * camel_exception_clear (&ex);
+ */
+
+ return CAMEL_POP3_FAIL;
+ /*}*/
}
va_start (ap, fmt);
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 0486e4da75..19668a30fa 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -61,7 +61,8 @@ static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList
static gboolean smtp_connect (CamelService *service, CamelException *ex);
static gboolean smtp_disconnect (CamelService *service, CamelException *ex);
static GList *esmtp_get_authtypes(gchar *buffer);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
static gchar *smtp_get_email_addr_from_text (gchar *text);
@@ -88,7 +89,8 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c
/* virtual method overload */
camel_service_class->connect = smtp_connect;
camel_service_class->disconnect = smtp_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -224,8 +226,9 @@ smtp_disconnect (CamelService *service, CamelException *ex)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
- if (!service->connected)
- return TRUE;
+ /*if (!service->connected)
+ * return TRUE;
+ */
/* send the QUIT command to the SMTP server */
smtp_quit(transport, ex);
@@ -290,7 +293,17 @@ static CamelServiceAuthType cram_md5_authtype = {
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
+{
+ /* FIXME: Re-enable this when auth types are actually
+ * implemented.
+ */
+
+ return NULL;
+}
+
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
{
/* FIXME: Re-enable this when auth types are actually
* implemented.
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 39ff8bf6f7..98816b6bbe 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,11 @@
+2000-08-18 Peter Williams <peterw@helixcode.com>
+
+ * filter-driver.c (do_filter_mail): Unlink a new parameter, path_to_unlink,
+ if it is empty once the mail is filtered. Fixes a race in
+ mail_tool_filter_contents_into.
+
+ * filter-driver.h: Update the prototype.
+
2000-08-14 Ettore Perazzoli <ettore@helixcode.com>
* vfolder-editor.c (rule_add): Add translation marks and use stock
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
index e3e1c7df5e..5cedee6e85 100644
--- a/filter/filter-driver.c
+++ b/filter/filter-driver.c
@@ -48,6 +48,7 @@ typedef struct {
gboolean self_destruct;
gpointer unhook_func;
gpointer unhook_data;
+ gchar *path_to_unlink;
} filter_mail_input_t;
/* mail-thread filter functions */
@@ -418,7 +419,8 @@ static const mail_operation_spec op_filter_mail =
void
filter_driver_run (FilterDriver *d, CamelFolder *source, CamelFolder *inbox,
enum _filter_source_t sourcetype,
- gboolean self_destruct, gpointer unhook_func, gpointer unhook_data)
+ gboolean self_destruct, gpointer unhook_func, gpointer unhook_data,
+ const char *path_to_unlink)
{
filter_mail_input_t *input;
@@ -430,6 +432,7 @@ filter_driver_run (FilterDriver *d, CamelFolder *source, CamelFolder *inbox,
input->self_destruct = self_destruct;
input->unhook_func = unhook_func;
input->unhook_data = unhook_data;
+ input->path_to_unlink = g_strdup (path_to_unlink);
mail_operation_queue (&op_filter_mail, input, TRUE);
}
@@ -618,9 +621,25 @@ do_filter_mail (gpointer in_data, gpointer op_data, CamelException *ex)
close_folders (d);
g_hash_table_destroy (p->folders);
mail_tool_camel_lock_up ();
- camel_folder_sync (p->source, TRUE, ex);
+ camel_folder_sync (source, TRUE, ex);
+ if (inbox != source)
+ camel_folder_sync (inbox, FALSE, ex);
camel_folder_thaw (inbox);
mail_tool_camel_lock_down ();
+
+ if (input->path_to_unlink) {
+ struct stat sb;
+
+ if (stat (input->path_to_unlink, &sb) < 0) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Couldn't stat(2) movemail folder %s"),
+ input->path_to_unlink);
+ return;
+ }
+
+ if (sb.st_size == 0)
+ unlink (input->path_to_unlink);
+ }
}
static void
@@ -631,6 +650,9 @@ cleanup_filter_mail (gpointer in_data, gpointer op_data, CamelException *ex)
camel_object_unref (CAMEL_OBJECT (input->source));
camel_object_unref (CAMEL_OBJECT (input->inbox));
+ if (input->path_to_unlink)
+ g_free (input->path_to_unlink);
+
if (input->self_destruct)
gtk_object_unref (GTK_OBJECT (input->driver));
}
diff --git a/filter/filter-driver.h b/filter/filter-driver.h
index 1ef62b7118..984780b927 100644
--- a/filter/filter-driver.h
+++ b/filter/filter-driver.h
@@ -57,7 +57,8 @@ FilterDriver *filter_driver_new (FilterContext *ctx, FilterGetFolderFunc fe
/* apply rules to a folder, unmatched messages goto inbox, if not NULL */
void filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox,
enum _filter_source_t sourcetype,
- gboolean self_destruct, gpointer unhook_func, gpointer unhook_data);
+ gboolean self_destruct, gpointer unhook_func, gpointer unhook_data,
+ const char *path_to_unlink);
#if 0
/* generate the search query/action string for a filter option */
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ff02ff09cd..7782416393 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -9,6 +9,16 @@
* folder-browser.c: (fb_resize_cb) Added function to monitor resize
of the e_paned in the main view.
+2000-08-18 Peter Williams <peterw@helixcode.com>
+
+ * mail-tools.c (mail_tool_filter_contents_into): Fix a race. filter_driver_run is an
+ async operation so it won't even be started by the time we sync the folders and check
+ for the movemailbox to be emtpy. Thus the empty check for the movemail would fail
+ 99% of the time.
+
+ * mail-callbacks.c (run_filter_ondemand): Pass he new argument to the ever-mushrooming
+ filter_driver_run.
+
2000-08-17 Peter Williams <peterw@helixcode.com>
* folder-browser-factory.c (control_activate): Fix menu item names.
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 33b44c1c6c..2739c40c93 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -136,9 +136,9 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO,
NULL);
- GDK_THREADS_ENTER ();
+ /*GDK_THREADS_ENTER ();*/
button = gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
- GDK_THREADS_LEAVE ();
+ /*GDK_THREADS_LEAVE ();*/
if (button == 0)
return TRUE;
@@ -250,7 +250,7 @@ create_msg_composer (const char *url)
if (id)
sig_file = id->sig;
-
+
if (url != NULL)
composer_widget = e_msg_composer_new_from_url (url);
else
@@ -650,5 +650,5 @@ run_filter_ondemand (BonoboUIHandler *uih, gpointer user_data, const char *path)
NULL);
filter_driver_run (d, oc->fb->folder, oc->fb->folder,
FILTER_SOURCE_DEMAND, TRUE,
- NULL, NULL);
+ NULL, NULL, NULL);
}
diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c
index 955c457e7c..c757c65904 100644
--- a/mail/mail-config-gui.c
+++ b/mail/mail-config-gui.c
@@ -2222,11 +2222,12 @@ static void do_test_service (gpointer in_data, gpointer op_data, CamelException
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
data->success = FALSE;
- } else if (camel_service_connect (service, ex)) {
- camel_service_disconnect (service, ex);
- data->success = TRUE;
+ /*} else if (camel_service_connect (service, ex)) {
+ *camel_service_disconnect (service, ex);
+ *data->success = TRUE;
+ */
} else {
- data->success = FALSE;
+ data->success = TRUE;
}
camel_object_unref (CAMEL_OBJECT (service));
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 2d10411f91..97bc4259af 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -101,12 +101,13 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
return NULL;
}
- camel_service_connect (CAMEL_SERVICE (store), ex);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (store));
- mail_tool_camel_lock_down();
- return NULL;
- }
+ /*camel_service_connect (CAMEL_SERVICE (store), ex);
+ *if (camel_exception_is_set (ex)) {
+ * camel_object_unref (CAMEL_OBJECT (store));
+ * mail_tool_camel_lock_down();
+ * return NULL;
+ *}
+ */
folder = camel_store_get_folder (store, name, create, ex);
camel_object_unref (CAMEL_OBJECT (store));
@@ -392,14 +393,16 @@ mail_tool_send_via_transport (CamelTransport *transport, CamelMedium *medium, Ca
{
mail_tool_camel_lock_up();
- camel_service_connect (CAMEL_SERVICE (transport), ex);
+ /*camel_service_connect (CAMEL_SERVICE (transport), ex);*/
+
if (camel_exception_is_set (ex))
goto cleanup;
camel_transport_send (transport, medium, ex);
- camel_service_disconnect (CAMEL_SERVICE (transport),
- camel_exception_is_set (ex) ? NULL : ex);
+ /*camel_service_disconnect (CAMEL_SERVICE (transport),
+ *camel_exception_is_set (ex) ? NULL : ex);*/
+
cleanup:
mail_tool_camel_lock_down();
}
@@ -503,6 +506,7 @@ mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest,
gchar *systemrules;
FilterContext *fc;
FilterDriver *filter;
+ gchar *unlink;
userrules = g_strdup_printf ("%s/filters.xml", evolution_dir);
systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR);
@@ -517,29 +521,16 @@ mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest,
camel_object_hook_event (CAMEL_OBJECT (dest), "folder_changed",
hook_func, hook_data);
- filter_driver_run (filter, source, dest, FILTER_SOURCE_INCOMING,
- TRUE, hook_func, hook_data);
-
- camel_folder_sync (CAMEL_FOLDER (source), TRUE, ex);
- camel_folder_sync (CAMEL_FOLDER (dest), TRUE, ex);
-
- if (delete_source) {
- gchar *path = mail_tool_get_local_movemail_path();
- struct stat sb;
-
- if (stat (path, &sb) < 0) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Couldn't stat(2) movemail folder %s"),
- path);
- g_free (path);
- return;
- }
+ if (delete_source)
+ unlink = mail_tool_get_local_movemail_path();
+ else
+ unlink = NULL;
- if (sb.st_size == 0)
- unlink (path);
+ filter_driver_run (filter, source, dest, FILTER_SOURCE_INCOMING,
+ TRUE, hook_func, hook_data, unlink);
- g_free (path);
- }
+ if (unlink)
+ g_free (unlink);
}
CamelFolder *
@@ -556,12 +547,13 @@ mail_tool_get_root_of_store (const char *source_uri, CamelException *ex)
return NULL;
}
- camel_service_connect (CAMEL_SERVICE (store), ex);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (store));
- mail_tool_camel_lock_down();
- return NULL;
- }
+ /*camel_service_connect (CAMEL_SERVICE (store), ex);
+ *if (camel_exception_is_set (ex)) {
+ * camel_object_unref (CAMEL_OBJECT (store));
+ * mail_tool_camel_lock_down();
+ * return NULL;
+ *}
+ */
folder = camel_store_get_root_folder (store, ex);
camel_object_unref (CAMEL_OBJECT (store));
diff --git a/mail/message-thread.h b/mail/message-thread.h
index 5c4be91ade..daff7451d4 100644
--- a/mail/message-thread.h
+++ b/mail/message-thread.h
@@ -5,6 +5,7 @@
#include "message-list.h"
struct _container {
+ /* Next must be the first member */
struct _container *next,
*parent,
*child;