From: Karl-Heinz Zimmer Date: Thu, 27 Jun 2002 08:21:58 +0000 (+0000) Subject: Missing implementation bug fixed: Return both error id and error plain text from... X-Git-Tag: gpgme-1.2.0@1385~918 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=442edc6fcbb89fd46d4977e8f03ee9dce636637c;p=gpgme.git Missing implementation bug fixed: Return both error id and error plain text from decryptMessage(). --- diff --git a/trunk/gpgmeplug/cryptplug.h b/trunk/gpgmeplug/cryptplug.h index 7b544e6..b978fb7 100644 --- a/trunk/gpgmeplug/cryptplug.h +++ b/trunk/gpgmeplug/cryptplug.h @@ -1675,7 +1675,9 @@ bool decryptMessage( const char* ciphertext, bool cipherIsBinary, int cipherLen, const char** cleartext, - const char* certificate ); + const char* certificate, + int* errId, + char** errTxt ); /*! \ingroup groupCryptAct \brief Combines the functionality of diff --git a/trunk/gpgmeplug/gpgmeplug.c b/trunk/gpgmeplug/gpgmeplug.c index d56a6fc..25f7e2a 100644 --- a/trunk/gpgmeplug/gpgmeplug.c +++ b/trunk/gpgmeplug/gpgmeplug.c @@ -1797,7 +1797,9 @@ bool decryptMessage( const char* ciphertext, bool cipherIsBinary, int cipherLen, const char** cleartext, - const char* certificate ) + const char* certificate, + int* errId, + char** errTxt ) { GpgmeCtx ctx; GpgmeError err; @@ -1827,7 +1829,19 @@ bool decryptMessage( const char* ciphertext, gpgme_data_new( &gPlaintext ); - gpgme_op_decrypt( ctx, gCiphertext, gPlaintext ); + err = err = gpgme_op_decrypt( ctx, gCiphertext, gPlaintext ); + if( err ) { + fprintf( stderr, "\ngpgme_op_decrypt() returned this error code: %i\n\n", err ); + if( errId ) + *errId = err; + if( errTxt ) { + const char* _errTxt = gpgme_strerror( err ); + *errTxt = malloc( strlen( _errTxt ) + 1 ); + if( *errTxt ) + strcpy(*errTxt, _errTxt ); + } + } + gpgme_data_release( gCiphertext ); rCiph = gpgme_data_release_and_get_mem( gPlaintext, &rCLen );