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, 15 Jan 2007 18:26:28 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/01/15 18:26:27

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonInteractive.ml commonOptions.ml 
                           guiDecoding.ml 
        src/daemon/driver: driverCommands.ml driverInterface.ml 
        src/networks/bittorrent: bTOptions.ml bTTracker.ml 
        src/networks/direct_connect: dcOptions.ml 
        src/networks/donkey: donkeyOptions.ml 
        src/networks/fileTP: fileTPOptions.ml 
        src/networks/gnutella: gnutellaOptions.ml 
        src/networks/openFT: openFTOptions.ml 
        src/networks/opennap: opennapOptions.ml 
        src/networks/soulseek: slskOptions.ml 
        src/utils/lib  : options.ml4 options.mli 

Log message:
        patch #5677

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1148&r2=1.1149
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonInteractive.ml?cvsroot=mldonkey&r1=1.87&r2=1.88
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.193&r2=1.194
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/guiDecoding.ml?cvsroot=mldonkey&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.210&r2=1.211
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInterface.ml?cvsroot=mldonkey&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTOptions.ml?cvsroot=mldonkey&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTTracker.ml?cvsroot=mldonkey&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/direct_connect/dcOptions.ml?cvsroot=mldonkey&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyOptions.ml?cvsroot=mldonkey&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/fileTP/fileTPOptions.ml?cvsroot=mldonkey&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/gnutella/gnutellaOptions.ml?cvsroot=mldonkey&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/openFT/openFTOptions.ml?cvsroot=mldonkey&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/opennap/opennapOptions.ml?cvsroot=mldonkey&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/soulseek/slskOptions.ml?cvsroot=mldonkey&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.ml4?cvsroot=mldonkey&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.mli?cvsroot=mldonkey&r1=1.10&r2=1.11

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1148
retrieving revision 1.1149
diff -u -b -r1.1148 -r1.1149
--- distrib/ChangeLog   11 Jan 2007 12:24:18 -0000      1.1148
+++ distrib/ChangeLog   15 Jan 2007 18:26:26 -0000      1.1149
@@ -14,6 +14,9 @@
 ChangeLog
 =========
 
+2007/01/15
+5677: Options: New concept of option types, fix non-admin Sancho http preview
+
 2007/01/11
 5665: EDK: Support compressed upload, implement file read cache (TripleM)
 new options:

Index: src/daemon/common/commonInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -b -r1.87 -r1.88
--- src/daemon/common/commonInteractive.ml      3 Dec 2006 20:49:42 -0000       
1.87
+++ src/daemon/common/commonInteractive.ml      15 Jan 2007 18:26:27 -0000      
1.88
@@ -752,12 +752,11 @@
 
 let opfile_args r opfile =
   let prefix = r.network_shortname ^ "-" in
