aboutsummaryrefslogtreecommitdiffstats
path: root/mail/upgrade-mailer.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-09-09 08:43:59 +0800
committerDan Winship <danw@src.gnome.org>2002-09-09 08:43:59 +0800
commit13527d90b5c43f691d1123004d2c6bb5ca18c3a8 (patch)
treec4f59ef0f2e92332ef909226fb61539f5cb2c0e3 /mail/upgrade-mailer.c
parent3abb7796bcc037301601780602f7de940d89ef32 (diff)
downloadgsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar.gz
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar.bz2
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar.lz
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar.xz
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.tar.zst
gsoc2013-evolution-13527d90b5c43f691d1123004d2c6bb5ca18c3a8.zip
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
Diffstat (limited to 'mail/upgrade-mailer.c')
-rw-r--r--mail/upgrade-mailer.c35
1 files changed, 20 insertions, 15 deletions
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;
}