From 71259e72512beb2a18c23e288c2f8ad4721f7c40 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 16 Oct 2001 22:06:01 +0000 Subject: Lets put the UID cache in ~/evolution/mail/pop3 as this makes more sense 2001-10-16 Jeffrey Stedfast * mail-ops.c (uid_cachename_hack): Lets put the UID cache in ~/evolution/mail/pop3 as this makes more sense than ~/mail/config does. Perform checking to see what flavor cache-path the user is on and compensate. svn path=/trunk/; revision=13708 --- mail/mail-ops.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'mail/mail-ops.c') diff --git a/mail/mail-ops.c b/mail/mail-ops.c index dd365b3fb5..e0d9836987 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -209,7 +209,8 @@ static char * uid_cachename_hack (CamelStore *store) { CamelURL *url = CAMEL_SERVICE (store)->url; - char *encoded_url, *filename; + char *encoded_url, *filename, *old_location; + struct stat st; encoded_url = g_strdup_printf ("pop://%s%s%s@%s/", url->user, url->authmech ? ";auth=" : "", @@ -217,7 +218,26 @@ uid_cachename_hack (CamelStore *store) url->host); e_filename_make_safe (encoded_url); - filename = g_strdup_printf ("%s/config/cache-%s", evolution_dir, encoded_url); + filename = g_strdup_printf ("%s/mail/pop3/cache-%s", evolution_dir, encoded_url); + + /* lame hack, but we can't expect user's to actually migrate + their cache files - brain power requirements are too + high. */ + if (stat (filename, &st) == -1) { + /* This is either the first time the user has checked + mail with this POP provider or else their cache + file is in the old location... */ + old_location = g_strdup_printf ("%s/config/cache-%s", evolution_dir, encoded_url); + if (stat (old_location, &st) == -1) { + /* old location doesn't exist either so use the new location */ + g_free (old_location); + } else { + /* old location exists, so I guess we use the old cache file location */ + g_free (filename); + filename = old_location; + } + } + g_free (encoded_url); return filename; -- cgit v1.2.3