[Top][All Lists]
[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, 12 Nov 2006 12:44:25 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/11/12 12:44:25
Modified files:
distrib : ChangeLog
src/daemon/common: commonFile.ml commonFile.mli
src/networks/bittorrent: bTInteractive.ml
src/networks/donkey: donkeyInteractive.ml
src/networks/fileTP: fileTPInteractive.ml
src/networks/gnutella: gnutellaInteractive.ml
Log message:
patch #5509
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1083&r2=1.1084
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.ml?cvsroot=mldonkey&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.mli?cvsroot=mldonkey&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyInteractive.ml?cvsroot=mldonkey&r1=1.134&r2=1.135
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/fileTP/fileTPInteractive.ml?cvsroot=mldonkey&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/gnutella/gnutellaInteractive.ml?cvsroot=mldonkey&r1=1.66&r2=1.67
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1083
retrieving revision 1.1084
diff -u -b -r1.1083 -r1.1084
--- distrib/ChangeLog 12 Nov 2006 12:42:55 -0000 1.1083
+++ distrib/ChangeLog 12 Nov 2006 12:44:24 -0000 1.1084
@@ -15,6 +15,8 @@
=========
2006/11/12
+5509: Common: Merge file_print functions,
+ BT: print BT-specific source infos in Telnet (thx to jave)
5544: Clean up code to avoid otags warnings (pango)
5543: Improve exception handling, fix some indentions (pango)
5542: CommonSources: Work-around division-by-zero bug in Ocaml
Index: src/daemon/common/commonFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.ml,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- src/daemon/common/commonFile.ml 9 Nov 2006 21:32:26 -0000 1.68
+++ src/daemon/common/commonFile.ml 12 Nov 2006 12:44:24 -0000 1.69
@@ -92,9 +92,8 @@
mutable op_file_active_sources : ('a -> client list);
mutable op_file_comment : ('a -> string);
mutable op_file_set_priority : ('a -> int -> unit);
- mutable op_file_print_plain : ('a -> Buffer.t -> unit);
- mutable op_file_print_html : ('a -> Buffer.t -> unit);
- mutable op_file_print_sources_html : ('a -> Buffer.t -> unit);
+ mutable op_file_print : ('a -> CommonTypes.ui_conn -> unit);
+ mutable op_file_print_sources : ('a -> CommonTypes.ui_conn -> unit);
mutable op_file_files : ('a -> 'a file_impl -> file list);
(* added in 2.5.27 to remove use of network names in global modules *)
mutable op_file_debug : ('a -> string);
@@ -366,7 +365,9 @@
try impl.impl_file_ops.op_file_active_sources impl.impl_file_val with _ -> []
(* Default for networks that don't implement it *)
-let default_file_print_sources_html file buf =
+let default_file_print_sources file o =
+ let buf = o.conn_buf in
+ if use_html_mods o then begin
let cfile = as_file file in
let allsources = ref (file_all_sources cfile) in
if List.length !allsources > 0 then begin
@@ -408,20 +409,26 @@
Printf.bprintf buf "\\</table\\>\\</div\\>\\<br\\>";
end
+ end
+ else
+ let cfile = as_file file in
+ let srcs = ref (file_all_sources cfile) in
+ Printf.bprintf buf "%d sources:\n" (List.length !srcs);
+ let print_source c =
+ Printf.bprintf buf " [%4d] " (client_num c);
+ client_bprint c buf;
+ in
+ List.iter print_source !srcs;
+ ()
-
-let file_print_sources_html (file : file) buf =
+let file_print_sources (file : file) conn =
let file = as_file_impl file in
- try file.impl_file_ops.op_file_print_sources_html file.impl_file_val buf
with _ ->
- default_file_print_sources_html file buf
-
-let file_print_html file buf =
- let impl = as_file_impl file in
- impl.impl_file_ops.op_file_print_html impl.impl_file_val buf
+ try file.impl_file_ops.op_file_print_sources file.impl_file_val conn with _
->
+ default_file_print_sources file conn
-let file_print_plain file buf =
+let file_print file o =
let impl = as_file_impl file in
- impl.impl_file_ops.op_file_print_plain impl.impl_file_val buf
+ impl.impl_file_ops.op_file_print impl.impl_file_val o
let file_find num =
H.find files_by_num (as_file {
@@ -799,7 +806,7 @@
("", "sr", magic) ]
| _ -> ());
- file_print_html file buf;
+ file_print file o;
Printf.bprintf buf "\\</tr\\>\\</table\\>\\</div\\>";
Printf.bprintf buf "\\</td\\>\\</tr\\>\\</table\\>\\</div\\>\\<br\\>";
@@ -830,24 +837,11 @@
| Some filename ->
Printf.bprintf buf "Probable name: %s\n" filename);
List.iter (fun name -> Printf.bprintf buf " (%s)\n" name)
info.G.file_names;
- file_print_plain file buf
+ file_print file o
end;
(try
-
- if !!print_all_sources then begin
- if use_html_mods o then
- file_print_sources_html file buf
- else begin
- Printf.bprintf buf "%d sources:\n" (List.length srcs);
- let print_source c =
- Printf.bprintf buf " [%4d] " (client_num c);
- client_bprint c buf;
- in
- List.iter print_source srcs;
- end;
- end
-
+ if !!print_all_sources then file_print_sources file o
with _ -> ())
let file_print_ed2k_link filename filesize md4hash =
@@ -1001,9 +995,8 @@
op_file_active_sources = (fun _ -> fni network "file_active_sources");
op_file_comment = (fun _ -> ni_ok network "file_comment"; "");
op_file_set_priority = (fun _ _ -> ni_ok network "file_set_priority");
- op_file_print_plain = (fun _ _ -> ni_ok network "file_print_plain");
- op_file_print_html = (fun _ _ -> ni_ok network "file_print_html");
- op_file_print_sources_html = (fun _ _ -> fni network
"file_print_sources_html");
+ op_file_print = (fun _ _ -> ni_ok network "file_print_html");
+ op_file_print_sources = (fun _ _ -> fni network "file_print_sources");
op_file_debug = (fun _ -> "");
op_file_proposed_filenames = (fun impl -> []);
}
@@ -1046,12 +1039,10 @@
lprintf_nl "op_file_all_sources";
if c.op_file_active_sources == cc.op_file_active_sources then
lprintf_nl "op_file_active_sources";
- if c.op_file_print_plain == cc.op_file_print_plain then
- lprintf_nl "op_file_print_plain";
- if c.op_file_print_html == cc.op_file_print_html then
- lprintf_nl "op_file_print_html";
- if c.op_file_print_sources_html == cc.op_file_print_sources_html then
- lprintf_nl "op_file_print_sources_html";
+ if c.op_file_print == cc.op_file_print then
+ lprintf_nl "op_file_print";
+ if c.op_file_print_sources == cc.op_file_print_sources then
+ lprintf_nl "op_file_print_sources";
) !files_ops;
lprint_newline ()
Index: src/daemon/common/commonFile.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.mli,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- src/daemon/common/commonFile.mli 9 Nov 2006 21:32:26 -0000 1.29
+++ src/daemon/common/commonFile.mli 12 Nov 2006 12:44:24 -0000 1.30
@@ -59,9 +59,8 @@
mutable op_file_active_sources : 'a -> CommonTypes.client list;
mutable op_file_comment : 'a -> string;
mutable op_file_set_priority : 'a -> int -> unit;
- mutable op_file_print_plain: 'a -> Buffer.t -> unit;
- mutable op_file_print_html: 'a -> Buffer.t -> unit;
- mutable op_file_print_sources_html : 'a -> Buffer.t -> unit;
+ mutable op_file_print: 'a -> CommonTypes.ui_conn -> unit;
+ mutable op_file_print_sources : 'a -> CommonTypes.ui_conn -> unit;
mutable op_file_files : ('a -> 'a file_impl -> CommonTypes.file list);
mutable op_file_debug : 'a -> string;
mutable op_file_proposed_filenames : 'a -> string list;
@@ -100,7 +99,7 @@
val file_preview : CommonTypes.file -> unit
val file_all_sources : CommonTypes.file -> CommonTypes.client list
val file_active_sources : CommonTypes.file -> CommonTypes.client list
-val file_print_sources_html : CommonTypes.file -> Buffer.t -> unit
+val file_print_sources : CommonTypes.file -> CommonTypes.ui_conn -> unit
val files_ops : (int file_ops * int file_ops) list ref
val new_file_ops : CommonTypes.network -> 'a file_ops
val check_file_implementations : unit -> unit
Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- src/networks/bittorrent/bTInteractive.ml 9 Nov 2006 21:32:27 -0000
1.121
+++ src/networks/bittorrent/bTInteractive.ml 12 Nov 2006 12:44:24 -0000
1.122
@@ -154,8 +154,10 @@
end
-let op_file_print_html file buf =
+let op_file_print file o =
+ let buf = o.conn_buf in
+ if use_html_mods o then begin
Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr
());
html_mods_td buf [
("Filename", "sr br", "Filename");
@@ -335,8 +337,7 @@
];
incr cntr;
) file.file_files
-
-let op_file_print_plain file buf =
+ end else begin
Printf.bprintf buf "Trackers:\n";
List.iter (fun tracker ->
@@ -367,8 +368,37 @@
in
Printf.bprintf buf "File %d: %s (%Ld bytes)%s\n" !cntr filename size
magic_string
) file.file_files
+ end
-let op_file_print_sources_html file buf =
+let op_file_print_sources file o =
+ let buf = o.conn_buf in
+
+(* redefine functions for telnet output *)
+ let html_mods_td buf l =
+ if use_html_mods o then
+ html_mods_td buf l
+ else
+ (* List *)
+ List.iter (fun (t,c,d) ->
+ (* Title Class Value *)
+ Printf.bprintf buf "%s "
+ d;
+ ) l
+ in
+ let html_mods_table_header buf n c l =
+ if use_html_mods o then
+ html_mods_table_header buf n c l
+ else
+ if List.length l > 0 then begin
+ Printf.bprintf buf "\n";
+ List.iter (fun (w,x,y,z) ->
+ (* Sort Class Title Value *)
+ Printf.bprintf buf "%s "
+ z;
+ ) l;
+ Printf.bprintf buf "\n"
+ end
+ in
if Hashtbl.length file.file_clients > 0 then begin
@@ -419,6 +449,7 @@
html_mods_table_header buf "sourcesTable" "sources al" header_list;
Hashtbl.iter (fun _ c ->
+ if use_html_mods o then
Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr());
let btos b = if b then "T" else "F" in
@@ -466,11 +497,13 @@
] in
html_mods_td buf td_list;
- Printf.bprintf buf "\\</tr\\>";
+ if use_html_mods o then Printf.bprintf buf "\\</tr\\>"
+ else Printf.bprintf buf "\n";
) file.file_clients;
- Printf.bprintf buf "\\</table\\>\\</div\\>\\<br\\>";
+ if use_html_mods o then Printf.bprintf buf
"\\</table\\>\\</div\\>\\<br\\>"
+ else Printf.bprintf buf "\n";
end
@@ -1167,9 +1200,8 @@
file_ops.op_file_active_sources <- op_file_active_sources;
file_ops.op_file_debug <- op_file_debug;
file_ops.op_file_commit <- op_file_commit;
- file_ops.op_file_print_html <- op_file_print_html;
- file_ops.op_file_print_plain <- op_file_print_plain;
- file_ops.op_file_print_sources_html <- op_file_print_sources_html;
+ file_ops.op_file_print <- op_file_print;
+ file_ops.op_file_print_sources <- op_file_print_sources;
file_ops.op_file_check <- op_file_check;
file_ops.op_file_cancel <- op_file_cancel;
file_ops.op_file_info <- op_file_info;
Index: src/networks/donkey/donkeyInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- src/networks/donkey/donkeyInteractive.ml 9 Nov 2006 21:32:27 -0000
1.134
+++ src/networks/donkey/donkeyInteractive.ml 12 Nov 2006 12:44:24 -0000
1.135
@@ -1231,15 +1231,16 @@
) file.file_sources;
!list
);
- file_ops.op_file_print_plain <- (fun file buf ->
+ file_ops.op_file_print <- (fun file o ->
+
+ let buf = o.conn_buf in
+ if not (use_html_mods o) then begin
let cntr = ref 0 in
List.iter (fun (ip, n, r, c) ->
incr cntr;
Printf.bprintf buf
"Comment %d: Rating(%d): %s (%s/%s)\n" !cntr r (Charset.to_utf8 c) n
(Ip.to_string ip)) file.file_comments
- );
- file_ops.op_file_print_html <- (fun file buf ->
-
+ end else begin
let tr () =
Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>"
(html_mods_cntr ())
in
@@ -1305,11 +1306,12 @@
^ "\\<td\\>"
^ "\\<input name=\\\"newName\\\" type=text size=" ^ input_size ^ "
value=\\\"" ^ (file_best_name file) ^
"\\\"\\>\\</input\\>\\</td\\>\\</form\\>\\</tr\\>\\</table\\>"
) ];
-
-
+ end
);
- file_ops.op_file_print_sources_html <- (fun file buf ->
+ file_ops.op_file_print_sources <- (fun file o ->
+ if not (use_html_mods o) then raise Not_found;
+ let buf = o.conn_buf in
let sources_list = ref [] in
DonkeySources.iter_relevant_sources (fun s ->
let s_uid = s.DonkeySources.source_uid in
Index: src/networks/fileTP/fileTPInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/fileTP/fileTPInteractive.ml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- src/networks/fileTP/fileTPInteractive.ml 9 Nov 2006 21:32:27 -0000
1.51
+++ src/networks/fileTP/fileTPInteractive.ml 12 Nov 2006 12:44:24 -0000
1.52
@@ -417,8 +417,7 @@
) file.file_clients
);
file_ops.op_file_resume <- (fun file -> ());
- file_ops.op_file_print_html <- (fun file buf -> ());
- file_ops.op_file_print_plain <- (fun file buf -> ());
+ file_ops.op_file_print <- (fun file buf -> ());
network.op_network_close_search <- (fun s -> ());
network.op_network_forget_search <- (fun s -> ());
network.op_network_connect_servers <- (fun s -> ());
Index: src/networks/gnutella/gnutellaInteractive.ml
===================================================================
RCS file:
/sources/mldonkey/mldonkey/src/networks/gnutella/gnutellaInteractive.ml,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- src/networks/gnutella/gnutellaInteractive.ml 1 Oct 2006 17:54:00
-0000 1.66
+++ src/networks/gnutella/gnutellaInteractive.ml 12 Nov 2006 12:44:24
-0000 1.67
@@ -289,8 +289,7 @@
module P = GuiTypes
let _ =
- file_ops.op_file_print_html <- (fun file buf -> ());
- file_ops.op_file_print_plain <- (fun file buf -> ());
+ file_ops.op_file_print <- (fun file buf -> ());
file_ops.op_file_cancel <- (fun file ->
CommonSwarming.remove_swarmer file.file_swarmer;
file.file_swarmer <- None;
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/13
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/13
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/15
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/19
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/19
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/21