server/mu4e: update decrypt/verify options

"extract-encrypted" -> "decrypt"

and a separate option for "verify"
This commit is contained in:
Dirk-Jan C. Binnema 2020-02-28 00:37:12 +02:00
parent 6b2bdf4f6d
commit 36a5d291d9
2 changed files with 24 additions and 16 deletions

View File

@ -266,13 +266,16 @@ static MuMsgOptions
message_options (const Parameters& params) message_options (const Parameters& params)
{ {
const auto extract_images{get_bool_or(params, "extract-images", false)}; const auto extract_images{get_bool_or(params, "extract-images", false)};
const auto extract_encrypted{get_bool_or(params, "extract-encrypted", false)}; const auto decrypt{get_bool_or(params, "decrypt", false)};
const auto verify{get_bool_or(params, "verify", false)};
int opts{MU_MSG_OPTION_VERIFY | MU_MSG_OPTION_USE_AGENT}; int opts{MU_MSG_OPTION_NONE};
if (extract_images) if (extract_images)
opts |= MU_MSG_OPTION_EXTRACT_IMAGES; opts |= MU_MSG_OPTION_EXTRACT_IMAGES;
if (extract_encrypted) if (verify)
opts |= MU_MSG_OPTION_DECRYPT; opts |= MU_MSG_OPTION_VERIFY | MU_MSG_OPTION_USE_AGENT;
if (decrypt)
opts |= MU_MSG_OPTION_DECRYPT | MU_MSG_OPTION_USE_AGENT;
return (MuMsgOptions)opts; return (MuMsgOptions)opts;
} }
@ -1154,8 +1157,7 @@ make_command_map (Context& context)
ArgMap{{"type", ArgInfo{Type::Symbol, true, ArgMap{{"type", ArgInfo{Type::Symbol, true,
"type of composition: reply/forward/edit/resend/new"}}, "type of composition: reply/forward/edit/resend/new"}},
{"docid", ArgInfo{Type::Integer, false,"document id of parent-message, if any"}}, {"docid", ArgInfo{Type::Integer, false,"document id of parent-message, if any"}},
{"extract-encrypted", ArgInfo{Type::Symbol, false, {"decrypt", ArgInfo{Type::Symbol, false, "whether to decrypt encrypted parts (if any)" }}},
"whether to decrypt encrypted parts (if any)" }}},
"get contact information", "get contact information",
[&](const auto& params){compose_handler(context, params);}}); [&](const auto& params){compose_handler(context, params);}});
@ -1175,7 +1177,7 @@ make_command_map (Context& context)
ArgMap{{"docid", ArgInfo{Type::Integer, true, "document for the message" }}, ArgMap{{"docid", ArgInfo{Type::Integer, true, "document for the message" }},
{"index", ArgInfo{Type::Integer, true, "index for the part to operate on" }}, {"index", ArgInfo{Type::Integer, true, "index for the part to operate on" }},
{"action", ArgInfo{Type::Symbol, true, "what to do with the part" }}, {"action", ArgInfo{Type::Symbol, true, "what to do with the part" }},
{"extract-encrypted", ArgInfo{Type::Symbol, false, {"decrypt", ArgInfo{Type::Symbol, false,
"whether to decrypt encrypted parts (if any)" }}, "whether to decrypt encrypted parts (if any)" }},
{"path", ArgInfo{Type::String, false, "part for saving (for action: save)" }}, {"path", ArgInfo{Type::String, false, "part for saving (for action: save)" }},
{"what", ArgInfo{Type::Symbol, false, "what to do with the part (feedback)" }}, {"what", ArgInfo{Type::Symbol, false, "what to do with the part (feedback)" }},
@ -1271,8 +1273,12 @@ make_command_map (Context& context)
{"extract-images", ArgInfo{Type::Symbol, false, {"extract-images", ArgInfo{Type::Symbol, false,
"whether to extract images for this messages (if any)"}}, "whether to extract images for this messages (if any)"}},
{"extract-encrypted", ArgInfo{Type::Symbol, false, {"decrypt", ArgInfo{Type::Symbol, false,
"whether to decrypt encrypted parts (if any)" }}}, "whether to decrypt encrypted parts (if any)" }},
{"verify", ArgInfo{Type::Symbol, false,
"whether to verify signatures (if any)" }}
},
"view a message. exactly one of docid/msgid/path must be specified", "view a message. exactly one of docid/msgid/path must be specified",
[&](const auto& params){view_handler(context, params);}}); [&](const auto& params){view_handler(context, params);}});
return cmap; return cmap;

View File

@ -330,7 +330,7 @@ The result is delivered to the function registered as
`mu4e-compose-func'." `mu4e-compose-func'."
(mu4e~call-mu `(compose (mu4e~call-mu `(compose
:type ,type :type ,type
:extract-encrypted ,decrypt :decrypt ,decrypt
:docid ,docid))) :docid ,docid)))
(defun mu4e~proc-contacts (personal after tstamp) (defun mu4e~proc-contacts (personal after tstamp)
@ -357,7 +357,7 @@ to a temporary file, then respond with
:action ,action :action ,action
:docid ,docid :docid ,docid
:index ,index :index ,index
:extract-encrypted ,decrypt :decrypt ,decrypt
:path ,path :path ,path
:what ,what :what ,what
:param ,param))) :param ,param)))
@ -467,28 +467,30 @@ respectively."
<docid> :fcc <path>)." <docid> :fcc <path>)."
(mu4e~call-mu `(sent :path ,path))) (mu4e~call-mu `(sent :path ,path)))
(defun mu4e~proc-view (docid-or-msgid &optional images decrypt) (defun mu4e~proc-view (docid-or-msgid &optional images decrypt verify)
"Get a message DOCID-OR-MSGID. "Get a message DOCID-OR-MSGID.
Optionally, if IMAGES is non-nil, backend will any images Optionally, if IMAGES is non-nil, backend will any images
attached to the message, and return them as temp files. DECRYPT attached to the message, and return them as temp files. DECRYPT and VERIFY
if necessary. The result will be delivered to the function if necessary. The result will be delivered to the function
registered as `mu4e-view-func'." registered as `mu4e-view-func'."
(mu4e~call-mu `(view (mu4e~call-mu `(view
:docid ,(if (stringp docid-or-msgid) nil docid-or-msgid) :docid ,(if (stringp docid-or-msgid) nil docid-or-msgid)
:msgid ,(if (stringp docid-or-msgid) docid-or-msgid nil) :msgid ,(if (stringp docid-or-msgid) docid-or-msgid nil)
:extract-images ,images :extract-images ,images
:extract-encrypted ,decrypt))) :decrypt ,decrypt
:verify ,verify)))
(defun mu4e~proc-view-path (path &optional images decrypt) (defun mu4e~proc-view-path (path &optional images decrypt)
"View message at PATH.. "View message at PATH..
Optionally, if IMAGES is non-nil, backend will any images Optionally, if IMAGES is non-nil, backend will any images
attached to the message, and return them as temp files. The attached to the message, and return them as temp files. The
result will be delivered to the function registered as result will be delivered to the function registered as
`mu4e-view-func'. Optionally DECRYPT." `mu4e-view-func'. Optionally DECRYPT and VERIFY."
(mu4e~call-mu `(view (mu4e~call-mu `(view
:path ,path :path ,path
:extract-images ,images :extract-images ,images
:extract-encrypted ,decrypt))) :decrypt ,decrypt
:verify ,verify)))
;;; _ ;;; _
(provide 'mu4e-proc) (provide 'mu4e-proc)