445 |
try |
try |
446 |
let list = network_connected_servers r in |
let list = network_connected_servers r in |
447 |
if List.mem NetworkHasServers r.network_flags || |
if List.mem NetworkHasServers r.network_flags || |
448 |
List.mem NetworkHasSupernodes r.network_flags |
List.mem NetworkHasSupernodes r.network_flags |
449 |
then begin |
then begin |
450 |
if use_html_mods o then Printf.bprintf buf "\\<div class=servers\\>"; |
if use_html_mods o then begin |
451 |
Printf.bprintf buf "--- Connected to %d servers on the %s network ---\n" |
Printf.bprintf buf "\\<div class=servers\\>"; |
452 |
(List.length list) r.network_name; |
html_mods_table_one_row buf "serversTable" "servers" [ |
453 |
if use_html_mods o then Printf.bprintf buf "\\</div\\>"; |
("", "srh", Printf.sprintf "--- Connected to %d servers on the %s network ---\n" |
454 |
end; |
(List.length list) r.network_name); ] |
455 |
if use_html_mods o && List.length list > 0 then server_print_html_header buf "C"; |
end |
456 |
|
else |
457 |
|
Printf.bprintf buf "--- Connected to %d servers on the %s network ---\n" |
458 |
|
(List.length list) r.network_name; |
459 |
|
if use_html_mods o then Printf.bprintf buf "\\</div\\>"; |
460 |
|
end; |
461 |
|
if use_html_mods o && List.length list > 0 then server_print_html_header buf "C"; |
462 |
|
|
463 |
html_mods_cntr_init (); |
html_mods_cntr_init (); |
464 |
List.iter (fun s -> |
List.iter (fun s -> |
465 |
server_print s o; |
server_print s o; |
466 |
) (List.sort (fun s1 s2 -> compare (server_num s1) (server_num s2)) list); |
) (List.sort (fun s1 s2 -> compare (server_num s1) (server_num s2)) list); |
467 |
if use_html_mods o && List.length list > 0 then |
if use_html_mods o && List.length list > 0 then |
468 |
Printf.bprintf buf "\\</table\\>\\</div\\>"; |
Printf.bprintf buf "\\</table\\>\\</div\\>"; |
469 |
if Autoconf.donkey = "yes" && r.network_name = "Donkey" && not !!enable_servers then |
if Autoconf.donkey = "yes" && r.network_name = "Donkey" && not !!enable_servers then |
470 |
begin |
begin |
471 |
if use_html_mods o then Printf.bprintf buf "\\<div class=servers\\>"; |
if use_html_mods o then Printf.bprintf buf "\\<div class=servers\\>"; |
472 |
Printf.bprintf buf "You disabled server usage, therefore you are not able to connect ED2K servers.\n"; |
Printf.bprintf buf "You disabled server usage, therefore you are not able to connect ED2K servers.\n"; |
473 |
Printf.bprintf buf "To use servers again 'set enable_servers true'\n"; |
Printf.bprintf buf "To use servers again 'set enable_servers true'\n"; |
474 |
if use_html_mods o then Printf.bprintf buf "\\</div\\>" |
if use_html_mods o then Printf.bprintf buf "\\</div\\>" |
475 |
end; |
end; |
476 |
with e -> |
with e -> |
477 |
Printf.bprintf buf "Exception %s in print_connected_servers" |
Printf.bprintf buf "Exception %s in print_connected_servers" |
478 |
(Printexc2.to_string e); |
(Printexc2.to_string e); |
479 |
) |
) |
480 |
|
|
481 |
let send_custom_query user buf query args = |
let send_custom_query user buf query args = |
482 |
try |
try |
483 |
let q = List.assoc query (CommonComplexOptions.customized_queries()) in |
let q = List.assoc query (CommonComplexOptions.customized_queries()) in |
484 |
let args = ref args in |
let args = ref args in |
485 |
let get_arg arg_name = |
let get_arg arg_name = |
486 |
(* lprintf "Getting %s\n" arg_name; *) |
(* lprintf "Getting %s\n" arg_name; *) |
487 |
match !args with |
match !args with |
488 |
(label, value) :: tail -> |
(label, value) :: tail -> |