-  let args = simple_options prefix opfile in
-  args
+  simple_options prefix opfile true
 
 let all_simple_options () =
   let options = ref (sort_options
-      (simple_options "" downloads_ini)
+      (simple_options "" downloads_ini true)
     )
   in
   networks_iter_all (fun r ->
@@ -807,7 +806,7 @@
 let apply_on_fully_qualified_options name f =
   if !verbose then lprintf_nl "Change option %s" name;
   let rec iter prefix opfile =
-    let args = simple_options prefix opfile in
+    let args = simple_options prefix opfile true in
     List.iter (fun o ->
 (*        lprintf "Compare [%s] [%s]\n" o.option_name name; *)
         if o.option_name = name then

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -b -r1.193 -r1.194
--- src/daemon/common/commonOptions.ml  8 Dec 2006 12:26:24 -0000       1.193
+++ src/daemon/common/commonOptions.ml  15 Jan 2007 18:26:27 -0000      1.194
@@ -273,14 +273,15 @@
     end
   end
 
-let define_option a b ?desc c d e =
+let define_option a b ?desc ?restart ?public ?internal c d e =
   match desc with
-    None -> define_option a b (_s c) d e
-  | Some desc -> define_option a b ~desc: (_s desc) (_s c) d e
-let define_expert_option a b ?desc c d e =
+    None -> define_option a b (_s c) d e ?restart ?public ?internal
+  | Some desc -> define_option a b ~desc: (_s desc) (_s c) d e ?restart 
?public ?internal
+
+let define_expert_option a b ?desc ?restart ?public ?internal c d e =
   match desc with
-    None -> define_expert_option a b (_s c) d e
-  | Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e
+    None -> define_expert_option a b (_s c) d e ?restart ?public ?internal
+  | Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e ?restart 
?public ?internal
 
 let string_list_option = define_option_class "String"
     (fun v ->
@@ -478,34 +479,42 @@
 
 let gui_port = define_option current_section ["gui_port"]
   ~desc: "The port to connect the GUI"
+  ~restart: true
   "port for Graphical Interfaces"
     int_option 4001
 
 let gift_port = define_option current_section ["gift_port"]
   ~desc: "The port to connect for GiFT GUIs."
+  ~restart: true
   "port for GiFT Graphical Interfaces interaction. It was 1213, but the 
default is
   now 0 for disabled, because it does not check for a password." 
     int_option 0
 
 let http_port = define_option current_section ["http_port"]
   ~desc: "The port to connect via HTTP"
+  ~public: true
+  ~restart: true
   "The port used to connect to your client with a WEB browser"
     int_option 4080
 
 let telnet_port = define_option current_section ["telnet_port"]
   ~desc: "The port to connect via telnet"
+  ~restart: true
   "port for user interaction"
     int_option 4000
 
 let http_bind_addr = define_expert_option current_section ["http_bind_addr"]
+  ~restart: true
   "The IP address used to bind the http server"
     Ip.option (Ip.any)
 
 let gui_bind_addr = define_expert_option current_section ["gui_bind_addr"]
+  ~restart: true
   "The IP address used to bind the gui server"
     Ip.option (Ip.of_inet_addr Unix.inet_addr_any)
 
 let telnet_bind_addr = define_expert_option current_section 
["telnet_bind_addr"]
+  ~restart: true
   "The IP address used to bind the telnet server"
     Ip.option (Ip.of_inet_addr Unix.inet_addr_any)
 
@@ -807,6 +816,7 @@
     int_option 200
 
 let html_mods_vd_gfx_h_intervall = define_expert_option current_section 
["html_mods_vd_gfx_h_intervall"]
+  ~restart: true
   "compute values for hourly graph every 1,2,3,4,5,10,15,20,30,60 min
        Changes to this option require a core restart."
      int_option 60
@@ -1225,12 +1235,14 @@
 let current_section = startup_section
 
 let run_as_user = define_option current_section ["run_as_user"]
+  ~restart: true
   "The login of the user you want mldonkey to run as, after the ports
   have been bound (can be use not to run with root priviledges when
   a port < 1024 is needed)"
     string_option ""
 
 let run_as_useruid = define_option current_section ["run_as_useruid"]
+  ~restart: true
   "The UID of the user (0=disabled) you want mldonkey to run as, after the 
ports
   have been bound (can be use not to run with root priviledges when
   a port < 1024 is needed)"
@@ -1249,6 +1261,7 @@
     bool_option true
 
 let config_files_security_space = define_expert_option current_section 
["config_files_security_space"]
+  ~restart: true
   "How many megabytes should MLdonkey keep for saving configuration files."
     int_option 10
 
@@ -1268,6 +1281,7 @@
     string_option "temp"
 
 let share_scan_interval = define_option current_section ["share_scan_interval"]
+  ~restart: true
   "How often (in minutes) should MLDonkey scan all shared directories for 
new/removed files"
     int_option 1
 
@@ -1382,6 +1396,7 @@
     bool_option false
 
 let buffer_writes_delay = define_expert_option current_section 
["buffer_writes_delay"]
+  ~restart: true
   "Buffer writes and flush after buffer_writes_delay seconds (experimental)"
     float_option 30.
 
@@ -1492,6 +1507,7 @@
     int_option 120
 
 let client_bind_addr = define_option current_section ["client_bind_addr"]
+  ~restart: true
   "The IP address used to bind the p2p clients"
     Ip.option (Ip.of_inet_addr Unix.inet_addr_any)
 
@@ -1542,6 +1558,7 @@
     int_option 500000
 
 let save_options_delay = define_expert_option current_section 
["save_options_delay"]
+  ~restart: true
   "The delay between two saves of the 'downloads.ini' file (default is 15 
minutes).
   Changes to this option require a core restart."
     float_option 900.0
@@ -1551,6 +1568,7 @@
     float_option 30.
 
 let download_sample_rate = define_expert_option current_section 
["download_sample_rate"]
+  ~restart: true
   "The delay between one glance at a file and another"
     float_option 1.
 
@@ -1584,6 +1602,7 @@
     int_option 1000
 
 let options_version = define_expert_option current_section ["options_version"]
+  ~internal: true
   "(internal option)"
     int_option 14
 

Index: src/daemon/common/guiDecoding.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- src/daemon/common/guiDecoding.ml    8 Jan 2007 11:06:42 -0000       1.68
+++ src/daemon/common/guiDecoding.ml    15 Jan 2007 18:26:27 -0000      1.69
@@ -1351,6 +1351,9 @@
     M.option_help = "";
     M.option_type = "";
     M.option_advanced = false;
+    M.option_restart = false;
+    M.option_public = false;
+    M.option_internal = false;
   }
 
 let to_gui (proto : int array)  opcode s =
@@ -1569,6 +1572,9 @@
               M.option_value = value;
               M.option_default = default;
               M.option_advanced = advanced;
+              M.option_restart = false;
+              M.option_public = false;
+              M.option_internal = false;
             }
           else
           let optype = 
