aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-03-29 04:40:26 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-03-29 04:40:26 +0000
commit877b16da4a494077b72a1e03c62a481151aa80c1 (patch)
tree5b943588242d3a48641b19d8207c27c0fd253302
parent78ffc1ed2c6fbf42feabfb348d746b5a36be3db8 (diff)
modified message threading.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@191 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.ja7
-rw-r--r--src/procheader.c25
-rw-r--r--src/procmsg.c24
4 files changed, 35 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b6fecdc..a3a45049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-03-28
+ * src/procmsg.c: procmsg_get_thread_tree(): look for indirect parent
+ only the second loop for accurate threading.
+ * src/procheader.c: procheader_parse_stream(): made In-Reply-To take
+ priority of References for MsgInfo::inreplyto.
+
+2005-03-28
+
* src/utils.[ch]: references_list_prepend(): new.
* src/procmsg.[ch]
src/procheader.c
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 95ffd928..0bd680ab 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,12 @@
2005-03-28
+ * src/procmsg.c: procmsg_get_thread_tree(): 正確なスレッド生成のため
+ 2回目のループのときのみ間接的な親を探すようにした。
+ * src/procheader.c: procheader_parse_stream(): MsgInfo::inreplyto
+ に対して In-Reply-To が References より優先されるようにした。
+
+2005-03-28
+
* src/utils.[ch]: references_list_prepend(): 新規。
* src/procmsg.[ch]
src/procheader.c
diff --git a/src/procheader.c b/src/procheader.c
index 62047aa5..eff43f48 100644
--- a/src/procheader.c
+++ b/src/procheader.c
@@ -503,7 +503,6 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
MsgInfo *msginfo;
gchar buf[BUFFSIZE];
- gchar *reference = NULL;
gchar *p, *q;
gchar *hp;
HeaderEntry *hentry;
@@ -571,19 +570,17 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
msginfo->references =
references_list_prepend(msginfo->references,
hp);
- if (msginfo->references && !reference)
- reference = g_strdup((gchar *)msginfo->references->data);
break;
case H_IN_REPLY_TO:
- if (!reference) {
- eliminate_parenthesis(hp, '(', ')');
- if ((p = strrchr(hp, '<')) != NULL &&
- strchr(p + 1, '>') != NULL) {
- extract_parenthesis(p, '<', '>');
- remove_space(p);
- if (*p != '\0')
- reference = g_strdup(p);
- }
+ if (msginfo->inreplyto) break;
+
+ eliminate_parenthesis(hp, '(', ')');
+ if ((p = strrchr(hp, '<')) != NULL &&
+ strchr(p + 1, '>') != NULL) {
+ extract_parenthesis(p, '<', '>');
+ remove_space(p);
+ if (*p != '\0')
+ msginfo->inreplyto = g_strdup(p);
}
break;
case H_CONTENT_TYPE:
@@ -633,7 +630,9 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
g_free(cc);
}
- msginfo->inreplyto = reference;
+ if (!msginfo->inreplyto && msginfo->references)
+ msginfo->inreplyto =
+ g_strdup((gchar *)msginfo->references->data);
g_free(charset);
diff --git a/src/procmsg.c b/src/procmsg.c
index 4ff70aec..1a12f096 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -695,14 +695,14 @@ static FILE *procmsg_open_data_file(const gchar *file, guint version,
/* check version */
if ((fp = fopen(file, "rb")) == NULL)
- debug_print("Mark/Cache file not found\n");
+ debug_print("Mark/Cache file '%s' not found\n", file);
else {
if (buf && buf_size > 0)
setvbuf(fp, buf, _IOFBF, buf_size);
if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1 ||
version != data_ver) {
- g_message("Mark/Cache version is different (%u != %u). "
- "Discarding it.\n", data_ver, version);
+ g_message("%s: Mark/Cache version is different (%u != %u). Discarding it.\n",
+ file, data_ver, version);
fclose(fp);
fp = NULL;
}
@@ -779,22 +779,15 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
for (; mlist != NULL; mlist = mlist->next) {
msginfo = (MsgInfo *)mlist->data;
- parent = NULL;
+ parent = root;
- if (msginfo->inreplyto)
+ /* only look for the real parent first */
+ if (msginfo->inreplyto) {
parent = g_hash_table_lookup(table, msginfo->inreplyto);
-
- if (!parent && msginfo->references) {
- for (reflist = msginfo->references;
- reflist != NULL; reflist = reflist->next)
- if ((parent = g_hash_table_lookup
- (table, reflist->data)) != NULL)
- break;
+ if (parent == NULL)
+ parent = root;
}
- if (parent == NULL)
- parent = root;
-
node = g_node_insert_data_before
(parent, parent == root ? parent->children : NULL,
msginfo);
@@ -812,6 +805,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
if (msginfo->inreplyto)
parent = g_hash_table_lookup(table, msginfo->inreplyto);
+ /* try looking for the indirect parent */
if (!parent && msginfo->references) {
for (reflist = msginfo->references;
reflist != NULL; reflist = reflist->next)