From c6fc4e27a953c5213cff8400ec8e40f6f051e914 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 25 Mar 2002 12:11:44 +0000 Subject: When we add a new name, up all of the cache limits, because we're probably 2002-03-25 Not Zed * camel-text-index.c (text_index_add_name): When we add a new name, up all of the cache limits, because we're probably going to be adding more. (text_index_sync): Drop the cache limits back down again, we dont need them when looking words up. ** MERGE camel_index branch. * camel-text-index.[ch]: Added files i forgot to add (eep nearly lost all this work!) * camel-block-file.c (sync_nolock): Fix an infinite loop in syncing. svn path=/trunk/; revision=16242 --- camel/providers/local/camel-local-folder.c | 29 +++++++++------ camel/providers/local/camel-local-folder.h | 6 ++-- camel/providers/local/camel-local-store.c | 15 ++++---- camel/providers/local/camel-local-summary.c | 10 ++++-- camel/providers/local/camel-local-summary.h | 6 ++-- camel/providers/local/camel-maildir-folder.c | 4 +-- camel/providers/local/camel-maildir-summary.c | 51 +++++++++++++++++++++++---- camel/providers/local/camel-maildir-summary.h | 4 +-- camel/providers/local/camel-mbox-folder.c | 4 +-- camel/providers/local/camel-mbox-store.c | 2 ++ camel/providers/local/camel-mbox-summary.c | 8 +++-- camel/providers/local/camel-mbox-summary.h | 2 +- camel/providers/local/camel-mh-folder.c | 4 +-- camel/providers/local/camel-mh-summary.c | 14 ++++---- camel/providers/local/camel-mh-summary.h | 4 +-- camel/providers/local/camel-spool-folder.h | 4 +-- camel/providers/local/camel-spool-summary.c | 5 ++- camel/providers/local/camel-spool-summary.h | 4 +-- camel/providers/local/camel-spoold-store.c | 2 +- 19 files changed, 120 insertions(+), 58 deletions(-) (limited to 'camel/providers/local') diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index d84041025c..0344fc8952 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -50,6 +50,8 @@ #include "camel-local-private.h" +#include "camel-text-index.h" + #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/ #ifndef PATH_MAX @@ -138,9 +140,8 @@ local_finalize(CamelObject * object) camel_object_unref((CamelObject *)local_folder->search); } - /* must free index after summary, since it isn't refcounted */ if (local_folder->index) - ibex_close(local_folder->index); + camel_object_unref((CamelObject *)local_folder->index); while (local_folder->locked> 0) camel_local_folder_unlock(local_folder); @@ -211,10 +212,17 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con lf->changes = camel_folder_change_info_new(); - /* if we have no index file, force it */ - forceindex = stat(lf->index_path, &st) == -1; + /* TODO: Remove the following line, it is a temporary workaround to remove + the old-format 'ibex' files that might be lying around */ + unlink(lf->index_path); + + /* if we have no/invalid index file, force it */ + forceindex = camel_text_index_check(lf->index_path) == -1; if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) { - lf->index = ibex_open(lf->index_path, O_CREAT | O_RDWR, 0600); + int flag = O_RDWR|O_CREAT; + if (forceindex) + flag |= O_TRUNC; + lf->index = (CamelIndex *)camel_text_index_new(lf->index_path, flag); if (lf->index == NULL) { /* yes, this isn't fatal at all */ g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno)); @@ -223,10 +231,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX; } } else { - /* if we do have an index file, remove it */ - if (forceindex == FALSE) { - unlink(lf->index_path); - } + /* if we do have an index file, remove it (?) */ + if (forceindex == FALSE) + camel_text_index_remove(lf->index_path); forceindex = FALSE; } @@ -237,7 +244,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con camel_exception_clear(ex); } - if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) { + /*if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {*/ + /* we sync here so that any hard work setting up the folder isn't lost */ + if (camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, lf->changes, ex) == -1) { camel_object_unref (CAMEL_OBJECT (folder)); return NULL; } diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h index 3eb4b02c32..c958bde835 100644 --- a/camel/providers/local/camel-local-folder.h +++ b/camel/providers/local/camel-local-folder.h @@ -29,7 +29,7 @@ extern "C" { #include #include -#include +#include #include "camel-local-summary.h" #include "camel-lock.h" @@ -54,7 +54,7 @@ typedef struct { char *summary_path; /* where the summary lives */ char *index_path; /* where the index file lives */ - ibex *index; /* index for this folder */ + CamelIndex *index; /* index for this folder */ CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */ CamelFolderChangeInfo *changes; /* used to store changes to the folder during processing */ } CamelLocalFolder; @@ -65,7 +65,7 @@ typedef struct { /* Virtual methods */ /* summary factory, only used at init */ - CamelLocalSummary *(*create_summary)(const char *path, const char *folder, ibex *index); + CamelLocalSummary *(*create_summary)(const char *path, const char *folder, CamelIndex *index); /* Lock the folder for my operations */ int (*lock)(CamelLocalFolder *, CamelLockType type, CamelException *ex); diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index daa70979dc..0e7be5f48b 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -38,6 +38,7 @@ #include "camel-url.h" #include "camel-local-folder.h" +#include #define d(x) @@ -321,11 +322,12 @@ rename_folder(CamelStore *store, const char *old, const char *new, CamelExceptio CAMEL_STORE_LOCK(store, cache_lock); folder = g_hash_table_lookup(store->folders, old); - if (folder) { - if (folder->index && ibex_move(folder->index, newibex) == -1) + if (folder && folder->index) { + if (folder->index && camel_index_rename(folder->index, newibex) == -1) goto ibex_failed; } else { - if (xrename(old, new, path, ".ibex", TRUE, ex)) + /* TODO: camel_text_index_rename should find out if we have an active index itself? */ + if (camel_text_index_rename(oldibex, newibex) == -1) goto ibex_failed; } @@ -348,10 +350,9 @@ base_failed: summary_failed: if (folder) { if (folder->index) - ibex_move(folder->index, oldibex); + camel_index_rename(folder->index, oldibex); } else - xrename(new, old, path, ".ibex", TRUE, ex); - + camel_text_index_rename(newibex, oldibex); ibex_failed: CAMEL_STORE_UNLOCK(store, cache_lock); g_free(newibex); @@ -379,7 +380,7 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) } g_free(str); str = g_strdup_printf("%s.ibex", name); - if (unlink(str) == -1 && errno != ENOENT) { + if (camel_text_index_remove(str) == -1 && errno != ENOENT) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not delete folder index file `%s': %s"), str, strerror(errno)); diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c index 508c7e0831..eae265d5a6 100644 --- a/camel/providers/local/camel-local-summary.c +++ b/camel/providers/local/camel-local-summary.c @@ -118,16 +118,20 @@ camel_local_summary_finalise(CamelObject *obj) { CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(obj); + if (mbs->index) + camel_object_unref((CamelObject *)mbs->index); g_free(mbs->folder_path); } void -camel_local_summary_construct(CamelLocalSummary *new, const char *filename, const char *local_name, ibex *index) +camel_local_summary_construct(CamelLocalSummary *new, const char *filename, const char *local_name, CamelIndex *index) { camel_folder_summary_set_build_content(CAMEL_FOLDER_SUMMARY(new), FALSE); camel_folder_summary_set_filename(CAMEL_FOLDER_SUMMARY(new), filename); new->folder_path = g_strdup(local_name); new->index = index; + if (index) + camel_object_ref((CamelObject *)index); } static int @@ -368,7 +372,7 @@ local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeIn g_warning("Could not save summary for %s: %s", cls->folder_path, strerror(errno)); } - if (cls->index && ibex_save(cls->index) == -1) + if (cls->index && camel_index_sync(cls->index) == -1) g_warning("Could not sync index for %s: %s", cls->folder_path, strerror(errno)); return ret; @@ -566,7 +570,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h) if (cls->index && (doindex || cls->index_force - || !ibex_contains_name(cls->index, (char *)camel_message_info_uid(mi)))) { + || !camel_index_has_name(cls->index, camel_message_info_uid(mi)))) { d(printf("Am indexing message %s\n", camel_message_info_uid(mi))); camel_folder_summary_set_index(s, cls->index); } else { diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h index e9c570deb1..4a4db952d2 100644 --- a/camel/providers/local/camel-local-summary.h +++ b/camel/providers/local/camel-local-summary.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define CAMEL_LOCAL_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_local_summary_get_type (), CamelLocalSummary) #define CAMEL_LOCAL_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_local_summary_get_type (), CamelLocalSummaryClass) @@ -46,7 +46,7 @@ struct _CamelLocalSummary { char *folder_path; /* name of matching folder */ - ibex *index; + CamelIndex *index; int index_force; /* do we force index during creation? */ }; @@ -63,7 +63,7 @@ struct _CamelLocalSummaryClass { }; guint camel_local_summary_get_type (void); -void camel_local_summary_construct (CamelLocalSummary *new, const char *filename, const char *local_name, ibex *index); +void camel_local_summary_construct (CamelLocalSummary *new, const char *filename, const char *local_name, CamelIndex *index); /* load/check the summary */ int camel_local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex); diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index 5336cb39c3..7bf998bff9 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -50,7 +50,7 @@ static CamelLocalFolderClass *parent_class = NULL; #define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) #define CMAILDIRS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) -static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, ibex *index); +static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, CamelIndex *index); static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex); static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex); @@ -120,7 +120,7 @@ camel_maildir_folder_new(CamelStore *parent_store, const char *full_name, guint3 return folder; } -static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, ibex *index) +static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, CamelIndex *index) { return (CamelLocalSummary *)camel_maildir_summary_new(path, folder, index); } diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c index 1cfcf50a88..b0bd172257 100644 --- a/camel/providers/local/camel-maildir-summary.c +++ b/camel/providers/local/camel-maildir-summary.c @@ -22,7 +22,9 @@ #include #endif +#include #include +#include #include #include #include @@ -36,6 +38,7 @@ #include "camel-maildir-summary.h" #include +#include #include "camel-private.h" #include "e-util/e-memory.h" @@ -152,7 +155,7 @@ camel_maildir_summary_finalise(CamelObject *obj) * * Return value: A new #CamelMaildirSummary object. **/ -CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, ibex *index) +CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, CamelIndex *index) { CamelMaildirSummary *o = (CamelMaildirSummary *)camel_object_new(camel_maildir_summary_get_type ()); @@ -457,7 +460,7 @@ static int camel_maildir_summary_add(CamelLocalSummary *cls, const char *name, i mp = camel_mime_parser_new(); camel_mime_parser_scan_from(mp, FALSE); camel_mime_parser_init_with_fd(mp, fd); - if (cls->index && (forceindex || !ibex_contains_name(cls->index, (char *)name))) { + if (cls->index && (forceindex || !camel_index_has_name(cls->index, name))) { d(printf("forcing indexing of message content\n")); camel_folder_summary_set_index((CamelFolderSummary *)maildirs, cls->index); } else { @@ -477,7 +480,7 @@ remove_summary(char *key, CamelMessageInfo *info, CamelLocalSummary *cls) { d(printf("removing message %s from summary\n", key)); if (cls->index) - ibex_unindex(cls->index, (char *)camel_message_info_uid(info)); + camel_index_delete_name(cls->index, camel_message_info_uid(info)); camel_folder_summary_remove((CamelFolderSummary *)cls, info); camel_folder_summary_info_free((CamelFolderSummary *)cls, info); } @@ -507,7 +510,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca CamelMaildirMessageInfo *mdi; CamelFolderSummary *s = (CamelFolderSummary *)cls; GHashTable *left; - int i, count; + int i, count, total; int forceindex; char *new, *cur; char *uid; @@ -519,6 +522,8 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca d(printf("checking summary ...\n")); + camel_operation_start(NULL, _("Checking folder consistency")); + /* scan the directory, check for mail files not in the index, or index entries that no longer exist */ dir = opendir(cur); @@ -526,6 +531,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca camel_exception_setv(ex, 1, _("Cannot open maildir directory path: %s: %s"), cls->folder_path, strerror(errno)); g_free(cur); g_free(new); + camel_operation_end(NULL); return -1; } @@ -540,7 +546,19 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca } } + /* joy, use this to pre-count the total, so we can report progress meaningfully */ + total = 0; + count = 0; + while ( (d = readdir(dir)) ) + total++; + rewinddir(dir); + while ( (d = readdir(dir)) ) { + int pc = count * 100 / total; + + camel_operation_progress(NULL, pc); + count++; + /* FIXME: also run stat to check for regular file */ p = d->d_name; if (p[0] == '.') @@ -554,7 +572,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca uid = g_strdup(d->d_name); info = camel_folder_summary_uid((CamelFolderSummary *)cls, uid); - if (info == NULL || (cls->index && (!ibex_contains_name(cls->index, uid)))) { + if (info == NULL || (cls->index && (!camel_index_has_name(cls->index, uid)))) { /* need to add this file to the summary */ if (info != NULL) { CamelMessageInfo *old = g_hash_table_lookup(left, camel_message_info_uid(info)); @@ -606,12 +624,26 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca g_hash_table_foreach(left, (GHFunc)remove_summary, cls); g_hash_table_destroy(left); + camel_operation_end(NULL); + + camel_operation_start(NULL, _("Checking for new messages")); + /* now, scan new for new messages, and copy them to cur, and so forth */ dir = opendir(new); if (dir != NULL) { + total = 0; + count = 0; + while ( (d = readdir(dir)) ) + total++; + rewinddir(dir); + while ( (d = readdir(dir)) ) { char *name, *newname, *destname, *destfilename; char *src, *dest; + int pc = count * 100 / total; + + camel_operation_progress(NULL, pc); + count++; name = d->d_name; if (name[0] == '.') @@ -650,6 +682,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca g_free(src); g_free(dest); } + camel_operation_end(NULL); } closedir(dir); @@ -682,8 +715,12 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange if (camel_local_summary_check(cls, changes, ex) == -1) return -1; + camel_operation_start(NULL, _("Storing folder")); + count = camel_folder_summary_count((CamelFolderSummary *)cls); for (i=count-1;i>=0;i--) { + camel_operation_progress(NULL, (count-i)*100/count); + info = camel_folder_summary_index((CamelFolderSummary *)cls, i); mdi = (CamelMaildirMessageInfo *)info; if (info && (info->flags & CAMEL_MESSAGE_DELETED) && expunge) { @@ -693,7 +730,7 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange /* FIXME: put this in folder_summary::remove()? */ if (cls->index) - ibex_unindex(cls->index, (char *)camel_message_info_uid(info)); + camel_index_delete_name(cls->index, camel_message_info_uid(info)); camel_folder_change_info_remove_uid(changes, camel_message_info_uid(info)); camel_folder_summary_remove((CamelFolderSummary *)cls, info); @@ -748,6 +785,8 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange camel_folder_summary_info_free((CamelFolderSummary *)cls, info); } + camel_operation_end(NULL); + return ((CamelLocalSummaryClass *)parent_class)->sync(cls, expunge, changes, ex); } diff --git a/camel/providers/local/camel-maildir-summary.h b/camel/providers/local/camel-maildir-summary.h index 5362795ab2..0cae785c6c 100644 --- a/camel/providers/local/camel-maildir-summary.h +++ b/camel/providers/local/camel-maildir-summary.h @@ -24,7 +24,7 @@ #include "camel-local-summary.h" #include #include -#include +#include #define CAMEL_MAILDIR_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_maildir_summary_get_type (), CamelMaildirSummary) #define CAMEL_MAILDIR_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_maildir_summary_get_type (), CamelMaildirSummaryClass) @@ -66,7 +66,7 @@ struct _CamelMaildirSummaryClass { }; CamelType camel_maildir_summary_get_type (void); -CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, ibex *index); +CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, CamelIndex *index); /* convert some info->flags to/from the messageinfo */ char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info); diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index c2b98c9aa3..bef6b64436 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -60,7 +60,7 @@ static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, cons static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex); static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex); -static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, ibex *index); +static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, CamelIndex *index); static void mbox_finalise(CamelObject * object); @@ -134,7 +134,7 @@ camel_mbox_folder_new(CamelStore *parent_store, const char *full_name, guint32 f return folder; } -static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, ibex *index) +static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, CamelIndex *index) { return (CamelLocalSummary *)camel_mbox_summary_new(path, folder, index); } diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index f401632b8d..3333580766 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -23,7 +23,9 @@ #include #endif +#include #include +#include #include #include #include diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index 697e806e53..2d06d29a38 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -27,7 +27,9 @@ #include "camel/camel-mime-message.h" #include "camel/camel-operation.h" +#include #include +#include #include #include #include @@ -136,7 +138,7 @@ camel_mbox_summary_finalise(CamelObject *obj) * Return value: A new CamelMboxSummary widget. **/ CamelMboxSummary * -camel_mbox_summary_new(const char *filename, const char *mbox_name, ibex *index) +camel_mbox_summary_new(const char *filename, const char *mbox_name, CamelIndex *index) { CamelMboxSummary *new = (CamelMboxSummary *)camel_object_new(camel_mbox_summary_get_type()); @@ -289,7 +291,7 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset, CamelException *ex) off_t pc = camel_mime_parser_tell_start_from (mp) + 1; camel_operation_progress (NULL, (int) (((float) pc / size) * 100)); - + info = camel_folder_summary_add_from_parser(s, mp); if (info == NULL) { camel_exception_setv(ex, 1, _("Fatal mail parser error near position %ld in folder %s"), @@ -560,7 +562,7 @@ mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChan d(printf("Deleting %s\n", uid)); if (cls->index) - ibex_unindex(cls->index, (char *)uid); + camel_index_delete_name(cls->index, uid); /* remove it from the change list */ camel_folder_change_info_remove_uid(changeinfo, uid); diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h index 82d200c854..ec4d015489 100644 --- a/camel/providers/local/camel-mbox-summary.h +++ b/camel/providers/local/camel-mbox-summary.h @@ -53,7 +53,7 @@ struct _CamelMboxSummaryClass { }; guint camel_mbox_summary_get_type (void); -CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index); +CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, CamelIndex *index); /* generate a From line from headers */ char *camel_mbox_summary_build_from(struct _header_raw *header); diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c index 6795ab3fbf..3d08bdb60a 100644 --- a/camel/providers/local/camel-mh-folder.c +++ b/camel/providers/local/camel-mh-folder.c @@ -50,7 +50,7 @@ static CamelLocalFolderClass *parent_class = NULL; #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 CamelLocalSummary *mh_create_summary(const char *path, const char *folder, ibex *index); +static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, CamelIndex *index); static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex); static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex); @@ -115,7 +115,7 @@ camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 fla return folder; } -static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, ibex *index) +static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, CamelIndex *index) { return (CamelLocalSummary *)camel_mh_summary_new(path, folder, index); } diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c index 06c5715d0d..530baa3caf 100644 --- a/camel/providers/local/camel-mh-summary.c +++ b/camel/providers/local/camel-mh-summary.c @@ -22,14 +22,16 @@ #include #endif +#include #include +#include + #include #include #include #include #include -#include #include #include @@ -118,7 +120,7 @@ camel_mh_summary_finalise(CamelObject *obj) * * Return value: A new #CamelMhSummary object. **/ -CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index) +CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, CamelIndex *index) { CamelMhSummary *o = (CamelMhSummary *)camel_object_new(camel_mh_summary_get_type ()); @@ -171,7 +173,7 @@ static int camel_mh_summary_add(CamelLocalSummary *cls, const char *name, int fo mp = camel_mime_parser_new(); camel_mime_parser_scan_from(mp, FALSE); camel_mime_parser_init_with_fd(mp, fd); - if (cls->index && (forceindex || !ibex_contains_name(cls->index, (char *)name))) { + if (cls->index && (forceindex || !camel_index_has_name(cls->index, name))) { d(printf("forcing indexing of message content\n")); camel_folder_summary_set_index((CamelFolderSummary *)mhs, cls->index); } else { @@ -191,7 +193,7 @@ remove_summary(char *key, CamelMessageInfo *info, CamelLocalSummary *cls) { d(printf("removing message %s from summary\n", key)); if (cls->index) - ibex_unindex(cls->index, (char *)camel_message_info_uid(info)); + camel_index_delete_name(cls->index, camel_message_info_uid(info)); camel_folder_summary_remove((CamelFolderSummary *)cls, info); camel_folder_summary_info_free((CamelFolderSummary *)cls, info); } @@ -239,7 +241,7 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came } if (c==0) { info = camel_folder_summary_uid((CamelFolderSummary *)cls, d->d_name); - if (info == NULL || (cls->index && (!ibex_contains_name(cls->index, d->d_name)))) { + if (info == NULL || (cls->index && (!camel_index_has_name(cls->index, d->d_name)))) { /* need to add this file to the summary */ if (info != NULL) { g_hash_table_remove(left, camel_message_info_uid(info)); @@ -368,7 +370,7 @@ mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo /* FIXME: put this in folder_summary::remove()? */ if (cls->index) - ibex_unindex(cls->index, (char *)uid); + camel_index_delete_name(cls->index, (char *)uid); camel_folder_change_info_remove_uid(changes, uid); camel_folder_summary_remove((CamelFolderSummary *)cls, info); diff --git a/camel/providers/local/camel-mh-summary.h b/camel/providers/local/camel-mh-summary.h index b24efbbfbf..4ee30df63b 100644 --- a/camel/providers/local/camel-mh-summary.h +++ b/camel/providers/local/camel-mh-summary.h @@ -24,7 +24,7 @@ #include "camel-local-summary.h" #include #include -#include +#include #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) @@ -47,7 +47,7 @@ struct _CamelMhSummaryClass { }; CamelType camel_mh_summary_get_type (void); -CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index); +CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, CamelIndex *index); #endif /* ! _CAMEL_MH_SUMMARY_H */ diff --git a/camel/providers/local/camel-spool-folder.h b/camel/providers/local/camel-spool-folder.h index 79f3e9ec88..af43e0dca1 100644 --- a/camel/providers/local/camel-spool-folder.h +++ b/camel/providers/local/camel-spool-folder.h @@ -29,7 +29,7 @@ extern "C" { #include #include -#include +#include #include "camel-spool-summary.h" #include "camel-lock.h" @@ -69,7 +69,7 @@ typedef struct { /* Virtual methods */ /* summary factory, only used at init */ - CamelSpoolSummary *(*create_summary)(const char *path, const char *folder, ibex *index); + CamelSpoolSummary *(*create_summary)(const char *path, const char *folder, CamelIndex *index); /* Lock the folder for my operations */ int (*lock)(CamelSpoolFolder *, CamelLockType type, CamelException *ex); diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c index 823b26fc77..d8c85b9e6d 100644 --- a/camel/providers/local/camel-spool-summary.c +++ b/camel/providers/local/camel-spool-summary.c @@ -23,14 +23,17 @@ #include #endif -#include +#include #include +#include #include #include #include #include #include +#include + #include "camel-spool-summary.h" #include "camel-mime-message.h" #include "camel-file-utils.h" diff --git a/camel/providers/local/camel-spool-summary.h b/camel/providers/local/camel-spool-summary.h index e0b63a1b6b..5b20e1dfbe 100644 --- a/camel/providers/local/camel-spool-summary.h +++ b/camel/providers/local/camel-spool-summary.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define CAMEL_SPOOL_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_spool_summary_get_type (), CamelSpoolSummary) #define CAMEL_SPOOL_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_spool_summary_get_type (), CamelSpoolSummaryClass) @@ -68,7 +68,7 @@ struct _CamelSpoolSummaryClass { }; guint camel_spool_summary_get_type (void); -void camel_spool_summary_construct (CamelSpoolSummary *new, const char *filename, const char *spool_name, ibex *index); +void camel_spool_summary_construct (CamelSpoolSummary *new, const char *filename, const char *spool_name, CamelIndex *index); /* create the summary, in-memory only */ CamelSpoolSummary *camel_spool_summary_new(const char *filename); diff --git a/camel/providers/local/camel-spoold-store.c b/camel/providers/local/camel-spoold-store.c index addd727214..aba994cc91 100644 --- a/camel/providers/local/camel-spoold-store.c +++ b/camel/providers/local/camel-spoold-store.c @@ -259,7 +259,7 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch uri = g_strdup_printf("spoold:%s;noselect=yes#%s", root, path); tmp = strrchr(path, '/'); if (tmp == NULL) - tmp = path; + tmp = (char *)path; else tmp++; fi = camel_folder_info_new(uri, path, tmp, -1); -- cgit