diff options
author | defanor <defanor@uberspace.net> | 2021-02-07 17:04:57 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2021-02-07 17:04:57 +0300 |
commit | 110d11fac989d27d72486e4eb7cca46b28f46ce2 (patch) | |
tree | 227c93b486db229cc6d55ff5e9f6c049623474e1 /src/rexmpp_openpgp.c | |
parent | adc336685e0167a9ba0919d48854b13137bb4055 (diff) |
Add the rexmpp_openpgp_set_home_dir utility function
Diffstat (limited to 'src/rexmpp_openpgp.c')
-rw-r--r-- | src/rexmpp_openpgp.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/rexmpp_openpgp.c b/src/rexmpp_openpgp.c index 8065aa7..3c584d5 100644 --- a/src/rexmpp_openpgp.c +++ b/src/rexmpp_openpgp.c @@ -33,10 +33,6 @@ Possible future improvements: automatically, encrypt messages opportunistically (as the XEP suggests). -- Optionally use a separate (possibly per-JID) keyring (though it can - be set by a client application already, right after rexmpp - initialisation). - - Upload keys signed with other keys (instead of exporting with `GPGME_EXPORT_MODE_MINIMAL`): for key rollover, for helping to extend trust to all the keys once some of them are verified in @@ -711,3 +707,18 @@ char *rexmpp_openpgp_encrypt_sign (rexmpp_t *s, return cipher_base64; } + +rexmpp_err_t rexmpp_openpgp_set_home_dir (rexmpp_t *s, const char *home_dir) { + gpgme_engine_info_t engine_info; + gpgme_error_t err; + engine_info = gpgme_ctx_get_engine_info(s->pgp_ctx); + err = gpgme_ctx_set_engine_info(s->pgp_ctx, engine_info->protocol, + engine_info->file_name, + home_dir); + if (gpg_err_code(err) != GPG_ERR_NO_ERROR) { + rexmpp_log(s, LOG_ERR, "Failed to set home directory: %s", + gpgme_strerror(err)); + return REXMPP_E_PGP; + } + return REXMPP_SUCCESS; +} |