* mu-msg-threader: set docid on previously seen virtual messages
This commit is contained in:
@ -147,7 +147,6 @@ mu_msg_threader_calculate (MuMsgIter *iter, size_t matchnum)
|
|||||||
|
|
||||||
/* sort */
|
/* sort */
|
||||||
mu_msg_iter_reset (iter); /* go all the way back */
|
mu_msg_iter_reset (iter); /* go all the way back */
|
||||||
|
|
||||||
|
|
||||||
/* finally, deliver the docid => thread-path hash */
|
/* finally, deliver the docid => thread-path hash */
|
||||||
thread_ids = create_doc_id_thread_path_hash (root_set,
|
thread_ids = create_doc_id_thread_path_hash (root_set,
|
||||||
@ -183,7 +182,8 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
|
|||||||
const char* msgid;
|
const char* msgid;
|
||||||
|
|
||||||
g_return_val_if_fail (msg, NULL);
|
g_return_val_if_fail (msg, NULL);
|
||||||
|
g_return_val_if_fail (docid != 0, NULL);
|
||||||
|
|
||||||
msgid = mu_msg_get_msgid (msg);
|
msgid = mu_msg_get_msgid (msg);
|
||||||
if (!msgid)
|
if (!msgid)
|
||||||
msgid = mu_msg_get_path (msg); /* fake it */
|
msgid = mu_msg_get_path (msg); /* fake it */
|
||||||
@ -194,6 +194,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
|
|||||||
* Store this message in the Container's message slot. */
|
* Store this message in the Container's message slot. */
|
||||||
if (c && !c->msg) {
|
if (c && !c->msg) {
|
||||||
c->msg = mu_msg_ref (msg);
|
c->msg = mu_msg_ref (msg);
|
||||||
|
c->docid = docid;
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
} else if (!c) { /* Else: Create a new Container object holding
|
} else if (!c) { /* Else: Create a new Container object holding
|
||||||
@ -273,10 +274,10 @@ handle_references (GHashTable *id_table, Container *c)
|
|||||||
use this new one. Find this Container in the parent's
|
use this new one. Find this Container in the parent's
|
||||||
children list, and unlink it.
|
children list, and unlink it.
|
||||||
|
|
||||||
Note that this could cause this message to now have no parent, if it
|
Note that this could cause this message to now have no
|
||||||
has no references field, but some message referred to it as the
|
parent, if it has no references field, but some message
|
||||||
non-first element of its references. (Which would have been some kind
|
referred to it as the non-first element of its
|
||||||
of lie...)
|
references. (Which would have been some kind of lie...)
|
||||||
|
|
||||||
Note that at all times, the various ``parent'' and ``child'' fields
|
Note that at all times, the various ``parent'' and ``child'' fields
|
||||||
must be kept inter-consistent. */
|
must be kept inter-consistent. */
|
||||||
@ -458,7 +459,6 @@ group_root_set_by_subject (GSList *root_set)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
G_GNUC_UNUSED static gint
|
G_GNUC_UNUSED static gint
|
||||||
cmp_dates (Container *c1, Container *c2)
|
cmp_dates (Container *c1, Container *c2)
|
||||||
{
|
{
|
||||||
@ -619,11 +619,16 @@ static Container*
|
|||||||
container_new (MuMsg *msg, guint docid, const char *msgid)
|
container_new (MuMsg *msg, guint docid, const char *msgid)
|
||||||
{
|
{
|
||||||
Container *c;
|
Container *c;
|
||||||
c = g_slice_new0 (Container);
|
|
||||||
|
|
||||||
|
g_return_val_if_fail (!msg || docid != 0, NULL);
|
||||||
|
|
||||||
|
c = g_slice_new0 (Container);
|
||||||
|
|
||||||
if (msg)
|
if (msg)
|
||||||
c->msg = mu_msg_ref (msg);
|
c->msg = mu_msg_ref (msg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c->docid = docid;
|
c->docid = docid;
|
||||||
c->msgid = msgid;
|
c->msgid = msgid;
|
||||||
|
|
||||||
@ -690,6 +695,9 @@ container_remove_child (Container *c, Container *child)
|
|||||||
g_return_if_fail (child);
|
g_return_if_fail (child);
|
||||||
g_return_if_fail (!child->child);
|
g_return_if_fail (!child->child);
|
||||||
g_return_if_fail (c != child);
|
g_return_if_fail (c != child);
|
||||||
|
|
||||||
|
/* g_print ("%s: %s <-- %s\n", __FUNCTION__, c->msgid, */
|
||||||
|
/* child->msgid); */
|
||||||
|
|
||||||
for (prev = NULL, cur = c->child; cur; cur = cur->next) {
|
for (prev = NULL, cur = c->child; cur; cur = cur->next) {
|
||||||
|
|
||||||
@ -758,6 +766,9 @@ container_splice (Container *parent, Container *child)
|
|||||||
g_return_if_fail (parent);
|
g_return_if_fail (parent);
|
||||||
g_return_if_fail (child);
|
g_return_if_fail (child);
|
||||||
g_return_if_fail (parent != child);
|
g_return_if_fail (parent != child);
|
||||||
|
|
||||||
|
/* g_print ("%s: %s <-- %s\n", __FUNCTION__, parent->msgid, */
|
||||||
|
/* child->msgid); */
|
||||||
|
|
||||||
container_add_child (parent, child->child);
|
container_add_child (parent, child->child);
|
||||||
child->child = NULL;
|
child->child = NULL;
|
||||||
@ -807,8 +818,8 @@ dump_container (Container *c)
|
|||||||
|
|
||||||
subject = (c->msg) ? mu_msg_get_subject (c->msg) : "<none>";
|
subject = (c->msg) ? mu_msg_get_subject (c->msg) : "<none>";
|
||||||
|
|
||||||
g_print ("[%s][%s m:%p p:%p]\n",c->msgid, subject, (void*)c,
|
g_print ("[%s][%s m:%p p:%p docid:%u]\n",c->msgid, subject, (void*)c,
|
||||||
(void*)c->parent);
|
(void*)c->parent, c->docid);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user