mirror of https://github.com/djcb/mu.git
* mu-msg-sexp: mark attachments as such
This commit is contained in:
parent
1c058a1b9d
commit
74189c04a4
|
@ -278,33 +278,27 @@ get_part_type_string (MuMsgPartType ptype)
|
|||
{
|
||||
GString *gstr;
|
||||
unsigned u;
|
||||
MuMsgPartType ptypes[] = {
|
||||
MU_MSG_PART_TYPE_LEAF,
|
||||
MU_MSG_PART_TYPE_MESSAGE,
|
||||
MU_MSG_PART_TYPE_INLINE,
|
||||
MU_MSG_PART_TYPE_SIGNED,
|
||||
MU_MSG_PART_TYPE_ENCRYPTED
|
||||
struct PartTypes {
|
||||
MuMsgPartType ptype;
|
||||
const char* name;
|
||||
} ptypes[] = {
|
||||
{ MU_MSG_PART_TYPE_LEAF, "leaf" },
|
||||
{ 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_append_c (gstr, '(');
|
||||
|
||||
for (u = 0; u!= G_N_ELEMENTS(ptypes); ++u) {
|
||||
const char* name;
|
||||
switch (ptype & ptypes[u]) {
|
||||
case MU_MSG_PART_TYPE_NONE : continue;
|
||||
case MU_MSG_PART_TYPE_LEAF :name = "leaf"; break;
|
||||
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 (ptype & ptypes[u].ptype) {
|
||||
if (gstr->len > 1)
|
||||
gstr = g_string_append_c (gstr, ' ');
|
||||
gstr = g_string_append (gstr, ptypes[u].name);
|
||||
}
|
||||
if (gstr->len > 1)
|
||||
gstr = g_string_append_c (gstr, ' ');
|
||||
gstr = g_string_append (gstr, name);
|
||||
}
|
||||
|
||||
gstr = g_string_append_c (gstr, ')');
|
||||
|
|
Loading…
Reference in New Issue