@@ -1630,6 +1636,9 @@
               M.option_value = value;
               M.option_default = default;
               M.option_advanced = advanced;
+              M.option_restart = false;
+              M.option_public = false;
+              M.option_internal = false;
             }
           else
           let optype = 

Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -b -r1.210 -r1.211
--- src/daemon/driver/driverCommands.ml 8 Jan 2007 11:06:42 -0000       1.210
+++ src/daemon/driver/driverCommands.ml 15 Jan 2007 18:26:27 -0000      1.211
@@ -100,20 +100,21 @@
     html_mods_table_header buf "upstatsTable" "upstats" [
       ( "0", "srh", "Option name", "Name (Help=mouseOver)" ) ;
       ( "0", "srh", "Option value", "Value (press ENTER to save)" ) ;
-      ( "0", "srh", "Option default", "Default" ) ]
+      ( "0", "srh", "Option default", "Default" );
+      ( "0", "srh", "Option type", "Type" );
+    ]
   else
     html_mods_table_header buf "voTable" "vo" [
       ( "0", "srh", "Option name", "Name" ) ;
       ( "0", "srh", "Option value", "Value (press ENTER to save)" ) ;
       ( "0", "srh", "Option default", "Default" ) ;
+      ( "0", "srh", "Option type", "Type" );
       ( "0", "srh", "Option description", "Help" ) ];
 
-  let counter = ref 0 in
+  html_mods_cntr_init ();
 
   List.iter (fun o ->
-      incr counter;
-      if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr 
class=\\\"dl-1\\\""
-      else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\"";
+      Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"" (html_mods_cntr ());
     
         if !!html_mods_use_js_helptext then
           Printf.bprintf buf " 
onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s\\\\\')',%d);setTimeout('hideLayer()',%d);return
 true;\\\" 
onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
@@ -121,27 +122,20 @@
         else
           Printf.bprintf buf "\\>";
 
-      if String.contains o.option_value '\n' then begin
+      if String.contains o.option_value '\n' then
         Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>
