aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/vee/camel-vee-folder.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-11-30 19:05:36 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-11-30 19:05:36 +0800
commit1fbfdbd43e88e490ea11d56a3abde4631dab8cb5 (patch)
tree540ed9a6001f488d2f8918a8de07ea3f4acbae3b /camel/providers/vee/camel-vee-folder.c
parenta49aa686202136919d0988b81790c8b2b4a57e92 (diff)
downloadgsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar.gz
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar.bz2
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar.lz
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar.xz
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.tar.zst
gsoc2013-evolution-1fbfdbd43e88e490ea11d56a3abde4631dab8cb5.zip
Remove assertion that content is there, when it no longer can be.
2000-11-30 Not Zed <NotZed@HelixCode.com> * providers/local/camel-mbox-folder.c (mbox_get_message): Remove assertion that content is there, when it no longer can be. * camel-folder-summary.h: Removed pos/bodypos/endpos from camelmeessagecontentinfo. (CamelMessageFlags): Added an attachments flag. * providers/local/camel-local-summary.h: Added load virtual function. * tests/lib/folders.c (test_message_info): Accessors. (test_folder_message): " * camel-folder-thread.c (get_root_subject): Fix accessors. (dump_tree_rec): " * camel-folder-search.c (camel_folder_search_execute_expression): Accessors for messageinfo. (search_match_all): " (search_header_contains): " (search_header_contains): " (search_body_contains): " (camel_folder_search_execute_expression): Use mepool_strdup. * providers/local/camel-mbox-summary.c (summary_update): Accessors for messageinfo. (mbox_summary_sync_full): " * providers/local/camel-mh-summary.c (remove_summary): Accessors for messageinfo. (mh_summary_check): " (mh_summary_sync_message): " (mh_summary_sync): " * providers/local/camel-mh-folder.c (mh_append_message): Use accessor for uid. * providers/local/camel-local-summary.c (local_summary_decode_x_evolution): Use accessor to uid. (local_summary_encode_x_evolution): Likewise. (message_info_new): And here. (camel_local_summary_load): Call virtual load function. (local_summary_load): Default load function, load summary. (camel_local_summary_load): Check file exists before trying to load. (camel_local_summary_construct): Turn off building content info! (CAMEL_LOCAL_SUMMARY_VERSION): Bump, since we dont build content info anymore. (camel_local_summary_load): After a successful load/check, do a save too so we dont have to go through it again randomly. * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): Use accessors for messageinfo. * providers/nntp/camel-nntp-folder.c (nntp_folder_get_uids): Use accessors for uid. * providers/imap/camel-imap-folder.c (imap_refresh_info): Use accessor for uid. (imap_sync): Likewise. (imap_get_uids): Likewise. (imap_update_summary): And here. * providers/vee/camel-vee-folder.c (vfolder_remove_match): Use accessor for uid. (vfolder_add_match): Handle estrv stuff. (vfolder_change_match): Accessor for uid. (get_real_message): " (vee_get_uids): " (vee_folder_build): " + estrv. (vee_folder_build_folder): " * providers/local/camel-maildir-folder.c (maildir_append_message): Use acccessors for uid's. (maildir_get_message): Here too. * providers/local/camel-maildir-summary.c (camel_maildir_summary_init): Setup the string count for us. (message_info_new): Access the string array directly. (message_info_free): No need to free string if using array. (camel_maildir_summary_info_to_name): Use accessor to get to uid. (remove_summary): And here. (maildir_summary_check): Likewise. (maildir_summary_sync): And here. (maildir_summary_load): Load up a cache of uid->filename mappings before loading the actual summary file. This saves us having to waste the diskspace storing the filenames in the summary itself, and also helps us sync the summary better on load. (message_info_load): If we have the load_map setup, and the uid exists, then set the filename cache from it, and update the flags from the name, incase our summary mismatches it. * camel-folder-summary.c (camel_folder_summary_init): Setup string count for compressed info record. An optional compile mode which stores all strings for a given messageinfo into a packed array, which should save 36-50 bytes/record. (camel_folder_summary_info_new): Init the string array. (message_info_new): Set the string array items, as required. (message_info_load): And here too. (message_info_save): Use accessors to get to strings. (message_info_free): Free strings as one. (camel_message_info_dup_to): Handle packed array case. (camel_folder_summary_add): Use accessors. And pack the strv before storing it. (summary_assign_uid): New function to assign a unique uid to a message, if it doesn't have one. (camel_folder_summary_add): Call assign_uid instead of doing it ourselves. (camel_folder_summary_info_new_from_parser): " (camel_folder_summary_info_new_from_message): " (camel_folder_summary_encode_string): constify. (camel_folder_summary_encode_token): " (summary_build_content_info_message): Fix accessors to messageinfo. (CAMEL_FOLDER_SUMMARY_VERSION): Bumped, for removal of contentinfo->pos data. (camel_folder_summary_info_new_from_parser): Calculate the size based on the parser position, not the removed contentinfo stuff. (camel_folder_summary_info_new_from_message): Remove size stuff. (camel_folder_summary_offset_content): Removed, no longer means anything. (content_info_new): (content_info_load): (content_info_save): (summary_build_content_info): Remove stuff for contentinfo->pos*. (summary_build_content_info): Take a msginfo argument, set attachments flag if we find any attachments. (summary_build_content_info_message): set attachments flag if we find any attachments. (camel_folder_summary_info_new_from_parser): Always scan the content info, even if we dont save it. (camel_folder_summary_info_new_from_message): And here too. (summary_build_content_info): Only create the contentinfo stuff if we have it turned on, otherwise just parse and discard. (summary_build_content_info_message): Likewise. svn path=/trunk/; revision=6731
Diffstat (limited to 'camel/providers/vee/camel-vee-folder.c')
-rw-r--r--camel/providers/vee/camel-vee-folder.c74
1 files changed, 52 insertions, 22 deletions
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index 77c3017179..c8ac7f2059 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -28,6 +28,10 @@
#include "camel-folder-search.h"
#endif
+#ifdef DOESTRV
+#include "e-util/e-memory.h"
+#endif
+
#include <string.h>
/* our message info includes the parent folder */
@@ -210,11 +214,13 @@ camel_vee_folder_new (CamelStore *parent_store, const char *name, CamelException
static void
vfolder_remove_match(CamelVeeFolder *vf, CamelVeeMessageInfo *vinfo)
{
- printf("removing match %s\n", vinfo->info.uid);
+ const char *uid = camel_message_info_uid(vinfo);
+
+ printf("removing match %s\n", uid);
- g_hash_table_remove(vf->messages_uid, vinfo->info.uid);
+ g_hash_table_remove(vf->messages_uid, uid);
g_ptr_array_remove_fast(vf->messages, vinfo);
- camel_folder_change_info_remove_uid(vf->changes, vinfo->info.uid);
+ camel_folder_change_info_remove_uid(vf->changes, uid);
camel_message_info_free((CamelMessageInfo *)vinfo);
}
@@ -222,18 +228,26 @@ static CamelVeeMessageInfo *
vfolder_add_match(CamelVeeFolder *vf, CamelFolder *f, const CamelMessageInfo *info)
{
CamelVeeMessageInfo *mi;
+ char *uid;
mi = g_malloc0(sizeof(*mi));
camel_message_info_dup_to(info, (CamelMessageInfo*)mi);
+ uid = g_strdup_printf("%p:%s", f, camel_message_info_uid(info));
+#ifdef DOESTRV
+ mi->info.strings = e_strv_set_ref_free(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid);
+ mi->info.strings = e_strv_pack(mi->info.strings);
+#else
g_free (mi->info.uid);
- mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
+ mi->info.uid = uid;
+#endif
mi->folder = f;
g_ptr_array_add(vf->messages, mi);
- g_hash_table_insert(vf->messages_uid, mi->info.uid, mi);
+ uid = (char *)camel_message_info_uid(mi);
+ g_hash_table_insert(vf->messages_uid, uid, mi);
- printf("adding match %s\n", mi->info.uid);
+ printf("adding match %s\n", uid);
- camel_folder_change_info_add_uid(vf->changes, mi->info.uid);
+ camel_folder_change_info_add_uid(vf->changes, uid);
return mi;
}
#endif
@@ -244,7 +258,7 @@ vfolder_change_match(CamelVeeFolder *vf, CamelVeeMessageInfo *vinfo, const Camel
CamelFlag *flag;
CamelTag *tag;
- printf("changing match %s\n", vinfo->info.uid);
+ printf("changing match %s\n", camel_message_info_uid(vinfo));
vinfo->info.flags = info->flags;
camel_flag_list_free(&vinfo->info.user_flags);
@@ -259,7 +273,7 @@ vfolder_change_match(CamelVeeFolder *vf, CamelVeeMessageInfo *vinfo, const Camel
camel_tag_set(&vinfo->info.user_tags, tag->name, tag->value);
tag = tag->next;
}
- camel_folder_change_info_change_uid(vf->changes, vinfo->info.uid);
+ camel_folder_change_info_change_uid(vf->changes, camel_message_info_uid(vinfo));
}
static void
@@ -462,7 +476,7 @@ get_real_message(CamelFolder *folder, const char *uid, CamelFolder **out_folder,
g_return_val_if_fail(mi != NULL, FALSE);
*out_folder = mi->folder;
- *out_uid = strchr(mi->info.uid, ':')+1;
+ *out_uid = strchr(camel_message_info_uid(mi), ':')+1;
return TRUE;
}
@@ -505,7 +519,7 @@ static GPtrArray *vee_get_uids (CamelFolder *folder)
g_ptr_array_set_size (result, vf->messages->len);
for (i=0;i<vf->messages->len;i++) {
CamelMessageInfo *mi = g_ptr_array_index(vf->messages, i);
- result->pdata[i] = g_strdup(mi->uid);
+ result->pdata[i] = g_strdup(camel_message_info_uid(mi));
}
return result;
@@ -574,8 +588,7 @@ vee_get_message_user_flag(CamelFolder *folder, const char *uid, const char *name
}
static void
-vee_set_message_user_flag(CamelFolder *folder, const char *uid,
- const char *name, gboolean value)
+vee_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value)
{
const char *real_uid;
CamelFolder *real_folder;
@@ -627,13 +640,21 @@ vee_folder_build(CamelVeeFolder *vf, CamelException *ex)
for (i = 0; i < matches->len; i++) {
info = camel_folder_get_message_info(f, matches->pdata[i]);
if (info) {
+ char *uid;
+
mi = g_malloc0(sizeof(*mi));
camel_message_info_dup_to(info, (CamelMessageInfo *)mi);
- g_free (mi->info.uid);
- mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
+ uid = g_strdup_printf("%p:%s", f, camel_message_info_uid(info));
+#ifdef DOESTRV
+ mi->info.strings = e_strv_set_ref_free(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid);
+ mi->info.strings = e_strv_pack(mi->info.strings);
+#else
+ g_free(mi->info.uid);
+ mi->info.uid = uid;
+#endif
mi->folder = f;
g_ptr_array_add(messages, mi);
- g_hash_table_insert(messages_uid, mi->info.uid, mi);
+ g_hash_table_insert(messages_uid, (char *)camel_message_info_uid(mi), mi);
}
}
camel_folder_search_free(f, matches);
@@ -658,8 +679,9 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException
for (i=0;i<vf->messages->len;i++) {
CamelVeeMessageInfo *mi = g_ptr_array_index(vf->messages, i);
if (mi->folder == source) {
- camel_folder_change_info_add_source(vf->changes, mi->info.uid);
- g_hash_table_remove(vf->messages_uid, mi->info.uid);
+ const char *uid = camel_message_info_uid(mi);
+ camel_folder_change_info_add_source(vf->changes, uid);
+ g_hash_table_remove(vf->messages_uid, uid);
g_ptr_array_remove_index_fast(vf->messages, i);
camel_message_info_free((CamelMessageInfo *)mi);
@@ -674,15 +696,23 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException
for (i = 0; i < matches->len; i++) {
info = camel_folder_get_message_info(f, matches->pdata[i]);
if (info) {
+ char *uid;
+
mi = g_malloc0(sizeof(*mi));
camel_message_info_dup_to(info, (CamelMessageInfo*)mi);
+ uid = g_strdup_printf("%p:%s", f, camel_message_info_uid(info));
+#ifdef DOESTRV
+ mi->info.strings = e_strv_set_ref_free(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid);
+ mi->info.strings = e_strv_pack(mi->info.strings);
+#else
g_free (mi->info.uid);
- mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
+ mi->info.uid = uid;
+#endif
mi->folder = f;
g_ptr_array_add(messages, mi);
- g_hash_table_insert(messages_uid, mi->info.uid, mi);
-
- camel_folder_change_info_add_update(vf->changes, mi->info.uid);
+ uid = (char *)camel_message_info_uid(mi);
+ g_hash_table_insert(messages_uid, uid, mi);
+ camel_folder_change_info_add_update(vf->changes, uid);
}
}
camel_folder_search_free(f, matches);