Revision 190

src/utils.c (revision 190)
883 883
	return addr_list;
884 884
}
885 885

  
886
GSList *references_list_append(GSList *msgid_list, const gchar *str)
886
GSList *references_list_prepend(GSList *msgid_list, const gchar *str)
887 887
{
888 888
	const gchar *strp;
889 889

  
......
903 903
		msgid = g_strndup(start + 1, end - start - 1);
904 904
		g_strstrip(msgid);
905 905
		if (*msgid)
906
			msgid_list = g_slist_append(msgid_list, msgid);
906
			msgid_list = g_slist_prepend(msgid_list, msgid);
907 907
		else
908 908
			g_free(msgid);
909 909

  
......
913 913
	return msgid_list;
914 914
}
915 915

  
916
GSList *references_list_append(GSList *msgid_list, const gchar *str)
917
{
918
	GSList *list;
919

  
920
	list = references_list_prepend(NULL, str);
921
	list = g_slist_reverse(list);
922
	msgid_list = g_slist_concat(msgid_list, list);
923

  
924
	return msgid_list;
925
}
926

  
916 927
GSList *newsgroup_list_append(GSList *group_list, const gchar *str)
917 928
{
918 929
	gchar *work;
src/utils.h (revision 190)
273 273

  
274 274
GSList *address_list_append		(GSList		*addr_list,
275 275
					 const gchar	*str);
276
GSList *references_list_prepend		(GSList		*msgid_list,
277
					 const gchar	*str);
276 278
GSList *references_list_append		(GSList		*msgid_list,
277 279
					 const gchar	*str);
278 280
GSList *newsgroup_list_append		(GSList		*group_list,
src/procmsg.c (revision 190)
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2004 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
202 202
	MsgFlags default_flags;
203 203
	gchar file_buf[BUFFSIZE];
204 204
	guint32 num;
205
	guint refnum;
205 206
	FolderType type;
206 207

  
207 208
	g_return_val_if_fail(item != NULL, NULL);
......
258 259
		READ_CACHE_DATA(msginfo->msgid, fp);
259 260
		READ_CACHE_DATA(msginfo->inreplyto, fp);
260 261

  
262
		READ_CACHE_DATA_INT(refnum, fp);
263
		for (; refnum != 0; refnum--) {
264
			gchar *ref;
265

  
266
			READ_CACHE_DATA(ref, fp);
267
			msginfo->references =
268
				g_slist_prepend(msginfo->references, ref);
269
		}
270
		if (msginfo->references)
271
			msginfo->references =
272
				g_slist_reverse(msginfo->references);
273

  
261 274
		MSG_SET_PERM_FLAGS(msginfo->flags, default_flags.perm_flags);
262 275
		MSG_SET_TMP_FLAGS(msginfo->flags, default_flags.tmp_flags);
263 276

  
......
444 457
void procmsg_write_cache(MsgInfo *msginfo, FILE *fp)
445 458
{
446 459
	MsgTmpFlags flags = msginfo->flags.tmp_flags & MSG_CACHED_FLAG_MASK;
460
	GSList *cur;
447 461

  
448 462
	WRITE_CACHE_DATA_INT(msginfo->msgnum, fp);
449 463
	WRITE_CACHE_DATA_INT(msginfo->size, fp);
......
460 474
	WRITE_CACHE_DATA(msginfo->subject, fp);
461 475
	WRITE_CACHE_DATA(msginfo->msgid, fp);
462 476
	WRITE_CACHE_DATA(msginfo->inreplyto, fp);
477

  
478
	WRITE_CACHE_DATA_INT(g_slist_length(msginfo->references), fp);
479
	for (cur = msginfo->references; cur != NULL; cur = cur->next) {
480
		WRITE_CACHE_DATA((gchar *)cur->data, fp);
481
	}
463 482
}
464 483

  
465 484
void procmsg_write_flags(MsgInfo *msginfo, FILE *fp)
......
682 701
			setvbuf(fp, buf, _IOFBF, buf_size);
683 702
		if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1 ||
684 703
		    version != data_ver) {
685
			debug_print("Mark/Cache version is different (%u != %u). "
686
				    "Discarding it.\n", data_ver, version);
704
			g_message("Mark/Cache version is different (%u != %u). "
705
				  "Discarding it.\n", data_ver, version);
687 706
			fclose(fp);
688 707
			fp = NULL;
689 708
		}
......
753 772
	GHashTable *table;
754 773
	MsgInfo *msginfo;
755 774
	const gchar *msgid;
775
	GSList *reflist;
756 776

  
757 777
	root = g_node_new(NULL);
758 778
	table = g_hash_table_new(g_str_hash, g_str_equal);
759 779

  
760 780
	for (; mlist != NULL; mlist = mlist->next) {
761 781
		msginfo = (MsgInfo *)mlist->data;
762
		parent = root;
782
		parent = NULL;
763 783

  
764
		if (msginfo->inreplyto) {
784
		if (msginfo->inreplyto)
765 785
			parent = g_hash_table_lookup(table, msginfo->inreplyto);
766
			if (parent == NULL)
767
				parent = root;
786

  
787
		if (!parent && msginfo->references) {
788
			for (reflist = msginfo->references;
789
			     reflist != NULL; reflist = reflist->next)
790
				if ((parent = g_hash_table_lookup
791
					(table, reflist->data)) != NULL)
792
					break;
768 793
		}
794

  
795
		if (parent == NULL)
796
			parent = root;
797

  
769 798
		node = g_node_insert_data_before
770 799
			(parent, parent == root ? parent->children : NULL,
771 800
			 msginfo);
......
778 807
	for (node = root->children; node != NULL; ) {
779 808
		next = node->next;
780 809
		msginfo = (MsgInfo *)node->data;
781
		if (msginfo->inreplyto) {
810
		parent = NULL;
811

  
812
		if (msginfo->inreplyto)
782 813
			parent = g_hash_table_lookup(table, msginfo->inreplyto);
783
			/* node should not be the parent, and node should not
784
			   be an ancestor of parent (circular reference) */
785
			if (parent && parent != node &&
786
			    !g_node_is_ancestor(node, parent)) {
787
				g_node_unlink(node);
788
				g_node_insert_before
789
					(parent, parent->children, node);
790
			}
814

  
815
		if (!parent && msginfo->references) {
816
			for (reflist = msginfo->references;
817
			     reflist != NULL; reflist = reflist->next)
818
				if ((parent = g_hash_table_lookup
819
					(table, reflist->data)) != NULL)
820
					break;
791 821
		}
822

  
823
		/* node should not be the parent, and node should not
824
		   be an ancestor of parent (circular reference) */
825
		if (parent && parent != node &&
826
		    !g_node_is_ancestor(node, parent)) {
827
			g_node_unlink(node);
828
			g_node_insert_before
829
				(parent, parent->children, node);
830
		}
792 831
		node = next;
793 832
	}
794 833

  
......
1448 1487
	g_free(msginfo->msgid);
1449 1488
	g_free(msginfo->inreplyto);
1450 1489

  
1490
	slist_free_strings(msginfo->references);
1491
	g_slist_free(msginfo->references);
1492

  
1451 1493
	g_free(msginfo->file_path);
1452 1494

  
1453 1495
	g_free(msginfo->plaintext_file);
src/procheader.c (revision 190)
504 504
	MsgInfo *msginfo;
505 505
	gchar buf[BUFFSIZE];
506 506
	gchar *reference = NULL;
507
	gchar *p;
507
	gchar *p, *q;
508 508
	gchar *hp;
509 509
	HeaderEntry *hentry;
510 510
	gint hnum;
......
520 520

  
521 521
	msginfo = g_new0(MsgInfo, 1);
522 522
	msginfo->flags = flags;
523
	msginfo->references = NULL;
523 524
	msginfo->inreplyto = NULL;
524 525

  
525 526
	while ((hnum = procheader_get_one_field(buf, sizeof(buf), fp, hentry))
......
567 568
			msginfo->msgid = g_strdup(hp);
568 569
			break;
569 570
		case H_REFERENCES:
571
			msginfo->references =
572
				references_list_prepend(msginfo->references,
573
							hp);
574
			if (msginfo->references && !reference)
575
				reference = g_strdup((gchar *)msginfo->references->data);
576
			break;
570 577
		case H_IN_REPLY_TO:
571 578
			if (!reference) {
572 579
				eliminate_parenthesis(hp, '(', ')');
src/procmsg.h (revision 190)
181 181
	gchar *msgid;
182 182
	gchar *inreplyto;
183 183

  
184
	GSList *references;
185

  
184 186
	FolderItem *folder;
185 187
	FolderItem *to_folder;
186 188

  
src/summaryview.c (revision 190)
3031 3031
	GtkCTreeNode *next;
3032 3032
	GtkCTreeNode *parent;
3033 3033
	MsgInfo *msginfo;
3034
	GSList *reflist;
3034 3035

  
3035 3036
	summary_lock(summaryview);
3036 3037

  
......
3051 3052
		if (msginfo && msginfo->inreplyto) {
3052 3053
			parent = g_hash_table_lookup(summaryview->msgid_table,
3053 3054
						     msginfo->inreplyto);
3055
			if (!parent && msginfo->references) {
3056
				for (reflist = msginfo->references;
3057
				     reflist != NULL; reflist = reflist->next)
3058
					if ((parent = g_hash_table_lookup
3059
						(summaryview->msgid_table,
3060
						 reflist->data)))
3061
						break;
3062
			}
3063

  
3054 3064
			if (parent && parent != node) {
3055 3065
				gtk_ctree_move(ctree, node, parent, NULL);
3056 3066
				gtk_ctree_expand(ctree, node);
src/defs.h (revision 190)
63 63
#define FOLDER_LIST		"folderlist.xml"
64 64
#define CACHE_FILE		".sylpheed_cache"
65 65
#define MARK_FILE		".sylpheed_mark"
66
#define CACHE_VERSION		0x20
66
#define CACHE_VERSION		0x21
67 67
#define MARK_VERSION		2
68 68

  
69 69
#define DEFAULT_SIGNATURE	".signature"
ChangeLog.ja (revision 190)
1 1
2005-03-28
2 2

  
3
	* src/utils.[ch]: references_list_prepend(): ??????
4
	* src/procmsg.[ch]
5
	  src/procheader.c
6
	  src/summaryview.c: ?????åɤ??????????򡢼ºݤοƥ??å???????
7
	  ???Ĥ????ʤ??ä??????? References ?إå??????ƤΥ??å????? ID
8
	  ?ò¸¡º÷¤¹¤??褦?˽???(Alfons ???? thanks)??
9
	* src/defs.h: ?????å????С????????????á?
10

  
11
2005-03-28
12

  
3 13
	* src/foldersel.c: ?ե????????????????????? GtkTreeView ?????Ѥ???
4 14
	  ?Ƽ???(Alfons ???? thanks)??
5 15
	* src/stock_pixmap.[ch]: stock_pixbuf_gdk(): ?????? xpm ???? GdkPixbuf
ChangeLog (revision 190)
1 1
2005-03-28
2 2

  
3
	* src/utils.[ch]: references_list_prepend(): new.
4
	* src/procmsg.[ch]
5
	  src/procheader.c
6
	  src/summaryview.c: modified the thread creation so that it looks up
7
	  every message-id in References header if the real parent message is
8
	  not found (thanks to Alfons).
9
	* src/defs.h: upped the cache version.
10

  
11
2005-03-28
12

  
3 13
	* src/foldersel.c: reimplemented folder selection dialog using
4 14
	  GtkTreeView (thanks to Alfons).
5 15
	* src/stock_pixmap.[ch]: stock_pixbuf_gdk(): new. It generates

Also available in: Unified diff