mcabber/mcabber/pgp.c
changeset 2234 232c26383fc4
parent 2233 90c25a29fb35
child 2237 048cff929e4d
equal deleted inserted replaced
2233:90c25a29fb35 2234:232c26383fc4
    55 {
    55 {
    56   gpgme_error_t err;
    56   gpgme_error_t err;
    57 
    57 
    58   gpgme_ctx_t ctx;
    58   gpgme_ctx_t ctx;
    59   gpgme_engine_info_t info;
    59   gpgme_engine_info_t info;
    60   const char *gpg_path;
    60   const char *gpg_path, *gpg_home;
    61 
    61 
    62   // Check for version and OpenPGP protocol support.
    62   // Check for version and OpenPGP protocol support.
    63   if (!gpgme_check_version(MIN_GPGME_VERSION)) {
    63   if (!gpgme_check_version(MIN_GPGME_VERSION)) {
    64     scr_LogPrint(LPRINT_LOGNORM,
    64     scr_LogPrint(LPRINT_LOGNORM,
    65                  "GPGME initialization error: Bad library version");
    65                  "GPGME initialization error: Bad library version");
    78   gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
    78   gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
    79 
    79 
    80   // The path to the gpg binary can be specified in order to force
    80   // The path to the gpg binary can be specified in order to force
    81   // version 1, for example.
    81   // version 1, for example.
    82   gpg_path = settings_opt_get("gpg_path");
    82   gpg_path = settings_opt_get("gpg_path");
    83   if (gpg_path) {
    83   gpg_home = settings_opt_get("gpg_home");
    84     err = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, gpg_path, NULL);
    84   if (gpg_path || gpg_home) {
       
    85     char *xp_gpg_home = expand_filename(gpg_home);
       
    86     err = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, gpg_path, xp_gpg_home);
       
    87     g_free(xp_gpg_home);
    85     if (err) return -1;
    88     if (err) return -1;
    86   }
    89   }
    87 
    90 
    88   // Store private data.
    91   // Store private data.
    89   gpg_set_private_key(priv_key);
    92   gpg_set_private_key(priv_key);