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: Sun, 03 Dec 2006 20:57:57 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/12/03 20:57:56

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonFile.mli commonShared.ml 
                           commonShared.mli commonUploads.ml 
        src/daemon/driver: driverInteractive.ml 
        src/networks/bittorrent: bTGlobals.ml bTInteractive.ml 
        src/networks/donkey: donkeyInteractive.ml donkeyShare.ml 

Log message:
        patch #5602

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1128&r2=1.1129
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.mli?cvsroot=mldonkey&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonShared.ml?cvsroot=mldonkey&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonShared.mli?cvsroot=mldonkey&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonUploads.ml?cvsroot=mldonkey&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInteractive.ml?cvsroot=mldonkey&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTGlobals.ml?cvsroot=mldonkey&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.124&r2=1.125
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyInteractive.ml?cvsroot=mldonkey&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyShare.ml?cvsroot=mldonkey&r1=1.55&r2=1.56

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1128
retrieving revision 1.1129
diff -u -b -r1.1128 -r1.1129
--- distrib/ChangeLog   3 Dec 2006 20:49:42 -0000       1.1128
+++ distrib/ChangeLog   3 Dec 2006 20:57:56 -0000       1.1129
@@ -15,6 +15,7 @@
 =========
 
 2006/12/03
+5602: HTML: Display share status in upstats
 5609: New field type Field_KNOWN, EDK: recognize more HELLO/EmuleInfo tags
 5610: CommonSources: Cleanups and reformatting the code (pango)
 

Index: src/daemon/common/commonFile.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.mli,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- src/daemon/common/commonFile.mli    12 Nov 2006 12:44:24 -0000      1.30
+++ src/daemon/common/commonFile.mli    3 Dec 2006 20:57:56 -0000       1.31
@@ -129,7 +129,6 @@
 val set_file_comment : CommonTypes.file -> string -> unit
 val file_comment : CommonTypes.file -> string
 val file_magic : CommonTypes.file -> string option
-val set_file_magic : CommonTypes.file -> string option -> unit
 val check_magic : CommonTypes.file -> unit  
 val recover_bytes : CommonTypes.file -> (int64 * int64) list
 val file_write : CommonTypes.file -> int64 -> string -> int -> int -> unit

Index: src/daemon/common/commonShared.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonShared.ml,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- src/daemon/common/commonShared.ml   29 Oct 2006 18:58:59 -0000      1.37
+++ src/daemon/common/commonShared.ml   3 Dec 2006 20:57:56 -0000       1.38
@@ -43,13 +43,14 @@
     mutable impl_shared_size : int64;
     mutable impl_shared_id : Md4.t;
     mutable impl_shared_requests : int;
-    mutable impl_shared_magic : string option;
+    mutable impl_shared_file : CommonTypes.file option;
     mutable impl_shared_servers : CommonTypes.server list;
   }
   
 and 'a shared_ops = {
     mutable op_shared_info : ('a -> GuiTypes.shared_info);
     mutable op_shared_unshare : ('a -> unit);
+    mutable op_shared_state : (CommonTypes.file -> CommonTypes.ui_conn -> 
string);
   }
   
 let as_shared  (shared : 'a shared_impl) =
@@ -180,6 +181,14 @@
   shared_remove impl;
   try impl.impl_shared_ops.op_shared_unshare impl.impl_shared_val with _ -> ()
 
+let shared_state s o =
+  let impl = as_shared_impl s in
+  try
+    match impl.impl_shared_file with
+    | None -> ""
+    | Some f -> impl.impl_shared_ops.op_shared_state f o
+  with _ -> ""
+
 let shared_dir = function
   | None       -> ""
   | Some sh    -> 
@@ -198,6 +207,7 @@
 let new_shared_ops network = {
     op_shared_unshare = (fun _ -> ni_ok network "shared_unshare");
     op_shared_info = (fun _ -> fni network "shared_info");
+    op_shared_state = (fun _ _ -> fni network "shared_state");
   }
 
 let dummy_shared = {
@@ -209,12 +219,13 @@
     impl_shared_ops = {
       op_shared_unshare = (fun _ -> raise Not_found);
       op_shared_info = (fun _ -> raise Not_found);
+      op_shared_state = (fun _ _ -> raise Not_found);
     };
     impl_shared_uploaded = zero;
     impl_shared_size = zero;
     impl_shared_id = Md4.null;
     impl_shared_requests = 0;
-    impl_shared_magic = None;
+    impl_shared_file = None;
     impl_shared_servers = []
   }
   
@@ -354,7 +365,10 @@
     T.shared_requests = impl.impl_shared_requests; 
     T.shared_uids = [];
     T.shared_sub_files = [];
-    T.shared_magic = impl.impl_shared_magic;
+    T.shared_magic =
+      match impl.impl_shared_file with
+      | None -> None
+      | Some f -> CommonFile.file_magic f;
   }
   
 let shared_info s =

Index: src/daemon/common/commonShared.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonShared.mli,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/daemon/common/commonShared.mli  8 Oct 2006 14:20:21 -0000       1.8
+++ src/daemon/common/commonShared.mli  3 Dec 2006 20:57:56 -0000       1.9
@@ -9,12 +9,13 @@
   mutable impl_shared_size : int64;
   mutable impl_shared_id : Md4.Md4.t;
   mutable impl_shared_requests : int;
-  mutable impl_shared_magic : string option;
+  mutable impl_shared_file : CommonTypes.file option;
   mutable impl_shared_servers : CommonTypes.server list;
 } 
 and 'a shared_ops = {
   mutable op_shared_info : 'a -> GuiTypes.shared_info;
   mutable op_shared_unshare : 'a -> unit;
