/[mldonkey]/mldonkey/src/daemon/driver/driverCommands.ml
ViewVC logotype

Diff of /mldonkey/src/daemon/driver/driverCommands.ml

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

revision 1.64 by spiralvoice, Tue Jul 12 23:08:57 2005 UTC revision 1.65 by spiralvoice, Thu Jul 14 14:00:19 2005 UTC
# Line 329  let _ = Line 329  let _ =
329                  let c = client_find num in                  let c = client_find num in
330                  let i = client_info c in                  let i = client_info c in
331                  if use_html_mods o then Printf.bprintf buf "\\<tr class=\\\"%s\\\"                  if use_html_mods o then Printf.bprintf buf "\\<tr class=\\\"%s\\\"
332                           title=\\\"Add as friend\\\"                    title=\\\"Add as friend\\\"
333                           onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"                    onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"
334              onMouseOver=\\\"mOvr(this);\\\"                    onMouseOver=\\\"mOvr(this);\\\"
335              onMouseOut=\\\"mOut(this);\\\"\\>"                    onMouseOut=\\\"mOut(this);\\\"\\>"
336                      (if (!counter mod 2 == 0) then "dl-1" else "dl-2") num;                      (if (!counter mod 2 == 0) then "dl-1" else "dl-2") num;
337                      client_print c o;                      client_print c o;
338                      html_mods_td buf ([                      html_mods_td buf ([
# Line 692  let _ = Line 692  let _ =
692                  lprintf "Exception %s in server_print\n"                  lprintf "Exception %s in server_print\n"
693                    (Printexc2.to_string e);                    (Printexc2.to_string e);
694          ) !!servers;          ) !!servers;
695          if use_html_mods o then Printf.bprintf buf "\\</table\\>\\</div\\>";          if use_html_mods o then begin
696          Printf.bprintf buf "Servers: %d known\n" !nb_servers;              Printf.bprintf buf "\\</table\\>\\</div\\>";
697                html_mods_table_one_row buf "serversTable" "servers" [
698                  ("", "srh", Printf.sprintf "Servers: %d known" !nb_servers); ]
699              end
700            else
701              Printf.bprintf buf "Servers: %d known\n" !nb_servers;
702          if Autoconf.donkey = "yes" && not !!enable_servers then          if Autoconf.donkey = "yes" && not !!enable_servers then
703            begin            begin
704              if use_html_mods o then Printf.bprintf buf "\\<div class=servers\\>";              if use_html_mods o then begin
705              Printf.bprintf buf "You disabled server usage, therefore you are not able to connect ED2K servers.\n";                  Printf.bprintf buf "\\<div class=servers\\>";
706              Printf.bprintf buf "To use servers again 'set enable_servers true'\n";                  html_mods_table_one_row buf "upstatsTable" "upstats" [
707                      ("", "srh", ("You disabled server usage, therefore you are not" ^
708                        " able to connect ED2K servers. " ^
709                        "To use servers again 'set enable_servers true'")); ]
710                  end
711                else
712                  Buffer.add_string buf ("You disabled server usage, therefore you are not" ^
713                    " able to connect ED2K servers.\n" ^
714                    "To use servers again 'set enable_servers true'\n");
715              if use_html_mods o then Printf.bprintf buf "\\</div\\>"              if use_html_mods o then Printf.bprintf buf "\\</div\\>"
716            end;            end;
717      ""), ":\t\t\t\t\tlist all known servers";      ""), ":\t\t\t\t\tlist all known servers";
# Line 731  let _ = Line 744  let _ =
744      ), "<num> :\t\t\tprint banner of connected server <num>";      ), "<num> :\t\t\tprint banner of connected server <num>";
745    
746      "c", Arg_multiple (fun args o ->      "c", Arg_multiple (fun args o ->
747            let buf = o.conn_buf in
748          match args with          match args with
749            [] ->            [] ->
750              networks_iter network_connect_servers;              networks_iter network_connect_servers;
751              _s "connecting more servers"              if o.conn_output = HTML then
752                  html_mods_table_one_row buf "serversTable" "servers" [
753                    ("", "srh", "Connecting more servers"); ]
754                else
755                  Printf.bprintf buf "connecting more servers";
756                _s
757            ""
758          | _ ->          | _ ->
759              List.iter (fun num ->              List.iter (fun num ->
760                  let num = int_of_string num in                  let num = int_of_string num in
761                  let s = server_find num in                  let s = server_find num in
762                  server_connect s                  server_connect s
763              ) args;              ) args;
764              _s "connecting server"              if o.conn_output = HTML then
765      ),                html_mods_table_one_row buf "serversTable" "servers" [
766      "[<num>] :\t\t\t\tconnect to more servers (or to server <num>)";                  ("", "srh", "Connecting more servers"); ]
767                else
768                  Printf.bprintf buf "connecting server";
769                _s
770            ""
771        ), "[<num>] :\t\t\t\tconnect to more servers (or to server <num>)";
772    
773      "x", Arg_one (fun num o ->      "x", Arg_one (fun num o ->
774          let num = int_of_string num in          let num = int_of_string num in
# Line 1139  let _ = Line 1164  let _ =
1164          | [] ->          | [] ->
1165              begin              begin
1166                match user.ui_user_searches with                match user.ui_user_searches with
1167                  [] -> "No search to print"                  [] ->
1168                      if o.conn_output = HTML then
1169                        html_mods_table_one_row buf "searchTable" "search" [
1170                          ("", "srh", "No search to print"); ]
1171                      else
1172                        Printf.bprintf buf "No search to print";
1173                ""
1174                | s :: _ ->                | s :: _ ->
1175                    DriverInteractive.print_search buf s o;                    DriverInteractive.print_search buf s o;
1176                    ""                    ""
# Line 1179  let _ = Line 1210  let _ =
1210      "vs", Arg_none (fun o ->      "vs", Arg_none (fun o ->
1211          let buf = o.conn_buf in          let buf = o.conn_buf in
1212          let user = o.conn_user in          let user = o.conn_user in
1213          Printf.bprintf  buf "Searching %d queries\n" (          let num_searches = List.length user.ui_user_searches in
1214            List.length user.ui_user_searches);          if num_searches < 1 then
1215          List.iter (fun s ->            if o.conn_output = HTML then
1216              Printf.bprintf buf "%s[%-5d]%s %s %s (found %d)\n"              html_mods_table_one_row buf "searchTable" "search" [
1217                (if o.conn_output = HTML then                ("", "srh", "No search yet"); ]
1218                  Printf.sprintf "\\<a href=\\\"submit\\?q=forget\\+%d\\\" target=fstatus\\>[Forget]\\</a\\> \\<a href=\\\"submit\\?q=vr\\+%d\\\"\\>" s.search_num s.search_num            else
1219                else "")              Printf.bprintf buf "No search yet"
1220              s.search_num          else begin
1221                s.search_string              if o.conn_output = HTML then
1222                (if o.conn_output = HTML then "\\</a\\>" else "")                Printf.bprintf  buf "Searching %d queries\n" (
1223              (if s.search_waiting = 0 then _s "done" else                  List.length user.ui_user_searches);
1224                  string_of_int s.search_waiting)              List.iter (fun s ->
1225              s.search_nresults                  Printf.bprintf buf "%s[%-5d]%s %s %s (found %d)\n"
1226          ) (Sort.list (fun f1 f2 -> f1.search_num < f2.search_num)                    (if o.conn_output = HTML then
1227            user.ui_user_searches); ""), ":\t\t\t\t\tview all queries";                      Printf.sprintf "\\<a href=\\\"submit\\?q=forget\\+%d\\\" target=fstatus\\>[Forget]\\</a\\> \\<a href=\\\"submit\\?q=vr\\+%d\\\"\\>" s.search_num s.search_num
1228                      else "")
1229                    s.search_num
1230                      s.search_string
1231                      (if o.conn_output = HTML then "\\</a\\>" else "")
1232                    (if s.search_waiting = 0 then _s "done" else
1233                        string_of_int s.search_waiting)
1234                    s.search_nresults
1235                ) (Sort.list (fun f1 f2 -> f1.search_num < f2.search_num)
1236                user.ui_user_searches)
1237              end;
1238            ""
1239        ), ":\t\t\t\t\tview all queries";
1240    
1241      "view_custom_queries", Arg_none (fun o ->      "view_custom_queries", Arg_none (fun o ->
1242          let buf = o.conn_buf in          let buf = o.conn_buf in
1243          if o.conn_output <> HTML then          if o.conn_output <> HTML then
1244            Printf.bprintf buf "%d custom queries defined\n"            Printf.bprintf buf "%d custom queries defined\n"
1245              (List.length (customized_queries ()));              (List.length (customized_queries ()));
1246          List.iter (fun (name, q) ->          let custom_commands = ref [] in
1247            List.iter (fun (name, q) ->
1248              if o.conn_output = HTML then              if o.conn_output = HTML then
1249                begin                begin
   
1250                  if use_html_mods o then                  if use_html_mods o then
1251                    Printf.bprintf buf                    custom_commands := !custom_commands @ [ ( "bu bbig",
1252                      "\\<a href=\\\"submit\\?custom=%s\\\" target=\\\"$O\\\"\\>%s\\</a\\> "                    Printf.sprintf "%s" name,
1253                      (Url.encode name) name                    Printf.sprintf "top.output.location.href='submit\\?custom=%s'" (Url.encode name),
1254                      Printf.sprintf "%s" name ) ; ]
1255                  else                  else
1256                    Printf.bprintf buf                    Printf.bprintf buf
1257                      "\\<a href=\\\"submit\\?custom=%s\\\" $O\\> %s \\</a\\>\n"                      "\\<a href=\\\"submit\\?custom=%s\\\" $O\\> %s \\</a\\>\n"
# Line 1220  let _ = Line 1263  let _ =
1263          ) (customized_queries ());          ) (customized_queries ());
1264    
1265          if use_html_mods o then          if use_html_mods o then
1266            Printf.bprintf buf "\\<a            html_mods_commands buf "commandsTable" "commands" (!custom_commands @ [
1267              href=\\\"http://www.fileheaven.org/\\\" name=\\\"FileHeaven\\\" target=\\\"$O\\\"\\>FileHeaven\\</a\\> \\<a              ("bu bbig", "Visit FileHeaven",
1268              href=\\\"http://www.filedonkey.com\\\" name=\\\"FileDonkey\\\" target=\\\"$O\\\"\\>FileDonkey\\</a\\> \\<a               "top.output.location.href='http://www.fileheaven.org/'", "FileHeaven");
1269              href=\\\"http://bitzi.com/search/\\\" name=\\\"Bitzi\\\" target=\\\"$O\\\"\\>Bitzi\\</a\\> ";              ("bu bbig", "Visit FileDonkey",
1270                 "top.output.location.href='http://www.filedonkey.com/'", "FileDonkey");
1271                ("bu bbig", "Visit Bitzi",
1272                 "top.output.location.href='http://www.fileheaven.org/'", "Bitzi");
1273              ]);
1274          ""          ""
1275      ), ":\t\t\tview custom queries";      ), ":\t\t\tview custom queries";
1276    
1277      "d", Arg_multiple (fun args o ->      "d", Arg_multiple (fun args o ->
1278          List.iter (fun arg ->          List.iter (fun arg ->
1279              CommonInteractive.download_file o arg) args;              CommonInteractive.download_file o arg) args;
1280          ""),          ""
1281      "<num> :\t\t\t\t$bfile to download$n";      ), "<num> :\t\t\t\t$bfile to download$n";
1282    
1283      "force_download", Arg_none (fun o ->      "force_download", Arg_none (fun o ->
1284          let buf = o.conn_buf in          let buf = o.conn_buf in
1285          match !CommonGlobals.aborted_download with          match !CommonGlobals.aborted_download with
1286            None -> "No download to force"            None ->
1287                if o.conn_output = HTML then
1288                  html_mods_table_one_row buf "downloadTable" "downloads" [
1289                    ("", "srh", "No download to force"); ]
1290                else
1291                  Printf.bprintf buf "No download to force";
1292            ""
1293          | Some r ->          | Some r ->
1294              let r = CommonResult.find_result r in              let r = CommonResult.find_result r in
1295              let files = CommonResult.result_download              let files = CommonResult.result_download r [] true in
                 r [] true  
             in  
1296              List.iter CommonInteractive.start_download files;              List.iter CommonInteractive.start_download files;
1297              "download forced"              if o.conn_output = HTML then
1298                  html_mods_table_one_row buf "downloadTable" "downloads" [
1299                    ("", "srh", "Download forced"); ]
1300                else
1301                  Printf.bprintf buf "Download forced";
1302            ""
1303      ), ":\t\t\t\tforce download of an already downloaded file";      ), ":\t\t\t\tforce download of an already downloaded file";
1304    
1305      ]      ]
# Line 1479  style=\\\"padding: 0px; font-size: 10px; Line 1534  style=\\\"padding: 0px; font-size: 10px;
1534                          strings_of_option html_checkbox_search_file_list;                          strings_of_option html_checkbox_search_file_list;
1535                          strings_of_option commands_frame_height;                          strings_of_option commands_frame_height;
1536                          strings_of_option html_vd_barheight;                          strings_of_option html_vd_barheight;
1537                            strings_of_option html_vd_chunk_graph;
1538                            strings_of_option html_vd_chunk_graph_style;
1539                            strings_of_option html_vd_chunk_graph_max_width;
1540                          strings_of_option display_downloaded_results;                          strings_of_option display_downloaded_results;
1541                          strings_of_option vd_reload_delay;                          strings_of_option vd_reload_delay;
1542                          strings_of_option html_use_gzip;                          strings_of_option html_use_gzip;
# Line 1897  let _ = Line 1955  let _ =
1955              _s "directory removed"              _s "directory removed"
1956            end else            end else
1957            _s "directory already unshared"            _s "directory already unshared"
1958        
1959      ), "<dir> :\t\t\t\tshare directory <dir>";      ), "<dir> :\t\t\t\tshare directory <dir>";
1960    
1961      "upstats", Arg_none (fun o ->      "upstats", Arg_none (fun o ->
1962          let buf = o.conn_buf in          let buf = o.conn_buf in
           
         if use_html_mods o then Printf.bprintf buf "\\<div class=\\\"upstats\\\"\\>"  
         else Printf.bprintf buf "Upload statistics:\n";  
         Printf.bprintf buf "Session: %s uploaded | Shared(%d): %s\n"  
           (size_of_int64 !upload_counter) !nshared_files (size_of_int64 !nshared_bytes);  
1963    
1964            if use_html_mods o then begin
1965                Printf.bprintf buf "\\<div class=\\\"upstats\\\"\\>";
1966                html_mods_table_one_row buf "upstatsTable" "upstats" [
1967                  ("", "srh", Printf.sprintf "Session: %s uploaded | Shared(%d): %s\n"
1968                    (size_of_int64 !upload_counter) !nshared_files (size_of_int64 !nshared_bytes)); ]
1969              end
1970            else begin
1971                Printf.bprintf buf "Upload statistics:\n";
1972                Printf.bprintf buf "Session: %s uploaded | Shared(%d): %s\n"
1973                  (size_of_int64 !upload_counter) !nshared_files (size_of_int64 !nshared_bytes)
1974              end;
1975          let list = ref [] in          let list = ref [] in
1976          shared_iter (fun s ->          shared_iter (fun s ->
1977              let impl = as_shared_impl s in              let impl = as_shared_impl s in
1978              list := impl :: !list              list := impl :: !list
1979          );          );
1980    
1981          if use_html_mods o then          if use_html_mods o then
1982            html_mods_table_header buf "upstatsTable" "upstats" [            html_mods_table_header buf "upstatsTable" "upstats" [
1983              ( "1", "srh", "Total file requests", "Reqs" ) ;              ( "1", "srh", "Total file requests", "Reqs" ) ;
1984              ( "1", "srh", "Total bytes sent", "Total" ) ;              ( "1", "srh", "Total bytes sent", "Total" ) ;
# Line 1945  let _ = Line 2009  let _ =
2009                    (Int64.to_string impl.impl_shared_size)                    (Int64.to_string impl.impl_shared_size)
2010                    (Md4.to_string impl.impl_shared_id) in                    (Md4.to_string impl.impl_shared_id) in
2011    
2012                  Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"                  Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"
2013                    (if (!counter mod 2 == 0) then "dl-1" else "dl-2";);                    (if (!counter mod 2 == 0) then "dl-1" else "dl-2";);
2014                    
2015                  let uploaded = Int64.to_float impl.impl_shared_uploaded in                  let uploaded = Int64.to_float impl.impl_shared_uploaded in
2016                  let size = Int64.to_float impl.impl_shared_size in                  let size = Int64.to_float impl.impl_shared_size in
2017                    
2018                  html_mods_td buf [                  html_mods_td buf [
2019                    ("", "sr ar", Printf.sprintf "%d" impl.impl_shared_requests);                    ("", "sr ar", Printf.sprintf "%d" impl.impl_shared_requests);
2020                    ("", "sr ar", size_of_int64 impl.impl_shared_uploaded);                    ("", "sr ar", size_of_int64 impl.impl_shared_uploaded);
2021                    ("", "sr ar", Printf.sprintf "%5.1f" ( if size < 1.0 then 0.0 else (uploaded *. 100.) /. size));                    ("", "sr ar", Printf.sprintf "%5.1f" ( if size < 1.0 then 0.0 else (uploaded *. 100.) /. size));
2022                    ("", "sr", Printf.sprintf "\\<a href=\\\"%s\\\"\\>%s\\</a\\>"                    ("", "sr", (if impl.impl_shared_id = Md4.null then
2023                        ed2k (Filename.basename impl.impl_shared_codedname));                      (Filename.basename impl.impl_shared_codedname)
2024                    ("", "sr", (if impl.impl_shared_id = Md4.null then "" else                    else
2025                      Printf.sprintf "\\<a href=\\\"http://stats.razorback2.com/ed2khistory?ed2k=%s\\\"\\>%s\\</a\\>                      Printf.sprintf "\\<a href=\\\"%s\\\"\\>%s\\</a\\>"
2026                                      \\<a href=\\\"http://bitzi.com/lookup/urn:ed2k:%s\\\"\\>%s\\</a\\>"                        ed2k (Filename.basename impl.impl_shared_codedname)));
2027                        (Md4.to_string impl.impl_shared_id) "R" (Md4.to_string impl.impl_shared_id) "B")) ];                    ("", "sr", (if impl.impl_shared_id = Md4.null then "" else
2028                  Printf.bprintf buf "\\</tr\\>\n";                      Printf.sprintf "\\<a href=\\\"http://stats.razorback2.com/ed2khistory?ed2k=%s\\\"\\>%s\\</a\\>
2029                                        \\<a href=\\\"http://bitzi.com/lookup/urn:ed2k:%s\\\"\\>%s\\</a\\>"
2030                          (Md4.to_string impl.impl_shared_id) "R" (Md4.to_string impl.impl_shared_id) "B")) ];
2031                    Printf.bprintf buf "\\</tr\\>\n";
2032                end                end
2033              else              else
2034                Printf.bprintf buf "%9d | %8s | %7s%% | %-50s\n"                Printf.bprintf buf "%9d | %8s | %7s%% | %-50s\n"
# Line 2001  let _ = Line 2068  let _ =
2068          ) list;          ) list;
2069          "Done"          "Done"
2070      ), ":\t\t\t\t\tlist links of shared files";      ), ":\t\t\t\t\tlist links of shared files";
2071        
2072      "uploaders", Arg_none (fun o ->      "uploaders", Arg_none (fun o ->
2073          let buf = o.conn_buf in          let buf = o.conn_buf in
2074    
2075          let nuploaders = Intmap.length !uploaders in          let nuploaders = Intmap.length !uploaders in
2076    
2077          if use_html_mods o then          if use_html_mods o then
2078    
2079            begin            begin
2080    
2081              let counter = ref 0 in              let counter = ref 0 in
2082                Printf.bprintf buf "\\<div class=\\\"uploaders\\\"\\>";
2083              Printf.bprintf buf "\\<div class=\\\"uploaders\\\"\\>Total upload slots: %d (%d) | Pending slots: %d\n" nuploaders              html_mods_table_one_row buf "uploadersTable" "uploaders" [
2084                  ("", "srh", Printf.sprintf "Total upload slots: %d (%d) | Pending slots: %d\n" nuploaders
2085                    (Fifo.length CommonUploads.upload_clients)
2086                    (Intmap.length !CommonUploads.pending_slots_map)); ];
2087    (*             Printf.bprintf buf "\\<div class=\\\"uploaders\\\"\\>Total upload slots: %d (%d) | Pending slots: %d\n" nuploaders
2088                (Fifo.length CommonUploads.upload_clients)                (Fifo.length CommonUploads.upload_clients)
2089              (Intmap.length !CommonUploads.pending_slots_map);              (Intmap.length !CommonUploads.pending_slots_map);
2090     *)
2091              if nuploaders > 0 then              if nuploaders > 0 then
2092    
2093                begin                begin
2094    
2095                  html_mods_table_header buf "uploadersTable" "uploaders" ([                  html_mods_table_header buf "uploadersTable" "uploaders" ([
2096                    ( "1", "srh ac", "Client number", "Num" ) ;                    ( "1", "srh ac", "Client number", "Num" ) ;
2097                    ( "0", "srh", "Network", "Network" ) ;                    ( "0", "srh", "Network", "Network" ) ;
2098                    ( "0", "srh", "Connection type [I]ndirect [D]irect", "C" ) ;                    ( "0", "srh", "Connection type [I]ndirect [D]irect", "C" ) ;
2099                    ( "0", "srh", "Client name", "Client name" ) ;                    ( "0", "srh", "Client name", "Client name" ) ;
2100                    ( "0", "srh", "IP address", "IP address" ) ;                    ( "0", "srh", "IP address", "IP address" ) ;
# Line 2344  let _ = Line 2415  let _ =
2415          List.iter (fun file ->          List.iter (fun file ->
2416              file_commit file              file_commit file
2417          ) !!done_files;          ) !!done_files;
2418          "Commited"          let buf = o.conn_buf in
2419            if o.conn_output = HTML then
2420              html_mods_table_one_row buf "serversTable" "servers" [
2421                ("", "srh", "Commited"); ]
2422            else
2423              Printf.bprintf buf "Commited";
2424            ""
2425      ) , ":\t\t\t\t\t$bmove downloaded files to incoming directory$n";      ) , ":\t\t\t\t\t$bmove downloaded files to incoming directory$n";
2426    
2427      "vd", Arg_multiple (fun args o ->      "vd", Arg_multiple (fun args o ->
# Line 2394  let _ = Line 2471  let _ =
2471                                  \\</tr\\>\\</table\\>                                  \\</tr\\>\\</table\\>
2472                                  \\</td\\>\\</tr\\>                                  \\</td\\>\\</tr\\>
2473                                  \\<tr\\>\\<td\\>" num num                                  \\<tr\\>\\<td\\>" num num
2474                  else begin                        else begin
2475                      Printf.bprintf  buf "\\<a href=\\\"files\\\"\\>Display all files\\</a\\>  ";                      Printf.bprintf  buf "\\<a href=\\\"files\\\"\\>Display all files\\</a\\>  ";
2476                      Printf.bprintf  buf "\\<a href=\\\"submit?q=verify_chunks+%d\\\"\\>Verify chunks\\</a\\>  " num;                      Printf.bprintf  buf "\\<a href=\\\"submit?q=verify_chunks+%d\\\"\\>Verify chunks\\</a\\>  " num;
2477                      Printf.bprintf  buf "\\<a href=\\\"submit?q=preview+%d\\\"\\>Preview\\</a\\> \n " num;                      Printf.bprintf  buf "\\<a href=\\\"submit?q=preview+%d\\\"\\>Preview\\</a\\> \n " num;
# Line 2785  let _ = Line 2862  let _ =
2862    
2863      "close_fds", Arg_none (fun o ->      "close_fds", Arg_none (fun o ->
2864          Unix32.close_all ();          Unix32.close_all ();
2865          "All files closed"          let buf = o.conn_buf in
2866            if o.conn_output = HTML then
2867              html_mods_table_one_row buf "serversTable" "servers" [
2868                ("", "srh", "All files closed"); ]
2869            else
2870              Printf.bprintf buf "All files closed";
2871            ""
2872      ), ":\t\t\t\tclose all files (use to free space on disk after remove)";      ), ":\t\t\t\tclose all files (use to free space on disk after remove)";
2873    
2874      "debug_socks", Arg_none (fun o ->      "debug_socks", Arg_none (fun o ->
# Line 2794  let _ = Line 2877  let _ =
2877      ), ":\t\t\t\tfor debugging only";      ), ":\t\t\t\tfor debugging only";
2878    
2879      "block_list", Arg_none (fun o ->      "block_list", Arg_none (fun o ->
2880        Ip_set.print_list o.conn_buf !Ip_set.bl;        let buf = o.conn_buf in
2881        _s "done"          if o.conn_output = HTML then
2882              let mybuf = Buffer.create 1000 in
2883              let mytable = ref [] in
2884              let split_string c str =
2885                let rec aux s acc =
2886                  try  let ind=String.index s c in
2887                         aux (String.sub s (ind+1) ((String.length s) - ind -1 ))
2888                             ((String.sub s 0 ind)::acc)
2889                  with Not_found -> List.rev (s::acc)
2890                  in aux str []; in
2891              let split_lines = split_string '\n' in
2892              Ip_set.print_list mybuf !Ip_set.bl;
2893              let listtmp = split_lines (Buffer.contents mybuf) in
2894               (List.iter (fun s ->
2895                 mytable := !mytable @ [ ("", "srh", s); ]
2896                ) listtmp);
2897              html_mods_table_one_col buf "serversTable" "servers" !mytable
2898            else
2899              Ip_set.print_list buf !Ip_set.bl;
2900          _s ""
2901      ), ":\t\t\t\tdisplay the list of blocked IP ranges that were hit";      ), ":\t\t\t\tdisplay the list of blocked IP ranges that were hit";
2902    
2903      "block_test", Arg_one (fun arg o ->      "block_test", Arg_one (fun arg o ->
2904        let ip = Ip.of_string arg in        let ip = Ip.of_string arg in
2905        _s (match match_ip_aux !Ip_set.bl ip with        _s (match match_ip_aux !Ip_set.bl ip with
2906            None -> "Not blocked"            None -> "Not blocked"
2907          | Some br ->          | Some br ->
2908              Printf.sprintf "Blocked, %s\n" br.blocking_description)),            Printf.sprintf "Blocked, %s\n" br.blocking_description)
2909        "<ip> :\t\t\tcheck whether an IP is blocked";      ), "<ip> :\t\t\tcheck whether an IP is blocked";
2910    ]    ]

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26