diff options
author | 9 <NotZed@Ximian.com> | 2001-10-10 06:26:01 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-10 06:26:01 +0800 |
commit | d5e090651bbd30ee761624187db6ad7920162aa8 (patch) | |
tree | 7ad7107b56496575d6e9914723ff8670a74e7351 /camel/camel-folder-summary.c | |
parent | 7980990c79feaa36f452d9e2f2f59e8de1b1ec5c (diff) | |
download | gsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.tar.gz gsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.tar.zst gsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.zip |
Implement.
2001-10-09 <NotZed@Ximian.com>
* providers/local/camel-spool-folder.c (spool_search_by_uids):
Implement.
* providers/imap/camel-imap-search.c (imap_body_contains): If
searching a sub-set of the total message count, then use a UID
range to search only specific messages.
* camel-vee-folder.c (vee_folder_change_match): Removed.
(folder_changed_add_uid): Helper func for changed code.
(folder_changed_remove_uid): "
(folder_changed_change_uid): "
(folder_changed): Rewritten. Supports proper auto-updating of
changes, but not removals till a sync occurs.
(vee_search_by_uids): Implement.
(folder_changed): Changed to call an async threaded function to do
the actual folder updating.
* camel-folder-summary.c (camel_flag_list_copy): New func to copy
a whole list of flags.
(camel_tag_list_copy): New func to copy a whole list of flags.
* providers/imap/camel-imap-folder.c (imap_search_by_uids):
Implement.
* providers/local/camel-local-folder.c (local_search_by_uids):
Implement.
* camel-folder.c (camel_folder_search_by_uids): New function,
search a subset of uid's.
(search_by_uids): Default impl, return error.
svn path=/trunk/; revision=13532
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r-- | camel/camel-folder-summary.c | 93 |
1 files changed, 91 insertions, 2 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 45c2fadae4..a83517ebcd 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -2150,8 +2150,49 @@ camel_flag_list_free(CamelFlag **list) *list = NULL; } -const char -*camel_tag_get(CamelTag **list, const char *name) +/** + * camel_flag_list_copy: + * @to: + * @from: + * + * Copy a flag list, return true if the destination list @to changed. + * + * Return value: + **/ +gboolean +camel_flag_list_copy(CamelFlag **to, CamelFlag **from) +{ + CamelFlag *flag, *tmp; + int changed = FALSE; + + if (*to == NULL && from == NULL) + return FALSE; + + /* Remove any now-missing flags */ + flag = (CamelFlag *)to; + while (flag->next) { + tmp = flag->next; + if (!camel_flag_get(from, tmp->name)) { + flag->next = tmp->next; + g_free(tmp); + changed = TRUE; + } else { + flag = tmp; + } + } + + /* Add any new flags */ + flag = *from; + while (flag) { + changed |= camel_flag_set(to, flag->name, TRUE); + flag = flag->next; + } + + return changed; +} + +const char * +camel_tag_get(CamelTag **list, const char *name) { CamelTag *tag; @@ -2231,6 +2272,54 @@ int camel_tag_list_size(CamelTag **list) return count; } +static void +rem_tag(char *key, char *value, CamelTag **to) +{ + camel_tag_set(to, key, NULL); +} + +/** + * camel_tag_list_copy: + * @to: + * @from: + * + * Copy a list of tags. + * + * Return value: + **/ +gboolean +camel_tag_list_copy(CamelTag **to, CamelTag **from) +{ + int changed = FALSE; + CamelTag *tag; + GHashTable *left; + + if (*to == NULL && from == NULL) + return FALSE; + + left = g_hash_table_new(g_str_hash, g_str_equal); + tag = *to; + while (tag) { + g_hash_table_insert(left, tag->name, tag); + tag = tag->next; + } + + tag = *from; + while (tag) { + changed |= camel_tag_set(to, tag->name, tag->value); + g_hash_table_remove(left, tag->name); + tag = tag->next; + } + + if (g_hash_table_size(left)>0) { + g_hash_table_foreach(left, (GHFunc)rem_tag, to); + changed = TRUE; + } + g_hash_table_destroy(left); + + return changed; +} + /** * camel_tag_list_free: * @list: |