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

Annotation of /trunk/Src/wptKeyManagerDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (hide annotations)
Wed Oct 12 10:04:26 2005 UTC (19 years, 4 months ago) by twoaday
File size: 52156 byte(s)
First testing phase finished.
Provide bug fixes for a lot of (minor) problems.

1 twoaday 2 /* wptKeyManagerDlg.cpp - WinPT Key Manager
2 twoaday 16 * Copyright (C) 2000-2005 Timo Schulz
3 twoaday 2 * Copyright (C) 2004 Andreas Jobs
4     *
5     * This file is part of WinPT.
6     *
7     * WinPT is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * WinPT is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with WinPT; if not, write to the Free Software Foundation,
19     * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20     */
21    
22     #include <windows.h>
23     #include <commctrl.h>
24    
25     #include "../resource.h"
26     #include "wptTypes.h"
27     #include "wptGPG.h"
28     #include "wptCommonCtl.h"
29     #include "wptContext.h" /* for passphrase_s */
30     #include "wptDlgs.h"
31     #include "wptW32API.h"
32     #include "wptVersion.h"
33     #include "wptKeylist.h"
34     #include "wptNLS.h"
35     #include "wptErrors.h"
36     #include "wptHotkey.h"
37     #include "wptKeyManager.h"
38     #include "wptKeyserver.h"
39     #include "wptKeyEdit.h"
40     #include "wptRegistry.h"
41    
42 twoaday 25 #define KM_SEPARATOR_ID 10000
43 twoaday 2 #define WINDOWCLASS_SEPARATOR_CHILD "WINPT_SEP_CHILD"
44 twoaday 25 //#define KM_SEPARATOR_HEIGHT 5
45 twoaday 2
46    
47     static subclass_s keylist_proc;
48     static int km_index = -1;
49    
50     HIMAGELIST glob_imagelist;
51    
52     struct km_info {
53     /* Window positions */
54     int pos_x, pos_y;
55     int ypos_sep;
56     int ypercent_sep;
57    
58     HWND hwnd_sep;
59     HWND toolbar;
60     HWND statbar;
61    
62     listview_ctrl_t lv;
63     int keylist_sortby;
64     };
65    
66     struct mybuttons {
67     long icon;
68     long command;
69     char *text;
70     };
71    
72     struct mybuttons myb[] = {
73     {IMI_KEY_DELETE, ID_KEYMISC_DELETE, "Delete"},
74     {IMI_KEY_PROPS, ID_KEYMISC_PROPS, "Properties"},
75     {IMI_KEY_SIGN, ID_KEYMISC_SIGN, "Sign"},
76     {IMI_KEY_IMPORT, ID_KEYMISC_IMPORT, "Import"},
77     {IMI_KEY_EXPORT, ID_KEYMISC_EXPORT, "Export"},
78     };
79    
80    
81 twoaday 22 #ifndef VK_F
82     #define VK_F 70
83     #endif
84     #ifndef VK_A
85     #define VK_A 65
86     #endif
87     #ifndef VK_C
88     #define VK_C 67
89     #endif
90     #ifndef VK_P
91     #define VK_P 80
92     #endif
93    
94 twoaday 2 static BOOL CALLBACK
95     keylist_subclass_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
96     {
97 twoaday 22 struct listview_ctrl_s lv;
98    
99     switch (msg) {
100 twoaday 2 case WM_LBUTTONDBLCLK:
101 twoaday 22 send_cmd_id (keylist_proc.dlg, ID_KEYMISC_PROPS);
102 twoaday 2 break;
103    
104     case WM_KEYUP:
105     int virt_key = (int)wparam;
106 twoaday 22 switch (virt_key) {
107     case VK_SPACE:
108 twoaday 2 send_cmd_id( keylist_proc.dlg, ID_KEYMISC_PROPS );
109     break;
110 twoaday 22
111     case VK_DELETE:
112 twoaday 2 send_cmd_id( keylist_proc.dlg, ID_KEYMISC_DELETE );
113     break;
114 twoaday 22
115     case VK_INSERT:
116 twoaday 2 send_cmd_id (keylist_proc.dlg, ID_KEYMISC_PASTE);
117     break;
118 twoaday 22
119     case VK_A:
120     if (GetAsyncKeyState (VK_CONTROL)) {
121     lv.ctrl = GetDlgItem (keylist_proc.dlg, IDC_KEYMISC_KEYLIST);
122     listview_select_all (&lv);
123     }
124     break;
125    
126     case VK_C:
127     if (GetAsyncKeyState (VK_CONTROL)) {
128     lv.ctrl = GetDlgItem (keylist_proc.dlg, IDC_KEYMISC_KEYLIST);
129     km_index = listview_get_curr_pos (&lv);
130     km_clip_export (keylist_proc.dlg, &lv);
131     }
132     break;
133    
134     case VK_P:
135     if (GetAsyncKeyState (VK_CONTROL)) {
136     km_index = -1;
137     km_clip_import (keylist_proc.dlg);
138     }
139     break;
140    
141     case VK_F:
142     if (GetAsyncKeyState (VK_CONTROL)) {
143     lv.ctrl = GetDlgItem (keylist_proc.dlg, IDC_KEYMISC_KEYLIST);
144     km_find_key (dlg, &lv);
145     }
146     break;
147 twoaday 2 }
148     break;
149     }
150    
151     return CallWindowProc( keylist_proc.old, dlg, msg, wparam, lparam );
152     } /* keylist_subclass_proc */
153    
154    
155     static HWND
156     load_toolbar (HWND dlg, struct km_info * kmi)
157     {
158     HWND tbwnd;
159     TBSAVEPARAMS tbsp;
160     TBBUTTON tb_buttons[] = {
161     /*{imagelist_getindex(IMI_EXIT), ID_KEYMISC_QUIT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0L, 0},*/
162     {imagelist_getindex(IMI_KEY_DELETE), ID_KEYMISC_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, 0},
163     {imagelist_getindex(IMI_KEY_PROPS), ID_KEYMISC_PROPS, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, 0},
164     {imagelist_getindex(IMI_KEY_SIGN), ID_KEYMISC_SIGN, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, 0},
165     {0, 0, 0, TBSTYLE_SEP, {0}, 0L, 0},
166     {imagelist_getindex(IMI_KEY_IMPORT), ID_KEYMISC_IMPORT, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, 0},
167     {imagelist_getindex(IMI_KEY_EXPORT), ID_KEYMISC_EXPORT, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, 0},
168     };
169    
170     tbwnd = CreateWindowEx (0, TOOLBARCLASSNAME, NULL,
171     WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_FLAT|CCS_ADJUSTABLE,
172     0, 0, 0, 0, dlg, (HMENU)IDR_WINPT_KMTB, glob_hinst, NULL);
173     if (tbwnd) {
174     SendMessage (tbwnd, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
175     SendMessage (tbwnd, TB_SETIMAGELIST, 0, (LPARAM)glob_imagelist);
176     SendMessage (tbwnd, TB_AUTOSIZE, 0, 0);
177     ShowWindow (tbwnd, SW_SHOW);
178    
179     /* Restore toolbar */
180     tbsp.hkr = HKEY_CURRENT_USER;
181     tbsp.pszSubKey = "Software\\WinPT";
182     tbsp.pszValueName = "KM_toolbar";
183     if (SendMessage(tbwnd, TB_SAVERESTORE, FALSE, (LPARAM)&tbsp ) == 0)
184     SendMessage (tbwnd, TB_ADDBUTTONS, sizeof(tb_buttons) / sizeof(tb_buttons[0]), (LONG)&tb_buttons[0]);
185     }
186     return tbwnd;
187     } /* load_toolbar */
188    
189    
190     static void
191     do_center_window (HWND dlg, struct km_info * kmi)
192     {
193     RECT rect;
194     char * p;
195     int pos_x = 0, pos_y = 0;
196    
197     /* Find bottom of keylist */
198     GetWindowRect (GetDlgItem(dlg, IDC_KEYMISC_KEYLIST), &rect);
199     MapWindowPoints (NULL, dlg, (POINT*)&rect, 2);
200    
201     kmi->ypos_sep = rect.bottom;
202    
203     p = get_reg_entry( HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_X" );
204     if( p && !strcmp( p, " " ) ) {
205     free_if_alloc( p );
206 twoaday 23 center_window( dlg, NULL );
207 twoaday 2 return;
208     }
209     else if( p )
210     pos_x = atol( p );
211    
212     p = get_reg_entry( HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_Y" );
213     if( p && !strcmp( p, " " ) ) {
214     free_if_alloc( p );
215 twoaday 23 center_window( dlg, NULL );
216 twoaday 2 return;
217     }
218     else if( p )
219     pos_y = atol( p );
220    
221     if( !pos_y && !pos_x ) {
222 twoaday 23 center_window( dlg, NULL );
223 twoaday 2 return;
224     }
225    
226     if( pos_x > GetSystemMetrics( SM_CXSCREEN )
227     || pos_y > GetSystemMetrics( SM_CYSCREEN ) ) {
228     pos_x = pos_y = 0;
229     }
230     GetClientRect( dlg, &rect );
231     MoveWindow( dlg, pos_x, pos_y, rect.right, rect.bottom, TRUE );
232     }
233    
234    
235     static void
236     do_resize_window( HWND dlg, struct km_info *kmi)
237     {
238     HWND h;
239     RECT rclient, rect;
240     BOOL bRepaint = FALSE;
241    
242     /* Get rect of client area and make life easier */
243     GetClientRect( dlg, &rclient );
244    
245     /* Move toolbar to the top of the window */
246     if (kmi->toolbar) {
247     GetWindowRect(kmi->toolbar, &rect);
248     ScreenToClient(dlg, (POINT*)&rect);
249     ScreenToClient(dlg, (POINT*)&(rect.right));
250    
251     rclient.top += rect.bottom - rect.top;
252     MoveWindow (kmi->toolbar, 0, 0, rclient.right - rclient.left,
253     rect.bottom - rect.top, bRepaint);
254     }
255    
256     /* Move statusbar to the bottom of the window */
257     if (kmi->statbar) {
258     GetWindowRect( kmi->statbar, &rect );
259     ScreenToClient(dlg, (POINT*)&rect);
260     ScreenToClient(dlg, (POINT*)&(rect.right));
261    
262     rclient.bottom -= rect.bottom - rect.top;
263     MoveWindow (kmi->statbar, 0, rclient.bottom, rclient.right - rclient.left,
264     rect.bottom - rect.top, bRepaint);
265     }
266    
267     // Obtain separator information and move it to the desired posistion
268     if (kmi->ypercent_sep)
269     kmi->ypos_sep = (rclient.bottom - rclient.top) * kmi->ypercent_sep / 100;
270     else
271     kmi->ypercent_sep = kmi->ypos_sep * 100 / (rclient.bottom - rclient.top);
272    
273     // Don't move away
274     if (kmi->ypos_sep+5 > rclient.bottom)
275     kmi->ypos_sep = rclient.bottom - 5;
276     if (kmi->ypos_sep < rclient.top)
277     kmi->ypos_sep = rclient.top;
278     MoveWindow (kmi->hwnd_sep, 0, kmi->ypos_sep, (rclient.right - rclient.left), 5, bRepaint);
279    
280     // Place the keylist above the separator
281     h = GetDlgItem( dlg, IDC_KEYMISC_KEYLIST );
282     MoveWindow (h, rclient.left, rclient.top, rclient.right - rclient.left,
283     kmi->ypos_sep - rclient.top, bRepaint);
284     rclient.top = kmi->ypos_sep + 5 + 8;
285    
286     /* Place the group text and the group box below the separator */
287     h = GetDlgItem( dlg, IDC_KEYMISC_GTEXT );
288     MoveWindow( h, rclient.left, rclient.top, 100, 14, bRepaint);
289     rclient.top += 18;
290    
291     h = GetDlgItem( dlg, IDC_KEYMISC_GROUP );
292     MoveWindow (h, rclient.left, rclient.top, rclient.right - rclient.left,
293     (rclient.bottom < rclient.top) ? 0 : rclient.bottom - rclient.top, bRepaint);
294    
295     /* Repaint the whole thing */
296     InvalidateRect (dlg, NULL, TRUE);
297     } /* do_resize_window */
298    
299    
300     static void
301     do_create_minpopup (HWND dlg)
302     {
303     HMENU hm;
304     MENUITEMINFO mi;
305     char * s;
306     POINT p;
307    
308     if (gpg_read_only)
309     return;
310     hm = CreatePopupMenu ();
311     if (!hm)
312     BUG( NULL );
313     memset (&mi, 0, sizeof mi);
314     mi.cbSize = sizeof mi;
315     s = (char *)_("Paste Key from Clipboard");
316     mi.fType = MF_STRING;
317     mi.dwTypeData = s;
318     mi.cch = strlen (s);
319     mi.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;
320     mi.wID = ID_KEYCTX_PASTE;
321     InsertMenuItem (hm, 0, FALSE, &mi);
322     GetCursorPos (&p);
323     TrackPopupMenu (hm, 0, p.x, p.y, 0, dlg, NULL);
324     DestroyMenu (hm);
325     } /* do_create_minpopup */
326    
327    
328     static void
329 twoaday 25 do_check_cache (listview_ctrl_t lv, HWND dlg, HWND sb)
330 twoaday 2 {
331 twoaday 25 gpg_keycache_t cache;
332 twoaday 2
333     if( keycache_get_reload( ) ) {
334     keycache_reload( dlg );
335     keycache_set_reload( 0 );
336     cache = keycache_get_ctx( 1 );
337     if( !cache )
338     BUG( dlg );
339 twoaday 23 keylist_reload( lv, cache, KEYLIST_LIST, KEY_SORT_USERID );
340     km_complete_status_bar (sb, lv);
341 twoaday 2 }
342     } /* do_check_cache */
343    
344    
345     long CALLBACK
346     separator_wnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
347     {
348     static POINT last_mouse_pos;
349    
350     if (msg == WM_CREATE)
351     SetWindowLong (hwnd, GWL_USERDATA, (long)(((CREATESTRUCT*)lparam)->lpCreateParams));
352    
353     switch (msg) {
354     case WM_PAINT:
355     PAINTSTRUCT ps;
356     RECT rect;
357     HPEN hpen;
358    
359     GetClientRect (hwnd, &rect);
360     BeginPaint (hwnd, &ps);
361    
362     // Background
363     FillRect (ps.hdc, &rect, (HBRUSH)(COLOR_3DFACE+1));
364    
365     // The lines from the light into the dark
366     MoveToEx(ps.hdc, 0,0, NULL);
367     if ((hpen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DHILIGHT))) != NULL) {
368     SelectObject(ps.hdc, (LPVOID)hpen);
369     LineTo(ps.hdc, rect.right, 0);
370     DeleteObject(hpen);
371     }
372     MoveToEx(ps.hdc, 0, 1, NULL);
373     if ((hpen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DLIGHT))) != NULL) {
374     SelectObject(ps.hdc, (LPVOID)hpen);
375     LineTo(ps.hdc, rect.right, rect.bottom);
376     DeleteObject(hpen);
377     }
378    
379     MoveToEx(ps.hdc, 0, rect.bottom-1, NULL);
380     if ((hpen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DSHADOW))) != NULL) {
381     SelectObject(ps.hdc, (LPVOID)hpen);
382     LineTo(ps.hdc, rect.right, rect.bottom-1);
383     DeleteObject(hpen);
384     }
385     MoveToEx(ps.hdc, 0, rect.bottom, NULL);
386     if ((hpen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW))) != NULL) {
387     SelectObject(ps.hdc, (LPVOID)hpen);
388     LineTo(ps.hdc, rect.right, rect.bottom);
389     DeleteObject(hpen);
390     }
391    
392     EndPaint (hwnd, &ps);
393     return 0;
394    
395     case WM_LBUTTONDOWN:
396     last_mouse_pos.x = LOWORD(lparam);
397     last_mouse_pos.y = HIWORD(lparam);
398     ClientToScreen (hwnd, &last_mouse_pos);
399     SetCapture (hwnd);
400     return 0;
401    
402     case WM_LBUTTONUP:
403     ReleaseCapture ();
404     return 0;
405    
406     case WM_MOUSEMOVE:
407     if (wparam == MK_LBUTTON) {
408     struct km_info *kmi;
409     POINT p;
410     RECT rect;
411    
412     if ((kmi = (struct km_info *)GetWindowLong (hwnd, GWL_USERDATA)) == NULL)
413     break;
414    
415     // Calculate mouse movement
416     p.x = LOWORD(lparam);
417     p.y = HIWORD(lparam);
418     ClientToScreen (hwnd, &p);
419    
420     GetWindowRect (hwnd, &rect);
421     rect.top += (short)(p.y - last_mouse_pos.y);
422     rect.bottom += (short)(p.y - last_mouse_pos.y);
423    
424     last_mouse_pos.y = p.y;
425    
426     // Apply mouse movement to window. Beware the MoveWindow is relaive
427     // to parent NOT screen
428     MapWindowPoints (NULL, GetParent(hwnd), (POINT*)&rect, 2);
429     kmi->ypos_sep = rect.top;
430     kmi->ypercent_sep = 0; // This forces do_resize_window to use abs. position
431     do_resize_window (GetParent(hwnd), kmi);
432     return 0;
433     }
434     }
435    
436     return DefWindowProc (hwnd, msg, wparam, lparam);
437     }
438    
439    
440     static HWND
441     regist_sep_wnd (HWND dlg, struct km_info * kmi)
442     {
443     WNDCLASS wndclass;
444     HWND h;
445    
446     wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
447     wndclass.lpfnWndProc = separator_wnd_proc;
448     wndclass.cbClsExtra = 0;
449     wndclass.cbWndExtra = sizeof (long);
450     wndclass.hInstance = glob_hinst;
451     wndclass.hIcon = NULL;
452     wndclass.hCursor = LoadCursor (NULL, IDC_SIZENS);
453     wndclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH);
454     wndclass.lpszMenuName = 0;
455     wndclass.lpszClassName = WINDOWCLASS_SEPARATOR_CHILD;
456     RegisterClass (&wndclass);
457    
458     h = CreateWindowEx (WS_EX_WINDOWEDGE, WINDOWCLASS_SEPARATOR_CHILD, NULL,
459     WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
460     0, 400, 2000, 5, dlg, (HMENU) 0, glob_hinst, kmi);
461     ShowWindow (h, SW_SHOW);
462     return h;
463     } /* regist_sep_wnd */
464    
465    
466    
467     #define enable_button(hwnd, cid) \
468     SendMessage ((hwnd), TB_ENABLEBUTTON, (cid), MAKELONG (key_selected, 0))
469    
470 twoaday 25
471 twoaday 2 void
472     update_ui_items (HWND hwnd, listview_ctrl_t lv)
473     {
474     int key_selected = 0, key_has_sec = 0;
475     int i, key_inv = 0;
476     HWND hwnd_child;
477     HMENU hmenu;
478    
479     /* Get some states */
480     key_selected = SendMessage (GetDlgItem (hwnd, IDC_KEYMISC_KEYLIST),
481     LVM_GETSELECTEDCOUNT, 0, 0)
482     ? TRUE : FALSE;
483     key_has_sec = FALSE;
484     if (key_selected) {
485     i = listview_get_curr_pos (lv);
486     key_has_sec = km_check_for_seckey( lv, i, NULL ) ? TRUE : FALSE;
487     key_inv = km_get_key_status (lv, i) & KM_FLAG_REVOKED;
488     }
489    
490     /* Enable / disable toolbar buttons */
491     hwnd_child = GetDlgItem(hwnd, IDR_WINPT_KMTB);
492     enable_button (hwnd_child, ID_KEYMISC_DELETE);
493     enable_button (hwnd_child, ID_KEYMISC_PROPS);
494     enable_button (hwnd_child, ID_KEYMISC_SIGN);
495     enable_button (hwnd_child, ID_KEYMISC_EXPORT);
496    
497     /* Enable / disable menu items */
498     hmenu = GetMenu (hwnd);
499     set_menu_state (hmenu, ID_KEYMISC_EXPORT, key_selected ? MF_ENABLED : MF_GRAYED);
500     set_menu_state (hmenu, ID_KEYMISC_EXPORT_PRIVKEY, key_has_sec ? MF_ENABLED : MF_GRAYED);
501     set_menu_state (hmenu, ID_KEYMISC_REVCERT, key_has_sec ? MF_ENABLED : MF_GRAYED);
502     set_menu_state (hmenu, ID_KEYMISC_DELETE, key_selected ? MF_ENABLED : MF_GRAYED);
503     set_menu_state (hmenu, ID_KEYMISC_PROPS, key_selected ? MF_ENABLED : MF_GRAYED);
504 twoaday 25 set_menu_state (hmenu, ID_KEYMISC_SIGN, key_selected && !key_inv ? MF_ENABLED : MF_GRAYED);
505     set_menu_state (hmenu, ID_KEYMISC_EDITKEY, key_selected? MF_ENABLED : MF_GRAYED);
506     set_menu_state (hmenu, ID_KEYMISC_CHECKSIGS, key_selected? MF_ENABLED : MF_GRAYED);
507 twoaday 2 } /* update_ui_items */
508    
509    
510     static void
511     popup_gpg_readonly (HWND dlg, HMENU hm)
512     {
513     int resids[] = {
514     ID_KEYCTX_PASTE,
515     ID_KEYCTX_EDIT,
516     ID_KEYCTX_SIGN,
517     ID_KEYCTX_REV,
518     ID_KEYCTX_DEL,
519     ID_KEYCTX_ENABLE,
520     ID_KEYCTX_DISABLE,
521     ID_KEYCTX_RECVFROM,
522     ID_KEYCTX_ADDKEY,
523     ID_KEYCTX_ADDPHOTO,
524     ID_KEYCTX_ADDUID,
525     ID_KEYCTX_ADDREV,
526     0
527     };
528     int i;
529    
530     if (gpg_read_only == 0)
531     return;
532     for (i=0; resids[i] != 0; i++)
533     set_menu_state (hm, resids[i], MF_GRAYED);
534     }
535    
536    
537     static void
538     menu_gpg_readonly (HWND dlg, HMENU hm, int id)
539     {
540 twoaday 19 int key_resids[] = {
541 twoaday 2 ID_KEYMISC_SIGN,
542     ID_KEYMISC_DELETE,
543     ID_KEYMISC_REVCERT,
544     ID_KEYMISC_IMPORT_HTTP,
545     ID_KEYMISC_IMPORT,
546     ID_KEYMISC_REFRESH_KEYS,
547     ID_KEYMISC_REBUILD,
548     ID_KEYMISC_KEYWIZARD,
549     ID_KEYMISC_CARDNEW,
550     ID_KEYMISC_NEWKEY,
551     0,
552     };
553 twoaday 19 int edit_resids[] = {
554 twoaday 2 ID_KEYMISC_PASTE,
555     ID_KEYMISC_OT,
556     ID_KEYMISC_EDITKEY,
557     0
558     };
559     int * resids;
560     int i;
561    
562    
563     if (gpg_read_only == 0)
564     return;
565 twoaday 19 switch (id) {
566 twoaday 2 case 0: return;
567     case 3: resids = key_resids; break;
568     case 1: resids = edit_resids;break;
569     }
570    
571     for (i=0; resids[i] != 0; i++)
572     set_menu_state (hm, resids[i], MF_GRAYED);
573     }
574    
575    
576 twoaday 22 static char*
577 twoaday 24 gen_export_filename (const char *keyid, int is_secret)
578 twoaday 22 {
579     gpgme_key_t key;
580     const char *s;
581     char *p;
582    
583     if (get_pubkey (keyid, &key))
584     return m_strdup (keyid);
585 twoaday 23 s = key->uids->name;
586 twoaday 22 if (!s)
587     return m_strdup (keyid);
588 twoaday 24 p = new char[strlen (s) + 8 + 16];
589 twoaday 22 if (!p)
590     BUG (0);
591 twoaday 24 sprintf (p, "%s%s.asc", s, is_secret? "_sec" : "");
592 twoaday 22 for (size_t i=0; i < strlen (p); i++) {
593     if (p[i] == ' ' || p[i] == ':' || p[i] == '?' || p[i] == '|')
594     p[i] = '_';
595     }
596     return p;
597     }
598    
599    
600     static void
601     update_key (listview_ctrl_t lv, int pos, const char *keyid, int keypair)
602     {
603     gpgme_key_t key;
604    
605     keycache_update (0, keyid);
606     if (keypair)
607     keycache_update (1, keyid);
608    
609     /* because we replaced the key item, we need to update the
610     address of the pointer in the ListView control. */
611     get_pubkey (keyid, &key);
612     keylist_upd_key (lv, pos, key);
613     }
614    
615    
616 twoaday 25 /* Setup status bar for the main window @dlg. */
617     static HWND
618     setup_status_bar (HWND dlg, listview_ctrl_t lv)
619     {
620     HWND statbar;
621     RECT r;
622     int partpos[3];
623     int i;
624 twoaday 22
625 twoaday 25 GetClientRect (dlg, &r);
626     for (i=1; i <= 3; i++)
627     partpos[i-1] = r.right/3*i;
628     statbar = CreateStatusWindow (WS_CHILD | WS_VISIBLE | CCS_BOTTOM,
629     "status bar", dlg, KM_SEPARATOR_ID);
630    
631     ShowWindow (statbar, SW_SHOW);
632     SendMessage (statbar, SB_SETPARTS, (WPARAM)3, (LPARAM)partpos);
633    
634     km_update_default_key_str (statbar);
635     km_complete_status_bar (statbar, lv);
636    
637     return statbar;
638     }
639    
640    
641 twoaday 2 BOOL CALLBACK
642     keymanager_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
643     {
644     struct km_info *kmi;
645     static km_group_s *gc = NULL;
646     static HMENU menu = NULL;
647     static int refresh_keys = 0;
648     INITCOMMONCONTROLSEX icex;
649     HWND kl;
650     HMENU hm;
651 twoaday 25 gpg_keycache_t c;
652 twoaday 22 gpgme_key_t key;
653     /*km_group_cb_s gcb; XXX */
654 twoaday 20 struct genkey_s genkey;
655 twoaday 2 struct winpt_key_s k = {0};
656 twoaday 19 struct URL_ctx_s *url;
657 twoaday 2 refresh_cache_s rcs = {0};
658 twoaday 24 char keyid[48], uid[128], type[32], *name;
659 twoaday 2 const char *t, * host;
660     u16 port = 0;
661     int idx = 0, i=0, rc;
662     size_t size = 0;
663    
664     if ((msg != WM_INITDIALOG)
665     && ((kmi = (struct km_info*)GetWindowLong (dlg, GWL_USERDATA)) == NULL))
666     return FALSE;
667    
668     switch (msg) {
669     case WM_INITDIALOG:
670     kmi = new struct km_info;
671     memset (kmi, 0, sizeof (struct km_info));
672     icex.dwSize = sizeof (INITCOMMONCONTROLSEX);
673     icex.dwICC = ICC_BAR_CLASSES;
674     InitCommonControlsEx (&icex);
675     kmi->hwnd_sep = regist_sep_wnd (dlg, kmi);
676     imagelist_load (dlg);
677    
678     #ifndef LANG_DE
679     SetWindowText( dlg, _("Key Manager") );
680     #endif
681     menu = LoadMenu( glob_hinst, (LPCSTR)IDR_WINPT_KEYMISC );
682     #ifndef LANG_DE
683     set_menu_text( menu, ID_KEYMISC_QUIT, _("&Quit") );
684     set_menu_text( menu, ID_KEYMISC_UID, _("User ID") );
685     set_menu_text( menu, ID_KEYMISC_NEWKEY, _("&Expert") );
686     set_menu_text( menu, ID_KEYMISC_KEYWIZARD, _("&Normal") );
687     set_menu_text( menu, ID_KEYMISC_EDIT, _("Edit") );
688     set_menu_text( menu, ID_KEYMISC_SIGN, _("&Sign") );
689     set_menu_text( menu, ID_KEYMISC_DELETE, _("&Delete") );
690     set_menu_text( menu, ID_KEYMISC_REVCERT, _("&Revoke") );
691     set_menu_text( menu, ID_KEYMISC_CHECKSIGS, _("&List Signatures") );
692     set_menu_text( menu, ID_KEYMISC_TRUSTPATH, _("List Trust Path") );
693     set_menu_text( menu, ID_KEYMISC_PROPS, _("&Properties") );
694     set_menu_text( menu, ID_KEYMISC_GPGOPT, _("Options") );
695     set_menu_text( menu, ID_KEYMISC_GPGPREFS, _("Preferences") );
696     set_menu_text( menu, ID_KEYMISC_SENDRECV, _("Keyserver") );
697     set_menu_text( menu, ID_KEYMISC_RECACHE, _("Re&load Key Cache") );
698     set_menu_text( menu, ID_KEYMISC_REBUILD, _("R&everify Signatures") );
699     set_menu_text( menu, ID_KEYMISC_INFO, _("Info") );
700     set_menu_text (menu, ID_KEYMISC_HELP, _("Help"));
701     #endif
702 twoaday 25 SetMenu (dlg, menu);
703 twoaday 2 if( keyring_check_last_access() )
704     keycache_set_reload( 1 );
705     if( keycache_get_reload( ) )
706     keycache_reload( dlg );
707     c = keycache_get_ctx( KEYCACHE_PUB );
708     if( !c )
709     BUG( NULL );
710 twoaday 23 kmi->keylist_sortby = KEY_SORT_USERID;
711 twoaday 2 Header_SetImageList(ListView_GetHeader(GetDlgItem( dlg, IDC_KEYMISC_KEYLIST )),
712     glob_imagelist);
713     kmi->lv = keylist_load( GetDlgItem( dlg, IDC_KEYMISC_KEYLIST ), c,
714     NULL, KEYLIST_LIST, kmi->keylist_sortby );
715     /* init subclassing for the listview */
716     kl = GetDlgItem( dlg, IDC_KEYMISC_KEYLIST );
717     keylist_proc.dlg = dlg;
718     keylist_proc.current = (WNDPROC)keylist_subclass_proc;
719     keylist_proc.old = (WNDPROC)GetWindowLong( kl, GWL_WNDPROC );
720     if( keylist_proc.old ) {
721     if( !SetWindowLong( kl, GWL_WNDPROC, (LONG)keylist_proc.current) ) {
722     msg_box( dlg, _("Could not set keylist window procedure."), _("Key Manager"), MB_ERR );
723     BUG( NULL );
724     }
725     }
726 twoaday 22 #if 0
727 twoaday 2 km_groups_new( &gc, GetDlgItem( dlg, IDC_KEYMISC_GROUP ) );
728     km_groups_load( gc );
729 twoaday 22 #endif
730 twoaday 25 SetClassLong (dlg, GCL_HICON, (LONG)LoadIcon (glob_hinst, (LPCTSTR)IDI_WINPT));
731     SetForegroundWindow (dlg);
732 twoaday 23
733 twoaday 25 kmi->statbar = setup_status_bar (dlg, kmi->lv);
734 twoaday 2
735     SetWindowLong (dlg, GWL_USERDATA, (LONG)kmi);
736     kmi->toolbar = load_toolbar (dlg, kmi);
737    
738     do_center_window( dlg, kmi );
739     do_resize_window( dlg, kmi );
740     update_ui_items (dlg, kmi->lv);
741     return TRUE;
742    
743     case WM_DESTROY:
744     if (kmi->lv) {
745     keylist_delete (kmi->lv);
746     kmi->lv = NULL;
747 twoaday 23
748     /*
749 twoaday 2 if (gc) {
750     km_groups_release (gc);
751     gc = NULL;
752 twoaday 23 }*/
753 twoaday 2 imagelist_destroy ();
754    
755     char buf[32];
756     ltoa (kmi->pos_x, buf, 10);
757     set_reg_entry( HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_X", buf );
758     ltoa (kmi->pos_y, buf, 10);
759     set_reg_entry (HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_Y", buf);
760     /* Remove runtime information. This should be the last action taken here. */
761     delete kmi; kmi = NULL;
762     SetWindowLong (dlg, GWL_USERDATA, NULL);
763     keycache_set_reload (refresh_keys);
764     return FALSE;
765    
766     case WM_MOVE:
767     /* kmi->pos_x = (int)(short)LOWORD(lparam);
768     kmi->pos_y = (int)(short)HIWORD(lparam); */
769     RECT r;
770     GetWindowRect (dlg, &r);
771     kmi->pos_x = r.left;
772     kmi->pos_y = r.top;
773     break;
774    
775    
776     case WM_RBUTTONUP:
777     do_create_minpopup (dlg);
778     break;
779    
780     case WM_NOTIFY:
781     NMHDR * notify;
782     POINT p;
783     HMENU popup;
784    
785     notify = (NMHDR *)lparam;
786     if (notify == NULL)
787     break;
788     switch (notify->code)
789     {
790     case TBN_QUERYDELETE:
791     SetWindowLong(dlg, DWL_MSGRESULT, TRUE);
792     return TRUE;
793    
794     case TBN_QUERYINSERT:
795     SetWindowLong(dlg, DWL_MSGRESULT, TRUE);
796     return TRUE;
797    
798     case TBN_GETBUTTONINFO:
799     LPTBNOTIFY lpTbNotify;
800     lpTbNotify = (LPTBNOTIFY)lparam;
801     if (lpTbNotify->iItem < (sizeof(myb) / sizeof(mybuttons))) {
802     lpTbNotify->tbButton.iBitmap = imagelist_getindex(myb[lpTbNotify->iItem].icon);
803     lpTbNotify->tbButton.idCommand = myb[lpTbNotify->iItem].command;
804     lpTbNotify->tbButton.fsState = TBSTATE_ENABLED;
805     lpTbNotify->tbButton.fsStyle = TBSTYLE_BUTTON;
806     lpTbNotify->tbButton.iString = 0;
807     strncpy (lpTbNotify->pszText, myb[lpTbNotify->iItem].text, lpTbNotify->cchText);
808     SetWindowLong(dlg, DWL_MSGRESULT, TRUE);
809     }
810     return TRUE;
811    
812     case TBN_RESET: /* Restore last saved toolbar status */
813     TBSAVEPARAMS tbsp;
814    
815     tbsp.hkr = HKEY_CURRENT_USER;
816     tbsp.pszSubKey = "Software\\WinPT";
817     tbsp.pszValueName = "KM_toolbar";
818     SendMessage (notify->hwndFrom, TB_SAVERESTORE, FALSE, (LPARAM)&tbsp);
819     break;
820    
821     case TBN_BEGINADJUST: /* User is about to change the toolbar. Save it */
822     tbsp.hkr = HKEY_CURRENT_USER;
823     tbsp.pszSubKey = "Software\\WinPT";
824     tbsp.pszValueName = "KM_toolbar";
825     SendMessage (notify->hwndFrom, TB_SAVERESTORE, TRUE, (LPARAM)&tbsp);
826     break;
827    
828     case TBN_ENDADJUST: /* User has finished customizing the toolbar. Save it. */
829     tbsp.hkr = HKEY_CURRENT_USER;
830     tbsp.pszSubKey = "Software\\WinPT";
831     tbsp.pszValueName = "KM_toolbar";
832     SendMessage (notify->hwndFrom, TB_SAVERESTORE, TRUE, (LPARAM)&tbsp);
833     break;
834    
835     case TTN_GETDISPINFO:
836     LPTOOLTIPTEXT lpttt;
837     lpttt = (LPTOOLTIPTEXT)lparam;
838    
839     lpttt->hinst = NULL;
840     switch (lpttt->hdr.idFrom) {
841     case ID_KEYMISC_DELETE:
842     lpttt->lpszText = (char *)_("Delete key from keyring");
843     break;
844    
845     case ID_KEYMISC_PROPS:
846     lpttt->lpszText = (char *)_("Show key properties");
847     break;
848    
849     case ID_KEYMISC_SIGN:
850     lpttt->lpszText = (char *)_("Sign key");
851     break;
852    
853     case ID_KEYMISC_IMPORT:
854     lpttt->lpszText = (char *)_("Import key to keyring");
855     break;
856    
857     case ID_KEYMISC_EXPORT:
858     lpttt->lpszText = (char *)_("Export key to a file");
859     break;
860     }
861     return TRUE;
862    
863     case LVN_ITEMCHANGED:
864     if (((LPNMLISTVIEW)lparam)->uNewState) /* item selected? */
865     {
866     update_ui_items (dlg, kmi->lv);
867     return TRUE;
868     }
869     break;
870    
871     case NM_RCLICK:
872 twoaday 22 if (notify->idFrom == IDC_KEYMISC_KEYLIST) {
873 twoaday 2 if (listview_get_curr_pos (kmi->lv) == -1)
874     return TRUE; /* Popup only when a item was selected */
875     do_check_cache (kmi->lv, dlg, kmi->statbar);
876     GetCursorPos (&p);
877     hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYMISC_CTX));
878     popup = GetSubMenu (hm, 0);
879     #ifndef LANG_DE
880     set_menu_text( popup, ID_KEYCTX_UID_COPY, _("Copy User ID to Clipboard") );
881     set_menu_text( popup, ID_KEYCTX_COPY, _("Copy Key to Clipboard") );
882     set_menu_text( popup, ID_KEYCTX_PASTE, _("Paste Key from Clipboard") );
883     set_menu_text( popup, ID_KEYCTX_RECVFROM, _("Refresh from Keyserver") );
884     #endif
885     idx = listview_get_curr_pos (kmi->lv);
886 twoaday 22 if (km_check_for_seckey (kmi->lv, idx, &i))
887 twoaday 2 set_menu_state (popup, ID_KEYCTX_SETDEFKEY, MF_ENABLED);
888 twoaday 22 if (i == 0)
889 twoaday 2 set_menu_state (popup, ID_KEYCTX_MAXTRUST, MF_ENABLED);
890 twoaday 19 if (!km_check_for_seckey (kmi->lv, idx, NULL)) {
891 twoaday 2 set_menu_state( popup, ID_KEYCTX_REV, MF_DISABLED|MF_GRAYED );
892     set_menu_state( popup, ID_KEYCTX_ADDKEY, MF_DISABLED|MF_GRAYED );
893     set_menu_state( popup, ID_KEYCTX_ADDUID, MF_DISABLED|MF_GRAYED );
894     set_menu_state( popup, ID_KEYCTX_ADDREV, MF_DISABLED|MF_GRAYED );
895     set_menu_state( popup, ID_KEYCTX_ADDPHOTO, MF_DISABLED|MF_GRAYED );
896     set_menu_state (popup, ID_KEYCTX_SETPREFKS, MF_DISABLED|MF_GRAYED);
897     }
898 twoaday 25 else if( km_check_for_seckey (kmi->lv, idx, NULL)
899     && km_key_is_v3 (kmi->lv, idx)) {
900 twoaday 2 /* PGP 2 keys, version 3 have no no support for photo-id's,
901     designated revokers and secondary keys. */
902 twoaday 20 set_menu_state (popup, ID_KEYCTX_ADDKEY, MF_DISABLED|MF_GRAYED);
903     set_menu_state (popup, ID_KEYCTX_ADDREV, MF_DISABLED|MF_GRAYED);
904     set_menu_state (popup, ID_KEYCTX_ADDPHOTO, MF_DISABLED|MF_GRAYED);
905 twoaday 2 }
906     if( km_get_key_status( kmi->lv, idx ) & KM_FLAG_DISABLED )
907     set_menu_state( popup, ID_KEYCTX_DISABLE, MF_DISABLED|MF_GRAYED );
908     else
909     set_menu_state( popup, ID_KEYCTX_ENABLE, MF_DISABLED|MF_GRAYED );
910     if (km_get_key_status (kmi->lv, idx) & KM_FLAG_REVOKED)
911     set_menu_state (popup, ID_KEYCTX_SIGN, MF_DISABLED|MF_GRAYED);
912 twoaday 22 if (mapi_init())
913     set_menu_state (popup, ID_KEYCTX_SENDMAIL, MF_DISABLED|MF_GRAYED);
914     /* Override 'Default Keyserver' with the actual name. */
915     host = kserver_get_hostname (0, -1, &port);
916     set_menu_text (popup, ID_KEYCTX_KS_DEFAULT, host);
917 twoaday 2 popup_gpg_readonly (dlg, popup);
918 twoaday 22 TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL);
919     DestroyMenu (popup);
920     DestroyMenu (hm);
921 twoaday 2 return TRUE;
922     }
923 twoaday 22 #if 0 /* XXX */
924 twoaday 2 if( notify->idFrom == IDC_KEYMISC_GROUP ) {
925     HWND tree = GetDlgItem( dlg, IDC_KEYMISC_GROUP );
926     if( TreeView_GetSelection( tree ) ) {
927     GetCursorPos( &p );
928     hm = LoadMenu( glob_hinst, MAKEINTRESOURCE(IDR_WINPT_GROUP_CTX) );
929     popup = GetSubMenu( hm, 0 );
930     if( km_index == -1 )
931     set_menu_state( popup, ID_GROUP_PASTE, MF_DISABLED|MF_GRAYED );
932     set_menu_text( popup, ID_GROUP_PASTE, _("Paste into this group") );
933     set_menu_text( popup, ID_GROUP_DELETE, _("Delete") );
934     TrackPopupMenu( popup, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL );
935     DestroyMenu( popup );
936     DestroyMenu( hm );
937     return TRUE;
938     }
939     }
940 twoaday 22 #endif
941 twoaday 2 break;
942    
943     case LVN_COLUMNCLICK:
944     if (notify->idFrom == IDC_KEYMISC_KEYLIST) {
945     NMLISTVIEW * p = (LPNMLISTVIEW) lparam;
946     int sortby = 0;
947     switch (p->iSubItem) {
948 twoaday 23 case 0: sortby = KEY_SORT_USERID; break;
949     case 1: sortby = KEY_SORT_KEYID; break;
950     case 2: sortby = KEY_SORT_IS_SECRET; break;
951     case 3: sortby = KEY_SORT_LEN; break;
952     case 5: sortby = KEY_SORT_VALIDITY; break;
953     case 6: sortby = KEY_SORT_OTRUST; break;
954     case 7: sortby = KEY_SORT_CREATED; break;
955     case 8: sortby = KEY_SORT_ALGO; break;
956     default: return TRUE; //sortby = KEY_SORT_USERID; break;
957 twoaday 2 }
958    
959     if ((kmi->keylist_sortby & ~KEYLIST_SORT_DESC) == sortby)
960     kmi->keylist_sortby ^= KEYLIST_SORT_DESC;
961     else
962     kmi->keylist_sortby = sortby;
963     keylist_sort (kmi->lv, kmi->keylist_sortby);
964     return TRUE;
965     }
966     break;
967     }
968     break;
969     }
970    
971     case WM_WINDOWPOSCHANGING:
972     if (((WINDOWPOS*)lparam)->cx < 400)
973     ((WINDOWPOS*)lparam)->cx = 400;
974     if (((WINDOWPOS*)lparam)->cy < 200)
975     ((WINDOWPOS*)lparam)->cy = 200;
976     return TRUE;
977    
978     case WM_SIZE:
979     do_resize_window (dlg, kmi);
980     return TRUE;
981    
982     case WM_SYSCOMMAND:
983     if( LOWORD (wparam) == SC_CLOSE )
984     EndDialog( dlg, TRUE );
985     return FALSE;
986    
987     case WM_MENUSELECT:
988     menu_gpg_readonly (dlg, (HMENU)lparam, LOWORD (wparam));
989     break;
990    
991     case WM_COMMAND:
992     if( gnupg_access_keyring( 1 ) ) {
993     msg_box( dlg, _("Could not access public keyring"), _("Key Manager"), MB_ERR );
994     return FALSE;
995     }
996     do_check_cache( kmi->lv, dlg, kmi->statbar );
997     switch( LOWORD( wparam ) ) {
998     case ID_KEYMISC_QUIT:
999     EndDialog( dlg, TRUE );
1000     return TRUE;
1001    
1002     case ID_KEYMISC_MAIL:
1003 twoaday 24 /* XXX
1004 twoaday 2 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_MAIL, GetDesktopWindow (),
1005 twoaday 24 winpt_mail_proc, NULL);*/
1006 twoaday 2 break;
1007 twoaday 22
1008     case ID_KEYMISC_FIND:
1009     km_find_key (dlg, kmi->lv);
1010     break;
1011    
1012 twoaday 2 case ID_KEYMISC_DELETE:
1013 twoaday 24 km_delete_keys (kmi->lv, dlg);
1014 twoaday 2 return TRUE;
1015    
1016 twoaday 22 case ID_KEYMISC_SIGN:
1017 twoaday 2 if ( (idx = listview_get_curr_pos( kmi->lv )) == -1 ) {
1018     msg_box( dlg, _("Please select a key."), _("Key Manager"),
1019     MB_ERR );
1020 twoaday 24 return TRUE;;
1021 twoaday 2 }
1022 twoaday 22 if (km_check_key_status (kmi->lv, idx))
1023 twoaday 24 return TRUE;
1024 twoaday 22 key = (gpgme_key_t)listview_get_item2 (kmi->lv, idx);
1025     listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1026     memset (&k, 0, sizeof (k));
1027     k.ctx = key;
1028     k.keyid = keyid;
1029     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYSIGN, dlg,
1030     keysign_dlg_proc, (LPARAM)&k,
1031     _("Key Signing"), IDS_WINPT_KEYSIGN);
1032     if (k.update)
1033     update_key (kmi->lv, idx, k.keyid, 0);
1034 twoaday 2 return TRUE;
1035    
1036     case ID_KEYMISC_REVCERT:
1037     idx = listview_get_curr_pos( kmi->lv );
1038     if( idx == -1 ) {
1039     msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1040 twoaday 24 return TRUE;
1041 twoaday 2 }
1042     listview_get_item_text( kmi->lv, idx, 0, uid, sizeof uid -1 );
1043     listview_get_item_text( kmi->lv, idx, 1, keyid, sizeof keyid-1 );
1044     if ( !km_check_for_seckey( kmi->lv, idx, NULL ) ) {
1045     msg_box( dlg, _("There is no secret key available!"), _("Key Manager"), MB_ERR );
1046 twoaday 24 return TRUE;
1047 twoaday 2 }
1048    
1049     {
1050     char t[128];
1051     listview_get_item_text( kmi->lv, idx, 5, t, sizeof t -1 );
1052     if( strchr( t, 'R' ) ) {
1053     msg_box( dlg, _("Key already revoked!"), _("Key Manager"), MB_INFO );
1054 twoaday 24 return TRUE;
1055 twoaday 2 }
1056     }
1057    
1058 twoaday 19 memset (&k, 0, sizeof (k));
1059 twoaday 2 k.key_pair = 1;
1060     k.keyid = keyid;
1061 twoaday 25 k.is_protected = km_check_if_protected (kmi->lv, idx);
1062     dialog_box_param(glob_hinst, (LPCSTR)IDD_WINPT_KEYREVOKE, dlg,
1063 twoaday 2 key_revoke_dlg_proc, (LPARAM)&k,
1064 twoaday 25 _("Key Revocation"), IDS_WINPT_KEYREVOKE);
1065 twoaday 2 return TRUE;
1066    
1067     case ID_KEYMISC_TRUSTPATH:
1068     idx = listview_get_curr_pos( kmi->lv );
1069     if( idx == -1 ) {
1070     msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1071 twoaday 24 return TRUE;
1072 twoaday 2 }
1073     listview_get_item_text( kmi->lv, idx, 0, uid, sizeof uid -1 );
1074     listview_get_item_text( kmi->lv, idx, 1, keyid, sizeof keyid -1 );
1075     if( km_check_for_seckey( kmi->lv, idx, NULL ) ) {
1076     msg_box( dlg, _("It does not make any sense with a key pair!"), _("Key Manager"), MB_OK );
1077     return FALSE;
1078     }
1079 twoaday 19 memset (&k, 0, sizeof (k));
1080 twoaday 2 k.keyid = keyid;
1081     k.uid = uid;
1082     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYTRUST, dlg,
1083     keytrust_dlg_proc, (LPARAM)&k,
1084     _("List Trust Path"), IDS_WINPT_KEYTRUST );
1085     return TRUE;
1086    
1087     case ID_KEYMISC_CHECKSIGS:
1088 twoaday 22 idx = listview_get_curr_pos (kmi->lv);
1089 twoaday 2 if( idx == -1 ) {
1090     msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1091     return FALSE;
1092     }
1093 twoaday 19 listview_get_item_text (kmi->lv, idx, 0, uid, DIM (uid)-1);
1094     listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1095     memset (&k, 0, sizeof (k));
1096 twoaday 2 k.keyid = keyid;
1097     k.uid = uid;
1098 twoaday 22 k.ctx = (gpgme_key_t)listview_get_item2 (kmi->lv, idx);
1099 twoaday 19 dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYSIG, dlg,
1100 twoaday 2 keysig_dlg_proc, (LPARAM)&k,
1101 twoaday 19 _("Key Signature List" ), IDS_WINPT_KEYSIG);
1102 twoaday 2 return TRUE;
1103    
1104     case ID_KEYMISC_PROPS:
1105     idx = listview_get_curr_pos( kmi->lv );
1106     if( idx == -1 ) {
1107     msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1108     return FALSE;
1109     }
1110 twoaday 22 listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1111     listview_get_item_text (kmi->lv, idx, 2, type, DIM (type)-1);
1112 twoaday 19 memset (&k, 0, sizeof (k));
1113 twoaday 2 k.key_pair = 0;
1114     k.keyid = keyid;
1115     if( !strcmp( type, "pub/sec" ) || !strcmp( type, "pub/crd" ) )
1116     k.key_pair = 1;
1117     k.callback.ctl = kmi->lv;
1118     k.callback.idx = idx;
1119 twoaday 23 k.is_v3 = km_key_is_v3 (kmi->lv, idx);
1120 twoaday 2 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYPROPS, dlg,
1121     keyprops_dlg_proc, (LPARAM)&k,
1122     _("Key Properties"), IDS_WINPT_KEYPROPS );
1123 twoaday 22 if (k.callback.new_val != 0) {
1124 twoaday 2 t = get_key_trust_str (k.callback.new_val);
1125     listview_add_sub_item (kmi->lv, idx, 6, t);
1126     }
1127     return TRUE;
1128    
1129     case ID_KEYMISC_RECACHE:
1130     /* If there is already a reload request, don't bother the user with a message. */
1131     if( keycache_get_reload() == 1 )
1132     idx = IDYES;
1133     else {
1134     char t[256];
1135     _snprintf( t, sizeof t -1,
1136     _("This is only useful when the keyring has been "
1137     "modified (sign a key...).\n"
1138     "Do you really want to reload the keycache?") );
1139     idx = msg_box( dlg, t, _("Key Manager"), MB_YESNO );
1140     }
1141     if( idx == IDYES ) {
1142     rcs.kr_reload = rcs.kr_update = 1;
1143     rcs.tr_update = 0;
1144     DialogBoxParam( glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg,
1145     keycache_dlg_proc, (LPARAM)&rcs );
1146     c = keycache_get_ctx( 1 );
1147     if( !c )
1148     BUG( dlg );
1149 twoaday 23 keylist_reload( kmi->lv, c, KEYLIST_LIST, KEY_SORT_USERID );
1150 twoaday 2 refresh_keys = 0;
1151     }
1152     return TRUE;
1153    
1154     case ID_KEYMISC_REBUILD:
1155 twoaday 24 name=NULL;
1156     gpg_rebuild_cache (&name);
1157     if (name) {
1158     char *p = strchr (name, '\n');
1159     show_msg (dlg, 2000, p? name + (p-name)+1 : name);
1160     free (name);
1161     }
1162 twoaday 2 return TRUE;
1163    
1164     case ID_KEYMISC_NEWKEY:
1165 twoaday 20 memset (&genkey, 0, sizeof (genkey));
1166     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYGEN, dlg,
1167     keygen_dlg_proc, (LPARAM)&genkey, _("Key Generation"),
1168     IDS_WINPT_KEYGEN);
1169 twoaday 22 if (genkey.newkey != NULL)
1170 twoaday 20 keylist_add_key (kmi->lv, KEYLIST_LIST, genkey.newkey);
1171 twoaday 2 return TRUE;
1172    
1173     case ID_KEYMISC_CARDNEW:
1174     if( !scard_support ) {
1175     msg_box( dlg, _("Smart Card support is not available."), _("Key Manager"), MB_INFO );
1176 twoaday 24 return TRUE;
1177 twoaday 2 }
1178     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CARD_KEYGEN, dlg,
1179     card_keygen_dlg_proc, NULL, _("Card Key Generation"),
1180     IDS_WINPT_CARD_KEYGEN );
1181 twoaday 22 /* XXX: use new code */
1182 twoaday 2 if( keycache_get_reload() )
1183     send_cmd_id( dlg, ID_KEYMISC_RECACHE );
1184     return TRUE;
1185    
1186     case ID_KEYMISC_KEYWIZARD:
1187 twoaday 20 memset (&genkey, 0, sizeof (genkey));
1188     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYWIZARD, dlg,
1189     keygen_wizard_dlg_proc, (LPARAM)&genkey, _("Key Generation Wizard"),
1190     IDS_WINPT_KEYWIZARD);
1191 twoaday 22 if (genkey.newkey != NULL)
1192 twoaday 20 keylist_add_key (kmi->lv, KEYLIST_LIST, genkey.newkey);
1193 twoaday 2 return TRUE;
1194    
1195     case ID_KEYMISC_SENDRECV:
1196     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYSERVER, dlg,
1197     keyserver_dlg_proc, NULL, _("Keyserver Access"),
1198     IDS_WINPT_KEYSERVER );
1199     return TRUE;
1200    
1201     case ID_KEYMISC_GPGPREFS:
1202     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, dlg,
1203     gpgprefs_dlg_proc, NULL, _("GnuPG Preferences"),
1204     IDS_WINPT_GPGPREFS );
1205     return TRUE;
1206    
1207     case ID_KEYMISC_GPGOPT:
1208     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_GPGOPT, dlg,
1209     gpgopt_dlg_proc, NULL, _("GnuPG Options" ),
1210     IDS_WINPT_GPGOPT );
1211     return TRUE;
1212    
1213     case ID_KEYMISC_IMPORT:
1214 twoaday 22 t = get_filename_dlg (dlg, FILE_OPEN, _("Choose Name of the Key File"), NULL, NULL);
1215     if (t)
1216     km_file_import (dlg, t);
1217 twoaday 2 return TRUE;
1218    
1219     case ID_KEYMISC_IMPORT_HTTP:
1220 twoaday 19 url = (struct URL_ctx_s*)get_http_file_dlg (dlg);
1221     if (url->cancel == 0)
1222     km_http_import (dlg, url->url);
1223     delete url; url=NULL;
1224 twoaday 2 break;
1225    
1226     case ID_KEYMISC_EXPORT:
1227 twoaday 22 idx = listview_get_curr_pos (kmi->lv);
1228     if (idx == -1) {
1229 twoaday 2 msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1230 twoaday 24 return TRUE;
1231 twoaday 2 }
1232 twoaday 22 if (listview_count_items (kmi->lv, 1) > 1)
1233     name = m_strdup ("Exported_GPG_Keys.asc");
1234 twoaday 2 else {
1235 twoaday 22 listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1236 twoaday 24 name = gen_export_filename (keyid, 0);
1237 twoaday 2 }
1238 twoaday 22 t = get_filename_dlg (dlg, FILE_SAVE, _("Choose Name for Key File"), NULL, name);
1239     free_if_alloc (name);
1240 twoaday 24 if (t == NULL)
1241     return TRUE;
1242 twoaday 22 km_file_export (dlg, kmi->lv, t);
1243 twoaday 2 return TRUE;
1244    
1245     case ID_KEYMISC_EXPORT_PRIVKEY:
1246     idx = listview_get_curr_pos( kmi->lv );
1247     if( idx == -1 ) {
1248     msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
1249 twoaday 24 return TRUE;
1250 twoaday 2 }
1251     if( !km_check_for_seckey( kmi->lv, idx, NULL ) ) {
1252     msg_box( dlg, _("There is no corresponding secret key for this key."),
1253     _("Key Manager"), MB_ERR );
1254 twoaday 24 return TRUE;
1255 twoaday 2 }
1256     if( listview_count_items( kmi->lv, 1 ) > 1 ) {
1257     msg_box( dlg, _("You can only export one secret key."), _("Key Manager"), MB_ERR );
1258 twoaday 24 return TRUE;
1259 twoaday 2 }
1260     idx = msg_box( dlg,
1261     _("This operation will export your *SECRET* key!\n\n"
1262     "Never send this key to ANYONE, it should be available\n"
1263     "ONLY on your machine and you may use this function\n"
1264     "to copy the key to a safe place.\n\n"
1265     "Do you really want to export the key?"),
1266     _("WARNING"), MB_INFO|MB_YESNO );
1267     if( idx == IDYES ) {
1268     idx = listview_get_curr_pos( kmi->lv );
1269     listview_get_item_text( kmi->lv, idx, 1, keyid, sizeof (keyid)-8 );
1270 twoaday 24 name = gen_export_filename (keyid, 1);
1271 twoaday 23 t = get_filename_dlg (dlg, FILE_SAVE, _("Choose Name for Key File"), NULL, name);
1272     if (t != NULL)
1273 twoaday 22 km_privkey_export (dlg, kmi->lv, t);
1274 twoaday 2 }
1275     break;
1276    
1277     case ID_KEYMISC_INFO:
1278     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, glob_hwnd,
1279     about_winpt_dlg_proc, NULL, _("About WinPT"),
1280     IDS_WINPT_ABOUT );
1281     break;
1282    
1283     case ID_KEYMISC_HELP:
1284     ShellExecute (dlg, "open", "winpt.chm", NULL, NULL, SW_SHOW);
1285     break;
1286    
1287     case ID_KEYMISC_OT:
1288     dialog_box_param( glob_hinst, (LPCTSTR)IDD_WINPT_OWNERTRUST, glob_hwnd,
1289     ownertrust_dlg_proc, NULL,
1290     _("Ownertrust"), IDS_WINPT_OWNERTRUST );
1291     break;
1292    
1293     case ID_KEYMISC_EDITKEY:
1294     idx = listview_get_curr_pos (kmi->lv);
1295 twoaday 16 if (idx == -1)
1296 twoaday 2 break;
1297 twoaday 16 listview_get_item_text (kmi->lv, idx, 1, keyid, sizeof (keyid)-1);
1298     /* XXX: pub/crd = secret key does not work */
1299 twoaday 19 memset (&k, 0, sizeof (k));
1300 twoaday 16 k.is_protected = km_check_if_protected (kmi->lv, idx);
1301     k.key_pair = km_check_for_seckey (kmi->lv, idx, NULL);
1302 twoaday 2 k.keyid = keyid;
1303 twoaday 20 k.is_v3 = km_key_is_v3 (kmi->lv, idx);
1304 twoaday 16 k.flags = km_get_key_status (kmi->lv, idx);
1305     dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT, dlg,
1306 twoaday 2 keyedit_main_dlg_proc, (LPARAM)&k,
1307 twoaday 16 _("Key Edit"), IDS_KEYCTX_EDIT);
1308 twoaday 22 if (k.update)
1309     update_key (kmi->lv, idx, keyid, 1);
1310 twoaday 2 break;
1311    
1312     case ID_KEYMISC_COPY:
1313 twoaday 22 km_index = listview_get_curr_pos (kmi->lv);
1314     km_clip_export (dlg, kmi->lv);
1315 twoaday 2 break;
1316    
1317     case ID_KEYMISC_SELALL:
1318     listview_select_all (kmi->lv);
1319     break;
1320    
1321     case ID_KEYMISC_PASTE:
1322     km_index = -1;
1323     km_clip_import (dlg);
1324     break;
1325    
1326     case ID_KEYCTX_SETPREFKS:
1327 twoaday 19 listview_get_item_text (kmi->lv, idx, 1, keyid, DIM(keyid)-1);
1328     memset (&k, 0, sizeof (k));
1329     k.keyid = keyid;
1330     keyedit_set_pref_keyserver (&k, dlg);
1331 twoaday 2 break;
1332    
1333     case ID_KEYMISC_REFRESH_KEYS:
1334 twoaday 19 if (listview_count_items (kmi->lv, 1) == 0) {
1335 twoaday 2 msg_box (dlg, _("No key was selected, select all by default."), _("Key Manager"), MB_INFO);
1336     listview_select_all (kmi->lv);
1337     }
1338     km_refresh_from_keyserver (kmi->lv, dlg);
1339     break;
1340    
1341     /** Context menu **/
1342     case ID_KEYCTX_EDIT:
1343     send_cmd_id( dlg, ID_KEYMISC_EDITKEY );
1344     break;
1345    
1346     case ID_KEYCTX_PROPS:
1347     send_cmd_id( dlg, ID_KEYMISC_PROPS );
1348     break;
1349    
1350     case ID_KEYCTX_UIDS:
1351     send_cmd_id( dlg, ID_KEYMISC_UID );
1352     break;
1353    
1354     case ID_KEYCTX_SIGN:
1355     send_cmd_id( dlg, ID_KEYMISC_SIGN );
1356     break;
1357    
1358     case ID_KEYCTX_DEL:
1359     send_cmd_id (dlg, ID_KEYMISC_DELETE);
1360     break;
1361    
1362     case ID_KEYCTX_REV:
1363     send_cmd_id( dlg, ID_KEYMISC_REVCERT );
1364     break;
1365    
1366     case ID_KEYCTX_SENDMAIL:
1367 twoaday 22 km_send_to_mail_recipient (kmi->lv, dlg);
1368 twoaday 2 break;
1369    
1370     case ID_KEYCTX_KS_DEFAULT:
1371     host = kserver_get_hostname (0, -1, &port);
1372     km_send_to_keyserver (kmi->lv, dlg, host, port);
1373     break;
1374    
1375     case ID_KEYCTX_ADDKEY:
1376 twoaday 22 idx = listview_get_curr_pos (kmi->lv);
1377 twoaday 19 listview_get_item_text( kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1378     memset (&k, 0, sizeof (k));
1379 twoaday 22 k.key_pair = km_check_for_seckey (kmi->lv, idx, NULL);
1380     k.is_protected = km_check_if_protected (kmi->lv, idx);
1381 twoaday 2 k.keyid = keyid;
1382 twoaday 22 keyedit_add_subkey (&k, dlg, NULL);
1383     if (k.update)
1384     update_key (kmi->lv, idx, keyid, 1);
1385 twoaday 2 break;
1386    
1387     case ID_KEYCTX_ADDUID:
1388 twoaday 22 idx = listview_get_curr_pos (kmi->lv);
1389 twoaday 19 listview_get_item_text( kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1390     memset (&k, 0, sizeof (k));
1391 twoaday 22 k.key_pair = km_check_for_seckey (kmi->lv, idx, NULL);
1392     k.is_protected = km_check_if_protected (kmi->lv, idx);
1393 twoaday 2 k.keyid = keyid;
1394 twoaday 22 keyedit_add_userid (&k, dlg, NULL);
1395     if (k.update)
1396     update_key (kmi->lv, idx, keyid, 1);
1397 twoaday 2 break;
1398    
1399     case ID_KEYCTX_ADDREV:
1400 twoaday 19 idx = listview_get_curr_pos (kmi->lv);
1401     listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1402     memset (&k, 0, sizeof (k));
1403 twoaday 2 k.keyid = keyid;
1404 twoaday 22 k.is_protected = km_check_if_protected (kmi->lv, idx);
1405 twoaday 2 k.key_pair = km_check_for_seckey( kmi->lv, idx, NULL );
1406 twoaday 22 keyedit_add_revoker (&k, dlg);
1407     if (k.update)
1408     update_key (kmi->lv, idx, keyid, 1);
1409 twoaday 2 break;
1410    
1411     case ID_KEYCTX_ADDPHOTO:
1412 twoaday 19 idx = listview_get_curr_pos (kmi->lv);
1413     listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1414     memset (&k, 0, sizeof (k));
1415 twoaday 2 k.keyid = keyid;
1416 twoaday 19 k.is_protected = km_check_if_protected (kmi->lv, idx);
1417     k.key_pair = km_check_for_seckey (kmi->lv, idx, NULL);
1418     keyedit_add_photo (&k, dlg);
1419 twoaday 22 if (k.update)
1420     update_key (kmi->lv, idx, keyid, 1);
1421 twoaday 2 break;
1422    
1423     case ID_KEYCTX_KS_NL:
1424     case ID_KEYCTX_KS_PL:
1425     case ID_KEYCTX_KS_AT:
1426     case ID_KEYCTX_KS_DE:
1427     case ID_KEYCTX_KS_DK:
1428     case ID_KEYCTX_KS_CZ:
1429     case ID_KEYCTX_KS_ES:
1430     case ID_KEYCTX_KS_UK:
1431     host = kserver_get_hostname (LOWORD (wparam) - 40107, 0, &port);
1432     km_send_to_keyserver (kmi->lv, dlg, host, port);
1433     break;
1434    
1435     case ID_KEYCTX_RECVFROM:
1436     km_refresh_from_keyserver (kmi->lv, dlg);
1437     break;
1438    
1439     case ID_KEYCTX_UID_COPY:
1440     /* XXX: add generic function to support multiple selection
1441     with a callback */
1442     idx = listview_get_curr_pos( kmi->lv );
1443     listview_get_item_text( kmi->lv, idx, 0, uid, sizeof uid-1 );
1444     set_clip_text( NULL, uid, strlen( uid ) );
1445     break;
1446    
1447     case ID_KEYCTX_KEYID_COPY:
1448     idx = listview_get_curr_pos( kmi->lv );
1449     listview_get_item_text( kmi->lv, idx, 1, uid, sizeof uid-1 );
1450     set_clip_text( NULL, uid, strlen( uid ) );
1451     break;
1452    
1453     case ID_KEYCTX_FPR_COPY:
1454     idx = listview_get_curr_pos( kmi->lv );
1455 twoaday 22 key = (gpgme_key_t) listview_get_item2 (kmi->lv, idx);
1456     if (key) {
1457     const char * s = get_key_fpr (key);
1458     set_clip_text (NULL, s? s : "", s? strlen (s): 0);
1459 twoaday 2 }
1460     break;
1461    
1462     case ID_KEYCTX_KINFO_COPY:
1463     idx = listview_get_curr_pos( kmi->lv );
1464     listview_get_item_text( kmi->lv, idx, 1, uid, sizeof uid-1 );
1465     km_set_clip_info( uid );
1466     break;
1467    
1468     case ID_KEYCTX_COPY:
1469     km_index = listview_get_curr_pos (kmi->lv);
1470     km_clip_export (dlg, kmi->lv);
1471     break;
1472    
1473     case ID_KEYCTX_PASTE:
1474     km_index = -1;
1475     km_clip_import (dlg);
1476     break;
1477    
1478     case ID_KEYCTX_DISABLE:
1479     idx = listview_get_curr_pos (kmi->lv);
1480     km_enable_disable_key (kmi->lv, dlg, idx, 0);
1481     break;
1482    
1483     case ID_KEYCTX_ENABLE:
1484     idx = listview_get_curr_pos (kmi->lv);
1485     km_enable_disable_key (kmi->lv, dlg, idx, 1);
1486     break;
1487    
1488     case ID_KEYCTX_LISTSIGS:
1489     send_cmd_id (dlg, ID_KEYMISC_CHECKSIGS);
1490     break;
1491    
1492     case ID_KEYCTX_MAXTRUST:
1493     idx = listview_get_curr_pos (kmi->lv);
1494 twoaday 22 listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1495     rc = km_set_implicit_trust (dlg, kmi->lv, idx);
1496     if (!rc)
1497     update_key (kmi->lv, idx, keyid, 0);
1498 twoaday 2 break;
1499    
1500     case ID_KEYCTX_SETDEFKEY:
1501     idx = listview_get_curr_pos (kmi->lv);
1502 twoaday 22 if (!km_check_key_status (kmi->lv, idx)) {
1503     listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
1504 twoaday 2 rc = set_gnupg_default_key (keyid);
1505     if (rc)
1506     msg_box( dlg, winpt_strerror (rc), _("Key Manager"), MB_ERR);
1507 twoaday 23 km_update_default_key_str (kmi->statbar);
1508 twoaday 2 }
1509     break;
1510 twoaday 22
1511     #if 0 /* XXX */
1512     case ID_GROUP_NEW:
1513     memset (&gcb, 0, sizeof (gcb));
1514     gcb.gc = gc;
1515     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GROUP, glob_hwnd,
1516     group_manager_dlg_proc, (LPARAM)&gcb, _("New Group"),
1517     IDS_WINPT_GROUP);
1518     if( gcb.use_name )
1519     treeview_add_item( GetDlgItem(dlg, IDC_KEYMISC_GROUP), NULL, gcb.name );
1520     return TRUE;
1521 twoaday 2
1522     case ID_GROUP_PASTE:
1523     km_groups_add (gc, kmi->lv, km_index);
1524     break;
1525    
1526     case ID_GROUP_DELETE:
1527     km_groups_del (gc);
1528     break;
1529 twoaday 22 #endif
1530     }
1531    
1532 twoaday 2 break;
1533     }
1534    
1535     return FALSE;
1536 twoaday 24 }
1537 twoaday 2
1538    
1539 twoaday 24

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26