Re: Super Nested Threads
- From: Peter Bloomfield <peterbloomfield bellsouth net>
- To: balsa-list gnome org
- Subject: Re: Super Nested Threads
- Date: Tue, 23 Nov 2004 00:29:07 +0000
On 11/22/2004 07:00:36 AM, Miquel van Smoorenburg wrote:
[ snip ]
What some clients and web forums do is that after the first
level of indenting, a message doesn't indent if it has only
one reply.
Like
1 message
2 reply to 1
3 reply to 2
4 reply to 3
5 reply to 4
6 reply to 2
7 reply to 6
8 reply to 7
9 reply to 2
Mike.
Hi Mike!
Thanks for pointing that out--I have a version working, and it
controls thread-explosion pretty well[1]. I'm attaching a patch
for anyone who'd like to try it.
We'd want to leave JWZ threading as is, for the purists (well, it
isn't really JWZ's proposal, but it's close), so I guess we'd
need to add a threading option--perhaps "JWZ (flatter)"?
While we're on the topic--how about "JWZ (references only)" for a
version that leaves out the lunatic "gathering by subject"? I'm
for ever losing messages with subjects like "Re: Today's meeting"
because they get threaded under decades-old messages with the
parent subject!!!
Regards,
Peter
[1] Of course, nothing will control a really convoluted thread
except a hard limit!
Index: libbalsa/mailbox_local.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/mailbox_local.c,v
retrieving revision 1.120
diff -u -r1.120 mailbox_local.c
--- libbalsa/mailbox_local.c 26 Oct 2004 10:48:36 -0000 1.120
+++ libbalsa/mailbox_local.c 23 Nov 2004 00:21:27 -0000
@@ -626,6 +626,7 @@
static gboolean lbml_prune(GNode * node, ThreadingInfo * ti);
static void lbml_subject_gather(GNode * node, ThreadingInfo * ti);
static void lbml_subject_merge(GNode * node, ThreadingInfo * ti);
+static gboolean lbml_flatten(GNode * node, ThreadingInfo * ti);
static const gchar *lbml_chop_re(const gchar * str);
#ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
static void lbml_clear_empty(GNode * msg_tree);
@@ -667,6 +668,9 @@
g_node_children_foreach(msg_tree, G_TRAVERSE_ALL,
(GNodeForeachFunc) lbml_subject_merge, &ti);
+ g_node_traverse(msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+ (GNodeTraverseFunc) lbml_flatten, &ti);
+
#ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
lbml_clear_empty(msg_tree);
#endif /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
@@ -1091,6 +1095,27 @@
libbalsa_mailbox_unlink_and_prepend(ti->mailbox, new_node, node2);
#endif /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
}
+}
+
+static gboolean
+lbml_flatten(GNode * node, ThreadingInfo * ti)
+{
+ GNode *parent = node->parent;
+ GNode *child;
+
+ if (!parent || G_NODE_IS_ROOT(parent) || node->prev || node->next)
+ return FALSE;
+
+ for (child = node; child->children && !child->children->next;
+ child = child->children)
+ /* Nothing */ ;
+ while (child != node) {
+ GNode *next = child->parent;
+ libbalsa_mailbox_unlink_and_prepend(ti->mailbox, child, parent);
+ child = next;
+ }
+
+ return FALSE;
}
/* The more heuristics should be added. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]