2005-07-27  Marcus Brinkmann  <marcus@g10code.de>

	* gpgme.texi (Decrypt): Add plaintext_filename to
	gpgme_decrypt_result_t.
	(Verify): Likewise for gpgme_verify_result_t.

gpgme/
2005-07-27  Marcus Brinkmann  <marcus@g10code.de>

	* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT.
	(struct _gpgme_op_decrypt_result): New member plaintext_filename.
	(struct _gpgme_op_verify_result): Likewise.
	* ops.h (_gpgme_parse_plaintext): Add prototype.
	* op-support.c (_gpgme_parse_plaintext): New function.
	* decrypt.c (release_op_data): Release
	OPD->result.plaintext_filename.
	(_gpgme_decrypt_status_handler): Handle GPGME_STATUS_PLAINTEXT.
	* verify.c (release_op_data): Release
	OPD->result.plaintext_filename.
	(_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT.
This commit is contained in:
Marcus Brinkmann 2005-07-27 01:50:08 +00:00
parent b19c847b02
commit 7bdaf53a4a
9 changed files with 112 additions and 1 deletions

8
NEWS
View File

@ -16,6 +16,11 @@ Noteworthy changes in version 1.1.0 (unreleased)
* Information about the recipients of an encrypted text is now * Information about the recipients of an encrypted text is now
available at decryption time. available at decryption time.
* New status GPGME_STATUS_PLAINTEXT. This is analyzed by the decrypt
and verify handlers, the information about the plaintext filename,
if available is made available in the new field plaintext_filename
of the respective result structure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_set_engine_info NEW gpgme_set_engine_info NEW
gpgme_ctx_get_engine_info NEW gpgme_ctx_get_engine_info NEW
@ -31,6 +36,9 @@ GPGME_STATUS_SC_OP_FAILURE NEW
GPGME_STATUS_SC_OP_SUCCESS NEW GPGME_STATUS_SC_OP_SUCCESS NEW
GPGME_STATUS_CARDCTRL NEW GPGME_STATUS_CARDCTRL NEW
GPGME_STATUS_BACKUP_KEY_CREATED NEW GPGME_STATUS_BACKUP_KEY_CREATED NEW
gpgme_decrypt_result_t EXTENDED: New field plaintext_filename.
gpgme_verify_result_t EXTENDED: New field plaintext_filename.
GPGME_STATUS_PLAINTEXT NEW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1,3 +1,9 @@
2005-07-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Decrypt): Add plaintext_filename to
gpgme_decrypt_result_t.
(Verify): Likewise for gpgme_verify_result_t.
2005-06-03 Marcus Brinkmann <marcus@g10code.de> 2005-06-03 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Verify): Add information about new fields in * gpgme.texi (Verify): Add information about new fields in

View File

@ -3668,6 +3668,10 @@ This is true if the key was not used according to its policy.
@item gpgme_recipient_t recipient @item gpgme_recipient_t recipient
This is a linked list of recipients to which this message was encrypted. This is a linked list of recipients to which this message was encrypted.
@item char *plaintext_filename
This is the filename of the original plaintext message file if it is
known, otherwise this is a null pointer.
@end table @end table
@end deftp @end deftp
@ -3880,6 +3884,10 @@ a @code{NULL} pointer. The structure contains the following member:
@item gpgme_signature_t signatures @item gpgme_signature_t signatures
A linked list with information about all signatures for which a A linked list with information about all signatures for which a
verification was attempted. verification was attempted.
@item char *plaintext_filename
This is the filename of the original plaintext message file if it is
known, otherwise this is a null pointer.
@end table @end table
@end deftp @end deftp

View File

@ -1,3 +1,17 @@
2005-07-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT.
(struct _gpgme_op_decrypt_result): New member plaintext_filename.
(struct _gpgme_op_verify_result): Likewise.
* ops.h (_gpgme_parse_plaintext): Add prototype.
* op-support.c (_gpgme_parse_plaintext): New function.
* decrypt.c (release_op_data): Release
OPD->result.plaintext_filename.
(_gpgme_decrypt_status_handler): Handle GPGME_STATUS_PLAINTEXT.
* verify.c (release_op_data): Release
OPD->result.plaintext_filename.
(_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT.
2005-07-26 Marcus Brinkmann <marcus@g10code.de> 2005-07-26 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_get_key): Allow key IDs. * keylist.c (gpgme_get_key): Allow key IDs.

