core: New keyword --file for OpenPGP recpstring.
* src/engine-gpg.c (append_args_from_recipients_string): Add new flags. -- Now you can use gpgme to encrypt without first importing a key. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
c143ab692c
commit
3589da0500
@ -6188,12 +6188,32 @@ to first create key objects. Leading and trailing white space is
|
|||||||
remove from each line in @var{recpstring}. The keys are then passed
|
remove from each line in @var{recpstring}. The keys are then passed
|
||||||
verbatim to the backend engine.
|
verbatim to the backend engine.
|
||||||
|
|
||||||
For the OpenPGP backend two special keywords are supported to modify
|
For the OpenPGP backend several special keywords are supported to
|
||||||
the operation: If the keyword "--hidden" is given as a recipient, it
|
modify the operation. These keywords are given instead of a key
|
||||||
is skipped but will trun all following key specifications to be hidden
|
specification. The currently supported keywords are:
|
||||||
recipients. If the keyword "--" is given as a recipient, it will be
|
|
||||||
skipped but no keywords will be detected in all following key
|
@table @code
|
||||||
specifications.
|
@item --hidden
|
||||||
|
@itemx --no-hidden
|
||||||
|
These keywords toggle between normal and hidden recipients for all
|
||||||
|
following key specifications. When a hidden recipient is requested
|
||||||
|
the gpg option @option{-R} (or @option{-F} in file mode) is used
|
||||||
|
instead of @option{-r} (@option{-f} in file mode).
|
||||||
|
|
||||||
|
@item --file
|
||||||
|
@itemx --no-file
|
||||||
|
These keywords toggle between regular and file mode for all following
|
||||||
|
key specification. In file mode the option @option{-f} or @option{-F}
|
||||||
|
is passed to gpg. At least GnuPG version 2.1.14 is required to handle
|
||||||
|
these options. The @code{GPGME_ENCRYPT_WANT_ADDRESS} flag is ignored
|
||||||
|
in file mode.
|
||||||
|
|
||||||
|
@item --
|
||||||
|
This keyword disables all keyword detection up to the end of the
|
||||||
|
string. All keywords are treated as verbatim arguments.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
|
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
@ -2001,9 +2001,11 @@ append_args_from_recipients_string (engine_gpg_t gpg,
|
|||||||
const char *string)
|
const char *string)
|
||||||
{
|
{
|
||||||
gpg_error_t err = 0;
|
gpg_error_t err = 0;
|
||||||
|
gpgme_encrypt_flags_t orig_flags = flags;
|
||||||
int any = 0;
|
int any = 0;
|
||||||
int ignore = 0;
|
int ignore = 0;
|
||||||
int hidden = 0;
|
int hidden = 0;
|
||||||
|
int file = 0;
|
||||||
const char *s;
|
const char *s;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -2028,10 +2030,22 @@ append_args_from_recipients_string (engine_gpg_t gpg,
|
|||||||
ignore = 1;
|
ignore = 1;
|
||||||
else if (!ignore && n == 8 && !memcmp (string, "--hidden", 8))
|
else if (!ignore && n == 8 && !memcmp (string, "--hidden", 8))
|
||||||
hidden = 1;
|
hidden = 1;
|
||||||
else if (n)
|
else if (!ignore && n == 11 && !memcmp (string, "--no-hidden", 11))
|
||||||
|
hidden = 0;
|
||||||
|
else if (!ignore && n == 6 && !memcmp (string, "--file", 6))
|
||||||
{
|
{
|
||||||
/* Add arg if it is not empty. */
|
file = 1;
|
||||||
err = add_arg (gpg, hidden? "-R":"-r");
|
/* Because the key is used as is we need to ignore this flag: */
|
||||||
|
flags &= ~GPGME_ENCRYPT_WANT_ADDRESS;
|
||||||
|
}
|
||||||
|
else if (!ignore && n == 9 && !memcmp (string, "--no-file", 9))
|
||||||
|
{
|
||||||
|
file = 0;
|
||||||
|
flags = orig_flags;
|
||||||
|
}
|
||||||
|
else if (n) /* Not empty - use it. */
|
||||||
|
{
|
||||||
|
err = add_arg (gpg, file? (hidden? "-F":"-f") : (hidden? "-R":"-r"));
|
||||||
if (!err)
|
if (!err)
|
||||||
err = add_arg_recipient_string (gpg, flags, string, n);
|
err = add_arg_recipient_string (gpg, flags, string, n);
|
||||||
if (!err)
|
if (!err)
|
||||||
|
Loading…
Reference in New Issue
Block a user