From 3b2cfae1768902b60d604fa96cd546636077feb1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 25 Sep 2009 02:59:30 -0400 Subject: Trim unused or unnecessary bits from the import framework. --- mail/importers/elm-importer.c | 9 ++---- mail/importers/mail-importer.c | 64 ++---------------------------------------- mail/importers/mail-importer.h | 23 --------------- mail/importers/pine-importer.c | 4 +-- 4 files changed, 7 insertions(+), 93 deletions(-) (limited to 'mail') diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 1c28e2d82d..e6cfa6a862 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -145,7 +145,6 @@ elm_get_rc(EImport *ei, const gchar *name) static gboolean elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) { - EImportTargetHome *s; const gchar *maildir; gchar *elmdir; gboolean mailexists, exists; @@ -153,9 +152,7 @@ elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (target->type != E_IMPORT_TARGET_HOME) return FALSE; - s = (EImportTargetHome *)target; - - elmdir = g_build_filename(s->homedir, ".elm", NULL); + elmdir = g_build_filename(g_get_home_dir (), ".elm", NULL); exists = g_file_test(elmdir, G_FILE_TEST_IS_DIR); g_free(elmdir); if (!exists) @@ -166,7 +163,7 @@ elm_supported(EImport *ei, EImportTarget *target, EImportImporter *im) maildir = "Mail"; if (!g_path_is_absolute(maildir)) - elmdir = g_build_filename(s->homedir, maildir, NULL); + elmdir = g_build_filename(g_get_home_dir (), maildir, NULL); else elmdir = g_strdup (maildir); @@ -198,7 +195,7 @@ elm_import_exec (struct _elm_import_msg *m) maildir = "Mail"; if (!g_path_is_absolute(maildir)) - elmdir = g_build_filename(m->target->homedir, maildir, NULL); + elmdir = g_build_filename(g_get_home_dir (), maildir, NULL); else elmdir = g_strdup(maildir); diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 61726dd37f..6e4573487f 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -54,66 +54,6 @@ #include "mail-importer.h" -/** - * mail_importer_make_local_folder: - * @folderpath: - * - * Check a local folder exists at path @folderpath, and if not, create it. - * - * Return value: The physical uri of the folder, or NULL if the folder did - * not exist and could not be created. - **/ -gchar * -mail_importer_make_local_folder(const gchar *folderpath) -{ - return g_strdup_printf("mbox:/home/notzed/.evolution/mail/local/%s", folderpath); -} - -/** - * mail_importer_add_line: - * importer: A MailImporter structure. - * str: Next line of the mbox. - * finished: TRUE if @str is the last line of the message. - * - * Adds lines to the message until it is finished, and then adds - * the complete message to the folder. - */ -void -mail_importer_add_line (MailImporter *importer, - const gchar *str, - gboolean finished) -{ - CamelMimeMessage *msg; - CamelMessageInfo *info; - CamelException *ex; - - if (importer->mstream == NULL) - importer->mstream = CAMEL_STREAM_MEM (camel_stream_mem_new ()); - - camel_stream_write (CAMEL_STREAM (importer->mstream), str, strlen (str)); - - if (finished == FALSE) - return; - - camel_stream_reset (CAMEL_STREAM (importer->mstream)); - info = camel_message_info_new(NULL); - camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0); - - msg = camel_mime_message_new (); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), - CAMEL_STREAM (importer->mstream)); - - camel_object_unref (importer->mstream); - importer->mstream = NULL; - - ex = camel_exception_new (); - camel_folder_append_message (importer->folder, msg, info, NULL, ex); - camel_object_unref (msg); - - camel_exception_free (ex); - camel_message_info_free(info); -} - struct _import_mbox_msg { MailMsg base; @@ -151,7 +91,7 @@ decode_status(const gchar *status) p = status; while ((*p++)) { - for (i=0;i #include -typedef struct _MailImporter MailImporter; -struct _MailImporter { - CamelFolder *folder; - CamelStreamMem *mstream; - - gboolean frozen; /* Is folder frozen? */ -}; - -struct _MailComponent; - -void mail_importer_init (struct _MailComponent *mc); -void mail_importer_uninit (void); - -void mail_importer_add_line (MailImporter *importer, - const gchar *str, - gboolean finished); -void mail_importer_create_folder (const gchar *parent_path, - const gchar *name, - const gchar *description); - -/* creates a folder at folderpath on the local storage */ -gchar *mail_importer_make_local_folder(const gchar *folderpath); - EImportImporter *mbox_importer_peek(void); EImportImporter *elm_importer_peek(void); diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 84c29b24c5..d00394fa75 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -76,11 +76,11 @@ pine_supported(EImport *ei, EImportTarget *target, EImportImporter *im) s = (EImportTargetHome *)target; - maildir = g_build_filename(s->homedir, "mail", NULL); + maildir = g_build_filename(g_get_home_dir (), "mail", NULL); md_exists = g_file_test(maildir, G_FILE_TEST_IS_DIR); g_free(maildir); - addrfile = g_build_filename(s->homedir, ".addressbook", NULL); + addrfile = g_build_filename(g_get_home_dir (), ".addressbook", NULL); addr_exists = g_file_test(addrfile, G_FILE_TEST_IS_REGULAR); g_free (addrfile); -- cgit v1.2.3