/[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 218 by twoaday, Sun May 14 18:40:36 2006 UTC revision 219 by twoaday, Sat May 27 08:56:00 2006 UTC
# Line 36  Line 36 
36  #include "wptKeylist.h"  #include "wptKeylist.h"
37    
38    
39    #define MAX_N_KEYS 64
40    
41    
42    /* Symbolic column IDs. */
43  enum { KSS_COL_BITS = 0, KSS_COL_ALGO,  enum { KSS_COL_BITS = 0, KSS_COL_ALGO,
44         KSS_COL_KEYID, KSS_COL_DATE, KSS_COL_UID };         KSS_COL_KEYID, KSS_COL_DATE, KSS_COL_UID };
45    
# Line 49  on_init_dialog (HWND dlg, UINT msg, WPAR Line 53  on_init_dialog (HWND dlg, UINT msg, WPAR
53      struct listview_column_s keysearch[] = {      struct listview_column_s keysearch[] = {
54          {0,  48, (char *)_("Size")},          {0,  48, (char *)_("Size")},
55          {1,  48, (char*)_("Algorithm")},          {1,  48, (char*)_("Algorithm")},
56          {2,  64, (char *)_("Key ID")},          {2,  80, (char *)_("Key ID")},
57          {3,  72, (char *)_("Creation")},          {3,  72, (char *)_("Creation")},
58          {4, 256, (char *)_("User ID")},          {4, 256, (char *)_("User ID")},
59          {0,   0, NULL}          {0,   0, NULL}
# Line 80  search_hkp_keys (HWND dlg, keyserver_ctx Line 84  search_hkp_keys (HWND dlg, keyserver_ctx
84  {  {
85      keyserver_key_s *key;      keyserver_key_s *key;
86      const char *uid;      const char *uid;
87      char bits[32], algo[32];      char bits[32], algo[32], keyid[32];
88      int conn_fd = 0;          int conn_fd = 0;    
89      int rc, nkeys = 0;      int rc, nkeys = 0;
90    
# Line 91  search_hkp_keys (HWND dlg, keyserver_ctx Line 95  search_hkp_keys (HWND dlg, keyserver_ctx
95          return rc;          return rc;
96      }      }
97    
98        if (nkeys > MAX_N_KEYS) {
99            rc = log_box (_("Keyserver Search"), MB_INFO_ASK,
100                          _("The search result contains a lot of keys: %d\n\n"
101                            "Do you really want to continue?"), nkeys);
102            if (rc == IDNO) {
103                kserver_search_end (conn_fd);
104                return -1;
105            }
106        }
107    
108      while (nkeys-- > 0) {      while (nkeys-- > 0) {
109          if (kserver_search_next (conn_fd, &key))          if (kserver_search_next (conn_fd, &key))
110              break;              break;
111          if (!key)          if (!key)
112              continue;              continue;
113    
114          _snprintf (bits, sizeof (bits) - 1, "%d", key->bits);          _snprintf (bits, sizeof (bits) - 1, "%d", key->bits);
115          _snprintf (algo, sizeof (algo)-1, "%s",          _snprintf (algo, sizeof (algo)-1, "%s",
116                      get_key_pubalgo ((gpgme_pubkey_algo_t)key->algo));                      get_key_pubalgo ((gpgme_pubkey_algo_t)key->algo));
117            _snprintf (keyid, sizeof (keyid)-1, "0x%s", key->keyid);
118          uid = key->main_uid? key->main_uid->uid : "";          uid = key->main_uid? key->main_uid->uid : "";
119          listview_add_item (lv, " ");          listview_add_item (lv, " ");
120          listview_add_sub_item (lv, 0, KSS_COL_BITS, bits);          listview_add_sub_item (lv, 0, KSS_COL_BITS, bits);
121          listview_add_sub_item (lv, 0, KSS_COL_ALGO, algo);          listview_add_sub_item (lv, 0, KSS_COL_ALGO, algo);
122          listview_add_sub_item (lv, 0, KSS_COL_KEYID, key->keyid);          listview_add_sub_item (lv, 0, KSS_COL_KEYID, keyid);
123          listview_add_sub_item (lv, 0, KSS_COL_DATE, get_key_created (key->creation));          listview_add_sub_item (lv, 0, KSS_COL_DATE, get_key_created (key->creation));
124          listview_add_sub_item (lv, 0, KSS_COL_UID, uid);          listview_add_sub_item (lv, 0, KSS_COL_UID, uid);
125          kserver_release_key (key); key=NULL;          kserver_release_key (key); key=NULL;
# Line 148  hkpsearch_dlg_proc (HWND dlg, UINT msg, Line 164  hkpsearch_dlg_proc (HWND dlg, UINT msg,
164  {  {
165      static listview_ctrl_t lv = NULL;      static listview_ctrl_t lv = NULL;
166      static keyserver_ctx *ksc;      static keyserver_ctx *ksc;
     int rc = 0;  
167            
168      switch (msg) {      switch (msg) {
169      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 156  hkpsearch_dlg_proc (HWND dlg, UINT msg, Line 171  hkpsearch_dlg_proc (HWND dlg, UINT msg,
171          if (!ksc)          if (!ksc)
172              dlg_fatal_error (dlg, "Could not get dialog param.");              dlg_fatal_error (dlg, "Could not get dialog param.");
173          lv = on_init_dialog (dlg, msg, wparam, lparam);          lv = on_init_dialog (dlg, msg, wparam, lparam);
174          rc = search_hkp_keys (dlg, ksc, lv);          if (search_hkp_keys (dlg, ksc, lv)) {
         if (rc) {  
175              EndDialog (dlg, FALSE);              EndDialog (dlg, FALSE);
176              return FALSE;              return FALSE;
177          }          }

Legend:
Removed from v.218  
changed lines
  Added in v.219

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26