2002-01-31 15:27:49 +00:00
|
|
|
/* progress.c - status handler for progress status
|
2018-11-16 12:27:33 +00:00
|
|
|
* Copyright (C) 2000 Werner Koch (dd9jn)
|
|
|
|
* Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
|
|
|
*
|
|
|
|
* This file is part of GPGME.
|
|
|
|
*
|
|
|
|
* GPGME is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2.1 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GPGME is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, see <https://gnu.org/licenses/>.
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*/
|
2002-01-31 15:27:49 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-06-05 23:20:29 +00:00
|
|
|
#include <errno.h>
|
2002-01-31 15:27:49 +00:00
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "context.h"
|
2012-10-19 09:23:39 +00:00
|
|
|
#include "debug.h"
|
2002-01-31 15:27:49 +00:00
|
|
|
|
|
|
|
|
2017-01-31 08:44:29 +00:00
|
|
|
/* The status handler for progress status lines which also monitors
|
|
|
|
* the PINENTRY_LAUNCHED status. */
|
2003-05-18 20:45:24 +00:00
|
|
|
gpgme_error_t
|
2003-05-18 21:08:43 +00:00
|
|
|
_gpgme_progress_status_handler (void *priv, gpgme_status_code_t code,
|
|
|
|
char *args)
|
2002-01-31 15:27:49 +00:00
|
|
|
{
|
2003-05-18 20:45:24 +00:00
|
|
|
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
2002-01-31 15:27:49 +00:00
|
|
|
char *p;
|
|
|
|
char *args_cpy;
|
|
|
|
int type = 0;
|
|
|
|
int current = 0;
|
|
|
|
int total = 0;
|
|
|
|
|
2017-01-31 08:44:29 +00:00
|
|
|
if (code == GPGME_STATUS_PINENTRY_LAUNCHED)
|
|
|
|
{
|
|
|
|
ctx->redraw_suggested = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-28 Marcus Brinkmann <marcus@g10code.de>
* data.c (gpgme_data_read): For GPGME_DATA_TYPE_NONE, return EOF
instead an error.
The following changes make it possible to flush an inbound data
pipe before invoking a command handler:
* posix-io.c (_gpgme_io_select): Accept new argument NONBLOCK to
_gpgme_io_select. Set timeout of 0 if this is set.
* w32-io.c (_gpgme_io_select): Likewise.
* io.h: Add new argument NONBLOCK to _gpgme_io_select prototype.
* wait.c (do_select): Add new argument to _gpgme_io_select
invocation.
* rungpg.h (_gpgme_gpg_set_command_handler): Add new argument
linked_data to prototype.
* engine.h (_gpgme_engine_set_command_handler): Likewise.
* engine.c (_gpgme_engine_set_command_handler): Likewise.
* passphrase.c (_gpgme_passphrase_start): Pass NULL as linked_data
argument to _gpgme_engine_set_command_handler.
* rungpg.c (struct gpg_object_s): New members linked_data and
linked_idx in CMD.
(_gpgme_gpg_new): Initialize those new members.
(_gpgme_gpg_set_command_handler): Accept new argument linked_data.
(build_argv): Handle linked_data in the same hack as cb_data.
(read_status): If linked_data is in use, flush the pipe before
activating the command handler.
* gpgme.h: Add prototypes for gpgme_op_edit_start and
gpgme_op_edit.
The next changes export the status codes to the user:
* decrypt.c (_gpgme_decrypt_status_handler): Likewise, also prefix
all STATUS_ with GPGME_.
* delete.c (delete_status_handler): Likewise.
* decrypt-verify.c (decrypt_verify_status_handler): Likewise.
* encrypt.c (_gpgme_encrypt_status_handler): Likewise.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (parse_status): Likewise.
(gpgsm_status_handler): Likewise.
(gpgsm_set_recipients): Likewise.
* export.c (export_status_handler): Likewise.
* genkey.c (genkey_status_handler): Likewise.
* import.c (append_xml_impinfo): Likewise.
(import_status_handler): Likewise.
* keylist.c (keylist_status_handler): Likewise.
* passphrase.c (_gpgme_passphrase_status_handler): Likewise.
(command_handler): Likewise.
* progress.c (_gpgme_progress_status_handler): Likewise.
* sign.c (_gpgme_sign_status_handler): Likewise.
* trustlist.c (trustlist_status_handler): Likewise.
* verify.c (_gpgme_verify_status_handler): Likewise.
* gpgme.h (GpgmeEditCb): New type.
* rungpg.h (GpgStatusCode): Rename and move to ...
* gpgme.h (GpgmeStatusCode): ... this and here.
* Makefile.am (status-table.h): Run mkstatus on gpgme.h, not rungpg.h.
* mkstatus: Prefix STATUS with GPGME_.
* rungpg.h (GpgStatusHandler, GpgCommandHandler): Change type
accordingly.
* ops.h (_gpgme_verify_status_handler,
_gpgme_decrypt_status_handler, _gpgme_sign_status_handler,
_gpgme_encrypt_status_handler, _gpgme_passphrase_status_handler,
_gpgme_progress_status_handler): Likewise.
* rungpg.c (struct gpg_object_s): Likewise for CMD.code.
These changes add an edit operation to GPGME:
* context.h (struct gpgme_context_s): New member RESULT.edit. *
ops.h: Add prototype for _gpgme_release_edit_result and
_gpgme_passphrase_command_handler.
* passphrase.c (command_handler): Make non-static and rename to ...
(_gpgme_passphrase_command_handler): ... this.
(_gpgme_passphrase_start): Use new name for command handler.
* types.h: Add EditResult type.
* gpgme.c (_gpgme_release_result): Release EDIT result.
* edit.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add edit.c.
(libgpgme_la_LDADD): Rename to libgpgme_la_LIBADD, and include
assuan_libobjs.
(assuan_libobjs): New variable, set this instead
libgpgme_la_LIBADD.
* engine.h (_gpgme_engine_op_edit): New prototype.
* engine.c (_gpgme_engine_op_edit): New function.
* rungpg.h (_gpgme_gpg_op_edit): New prototype.
* rungpg.c (_gpgme_gpg_op_edit): New function.
2002-07-28 18:41:02 +00:00
|
|
|
if (code != GPGME_STATUS_PROGRESS || !*args || !ctx->progress_cb)
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
return 0;
|
2002-01-31 15:27:49 +00:00
|
|
|
|
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
* util.h (_gpgme_malloc, _gpgme_realloc, _gpgme_calloc,
_gpgme_strdup, _gpgme_free): Remove prototypes.
(xtrymalloc, xtrycalloc, xtryrealloc, xtrystrdup, xfree): Remove
macros.
* util.c: File removed.
* Makefile.am (libgpgme_la_SOURCES): Remove util.h.
* conversion.c (_gpgme_decode_c_string): Use malloc instead of
xtrymalloc, realloc instead of xtryrealloc, calloc instead of
xtrycalloc, free instead of xfree.
(_gpgme_data_append_percentstring_for_xml): Likewise.
* data.c (_gpgme_data_new, _gpgme_data_release): Likewise.
* data-compat.c (gpgme_data_new_from_filepart): Likewise.
* data-mem.c (mem_write, mem_release, gpgme_data_new_from_mem,
_gpgme_data_get_as_string): Likewise.
* debug.c (debug_init): Likewise.
* decrypt.c (_gpgme_release_decrypt_result): Likewise.
* delete.c (_gpgme_release_delete_result): Likewise.
* edit.c (_gpgme_release_edit_result, _gpgme_op_edit_start):
Likewise.
* encrypt.c (_gpgme_release_encrypt_result): Likewise.
* engine.c (_gpgme_engine_get_info, _gpgme_engine_new,
_gpgme_engine_release): Likewise.
* engine-gpgsm.c (_gpgme_gpgsm_new, _gpgme_gpgsm_release,
_gpgme_gpgsm_op_decrypt, _gpgme_gpgsm_op_delete,
gpgsm_set_recipients, _gpgme_gpgsm_op_encrypt,
_gpgme_gpgsm_op_export, _gpgme_gpgsm_op_genkey,
_gpgme_gpgsm_op_import, _gpgme_gpgsm_op_keylist,
_gpgme_gpgsm_op_keylist_ext, _gpgme_gpgsm_op_sign,
_gpgme_gpgsm_op_verify, gpgsm_status_handler): Likewise.
* genkey.c (_gpgme_release_genkey_result): Likewise.
* gpgme.c (gpgme_new, gpgme_release): Likewise.
* import.c (_gpgme_release_import_result): Likewise.
* key.c (_gpgme_key_cache_init, _gpgme_key_cache_add, key_new,
add_subkey, gpgme_key_release, _gpgme_key_append_name): Likewise.
* keylist.c (_gpgme_release_keylist_result, keylist_colon_handler,
_gpgme_op_keylist_event_cb, gpgme_op_keylist_next): Likewise.
* ops.h (test_and_allocate_result): Likewise.
* passphrase.c (_gpgme_release_passphrase_result,
_gpgme_passphrase_status_handler,
_gpgme_passphrase_command_handler): Likewise.
* progress.c (_gpgme_progress_status_handler): Likewise.
* recipient.c (gpgme_recipients_new, gpgme_recipients_release,
gpgme_recipients_add_name_with_validity): Likewise.
* rungpg.c (_gpgme_gpg_new, _gpgme_gpg_release,
_gpgme_gpg_add_arg, _gpgme_gpg_add_data,
_gpgme_gpg_set_colon_line_handler, free_argv, free_fd_data_map,
build_argv, _gpgme_gpg_spawn, read_status, read_colon_line):
Likewise.
* sign.c (_gpgme_release_sign_result): Likewise.
* signers.c (_gpgme_signers_add): Likewise.
* trustlist.c (trust_item_new, trustlist_colon_handler,
_gpgme_op_trustlist_event_cb, gpgme_op_trustlist_next,
gpgme_trustitem_release): Likewise.
* verify.c (_gpgme_release_verify_result, finish_sig): Likewise.
* version.c (gpgme_get_engine_info, _gpgme_get_program_version):
Likewise.
* w32-io.c (create_reader, create_writer, destroy_reader,
destroy_writer, build_commandline, _gpgme_io_spawn): Likewise.
* w32-sema.c (critsect_init, _gpgme_sema_cs_destroy): Likewise.
* w32-util.c (read_w32_registry_string): Likewise.
* wait.c (_gpgme_fd_table_deinit, _gpgme_fd_table_put,
_gpgme_wait_event_cb, _gpgme_add_io_cb, _gpgme_remove_io_cb)
* data-compat.c: Include <stdlib.h>.
2002-10-09 01:08:21 +00:00
|
|
|
args_cpy = strdup (args);
|
2002-01-31 15:27:49 +00:00
|
|
|
if (!args_cpy)
|
2013-02-06 16:35:40 +00:00
|
|
|
return gpg_error_from_syserror ();
|
2002-01-31 15:27:49 +00:00
|
|
|
|
|
|
|
p = strchr (args_cpy, ' ');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
|
|
|
if (*p)
|
|
|
|
{
|
2003-01-29 19:50:43 +00:00
|
|
|
type = *(unsigned char *)p;
|
2002-01-31 15:27:49 +00:00
|
|
|
p = strchr (p+1, ' ');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
|
|
|
if (*p)
|
|
|
|
{
|
|
|
|
current = atoi (p);
|
|
|
|
p = strchr (p+1, ' ');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
|
|
|
total = atoi (p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-09-25 13:29:49 +00:00
|
|
|
}
|
2002-01-31 15:27:49 +00:00
|
|
|
|
|
|
|
if (type != 'X')
|
|
|
|
ctx->progress_cb (ctx->progress_cb_value, args_cpy, type, current, total);
|
|
|
|
|
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
* util.h (_gpgme_malloc, _gpgme_realloc, _gpgme_calloc,
_gpgme_strdup, _gpgme_free): Remove prototypes.
(xtrymalloc, xtrycalloc, xtryrealloc, xtrystrdup, xfree): Remove
macros.
* util.c: File removed.
* Makefile.am (libgpgme_la_SOURCES): Remove util.h.
* conversion.c (_gpgme_decode_c_string): Use malloc instead of
xtrymalloc, realloc instead of xtryrealloc, calloc instead of
xtrycalloc, free instead of xfree.
(_gpgme_data_append_percentstring_for_xml): Likewise.
* data.c (_gpgme_data_new, _gpgme_data_release): Likewise.
* data-compat.c (gpgme_data_new_from_filepart): Likewise.
* data-mem.c (mem_write, mem_release, gpgme_data_new_from_mem,
_gpgme_data_get_as_string): Likewise.
* debug.c (debug_init): Likewise.
* decrypt.c (_gpgme_release_decrypt_result): Likewise.
* delete.c (_gpgme_release_delete_result): Likewise.
* edit.c (_gpgme_release_edit_result, _gpgme_op_edit_start):
Likewise.
* encrypt.c (_gpgme_release_encrypt_result): Likewise.
* engine.c (_gpgme_engine_get_info, _gpgme_engine_new,
_gpgme_engine_release): Likewise.
* engine-gpgsm.c (_gpgme_gpgsm_new, _gpgme_gpgsm_release,
_gpgme_gpgsm_op_decrypt, _gpgme_gpgsm_op_delete,
gpgsm_set_recipients, _gpgme_gpgsm_op_encrypt,
_gpgme_gpgsm_op_export, _gpgme_gpgsm_op_genkey,
_gpgme_gpgsm_op_import, _gpgme_gpgsm_op_keylist,
_gpgme_gpgsm_op_keylist_ext, _gpgme_gpgsm_op_sign,
_gpgme_gpgsm_op_verify, gpgsm_status_handler): Likewise.
* genkey.c (_gpgme_release_genkey_result): Likewise.
* gpgme.c (gpgme_new, gpgme_release): Likewise.
* import.c (_gpgme_release_import_result): Likewise.
* key.c (_gpgme_key_cache_init, _gpgme_key_cache_add, key_new,
add_subkey, gpgme_key_release, _gpgme_key_append_name): Likewise.
* keylist.c (_gpgme_release_keylist_result, keylist_colon_handler,
_gpgme_op_keylist_event_cb, gpgme_op_keylist_next): Likewise.
* ops.h (test_and_allocate_result): Likewise.
* passphrase.c (_gpgme_release_passphrase_result,
_gpgme_passphrase_status_handler,
_gpgme_passphrase_command_handler): Likewise.
* progress.c (_gpgme_progress_status_handler): Likewise.
* recipient.c (gpgme_recipients_new, gpgme_recipients_release,
gpgme_recipients_add_name_with_validity): Likewise.
* rungpg.c (_gpgme_gpg_new, _gpgme_gpg_release,
_gpgme_gpg_add_arg, _gpgme_gpg_add_data,
_gpgme_gpg_set_colon_line_handler, free_argv, free_fd_data_map,
build_argv, _gpgme_gpg_spawn, read_status, read_colon_line):
Likewise.
* sign.c (_gpgme_release_sign_result): Likewise.
* signers.c (_gpgme_signers_add): Likewise.
* trustlist.c (trust_item_new, trustlist_colon_handler,
_gpgme_op_trustlist_event_cb, gpgme_op_trustlist_next,
gpgme_trustitem_release): Likewise.
* verify.c (_gpgme_release_verify_result, finish_sig): Likewise.
* version.c (gpgme_get_engine_info, _gpgme_get_program_version):
Likewise.
* w32-io.c (create_reader, create_writer, destroy_reader,
destroy_writer, build_commandline, _gpgme_io_spawn): Likewise.
* w32-sema.c (critsect_init, _gpgme_sema_cs_destroy): Likewise.
* w32-util.c (read_w32_registry_string): Likewise.
* wait.c (_gpgme_fd_table_deinit, _gpgme_fd_table_put,
_gpgme_wait_event_cb, _gpgme_add_io_cb, _gpgme_remove_io_cb)
* data-compat.c: Include <stdlib.h>.
2002-10-09 01:08:21 +00:00
|
|
|
free (args_cpy);
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
return 0;
|
2002-01-31 15:27:49 +00:00
|
|
|
}
|