Add Decryption field

Add a decryption field of the form

Decryption: 2 part(s) decrypted 1 part(s) failed

Meaning that 2 encrypted mime parts where successfully decrypted and 1
part failed.  Note that the number 2 refers to the number of
successfully decrypted mime parts and not the number of successfully
decrypted encryptes multiparts, i.e., if an encrypted multipart
contains 4 parts and decryption is successful the field will be

Decryption: 4 part(s) decrypted

TODO: Add details button listing the names and indexes of the
decrypted (or not) mime-parts
This commit is contained in:
Foivos S. Zakkak
2014-10-19 03:20:21 +03:00
parent ae75060b6a
commit 2d843ca887
4 changed files with 85 additions and 30 deletions

View File

@ -300,6 +300,21 @@ sig_verdict (MuMsgPart *mpart)
}
}
static const char*
dec_verdict (MuMsgPart *mpart)
{
MuMsgPartType ptype;
ptype = mpart->part_type;
if (ptype & MU_MSG_PART_TYPE_DECRYPTED)
return ":decryption succeeded";
else if (ptype & MU_MSG_PART_TYPE_ENCRYPTED)
return ":decryption failed";
else
return "";
}
static gchar *
get_part_type_string (MuMsgPartType ptype)
@ -348,7 +363,7 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo)
tmp = g_strdup_printf
("%s(:index %d :name \"%s\" :mime-type \"%s/%s\"%s%s "
":type %s "
":attachment %s :size %i %s)",
":attachment %s :size %i %s %s)",
pinfo->parts ? pinfo->parts: "",
part->index,
name ? name : "noname",
@ -358,7 +373,8 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo)
parttype,
mu_msg_part_maybe_attachment (part) ? "t" : "nil",
(int)part->size,
sig_verdict (part));
sig_verdict (part),
dec_verdict (part));
g_free (pinfo->parts);
pinfo->parts = tmp;