From 13527d90b5c43f691d1123004d2c6bb5ca18c3a8 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 9 Sep 2002 00:43:59 +0000 Subject: Don't modify the URL if the path doesn't start with "exchange". (Means * upgrade-mailer.c (exchange_url_upgrade): Don't modify the URL if the path doesn't start with "exchange". (Means it's already a 1.2 URL.) (shortcuts_upgrade_uri): Need to hex-decode exchange URLs here too. (shortcuts_upgrade_xml_file): Fix an off-by-one error here (twice) so it actually works instead of always claiming shortcuts.xml doesn't need to be upgraded. (mailer_upgrade): Check the size of the accounts hash rather than imap_sources since we have work to do if the user has an exchange account but no imap accounts. svn path=/trunk/; revision=18018 --- mail/upgrade-mailer.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'mail/upgrade-mailer.c') diff --git a/mail/upgrade-mailer.c b/mail/upgrade-mailer.c index 9ce20522dc..15d0ed242e 100644 --- a/mail/upgrade-mailer.c +++ b/mail/upgrade-mailer.c @@ -365,13 +365,14 @@ exchange_url_upgrade (const char *uri) base_url = get_base_url ("exchange", uri); folder = (unsigned char *) uri + strlen (base_url) + 1; - if (!strncmp (folder, "exchange/", 9)) { - folder += 9; - while (*folder && *folder != '/') - folder++; - if (*folder == '/') - folder++; - } + if (strncmp (folder, "exchange/", 9)) + return g_strdup (uri); + + folder += 9; + while (*folder && *folder != '/') + folder++; + if (*folder == '/') + folder++; folder = hex_decode (folder, strlen (folder)); url = g_strdup_printf ("%s/personal/%s", base_url, folder); @@ -597,13 +598,17 @@ static char * shortcuts_upgrade_uri (GHashTable *accounts, GHashTable *imap_sources, const char *account, const char *folder) { struct _storeinfo *si; - char *url, *new; + char *url, *new, *decoded; int type; type = GPOINTER_TO_INT ((si = g_hash_table_lookup (accounts, account))); if (type == 1) { /* exchange */ - return g_strdup_printf ("personal/%s", folder); + decoded = hex_decode (folder, strlen (folder)); + new = g_strdup_printf ("personal/%s", decoded); + g_free (decoded); + + return new; } else { /* imap */ url = g_strdup_printf ("%s/%s", si->base_url, folder); @@ -673,9 +678,9 @@ shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, cons url_need_upgrade = FALSE; do { g_free (account); - inptr = strstr (inptr, ">evolution:"); + inptr = strstr (inptr, ">evolution:/"); if (inptr) { - inptr += 11; + inptr += 12; account = inptr; while (*inptr && *inptr != '/') inptr++; @@ -757,9 +762,9 @@ shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, cons url_need_upgrade = FALSE; do { g_free (account); - inptr = strstr (inptr, ">evolution:"); + inptr = strstr (inptr, ">evolution:/"); if (inptr) { - inptr += 11; + inptr += 12; account = inptr; while (*inptr && *inptr != '/') inptr++; @@ -894,8 +899,8 @@ mailer_upgrade (Bonobo_ConfigDatabase db) g_free (uri); } - if (g_hash_table_size (imap_sources) == 0) { - /* user doesn't have any imap accounts - nothing to upgrade */ + if (g_hash_table_size (accounts) == 0) { + /* user doesn't have any imap/exchange accounts - nothing to upgrade */ g_hash_table_destroy (imap_sources); return 0; } -- cgit v1.2.3