aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/pst-import/pst-importer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pst-import/pst-importer.c')
-rw-r--r--plugins/pst-import/pst-importer.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index fa0b61e993..84706b783e 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -52,16 +52,6 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-source-selector-dialog.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-store.h>
-#include <camel/camel-exception.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-multipart.h>
-#include <camel/camel-data-wrapper.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-file-utils.h>
-
#include <mail/e-mail-local.h>
#include <mail/mail-mt.h>
#include <mail/mail-tools.h>
@@ -70,6 +60,13 @@
#include <libpst/libpst.h>
#include <libpst/timeconv.h>
+#ifdef WIN32
+#ifdef gmtime_r
+#undef gmtime_r
+#endif
+#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
+#endif
+
typedef struct _PstImporter PstImporter;
gint pst_init (pst_file *pst, gchar *filename);
@@ -469,24 +466,24 @@ pst_import_file (PstImporter *m)
g_free (filename);
- camel_operation_progress_count (NULL, 1);
+ camel_operation_progress (NULL, 1);
if ((item = pst_parse_item (&m->pst, m->pst.d_head, NULL)) == NULL) {
pst_error_msg ("Could not get root record");
return;
}
- camel_operation_progress_count (NULL, 2);
+ camel_operation_progress (NULL, 2);
if ((d_ptr = pst_getTopOfFolders (&m->pst, item)) == NULL) {
pst_error_msg ("Top of folders record not found. Cannot continue");
return;
}
- camel_operation_progress_count (NULL, 3);
+ camel_operation_progress (NULL, 3);
pst_import_folders (m, d_ptr);
- camel_operation_progress_count (NULL, 4);
+ camel_operation_progress (NULL, 4);
camel_operation_end (NULL);
@@ -671,7 +668,7 @@ pst_process_folder (PstImporter *m, pst_item *item)
m->folder_uri = uri;
if (m->folder) {
- camel_object_unref (m->folder);
+ g_object_unref (m->folder);
m->folder = NULL;
}
@@ -708,7 +705,7 @@ pst_create_folder (PstImporter *m)
*pos = '\0';
folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
- camel_object_unref(folder);
+ g_object_unref (folder);
*pos = '/';
}
}
@@ -716,7 +713,7 @@ pst_create_folder (PstImporter *m)
g_free (dest);
if (m->folder) {
- camel_object_unref (m->folder);
+ g_object_unref (m->folder);
}
m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
@@ -808,7 +805,7 @@ pst_process_email (PstImporter *m, pst_item *item)
}
camel_mime_message_set_from (msg, addr);
- camel_object_unref (addr);
+ g_object_unref (addr);
if (item->email->sent_date != NULL) {
camel_mime_message_set_date (msg, pst_fileTimeToUnixTime (item->email->sent_date), 0);
@@ -836,7 +833,7 @@ pst_process_email (PstImporter *m, pst_item *item)
if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0)
camel_mime_message_set_recipients (msg, "To", addr);
- camel_object_unref (addr);
+ g_object_unref (addr);
}
if (item->email->cc_address.str != NULL) {
@@ -845,7 +842,7 @@ pst_process_email (PstImporter *m, pst_item *item)
if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0)
camel_mime_message_set_recipients (msg, "CC", addr);
- camel_object_unref (addr);
+ g_object_unref (addr);
}
}
@@ -876,7 +873,7 @@ pst_process_email (PstImporter *m, pst_item *item)
part = camel_mime_part_new ();
camel_mime_part_set_content (part, item->body.str, strlen (item->body.str), "text/plain");
camel_multipart_add_part (mp, part);
- camel_object_unref (part);
+ g_object_unref (part);
}
if (item->email->htmlbody.str != NULL) {
@@ -884,21 +881,21 @@ pst_process_email (PstImporter *m, pst_item *item)
part = camel_mime_part_new ();
camel_mime_part_set_content (part, item->email->htmlbody.str, strlen (item->email->htmlbody.str), "text/html");
camel_multipart_add_part (mp, part);
- camel_object_unref (part);
+ g_object_unref (part);
}
for (attach = item->attach; attach; attach = attach->next) {
if (attach->data.data || attach->i_id) {
part = attachment_to_part(m, attach);
camel_multipart_add_part (mp, part);
- camel_object_unref (part);
+ g_object_unref (part);
}
}
/*camel_mime_message_dump (msg, TRUE);*/
if (item->email->htmlbody.str || item->attach) {
- camel_medium_set_content_object (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (mp));
+ camel_medium_set_content (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (mp));
} else if (item->body.str) {
camel_mime_part_set_content (CAMEL_MIME_PART (msg), item->body.str, strlen (item->body.str), "text/plain");
} else {
@@ -921,7 +918,7 @@ pst_process_email (PstImporter *m, pst_item *item)
camel_folder_append_message (m->folder, msg, info, NULL, &m->ex);
camel_message_info_free (info);
- camel_object_unref (msg);
+ g_object_unref (msg);
camel_folder_sync (m->folder, FALSE, NULL);
camel_folder_thaw (m->folder);
@@ -1241,24 +1238,24 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
continue;
}
- content = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ content = camel_medium_get_content (CAMEL_MEDIUM (part));
if (camel_data_wrapper_decode_to_stream (content, stream) == -1
|| camel_stream_flush (stream) == -1)
{
g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno));
- camel_object_unref (stream);
+ g_object_unref (stream);
attach = attach->next;
continue;
}
- camel_object_unref (stream);
+ g_object_unref (stream);
uri = g_filename_to_uri (path, NULL, NULL);
list = g_slist_append (list, g_strdup (uri));
g_free (uri);
- camel_object_unref (part);
+ g_object_unref (part);
g_free (path);
attach = attach->next;