/[winpt]/trunk/Src/wptGPG.cpp
ViewVC logotype

Diff of /trunk/Src/wptGPG.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 36 by werner, Thu Oct 27 15:25:13 2005 UTC revision 41 by twoaday, Fri Oct 28 07:15:26 2005 UTC
# Line 1  Line 1 
1  /* wptGPG.cpp - GnuPG configuration  /* wptGPG.cpp - GnuPG configuration
2   *      Copyright (C) 2001-2004 Timo Schulz   *      Copyright (C) 2001-2005 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 17  Line 17 
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19   */   */
20    #include <windows.h>
 #ifdef HAVE_CONFIG_H  
 #include <config.h>  
 #endif  
   
 #include <string.h>  
21  #include <string.h>  #include <string.h>
22  #include <stdio.h>  #include <stdio.h>
 #include <windows.h>  
23  #include <shlobj.h>  #include <shlobj.h>
24  #include <ctype.h>  #include <ctype.h>
25  #include <io.h>  #include <io.h>
26    #include <time.h>
27    
28  #include "wptGPG.h"  #include "wptGPG.h"
29  #include "wptGPGCmds.h"  #include "wptGPGCmds.h"
# Line 223  default_key_from_cache (int *ret_no_usea Line 218  default_key_from_cache (int *ret_no_usea
218  }  }
219    
220    
221    /* Load the gpg.conf and search for some options
222       and store the result in the global preference context.
223       Return value: 0 on success. */
224    int
225    gnupg_load_config (void)
226    {
227        int rc;
228        gpg_optfile_t opt;
229        gpg_option_t o;
230        char *conf = get_gnupg_cfgfile ();
231        if (!conf)
232            return -1;
233        rc = parse_gpg_options (conf, &opt);
234        if (rc) {
235            free_if_alloc (conf);
236            return -1;
237        }
238        o = find_option (opt, "ask-cert-level");
239        if (o)
240            reg_prefs.gpg.ask_cert_level = 1;
241        release_gpg_options (opt);
242        free_if_alloc (conf);
243        return 0;
244    }
245    
246    
247  char*  char*
248  get_gnupg_default_key (void)  get_gnupg_default_key (void)
249  {      {    
# Line 252  get_gnupg_default_key (void) Line 273  get_gnupg_default_key (void)
273          if( e )          if( e )
274              keyid = m_strdup( e->val );              keyid = m_strdup( e->val );
275      }      }
276      free_if_alloc( optfile );      free_if_alloc (optfile);
277      release_gpg_options( opt );          release_gpg_options (opt);
278    
279      if( !keyid )      if (!keyid)
280          keyid = default_key_from_cache( &no_usable );          keyid = default_key_from_cache (&no_usable);
281      return keyid;      return keyid;
282  } /* get_gnupg_default_key */  } /* get_gnupg_default_key */
283    

Legend:
Removed from v.36  
changed lines
  Added in v.41

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26