gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) { gpgme_error_t err; void *hook; op_data_t opd; struct trust_queue_item_s *q; TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_next", ctx); if (!r_item) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); *r_item = NULL; if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, &hook, -1, NULL); opd = hook; if (err) return TRACE_ERR (err); if (opd == NULL) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); if (!opd->trust_queue) { err = _gpgme_wait_on_condition (ctx, &opd->trust_cond, NULL); if (err) return TRACE_ERR (err); if (!opd->trust_cond) return TRACE_ERR (gpg_error (GPG_ERR_EOF)); opd->trust_cond = 0; assert (opd->trust_queue); } q = opd->trust_queue; opd->trust_queue = q->next; *r_item = q->item; free (q); if ((*r_item)->type == 1) { TRACE_SUC5 ("trust_item=%p: %s: owner trust %s with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->owner_trust, (*r_item)->level, (*r_item)->validity); } else if ((*r_item)->type == 2) { TRACE_SUC5 ("trust_item=%p: %s: UID %s with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->name, (*r_item)->level, (*r_item)->validity); } else { TRACE_SUC5 ("trust_item=%p: %s: unknown type %i with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->type, (*r_item)->level, (*r_item)->validity); } return 0; }
gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) { gpgme_error_t err; void *hook; op_data_t opd; struct trust_queue_item_s *q; if (!r_item) return gpg_error (GPG_ERR_INV_VALUE); *r_item = NULL; if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); err = _gpgme_op_data_lookup (ctx, OPDATA_TRUSTLIST, &hook, -1, NULL); opd = hook; if (err) return err; if (opd == NULL) return gpg_error (GPG_ERR_INV_VALUE); if (!opd->trust_queue) { err = _gpgme_wait_on_condition (ctx, &opd->trust_cond); if (err) return err; if (!opd->trust_cond) return gpg_error (GPG_ERR_EOF); opd->trust_cond = 0; assert (opd->trust_queue); } q = opd->trust_queue; opd->trust_queue = q->next; *r_item = q->item; free (q); return 0; }
/* Wait until the blocking operation in context CTX has finished and return the error value. */ gpgme_error_t _gpgme_wait_one (gpgme_ctx_t ctx) { return _gpgme_wait_on_condition (ctx, NULL); }
/* Wait until the blocking operation in context CTX has finished and return the error value. This is the right variant to use for sesion-based protocols. */ gpgme_error_t _gpgme_wait_one_ext (gpgme_ctx_t ctx, gpgme_error_t *op_err) { return _gpgme_wait_on_condition (ctx, NULL, op_err); }