diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-11-21 07:49:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-11-21 07:49:53 +0800 |
commit | 7b8057a43c064a5f5a3611eb59d8bd68d1aabe11 (patch) | |
tree | 1e10e2e6198374cb819c2f74809d9bf87cfeb8e1 /mail | |
parent | 768136e12929387977670515f30d87d7a91a7865 (diff) | |
download | gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar.gz gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar.bz2 gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar.lz gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar.xz gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.tar.zst gsoc2013-evolution-7b8057a43c064a5f5a3611eb59d8bd68d1aabe11.zip |
Save out the md5 hash of the messageid as hex, since thats all we have for
2000-11-20 Not Zed <NotZed@HelixCode.com>
* message-list.c (save_node_state): Save out the md5 hash of the
messageid as hex, since thats all we have for those nodes.
(build_subtree): Expand the messageid to a hex string first, then
check it.
(add_node_diff): And the same here.
* message-thread.c (thread_messages): Changed for changes to
messageid/references items.
(id_hash, id_equal): New functions to hash on the binary message id hash.
(thread_messages): removed some more no longer used dead code.
svn path=/trunk/; revision=6617
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 13 | ||||
-rw-r--r-- | mail/message-list.c | 18 | ||||
-rw-r--r-- | mail/message-thread.c | 76 |
3 files changed, 64 insertions, 43 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 0ef37d3aac..875d3dfe2a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2000-11-20 Not Zed <NotZed@HelixCode.com> + + * message-list.c (save_node_state): Save out the md5 hash of the + messageid as hex, since thats all we have for those nodes. + (build_subtree): Expand the messageid to a hex string first, then + check it. + (add_node_diff): And the same here. + + * message-thread.c (thread_messages): Changed for changes to + messageid/references items. + (id_hash, id_equal): New functions to hash on the binary message id hash. + (thread_messages): removed some more no longer used dead code. + 2000-11-20 Jeffrey Stedfast <fejj@helixcode.com> * message-list.c (e_mail_address_compare): New comparison function diff --git a/mail/message-list.c b/mail/message-list.c index f4aa692309..3e478c388a 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1263,7 +1263,7 @@ save_node_state(MessageList *ml, FILE *out, ETreePath *node) if (id_is_uid(data)) { info = camel_folder_get_message_info(ml->folder, id_uid(data)); if (info) { - fprintf(out, "%s\n", info->message_id); + fprintf(out, "%08x%08x\n", info->message_id.id.part.hi, info->message_id.id.part.lo); } } else { fprintf(out, "%s\n", data); @@ -1435,9 +1435,11 @@ build_subtree (MessageList *ml, ETreePath *parent, struct _container *c, int *ro id = new_id_from_uid(c->message->uid); g_hash_table_insert(ml->uid_rowmap, id_uid(id), GINT_TO_POINTER ((*row)++)); if (c->child) { - if (c->message && c->message->message_id) - expanded = !g_hash_table_lookup(expanded_nodes, c->message->message_id) != 0; - else + if (c->message) { + char key[17]; + sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); + expanded = !g_hash_table_lookup(expanded_nodes, key) != 0; + } else expanded = TRUE; } } else { @@ -1493,9 +1495,11 @@ add_node_diff(MessageList *ml, ETreePath *parent, ETreePath *path, struct _conta g_hash_table_remove(ml->uid_rowmap, id_uid(id)); g_hash_table_insert(ml->uid_rowmap, id_uid(id), GINT_TO_POINTER (*row)); if (c->child) { - if (c->message && c->message->message_id) - expanded = !g_hash_table_lookup(expanded_nodes, c->message->message_id) != 0; - else + if (c->message) { + char key[17]; + sprintf(key, "%08x%08x", c->message->message_id.id.part.hi, c->message->message_id.id.part.lo); + expanded = !g_hash_table_lookup(expanded_nodes, key) != 0; + } else expanded = TRUE; } } else { diff --git a/mail/message-thread.c b/mail/message-thread.c index 098803e28e..6502437c74 100644 --- a/mail/message-thread.c +++ b/mail/message-thread.c @@ -100,8 +100,8 @@ prune_empty(struct _container **cp) while (lastc->next) { c = lastc->next; - d(printf("checking message %p %p (%s)\n", c, - c->message, c->message?c->message->message_id:"<empty>")); + d(printf("checking message %p %p (%.8s)\n", c, + c->message, c->message?c->message->message_id.id.hash:"<empty>")); if (c->message == NULL) { if (c->child == NULL) { d(printf("removing empty node\n")); @@ -320,7 +320,7 @@ dump_tree_rec(struct _tree_info *info, struct _container *c, int depth) g_hash_table_insert(info->visited, c, c); } if (c->message) { - printf("%s %p Subject: %s <%s>\n", p, c, c->message->subject, c->message->message_id); + printf("%s %p Subject: %s <%.8s>\n", p, c, c->message->subject, c->message->message_id.id.hash); count += 1; } else { printf("%s %p <empty>\n", p, c); @@ -424,6 +424,18 @@ sort_thread(struct _container **cp) *cp = head; } +static guint id_hash(void *key) +{ + CamelSummaryMessageID *id = (CamelSummaryMessageID *)key; + + return id->id.part.lo; +} + +static gint id_equal(void *a, void *b) +{ + return ((CamelSummaryMessageID *)a)->id.id == ((CamelSummaryMessageID *)b)->id.id; +} + /* NOTE: This function assumes you have obtained the relevant locks for the folder, BEFORE calling it */ struct _thread_messages * @@ -431,8 +443,7 @@ thread_messages(CamelFolder *folder, GPtrArray *uids) { GHashTable *id_table, *no_id_table; int i; - struct _container *c, *p, *child, *head; - struct _header_references *ref; + struct _container *c, *child, *head; struct _thread_messages *thread; #ifdef TIMEIT @@ -442,19 +453,19 @@ thread_messages(CamelFolder *folder, GPtrArray *uids) gettimeofday(&start, NULL); #endif - id_table = g_hash_table_new(g_str_hash, g_str_equal); + id_table = g_hash_table_new((GHashFunc)id_hash, (GCompareFunc)id_equal); no_id_table = g_hash_table_new(NULL, NULL); for (i=0;i<uids->len;i++) { const CamelMessageInfo *mi; - mi = camel_folder_get_message_info (folder, uids->pdata[i]); + mi = camel_folder_get_message_info(folder, uids->pdata[i]); if (mi == NULL) { g_warning("Folder doesn't contain uid %s", (char *)uids->pdata[i]); continue; } - if (mi->message_id) { - c = g_hash_table_lookup(id_table, mi->message_id); + if (mi->message_id.id.id) { + c = g_hash_table_lookup(id_table, &mi->message_id); /* check for duplicate messages */ if (c) { /* if duplicate, just make out it is a no-id message, but try and insert it @@ -463,9 +474,9 @@ thread_messages(CamelFolder *folder, GPtrArray *uids) c = g_malloc0(sizeof(*c)); g_hash_table_insert(no_id_table, (void *)mi, c); } else { - d(printf("doing : %s\n", mi->message_id)); + d(printf("doing : %.8s\n", mi->message_id.id.hash)); c = g_malloc0(sizeof(*c)); - g_hash_table_insert(id_table, mi->message_id, c); + g_hash_table_insert(id_table, (void *)&mi->message_id, c); } } else { d(printf("doing : (no message id)\n")); @@ -476,32 +487,25 @@ thread_messages(CamelFolder *folder, GPtrArray *uids) c->message = mi; c->order = i; child = c; - ref = mi->references; - p = NULL; - head = NULL; - d(printf("references:\n")); - while (ref) { - if (ref->id == NULL) { - /* this shouldn't actually happen, and indicates - some problems in camel */ - d(printf("ref missing id!?\n")); - ref = ref->next; - continue; - } - - d(printf("looking up reference: %s\n", ref->id)); - c = g_hash_table_lookup(id_table, ref->id); - if (c == NULL) { - d(printf("not found\n")); - c = g_malloc0(sizeof(*c)); - g_hash_table_insert(id_table, ref->id, c); + if (mi->references) { + int j; + + d(printf("references:\n")); + for (j=0;j<mi->references->size;j++) { + /* should never be empty, but just incase */ + if (mi->references->references[j].id.id == 0) + continue; + + c = g_hash_table_lookup(id_table, &mi->references->references[j]); + if (c == NULL) { + d(printf("not found\n")); + c = g_malloc0(sizeof(*c)); + g_hash_table_insert(id_table, &mi->references->references[j], c); + } + if (c!=child) + container_parent_child(c, child); + child = c; } - if (c!=child) - container_parent_child(c, child); - child = c; - if (head == NULL) - head = c; - ref = ref->next; } } |