aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-utils.c71
2 files changed, 69 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8c46a6e0a8..123419220e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,15 @@
2004-02-23 Jeffrey Stedfast <fejj@ximian.com>
+ Fix for bug #54057
+
+ * em-utils.c (em_utils_folder_is_sent): Use provider->url_equal()
+ rather than camel_store_uri_cmp() since that function did not do
+ anything close to what it claimed to do. Also use
+ em_uri_to_camel() here on the account sent_folder_uri.
+ (em_utils_folder_is_drafts): Same.
+
+2004-02-23 Jeffrey Stedfast <fejj@ximian.com>
+
* em-message-browser.c (emmb_list_message_selected): Protect
against NULL uids.
(emmb_set_message): Same.
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 1ac9aeb50f..dd8aed5444 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2116,6 +2116,28 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part)
return path;
}
+static int
+emu_provider_uri_equal (CamelProvider *provider, const char *uri0, const char *uri1)
+{
+ CamelURL *url0, *url1;
+ int equal;
+
+ if (!(url0 = camel_url_new (uri0, NULL)))
+ return FALSE;
+
+ if (!(url1 = camel_url_new (uri1, NULL))) {
+ camel_url_free (url0);
+ return FALSE;
+ }
+
+ equal = provider->url_equal (url0, url1);
+
+ camel_url_free (url0);
+ camel_url_free (url1);
+
+ return equal;
+}
+
/**
* em_utils_folder_is_drafts:
* @folder: folder
@@ -2128,25 +2150,35 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part)
gboolean
em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
{
+ CamelProvider *provider;
EAccountList *accounts;
EAccount *account;
EIterator *iter;
int is = FALSE;
-
+ char *drafts_uri;
+
if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS))
return TRUE;
if (uri == NULL)
return FALSE;
-
+
+ if (!(provider = ((CamelService *) folder->parent_store)->provider))
+ return FALSE;
+
accounts = mail_config_get_accounts();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
- if (account->drafts_folder_uri &&
- camel_store_uri_cmp(folder->parent_store, account->drafts_folder_uri, uri)) {
- is = TRUE;
- break;
+
+ if (account->drafts_folder_uri) {
+ drafts_uri = em_uri_to_camel (account->drafts_folder_uri);
+ if (emu_provider_uri_equal (provider, drafts_uri, uri)) {
+ g_free (drafts_uri);
+ is = TRUE;
+ break;
+ }
+ g_free (drafts_uri);
}
e_iterator_next(iter);
@@ -2169,25 +2201,38 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
gboolean
em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
{
+ CamelProvider *provider;
EAccountList *accounts;
EAccount *account;
EIterator *iter;
int is = FALSE;
-
+ char *sent_uri;
+
+ printf ("checking if %s is a Sent folder\n", uri);
+
if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))
return TRUE;
if (uri == NULL)
return FALSE;
-
+
+ if (!(provider = ((CamelService *) folder->parent_store)->provider))
+ return FALSE;
+
accounts = mail_config_get_accounts();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
- if (account->sent_folder_uri &&
- camel_store_uri_cmp(folder->parent_store, account->sent_folder_uri, uri)) {
- is = TRUE;
- break;
+
+ if (account->sent_folder_uri) {
+ sent_uri = em_uri_to_camel (account->sent_folder_uri);
+ printf ("\tcomparing %s to %s\n", sent_uri, uri);
+ if (emu_provider_uri_equal (provider, sent_uri, uri)) {
+ g_free (sent_uri);
+ is = TRUE;
+ break;
+ }
+ g_free (sent_uri);
}
e_iterator_next(iter);
@@ -2195,6 +2240,8 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
g_object_unref(iter);
+ printf ("%s\n", is ? "yup" : "nup");
+
return is;
}