-                  \\<a 
href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>
-                  \\<form action=\\\"submit\\\" target=\\\"$S\\\" 
onsubmit=\\\"javascript: 
{setTimeout('window.location.replace(window.location.href)',500);}\\\"\\>
-                  \\<input type=hidden name=setoption value=q\\>\\<input 
type=hidden name=option value=%s\\>\\</td\\>
-                  \\<td\\>\\<textarea name=value rows=5 cols=20 
wrap=virtual\\>%s\\</textarea\\>
-                  \\<input type=submit value=Modify\\>\\</td\\>\\</form\\>
-                  \\<td class=\\\"sr\\\"\\>%s\\</td\\>"
-                  (String2.upp_initial o.option_name) o.option_name 
o.option_name o.option_value o.option_default;
-                  
-          if not !!html_mods_use_js_helptext then
-            Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" 
(Str.global_replace (Str.regexp "\n") "\\<br\\>" o.option_help);
-            
-        Printf.bprintf buf "\\</tr\\>"
-        end
-      
-      else begin
+\\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>
+\\<form action=\\\"submit\\\" target=\\\"$S\\\" onsubmit=\\\"javascript: 
{setTimeout('window.location.replace(window.location.href)',500);}\\\"\\>
+\\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option 
value=%s\\>\\</td\\>
+\\<td\\>\\<textarea name=value rows=5 cols=20 wrap=virtual\\>%s\\</textarea\\>
+\\<input type=submit value=Modify\\>"
+                  (String2.upp_initial o.option_name) o.option_name 
o.option_name o.option_value
+      else
+        begin
         Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>
-                  \\<a 
href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>\\</td\\>
-                  \\<td class=\\\"sr\\\"\\>\\<form action=\\\"submit\\\" 
target=\\\"$S\\\" onsubmit=\\\"javascript: 
{setTimeout('window.location.replace(window.location.href)',500);}\\\"\\>
-                  \\<input type=hidden name=setoption value=q\\>\\<input 
type=hidden name=option value=%s\\>"
+\\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>\\</td\\>
+\\<td class=\\\"sr\\\"\\>\\<form action=\\\"submit\\\" target=\\\"$S\\\" 
onsubmit=\\\"javascript: 
{setTimeout('window.location.replace(window.location.href)',500);}\\\"\\>
+\\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option 
value=%s\\>"
                   (String2.upp_initial o.option_name) o.option_name 
o.option_name;
 
           if o.option_value = "true" || o.option_value = "false" then
@@ -153,14 +147,15 @@
             Printf.bprintf buf "\\<input style=\\\"font-family: verdana; 
font-size: 10px;\\\"
                                 type=text name=value size=20 
value=\\\"%s\\\"\\>"
                                 o.option_value;
-
+        end;
           Printf.bprintf buf "\\</td\\>\\</form\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>" (shorten o.option_default 40);
-          
+        Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>"
+          ((if o.option_restart then Printf.sprintf "restart " else "") ^
+           (if o.option_internal then Printf.sprintf "internal " else "") ^
+           (if o.option_public then Printf.sprintf "public " else ""));
           if not !!html_mods_use_js_helptext then
             Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" 
(Str.global_replace (Str.regexp "\n") "\\<br\\>" o.option_help);
-          
           Printf.bprintf buf "\\</tr\\>"
-        end;
 
   )list;
   Printf.bprintf  buf "\\</table\\>\\</div\\>"
@@ -1662,8 +1657,7 @@
             list_options_html o (
               match args with
                 [] | _ :: _ :: _ ->
-                  let v=   CommonInteractive.all_simple_options () in
-                  v
+                  CommonInteractive.all_simple_options ()
 
               | [arg] ->
                   try
@@ -1920,9 +1914,8 @@
           ("", "srh", "!! press ENTER to send changes to core !!"); ];
           end
                      
-        else begin
-            list_options o (CommonInteractive.parse_simple_options args)
-          end;
+        else
+            list_options o (CommonInteractive.parse_simple_options args);
         ""
     ), ":\t\t\t\t\tprint all options";
 

