Missing implementation bug fixed: Return both error id and error plain text from...
authorKarl-Heinz Zimmer <khz@kde.org>
Thu, 27 Jun 2002 08:21:58 +0000 (08:21 +0000)
committerKarl-Heinz Zimmer <khz@kde.org>
Thu, 27 Jun 2002 08:21:58 +0000 (08:21 +0000)
trunk/gpgmeplug/cryptplug.h
trunk/gpgmeplug/gpgmeplug.c

index 7b544e6f8679b71467292bd41bf2d36baf0ce18b..b978fb706089df9eb48cadf57fb34e3c4c896118 100644 (file)
@@ -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
index d56a6fc60470dc8e4b47e2a709548dd97a26c046..25f7e2aee570f85bd2947f4141e744754485b7a1 100644 (file)
@@ -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 );