From 2b29d7310a6287f425f8f8ebe73fa0ace7f58f4f Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 7 Jul 2000 21:21:16 +0000 Subject: Add another argument "clast" pointing to the container before the current * message-thread.c (remove_node): Add another argument "clast" pointing to the container before the current one in the list, which it can update if that turns out to be the one that it removed. (group_root_set): Update for remove_node change, and remove both nodes in the "subjects are common" case. Fixes a bug that would cause the message list to be truncated if this rule was invoked. svn path=/trunk/; revision=3961 --- mail/ChangeLog | 10 ++++++++++ mail/message-thread.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index d45f11c222..f33cafe649 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2000-07-07 Dan Winship + + * message-thread.c (remove_node): Add another argument "clast" + pointing to the container before the current one in the list, + which it can update if that turns out to be the one that it + removed. + (group_root_set): Update for remove_node change, and remove both + nodes in the "subjects are common" case. Fixes a bug that would + cause the message list to be truncated if this rule was invoked. + 2000-07-07 Dan Winship * message-list.c: Lots of changes. Store uids as node data on the diff --git a/mail/message-thread.c b/mail/message-thread.c index 789536ba34..9c0325ed21 100644 --- a/mail/message-thread.c +++ b/mail/message-thread.c @@ -208,7 +208,7 @@ get_root_subject(struct _container *c, int *re) /* this is pretty slow, but not used often */ static void -remove_node(struct _container **list, struct _container *node) +remove_node(struct _container **list, struct _container *node, struct _container **clast) { struct _container *c; @@ -216,6 +216,8 @@ remove_node(struct _container **list, struct _container *node) c = (struct _container *)list; while (c->next) { if (c->next == node) { + if (clast && *clast == c->next) + *clast = c; c->next = c->next->next; break; } @@ -266,7 +268,7 @@ group_root_set(struct _container **cp) continue; } if (c->message == NULL && container->message != NULL) { d(printf("container is non-empty parent\n")); - remove_node(cp, container); + remove_node(cp, container, &clast); container_add_child(c, container); } else if (c->message != NULL && container->message == NULL) { d(printf("container is empty child\n")); @@ -280,12 +282,13 @@ group_root_set(struct _container **cp) continue; } else if (!c->re && container->re) { d(printf("container is not re\n")); - remove_node(cp, container); + remove_node(cp, container, &clast); container_add_child(c, container); } else { d(printf("subjects are common %p and %p\n", c, container)); - remove_node(cp, container); + remove_node(cp, container, &clast); + remove_node(cp, c, &clast); scan = g_malloc0(sizeof(*scan)); scan->root_subject = c->root_subject; @@ -477,7 +480,7 @@ thread_messages(CamelFolder *folder, GPtrArray *uids) #if 0 printf("finished\n"); i = dump_tree(head, 0); - printf("%d count, %d msgs initially, %d items in tree\n", count, msgs, i); + printf("%d count, %d items in tree\n", uids->len, i); #endif sort_thread(&head); -- cgit v1.2.3