1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-21 06:56:48 +02:00

* make mu-msg-file return references in same order as found in msgs; update

unit test
This commit is contained in:
Dirk-Jan C. Binnema 2011-06-08 09:01:26 +03:00
parent ef6f58d51b
commit 583afc2749
2 changed files with 20 additions and 4 deletions

View File

@ -662,8 +662,11 @@ get_body (MuMsgFile *self, gboolean want_html)
}
/* get them in the order parent->grandparent->..., i.e. in opposite
* from what's in the header
*/
static GSList*
get_msgids_from_header (MuMsgFile *self, const char* header)
get_msgids_reverted (MuMsgFile *self, const gchar *header)
{
GSList *msgids;
const char *str;
@ -686,7 +689,7 @@ get_msgids_from_header (MuMsgFile *self, const char* header)
g_mime_references_free (mime_refs);
}
return g_slist_reverse (msgids);
return msgids;
}
@ -697,11 +700,11 @@ get_references (MuMsgFile *self)
g_return_val_if_fail (self, NULL);
refs = get_msgids_from_header (self, "References");
refs = get_msgids_reverted (self, "References");
/* now, add in-reply-to:, we only take the first one if there
* are more */
inreply = get_msgids_from_header (self, "In-reply-to");
inreply = get_msgids_reverted (self, "In-reply-to");
if (inreply) {
refs = g_slist_prepend (refs, g_strdup ((gchar*)inreply->data));
g_slist_foreach (inreply, (GFunc)g_free, NULL);

View File

@ -288,6 +288,19 @@ test_mu_msg_comp_unix_programmer (void)
g_assert_cmpstr (mu_msg_get_msgid(msg),
==, "oktdp.42997$Te.22361@news.usenetserver.com");
g_assert_cmpstr (mu_msg_get_references_str(msg), ==,
"e9065dac-13c1-4103-9e31-6974ca232a89@t15g2000prt.googlegroups.com,"
"87hbblwelr.fsf@sapphire.mobileactivedefense.com,"
"pql248-4va.ln1@wilbur.25thandClement.com,"
"ikns6r$li3$1@Iltempo.Update.UU.SE,"
"8762s0jreh.fsf@sapphire.mobileactivedefense.com,"
"ikqqp1$jv0$1@Iltempo.Update.UU.SE,"
"87hbbjc5jt.fsf@sapphire.mobileactivedefense.com,"
"ikr0na$lru$1@Iltempo.Update.UU.SE,"
"tO8cp.1228$GE6.370@news.usenetserver.com,"
"ikr6ks$nlf$1@Iltempo.Update.UU.SE,"
"8ioh48-8mu.ln1@leafnode-msgid.gclare.org.uk");
//"jimbo@slp53.sl.home (Jimbo Foobarcuux)";
g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */
==, MU_MSG_PRIO_NORMAL);