From f24263267d664ee1413a54386f95910c9eb30b3a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 9 Sep 2002 17:45:47 +0000 Subject: Hex decode imap folder names too. (shortcuts_upgrade_xml_file): Don't look 2002-09-09 Jeffrey Stedfast * upgrade-mailer.c (shortcuts_upgrade_uri): Hex decode imap folder names too. (shortcuts_upgrade_xml_file): Don't look for an end quote, instead look for to terminate the uri. svn path=/trunk/; revision=18020 --- mail/ChangeLog | 7 +++++++ mail/upgrade-mailer.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 21d2e336af..6e3e0d629f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2002-09-09 Jeffrey Stedfast + + * upgrade-mailer.c (shortcuts_upgrade_uri): Hex decode imap folder + names too. + (shortcuts_upgrade_xml_file): Don't look for an end quote, instead + look for to terminate the uri. + 2002-09-08 Dan Winship * upgrade-mailer.c (exchange_url_upgrade): Don't modify the URL if diff --git a/mail/upgrade-mailer.c b/mail/upgrade-mailer.c index 15d0ed242e..abcc827891 100644 --- a/mail/upgrade-mailer.c +++ b/mail/upgrade-mailer.c @@ -597,22 +597,24 @@ mailer_upgrade_xml_file (GHashTable *imap_sources, const char *filename) static char * shortcuts_upgrade_uri (GHashTable *accounts, GHashTable *imap_sources, const char *account, const char *folder) { + char *url, *decoded, *new = NULL; struct _storeinfo *si; - char *url, *new, *decoded; int type; + decoded = hex_decode (folder, strlen (folder)); + type = GPOINTER_TO_INT ((si = g_hash_table_lookup (accounts, account))); if (type == 1) { /* exchange */ - 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); + url = g_strdup_printf ("%s/%s", si->base_url, decoded); new = imap_url_upgrade (imap_sources, url); + g_free (decoded); g_free (url); if (new) { @@ -623,13 +625,15 @@ shortcuts_upgrade_uri (GHashTable *accounts, GHashTable *imap_sources, const cha } } + g_free (decoded); + return NULL; } static int shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, const char *filename) { - unsigned char *buffer, *inptr, *start, *folder, *new, *account = NULL; + unsigned char *buffer, *inptr, *start, *folder, *new, *p, *account = NULL; ssize_t nread = 0, nwritten, n; gboolean url_need_upgrade; struct stat st; @@ -681,12 +685,11 @@ shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, cons inptr = strstr (inptr, ">evolution:/"); if (inptr) { inptr += 12; - account = inptr; - while (*inptr && *inptr != '/') - inptr++; + p = account = inptr; + while (*p && *p != '/') + p++; - account = g_strndup (account, inptr - account); - inptr++; + account = g_strndup (account, p - account); url_need_upgrade = GPOINTER_TO_INT (g_hash_table_lookup (accounts, account)); } @@ -732,9 +735,11 @@ shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, cons if (nwritten < len) goto exception; - start = inptr; - while (*start && *start != '"') - start++; + if (!(start = strstr (inptr, ""))) { + start = inptr; + while (*start && *start != '<') + start++; + } folder = g_strndup (inptr, start - inptr); new = shortcuts_upgrade_uri (accounts, imap_sources, account, folder); @@ -765,12 +770,11 @@ shortcuts_upgrade_xml_file (GHashTable *accounts, GHashTable *imap_sources, cons inptr = strstr (inptr, ">evolution:/"); if (inptr) { inptr += 12; - account = inptr; - while (*inptr && *inptr != '/') - inptr++; + p = account = inptr; + while (*p && *p != '/') + p++; - account = g_strndup (account, inptr - account); - inptr++; + account = g_strndup (account, p - account); url_need_upgrade = GPOINTER_TO_INT (g_hash_table_lookup (accounts, account)); } -- cgit v1.2.3