aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/mbox
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/mbox')
-rw-r--r--camel/providers/mbox/.cvsignore7
-rw-r--r--camel/providers/mbox/Makefile.am41
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c970
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h81
-rw-r--r--camel/providers/mbox/camel-mbox-provider.c50
-rw-r--r--camel/providers/mbox/camel-mbox-store.c129
-rw-r--r--camel/providers/mbox/camel-mbox-store.h69
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c733
-rw-r--r--camel/providers/mbox/camel-mbox-summary.h78
-rw-r--r--camel/providers/mbox/libcamelmbox.urls1
10 files changed, 0 insertions, 2159 deletions
diff --git a/camel/providers/mbox/.cvsignore b/camel/providers/mbox/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/mbox/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am
deleted file mode 100644
index defd6925cc..0000000000
--- a/camel/providers/mbox/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmboxincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelmbox.la
-provider_DATA = libcamelmbox.urls
-
-INCLUDES = -I.. \
- -I$(srcdir)/.. \
- -I$(top_srcdir)/camel \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/libibex \
- -I$(top_srcdir)/e-util \
- -I$(top_srcdir) \
- -I$(includedir) \
- $(GTK_INCLUDEDIR) \
- -DG_LOG_DOMAIN=\"camel-mbox-provider\"
-
-libcamelmbox_la_SOURCES = \
- camel-mbox-folder.c \
- camel-mbox-provider.c \
- camel-mbox-store.c \
- camel-mbox-summary.c
-
-libcamelmboxinclude_HEADERS = \
- camel-mbox-folder.h \
- camel-mbox-store.h \
- camel-mbox-summary.h
-
-libcamelmbox_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-libcamelmbox_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-#libcamelmbox_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST = libcamelmbox.urls
-
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
deleted file mode 100644
index 3403271e40..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mbox-folder.c : Abstract class for an email folder */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999, 2000 Helix Code Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "camel-mbox-folder.h"
-#include "camel-mbox-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-mbox-summary.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-stream-filter.h"
-#include "camel-mime-filter-from.h"
-#include "camel-exception.h"
-
-#define d(x)
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMboxFolder */
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void mbox_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-
-static void mbox_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void mbox_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean mbox_exists (CamelFolder *folder, CamelException *ex);
-static gboolean mbox_create(CamelFolder *folder, CamelException *ex);
-static gboolean mbox_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean mbox_delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *mbox_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *mbox_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint mbox_get_message_count (CamelFolder *folder, CamelException *ex);
-static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GList *mbox_get_uid_list (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-
-static void mbox_expunge (CamelFolder *folder, CamelException *ex);
-#if 0
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-#endif
-
-GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count);
-static const CamelMessageInfo *mbox_summary_get_by_uid(CamelFolder *f, const char *uid);
-
-static GList *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-static void mbox_finalize (GtkObject *object);
-
-static void
-camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mbox_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->init = mbox_init;
- camel_folder_class->open = mbox_open;
- camel_folder_class->close = mbox_close;
- camel_folder_class->exists = mbox_exists;
- camel_folder_class->create = mbox_create;
- camel_folder_class->delete = mbox_delete;
- camel_folder_class->delete_messages = mbox_delete_messages;
- camel_folder_class->list_subfolders = mbox_list_subfolders;
- camel_folder_class->get_message_by_number = mbox_get_message_by_number;
- camel_folder_class->get_message_count = mbox_get_message_count;
- camel_folder_class->append_message = mbox_append_message;
- camel_folder_class->get_uid_list = mbox_get_uid_list;
- camel_folder_class->expunge = mbox_expunge;
-#if 0
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
-#endif
- camel_folder_class->get_message_by_uid = mbox_get_message_by_uid;
-
- camel_folder_class->search_by_expression = mbox_search_by_expression;
-
- camel_folder_class->get_message_info = summary_get_message_info;
- camel_folder_class->summary_get_by_uid = mbox_summary_get_by_uid;
-
- gtk_object_class->finalize = mbox_finalize;
-
-}
-
-static void
-mbox_finalize (GtkObject *object)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (object);
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-GtkType
-camel_mbox_folder_get_type (void)
-{
- static GtkType camel_mbox_folder_type = 0;
-
- if (!camel_mbox_folder_type) {
- GtkTypeInfo camel_mbox_folder_info =
- {
- "CamelMboxFolder",
- sizeof (CamelMboxFolder),
- sizeof (CamelMboxFolderClass),
- (GtkClassInitFunc) camel_mbox_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mbox_folder_info);
- }
-
- return camel_mbox_folder_type;
-}
-
-static void
-mbox_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name, gchar separator,
- CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- const gchar *root_dir_path;
-
- /* call parent method */
- parent_class->init (folder, parent_store, parent_folder,
- name, separator, ex);
- if (camel_exception_get_id (ex))
- return;
-
- /* we assume that the parent init
- method checks for the existance of @folder */
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
-
- mbox_folder->summary = NULL;
- mbox_folder->search = NULL;
-
- /* now set the name info */
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
- g_free (mbox_folder->index_file_path);
-
- root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store));
-
- mbox_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, folder->full_name);
- mbox_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, folder->full_name);
- mbox_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, folder->full_name);
- mbox_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, folder->full_name);
-}
-
-static void
-mbox_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- int forceindex;
- struct stat st;
-
- /* call parent class */
- parent_class->open (folder, mode, ex);
- if (camel_exception_get_id(ex))
- return;
-
- /* if we have no index file, force it */
- forceindex = stat(mbox_folder->index_file_path, &st) == -1;
-
- printf("loading ibex\n");
- mbox_folder->index = ibex_open(mbox_folder->index_file_path, O_CREAT|O_RDWR, 0600);
- printf("loaded ibex\n");
- if (mbox_folder->index == NULL) {
- /* yes, this isn't fatal at all */
- g_warning("Could not open/create index file: %s: indexing not performed",
- strerror(errno));
- }
-
- /* no summary (disk or memory), and we're proverbially screwed */
- printf("loading summary\n");
- mbox_folder->summary = camel_mbox_summary_new(mbox_folder->summary_file_path, mbox_folder->folder_file_path, mbox_folder->index);
- if (mbox_folder->summary == NULL
- || camel_mbox_summary_load(mbox_folder->summary, forceindex) == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- "Could not create summary");
- return;
- }
- printf("summary loaded\n");
-}
-
-static void
-mbox_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-
- if (expunge) {
- mbox_expunge(folder, ex);
- }
-
- /* save index */
- if (mbox_folder->index) {
- ibex_close(mbox_folder->index);
- mbox_folder->index = NULL;
- }
- if (mbox_folder->summary) {
- camel_folder_summary_save ((CamelFolderSummary *)mbox_folder->summary);
- gtk_object_unref((GtkObject *)mbox_folder->summary);
- mbox_folder->summary = NULL;
- }
- if (mbox_folder->search) {
- gtk_object_unref((GtkObject *)mbox_folder->search);
- mbox_folder->search = NULL;
- }
-}
-
-static void
-mbox_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox = (CamelMboxFolder *)folder;
-
- if (camel_mbox_summary_expunge(mbox->summary) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- "Could not expunge: %s", strerror(errno));
- }
-
- /* TODO: check it actually changed */
- gtk_signal_emit_by_name((GtkObject *)folder, "folder_changed", 0);
-}
-
-/* FIXME: clean up this snot */
-static gboolean
-mbox_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder;
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- g_assert(folder != NULL);
-
- mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
- /* check if the mbox file path is determined */
- if (!mbox_folder->folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder file path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the mbox dir path is determined */
- if (!mbox_folder->folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder directory path. Maybe use set_name ?");
- return FALSE;
- }
-
-
- /* we should not check for that here */
-#if 0
- /* check if the mbox directory exists */
- access_result = access (mbox_folder->folder_dir_path, F_OK);
- if (access_result < 0) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- stat_error = stat (mbox_folder->folder_dir_path, &stat_buf);
- if (stat_error == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
- if (!exists) return FALSE;
-#endif
-
-
- /* check if the mbox file exists */
- stat_error = stat (mbox_folder->folder_file_path, &stat_buf);
- if (stat_error == -1)
- return FALSE;
-
- exists = S_ISREG (stat_buf.st_mode);
- /* we should check the rights here */
-
- return exists;
-}
-
-/* FIXME: clean up this snot */
-static gboolean
-mbox_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path, *folder_dir_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
- gboolean folder_already_exists;
- int creat_fd;
-
- g_assert(folder != NULL);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- /* get the paths of what we need to create */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_dir_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* if the folder already exists, simply return */
- folder_already_exists = camel_folder_exists (folder,ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (folder_already_exists)
- return TRUE;
-
-
- /* create the directory for the subfolders */
- mkdir_error = mkdir (folder_dir_path, dir_mode);
- if (mkdir_error == -1)
- goto io_error;
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- creat_fd = open (folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- 0600);
- if (creat_fd == -1)
- goto io_error;
-
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to create the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to create the mbox file.");
- return FALSE;
- }
-}
-
-
-/* FIXME: cleanup */
-static gboolean
-mbox_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path, *folder_dir_path;
- gint rmdir_error = 0;
- gint unlink_error = 0;
- gboolean folder_already_exists;
-
- g_assert(folder != NULL);
-
- /* check if the folder object exists */
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (!folder_already_exists)
- return TRUE;
-
-
- /* call default implementation.
- It should delete the messages in the folder
- and recurse the operation to subfolders */
- parent_class->delete (folder, recurse, ex);
-
-
- /* get the paths of what we need to be deleted */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* physically delete the directory */
- rmdir_error = rmdir (folder_dir_path);
- if (rmdir_error == -1)
- switch (errno) {
- case EACCES :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox folder");
- return FALSE;
- break;
-
- case ENOTEMPTY :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "mbox folder not empty. Cannot delete it. Maybe use recurse flag ?");
- return FALSE;
- break;
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
- /* physically delete the file */
- unlink_error = unlink (folder_dir_path);
- if (unlink_error == -1)
- switch (errno) {
- case EACCES :
- case EPERM :
- case EROFS :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox file");
- return FALSE;
- break;
-
- case EFAULT :
- case ENOENT :
- case ENOTDIR :
- case EISDIR :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox file");
- return FALSE;
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
-
- return TRUE;
-}
-
-/* TODO: remove this */
-gboolean
-mbox_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path;
- gboolean folder_already_exists;
- int creat_fd;
- g_assert(folder!=NULL);
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
-
- /* get the paths of the mbox file we need to delete */
- folder_file_path = mbox_folder->folder_file_path;
-
- if (!folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- creat_fd = open (folder_file_path,
- O_WRONLY | O_TRUNC,
- 0600);
- if (creat_fd == -1)
- goto io_error;
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to write in the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to write in the mbox file.");
- return FALSE;
- }
-
-
-}
-
-/* FIXME: cleanup */
-static GList *
-mbox_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_dir_path;
- gboolean folder_exists;
-
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- gchar *full_entry_name;
- gchar *real_folder_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gboolean folder_suffix_found;
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case the folder does not exist,
- raise an exception */
- folder_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_exists) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Inexistant folder.");
- return FALSE;
- }
-
-
- /* get the mbox subfolders directories */
- folder_dir_path = mbox_folder->folder_file_path;
- if (!folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- dir_handle = opendir (folder_dir_path);
-
- /* read the first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", folder_dir_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- /* if the folder is a netscape folder, remove the
- ".sdb" from the name */
- real_folder_name = string_prefix (entry_name, ".sdb", &folder_suffix_found);
- /* stick here the tests for other folder suffixes if any */
-
- if (!folder_suffix_found) real_folder_name = g_strdup (entry_name);
-
- /* add the folder name to the list */
- subfolder_name_list = g_list_append (subfolder_name_list,
- real_folder_name);
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-
-
-
- /* io exception handling */
- switch (errno) {
- case EACCES :
-
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Unable to list the directory. Full Error text is : %s ",
- strerror (errno));
- break;
-
- case ENOENT :
- case ENOTDIR :
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox folder path. Full Error text is : %s ",
- strerror (errno));
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
-
- }
-
- g_list_free (subfolder_name_list);
- return NULL;
-}
-
-static gint
-mbox_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- g_assert (folder);
- g_assert (mbox_folder->summary);
-
- return camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
-}
-
-/* FIXME: this may need some tweaking for performance? */
-static void
-mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- CamelStream *output_stream = NULL, *filter_stream = NULL;
- CamelMimeFilter *filter_from;
- struct stat st;
- off_t seek = -1;
- char *xev;
- guint32 uid;
-
- if (stat(mbox_folder->folder_file_path, &st) != 0)
- goto fail;
-
- output_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDWR, 0600, ex);
- if (output_stream == NULL)
- goto fail;
-
- seek = camel_seekable_stream_seek((CamelSeekableStream *)output_stream, st.st_size, SEEK_SET, ex);
- if (seek != st.st_size)
- goto fail;
-
- /* assign a new x-evolution header/uid */
- camel_medium_remove_header((CamelMedium *)message, "X-Evolution");
- uid = camel_folder_summary_next_uid((CamelFolderSummary *)mbox_folder->summary);
- xev = g_strdup_printf("%08x-%04x", uid, message->flags & 0xffff);
- camel_medium_add_header((CamelMedium *)message, "X-Evolution", xev);
- g_free(xev);
-
- /* we must write this to the non-filtered stream ... */
- if (camel_stream_write_string (output_stream, "From - \n", ex) == -1)
- goto fail;
-
- /* and write the content to the filtering stream, that translated '\nFrom' into '\n>From' */
- filter_stream = (CamelStream *)camel_stream_filter_new_with_stream(output_stream);
- filter_from = (CamelMimeFilter *)camel_mime_filter_from_new();
- camel_stream_filter_add((CamelStreamFilter *)filter_stream, filter_from);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), filter_stream, ex);
-#warning "we still need stream_close() for this"
- if (!camel_exception_is_set (ex))
- camel_stream_flush (filter_stream, ex);
-
- if (camel_exception_is_set (ex))
- goto fail;
-
- /* filter stream ref's the output stream itself, so we need to unref it too */
- gtk_object_unref (GTK_OBJECT (filter_from));
- gtk_object_unref (GTK_OBJECT (filter_stream));
- gtk_object_unref (GTK_OBJECT (output_stream));
-
- /* force a summary update - will only update from the new position, if it can */
- camel_mbox_summary_update(mbox_folder->summary, seek);
- return;
-
-fail:
- if (camel_exception_is_set (ex)) {
- camel_exception_setv (ex, camel_exception_get_id (ex),
- "Cannot append message to mbox file: %s",
- camel_exception_get_description (ex));
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot append message to mbox file: %s",
- g_strerror (errno));
- }
- if (filter_stream) {
- /*camel_stream_close (filter_stream);*/
- gtk_object_unref ((GtkObject *)filter_stream);
- }
- if (output_stream)
- gtk_object_unref ((GtkObject *)output_stream);
-
- /* make sure the file isn't munged by us */
- if (seek != -1) {
- int fd = open(mbox_folder->folder_file_path, O_WRONLY, 0600);
- if (fd != -1) {
- ftruncate(fd, st.st_size);
- close(fd);
- }
- }
-}
-
-static GList *
-mbox_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- GList *uid_list = NULL;
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- int i, count;
-
- /* FIXME: how are these allocated strings ever free'd? */
- count = camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
- for (i=0;i<count;i++) {
- CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, i);
- uid_list = g_list_prepend(uid_list, g_strdup(info->info.uid));
- }
-
- return uid_list;
-}
-
-static CamelMimeMessage *
-mbox_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- CamelMboxMessageInfo *info;
-
- g_warning("YOUR CODE SHOULD NOT BE GETTING MESSAGES BY NUMBER, CHANGE IT");
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, number);
- if (info == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
- "No such message %d in folder `%s'.",
- number, folder->name);
- return NULL;
- }
-
- return mbox_get_message_by_uid (folder, info->info.uid, ex);
-}
-
-/* track flag changes in the summary */
-static void
-message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf)
-{
- CamelMessageInfo *info;
-
- printf("Message changed: %s: %d\n", m->message_uid, type);
- switch (type) {
- case MESSAGE_FLAGS_CHANGED:
- info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, m->message_uid);
- if (info) {
- info->flags = m->flags | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch((CamelFolderSummary *)mf->summary);
- } else
- g_warning("Message changed event on message not in summary: %s", m->message_uid);
- break;
- default:
- printf("Unhandled message change event: %d\n", type);
- break;
- }
-}
-
-static CamelMimeMessage *
-mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelMboxMessageInfo *info;
- CamelMimeParser *parser = NULL;
- char *buffer;
- int len;
-
- /* get the message summary info */
- info = (CamelMboxMessageInfo *)camel_folder_summary_uid((CamelFolderSummary *)mbox_folder->summary, uid);
-
- if (info == NULL) {
- errno = ENOENT;
- goto fail;
- }
-
- /* if this has no content, its an error in the library */
- g_assert(info->info.content);
- g_assert(info->frompos != -1);
-
- /* where we read from */
- message_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDONLY, 0, ex);
- if (message_stream == NULL)
- goto fail;
-
- /* we use a parser to verify the message is correct, and in the correct position */
- parser = camel_mime_parser_new();
- camel_mime_parser_init_with_stream(parser, message_stream);
- gtk_object_unref((GtkObject *)message_stream);
- camel_mime_parser_scan_from(parser, TRUE);
-
- camel_mime_parser_seek(parser, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(parser, &buffer, &len) != HSCAN_FROM) {
- g_warning("File appears truncated");
- goto fail;
- }
-
- if (camel_mime_parser_tell_start_from(parser) != info->frompos) {
- g_warning("Summary doesn't match the folder contents! eek!");
- errno = EINVAL;
- goto fail;
- }
-
- message = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
- g_warning("Construction failed");
- goto fail;
- }
-
- /* we're constructed, finish setup and clean up */
- message->folder = folder;
- gtk_object_ref((GtkObject *)folder);
- message->message_uid = g_strdup(uid);
- message->flags = info->info.flags;
- gtk_signal_connect((GtkObject *)message, "message_changed", message_changed, folder);
-
- gtk_object_unref((GtkObject *)parser);
-
- return message;
-
-fail:
- if (camel_exception_is_set (ex)) {
- camel_exception_setv (ex, camel_exception_get_id (ex),
- "Cannot get message: %s",
- camel_exception_get_description (ex));
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "Cannot get message: %s",
- g_strerror(errno));
- }
- if (parser)
- gtk_object_unref((GtkObject *)parser);
- if (message)
- gtk_object_unref((GtkObject *)message);
-
- return NULL;
-}
-
-/* get message info for a range of messages */
-GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count)
-{
- GPtrArray *array = g_ptr_array_new();
- int i, maxcount;
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- maxcount = camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
- maxcount = MIN(count, maxcount);
- for (i=first;i<maxcount;i++)
- g_ptr_array_add(array, camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, i));
-
- return array;
-}
-
-/* get a single message info, by uid */
-static const CamelMessageInfo *
-mbox_summary_get_by_uid(CamelFolder *f, const char *uid)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)f;
-
- return camel_folder_summary_uid((CamelFolderSummary *)mbox_folder->summary, uid);
-}
-
-static GList *
-mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- if (mbox_folder->search == NULL) {
- mbox_folder->search = camel_folder_search_new();
- }
-
- camel_folder_search_set_folder(mbox_folder->search, folder);
- if (mbox_folder->summary)
- /* FIXME: dont access summary array directly? */
- camel_folder_search_set_summary(mbox_folder->search, ((CamelFolderSummary *)mbox_folder->summary)->messages);
- camel_folder_search_set_body_index(mbox_folder->search, mbox_folder->index);
-
- return camel_folder_search_execute_expression(mbox_folder->search, expression, ex);
-}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
deleted file mode 100644
index d7dc361f14..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_FOLDER_H
-#define CAMEL_MBOX_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-search.h>
-#include <libibex/ibex.h>
-#include "camel-mbox-summary.h"
-
-/* #include "camel-store.h" */
-
-#define CAMEL_MBOX_FOLDER_TYPE (camel_mbox_folder_get_type ())
-#define CAMEL_MBOX_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
-#define CAMEL_MBOX_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
-#define IS_CAMEL_MBOX_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *folder_file_path; /* contains the messages */
- gchar *summary_file_path; /* contains the messages summary */
- gchar *folder_dir_path; /* contains the subfolders */
- gchar *index_file_path; /* index of body contents */
-
- ibex *index; /* index for this folder */
- CamelMboxSummary *summary;
- CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
-} CamelMboxFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMboxFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_FOLDER_H */
diff --git a/camel/providers/mbox/camel-mbox-provider.c b/camel/providers/mbox/camel-mbox-provider.c
deleted file mode 100644
index 04ce88de12..0000000000
--- a/camel/providers/mbox/camel-mbox-provider.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-provider.c: mbox provider registration code */
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 2000 HelixCode (www.helixcode.com).
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-mbox-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider mbox_provider = {
- "mbox",
- "UNIX mbox-format mail files",
-
- "For reading mail delivered by the local system, and for "
- "storing mail on local disk.",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- mbox_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_mbox_store_get_type();
-
- camel_session_register_provider (session, &mbox_provider);
-}
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
deleted file mode 100644
index 8db2f9338e..0000000000
--- a/camel/providers/mbox/camel-mbox-store.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.c : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <bertrand@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "camel-mbox-store.h"
-#include "camel-mbox-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-/* Returns the class for a CamelMboxStore */
-#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static char *get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
-
-static void
-camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class);
-
- /* virtual method overload */
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_folder_name = get_folder_name;
-}
-
-
-
-static void
-camel_mbox_store_init (gpointer object, gpointer klass)
-{
- CamelService *service = CAMEL_SERVICE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- service->url_flags = CAMEL_SERVICE_URL_NEED_PATH;
-
- /* mbox names are filenames, so they are case-sensitive. */
- store->folders = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-
-
-
-GtkType
-camel_mbox_store_get_type (void)
-{
- static GtkType camel_mbox_store_type = 0;
-
- if (!camel_mbox_store_type) {
- GtkTypeInfo camel_mbox_store_info =
- {
- "CamelMboxStore",
- sizeof (CamelMboxStore),
- sizeof (CamelMboxStoreClass),
- (GtkClassInitFunc) camel_mbox_store_class_init,
- (GtkObjectInitFunc) camel_mbox_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mbox_store_info);
- }
-
- return camel_mbox_store_type;
-}
-
-
-const gchar *
-camel_mbox_store_get_toplevel_dir (CamelMboxStore *store)
-{
- CamelURL *url = CAMEL_SERVICE (store)->url;
-
- g_assert(url != NULL);
- return url->path;
-}
-
-
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- CamelMboxFolder *new_mbox_folder;
- CamelFolder *new_folder;
-
- new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mbox_folder);
-
- /* XXX We shouldn't be passing NULL here, but it's equivalent to
- * what was there before, and there's no
- * CamelMboxFolder::get_subfolder yet anyway...
- */
- CF_CLASS (new_folder)->init (new_folder, store, NULL,
- folder_name, '/', ex);
-
- return new_folder;
-}
-
-static char *
-get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- return g_strdup (folder_name);
-}
diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h
deleted file mode 100644
index 06a971ada4..0000000000
--- a/camel/providers/mbox/camel-mbox-store.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.h : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <bertrand@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_STORE_H
-#define CAMEL_MBOX_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MBOX_STORE_TYPE (camel_mbox_store_get_type ())
-#define CAMEL_MBOX_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
-#define CAMEL_MBOX_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
-#define IS_CAMEL_MBOX_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
-} CamelMboxStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelMboxStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_store_get_type (void);
-
-const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_STORE_H */
-
-
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
deleted file mode 100644
index 56ff1cb198..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mbox-summary.h"
-#include <camel/camel-mime-message.h>
-
-#include <sys/stat.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define io(x)
-#define d(x)
-
-#define CAMEL_MBOX_SUMMARY_VERSION (0x1000)
-
-struct _CamelMboxSummaryPrivate {
-};
-
-#define _PRIVATE(o) (((CamelMboxSummary *)(o))->priv)
-
-static int summary_header_load(CamelFolderSummary *, FILE *);
-static int summary_header_save(CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _header_raw *);
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-static CamelMessageInfo * message_info_load(CamelFolderSummary *, FILE *);
-static int message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
-/*static void message_info_free(CamelFolderSummary *, CamelMessageInfo *);*/
-
-static void camel_mbox_summary_class_init (CamelMboxSummaryClass *klass);
-static void camel_mbox_summary_init (CamelMboxSummary *obj);
-static void camel_mbox_summary_finalise (GtkObject *obj);
-
-static CamelFolderSummaryClass *camel_mbox_summary_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mbox_summary_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMboxSummary",
- sizeof (CamelMboxSummary),
- sizeof (CamelMboxSummaryClass),
- (GtkClassInitFunc) camel_mbox_summary_class_init,
- (GtkObjectInitFunc) camel_mbox_summary_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_folder_summary_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_mbox_summary_class_init (CamelMboxSummaryClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) klass;
-
- camel_mbox_summary_parent = gtk_type_class (camel_folder_summary_get_type ());
-
- object_class->finalize = camel_mbox_summary_finalise;
-
- sklass->summary_header_load = summary_header_load;
- sklass->summary_header_save = summary_header_save;
-
- sklass->message_info_new = message_info_new;
- sklass->message_info_new_from_parser = message_info_new_from_parser;
- sklass->message_info_load = message_info_load;
- sklass->message_info_save = message_info_save;
- /*sklass->message_info_free = message_info_free;*/
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mbox_summary_init (CamelMboxSummary *obj)
-{
- struct _CamelMboxSummaryPrivate *p;
- struct _CamelFolderSummary *s = (CamelFolderSummary *)obj;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-
- /* subclasses need to set the right instance data sizes */
- s->message_info_size = sizeof(CamelMboxMessageInfo);
- s->content_info_size = sizeof(CamelMboxMessageContentInfo);
-
- /* and a unique file version */
- s->version = CAMEL_MBOX_SUMMARY_VERSION;
-}
-
-static void
-camel_mbox_summary_finalise (GtkObject *obj)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)obj;
-
- g_free(mbs->folder_path);
-
- ((GtkObjectClass *)(camel_mbox_summary_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_mbox_summary_new:
- *
- * Create a new CamelMboxSummary object.
- *
- * Return value: A new CamelMboxSummary widget.
- **/
-CamelMboxSummary *
-camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index)
-{
- CamelMboxSummary *new = CAMEL_MBOX_SUMMARY ( gtk_type_new (camel_mbox_summary_get_type ()));
- if (new) {
- /* ?? */
- camel_folder_summary_set_build_content((CamelFolderSummary *)new, TRUE);
- camel_folder_summary_set_filename((CamelFolderSummary *)new, filename);
- new->folder_path = g_strdup(mbox_name);
- new->index = index;
- }
- return new;
-}
-
-
-static int summary_header_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_load(s, in) == -1)
- return -1;
-
- return camel_folder_summary_decode_uint32(in, &mbs->folder_size);
-}
-
-static int summary_header_save(CamelFolderSummary *s, FILE *out)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_save(s, out) == -1)
- return -1;
-
- return camel_folder_summary_encode_uint32(out, mbs->folder_size);
-}
-
-static int
-header_evolution_decode(const char *in, guint32 *uid, guint32 *flags)
-{
- char *header;
- if (in
- && (header = header_token_decode(in))) {
- if (strlen(header) == strlen("00000000-0000")
- && sscanf(header, "%08x-%04x", uid, flags) == 2) {
- g_free(header);
- return *uid;
- }
- g_free(header);
- }
-
- return -1;
-}
-
-static char *
-header_evolution_encode(guint32 uid, guint32 flags)
-{
- return g_strdup_printf("%08x-%04x", uid, flags & 0xffff);
-}
-
-static CamelMessageInfo * message_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new(s, h);
- if (mi) {
- const char *xev;
- guint32 uid, flags;
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- xev = header_raw_find(&h, "X-Evolution", NULL);
- if (xev
- && header_evolution_decode(xev, &uid, &flags) != -1) {
- g_free(mi->uid);
- mi->uid = g_strdup_printf("%u", uid);
- mi->flags = flags;
- } else {
- /* to indicate it has no xev header? */
- mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_NOXEV;
- mi->uid = g_strdup_printf("%u", camel_folder_summary_next_uid(s));
- }
- mbi->frompos = -1;
- }
- return mi;
-}
-
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *mi;
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new_from_parser(s, mp);
- if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- mbi->frompos = camel_mime_parser_tell_start_from(mp);
-
- /* do we want to index this message as we add it, as well? */
- if (mbs->index_force
- || (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0
- || !ibex_contains_name(mbs->index, mi->uid)) {
- camel_folder_summary_set_index(s, mbs->index);
- } else {
- camel_folder_summary_set_index(s, NULL);
- }
- }
- return mi;
-}
-
-static CamelMessageInfo * message_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *mi;
-
- io(printf("loading mbox message info\n"));
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_load(s, in);
- if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- camel_folder_summary_decode_uint32(in, &mbi->frompos);
- }
- return mi;
-}
-
-static int message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
-{
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- io(printf("saving mbox message info\n"));
-
- ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save(s, out, mi);
-
- return camel_folder_summary_encode_uint32(out, mbi->frompos);
-}
-
-static int
-summary_rebuild(CamelMboxSummary *mbs, off_t offset)
-{
- CamelMimeParser *mp;
- int fd;
- int ok = 0;
-
- printf("(re)Building summary from %d (%s)\n", (int)offset, mbs->folder_path);
-
- fd = open(mbs->folder_path, O_RDONLY);
- mp = camel_mime_parser_new();
- camel_mime_parser_init_with_fd(mp, fd);
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_seek(mp, offset, SEEK_SET);
-
- if (offset > 0) {
- if (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- if (camel_mime_parser_tell_start_from(mp) != offset) {
- g_warning("The next message didn't start where I expected\nbuilding summary from start");
- camel_mime_parser_drop_step(mp);
- offset = 0;
- camel_mime_parser_seek(mp, offset, SEEK_SET);
- camel_folder_summary_clear((CamelFolderSummary *)mbs);
- } else {
- camel_mime_parser_unstep(mp);
- }
- } else {
- gtk_object_unref((GtkObject *)mp);
- /* end of file - no content? */
- return 0;
- }
- }
-
- while (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- CamelMessageInfo *info;
-
- info = camel_folder_summary_add_from_parser((CamelFolderSummary *)mbs, mp);
- if (info == NULL) {
- ok = -1;
- break;
- }
-
- g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END);
- }
-
- gtk_object_unref((GtkObject *)mp);
-
- return ok;
-}
-
-int
-camel_mbox_summary_update(CamelMboxSummary *mbs, off_t offset)
-{
- int ret;
-
- mbs->index_force = FALSE;
- ret = summary_rebuild(mbs, offset);
-
-#if 0
-#warning "Saving full summary and index after every summarisation is slow ..."
- if (ret != -1) {
- if (camel_folder_summary_save((CamelFolderSummary *)mbs) == -1)
- g_warning("Could not save summary: %s", strerror(errno));
- printf("summary saved\n");
- if (mbs->index)
- ibex_save(mbs->index);
- printf("ibex saved\n");
- }
-#endif
- return ret;
-}
-
-int
-camel_mbox_summary_load(CamelMboxSummary *mbs, int forceindex)
-{
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
- struct stat st;
- int ret = 0;
- off_t minstart;
-
- mbs->index_force = forceindex;
-
- /* is the summary out of date? */
- if (stat(mbs->folder_path, &st) == -1) {
- camel_folder_summary_clear(s);
- printf("Cannot summarise folder: '%s': %s\n", mbs->folder_path, strerror(errno));
- return -1;
- }
-
- if (forceindex || camel_folder_summary_load(s) == -1) {
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- } else {
- minstart = st.st_size;
-#if 0
- /* find out the first unindexed message ... */
- /* TODO: For this to work, it has to check that the message is
- indexable, and contains content ... maybe it cannot be done
- properly? */
- for (i=0;i<camel_folder_summary_count(s);i++) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, i);
- if (!ibex_contains_name(mbs->index, mi->uid)) {
- minstart = ((CamelMboxMessageInfo *)mi)->frompos;
- printf("Found unindexed message: %s\n", mi->uid);
- break;
- }
- }
-#endif
- /* is the summary uptodate? */
- if (st.st_size == mbs->folder_size && st.st_mtime == s->time) {
- printf("Summary time and date match mbox\n");
- if (minstart < st.st_size) {
- /* FIXME: Only clear the messages and reindex from this point forward */
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- }
- } else {
- if (mbs->folder_size < st.st_size) {
- printf("Index is for a smaller mbox\n");
- if (minstart < mbs->folder_size) {
- /* FIXME: only make it rebuild as necessary */
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- } else {
- ret = summary_rebuild(mbs, mbs->folder_size);
- }
- } else {
- printf("index is for a bigger mbox\n");
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- }
- }
- }
-
- if (ret != -1) {
- mbs->folder_size = st.st_size;
- s->time = st.st_mtime;
- printf("saving summary\n");
- if (camel_folder_summary_save(s) == -1)
- g_warning("Could not save summary: %s", strerror(errno));
- printf("summary saved\n");
- if (mbs->index)
- ibex_save(mbs->index);
- printf("ibex saved\n");
- }
-
- return ret;
-}
-
-static int
-header_write(int fd, struct _header_raw *header, char *xevline)
-{
- struct iovec iv[4];
- int outlen = 0, len;
-
- iv[1].iov_base = ":";
- iv[1].iov_len = 1;
- iv[3].iov_base = "\n";
- iv[3].iov_len = 1;
-
- while (header) {
- if (strcasecmp(header->name, "X-Evolution")) {
- iv[0].iov_base = header->name;
- iv[0].iov_len = strlen(header->name);
- iv[2].iov_base = header->value;
- iv[2].iov_len = strlen(header->value);
-
- do {
- len = writev(fd, iv, 4);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
- outlen += len;
- }
- header = header->next;
- }
-
- iv[0].iov_base = "X-Evolution: ";
- iv[0].iov_len = strlen(iv[0].iov_base);
- iv[1].iov_base = xevline;
- iv[1].iov_len = strlen(xevline);
- iv[2].iov_base = "\n\n";
- iv[2].iov_len = 2;
-
- do {
- len = writev(fd, iv, 3);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
-
- outlen += 1;
-
- d(printf("Wrote %d bytes of headers\n", outlen));
-
- return outlen;
-}
-
-static int
-copy_block(int fromfd, int tofd, off_t start, size_t bytes)
-{
- char buffer[4096];
- int written = 0;
-
- d(printf("writing %d bytes ... ", bytes));
-
- if (lseek(fromfd, start, SEEK_SET) != start)
- return -1;
-
- while (bytes>0) {
- int toread, towrite;
-
- toread = bytes;
- if (bytes>4096)
- toread = 4096;
- else
- toread = bytes;
- do {
- towrite = read(fromfd, buffer, toread);
- } while (towrite == -1 && errno == EINTR);
-
- if (towrite == -1)
- return -1;
-
- /* check for 'end of file' */
- if (towrite == 0) {
- d(printf("end of file?\n"));
- break;
- }
-
- do {
- toread = write(tofd, buffer, towrite);
- } while (toread == -1 && errno == EINTR);
-
- if (toread == -1)
- return -1;
-
- written += toread;
- bytes -= toread;
- }
-
- d(printf("written %d bytes\n", written));
-
- return written;
-}
-
-int
-camel_mbox_summary_expunge(CamelMboxSummary *mbs)
-{
- CamelMimeParser *mp=NULL;
- int i, count;
- CamelMboxMessageInfo *info;
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
-
- int fd=-1, fdout=-1;
- off_t offset = 0;
- char *tmpname=0;
- char *buffer, *xevnew = NULL;
- const char *xev;
- int len;
- guint32 uid, flags;
- int quick = TRUE, work = FALSE;
-
- /* make sure we're in sync */
- count = camel_folder_summary_count(s);
- if (count>0) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, count-1);
- camel_mbox_summary_update(mbs, mi->content->endpos);
- } else {
- camel_mbox_summary_update(mbs, 0);
- }
-
- /* check if we have any work to do */
- d(printf("Performing expunge, %d messages in inbox\n", count));
- for (i=0;quick && i<count;i++) {
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
- if (info->info.flags & (CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_FOLDER_NOXEV))
- quick = FALSE;
- else
- work |= (info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
- }
-
- d(printf("Options: %s %s\n", quick?"quick":"", work?"Work":""));
-
- if (quick && !work)
- return 0;
-
- fd = open(mbs->folder_path, O_RDWR);
- if (fd == -1)
- return -1;
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, fd);
-
- if (!quick) {
- tmpname = alloca(strlen(mbs->folder_path)+5);
- sprintf(tmpname, "%s.tmp", mbs->folder_path);
- d(printf("Writing tmp file to %s\n", tmpname));
- retry_out:
- fdout = open(tmpname, O_WRONLY|O_CREAT|O_EXCL, 0600);
- if (fdout == -1) {
- if (errno == EEXIST)
- if (unlink(tmpname) != -1)
- goto retry_out;
- tmpname = 0;
- goto error;
- }
- }
-
- for (i=0;i<count;i++) {
- off_t frompos, bodypos;
- off_t xevoffset;
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
-
- g_assert(info);
-
- d(printf("Looking at message %s\n", info->info.uid));
-
- if (info->info.flags & CAMEL_MESSAGE_DELETED) {
- d(printf("Deleting %s\n", info->info.uid));
-
- g_assert(!quick);
- offset -= (info->info.content->endpos - info->frompos);
- if (mbs->index)
- ibex_unindex(mbs->index, info->info.uid);
- camel_folder_summary_remove(s, (CamelMessageInfo *)info);
- count--;
- i--;
- info = NULL;
- } else if (info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- int xevok = FALSE;
-
- d(printf("Updating header for %s flags = %08x\n", info->info.uid, info->info.flags));
-
- /* find the next message, header parts */
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM)
- goto error;
-
- if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
- g_error("Summary/mbox mismatch, aborting expunge");
- goto error;
- }
-
- if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END)
- goto error;
-
- xev = camel_mime_parser_header(mp, "X-Evolution", (int *)&xevoffset);
- if (xev && header_evolution_decode(xev, &uid, &flags) != -1) {
- char name[64];
-
- sprintf(name, "%u", uid);
- if (strcmp(name, info->info.uid)) {
- d(printf("Summary mismatch, aborting leaving mailbox intact\n"));
- goto error;
- }
- xevok = TRUE;
- }
- xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags);
- if (quick) {
- if (!xevok) {
- g_error("The summary told me I had an X-Evolution header, but i dont!");
- goto error;
- }
- buffer = g_strdup_printf("X-Evolution: %s", xevnew);
- do {
- len = write(fd, buffer, strlen(buffer));
- } while (len == -1 && errno == EINTR);
- g_free(buffer);
- if (len == -1) {
- goto error;
- }
- } else {
- frompos = lseek(fdout, 0, SEEK_CUR);
- write(fdout, "From -\n", strlen("From -\n"));
- if (header_write(fdout, camel_mime_parser_headers_raw(mp), xevnew) == -1) {
- d(printf("Error writing to tmp mailbox\n"));
- goto error;
- }
- bodypos = lseek(fdout, 0, SEEK_CUR);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- info->info.content->pos,
- info->info.content->endpos,
- info->info.content->bodypos));
- if (copy_block(fd, fdout, info->info.content->bodypos, info->info.content->endpos - info->info.content->bodypos) == -1) {
- g_warning("Cannot copy data to output fd");
- goto error;
- }
- info->frompos = frompos;
- offset = bodypos - info->info.content->bodypos;
- }
- g_free(xevnew); xevnew = NULL;
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
- } else {
- d(printf("Nothing to do for this message\n"));
- }
- if (!quick && info!=NULL && offset!=0) {
- camel_folder_summary_offset_content(info->info.content, offset);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- info->info.content->pos,
- info->info.content->endpos,
- info->info.content->bodypos));
- }
- }
-
- d(printf("Closing folders\n"));
-
- if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- goto error;
- }
-
- if (!quick) {
- struct stat st;
-
- if (close(fdout) == -1) {
- g_warning("Cannot close tmp folder: %s", strerror(errno));
- goto error;
- }
-
- if (rename(tmpname, mbs->folder_path) == -1) {
- g_warning("Cannot rename folder: %s", strerror(errno));
- goto error;
- }
- tmpname = 0;
-
- if (stat(mbs->folder_path, &st) == -1)
- goto error;
-
- s->flags |= CAMEL_SUMMARY_DIRTY;
- s->time = st.st_mtime;
- mbs->folder_size = st.st_size;
- camel_folder_summary_save(s);
- if (mbs->index)
- ibex_save(mbs->index);
- }
-
- gtk_object_unref((GtkObject *)mp);
-
- return 0;
-error:
- d(printf("Error occured: %s\n", strerror(errno)));
- count = errno;
-
- close(fd);
- close(fdout);
-
- g_free(xevnew);
-
- if (tmpname)
- unlink(tmpname);
- if (mp)
- gtk_object_unref((GtkObject *)mp);
-
- errno = count;
- return -1;
-}
diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h
deleted file mode 100644
index 6d98fd051d..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_MBOX_SUMMARY_H
-#define _CAMEL_MBOX_SUMMARY_H
-
-#include <gtk/gtk.h>
-#include <camel/camel-folder-summary.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_mbox_summary_get_type (), CamelMboxSummary)
-#define CAMEL_MBOX_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mbox_summary_get_type (), CamelMboxSummaryClass)
-#define IS_CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_mbox_summary_get_type ())
-
-typedef struct _CamelMboxSummary CamelMboxSummary;
-typedef struct _CamelMboxSummaryClass CamelMboxSummaryClass;
-
-/* extra summary flags */
-enum {
- CAMEL_MESSAGE_FOLDER_NOXEV = 1<<16,
-/* CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<17,*/
-};
-
-typedef struct _CamelMboxMessageContentInfo {
- CamelMessageContentInfo info;
-} CamelMboxMessageContentInfo;
-
-typedef struct _CamelMboxMessageInfo {
- CamelMessageInfo info;
-
- off_t frompos;
-} CamelMboxMessageInfo;
-
-struct _CamelMboxSummary {
- CamelFolderSummary parent;
-
- struct _CamelMboxSummaryPrivate *priv;
-
- char *folder_path; /* name of matching folder */
- size_t folder_size; /* size of the mbox file, last sync */
-
- ibex *index;
- int index_force; /* do we force index during creation? */
-};
-
-struct _CamelMboxSummaryClass {
- CamelFolderSummaryClass parent_class;
-};
-
-guint camel_mbox_summary_get_type (void);
-CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index);
-
-/* load/check the summary */
-int camel_mbox_summary_load(CamelMboxSummary *mbs, int forceindex);
-/* incremental update */
-int camel_mbox_summary_update(CamelMboxSummary *mbs, off_t offset);
-/* perform a folder expunge */
-int camel_mbox_summary_expunge(CamelMboxSummary *mbs);
-
-#endif /* ! _CAMEL_MBOX_SUMMARY_H */
diff --git a/camel/providers/mbox/libcamelmbox.urls b/camel/providers/mbox/libcamelmbox.urls
deleted file mode 100644
index e021190356..0000000000
--- a/camel/providers/mbox/libcamelmbox.urls
+++ /dev/null
@@ -1 +0,0 @@
-mbox