* mu-msg-sexp: mark attachments as such

This commit is contained in:
djcb 2012-08-10 09:59:01 +03:00
parent 1c058a1b9d
commit 74189c04a4
1 changed files with 14 additions and 20 deletions

View File

@ -278,33 +278,27 @@ get_part_type_string (MuMsgPartType ptype)
{ {
GString *gstr; GString *gstr;
unsigned u; unsigned u;
MuMsgPartType ptypes[] = { struct PartTypes {
MU_MSG_PART_TYPE_LEAF, MuMsgPartType ptype;
MU_MSG_PART_TYPE_MESSAGE, const char* name;
MU_MSG_PART_TYPE_INLINE, } ptypes[] = {
MU_MSG_PART_TYPE_SIGNED, { MU_MSG_PART_TYPE_LEAF, "leaf" },
MU_MSG_PART_TYPE_ENCRYPTED { MU_MSG_PART_TYPE_MESSAGE, "message" },
{ MU_MSG_PART_TYPE_INLINE, "inline" },
{ MU_MSG_PART_TYPE_ATTACHMENT, "attachment" },
{ MU_MSG_PART_TYPE_SIGNED, "signed" },
{ MU_MSG_PART_TYPE_ENCRYPTED, "encrypted" }
}; };
gstr = g_string_sized_new (100); /* more than enough */ gstr = g_string_sized_new (100); /* more than enough */
gstr = g_string_append_c (gstr, '('); gstr = g_string_append_c (gstr, '(');
for (u = 0; u!= G_N_ELEMENTS(ptypes); ++u) { for (u = 0; u!= G_N_ELEMENTS(ptypes); ++u) {
const char* name; if (ptype & ptypes[u].ptype) {
switch (ptype & ptypes[u]) { if (gstr->len > 1)
case MU_MSG_PART_TYPE_NONE : continue; gstr = g_string_append_c (gstr, ' ');
case MU_MSG_PART_TYPE_LEAF :name = "leaf"; break; gstr = g_string_append (gstr, ptypes[u].name);
case MU_MSG_PART_TYPE_MESSAGE :name = "message"; break;
case MU_MSG_PART_TYPE_INLINE :name = "inline"; break;
case MU_MSG_PART_TYPE_SIGNED :name = "signed"; break;
case MU_MSG_PART_TYPE_ENCRYPTED :name = "encrypted"; break;
default:g_return_val_if_reached (NULL);
return NULL;
} }
if (gstr->len > 1)
gstr = g_string_append_c (gstr, ' ');
gstr = g_string_append (gstr, name);
} }
gstr = g_string_append_c (gstr, ')'); gstr = g_string_append_c (gstr, ')');