diff options
| author | Marcus Brinkmann <[email protected]> | 2005-08-26 14:53:55 +0000 | 
|---|---|---|
| committer | Marcus Brinkmann <[email protected]> | 2005-08-26 14:53:55 +0000 | 
| commit | 9f952a5a0b6876814d43495f077aa114eec352d7 (patch) | |
| tree | 3b5131c781c616ae4468806bbcab189d446d403e | |
| parent | * configure.ac (SEPCONSTANTS): New to define DIRSEP_C et al. (diff) | |
| download | gpgme-9f952a5a0b6876814d43495f077aa114eec352d7.tar.gz gpgme-9f952a5a0b6876814d43495f077aa114eec352d7.zip | |
2005-08-26  Marcus Brinkmann  <[email protected]>
	* engine.h (engine_command_handler_t): Add new argument processed.
	* ops.h (_gpgme_passphrase_command_handler_internal): Rename
	prototype to ...
	(_gpgme_passphrase_command_handler): ... this one.
	* passphrase.c (_gpgme_passphrase_command_handler_internal):
	Rename to ...
	(_gpgme_passphrase_command_handler): ... this one.
	* edit.c (command_handler): Add new argument processed.  Remove
	local variable with the same name.  Always return processed as
	true.
	* rungpg.c (command_handler): Send a newline character if the
	handler did not.
Diffstat (limited to '')
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | gpgme/ChangeLog | 15 | ||||
| -rw-r--r-- | gpgme/edit.c | 15 | ||||
| -rw-r--r-- | gpgme/engine.h | 2 | ||||
| -rw-r--r-- | gpgme/ops.h | 3 | ||||
| -rw-r--r-- | gpgme/passphrase.c | 15 | ||||
| -rw-r--r-- | gpgme/rungpg.c | 8 | 
7 files changed, 37 insertions, 23 deletions
| @@ -6,6 +6,8 @@ Hey Emacs, this is -*- outline -*- mode!  ** Add notation data to key signatures.  * ABI's to break: +** gpgme_edit_cb_t: Add "processed" return argument +   (see edit.c::command_handler).  ** I/O and User Data could be made extensible.  But this can be done     without breaking the ABI hopefully.  *  All enums that should be enums need to have a maximum value to ensure diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 72a7eab7..3c211d93 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,18 @@ +2005-08-26  Marcus Brinkmann  <[email protected]> + +	* engine.h (engine_command_handler_t): Add new argument processed. +	* ops.h (_gpgme_passphrase_command_handler_internal): Rename +	prototype to ... +	(_gpgme_passphrase_command_handler): ... this one. +	* passphrase.c (_gpgme_passphrase_command_handler_internal): +	Rename to ... +	(_gpgme_passphrase_command_handler): ... this one. +	* edit.c (command_handler): Add new argument processed.  Remove +	local variable with the same name.  Always return processed as +	true. +	* rungpg.c (command_handler): Send a newline character if the +	handler did not. +  2005-08-26  Werner Koch  <[email protected]>  	* w32-util.c (read_w32_registry_string): Updated from code used by diff --git a/gpgme/edit.c b/gpgme/edit.c index 9ef450f0..6ff8fba4 100644 --- a/gpgme/edit.c +++ b/gpgme/edit.c @@ -63,21 +63,20 @@ edit_status_handler (void *priv, gpgme_status_code_t status, char *args)  static gpgme_error_t  command_handler (void *priv, gpgme_status_code_t status, const char *args, -		 int fd) +		 int fd, int *processed)  {    gpgme_ctx_t ctx = (gpgme_ctx_t) priv;    gpgme_error_t err; -  int processed = 0;    if (ctx->passphrase_cb)      { -      err = _gpgme_passphrase_command_handler_internal (ctx, status, args, -							fd, &processed); +      err = _gpgme_passphrase_command_handler (ctx, status, args, +					       fd, processed);        if (err)  	return err;      } -  if (!processed) +  if (!*processed)      {        void *hook;        op_data_t opd; @@ -87,8 +86,14 @@ command_handler (void *priv, gpgme_status_code_t status, const char *args,        if (err)  	return err; +      /* FIXME: We expect the user to handle _all_ status codes. +	 Later, we may fix the callback interface to allow the user +	 indicate if it processed the status code or not.  */ +      *processed = 1; +        return (*opd->fnc) (opd->fnc_value, status, args, fd);      } +    return 0;  } diff --git a/gpgme/engine.h b/gpgme/engine.h index b7489379..3179e27c 100644 --- a/gpgme/engine.h +++ b/gpgme/engine.h @@ -34,7 +34,7 @@ typedef gpgme_error_t (*engine_colon_line_handler_t) (void *priv, char *line);  typedef gpgme_error_t (*engine_command_handler_t) (void *priv,  						   gpgme_status_code_t code,  						   const char *keyword, -						   int fd); +						   int fd, int *processed);  /* Get a deep copy of the engine info and return it in INFO.  */  gpgme_error_t _gpgme_engine_info_copy (gpgme_engine_info_t *r_info); diff --git a/gpgme/ops.h b/gpgme/ops.h index 1877caab..79fb3b47 100644 --- a/gpgme/ops.h +++ b/gpgme/ops.h @@ -104,9 +104,6 @@ gpgme_error_t _gpgme_passphrase_status_handler (void *priv,  						char *args);  gpgme_error_t _gpgme_passphrase_command_handler (void *opaque,  						 gpgme_status_code_t code, -						 const char *key, int fd); -gpgme_error_t _gpgme_passphrase_command_handler_internal (void *opaque, -						 gpgme_status_code_t code,  						 const char *key, int fd,  						 int *processed); diff --git a/gpgme/passphrase.c b/gpgme/passphrase.c index 74214fb1..71326845 100644 --- a/gpgme/passphrase.c +++ b/gpgme/passphrase.c @@ -116,10 +116,8 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code,  gpgme_error_t -_gpgme_passphrase_command_handler_internal (void *priv, -					    gpgme_status_code_t code, -					    const char *key, int fd, -					    int *processed) +_gpgme_passphrase_command_handler (void *priv, gpgme_status_code_t code, +				   const char *key, int fd, int *processed)  {    gpgme_ctx_t ctx = (gpgme_ctx_t) priv;    gpgme_error_t err; @@ -153,12 +151,3 @@ _gpgme_passphrase_command_handler_internal (void *priv,    return 0;  } - - -gpgme_error_t -_gpgme_passphrase_command_handler (void *priv, gpgme_status_code_t code, -				   const char *key, int fd) -{ -  return _gpgme_passphrase_command_handler_internal (priv, code, key, fd, -						     NULL); -} diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 0d728fee..a53bac3a 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -478,15 +478,21 @@ command_handler (void *opaque, int fd)  {    gpgme_error_t err;    engine_gpg_t gpg = (engine_gpg_t) opaque; +  int processed = 0;    assert (gpg->cmd.used);    assert (gpg->cmd.code);    assert (gpg->cmd.fnc); -  err = gpg->cmd.fnc (gpg->cmd.fnc_value, gpg->cmd.code, gpg->cmd.keyword, fd); +  err = gpg->cmd.fnc (gpg->cmd.fnc_value, gpg->cmd.code, gpg->cmd.keyword, fd, +		      &processed);    if (err)      return err; +  /* We always need to send at least a newline character.  */ +  if (!processed) +    write (fd, "\n", 1); +    gpg->cmd.code = 0;    /* And sleep again until read_status will wake us up again.  */    /* XXX We must check if there are any more fds active after removing | 