+  mutable op_shared_state : CommonTypes.file -> CommonTypes.ui_conn -> string;
 } 
 
 val dirnames_prio : (string * int) list ref
@@ -50,5 +51,4 @@
 val shared_check_files : unit -> unit
 val impl_shared_info : 'a shared_impl -> GuiTypes.shared_info
 val shared_info : CommonTypes.shared -> GuiTypes.shared_info
-
-  
+val shared_state : CommonTypes.shared -> CommonTypes.ui_conn -> string

Index: src/daemon/common/commonUploads.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonUploads.ml,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- src/daemon/common/commonUploads.ml  26 Nov 2006 13:54:09 -0000      1.52
+++ src/daemon/common/commonUploads.ml  3 Dec 2006 20:57:56 -0000       1.53
@@ -687,7 +687,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = sh;
           impl_shared_requests = 0;
-          impl_shared_magic = None;
+          impl_shared_file = None;
           impl_shared_servers = [];
         }
       and sh = {

Index: src/daemon/driver/driverInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- src/daemon/driver/driverInteractive.ml      3 Dec 2006 20:49:42 -0000       
1.121
+++ src/daemon/driver/driverInteractive.ml      3 Dec 2006 20:57:56 -0000       
1.122
@@ -2457,7 +2457,9 @@
       ( "0", "srh", "Preview", "P" ) ;
       ( "0", "srh", "Filename", "Filename" );
       ( "0", "srh", "Statistic links", "Stats" );
-      ( "0", "srh", "Published on servers", "Publ" ) ]
+      ( "0", "srh", "Published on servers", "Publ" );
+      ( "0", "srh", "Share status", "Status" )
+    ]
   else
     begin
       Printf.bprintf buf " Requests |  Bytes   | Uploaded | File\n";
@@ -2483,8 +2485,9 @@
        (if !!html_mods_use_js_tooltips then
           Printf.bprintf buf " 
onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%s%s\\\\\')',%d);setTimeout('hideLayer()',%d);return
 true;\\\" 
onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
            (Http_server.html_real_escaped (Filename.basename (Charset.to_utf8 
impl.impl_shared_codedname)))
-           (match impl.impl_shared_magic with
-              None -> ""
+           (match impl.impl_shared_file with
+              None -> "no file info"
+            | Some file -> match file_magic file with | None -> "no magic"
             | Some magic -> "File type: " ^ (Http_server.html_real_escaped 
magic) ^ "<br>")
            (if impl.impl_shared_servers = [] then "" else
               Printf.sprintf "<br>Published on %d %s<br>%s"
@@ -2506,7 +2509,6 @@
 
        let uploaded = Int64.to_float impl.impl_shared_uploaded in
        let size = Int64.to_float impl.impl_shared_size in
-
        html_mods_td buf [
          ("", "sr ar", Printf.sprintf "%d" impl.impl_shared_requests);
          ("", "sr ar", size_of_int64 impl.impl_shared_uploaded);
@@ -2524,7 +2526,9 @@
                       (Md4.to_string impl.impl_shared_id) "T1"
                       (Md4.to_string impl.impl_shared_id) "T2"
                       (Md4.to_string impl.impl_shared_id) "B"));
-         ("", "sr ar", Printf.sprintf "%d" published ) ];
+         ("", "sr ar", Printf.sprintf "%d" published);
+         ("", "sr", shared_state (as_shared impl) o);
+        ];
        Printf.bprintf buf "\\</tr\\>\n";
       end
     else

