* mu-msg-sexp: get the thread info too
This commit is contained in:
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "mu-str.h"
|
#include "mu-str.h"
|
||||||
#include "mu-msg.h"
|
#include "mu-msg.h"
|
||||||
|
#include "mu-msg-iter.h"
|
||||||
#include "mu-msg-part.h"
|
#include "mu-msg-part.h"
|
||||||
#include "mu-maildir.h"
|
#include "mu-maildir.h"
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ get_name_addr_pair (MuMsgContact *c)
|
|||||||
static void
|
static void
|
||||||
add_prefix_maybe (GString *gstr, gboolean *field, const char *prefix)
|
add_prefix_maybe (GString *gstr, gboolean *field, const char *prefix)
|
||||||
{
|
{
|
||||||
|
/* if there's nothing in the field yet, add the prefix */
|
||||||
if (!*field)
|
if (!*field)
|
||||||
g_string_append (gstr, prefix);
|
g_string_append (gstr, prefix);
|
||||||
|
|
||||||
@ -104,6 +106,8 @@ each_contact (MuMsgContact *c, ContactData *cdata)
|
|||||||
|
|
||||||
ctype = mu_msg_contact_type (c);
|
ctype = mu_msg_contact_type (c);
|
||||||
|
|
||||||
|
/* if the current type is not the previous type, close the
|
||||||
|
* previous first */
|
||||||
if (cdata->prev_ctype != ctype && cdata->prev_ctype != (unsigned)-1)
|
if (cdata->prev_ctype != ctype && cdata->prev_ctype != (unsigned)-1)
|
||||||
g_string_append (cdata->gstr, ")\n");
|
g_string_append (cdata->gstr, ")\n");
|
||||||
|
|
||||||
@ -241,8 +245,22 @@ append_sexp_message_file_attr (GString *gstr, MuMsg *msg)
|
|||||||
mu_msg_get_body_html(msg));
|
mu_msg_get_body_html(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
|
||||||
|
{
|
||||||
|
g_string_append_printf
|
||||||
|
(gstr, "\t:thread (:path \"%s\" :root %s :first-child %s "
|
||||||
|
":empty-parent %s :duplicate %s)\n",
|
||||||
|
ti->threadpath,
|
||||||
|
ti->prop & MU_MSG_ITER_THREAD_PROP_ROOT ? "t" : "nil",
|
||||||
|
ti->prop & MU_MSG_ITER_THREAD_PROP_FIRST_CHILD ? "t" : "nil",
|
||||||
|
ti->prop & MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT ? "t" : "nil",
|
||||||
|
ti->prop & MU_MSG_ITER_THREAD_PROP_DUP ? "t" : "nil");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
mu_msg_to_sexp (MuMsg *msg, gboolean dbonly)
|
mu_msg_to_sexp (MuMsg *msg, const MuMsgIterThreadInfo *ti, gboolean dbonly)
|
||||||
{
|
{
|
||||||
GString *gstr;
|
GString *gstr;
|
||||||
time_t t;
|
time_t t;
|
||||||
@ -251,6 +269,10 @@ mu_msg_to_sexp (MuMsg *msg, gboolean dbonly)
|
|||||||
g_string_append (gstr, "(\n");
|
g_string_append (gstr, "(\n");
|
||||||
|
|
||||||
append_sexp_contacts (gstr, msg);
|
append_sexp_contacts (gstr, msg);
|
||||||
|
|
||||||
|
if (ti)
|
||||||
|
append_sexp_thread_info (gstr, ti);
|
||||||
|
|
||||||
append_sexp_attr (gstr,
|
append_sexp_attr (gstr,
|
||||||
"subject", mu_msg_get_subject (msg));
|
"subject", mu_msg_get_subject (msg));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user