diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-11-30 19:05:36 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-11-30 19:05:36 +0800 |
commit | 1fbfdbd43e88e490ea11d56a3abde4631dab8cb5 (patch) | |
tree | 540ed9a6001f488d2f8918a8de07ea3f4acbae3b /camel/camel-folder-search.c | |
parent | a49aa686202136919d0988b81790c8b2b4a57e92 (diff) | |
download | gsoc2013-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/camel-folder-search.c')
-rw-r--r-- | camel/camel-folder-search.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 8bd1e90b24..0376dd9fef 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -118,7 +118,7 @@ camel_folder_search_finalize (CamelObject *obj) /* yeah, this is a gtk object */ if (search->sexp) - gtk_object_unref(search->sexp); + gtk_object_unref((GtkObject *)search->sexp); g_free(search->last_search); g_hash_table_foreach(p->mempool_hash, free_mempool, obj); @@ -323,19 +323,16 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex } for (i=0;i<search->summary->len;i++) { CamelMessageInfo *info = g_ptr_array_index(search->summary, i); - if (g_hash_table_lookup(results, info->uid)) { - char *s = e_mempool_alloc(pool, strlen(info->uid) + 1); - strcpy(s, info->uid); - g_ptr_array_add(matches, s); + char *uid = (char *)camel_message_info_uid(info); + if (g_hash_table_lookup(results, uid)) { + g_ptr_array_add(matches, e_mempool_strdup(pool, uid)); } } g_hash_table_destroy(results); } else { for (i=0;i<r->value.ptrarray->len;i++) { - char *s = e_mempool_alloc(pool, strlen(g_ptr_array_index(r->value.ptrarray, i)) + 1); d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i))); - strcpy(s, g_ptr_array_index(r->value.ptrarray, i)); - g_ptr_array_add(matches, s); + g_ptr_array_add(matches, e_mempool_strdup(pool, g_ptr_array_index(r->value.ptrarray, i))); } } e_sexp_result_free(r); @@ -441,13 +438,13 @@ search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFold r1 = e_sexp_term_eval(f, argv[0]); if (r1->type == ESEXP_RES_BOOL) { if (r1->value.bool) - g_ptr_array_add(r->value.ptrarray, search->current->uid); + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current)); } else { g_warning("invalid syntax, matches require a single bool result"); } e_sexp_result_free(r1); } else { - g_ptr_array_add(r->value.ptrarray, search->current->uid); + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current)); } search->current = NULL; @@ -467,13 +464,13 @@ search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFold r1 = e_sexp_term_eval(f, argv[0]); if (r1->type == ESEXP_RES_BOOL) { if (r1->value.bool) - g_ptr_array_add(r->value.ptrarray, search->current->uid); + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current)); } else { g_warning("invalid syntax, matches require a single bool result"); } e_sexp_result_free(r1); } else { - g_ptr_array_add(r->value.ptrarray, search->current->uid); + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current)); } } search->current = NULL; @@ -492,24 +489,25 @@ search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, C /* are we inside a match-all? */ if (search->current && argc>1 && argv[0]->type == ESEXP_RES_STRING) { - char *headername, *header = NULL; + char *headername; + const char *header = NULL; char strbuf[32]; int i; /* only a subset of headers are supported .. */ headername = argv[0]->value.string; if (!strcasecmp(headername, "subject")) { - header = search->current->subject; + header = camel_message_info_subject(search->current); } else if (!strcasecmp(headername, "date")) { /* FIXME: not a very useful form of the date */ sprintf(strbuf, "%d", (int)search->current->date_sent); header = strbuf; } else if (!strcasecmp(headername, "from")) { - header = search->current->from; + header = camel_message_info_from(search->current); } else if (!strcasecmp(headername, "to")) { - header = search->current->to; + header = camel_message_info_to(search->current); } else if (!strcasecmp(headername, "cc")) { - header = search->current->cc; + header = camel_message_info_cc(search->current); } else { g_warning("Performing query on unknown header: %s", headername); } @@ -519,7 +517,7 @@ search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, C for (i=1;i<argc && !truth;i++) { if (argv[i]->type == ESEXP_RES_STRING && e_utf8_strstrcase (header, argv[i]->value.string)) { - r(printf("%s got a match with %s of %s\n", search->current->uid, header, argv[i]->value.string)); + r(printf("%s got a match with %s of %s\n", camel_message_info_uid(search->current), header, argv[i]->value.string)); truth = TRUE; break; } @@ -661,7 +659,8 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam if (search->body_index) { for (i=0;i<argc && !truth;i++) { if (argv[i]->type == ESEXP_RES_STRING) { - truth = ibex_find_name(search->body_index, search->current->uid, argv[i]->value.string); + truth = ibex_find_name(search->body_index, (char *)camel_message_info_uid(search->current), + argv[i]->value.string); } else { g_warning("Invalid type passed to body-contains match function"); } @@ -669,7 +668,7 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam } else if (search->folder) { /* we do a 'slow' direct search */ if (build_match_regex(&pattern, argc, argv) == 0) { - truth = match_message(search->folder, search->current->uid, &pattern); + truth = match_message(search->folder, camel_message_info_uid(search->current), &pattern); regfree(&pattern); } } else { @@ -713,8 +712,8 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam for (i=0;i<search->summary->len;i++) { CamelMessageInfo *info = g_ptr_array_index(search->summary, i); - if (match_message(search->folder, info->uid, &pattern)) - g_ptr_array_add(r->value.ptrarray, info->uid); + if (match_message(search->folder, camel_message_info_uid(info), &pattern)) + g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info)); } } /* else? we could always get the summary from the folder, but then we need to free it later somehow */ |