added new status messages

This commit is contained in:
Werner Koch 2001-09-07 12:47:33 +00:00
parent 5b3d8162b4
commit 92ca22fe6b
4 changed files with 35 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2001-09-07 Werner Koch <wk@gnupg.org>
* rungpg.h: Add NO_RECP.
* encrypt.c (encrypt_status_handler): Take on No_RECP.
(gpgme_op_encrypt): Better error return.
* verify.c (verify_status_handler): Take on NODATA.
2001-09-03 Werner Koch <wk@gnupg.org>
* rungpg.h: Added STATUS_INV_RECP.

View File

@ -39,6 +39,7 @@
struct encrypt_result_s {
int no_recipients;
GpgmeData xmlinfo;
};
@ -126,6 +127,10 @@ encrypt_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
append_xml_encinfo (&ctx->result.encrypt->xmlinfo, args);
break;
case STATUS_NO_RECP:
ctx->result.encrypt->no_recipients = 1; /* i.e. no usable ones */
break;
default:
break;
}
@ -222,18 +227,27 @@ GpgmeError
gpgme_op_encrypt ( GpgmeCtx c, GpgmeRecipients recp,
GpgmeData in, GpgmeData out )
{
int rc = gpgme_op_encrypt_start ( c, recp, in, out );
if ( !rc ) {
int err = gpgme_op_encrypt_start ( c, recp, in, out );
if ( !err ) {
gpgme_wait (c, 1);
if ( c->result_type != RESULT_TYPE_ENCRYPT )
err = mk_error (General_Error);
else if ( c->out_of_core )
err = mk_error (Out_Of_Core);
else {
assert ( c->result.encrypt );
if (c->result.encrypt->no_recipients)
err = mk_error (No_Recipients);
}
c->pending = 0;
/* FIXME: old gpg versions don't return status info for invalid
/* Old gpg versions don't return status info for invalid
* recipients, so we simply check whether we got any output at
* all and if not assume that we don't have valid recipients
* */
if (gpgme_data_get_type (out) == GPGME_DATA_TYPE_NONE)
rc = mk_error (No_Recipients);
if (!err && gpgme_data_get_type (out) == GPGME_DATA_TYPE_NONE)
err = mk_error (No_Recipients);
}
return rc;
return err;
}

View File

@ -87,7 +87,8 @@ typedef enum {
STATUS_POLICY_URL ,
STATUS_BEGIN_STREAM ,
STATUS_END_STREAM ,
STATUS_INV_RECP
STATUS_INV_RECP ,
STATUS_NO_RECP
} GpgStatusCode;
typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args );

View File

@ -152,8 +152,12 @@ verify_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
}
switch (code) {
case STATUS_NODATA:
ctx->result.verify->status = GPGME_SIG_STAT_NOSIG;
break;
case STATUS_GOODSIG:
/* We just look at VALIDSIG */
/* We only look at VALIDSIG */
break;
case STATUS_VALIDSIG: