aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/mh
diff options
context:
space:
mode:
authornobody <nobody@localhost>2000-11-07 05:40:14 +0800
committernobody <nobody@localhost>2000-11-07 05:40:14 +0800
commit4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a (patch)
tree786145ed8b82796d89e41d2ed37058c0097ace13 /camel/providers/mh
parentb4c61eba8055f666fd8a2270879a6f9722faa2b3 (diff)
downloadgsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar.gz
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar.bz2
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar.lz
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar.xz
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.tar.zst
gsoc2013-evolution-4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a.zip
This commit was manufactured by cvs2svn to create tag 'BONOBO_0_31'.BONOBO_0_31
svn path=/tags/BONOBO_0_31/; revision=6435
Diffstat (limited to 'camel/providers/mh')
-rw-r--r--camel/providers/mh/.cvsignore7
-rw-r--r--camel/providers/mh/Makefile.am39
-rw-r--r--camel/providers/mh/camel-mh-folder.c534
-rw-r--r--camel/providers/mh/camel-mh-folder.h74
-rw-r--r--camel/providers/mh/camel-mh-provider.c56
-rw-r--r--camel/providers/mh/camel-mh-store.c228
-rw-r--r--camel/providers/mh/camel-mh-store.h59
-rw-r--r--camel/providers/mh/camel-mh-summary.c279
-rw-r--r--camel/providers/mh/camel-mh-summary.h62
-rw-r--r--camel/providers/mh/libcamelmh.urls1
10 files changed, 0 insertions, 1339 deletions
diff --git a/camel/providers/mh/.cvsignore b/camel/providers/mh/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/mh/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/mh/Makefile.am b/camel/providers/mh/Makefile.am
deleted file mode 100644
index 62f447171b..0000000000
--- a/camel/providers/mh/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-libcamelmhincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelmh.la
-provider_DATA = libcamelmh.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-mh-provider\"
-
-libcamelmh_la_SOURCES = \
- camel-mh-folder.c \
- camel-mh-provider.c \
- camel-mh-store.c \
- camel-mh-summary.c
-
-libcamelmhinclude_HEADERS = \
- camel-mh-folder.h \
- camel-mh-store.h \
- camel-mh-summary.h
-
-libcamelmh_la_LDFLAGS = -version-info 0:0:0
-
-libcamelmh_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-#libcamelmh_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST = libcamelmh.urls
-
diff --git a/camel/providers/mh/camel-mh-folder.c b/camel/providers/mh/camel-mh-folder.c
deleted file mode 100644
index a56de4a9c1..0000000000
--- a/camel/providers/mh/camel-mh-folder.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mh-folder.c : Abstract class for an email folder */
-
-/*
- * Authors: 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-mh-folder.h"
-#include "camel-mh-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-mh-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 CamelMhFolder */
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMHS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex);
-static gint mh_get_message_count(CamelFolder * folder);
-static gint mh_get_unread_message_count(CamelFolder * folder);
-static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
-static GPtrArray *mh_get_uids(CamelFolder * folder);
-static GPtrArray *mh_get_summary(CamelFolder * folder);
-static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
-
-static void mh_expunge(CamelFolder * folder, CamelException * ex);
-
-static const CamelMessageInfo *mh_get_message_info(CamelFolder * folder, const char *uid);
-
-static GPtrArray *mh_search_by_expression(CamelFolder * folder, const char *expression, CamelException * ex);
-static void mh_search_free(CamelFolder *folder, GPtrArray *result);
-
-static guint32 mh_get_message_flags(CamelFolder * folder, const char *uid);
-static void mh_set_message_flags(CamelFolder * folder, const char *uid, guint32 flags, guint32 set);
-static gboolean mh_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name);
-static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value);
-static const char *mh_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name);
-static void mh_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-
-static void mh_finalize(CamelObject * object);
-
-static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_mh_folder_class);
-
- parent_class = CAMEL_FOLDER_CLASS (camel_type_get_global_classfuncs(camel_folder_get_type()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->sync = mh_sync;
- camel_folder_class->get_message_count = mh_get_message_count;
- camel_folder_class->get_unread_message_count = mh_get_unread_message_count;
- camel_folder_class->append_message = mh_append_message;
- camel_folder_class->get_uids = mh_get_uids;
- camel_folder_class->free_uids = camel_folder_free_deep;
- camel_folder_class->get_summary = mh_get_summary;
- camel_folder_class->free_summary = camel_folder_free_nop;
- camel_folder_class->expunge = mh_expunge;
-
- camel_folder_class->get_message = mh_get_message;
-
- camel_folder_class->search_by_expression = mh_search_by_expression;
- camel_folder_class->search_free = mh_search_free;
-
- camel_folder_class->get_message_info = mh_get_message_info;
-
- camel_folder_class->get_message_flags = mh_get_message_flags;
- camel_folder_class->set_message_flags = mh_set_message_flags;
- camel_folder_class->get_message_user_flag = mh_get_message_user_flag;
- camel_folder_class->set_message_user_flag = mh_set_message_user_flag;
- camel_folder_class->get_message_user_tag = mh_get_message_user_tag;
- camel_folder_class->set_message_user_tag = mh_set_message_user_tag;
-}
-
-static void mh_init(gpointer object, gpointer klass)
-{
- CamelFolder *folder = object;
- CamelMhFolder *mh_folder = object;
-
- folder->has_summary_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 | CAMEL_MESSAGE_USER;
-
- mh_folder->summary = NULL;
- mh_folder->search = NULL;
- mh_folder->changes = camel_folder_change_info_new();
-}
-
-static void mh_finalize(CamelObject * object)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(object);
-
- if (mh_folder->index)
- ibex_close(mh_folder->index);
-
- g_free(mh_folder->folder_file_path);
- g_free(mh_folder->summary_file_path);
- g_free(mh_folder->folder_dir_path);
- g_free(mh_folder->index_file_path);
- camel_folder_change_info_free(mh_folder->changes);
-}
-
-CamelType camel_mh_folder_get_type(void)
-{
- static CamelType camel_mh_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_mh_folder_type == CAMEL_INVALID_TYPE) {
- camel_mh_folder_type = camel_type_register(CAMEL_FOLDER_TYPE, "CamelMhFolder",
- sizeof(CamelMhFolder),
- sizeof(CamelMhFolderClass),
- (CamelObjectClassInitFunc) camel_mh_folder_class_init,
- NULL,
- (CamelObjectInitFunc) mh_init,
- (CamelObjectFinalizeFunc) mh_finalize);
- }
-
- return camel_mh_folder_type;
-}
-
-CamelFolder *
-camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
-{
- CamelFolder *folder;
- CamelMhFolder *mh_folder;
- const char *root_dir_path, *name;
- int forceindex;
- struct stat st;
-
- folder = CAMEL_FOLDER (camel_object_new(CAMEL_MH_FOLDER_TYPE));
- mh_folder = (CamelMhFolder *)folder;
-
- name = strrchr(full_name, '/');
- if (name)
- name++;
- else
- name = full_name;
- camel_folder_construct (folder, parent_store, full_name, name);
-
- root_dir_path = camel_mh_store_get_toplevel_dir(CAMEL_MH_STORE(folder->parent_store));
-
- mh_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
- mh_folder->summary_file_path = g_strdup_printf("%s/%s/ev-summary", root_dir_path, full_name);
- mh_folder->folder_dir_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
- mh_folder->index_file_path = g_strdup_printf("%s/%s/ev-index.ibex", root_dir_path, full_name);
-
- /* if we have no index file, force it */
- forceindex = stat(mh_folder->index_file_path, &st) == -1;
- /* check if we need to setup an index */
- if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) {
- mh_folder->index = ibex_open(mh_folder->index_file_path, O_CREAT | O_RDWR, 0600);
- if (mh_folder->index == NULL) {
- /* yes, this isn't fatal at all */
- g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno));
- forceindex = FALSE;
- }
- } else {
- /* if we do have an index file, remove it */
- if (forceindex == FALSE) {
- unlink(mh_folder->index_file_path);
- }
- forceindex = FALSE;
- }
-
- /* no summary (disk or memory), and we're proverbially screwed */
- mh_folder->summary = camel_mh_summary_new(mh_folder->summary_file_path,
- mh_folder->folder_file_path,
- mh_folder->index);
-
- if (camel_mh_summary_load(mh_folder->summary, forceindex) == -1) {
- camel_exception_set(ex, CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- _("Could not load or create summary"));
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
- return folder;
-}
-
-static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- if (expunge)
- mh_expunge(folder, ex);
- else {
- camel_mh_summary_sync(mh_folder->summary, FALSE, mh_folder->changes, ex);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
- camel_folder_change_info_clear(mh_folder->changes);
- }
-
- /* save index */
- if (mh_folder->index)
- ibex_save(mh_folder->index);
- if (mh_folder->summary)
- camel_folder_summary_save(CAMEL_FOLDER_SUMMARY(mh_folder->summary));
-}
-
-static void mh_expunge(CamelFolder * folder, CamelException * ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- camel_mh_summary_sync(mh_folder->summary, TRUE, mh_folder->changes, ex);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
- camel_folder_change_info_clear(mh_folder->changes);
-}
-
-static gint mh_get_message_count(CamelFolder * folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- g_return_val_if_fail(mh_folder->summary != NULL, -1);
-
- return camel_folder_summary_count(CAMEL_FOLDER_SUMMARY(mh_folder->summary));
-}
-
-static gint mh_get_unread_message_count(CamelFolder * folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelMessageInfo *info;
- GPtrArray *infolist;
- gint i, count = 0;
-
- g_return_val_if_fail(mh_folder->summary != NULL, -1);
-
- infolist = mh_get_summary(folder);
-
- for (i = 0; i < infolist->len; i++) {
- info = (CamelMessageInfo *) g_ptr_array_index(infolist, i);
- if (!(info->flags & CAMEL_MESSAGE_SEEN))
- count++;
- }
-
- return count;
-}
-
-static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelStream *output_stream = NULL;
- char *name = NULL;
- char *uid = NULL;
- CamelMessageInfo *newinfo;
-
- /* FIXME: probably needs additional locking */
-
- /* keep trying uid's until we find one thats ok */
- do {
- g_free(uid);
- g_free(name);
- uid = camel_folder_summary_next_uid_string((CamelFolderSummary *)mh_folder->summary);
- name = g_strdup_printf("%s/%s", mh_folder->folder_file_path, uid);
- output_stream = camel_stream_fs_new_with_name(name, O_WRONLY|O_CREAT|O_EXCL, 0600);
- } while (output_stream == NULL && errno == EEXIST);
-
- if (output_stream == NULL)
- goto fail;
-
- /* write the message */
- if (camel_data_wrapper_write_to_stream(CAMEL_DATA_WRAPPER(message), output_stream) == -1)
- goto fail;
-
- if (camel_stream_close(output_stream) == -1)
- goto fail;
-
- /* index/summarise the message. Yes this re-reads it, its just simpler */
- camel_mh_summary_add(mh_folder->summary, uid, TRUE);
-
- if (info
- && (newinfo = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mh_folder->summary), uid))) {
- CamelFlag *flag = info->user_flags;
- CamelTag *tag = info->user_tags;
-
- newinfo->flags = info->flags;
- while (flag) {
- camel_flag_set(&newinfo->user_flags, flag->name, TRUE);
- flag = flag->next;
- }
- while (tag) {
- camel_tag_set(&newinfo->user_tags, tag->name, tag->value);
- tag = tag->next;
- }
- }
-
- camel_folder_change_info_add_uid(mh_folder->changes, uid);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", mh_folder->changes);
- camel_folder_change_info_clear(mh_folder->changes);
- g_free(name);
- g_free(uid);
- return;
-
-fail:
- if (camel_exception_is_set(ex)) {
- camel_exception_setv(ex, camel_exception_get_id(ex),
- _("Cannot append message to mh folder: %s"), camel_exception_get_description(ex));
- } else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to mh folder: %s"), g_strerror(errno));
- }
- if (output_stream)
- camel_object_unref(CAMEL_OBJECT(output_stream));
- if (name) {
- unlink(name);
- g_free(name);
- }
- g_free(uid);
-}
-
-static GPtrArray *mh_get_uids(CamelFolder * folder)
-{
- GPtrArray *array;
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- int i, count;
-
- count = camel_folder_summary_count(CAMEL_FOLDER_SUMMARY(mh_folder->summary));
- array = g_ptr_array_new();
- g_ptr_array_set_size(array, count);
- for (i = 0; i < count; i++) {
- CamelMessageInfo *info =
- camel_folder_summary_index(CAMEL_FOLDER_SUMMARY(mh_folder->summary), i);
-
- array->pdata[i] = g_strdup(info->uid);
- }
-
- return array;
-}
-
-static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelMessageInfo *info;
- char *name;
-
- name = g_strdup_printf("%s/%s", mh_folder->folder_file_path, uid);
-
- /* get the message summary info */
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mh_folder->summary), uid);
-
- if (info == NULL) {
- errno = ENOENT;
- goto fail;
- }
-
- message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0);
-
- /* where we read from */
- if (message_stream == NULL)
- goto fail;
-
- message = camel_mime_message_new();
- if (camel_data_wrapper_construct_from_stream(CAMEL_DATA_WRAPPER(message), message_stream) == -1) {
- g_warning("Construction failed");
- errno = EINVAL;
- goto fail;
- }
- camel_object_unref(CAMEL_OBJECT(message_stream));
- g_free(name);
-
- return message;
-
-fail:
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"),
- name, g_strerror(errno));
-
- if (message_stream)
- camel_object_unref(CAMEL_OBJECT(message_stream));
-
- if (message)
- camel_object_unref(CAMEL_OBJECT(message));
-
- g_free(name);
-
- return NULL;
-}
-
-GPtrArray *mh_get_summary(CamelFolder * folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- return CAMEL_FOLDER_SUMMARY(mh_folder->summary)->messages;
-}
-
-/* get a single message info, by uid */
-static const CamelMessageInfo *mh_get_message_info(CamelFolder * folder, const char *uid)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- return camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mh_folder->summary), uid);
-}
-
-static GPtrArray *mh_search_by_expression(CamelFolder * folder, const char *expression, CamelException * ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
-
- if (mh_folder->search == NULL) {
- mh_folder->search = camel_folder_search_new();
- }
-
- camel_folder_search_set_folder(mh_folder->search, folder);
- if (mh_folder->summary) {
- /* FIXME: dont access summary array directly? */
- camel_folder_search_set_summary(mh_folder->search,
- CAMEL_FOLDER_SUMMARY(mh_folder->summary)->messages);
- }
-
- camel_folder_search_set_body_index(mh_folder->search, mh_folder->index);
-
- return camel_folder_search_execute_expression(mh_folder->search, expression, ex);
-}
-
-static void mh_search_free(CamelFolder *folder, GPtrArray *result)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
-
- camel_folder_search_free_result(mh_folder->search, result);
-}
-
-static guint32 mh_get_message_flags(CamelFolder * folder, const char *uid)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_val_if_fail(info != NULL, 0);
-
- return info->flags;
-}
-
-static void mh_set_message_flags(CamelFolder * folder, const char *uid, guint32 flags, guint32 set)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_if_fail(info != NULL);
-
- info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary));
-
- camel_object_trigger_event (CAMEL_OBJECT(folder), "message_changed", (char *) uid);
-}
-
-static gboolean mh_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_val_if_fail(info != NULL, FALSE);
-
- return camel_flag_get(&info->user_flags, name);
-}
-
-static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_if_fail(info != NULL);
-
- camel_flag_set(&info->user_flags, name, value);
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary));
- camel_object_trigger_event (CAMEL_OBJECT(folder), "message_changed", (char *) uid);
-}
-
-static const char *mh_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_val_if_fail(info != NULL, FALSE);
-
- return camel_tag_get(&info->user_tags, name);
-}
-
-static void mh_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value)
-{
- CamelMessageInfo *info;
- CamelMhFolder *mf = CAMEL_MH_FOLDER(folder);
-
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_if_fail(info != NULL);
-
- camel_tag_set(&info->user_tags, name, value);
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary));
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
-}
diff --git a/camel/providers/mh/camel-mh-folder.h b/camel/providers/mh/camel-mh-folder.h
deleted file mode 100644
index ddfdf2b4aa..0000000000
--- a/camel/providers/mh/camel-mh-folder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.h : MH folder. */
-
-/*
- *
- * Authors:
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 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
- */
-
-#ifndef CAMEL_MH_FOLDER_H
-#define CAMEL_MH_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-search.h>
-#include <libibex/ibex.h>
-#include "camel-mh-summary.h"
-
-#define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ())
-#define CAMEL_MH_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder))
-#define CAMEL_MH_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass))
-#define IS_CAMEL_MH_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_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 */
- CamelMhSummary *summary;
- CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
- CamelFolderChangeInfo *changes; /* mass changes to the folder */
-} CamelMhFolder;
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMhFolderClass;
-
-/* public methods */
-CamelFolder *camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_mh_folder_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MH_FOLDER_H */
diff --git a/camel/providers/mh/camel-mh-provider.c b/camel/providers/mh/camel-mh-provider.c
deleted file mode 100644
index 74329a3203..0000000000
--- a/camel/providers/mh/camel-mh-provider.c
+++ /dev/null
@@ -1,56 +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-mh-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-#include "camel-url.h"
-
-static CamelProvider mh_provider = {
- "mh",
- N_("UNIX MH-format mail directories"),
-
- N_("For storing local mail in MH-like mail directories"),
-
- "mail",
-
- CAMEL_PROVIDER_IS_STORAGE,
-
- CAMEL_URL_NEED_PATH,
-
- {0, 0},
-
- NULL
-};
-
-void camel_provider_module_init(CamelSession * session)
-{
- mh_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mh_store_get_type();
-
- mh_provider.service_cache = g_hash_table_new(camel_url_hash, camel_url_equal);
-
- camel_session_register_provider(session, &mh_provider);
-}
diff --git a/camel/providers/mh/camel-mh-store.c b/camel/providers/mh/camel-mh-store.c
deleted file mode 100644
index 0a6da11162..0000000000
--- a/camel/providers/mh/camel-mh-store.c
+++ /dev/null
@@ -1,228 +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.
- *
- * 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 <config.h>
-
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "camel-mh-store.h"
-#include "camel-mh-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-/* Returns the class for a CamelMhStore */
-#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static char *get_name(CamelService * service, gboolean brief);
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex);
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex);
-static void rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex);
-static char *get_folder_name(CamelStore * store, const char *folder_name, CamelException * ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
-
-static void camel_mh_store_class_init(CamelObjectClass * camel_mh_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS(camel_mh_store_class);
- CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS(camel_mh_store_class);
-
- /* virtual method overload */
- camel_service_class->get_name = get_name;
-
- camel_store_class->get_folder = get_folder;
- camel_store_class->delete_folder = delete_folder;
- camel_store_class->rename_folder = rename_folder;
- camel_store_class->get_folder_name = get_folder_name;
- camel_store_class->get_folder_info = get_folder_info;
- camel_store_class->free_folder_info = camel_store_free_folder_info_full;
-}
-
-static void camel_mh_store_init(CamelObject * object)
-{
- CamelStore *store = CAMEL_STORE(object);
-
- /* mh names are filenames, so they are case-sensitive. */
- store->folders = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-CamelType camel_mh_store_get_type(void)
-{
- static CamelType camel_mh_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_mh_store_type == CAMEL_INVALID_TYPE) {
- camel_mh_store_type = camel_type_register(CAMEL_STORE_TYPE, "CamelMhStore",
- sizeof(CamelMhStore),
- sizeof(CamelMhStoreClass),
- (CamelObjectClassInitFunc) camel_mh_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mh_store_init,
- NULL);
- }
-
- return camel_mh_store_type;
-}
-
-const gchar *camel_mh_store_get_toplevel_dir(CamelMhStore * store)
-{
- CamelURL *url = CAMEL_SERVICE(store)->url;
-
- g_assert(url != NULL);
- return url->path;
-}
-
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex)
-{
- char *name;
- struct stat st;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
-
- if (stat(name, &st) == -1) {
- if (errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder `%s':\n%s"),
- folder_name, g_strerror(errno));
- g_free (name);
- return NULL;
- }
- if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Folder `%s' does not exist."), folder_name);
- g_free (name);
- return NULL;
- }
- printf("creating ...\n");
-
- if (mkdir(name, 0700) != 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create folder `%s':\n%s"),
- folder_name, g_strerror(errno));
- g_free (name);
- return NULL;
- }
- printf("created ok?\n");
-
- } else if (!S_ISDIR(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("`%s' is not a directory."), name);
- g_free (name);
- return NULL;
- }
- g_free(name);
-
- return camel_mh_folder_new(store, folder_name, flags, ex);
-}
-
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex)
-{
- char *name;
- struct stat st;
- char *str;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
- if (stat(name, &st) == -1) {
- if (errno != ENOENT)
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s': %s"),
- folder_name, strerror(errno));
- } else {
- /* this will 'fail' if there are still messages in the directory -
- but only the metadata is lost */
- str = g_strdup_printf("%s/ev-summary", name);
- unlink(str);
- g_free(str);
- str = g_strdup_printf("%s/ev-index.ibex", name);
- unlink(str);
- g_free(str);
- if (rmdir(name) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s': %s"),
- folder_name, strerror(errno));
- }
- }
- g_free(name);
-}
-
-static void rename_folder (CamelStore *store, const char *old_name, const char *new_name, CamelException *ex)
-{
- char *old, *new;
- struct stat st;
-
- old = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, old_name);
- new = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, new_name);
- if (stat(new, &st) == -1 && errno == ENOENT) {
- if (stat(old, &st) == 0 && S_ISDIR(st.st_mode)) {
- if (rename(old, new) != 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder `%s': %s"), old_name, strerror(errno));
- }
- } else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder `%s': %s"), old_name, strerror(errno));
- }
- } else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder `%s': %s exists"), old_name, new_name);
- }
-}
-
-static char *get_folder_name(CamelStore * store, const char *folder_name, CamelException * ex)
-{
- /* For now, we don't allow hieararchy. FIXME. */
- if (strchr(folder_name + 1, '/')) {
- camel_exception_set(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("MH folders may not be nested."));
- return NULL;
- }
-
- return *folder_name == '/' ? g_strdup(folder_name) : g_strdup_printf("/%s", folder_name);
-}
-
-static char *get_name(CamelService * service, gboolean brief)
-{
- if (brief)
- return g_strdup(service->url->path);
- else
- return g_strdup_printf(_("Local mail directory %s"), service->url->path);
-}
-
-
-static CamelFolderInfo *
-get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex)
-{
- /* FIXME: This is broken, but it corresponds to what was
- * there before.
- */
- return NULL;
-}
diff --git a/camel/providers/mh/camel-mh-store.h b/camel/providers/mh/camel-mh-store.h
deleted file mode 100644
index e2e2bbb656..0000000000
--- a/camel/providers/mh/camel-mh-store.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-store.h : class for an mh store */
-
-/*
- *
- * 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_MH_STORE_H
-#define CAMEL_MH_STORE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-#include "camel-store.h"
-#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
-#define CAMEL_MH_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
-#define CAMEL_MH_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
-#define IS_CAMEL_MH_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
-
-typedef struct {
- CamelStore parent_object;
-
-} CamelMhStore;
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelMhStoreClass;
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_mh_store_get_type(void);
-
-const gchar *camel_mh_store_get_toplevel_dir(CamelMhStore * store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MH_STORE_H */
diff --git a/camel/providers/mh/camel-mh-summary.c b/camel/providers/mh/camel-mh-summary.c
deleted file mode 100644
index c757a9a0a9..0000000000
--- a/camel/providers/mh/camel-mh-summary.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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 Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-mh-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>
-
-#include <sys/types.h>
-#include <dirent.h>
-
-#include <ctype.h>
-
-#define d(x)
-
-#define CAMEL_MH_SUMMARY_VERSION (0x2000)
-
-static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_raw *);
-
-static void camel_mh_summary_class_init (CamelMhSummaryClass *class);
-static void camel_mh_summary_init (CamelMhSummary *gspaper);
-static void camel_mh_summary_finalise (CamelObject *obj);
-
-#define _PRIVATE(x) (((CamelMhSummary *)(x))->priv)
-
-struct _CamelMhSummaryPrivate {
- char *current_uid;
-};
-
-static CamelFolderSummaryClass *parent_class;
-
-CamelType
-camel_mh_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_folder_summary_get_type (), "CamelMhSummary",
- sizeof(CamelMhSummary),
- sizeof(CamelMhSummaryClass),
- (CamelObjectClassInitFunc)camel_mh_summary_class_init,
- NULL,
- (CamelObjectInitFunc)camel_mh_summary_init,
- (CamelObjectFinalizeFunc)camel_mh_summary_finalise);
- }
-
- return type;
-}
-
-static void
-camel_mh_summary_class_init (CamelMhSummaryClass *class)
-{
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) class;
-
- parent_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs(camel_folder_summary_get_type ()));
-
- /* override methods */
- sklass->message_info_new = message_info_new;
-}
-
-static void
-camel_mh_summary_init (CamelMhSummary *o)
-{
- struct _CamelFolderSummary *s = (CamelFolderSummary *) o;
-
- o->priv = g_malloc0(sizeof(*o->priv));
-
- /* set unique file version */
- s->version += CAMEL_MH_SUMMARY_VERSION;
-}
-
-static void
-camel_mh_summary_finalise(CamelObject *obj)
-{
- CamelMhSummary *o = (CamelMhSummary *)obj;
-
- g_free(o->mh_path);
- g_free(o->priv);
-}
-
-/**
- * camel_mh_summary_new:
- *
- * Create a new CamelMhSummary object.
- *
- * Return value: A new #CamelMhSummary object.
- **/
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index)
-{
- CamelMhSummary *o = (CamelMhSummary *)camel_object_new(camel_mh_summary_get_type ());
-
- camel_folder_summary_set_build_content((CamelFolderSummary *)o, TRUE);
- camel_folder_summary_set_filename((CamelFolderSummary *)o, filename);
- o->mh_path = g_strdup(mhdir);
- o->index = index;
- return o;
-}
-
-static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
- CamelMhSummary *mhs = (CamelMhSummary *)s;
-
- mi = ((CamelFolderSummaryClass *) parent_class)->message_info_new(s, h);
- if (mi) {
- /* it only ever indexes 1 message at a time */
- mi->uid = g_strdup(mhs->priv->current_uid);
- }
-
- return mi;
-}
-
-int camel_mh_summary_load(CamelMhSummary * mhs, int forceindex)
-{
- CamelFolderSummary *s = CAMEL_FOLDER_SUMMARY(mhs);
-
- d(printf("loading summary ...\n"));
-
- if (forceindex || camel_folder_summary_load(s) == -1) {
- camel_folder_summary_clear(s);
- }
- return camel_mh_summary_check(mhs, forceindex);
-}
-
-int camel_mh_summary_add(CamelMhSummary * mhs, const char *name, int forceindex)
-{
- char *filename = g_strdup_printf("%s/%s", mhs->mh_path, name);
- int fd;
- CamelMimeParser *mp;
-
- d(printf("summarising: %s\n", name));
-
- fd = open(filename, O_RDONLY);
- if (fd == -1) {
- g_warning("Cannot summarise/index: %s: %s", filename, strerror(errno));
- g_free(filename);
- return -1;
- }
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, FALSE);
- camel_mime_parser_init_with_fd(mp, fd);
- if (mhs->index && (forceindex || !ibex_contains_name(mhs->index, (char *)name))) {
- d(printf("forcing indexing of message content\n"));
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, mhs->index);
- } else {
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, NULL);
- }
- mhs->priv->current_uid = (char *)name;
- camel_folder_summary_add_from_parser((CamelFolderSummary *)mhs, mp);
- camel_object_unref((CamelObject *)mp);
- mhs->priv->current_uid = NULL;
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, NULL);
- g_free(filename);
- return 0;
-}
-
-static void
-remove_summary(char *key, CamelMessageInfo *info, CamelMhSummary *mhs)
-{
- d(printf("removing message %s from summary\n", key));
- if (mhs->index)
- ibex_unindex(mhs->index, info->uid);
- camel_folder_summary_remove((CamelFolderSummary *)mhs, info);
-}
-
-int camel_mh_summary_check(CamelMhSummary * mhs, int forceindex)
-{
- DIR *dir;
- struct dirent *d;
- char *p, c;
- CamelMessageInfo *info;
- GHashTable *left;
- int i, count;
-
- d(printf("checking summary ...\n"));
-
- /* scan the directory, check for mail files not in the index, or index entries that
- no longer exist */
- dir = opendir(mhs->mh_path);
- if (dir == NULL)
- return -1;
-
- /* keeps track of all uid's that have not been processed */
- left = g_hash_table_new(g_str_hash, g_str_equal);
- count = camel_folder_summary_count((CamelFolderSummary *)mhs);
- for (i=0;i<count;i++) {
- info = camel_folder_summary_index((CamelFolderSummary *)mhs, i);
- if (info) {
- g_hash_table_insert(left, info->uid, info);
- }
- }
- while ( (d = readdir(dir)) ) {
- /* FIXME: also run stat to check for regular file */
- p = d->d_name;
- while ( (c = *p++) ) {
- if (!isdigit(c))
- break;
- }
- if (c==0) {
- info = camel_folder_summary_uid((CamelFolderSummary *)mhs, d->d_name);
- if (info == NULL || (mhs->index && (!ibex_contains_name(mhs->index, d->d_name)))) {
- /* need to add this file to the summary */
- if (info != NULL) {
- g_hash_table_remove(left, info->uid);
- camel_folder_summary_remove((CamelFolderSummary *)mhs, info);
- }
- camel_mh_summary_add(mhs, d->d_name, forceindex);
- } else {
- g_hash_table_remove(left, info->uid);
- }
- }
- }
- closedir(dir);
- g_hash_table_foreach(left, (GHFunc)remove_summary, mhs);
- g_hash_table_destroy(left);
-
- /* force a save of the index, just to make sure */
- /* note this could be expensive so possibly shouldn't be here
- as such */
- if (mhs->index) {
- ibex_save(mhs->index);
- }
-
- return 0;
-}
-
-/* sync the summary with the ondisk files.
- It doesnt store the state in the file, the summary only, == MUCH faster */
-int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- int count, i;
- CamelMessageInfo *info;
- char *name;
-
- printf("summary_sync(expunge=%s)\n", expunge?"true":"false");
-
- if (mhs->index) {
- ibex_save(mhs->index);
- }
- if (!expunge)
- return 0;
-
- count = camel_folder_summary_count((CamelFolderSummary *)mhs);
- for (i=count-1;i>=0;i--) {
- info = camel_folder_summary_index((CamelFolderSummary *)mhs, i);
- if (info && info->flags & CAMEL_MESSAGE_DELETED) {
- name = g_strdup_printf("%s/%s", mhs->mh_path, info->uid);
- d(printf("deleting %s\n", name));
- if (unlink(name) == 0 || errno==ENOENT) {
- camel_folder_change_info_remove_uid(changes, info->uid);
- camel_folder_summary_remove((CamelFolderSummary *)mhs, info);
- }
- }
- }
- return 0;
-}
-
diff --git a/camel/providers/mh/camel-mh-summary.h b/camel/providers/mh/camel-mh-summary.h
deleted file mode 100644
index 81aa91b418..0000000000
--- a/camel/providers/mh/camel-mh-summary.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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 Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MH_SUMMARY_H
-#define _CAMEL_MH_SUMMARY_H
-
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MH_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_mh_summary_get_type (), CamelMhSummary)
-#define CAMEL_MH_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mh_summary_get_type (), CamelMhSummaryClass)
-#define IS_CAMEL_MH_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_mh_summary_get_type ())
-
-typedef struct _CamelMhSummary CamelMhSummary;
-typedef struct _CamelMhSummaryClass CamelMhSummaryClass;
-
-struct _CamelMhSummary {
- CamelFolderSummary parent;
- struct _CamelMhSummaryPrivate *priv;
-
- char *mh_path;
- ibex *index;
-};
-
-struct _CamelMhSummaryClass {
- CamelFolderSummaryClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-CamelType camel_mh_summary_get_type (void);
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index);
-
-/* methods */
-int camel_mh_summary_load(CamelMhSummary * mhs, int forceindex);
-int camel_mh_summary_check(CamelMhSummary * mhs, int forceindex);
-int camel_mh_summary_add(CamelMhSummary * mhs, const char *name, int forceindex);
-int camel_mh_summary_sync(CamelMhSummary * mhs, int expunge, CamelFolderChangeInfo *changes, CamelException *ex);
-
-#endif /* ! _CAMEL_MH_SUMMARY_H */
-
diff --git a/camel/providers/mh/libcamelmh.urls b/camel/providers/mh/libcamelmh.urls
deleted file mode 100644
index 372daaa98f..0000000000
--- a/camel/providers/mh/libcamelmh.urls
+++ /dev/null
@@ -1 +0,0 @@
-mh