diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-09-10 01:45:47 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-09-10 01:45:47 +0800 |
commit | f24263267d664ee1413a54386f95910c9eb30b3a (patch) | |
tree | e3140f3b9066329617082918ef860c12f3100368 | |
parent | bada7196efdd0f97b376c7b2b0e0a1b84b4b15e3 (diff) | |
download | gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar.gz gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar.bz2 gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar.lz gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar.xz gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.tar.zst gsoc2013-evolution-f24263267d664ee1413a54386f95910c9eb30b3a.zip |
Hex decode imap folder names too. (shortcuts_upgrade_xml_file): Don't look
2002-09-09 Jeffrey Stedfast <fejj@ximian.com>
* 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 </item> to terminate the uri.
svn path=/trunk/; revision=18020
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | 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 <fejj@ximian.com> + + * 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 </item> to terminate the uri. + 2002-09-08 Dan Winship <danw@ximian.com> * 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, "</item>"))) { + 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)); } |