From: Marcus Brinkmann Date: Wed, 27 Jul 2005 01:50:08 +0000 (+0000) Subject: doc/ X-Git-Tag: gpgme-1-1-0~29 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7bdaf53a4a4ce97007c3d919328a1225e506dc54;p=gpgme.git doc/ 2005-07-27 Marcus Brinkmann * gpgme.texi (Decrypt): Add plaintext_filename to gpgme_decrypt_result_t. (Verify): Likewise for gpgme_verify_result_t. gpgme/ 2005-07-27 Marcus Brinkmann * 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. --- diff --git a/NEWS b/NEWS index 9ca3e75..663f0a2 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,11 @@ Noteworthy changes in version 1.1.0 (unreleased) * Information about the recipients of an encrypted text is now 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_ctx_get_engine_info NEW @@ -31,6 +36,9 @@ GPGME_STATUS_SC_OP_FAILURE NEW GPGME_STATUS_SC_OP_SUCCESS NEW GPGME_STATUS_CARDCTRL 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/ChangeLog b/doc/ChangeLog index 1525f8b..f8995c8 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2005-07-27 Marcus Brinkmann + + * gpgme.texi (Decrypt): Add plaintext_filename to + gpgme_decrypt_result_t. + (Verify): Likewise for gpgme_verify_result_t. + 2005-06-03 Marcus Brinkmann * gpgme.texi (Verify): Add information about new fields in diff --git a/doc/gpgme.texi b/doc/gpgme.texi index d5c14de..61d56b7 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -3668,6 +3668,10 @@ This is true if the key was not used according to its policy. @item gpgme_recipient_t recipient 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 deftp @@ -3880,6 +3884,10 @@ a @code{NULL} pointer. The structure contains the following member: @item gpgme_signature_t signatures A linked list with information about all signatures for which a 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 deftp diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index b59c04f..bd25f51 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,17 @@ +2005-07-27 Marcus Brinkmann + + * 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 * keylist.c (gpgme_get_key): Allow key IDs. diff --git a/gpgme/decrypt.c b/gpgme/decrypt.c index 0f80549..91e6c30 100644 --- a/gpgme/decrypt.c +++ b/gpgme/decrypt.c @@ -53,6 +53,9 @@ release_op_data (void *hook) if (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; + case GPGME_STATUS_PLAINTEXT: + err = _gpgme_parse_plaintext (args, &opd->result.plaintext_filename); + if (err) + return err; + default: break; } diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 18bd983..0893096 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -403,7 +403,9 @@ typedef enum GPGME_STATUS_SC_OP_FAILURE, GPGME_STATUS_SC_OP_SUCCESS, GPGME_STATUS_CARDCTRL, - GPGME_STATUS_BACKUP_KEY_CREATED + GPGME_STATUS_BACKUP_KEY_CREATED, + + GPGME_STATUS_PLAINTEXT } gpgme_status_code_t; @@ -1110,6 +1112,9 @@ struct _gpgme_op_decrypt_result int _unused : 31; 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; @@ -1259,6 +1264,9 @@ typedef struct _gpgme_signature *gpgme_signature_t; struct _gpgme_op_verify_result { 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; diff --git a/gpgme/op-support.c b/gpgme/op-support.c index ba220a3..68ff77d 100644 --- a/gpgme/op-support.c +++ b/gpgme/op-support.c @@ -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_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; 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; +} diff --git a/gpgme/ops.h b/gpgme/ops.h index 3b4c2cd..1877caa 100644 --- a/gpgme/ops.h +++ b/gpgme/ops.h @@ -54,6 +54,11 @@ gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous); 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. */ gpgme_error_t _gpgme_op_verify_init_result (gpgme_ctx_t ctx); diff --git a/gpgme/verify.c b/gpgme/verify.c index b7fd147..52f700b 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -70,6 +70,9 @@ release_op_data (void *hook) free (sig); 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; break; + case GPGME_STATUS_PLAINTEXT: + err = _gpgme_parse_plaintext (args, &opd->result.plaintext_filename); + if (err) + return err; + default: break; }