* 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

@ -38,18 +38,16 @@ enum _MuMsgOptions {
/* 1 << 0 is still free! */
/* for -> sexp conversion */
MU_MSG_OPTION_HEADERS_ONLY = 1 << 1,
MU_MSG_OPTION_EXTRACT_IMAGES = 1 << 2,
/* 1 << 3 is still free! */
/* below options are for checking signatures; only effective
* if mu was built with crypto support */
MU_MSG_OPTION_CHECK_SIGNATURES = 1 << 4,
MU_MSG_OPTION_AUTO_RETRIEVE_KEY = 1 << 5,
MU_MSG_OPTION_USE_AGENT = 1 << 6,
MU_MSG_OPTION_USE_PKCS7 = 1 << 7 /* gpg is the default */
};
typedef enum _MuMsgOptions MuMsgOptions;
@ -138,6 +136,28 @@ MuMsg *mu_msg_ref (MuMsg *msg);
void mu_msg_unref (MuMsg *msg);
/**
* should we set this message to 'autodecrypt'? if so, try to
* automatically decrypt encrypted message parts.
*
* @param msg a message
* @param autodecrypt TRUE or FALSE
*
* @return
*/
void mu_msg_set_auto_decrypt (MuMsg *msg, gboolean autodecrypt);
/**
* get the autodecrypt status for this message. See @func mu_msg_set_auto_decrypt
*
* @param msg a message
*
* @return the auto-decrypt status
*/
gboolean mu_msg_get_auto_decrypt (MuMsg *msg);
/**
* cache the values from the backend (file or db), so we don't the
@ -566,6 +586,8 @@ typedef gboolean (*MuMsgContactForeachFunc) (MuMsgContact* contact,
void mu_msg_contact_foreach (MuMsg *msg, MuMsgContactForeachFunc func,
gpointer user_data);
G_END_DECLS
#endif /*__MU_MSG_H__*/