From 36a5d291d999fe6036eb101525546148d281464a Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 28 Feb 2020 00:37:12 +0200 Subject: [PATCH] server/mu4e: update decrypt/verify options "extract-encrypted" -> "decrypt" and a separate option for "verify" --- mu/mu-cmd-server.cc | 24 +++++++++++++++--------- mu4e/mu4e-proc.el | 16 +++++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mu/mu-cmd-server.cc b/mu/mu-cmd-server.cc index 46d8cffa..96702981 100644 --- a/mu/mu-cmd-server.cc +++ b/mu/mu-cmd-server.cc @@ -266,13 +266,16 @@ static MuMsgOptions message_options (const Parameters& params) { 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) opts |= MU_MSG_OPTION_EXTRACT_IMAGES; - if (extract_encrypted) - opts |= MU_MSG_OPTION_DECRYPT; + if (verify) + 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; } @@ -1154,8 +1157,7 @@ make_command_map (Context& context) ArgMap{{"type", ArgInfo{Type::Symbol, true, "type of composition: reply/forward/edit/resend/new"}}, {"docid", ArgInfo{Type::Integer, false,"document id of parent-message, if any"}}, - {"extract-encrypted", ArgInfo{Type::Symbol, false, - "whether to decrypt encrypted parts (if any)" }}}, + {"decrypt", ArgInfo{Type::Symbol, false, "whether to decrypt encrypted parts (if any)" }}}, "get contact information", [&](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" }}, {"index", ArgInfo{Type::Integer, true, "index for the part to operate on" }}, {"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)" }}, {"path", ArgInfo{Type::String, false, "part for saving (for action: save)" }}, {"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, "whether to extract images for this messages (if any)"}}, - {"extract-encrypted", ArgInfo{Type::Symbol, false, - "whether to decrypt encrypted parts (if any)" }}}, + {"decrypt", ArgInfo{Type::Symbol, false, + "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", [&](const auto& params){view_handler(context, params);}}); return cmap; diff --git a/mu4e/mu4e-proc.el b/mu4e/mu4e-proc.el index 118a4afb..6ddbfed4 100644 --- a/mu4e/mu4e-proc.el +++ b/mu4e/mu4e-proc.el @@ -330,7 +330,7 @@ The result is delivered to the function registered as `mu4e-compose-func'." (mu4e~call-mu `(compose :type ,type - :extract-encrypted ,decrypt + :decrypt ,decrypt :docid ,docid))) (defun mu4e~proc-contacts (personal after tstamp) @@ -357,7 +357,7 @@ to a temporary file, then respond with :action ,action :docid ,docid :index ,index - :extract-encrypted ,decrypt + :decrypt ,decrypt :path ,path :what ,what :param ,param))) @@ -467,28 +467,30 @@ respectively." :fcc )." (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. 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 registered as `mu4e-view-func'." (mu4e~call-mu `(view :docid ,(if (stringp docid-or-msgid) nil docid-or-msgid) :msgid ,(if (stringp docid-or-msgid) docid-or-msgid nil) :extract-images ,images - :extract-encrypted ,decrypt))) + :decrypt ,decrypt + :verify ,verify))) (defun mu4e~proc-view-path (path &optional images decrypt) "View message at PATH.. Optionally, if IMAGES is non-nil, backend will any images attached to the message, and return them as temp files. The 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 :path ,path :extract-images ,images - :extract-encrypted ,decrypt))) + :decrypt ,decrypt + :verify ,verify))) ;;; _ (provide 'mu4e-proc)