aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-vee-folder.c
diff options
context:
space:
mode:
author5 <NotZed@Ximian.com>2001-10-26 08:37:52 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-26 08:37:52 +0800
commit5b449d9ca73f3b7428f18c75af49d9d0cf8f36ce (patch)
treee60b95d8f22e5b1408919f13f5965ba57082ea23 /camel/camel-vee-folder.c
parentb822bc381f5370d64329d8892c8745a8708b214c (diff)
downloadgsoc2013-evolution-5b449d9ca73f3b7428f18c75af49d9d0cf8f36ce.tar.gz
gsoc2013-evolution-5b449d9ca73f3b7428f18c75af49d9d0cf8f36ce.tar.zst
gsoc2013-evolution-5b449d9ca73f3b7428f18c75af49d9d0cf8f36ce.zip
Remove the stupid warning that should never have been there in the first
2001-10-25 <NotZed@Ximian.com> * camel-search-private.c (utf8_get): Remove the stupid warning that should never have been there in the first place. * camel-sasl-digest-md5.c (digest_response): s/iconv/e_iconv/ * camel-pgp-context.c (pgp_verify): " * camel-mime-utils.c (rfc2047_decode_word, rfc2047_decode_word, append_8bit, rfc2047_encode_word, rfc2184_decode, header_decode_param): " * camel-mime-part-utils.c (convert_buffer, convert_buffer): " * camel-mime-filter-charset.c (reset, complete, filter): " svn path=/trunk/; revision=14113
Diffstat (limited to 'camel/camel-vee-folder.c')
-rw-r--r--camel/camel-vee-folder.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 37bca4767b..7e31e94cb9 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -1260,7 +1260,7 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
CamelVeeMessageInfo *vinfo;
int i, vuidlen = 0;
CamelFolderChangeInfo *vf_changes = NULL, *unmatched_changes = NULL;
- GPtrArray *matches;
+ GPtrArray *matches, *newchanged = NULL, *changed;
GHashTable *matches_hash;
/* Check the folder hasn't beem removed while we weren't watching */
@@ -1301,8 +1301,34 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
if (changes->uid_changed->len > 0)
dd(printf(" Searching for changed matches '%s'\n", vf->expression));
- if (changes->uid_changed->len > 0
- && (matches = camel_folder_search_by_uids(sub, vf->expression, changes->uid_changed, NULL))) {
+ /* TODO:
+ In this code around here, we can work out if the search will affect the changes
+ we had, and only re-search against them if they might have */
+
+ matches = NULL;
+ changed = changes->uid_changed;
+ if (changed->len
+ && (vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
+ newchanged = g_ptr_array_new();
+ for (i=0;i<changed->len;i++) {
+ uid = changed->pdata[i];
+ if (strlen(uid)+9 > vuidlen) {
+ vuidlen = strlen(uid)+64;
+ vuid = g_realloc(vuid, vuidlen);
+ }
+ memcpy(vuid, hash, 8);
+ strcpy(vuid+8, uid);
+ vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
+ if (vinfo == NULL)
+ g_ptr_array_add(newchanged, uid);
+ else
+ camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
+ }
+ changed = newchanged;
+ }
+
+ if (changed->len
+ && (matches = camel_folder_search_by_uids(sub, vf->expression, changed, NULL))) {
/* If we are auto-updating, then re-check changed uids still match */
dd(printf(" Vfolder %supdate\nuids match:", (vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO)?"auto-":""));
matches_hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -1311,8 +1337,8 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
g_hash_table_insert(matches_hash, matches->pdata[i], matches->pdata[i]);
}
dd(printf("\n"));
- for (i=0;i<changes->uid_changed->len;i++) {
- uid = changes->uid_changed->pdata[i];
+ for (i=0;i<changed->len;i++) {
+ uid = changed->pdata[i];
if (strlen(uid)+9 > vuidlen) {
vuidlen = strlen(uid)+64;
vuid = g_realloc(vuid, vuidlen);
@@ -1322,20 +1348,20 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
if (vinfo == NULL) {
/* A uid we dont have, but now it matches, add it */
- if (g_hash_table_lookup(matches_hash, changes->uid_changed->pdata[i])) {
- dd(printf(" adding uid '%s' [newly matched]\n", (char *)changes->uid_changed->pdata[i]));
- folder_changed_add_uid(sub, changes->uid_changed->pdata[i], hash, vf);
+ if (g_hash_table_lookup(matches_hash, uid)) {
+ dd(printf(" adding uid '%s' [newly matched]\n", uid));
+ folder_changed_add_uid(sub, uid, hash, vf);
}
} else {
if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0
- || g_hash_table_lookup(matches_hash, changes->uid_changed->pdata[i])) {
+ || g_hash_table_lookup(matches_hash, uid)) {
/* still match, or we're not auto-updating, change event, (if it changed) */
- dd(printf(" changing uid '%s' [still matches]\n", (char *)changes->uid_changed->pdata[i]));
- folder_changed_change_uid(sub, changes->uid_changed->pdata[i], hash, vf);
+ dd(printf(" changing uid '%s' [still matches]\n", uid));
+ folder_changed_change_uid(sub, uid, hash, vf);
} else {
/* No longer matches, remove it, but keep it in unmatched (potentially) */
- dd(printf(" removing uid '%s' [did match]\n", (char *)changes->uid_changed->pdata[i]));
- folder_changed_remove_uid(sub, changes->uid_changed->pdata[i], hash, TRUE, vf);
+ dd(printf(" removing uid '%s' [did match]\n", uid));
+ folder_changed_remove_uid(sub, uid, hash, TRUE, vf);
}
camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
}
@@ -1345,6 +1371,9 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
camel_folder_search_free(sub, matches);
}
+ if (newchanged)
+ g_ptr_array_free(newchanged, TRUE);
+
if (camel_folder_change_info_changed(folder_unmatched->changes)) {
unmatched_changes = folder_unmatched->changes;
folder_unmatched->changes = camel_folder_change_info_new();