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

Diff of /trunk/Src/wptKeyserverSearchDlg.cpp

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

revision 185 by twoaday, Mon Mar 20 12:48:52 2006 UTC revision 197 by twoaday, Mon Apr 10 07:38:06 2006 UTC
# Line 105  search_hkp_keys (HWND dlg, keyserver_ctx Line 105  search_hkp_keys (HWND dlg, keyserver_ctx
105  }  }
106    
107    
108    /* Fetch all selected keys from the keyserver in @ksc. */
109    static void
110    fetch_keys (HWND dlg, listview_ctrl_t lv, keyserver_ctx *ksc)
111    {
112        char keyid[32];
113        char *fpr;
114        int n, rc = 0;
115    
116        n = listview_count_items (lv, 1);
117        if (!n) {
118            msg_box (dlg, _("Please select a key."), _("Keyserver Search"), MB_ERR);
119            return;
120        }
121    
122        for (n=0; n < listview_count_items (lv, 0); n++) {
123            if (!listview_get_item_state (lv, n))
124                continue;
125    
126            listview_get_item_text (lv, n, KSS_COL_KEYID, keyid, sizeof (keyid)-1);
127            rc = hkp_recv_key2 (dlg, ksc->name, ksc->port, keyid, 0, &fpr);
128            if (!rc && fpr != NULL) {
129                keycache_update (0, fpr);
130                free_if_alloc (fpr);
131            }
132        }
133    }
134    
135    
136  /* Dialog box procedure for keyserver searching. */  /* Dialog box procedure for keyserver searching. */
137  BOOL CALLBACK  BOOL CALLBACK
138  hkpsearch_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  hkpsearch_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
139  {  {
140      static listview_ctrl_t lv = NULL;      static listview_ctrl_t lv = NULL;
141      static keyserver_ctx *ksc;      static keyserver_ctx *ksc;
142      char *fpr = NULL, t[32];      int rc = 0;
     int pos;  
     int rc;  
143            
144      switch (msg) {      switch (msg) {
145      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 151  hkpsearch_dlg_proc (HWND dlg, UINT msg, Line 177  hkpsearch_dlg_proc (HWND dlg, UINT msg,
177              return FALSE;              return FALSE;
178                            
179          case IDC_HKPSEARCH_RECV:          case IDC_HKPSEARCH_RECV:
180              if ((pos = listview_get_curr_pos (lv)) == -1) {              fetch_keys (dlg, lv, ksc);
                 msg_box (dlg, _("Please select a key."), _("Keyserver Search"), MB_ERR);  
                 return FALSE;  
             }  
             listview_get_item_text (lv, pos, 1, t, sizeof (t) -1);  
             rc = hkp_recv_key2 (dlg, ksc->name, ksc->port, t, 0, &fpr);  
             if (!rc && fpr != NULL) {  
                 keycache_update (0, fpr);  
                 free_if_alloc (fpr);  
             }  
181              return TRUE;              return TRUE;
182          }          }
183          break;          break;

Legend:
Removed from v.185  
changed lines
  Added in v.197

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26