diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-04-03 05:16:39 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-04-03 05:16:39 +0800 |
commit | 4590eb4220de4935a55b3cc82cc4b96d2c9a8436 (patch) | |
tree | c4aa902b1e1199119741fe98c2c3471bd6810bc1 /mail | |
parent | 6e087969220063436a3b166bda6efcaceda525eb (diff) | |
download | gsoc2013-evolution-4590eb4220de4935a55b3cc82cc4b96d2c9a8436.tar.gz gsoc2013-evolution-4590eb4220de4935a55b3cc82cc4b96d2c9a8436.tar.zst gsoc2013-evolution-4590eb4220de4935a55b3cc82cc4b96d2c9a8436.zip |
Check for KMail files.
svn path=/trunk/; revision=9103
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/importers/elm-importer.c | 60 |
2 files changed, 71 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 183887dfea..921f31a7cb 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2001-04-02 Iain Holmes <iain@ximian.com> + + * importers/elm-importer.c (elm_can_import): Call is_kmail to check for + KMail files. + (is_kmail): Checks if the given directory is a KMail directory. + +2001-04-02 Iain Holmes <iain@ximian.com> + + * importers/elm-importer.c (elm_can_import): Check for some MH files + to make sure that the dir really is an Elm dir. + 2001-04-02 Dan Winship <danw@ximian.com> * mail-account-gui.c: Add a "provider_type" arg to diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 426120a1b1..1394d0f279 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -189,6 +189,41 @@ elm_import_file (ElmImporter *importer, } static gboolean +is_kmail (const char *maildir) +{ + char *names[5] = + { + "inbox", + "outbox", + "sent-mail", + "trash", + "drafts" + }; + int i; + + for (i = 0; i < 5; i++) { + char *file, *index, *tmp; + + file = g_concat_dir_and_file (maildir, names[i]); + tmp = g_strdup_printf (".%s.index", names[i]); + index = g_concat_dir_and_file (maildir, tmp); + g_free (tmp); + + if (!g_file_exists (file) || + !g_file_exists (index)) { + g_free (index); + g_free (file); + return FALSE; + } + + g_free (index); + g_free (file); + } + + return TRUE; +} + +static gboolean elm_can_import (EvolutionIntelligentImporter *ii, void *closure) { @@ -208,8 +243,33 @@ elm_can_import (EvolutionIntelligentImporter *ii, } gnome_config_pop_prefix (); + /* Elm uses ~/Mail + Alas so does MH and KMail. */ maildir = gnome_util_prepend_user_home ("Mail"); exists = g_file_exists (maildir); + + if (exists) { + char *mh, *mhdir; + + /* Check for some other files to work out what it is. */ + + /* MH? */ + mh = g_concat_dir_and_file (maildir, "context"); + mhdir = g_concat_dir_and_file (maildir, "inbox"); + if (g_file_exists (mh) && + g_file_test (mhdir, G_FILE_TEST_ISDIR)) { + exists = FALSE; /* Probably MH */ + } + + g_free (mh); + g_free (mhdir); + } + + if (exists) { + /* Check for KMail stuff */ + exists = !is_kmail (maildir); + } + g_free (maildir); return exists; |