Index: src/daemon/driver/driverInterface.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- src/daemon/driver/driverInterface.ml        26 Nov 2006 13:54:09 -0000      
1.61
+++ src/daemon/driver/driverInterface.ml        15 Jan 2007 18:26:27 -0000      
1.62
@@ -470,15 +470,13 @@
           gui.gui_events.gui_new_events <- ev :: gui.gui_events.gui_new_events
       ) console_messages;                
       
-      if user2_is_admin gui.gui_conn.conn_user.ui_user then
       gui_send gui (
-        P.Options_info (simple_options "" downloads_ini));
+        P.Options_info (simple_options "" downloads_ini (user2_is_admin 
gui.gui_conn.conn_user.ui_user)));
 
-      if user2_is_admin gui.gui_conn.conn_user.ui_user then
       networks_iter_all (fun r ->
           List.iter (fun opfile ->
               let prefix = r.network_shortname ^ "-" in
-              let args = simple_options prefix opfile in
+              let args = simple_options prefix opfile (user2_is_admin 
gui.gui_conn.conn_user.ui_user) in
               gui_send gui (P.Options_info args)) r.network_config_file);
 
 (* Options panels defined in downloads.ini *)

Index: src/networks/bittorrent/bTOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTOptions.ml,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- src/networks/bittorrent/bTOptions.ml        21 Aug 2006 18:30:15 -0000      
1.30
+++ src/networks/bittorrent/bTOptions.ml        15 Jan 2007 18:26:27 -0000      
1.31
@@ -26,6 +26,7 @@
 let bittorrent_section = file_section bittorrent_ini ["Bittorrent"] 
"Bittorrent options"
 
 let client_port = define_option bittorrent_section ["client_port"]
+  ~restart: true
   "The port to bind the client to"
     int_option 6882
 
@@ -99,6 +100,7 @@
     int_option (-1)
 
 let import_new_torrents_interval = define_option bittorrent_section 
["import_new_torrents_interval"]
+  ~restart: true
   "Interval in seconds 'torrents/incoming' is scanned for new torrent files to 
be downloaded,
   0 to deactivate, changes require restart"
     float_option 60.
@@ -130,6 +132,7 @@
     string_option "default"
 
 let options_version = define_option bittorrent_section ["options_version"]
+  ~internal: true
   "(internal option)"
     int_option 0
 

Index: src/networks/bittorrent/bTTracker.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTracker.ml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- src/networks/bittorrent/bTTracker.ml        27 Jul 2006 21:45:05 -0000      
1.25
+++ src/networks/bittorrent/bTTracker.ml        15 Jan 2007 18:26:27 -0000      
1.26
@@ -96,6 +96,7 @@
 let ntracked_files = ref 0
 
 let tracker_port = define_option bittorrent_section ["tracker_port"]
+  ~restart: true
   "The port to bind the tracker to"
     int_option 6881
 

Index: src/networks/direct_connect/dcOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/direct_connect/dcOptions.ml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- src/networks/direct_connect/dcOptions.ml    5 Nov 2005 16:23:40 -0000       
1.7
+++ src/networks/direct_connect/dcOptions.ml    15 Jan 2007 18:26:27 -0000      
1.8
@@ -57,6 +57,7 @@
 
   
 let dc_port = define_option directconnect_section ["client_port"]
+  ~restart: true
   "The port to bind the client to"
     int_option 4444
   
@@ -88,6 +89,7 @@
     string_option "Pk=mldc"
 
 let options_version = define_option directconnect_section ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
 

Index: src/networks/donkey/donkeyOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOptions.ml,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- src/networks/donkey/donkeyOptions.ml        11 Jan 2007 12:24:18 -0000      
1.60
+++ src/networks/donkey/donkeyOptions.ml        15 Jan 2007 18:26:27 -0000      
1.61
@@ -30,6 +30,7 @@
     int_option 30
 
 let donkey_port = define_option donkey_section ["port"]
+  ~restart: true
   "The port used for connection by other donkey clients."
     int_option (2000 + Random.int 20000)
 
