/[winpt]/trunk/MyGPGME/common-status.c
ViewVC logotype

Contents of /trunk/MyGPGME/common-status.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (show annotations)
Wed Aug 10 11:33:35 2005 UTC (19 years, 6 months ago) by twoaday
File MIME type: text/plain
File size: 2827 byte(s)
2005-08-06  Timo Schulz  <twoaday@freakmail.de>
 
        * wptGPGME.cpp (keycache_update): Reload OpenPGP parts
        of the secret key.
        (keycache_init): cache name of secret keyring.
        * wptKeyList.cpp (keylist_upd_key): Do not add long keyid.
        (get_key_type): Do not assume 'ultimate' means key pair.
        * wptKeyEditDlgs.cpp (diff_time): New.
        (keyedit_addsubkey_dlg_proc): Changed design and use
        diff_time. Drop checks for invalid keylength (< 1024, > 4096)
        because the combo box automatically handles this.
        * wptKeyManager.cpp (km_set_implicit_trust): Return error code.
        * wptGPG.cpp (get_backup_name): New.
        (gnupg_backup_keyrings): Rotate backup names, from 0..3.
        * wptClipImportDialog.cpp (clip_import_dlg_proc): Free memory.
        * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Use 0x short keyid and
        not the long keyid.


1 /* common-status.c
2 * Copyright (C) 2004 Timo Schulz
3 *
4 * This file is part of MyGPGME.
5 *
6 * MyGPGME is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * MyGPGME is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20 #include <stdlib.h>
21 #include <stdio.h>
22
23 #include "types.h"
24 #include "context.h"
25 #include "common-status.h"
26 #include "util.h"
27
28
29 gpgme_error_t
30 _gpgme_nodata_status_handler (gpg_status_code_t code,
31 const char * args, int * ret)
32 {
33 *ret = 0;
34
35 switch (code) {
36 case STATUS_NODATA:
37 if (args)
38 *ret = atoi (args);
39 else
40 *ret = -1;
41 break;
42
43 case STATUS_UNEXPECTED:
44 *ret = 1;
45 break;
46 }
47
48 return 0;
49 }
50
51
52 gpgme_error_t
53 _gpgme_sigtrust_status_handler (gpg_status_code_t code,
54 const char * args,
55 int * retval)
56 {
57 *retval = 0;
58
59 switch (code) {
60 case STATUS_TRUST_UNDEFINED:
61 *retval = GPGME_VALIDITY_UNDEFINED;
62 break;
63
64 case STATUS_TRUST_NEVER:
65 *retval = GPGME_VALIDITY_NEVER;
66 break;
67
68 case STATUS_TRUST_MARGINAL:
69 *retval = GPGME_VALIDITY_MARGINAL;
70 break;
71
72 case STATUS_TRUST_FULLY:
73 *retval = GPGME_VALIDITY_FULL;
74 break;
75
76 case STATUS_TRUST_ULTIMATE:
77 *retval = GPGME_VALIDITY_ULTIMATE;
78 break;
79 }
80 return 0;
81 }
82
83
84 gpgme_error_t
85 _gpgme_pass_status_handler (gpg_status_code_t code,
86 const char *args,
87 int *r_bad_pass, int *r_no_pass,
88 char **r_info)
89 {
90 int bad_pass = *r_bad_pass;
91 int no_pass = *r_no_pass;
92 char * p;
93
94 switch (code) {
95 case STATUS_BAD_PASSPHRASE:
96 bad_pass++;
97 break;
98
99 case STATUS_GOOD_PASSPHRASE:
100 bad_pass = 0;
101 break;
102
103 case STATUS_NEED_PASSPHRASE:
104 case STATUS_NEED_PASSPHRASE_SYM:
105 DEBUG1 ("pass_status_handler: %s\r\n", args);
106 safe_free (*r_info);
107 p = *r_info = strdup (args);
108 if (!p)
109 return GPGME_Out_Of_Core;
110 break;
111
112 case STATUS_MISSING_PASSPHRASE:
113 DEBUG0 ("missing passphrase - stop\n");
114 no_pass = 1;
115 break;
116 }
117
118 *r_bad_pass = bad_pass;
119 *r_no_pass = no_pass;
120
121 return 0;
122 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26