diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-08-11 00:35:28 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-08-11 00:35:28 +0800 |
commit | 690509bf826bc02af09cbec064f1f34c48dd9b0c (patch) | |
tree | 41580cd68f0f3e0dc297f11e34e237c37b2dc09e /camel/camel-folder-summary.c | |
parent | 544eb3c3493bfa25d6a3a82d1c18805174c37eb9 (diff) | |
download | gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar.gz gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar.bz2 gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar.lz gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar.xz gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.tar.zst gsoc2013-evolution-690509bf826bc02af09cbec064f1f34c48dd9b0c.zip |
A better way to compress leading whitespace. The code is probably invalid
2000-08-11 Not Zed <NotZed@HelixCode.com>
* camel-mime-parser.c (folder_scan_header): A better way to
compress leading whitespace. The code is probably invalid anyway,
I dont think it will work across buffer boundaries.
* providers/mbox/camel-mbox-folder.c (mbox_append_message): And
write out proper format From lines here too.
* providers/mbox/camel-mbox-summary.c
(camel_mbox_summary_build_from): New function to build a more
compatible mbox "From " line.
(camel_mbox_summary_sync): Write From lines in the proper format.
2000-08-10 Not Zed <NotZed@HelixCode.com>
* providers/mh/camel-mh-store.c (get_folder): Remove warnin g.
* providers/mbox/camel-mbox-store.c (xrename): Kill some warnings
with constification.
* providers/imap/camel-imap-folder.c (imap_append_message): Fixed
for append api change. Eek this routine seriously wastes memory.
* providers/mh/camel-mh-folder.c (mh_search_free): Impelemnt.
(mh_append_message): Fix for api change, and include user flags
and tags in new message.
* providers/vee/camel-vee-folder.c (vee_search_by_expression): Fix
for search api change.
* camel-folder.c (camel_folder_search_free): New function for
freeing search results.
(search_free): Changed my mind, implement a default that actually
does something. Free as to the old interface.
(camel_folder_append_message): Changed to accept a
camelmessageinfo rather than flags, which just doesn't have enough
info in it.
(copy_message_to): Change for append_message api change.
(move_message_to): Likewise.
* providers/mbox/camel-mbox-folder.c (mbox_search_free):
Implement.
(mbox_append_message): Fix for api change, and also copy user
flags/tags across to new summary.
* camel-folder-search.c (search_user_tag): A search expression
that returns the current use flag by name.
(camel_folder_search_free_result): New function to free the result
of a search.
* camel-folder-summary.c: Bump summary version.
(message_info_new):
(message_info_load):
(message_info_save):
(camel_message_info_dup_to):
(camel_message_info_free): Added support for arbitrary tag/value
pairs (CamelTag's).
(camel_tag_get):
(camel_tag_set):
(camel_tag_list_size):
(camel_tag_list_free): Operations for working with CamelTags.
svn path=/trunk/; revision=4683
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r-- | camel/camel-folder-summary.c | 102 |
1 files changed, 101 insertions, 1 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 6a16859f4f..a47d98a46a 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -48,7 +48,7 @@ extern int strdup_count, malloc_count, free_count; #endif -#define CAMEL_FOLDER_SUMMARY_VERSION (6) +#define CAMEL_FOLDER_SUMMARY_VERSION (7) struct _CamelFolderSummaryPrivate { GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */ @@ -951,6 +951,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h) mi->to = camel_summary_format_address(h, "to"); mi->cc = camel_summary_format_address(h, "cc"); mi->user_flags = NULL; + mi->user_tags = NULL; mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL); received = header_raw_find(&h, "received", NULL); if (received) @@ -1012,6 +1013,16 @@ message_info_load(CamelFolderSummary *s, FILE *in) g_free(name); } + camel_folder_summary_decode_uint32(in, &count); + for (i=0;i<count;i++) { + char *name, *value; + camel_folder_summary_decode_string(in, &name); + camel_folder_summary_decode_string(in, &value); + camel_tag_set(&mi->user_tags, name, value); + g_free(name); + g_free(value); + } + return mi; } @@ -1020,6 +1031,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi) { guint32 count; CamelFlag *flag; + CamelTag *tag; struct _header_references *refs; io(printf("Saving message info\n")); @@ -1051,6 +1063,16 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi) camel_folder_summary_encode_string(out, flag->name); flag = flag->next; } + + count = camel_tag_list_size(&mi->user_tags); + camel_folder_summary_encode_uint32(out, count); + tag = mi->user_tags; + while (tag) { + camel_folder_summary_encode_string(out, tag->name); + camel_folder_summary_encode_string(out, tag->value); + tag = tag->next; + } + return ferror(out); } @@ -1356,6 +1378,76 @@ camel_flag_list_free(CamelFlag **list) *list = NULL; } +const char *camel_tag_get(CamelTag **list, const char *name) +{ + CamelTag *tag; + + tag = *list; + while (tag) { + if (!strcmp(tag->name, name)) + return (const char *)tag->value; + tag = tag->next; + } + return NULL; +} + +void camel_tag_set(CamelTag **list, const char *name, const char *value) +{ + CamelTag *tag, *tmp; + + /* this 'trick' works because tag->next is the first element */ + tag = (CamelTag *)list; + while (tag->next) { + tmp = tag->next; + if (!strcmp(tmp->name, name)) { + if (value == NULL) { /* clear it? */ + tag->next = tmp->next; + g_free(tmp->value); + g_free(tmp); + } else if (strcmp(tmp->value, value)) { /* has it changed? */ + g_free(tmp->value); + tmp->value = g_strdup(value); + } + return; + } + tag = tmp; + } + + if (value) { + tmp = g_malloc(sizeof(*tmp)+strlen(name)); + strcpy(tmp->name, name); + tmp->value = g_strdup(value); + tmp->next = 0; + tag->next = tmp; + } +} + +int camel_tag_list_size(CamelTag **list) +{ + int count=0; + CamelTag *tag; + + tag = *list; + while (tag) { + count++; + tag = tag->next; + } + return count; +} + +void camel_tag_list_free(CamelTag **list) +{ + CamelTag *tag, *tmp; + tag = *list; + while (tag) { + tmp = tag->next; + g_free(tag->value); + g_free(tag); + tag = tmp; + } + *list = NULL; +} + /** * camel_message_info_dup_to: * @from: source message info @@ -1370,6 +1462,7 @@ void camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to) { CamelFlag *flag; + CamelTag *tag; /* Copy numbers */ to->flags = from->flags; @@ -1393,6 +1486,12 @@ camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to) flag = flag->next; } + tag = from->user_tags; + while (tag) { + camel_tag_set(&to->user_tags, tag->name, tag->value); + tag = tag->next; + } + /* FIXME some day */ to->content = NULL; } @@ -1414,6 +1513,7 @@ camel_message_info_free(CamelMessageInfo *mi) g_free(mi->message_id); header_references_list_clear(&mi->references); camel_flag_list_free(&mi->user_flags); + camel_tag_list_free(&mi->user_tags); /* FIXME: content info? */ g_free(mi); } |