@@ -221,6 +222,7 @@
   )
 
 let upload_compression_table_size = define_expert_option donkey_section 
["upload_compression_table_size"]
+  ~restart: true
   "Size of the cache table in entries (ca. 2 * 180 kbytes). zones have to be
   compressed at once, but only parts of it are sent at a time (10 kbytes).
   to reduce diskaccess and repeated compression to a minimum, size should be
@@ -251,6 +253,7 @@
     int_option 2
 
 let remove_old_servers_delay = define_expert_option donkey_section 
["remove_old_servers_delay"]
+  ~restart: true
   "How often should remove old donkey servers (see max_server_age) be called
   (in seconds, 0 to disable)"
     float_option 900.
@@ -318,10 +321,12 @@
     "Overnet options"
 
 let overnet_port = define_option overnet_section 
[overnet_options_section_name; "port"]
+  ~restart: true
   "port for overnet"
     int_option (2000 + Random.int 20000)
 
 let options_version = define_expert_option donkey_section ["options_version"]
+  ~internal: true
   "(internal option)"
     int_option 3
 

Index: src/networks/fileTP/fileTPOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/fileTP/fileTPOptions.ml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/networks/fileTP/fileTPOptions.ml        30 May 2006 10:54:14 -0000      
1.11
+++ src/networks/fileTP/fileTPOptions.ml        15 Jan 2007 18:26:27 -0000      
1.12
@@ -55,6 +55,7 @@
     string_option "range"
 
 let options_version = define_option fileTP_section ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
 

Index: src/networks/gnutella/gnutellaOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/gnutella/gnutellaOptions.ml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- src/networks/gnutella/gnutellaOptions.ml    12 May 2006 21:02:38 -0000      
1.20
+++ src/networks/gnutella/gnutellaOptions.ml    15 Jan 2007 18:26:27 -0000      
1.21
@@ -37,6 +37,7 @@
       if !!max_ultrapeers > 10 then max_ultrapeers =:= 10)
   
 let client_port = define_option gnutella_section ["client_port"]
+    ~restart: true
     "The port to bind the client to"
     int_option GnutellaNetwork.port
   
@@ -155,6 +156,7 @@
     string_option ""
 
 let options_version = define_option gnutella_section ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
   

Index: src/networks/openFT/openFTOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/openFT/openFTOptions.ml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- src/networks/openFT/openFTOptions.ml        5 Nov 2005 16:23:41 -0000       
1.4
+++ src/networks/openFT/openFTOptions.ml        15 Jan 2007 18:26:27 -0000      
1.5
@@ -27,10 +27,12 @@
   int_option 5
 
 let port = define_option openft_ini ["client_port"]
+    ~restart: true
     "The port to bind the client to"
     int_option 1215
 
 let http_port = define_option openft_ini ["http_port"]
+    ~restart: true
     "The port to bind the client to for downloads"
     int_option 1216
     
@@ -43,6 +45,7 @@
   int_option 20
 
 let options_version = define_option openft_ini ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
     

Index: src/networks/opennap/opennapOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/opennap/opennapOptions.ml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/networks/opennap/opennapOptions.ml      5 Nov 2005 16:23:41 -0000       
1.11
+++ src/networks/opennap/opennapOptions.ml      15 Jan 2007 18:26:27 -0000      
1.12
@@ -27,6 +27,7 @@
 let opennap_section = file_section opennap_ini ["Opennap"] "Opennap options"
   
 let client_port = define_option opennap_section ["client_port"]
+    ~restart: true
     "The port to bind the client to"
     int_option 6699
   
@@ -63,6 +64,7 @@
     int_option 400
   
 let options_version = define_expert_option opennap_section ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
 

Index: src/networks/soulseek/slskOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/soulseek/slskOptions.ml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/networks/soulseek/slskOptions.ml        5 Nov 2005 16:23:41 -0000       
1.9
+++ src/networks/soulseek/slskOptions.ml        15 Jan 2007 18:26:27 -0000      
1.10
@@ -46,6 +46,7 @@
 *)
   
 let slsk_port = define_option soulseek_section ["client_port"]
