* src/procmsg.c
[claws.git] / src / procmsg.c
index 9aa9c2ed621d38924088c4324d0c3c22ccc035d6..75e5c1f5999447fd7dfc40eba1dbe1f2d3c6d6cc 100644 (file)
@@ -217,8 +217,7 @@ static GNode *subject_relation_lookup(GRelation *relation, MsgInfo *msginfo)
 /* 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;
@@ -251,9 +250,9 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                }
        }
 
-       /* 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) { 
@@ -262,26 +261,23 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                           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))