13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
* General Public License for more details. |
* General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
16 |
*/ |
*/ |
17 |
|
|
18 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
42 |
given in @ctrl. |
given in @ctrl. |
43 |
Return value: 0 on success. */ |
Return value: 0 on success. */ |
44 |
static void |
static void |
45 |
siglist_build (listview_ctrl_t * lv, HWND ctrl) |
siglist_build (listview_ctrl_t *lv, HWND ctrl) |
46 |
{ |
{ |
47 |
struct listview_ctrl_s *c; |
listview_ctrl_t c; |
48 |
struct listview_column_s implist[] = { |
struct listview_column_s implist[] = { |
49 |
{0, 240, (char *)_("User ID")}, |
{0, 240, (char *)_("User ID")}, |
50 |
{1, 50, (char *)_("Valid")}, |
{1, 50, (char *)_("Valid")}, |
68 |
|
|
69 |
/* Delete the signature control in @lv. */ |
/* Delete the signature control in @lv. */ |
70 |
void |
void |
71 |
siglist_delete( listview_ctrl_t lv ) |
siglist_delete (listview_ctrl_t lv) |
72 |
{ |
{ |
73 |
if (lv) { |
if (lv) { |
74 |
listview_release (lv); |
listview_release (lv); |
78 |
|
|
79 |
/* Indent the string in @old with the level @ilvl. |
/* Indent the string in @old with the level @ilvl. |
80 |
Return value: indented string. */ |
Return value: indented string. */ |
81 |
static char * |
static char* |
82 |
indent_string (const char * old, int ilvl) |
indent_string (const char *old, int ilvl) |
83 |
{ |
{ |
84 |
char * p; |
char *p; |
85 |
int i; |
int i; |
86 |
|
|
87 |
p = new char[strlen (old) + 1 + ilvl]; |
p = new char[strlen (old) + 1 + ilvl]; |
100 |
{ |
{ |
101 |
LV_ITEM lvi; |
LV_ITEM lvi; |
102 |
|
|
103 |
memset (&lvi, 0, sizeof lvi); |
memset (&lvi, 0, sizeof (lvi)); |
104 |
lvi.iItem = pos; |
lvi.iItem = pos; |
105 |
lvi.lParam = (LPARAM)ks; |
lvi.lParam = (LPARAM)ks; |
106 |
lvi.mask = LVIF_PARAM; |
lvi.mask = LVIF_PARAM; |
117 |
siglist_add_key (listview_ctrl_t lv, struct native_uid_s *uid, |
siglist_add_key (listview_ctrl_t lv, struct native_uid_s *uid, |
118 |
gpgme_key_sig_t ks, int pos) |
gpgme_key_sig_t ks, int pos) |
119 |
{ |
{ |
120 |
struct winpt_key_s key; |
struct winpt_key_s key; |
|
char t[128]; |
|
121 |
const char *attr; |
const char *attr; |
122 |
const char *s; |
const char *s; |
123 |
int key_attr, no_uid = 0; |
char t[128]; |
124 |
int rc = 0; |
int no_uid = 0; |
125 |
|
int rc; |
126 |
|
|
127 |
if (ks && !IS_UID_CERT (ks->sig_class)) |
if (ks && !IS_UID_CERT (ks->sig_class)) |
128 |
return 0; |
return 0; |
142 |
attr = uid->uid; |
attr = uid->uid; |
143 |
if (attr && strlen (attr)) { |
if (attr && strlen (attr)) { |
144 |
char *p = uid? m_strdup (attr) : indent_string (attr, 2); |
char *p = uid? m_strdup (attr) : indent_string (attr, 2); |
145 |
listview_add_sub_item (lv, pos, 0, p); |
listview_add_sub_item (lv, pos, SL_COL_UID, p); |
146 |
free_if_alloc (p); |
free_if_alloc (p); |
147 |
} |
} |
148 |
else { |
else { |
149 |
listview_add_sub_item (lv, pos, 0, _(" user ID not found")); |
listview_add_sub_item (lv, pos, SL_COL_UID, _(" user ID not found")); |
150 |
no_uid = 1; |
no_uid = 1; |
151 |
} |
} |
152 |
|
|
153 |
|
/* Return immediately for root items. */ |
154 |
if (uid) |
if (uid) |
155 |
return 0; |
return 0; |
156 |
|
|
157 |
|
/* TRANSLATORS: these strings should be in capital letters. */ |
158 |
switch (gpgme_err_code (ks->status)) { |
switch (gpgme_err_code (ks->status)) { |
159 |
case GPG_ERR_NO_ERROR: s = "YES"; break; |
case GPG_ERR_NO_ERROR: s = _("YES"); break; |
160 |
case GPG_ERR_NO_PUBKEY: s = "NOKEY"; break; |
case GPG_ERR_NO_PUBKEY: s = _("NOKEY"); break; |
161 |
case GPG_ERR_BAD_SIGNATURE:s = "NO"; break; |
case GPG_ERR_BAD_SIGNATURE:s = _("NO"); break; |
162 |
default: s = "ERROR"; break; |
default: s = _("ERROR"); break; |
163 |
} |
} |
164 |
if (no_uid) |
if (no_uid) |
165 |
s = "NOKEY"; |
s = _("NOKEY"); |
166 |
listview_add_sub_item (lv, pos, 1, s); |
listview_add_sub_item (lv, pos, SL_COL_VALID, s); |
167 |
|
|
168 |
switch (ks->sig_class) { |
switch (ks->sig_class) { |
169 |
case 0x10: strcpy (t, " "); break; |
case 0x10: strcpy (t, " "); break; |
171 |
case 0x12: strcpy (t, "2"); break; |
case 0x12: strcpy (t, "2"); break; |
172 |
case 0x13: strcpy (t, "3"); break; |
case 0x13: strcpy (t, "3"); break; |
173 |
} |
} |
174 |
|
|
175 |
strcat (t, " "); |
strcat (t, " "); |
176 |
if (!ks->exportable) |
if (!ks->exportable) |
177 |
strcat (t, "L"); |
strcat (t, "L"); |
178 |
/*if (key_attr & GPGME_SIGF_NREV) |
/* XXX: if gpgme supports non-revocable status, add 'R' */ |
179 |
strcat (t, "R");*/ |
listview_add_sub_item (lv, pos, SL_COL_CLASS, t); |
180 |
listview_add_sub_item (lv, pos, 2, t); |
|
181 |
|
s = get_key_created (ks->timestamp); |
182 |
key_attr = ks->timestamp; |
listview_add_sub_item (lv, pos, SL_COL_CREATE, s); |
183 |
if( key_attr ) { |
|
184 |
s = get_key_created (key_attr); |
if (ks->keyid && strlen (ks->keyid) == 16) { |
185 |
listview_add_sub_item (lv, pos, 3, s); |
_snprintf (t, DIM (t) -1, "0x%s", ks->keyid + 8); |
186 |
} |
listview_add_sub_item (lv, pos, SL_COL_KEYID, t); |
|
|
|
|
attr = ks->keyid; |
|
|
if (attr && strlen (attr) == 16) { |
|
|
_snprintf (t, sizeof (t) -1, "0x%s", attr + 8); |
|
|
listview_add_sub_item (lv, pos, 4, t); |
|
187 |
} |
} |
188 |
|
|
189 |
key_attr = ks->expires; |
if (ks->expires > 0) { |
190 |
if (key_attr) { |
s = get_key_created (ks->expires); |
191 |
s = get_key_created (key_attr); |
listview_add_sub_item (lv, pos, SL_COL_EXPIRE, s); |
|
listview_add_sub_item (lv, pos, 5, s); |
|
192 |
} |
} |
193 |
|
|
194 |
attr = get_key_pubalgo (ks->pubkey_algo); |
attr = get_key_pubalgo (ks->pubkey_algo); |