30 |
|
|
31 |
|
|
32 |
static int |
static int |
33 |
|
check_number (HWND dlg, int id) |
34 |
|
{ |
35 |
|
char buf[32]; |
36 |
|
size_t i; |
37 |
|
|
38 |
|
GetDlgItemText (dlg, id, buf, 31); |
39 |
|
for (i=0; i < strlen (buf); i++) { |
40 |
|
if (!isdigit (buf[i])) |
41 |
|
return -1; |
42 |
|
} |
43 |
|
return 0; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
static int |
48 |
read_proxy (HWND dlg, keyserver_proxy_ctx * ctx) |
read_proxy (HWND dlg, keyserver_proxy_ctx * ctx) |
49 |
{ |
{ |
50 |
char t[512]; |
char t[512]; |
61 |
if (!strncmp (t, "http://", 7)) |
if (!strncmp (t, "http://", 7)) |
62 |
pos = 7; |
pos = 7; |
63 |
ctx->host = strdup (t + pos); |
ctx->host = strdup (t + pos); |
64 |
|
} |
65 |
|
if (check_number (dlg, IDC_PROXY_PORT)) { |
66 |
|
msg_box (dlg, _("Invalid port number."), _("Proxy Settings"), MB_ERR); |
67 |
|
return -1; |
68 |
} |
} |
69 |
|
|
70 |
ctx->port = GetDlgItemInt( dlg, IDC_PROXY_PORT, NULL, FALSE ); |
ctx->port = GetDlgItemInt( dlg, IDC_PROXY_PORT, NULL, FALSE ); |
71 |
if( ctx->port < 0 || ctx->port > 65535 ) { |
if( ctx->port < 0 || ctx->port > 65535 ) { |
72 |
msg_box( dlg, _("Please select a value from 0-65535 for the port"), _("Proxy Settings"), MB_INFO ); |
msg_box( dlg, _("Please select a value from 0-65535 for the port"), _("Proxy Settings"), MB_INFO ); |