src/pEpEngine.c
changeset 20 63ff31d0cfbd
parent 15 98a6c1cc9160
child 24 50887c6ab78f
     1.1 --- a/src/pEpEngine.c	Mon Aug 11 13:52:06 2014 +0200
     1.2 +++ b/src/pEpEngine.c	Mon Aug 11 16:49:42 2014 +0200
     1.3 @@ -87,6 +87,8 @@
     1.4          gpgme_key_t RECP[], gpgme_encrypt_flags_t FLAGS, gpgme_data_t PLAIN,
     1.5          gpgme_data_t CIPHER);
     1.6  typedef gpgme_verify_result_t (*gpgme_op_verify_result_t)(gpgme_ctx_t CTX);
     1.7 +typedef void (*gpgme_signers_clear_t)(gpgme_ctx_t CTX);
     1.8 +typedef gpgme_error_t (*gpgme_signers_add_t)(gpgme_ctx_t CTX, const gpgme_key_t KEY);
     1.9  
    1.10  // keys
    1.11  
    1.12 @@ -152,6 +154,8 @@
    1.13  	gpgme_op_decrypt_result_t gpgme_op_decrypt_result;
    1.14  	gpgme_op_encrypt_sign_t gpgme_op_encrypt_sign;
    1.15  	gpgme_op_verify_result_t gpgme_op_verify_result;
    1.16 +    gpgme_signers_clear_t gpgme_signers_clear;
    1.17 +    gpgme_signers_add_t gpgme_signers_add;
    1.18  
    1.19  	gpgme_get_key_t gpgme_get_key;
    1.20  	gpgme_op_genkey_t gpgme_op_genkey;
    1.21 @@ -332,7 +336,17 @@
    1.22          = (gpgme_op_verify_result_t) (intptr_t) dlsym(_session->gpgme,
    1.23                  "gpgme_op_verify_result");
    1.24  	assert(_session->gpgme_op_verify_result);
    1.25 -	
    1.26 +
    1.27 +    _session->gpgme_signers_clear
    1.28 +        = (gpgme_signers_clear_t) (intptr_t) dlsym(_session->gpgme,
    1.29 +        "gpgme_signers_clear");
    1.30 +    assert(_session->gpgme_signers_clear);
    1.31 +
    1.32 +    _session->gpgme_signers_add
    1.33 +        = (gpgme_signers_add_t) (intptr_t) dlsym(_session->gpgme,
    1.34 +        "gpgme_signers_add");
    1.35 +    assert(_session->gpgme_signers_add);
    1.36 +
    1.37  	_session->gpgme_get_key
    1.38          = (gpgme_get_key_t) (intptr_t) dlsym(_session->gpgme, "gpgme_get_key");
    1.39  	assert(_session->gpgme_get_key);
    1.40 @@ -1061,6 +1075,8 @@
    1.41  		return PEP_OUT_OF_MEMORY;
    1.42  	}
    1.43  
    1.44 +    _session->gpgme_signers_clear(_session->ctx);
    1.45 +
    1.46      for (_keylist=keylist, i=0; _keylist!=NULL; _keylist=_keylist->next, i++) {
    1.47  		assert(_keylist->value);
    1.48          gpgme_error = _session->gpgme_get_key(_session->ctx, _keylist->value,
    1.49 @@ -1076,6 +1092,10 @@
    1.50  			_session->gpgme_data_release(cipher);
    1.51  			return PEP_OUT_OF_MEMORY;
    1.52  		case GPG_ERR_NO_ERROR:
    1.53 +            if (i == 0) {
    1.54 +                gpgme_error_t _gpgme_error = _session->gpgme_signers_add(_session->ctx, rcpt[0]);
    1.55 +                assert(_gpgme_error == GPG_ERR_NO_ERROR);
    1.56 +            }
    1.57  			break;
    1.58  		case GPG_ERR_EOF:
    1.59              for (j=0; j<i; j++)