mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Mon, 09 Jul 2007 23:45:44 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/07/09 23:45:44

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonOptions.ml 
        src/networks/direct_connect: dcGlobals.ml dcInteractive.ml 

Log message:
        patch #6065

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1300&r2=1.1301
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.210&r2=1.211
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/direct_connect/dcGlobals.ml?cvsroot=mldonkey&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/direct_connect/dcInteractive.ml?cvsroot=mldonkey&r1=1.32&r2=1.33

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1300
retrieving revision 1.1301
diff -u -b -r1.1300 -r1.1301
--- distrib/ChangeLog   9 Jul 2007 23:44:33 -0000       1.1300
+++ distrib/ChangeLog   9 Jul 2007 23:45:44 -0000       1.1301
@@ -15,6 +15,7 @@
 =========
 
 2007/07/10
+6065: DirectConnect: Support dc++ hublist in web_infos
 6063: BT: Better detect single-file torrents
 
 2007/07/03

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -b -r1.210 -r1.211
--- src/daemon/common/commonOptions.ml  1 Jul 2007 13:00:11 -0000       1.210
+++ src/daemon/common/commonOptions.ml  9 Jul 2007 23:45:44 -0000       1.211
@@ -1019,9 +1019,11 @@
   EXAMPLE:
     web_infos = [
     (\"server.met\", 0, \"http://www.gruk.org/server.met.gz\";);
+    (\"hublist\", 0, \"http://dchublist.com/hublist.config.bz2\";);
     (\"guarding.p2p\", 96, \"http://www.bluetack.co.uk/config/level1.gz\";);
     (\"ocl\", 24, 
\"http://members.lycos.co.uk/appbyhp2/FlockHelpApp/contact-files/contact.ocl\";);
     (\"contact.dat\", 168, \"http://download.overnet.org/contact.dat\";);
+    (\"geoip.dat\", 168, 
\"http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz\";);
     ]
   "
     (list_option (tuple3_option (string_option, int_option, string_option)))
@@ -1036,6 +1038,8 @@
         "http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz";);
       ("nodes.gzip", 0,
         "http://update.kceasy.com/update/fasttrack/nodes.gzip";);
+      ("hublist", 0,
+        "http://dchublist.com/hublist.config.bz2";);
 (*
     ("slsk_boot", 0,
       "http://www.slsknet.org/slskinfo2";);
@@ -1602,7 +1606,7 @@
 let options_version = define_expert_option current_section ["options_version"]
   ~internal: true
   "(internal option)"
-    int_option 17
+    int_option 18
 
 let max_comments_per_file = define_expert_option current_section 
["max_comments_per_file"]
   "Maximum number of comments per file"
@@ -2173,4 +2177,8 @@
       if !!download_sample_size = 10 then download_sample_size =:= 100;
       update 17
 
+  | 17 ->
+      web_infos_add "hublist" 0 "http://dchublist.com/hublist.config.bz2";;
+      update 18
+
   | _ -> ()

Index: src/networks/direct_connect/dcGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/direct_connect/dcGlobals.ml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/networks/direct_connect/dcGlobals.ml    1 Jun 2007 19:31:09 -0000       
1.13
+++ src/networks/direct_connect/dcGlobals.ml    9 Jul 2007 23:45:44 -0000       
1.14
@@ -110,8 +110,7 @@
 (*let current_open_slots = ref 0*)
 (*let clients_by_name = Hashtbl.create 113*)
 let clients_list = ref ([] : client list)
-(*let dc_hublist = ref ([] : dc_hub list)*) (* list for DC servers *)
-let dc_hublistfile = ref ""
+let dc_hublist = ref ([] : dc_hub list) (* list for DC servers *)
 let temp_nick = ref "unknown"
 let temp_nick_num = ref 0 (* this is used to name temporary users always with 
different name *)
 let used_slots = ref 0

Index: src/networks/direct_connect/dcInteractive.ml
===================================================================
RCS file: 
/sources/mldonkey/mldonkey/src/networks/direct_connect/dcInteractive.ml,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- src/networks/direct_connect/dcInteractive.ml        24 Jun 2007 18:38:28 
-0000      1.32
+++ src/networks/direct_connect/dcInteractive.ml        9 Jul 2007 23:45:44 
-0000       1.33
@@ -617,13 +617,9 @@
         \\<td\\>\\<input style=\\\"font-family: verdana; font-size: 12px;\\\" 
type=submit
         Value=\\\"DC Info\\\"\\>\\</td\\>\\</form\\>";
       Printf.bprintf buf "\\<form style=\\\"margin: 0px;\\\" 
id=\\\"hublistshow\\\" name=\\\"hublistshow\\\"
-        action=\\\"javascript:parent.output.location.href='submit?q=dchublist 
show'\\\"\\>
+        
action=\\\"javascript:parent.output.location.href='submit?q=dchublist'\\\"\\>
         \\<td\\>\\<input style=\\\"font-family: verdana; font-size: 12px;\\\" 
type=submit
         Value=\\\"Show hublist\\\"\\>\\</td\\>\\</form\\>";
-      Printf.bprintf buf "\\<form style=\\\"margin: 0px;\\\" 
id=\\\"hublistload\\\" name=\\\"hublistload\\\"
-        action=\\\"javascript:parent.output.location.href='submit?q=dchublist 
load'\\\"\\>
-        \\<td\\>\\<input style=\\\"font-family: verdana; font-size: 12px;\\\" 
type=submit
-        Value=\\\"Load hublist\\\"\\>\\</td\\>\\</form\\>";
       Printf.bprintf buf "\\<form style=\\\"margin: 0px;\\\" 
id=\\\"filelists\\\" name=\\\"filelists\\\"
         
action=\\\"javascript:parent.output.location.href='submit?q=dcfilelists'\\\"\\>
         \\<td\\>\\<input style=\\\"font-family: verdana; font-size: 12px;\\\" 
type=submit
@@ -692,44 +688,20 @@
   (* 'dchubs [args]' - Show dchub list with optional filters args (max 5) *)
   "dchublist", Arg_multiple (fun args o ->
     let buf = o.conn_buf in
-    let failtxt = "dchublist show [filtertext] | load - bad arguments" in
-    (match args with
-    | cmd :: rest_args ->
-        (match cmd with 
-        | "load" ->
-          let url =
-            if (!!servers_list_url = empty_string) then failwith "No valid 
url" 
-            else
-              { url = !!servers_list_url;
-                kind = "";
-                period = 0;
-                state = None;
-              }
-          in
-          CommonWeb.mldonkey_wget url (fun _ -> () );
-          Printf.bprintf buf "Trying to load %s\n" url.url;
-        | "show" ->
-            let filename = Filename.concat "web_infos" (Filename.basename 
!!servers_list_url) in
-            if !verbose_msg_servers then lprintf_nl "Loading hublist with 
filename (%s) " filename;   
-            let hublist =
-              (try
-                (match Filename2.last_extension filename with
-                | ".bz2" -> DcServers.make_hublist_from_file 
(Misc2.bz2_extract filename)
-                | _ -> DcServers.make_hublist_from_file filename )
-              with e -> 
-                if !verbose_msg_servers then lprintf_nl "(%s) in 
loading/parsing serverlist" (Printexc2.to_string e);
-                raise Not_found ) 
-            in
-            if use_html_mods o then begin
+    let filter = ref [] in
+    let print_hublist () =
+      if use_html_mods o then
+        begin
               html_mods_table_one_row buf "serversTable" "servers" [
-                (empty_string, "srh", Printf.sprintf "Showing hublist %s" 
!!servers_list_url); ];
-              Printf.bprintf buf "\\</table\\>\\</div\\>";
-            end else Printf.bprintf buf "Showing hublist %s" 
!!servers_list_url;
-
+            (empty_string, "srh", Printf.sprintf "Showing hublist"); ];
+          Printf.bprintf buf "\\</table\\>\\</div\\>"
+        end
+      else
+        Printf.bprintf buf "Showing hublist";
             html_mods_cntr_init ();
             let nb_hubs = ref 0 in 
             if use_html_mods o then dc_hublist_print_html_header buf 
empty_string;
-            let show_all = if (rest_args = []) then true else false in
+      let show_all = if (!filter = []) then true else false in
             List.iter (fun h ->
               let hub_has_string searched = 
                 if String2.contains (Ip.string_of_addr h.dc_ip) searched ||
@@ -743,34 +715,43 @@
                   incr nb_hubs;
                 with e -> 
                     if !verbose_msg_servers then 
-                      lprintf_nl "Exception %s in hub_print\n" 
(Printexc2.to_string e) )
+               lprintf_nl "Exception %s in hub_print\n" (Printexc2.to_string 
e))
               in
-              if show_all then print_hub ()
-              else begin 
+        if show_all then
+          print_hub ()
+        else
+          begin
                 let print = ref false in
                 let finished = ref false in
                 let counter = ref 0 in
-                let filters_length = List.length rest_args in
+            let filters_length = List.length !filter in
                 while (!print = false) && (!finished = false) do
-                  if (!counter = filters_length) || (!counter > 5) then 
finished := true 
-                  else if (hub_has_string (List.nth rest_args !counter)) then 
print := true;
+              if (!counter = filters_length) || (!counter > 5) then
+                finished := true
+              else
+                if (hub_has_string (List.nth !filter !counter)) then print := 
true;
                   incr counter
                 done;    
-                if (!print = true) then print_hub ();
-              end;
-            ) hublist;
-            let txt =
-              if show_all then "(showing all hubs from hublist)" else 
"(filtered)"
-            in
-            if use_html_mods o then begin
+            if (!print = true) then print_hub ()
+          end
+      ) !dc_hublist;
+      let txt = if show_all then "(showing all hubs from hublist)" else 
"(filtered)" in
+      if use_html_mods o then
+        begin
               Printf.bprintf buf "\\</table\\>\\</div\\>";
               html_mods_table_one_row buf "serversTable" "servers" [
                 (empty_string, "srh", Printf.sprintf "Hubs: %d known %s" 
!nb_hubs txt); ]
-            end else Printf.bprintf buf "Hubs: %d known %s" !nb_hubs txt;
-        | _ -> failwith failtxt )
-    | _ -> failwith failtxt );
+        end
+      else
+        Printf.bprintf buf "Hubs: %d known %s" !nb_hubs txt
+    in
+    (match args with
+    | [] -> ()
+    | rest_args -> filter := rest_args
+    );
+    print_hublist ();
     empty_string
-  ), "<show [filtertext] | load>\rFor example: dchublist show fin - filters 
hubs with text fin\rdchublist load - loads hublist from address in options";
+  ), "[filtertext]: dchublist fin - filters hubs with text fin";
 
   (* 'dcuserip name' query user-ip from hub  *)
   "dcuserip", Arg_multiple (fun args o ->
@@ -1570,10 +1551,33 @@
     file_ops.op_file_resume <- (fun _ -> ());
     file_ops.op_file_set_format <- (fun _ _ -> ());
     file_ops.op_file_check <- (fun _ -> ());
-    file_ops.op_file_recover <- (fun _ -> ());
+    file_ops.op_file_recover <- (fun _ -> ())
     (*file_ops.op_file_print_html <- (fun _ _ -> lprintf_nl "Received 
(op_file_print_html)"; ());*)
     (*file_ops.op_file_print_sources_html <- (fun _ _ -> lprintf_nl "Received 
(op_file_print_sources_html)"; ())*)
 (*    mutable op_file_files : ('a -> 'a file_impl -> file list);
     mutable op_file_debug : ('a -> string);
     mutable op_file_proposed_filenames : ('a -> string list);
 *)
+
+let _ =
+  CommonWeb.add_web_kind "hublist" "DirectConnect hublist"
+    (fun url filename ->
+      if !!enable_directconnect then
+        begin
+          try
+            dc_hublist := (
+              match Filename2.last_extension filename with
+              | ".bz2" -> DcServers.make_hublist_from_file (Misc2.bz2_extract 
filename)
+              | _ -> DcServers.make_hublist_from_file filename);
+            lprintf_nl "loaded dc++ hublist, %d entries" (List.length 
!dc_hublist)
+          with e -> 
+            if !verbose_msg_servers then
+              lprintf_nl "(%s) in loading/parsing serverlist" 
(Printexc2.to_string e);
+            raise Not_found
+        end
+      else
+        begin
+          lprintf_nl "DirectConnect module is disabled, ignoring...";
+          raise Not_found
+        end
+    )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]