aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/camel-folder-thread.c19
-rw-r--r--camel/camel-folder-thread.h7
3 files changed, 26 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e466cc9d58..f1c3f6cc72 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2002-08-27 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-folder-thread.c (camel_folder_thread_messages_new): Now
+ takes a third argument to specify whether or not to group messages
+ by subject when threading. It seems some people don't want this
+ feature (see bug #22791 for details).
+ (thread_summary): If thread_by_subject is enabled, group
+ un-threaded messages by subject otherwise don't bother.
+
2002-08-26 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-command.c
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index 1401d39f21..9d5ecf2861 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -500,9 +500,10 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
/* remove empty parent nodes */
prune_empty(thread, &head);
-
- /* find any siblings which missed out */
- group_root_set(thread, &head);
+
+ /* find any siblings which missed out - but only if we are allowing threading by subject */
+ if (thread->subject)
+ group_root_set (thread, &head);
#if 0
printf("finished\n");
@@ -561,9 +562,14 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
* @folder:
* @uids: The subset of uid's to thread. If NULL. then thread all
* uid's in @folder.
+ * @thread_subject: thread based on subject also
*
* Thread a (subset) of the messages in a folder. And sort the result
* in summary order.
+ *
+ * If @thread_subject is %TRUE, messages with
+ * related subjects will also be threaded. The default behaviour is to
+ * only thread based on message-id.
*
* This function is probably to be removed soon.
*
@@ -571,7 +577,7 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
* which represent the threaded structure of the messages.
**/
CamelFolderThread *
-camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
+camel_folder_thread_messages_new (CamelFolder *folder, GPtrArray *uids, gboolean thread_subject)
{
CamelFolderThread *thread;
GHashTable *wanted = NULL;
@@ -581,12 +587,13 @@ camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
thread = g_malloc(sizeof(*thread));
thread->refcount = 1;
+ thread->subject = thread_subject;
thread->tree = NULL;
thread->node_chunks = e_memchunk_new(32, sizeof(CamelFolderThreadNode));
thread->folder = folder;
camel_object_ref((CamelObject *)folder);
- /* get all of the summary items of interest in summary order*/
+ /* get all of the summary items of interest in summary order */
if (uids) {
wanted = g_hash_table_new(g_str_hash, g_str_equal);
for (i=0;i<uids->len;i++)
@@ -623,7 +630,7 @@ add_present_rec(CamelFolderThread *thread, GHashTable *have, GPtrArray *summary,
if (g_hash_table_lookup(have, (char *)uid)) {
g_hash_table_remove(have, (char *)camel_message_info_uid(node->message));
- g_ptr_array_add(summary, node->message);
+ g_ptr_array_add(summary, (void *) node->message);
} else {
camel_folder_free_message_info(thread->folder, (CamelMessageInfo *)node->message);
}
diff --git a/camel/camel-folder-thread.h b/camel/camel-folder-thread.h
index 3b40fe9d9c..8bb78e27a0 100644
--- a/camel/camel-folder-thread.h
+++ b/camel/camel-folder-thread.h
@@ -41,8 +41,9 @@ typedef struct _CamelFolderThreadNode {
} CamelFolderThreadNode;
typedef struct _CamelFolderThread {
- int refcount;
-
+ guint32 refcount : 31;
+ guint32 subject : 1;
+
struct _CamelFolderThreadNode *tree;
struct _EMemChunk *node_chunks;
CamelFolder *folder;
@@ -50,7 +51,7 @@ typedef struct _CamelFolderThread {
} CamelFolderThread;
/* interface 1: using uid's */
-CamelFolderThread *camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids);
+CamelFolderThread *camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids, gboolean thread_subject);
void camel_folder_thread_messages_apply(CamelFolderThread *thread, GPtrArray *uids);
/* interface 2: using messageinfo's. Currently disabled. */