+  ~restart: true
   "The port to bind the client to"
     int_option 2234
   
@@ -74,6 +75,7 @@
     "the last token used for a query is saved here" int_option 1
 
 let options_version = define_option soulseek_section ["options_version"]
+    ~internal: true
     "(internal option)"
     int_option 0
 

Index: src/utils/lib/options.ml4
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- src/utils/lib/options.ml4   21 Oct 2006 19:35:54 -0000      1.22
+++ src/utils/lib/options.ml4   15 Jan 2007 18:26:27 -0000      1.23
@@ -61,6 +61,9 @@
     mutable option_hooks : (unit -> unit) list;
     option_section : options_section;
     option_advanced : bool;    
+    option_restart : bool;
+    option_public : bool;
+    option_internal : bool;
     }
 and options_file =
   { mutable file_name : string;
@@ -137,6 +140,7 @@
 
 let define_simple_option
     normalp (section : options_section) (option_name : string list) desc
+  restart public internal
   (option_help : string) (option_class : 'a option_class)
   (default_value : 'a) (advanced : bool) =
   let desc = match desc with None -> "" | Some s -> s in
@@ -145,6 +149,9 @@
       option_class = option_class; option_value = default_value;
       option_default = default_value; 
       option_hooks = []; option_section = section;
+      option_restart = (match restart with None -> false | Some v -> v);
+      option_public = (match public with None -> false | Some v -> v);
+      option_internal = (match internal with None -> false | Some v -> v);
       option_advanced = advanced; option_desc = desc; }
   in
   section.section_options <- 
@@ -168,16 +175,16 @@
 let define_header_option
   opfile option_name option_help option_class default_value =
   define_simple_option false (List.hd opfile.file_sections)
-  option_name None option_help option_class
+  option_name None None None None option_help option_class
     default_value false
 
-let define_option opfile option_name ?desc option_help option_class 
default_value =
-  define_simple_option true opfile option_name desc option_help option_class
+let define_option opfile option_name ?desc ?restart ?public ?internal 
option_help option_class default_value =
+  define_simple_option true opfile option_name desc restart public internal 
option_help option_class
     default_value false
 
 let define_expert_option
-  opfile option_name ?desc option_help option_class default_value =
-  define_simple_option true opfile option_name desc option_help option_class
+  opfile option_name ?desc ?restart ?public ?internal option_help option_class 
default_value =
+  define_simple_option true opfile option_name desc restart public internal 
option_help option_class
     default_value true
 
   
@@ -379,12 +386,16 @@
 let rec save_module indent oc list =
   let subm = ref [] in
   List.iter
-    (fun (name, help, value) ->
+    (fun (name, help, restart, internal, value) ->
        match name with
          [] -> assert false
        | [name] ->
            if !with_help && help <> "" then
              Printf.fprintf oc "\n\t(* %s *)\n" (tabulate help);
+           if restart then
+             Printf.fprintf oc "\t(* changing this option requires restart of 
MLDonkey core *)\n";
+           if internal then
+             Printf.fprintf oc "\t(* Do not change this option, internal use 
only! *)\n";
            Printf.fprintf oc "%s %s = " indent (safe_string name);
            save_value indent oc value;
            Printf.fprintf oc "\n"
@@ -393,7 +404,7 @@
              try List.assoc m !subm with
                e -> let p = ref [] in subm := (m, p) :: !subm; p
            in
-           p := (tail, help, value) :: !p)
+           p := (tail, help, restart, internal, value) :: !p)
     list;
   List.iter
     (fun (m, p) ->
@@ -804,6 +815,7 @@
 
 let option_to_value o =
   o.option_name, o.option_help,
+  o.option_restart, o.option_internal,
   (try o.option_class.to_value o.option_value with
      e ->
        lprintf "Error while saving option \"%s\": %s\n"
@@ -1045,29 +1057,6 @@
   let help = o.option_help in if help = "" then "No Help Available" else help
 let advanced o = o.option_advanced
 
-(*
-let simple_options opfile =
-  let list = ref [] in
-  List.iter (fun s ->
-      List.iter
-        (fun o ->
-          match o.option_name with
-            [] | _ :: _ :: _ -> ()
-          | [name] ->
-              match o.option_class.to_value o.option_value with
-                Module _ | SmallList _ | List _ | DelayedValue _ ->
-                  begin match o.option_class.string_wrappers with
-                      None -> ()
-                    | Some (to_string, from_string) ->
-                        list := (name, to_string o.option_value) :: !list
-                  end
-              | v -> list := (name, safe_value_to_string v) :: !list)
-      s.section_options)
-  opfile.file_sections;
-  !list
-*)
-  
-  
 let get_option opfile name =
 (*  lprintf "get_option [%s]\n" name;*)
   let rec iter name list sections =
@@ -1140,6 +1129,9 @@
         option_advanced : bool;
         option_default : string;
         option_type : string;
+        option_restart : bool;
+        option_public : bool;
+        option_internal : bool;
       }
   
   end
@@ -1173,13 +1165,17 @@
         M.option_advanced = o.option_advanced;
         M.option_help = o.option_help;
         M.option_type = o.option_class.class_name;
+        M.option_restart = o.option_restart;
+        M.option_public = o.option_public;
+        M.option_internal = o.option_internal;
       }
   
