aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-25 14:59:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-26 22:28:05 +0800
commit3b2cfae1768902b60d604fa96cd546636077feb1 (patch)
tree589cdc466339ef9d1d39fe9aa5858d76708efa9f /mail/importers
parentface752169b27bad4c3cdec8395aee79e40eba7f (diff)
downloadgsoc2013-evolution-3b2cfae1768902b60d604fa96cd546636077feb1.tar.gz
gsoc2013-evolution-3b2cfae1768902b60d604fa96cd546636077feb1.tar.zst
gsoc2013-evolution-3b2cfae1768902b60d604fa96cd546636077feb1.zip
Trim unused or unnecessary bits from the import framework.
Diffstat (limited to 'mail/importers')
-rw-r--r--mail/importers/elm-importer.c9
-rw-r--r--mail/importers/mail-importer.c64
-rw-r--r--mail/importers/mail-importer.h23
-rw-r--r--mail/importers/pine-importer.c4
4 files changed, 7 insertions, 93 deletions
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<sizeof(status_flags)/sizeof(status_flags[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (status_flags); i++)
if (status_flags[i].tag == *p)
flags |= status_flags[i].flag;
}
@@ -166,7 +106,7 @@ decode_mozilla_status(const gchar *tmp)
guint32 flags = 0;
gint i;
- for (i=0;i<sizeof(status_flags)/sizeof(status_flags[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (status_flags); i++)
if (status_flags[i].mozflag & status)
flags |= status_flags[i].flag;
return flags;
diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h
index d751547827..7758c0e563 100644
--- a/mail/importers/mail-importer.h
+++ b/mail/importers/mail-importer.h
@@ -27,29 +27,6 @@
#include <e-util/e-import.h>
#include <camel/camel-folder.h>
-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);