diff options
Diffstat (limited to 'plugins/pst-import')
-rw-r--r-- | plugins/pst-import/ChangeLog | 22 | ||||
-rw-r--r-- | plugins/pst-import/Makefile.am | 6 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 55 |
3 files changed, 30 insertions, 53 deletions
diff --git a/plugins/pst-import/ChangeLog b/plugins/pst-import/ChangeLog deleted file mode 100644 index 0f031b508d..0000000000 --- a/plugins/pst-import/ChangeLog +++ /dev/null @@ -1,22 +0,0 @@ -2009-01-28 Tor Lillqvist <tml@novell.com> - - * Makefile.am: On Windows use -no-undefined and link with all - required libraries. (Just throw in a bunch of libraries without - cherry-picking. Having "superfluous" ones just slows down the - linking a bit, but doesn't hurt at run-time.) - - Use LIBPST_CFLAGS. - - * pst-importer.c: Include <libpst/define.h> before the other - libpst headers. Otherwise we get compilation errors on Windows, - sigh. - -2009-01-15 Bharath Acharya <abharath@novell.com> - - Basic functionality implemented by - Chris Halls <chris.halls@credativ.co.uk> - - ** Added PST-Import plugin - * Makefile.am: - * org-gnome-pst.eplug.xml: - * pst-importer.c: diff --git a/plugins/pst-import/Makefile.am b/plugins/pst-import/Makefile.am index 68c8a19264..0c6c89b5b9 100644 --- a/plugins/pst-import/Makefile.am +++ b/plugins/pst-import/Makefile.am @@ -22,7 +22,8 @@ liborg_gnome_pst_import_la_CPPFLAGS = \ $(GNOME_PLATFORM_CFLAGS) \ $(EVOLUTION_CFLAGS) \ $(EVOLUTION_CALENDAR_CFLAGS) \ - $(LIBPST_CFLAGS) + $(LIBPST_CFLAGS) \ + $(CAMEL_CFLAGS) liborg_gnome_pst_import_la_SOURCES = pst-importer.c @@ -35,7 +36,8 @@ liborg_gnome_pst_import_la_LIBADD = \ $(EVOLUTION_CALENDAR_LIBS) \ $(EVOLUTION_MAIL_LIBS) \ $(GNOME_PLATFORM_LIBS) \ - $(LIBPST_LIBS) + $(LIBPST_LIBS) \ + $(CAMEL_LIBS) EXTRA_DIST = org-gnome-pst-import.eplug.xml 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; |