* crypto: implement automagic decryption when so requested

(mainly by adding some smartness to various part_foreach functions, adding
  mu_msg_(get|set)_auto_decrypt to mark a message for auto-decryption)
This commit is contained in:
djcb
2012-07-27 18:04:17 +03:00
parent c88aea5285
commit 8432156765
6 changed files with 234 additions and 65 deletions

View File

@ -84,7 +84,8 @@ msg_new (void)
}
MuMsg*
mu_msg_new_from_file (const char *path, const char *mdir, GError **err)
mu_msg_new_from_file (const char *path, const char *mdir,
GError **err)
{
MuMsg *self;
MuMsgFile *msgfile;
@ -169,6 +170,26 @@ mu_msg_unref (MuMsg *self)
}
void
mu_msg_set_auto_decrypt (MuMsg *msg, gboolean autodecrypt)
{
g_return_if_fail (msg);
mu_msg_load_msg_file (msg, NULL);
msg->_file->_auto_decrypt = autodecrypt;
}
gboolean
mu_msg_get_auto_decrypt (MuMsg *msg)
{
g_return_val_if_fail (msg, FALSE);
if (!msg->_file)
return FALSE;
return msg->_file->_auto_decrypt;
}
/* use this instead of mu_msg_get_path so we don't get into infinite
* regress...*/
static const char*
@ -377,8 +398,6 @@ mu_msg_get_timestamp (MuMsg *self)
}
const char*
mu_msg_get_path (MuMsg *self)
{