/* return the reversed thread tree */
GNode *procmsg_get_thread_tree(GSList *mlist)
{
- GNode *root, *parent, *node, *next, *last;
- GNode *prev; /* CLAWS */
+ GNode *root, *parent, *node, *next;
GHashTable *msgid_table;
GRelation *subject_relation;
MsgInfo *msginfo;
}
}
- /* complete the unfinished threads. record the last encountered node. */
+ /* complete the unfinished threads */
for (node = root->children; node != NULL; ) {
- parent = prev = NULL;
+ parent = NULL;
next = node->next;
msginfo = (MsgInfo *)node->data;
if (msginfo->inreplyto) {
be an ancestor of parent (circular reference) */
if (parent && parent != node &&
!g_node_is_ancestor(node, parent)) {
- /* since this node is moved away, the previous
- * one is the last recorded one */
- prev = node->prev;
g_node_unlink(node);
g_node_insert_before
(parent, parent->children, node);
}
}
- last = prev ? prev : node;
node = next;
}
if (prefs_common.thread_by_subject) {
- for (node = last; node && node != NULL;) {
- next = node->prev;
+ for (node = root->children; node && node != NULL;) {
+ next = node->next;
msginfo = (MsgInfo *) node->data;
parent = subject_relation_lookup(subject_relation, msginfo);
- /* the node may already be threaded by IN-REPLY-TO, so go up in the tree to
+ /* the node may already be threaded by IN-REPLY-TO, so go up
+ * in the tree to
find the parent node */
if (parent != NULL) {
if (g_node_is_ancestor(node, parent))