View File

@ -53,6 +53,9 @@ release_op_data (void *hook)
if (opd->result.unsupported_algorithm) if (opd->result.unsupported_algorithm)
free (opd->result.unsupported_algorithm); free (opd->result.unsupported_algorithm);
if (opd->result.plaintext_filename)
free (opd->result.plaintext_filename);
} }
@ -238,6 +241,11 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
} }
break; break;
case GPGME_STATUS_PLAINTEXT:
err = _gpgme_parse_plaintext (args, &opd->result.plaintext_filename);
if (err)
return err;
default: default:
break; break;
} }

View File

@ -403,7 +403,9 @@ typedef enum
GPGME_STATUS_SC_OP_FAILURE, GPGME_STATUS_SC_OP_FAILURE,
GPGME_STATUS_SC_OP_SUCCESS, GPGME_STATUS_SC_OP_SUCCESS,
GPGME_STATUS_CARDCTRL, GPGME_STATUS_CARDCTRL,
GPGME_STATUS_BACKUP_KEY_CREATED GPGME_STATUS_BACKUP_KEY_CREATED,
GPGME_STATUS_PLAINTEXT
} }
gpgme_status_code_t; gpgme_status_code_t;
@ -1110,6 +1112,9 @@ struct _gpgme_op_decrypt_result
int _unused : 31; int _unused : 31;
gpgme_recipient_t recipients; gpgme_recipient_t recipients;
/* The original filename of the plaintext message, if available. */
char *plaintext_filename;
}; };
typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
@ -1259,6 +1264,9 @@ typedef struct _gpgme_signature *gpgme_signature_t;
struct _gpgme_op_verify_result struct _gpgme_op_verify_result
{ {
gpgme_signature_t signatures; gpgme_signature_t signatures;
/* The original filename of the plaintext message, if available. */
char *plaintext_filename;
}; };
typedef struct _gpgme_op_verify_result *gpgme_verify_result_t; typedef struct _gpgme_op_verify_result *gpgme_verify_result_t;

View File

@ -123,6 +123,8 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)
} }
/* Parse the INV_RECP status line in ARGS and return the result in
KEY. */
gpgme_error_t gpgme_error_t
_gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key) _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key)
{ {
@ -209,3 +211,47 @@ _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key)
*key = inv_key; *key = inv_key;
return 0; return 0;
} }
/* Parse the PLAINTEXT status line in ARGS and return the result in
FILENAMEP. */
gpgme_error_t
_gpgme_parse_plaintext (char *args, char **filenamep)
{
char *tail;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
/* First argument is file type. */
while (*args != ' ' && *args != '\0')
args++;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
/* Second argument is the timestamp. */
while (*args != ' ' && *args != '\0')
args++;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
tail = args;
while (*tail != ' ' && *tail != '\0')
tail++;
*tail = '\0';
if (filenamep && *args != '\0')
{
char *filename = strdup (args);
if (!filename)
return gpg_error_from_errno (errno);
*filenamep = filename;
}
return 0;
}

View File

@ -54,6 +54,11 @@ gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous);
KEY. */ KEY. */
gpgme_error_t _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key); gpgme_error_t _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key);
/* Parse the PLAINTEXT status line in ARGS and return the result in
FILENAMEP. */
gpgme_error_t _gpgme_parse_plaintext (char *args, char **filenamep);
/* From verify.c. */ /* From verify.c. */
gpgme_error_t _gpgme_op_verify_init_result (gpgme_ctx_t ctx); gpgme_error_t _gpgme_op_verify_init_result (gpgme_ctx_t ctx);

View File

@ -70,6 +70,9 @@ release_op_data (void *hook)
free (sig); free (sig);
sig = next; sig = next;
} }
if (opd->result.plaintext_filename)
free (opd->result.plaintext_filename);
} }
@ -695,6 +698,11 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args)
opd->only_newsig_seen = 0; opd->only_newsig_seen = 0;
break; break;
case GPGME_STATUS_PLAINTEXT:
err = _gpgme_parse_plaintext (args, &opd->result.plaintext_filename);
if (err)
return err;
default: default:
break; break;
} }