Index: src/networks/bittorrent/bTGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTGlobals.ml,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- src/networks/bittorrent/bTGlobals.ml        2 Dec 2006 12:35:46 -0000       
1.73
+++ src/networks/bittorrent/bTGlobals.ml        3 Dec 2006 20:57:56 -0000       
1.74
@@ -124,7 +124,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = file;
           impl_shared_requests = 0;
-          impl_shared_magic = None;
+          impl_shared_file = Some (as_file file);
           impl_shared_servers = [];
         } in
         file.file_shared <- Some impl;

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- src/networks/bittorrent/bTInteractive.ml    2 Dec 2006 12:35:46 -0000       
1.124
+++ src/networks/bittorrent/bTInteractive.ml    3 Dec 2006 20:57:56 -0000       
1.125
@@ -1271,6 +1271,9 @@
 
   CommonNetwork.register_commands commands;
 
+  shared_ops.op_shared_state <- (fun file o ->
+      "no BT data"
+  );
   shared_ops.op_shared_unshare <- (fun file ->
       (if !verbose_share then lprintf_file_nl (as_file file) "unshare file");
       BTGlobals.unshare_file file);

Index: src/networks/donkey/donkeyInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- src/networks/donkey/donkeyInteractive.ml    3 Dec 2006 20:49:42 -0000       
1.143
+++ src/networks/donkey/donkeyInteractive.ml    3 Dec 2006 20:57:56 -0000       
1.144
@@ -1782,6 +1782,29 @@
   )
 
 let _ =
+  shared_ops.op_shared_state <- (fun f o ->
+    match CommonFile.file_state f with
+    | FileShared ->
+      (match file_shared f with
+      | None -> "no file_shared info"
+      | Some f ->
+            let pre_share1_dir =
+              String2.replace (Filename2.dirname (as_shared_impl 
f).impl_shared_fullname) '\\' "/" in
+            let pre_share2_dir =
+              try       
+                String2.after pre_share1_dir
+                (String2.search_from
+                (Filename2.dirname (as_shared_impl f).impl_shared_fullname) 0 
(Sys.getcwd ()) +
+                String.length (Sys.getcwd ()))
+              with Not_found -> pre_share1_dir
+            in
+            let dir =
+              if String2.check_prefix pre_share2_dir "/" then String2.after 
pre_share2_dir 1 else pre_share2_dir in
+            if o.conn_output = HTML then
+              Printf.sprintf "\\<a 
href=\\\"submit?q=debug_dir+%s\\\"\\>%s\\</a\\>" (Http_server.html_real_escaped 
dir) (Http_server.html_real_escaped dir)
+            else Printf.sprintf "Shared in %s" dir)
+    | state -> string_of_state state
+  );
   shared_ops.op_shared_unshare <- (fun file ->
       unshare_file file;
 (* Should we or not ??? *)

Index: src/networks/donkey/donkeyShare.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyShare.ml,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- src/networks/donkey/donkeyShare.ml  9 Oct 2006 16:17:19 -0000       1.55
+++ src/networks/donkey/donkeyShare.ml  3 Dec 2006 20:57:56 -0000       1.56
@@ -44,12 +44,7 @@
   | Some _ -> ()
   | None ->
       let full_name = file_disk_name file in
-      let magic =
-        match Magic.M.magic_fileinfo full_name false with
-          None -> None
-        | Some magic -> Some (intern magic)
-      in
-
+      check_magic (as_file file);
       let impl = {
           impl_shared_update = 1;
           impl_shared_fullname = full_name;
@@ -61,7 +56,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = file;
           impl_shared_requests = 0;
-          impl_shared_magic = magic;
+          impl_shared_file = Some (as_file file);
           impl_shared_servers = []
         } in
       file.file_shared <- Some impl;
@@ -333,12 +328,6 @@
     let found = ref false in
     List.iter (fun sh -> if sh.shared_name = fullname then found := true) 
!shared_files;
     if not !found then begin
-        let magic =
-          match Magic.M.magic_fileinfo fullname false with
-            None -> None
-          | Some magic -> Some (intern magic)
-        in
-
           let rec impl = {
               impl_shared_update = 1;
               impl_shared_fullname = fullname;
@@ -350,7 +339,7 @@
               impl_shared_id = Md4.null;
               impl_shared_val = pre_shared;
               impl_shared_requests = 0;
-              impl_shared_magic = magic;
+              impl_shared_file = None;
               impl_shared_servers = [];
             } and
             pre_shared = {




reply via email to

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