-let simple_options prefix opfile =
+let simple_options prefix opfile admin =
   let list = ref [] in
   List.iter (fun s ->
       List.iter
         (fun o ->
+          if admin || o.option_public then
           try list := strings_of_option prefix o :: !list  with _ -> ())
       s.section_options)
   opfile.file_sections;
@@ -1195,7 +1191,7 @@
             set_simple_option opfile oi.M.option_name s),
        Printf.sprintf "<string> : \t%s (current: %s)"
          oi.M.option_help oi.M.option_value)
-    (simple_options prefix opfile)
+    (simple_options prefix opfile true)
 
 let prefixed_args prefix file =
   List.map
@@ -1224,6 +1220,9 @@
     option_advanced : bool;
     option_default : string;
     option_type : string;
+    option_restart : bool;
+    option_public : bool;
+    option_internal : bool;
   }
   
 let iter_section f s =

Index: src/utils/lib/options.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.mli,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/utils/lib/options.mli   21 Oct 2006 19:35:54 -0000      1.10
+++ src/utils/lib/options.mli   15 Jan 2007 18:26:27 -0000      1.11
@@ -43,6 +43,9 @@
     option_advanced : bool;
     option_default : string;
     option_type : string;
+    option_restart : bool; (* changing this option requires a restart *)
+    option_public : bool; (* send this option to GUIs even for non-admin users 
*)
+    option_internal : bool; (* this option should not be changed by users *)
   }
 
 exception SideEffectOption
@@ -77,9 +80,11 @@
 (*4 Creating options *)  
 val define_option : options_section ->
   string list ->  ?desc: string ->
+  ?restart: bool -> ?public: bool -> ?internal: bool ->
   string -> 'a option_class -> 'a -> 'a option_record
 val define_expert_option : options_section ->
   string list ->    ?desc: string ->
+  ?restart: bool -> ?public: bool -> ?internal: bool ->
   string -> 'a option_class -> 'a -> 'a option_record
 val define_header_option : options_file ->
   string list ->  string -> 'a option_class -> 'a -> 'a option_record
@@ -183,7 +188,7 @@
 val value_to_filename : option_value -> string
 
 val set_simple_option : options_file -> string -> string -> unit
-val simple_options : string -> options_file -> option_info list
+val simple_options : string -> options_file -> bool -> option_info list
 val get_simple_option : options_file -> string -> string
 val set_option_hook : options_file -> string -> (unit -> unit) -> unit
 




reply via email to

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