mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] Changes to mldonkey/src/networks/fileTP/fileTPComplex


From: mldonkey-commits
Subject: [Mldonkey-commits] Changes to mldonkey/src/networks/fileTP/fileTPComplexOptions.ml
Date: Tue, 26 Jul 2005 19:16:50 -0400

Index: mldonkey/src/networks/fileTP/fileTPComplexOptions.ml
diff -u mldonkey/src/networks/fileTP/fileTPComplexOptions.ml:1.10 
mldonkey/src/networks/fileTP/fileTPComplexOptions.ml:1.11
--- mldonkey/src/networks/fileTP/fileTPComplexOptions.ml:1.10   Sun Jul 17 
16:11:13 2005
+++ mldonkey/src/networks/fileTP/fileTPComplexOptions.ml        Tue Jul 26 
23:16:48 2005
@@ -22,7 +22,7 @@
 open Md4
 open Options
 open BasicSocket
-  
+
 open CommonDownloads
 open CommonTypes
 open CommonFile
@@ -32,13 +32,13 @@
 open FileTPGlobals
 
 module ClientOption = struct
-    
-    let value_to_client v = 
+
+    let value_to_client v =
       match v with
       | Module assocs ->
-          
+
           let get_value name conv = conv (List.assoc name assocs) in
-          let get_value_nil name conv = 
+          let get_value_nil name conv =
             try conv (List.assoc name assocs) with _ -> []
           in
           let client_hostname = get_value "client_hostname" value_to_string in
@@ -50,9 +50,9 @@
 
 (*
           (try
-              c.client_user.user_speed <- get_value "client_speed" 
value_to_int 
+              c.client_user.user_speed <- get_value "client_speed" value_to_int
             with _ -> ());
-          
+
           (try
               if get_value "client_push" value_to_bool then
                 c.client_user.user_kind <- Indirect_location ("", client_uid)
@@ -60,8 +60,7 @@
   *)
           c
       | _ -> failwith "Options: Not a client"
-    
-    
+
     let client_to_value c =
       Options.Module [
         "client_hostname", string_to_value c.client_hostname;
@@ -72,32 +71,32 @@
 "client_push", bool_to_value false;
   *)
       ]
-      
+
     let t =
       define_option_class "Client" value_to_client client_to_value
-  
+
   end
 
 let value_to_int32pair v =
   match v with
     List [v1;v2] | SmallList [v1;v2] ->
       (value_to_int64 v1, value_to_int64 v2)
-  | _ -> 
+  | _ ->
       failwith "Options: Not an int32 pair"
 
 let value_to_file file_size file_state assocs =
   let get_value name conv = conv (List.assoc name assocs) in
-  let get_value_nil name conv = 
+  let get_value_nil name conv =
     try conv (List.assoc name assocs) with _ -> []
   in
 
-  let file_name = get_value "file_filename" value_to_string in 
-  let file_id = 
+  let file_name = get_value "file_filename" value_to_string in
+  let file_id =
     try
       Md4.of_string (get_value "file_id" value_to_string)
     with _ -> failwith "Bad file_id"
   in
-  
+
   let file = new_file file_id file_name file_size in
 
   (match file.file_swarmer with
@@ -114,48 +113,47 @@
                   add_download file s (Url.of_string (value_to_string index))
               | _ -> failwith "Bad source"
           )))
-    with e -> 
+    with e ->
         lprintf "Exception %s while loading source\n"
-          (Printexc2.to_string e); 
+          (Printexc2.to_string e);
   );
   as_file file
-  
+
 let file_to_value file =
   let assocs =
     [
 (*      "file_name", string_to_value file.file_name; *)
       "file_downloaded", int64_to_value (file_downloaded file);
       "file_id", string_to_value (Md4.to_string file.file_id);
-      "file_sources", 
+      "file_sources",
       list_to_value (fun c ->
           lprintf "SAVING: find_client...\n";
           let n = (find_download file c.client_downloads).download_url in
-          lprintf "SAVING: find_client...done...saving\n"; 
-          SmallList [ClientOption.client_to_value c; 
+          lprintf "SAVING: find_client...done...saving\n";
+          SmallList [ClientOption.client_to_value c;
             string_to_value (Url.to_string n)]
       ) file.file_clients;
     ]
   in
   match file.file_swarmer with
-    None -> assocs 
+    None -> assocs
   | Some swarmer ->
       Int64Swarmer.swarmer_to_value swarmer assocs
 
-let old_files = 
+let old_files =
   define_option fileTP_section ["old_urls"]
     "" (list_option Url.option) []
-    
+
 let save_config () =
-  
+
   let files = !!old_files in
   old_files =:= [];
   List.iter (fun file ->
-      if not (List.mem file !!old_files) then 
+      if not (List.mem file !!old_files) then
         old_files =:= file :: !!old_files
   ) files;
-  
   ()
-  
+
 let _ =
   network.op_network_file_of_option <- value_to_file;
   file_ops.op_file_to_option <- file_to_value;




reply via email to

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