[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/... |
Date: |
Sat, 11 Feb 2006 14:52:45 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Branch:
Changes by: spiralvoice <address@hidden> 06/02/11 14:52:45
Modified files:
distrib : ChangeLog
src/networks/donkey: donkeyClient.ml donkeyProtoClient.ml
donkeyProtoCom.ml donkeyProtoCom.mli
Log message:
patch #4902
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.731&tr2=1.732&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml.diff?tr1=1.84&tr2=1.85&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoClient.ml.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.ml.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.mli.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.731 mldonkey/distrib/ChangeLog:1.732
--- mldonkey/distrib/ChangeLog:1.731 Sat Feb 11 14:49:51 2006
+++ mldonkey/distrib/ChangeLog Sat Feb 11 14:52:45 2006
@@ -15,6 +15,7 @@
=========
2006/02/11
+4902: EDK: Stub respond to directory browsing requests (sam_dennis)
4905: Update for patch 4823: add another -fno-fomit-frame-pointer
in config/Makefile.in to avoid breaking CryptoPP (mikeX)
4903: EDK: Remove obsolete donkeyNeighbours (thx to sam_dennis)
Index: mldonkey/src/networks/donkey/donkeyClient.ml
diff -u mldonkey/src/networks/donkey/donkeyClient.ml:1.84
mldonkey/src/networks/donkey/donkeyClient.ml:1.85
--- mldonkey/src/networks/donkey/donkeyClient.ml:1.84 Sat Feb 11 14:43:20 2006
+++ mldonkey/src/networks/donkey/donkeyClient.ml Sat Feb 11 14:52:45 2006
@@ -1633,6 +1633,38 @@
lprintf_nl () "Sending %d Files in ViewFilesReqReply" (List.length
!published_files);
client_send_files sock !published_files
+ (*TODO: real directory support*)
+ | M.ViewDirsReq t when !CommonUploads.has_upload = 0 &&
+ (match !!allow_browse_share with
+ 1 -> client_friend_tag land client_type c <> 0
+ | 2 -> true
+ | _ -> false) ->
+ let published_dirs = ["FIXME"] in
+ if !verbose_msg_clients then
+ lprintf_nl () "Sending %d Dirs in ViewDirsReplyReq" (List.length
published_dirs);
+ client_send c (M.ViewDirsReplyReq published_dirs)
+
+ (*TODO: real directory support*)
+ (*TODO: "!Incomplete Files" support*)
+ | M.ViewFilesDirReq t when !CommonUploads.has_upload = 0 &&
+ (match !!allow_browse_share with
+ 1 -> client_friend_tag land client_type c <> 0
+ | 2 -> true
+ | _ -> false) ->
+ let files = DonkeyShare.all_shared () in
+ let published_files = ref [] in
+ List.iter (fun f ->
+ let filename = file_best_name f in
+ if not (String2.starts_with filename "hidden.") then
+ published_files := f :: !published_files
+ ) files;
+(*
+ lprintf "ASK VIEW FILES\n";
+ *)
+ if !verbose_msg_clients then
+ lprintf_nl () "Sending %d Files in ViewFilesReqReply" (List.length
!published_files);
+ client_send_dir sock t !published_files
+
| M.QueryFileReq t ->
let md4 = t.M.QueryFile.md4 in
c.client_requests_received <- c.client_requests_received + 1;
Index: mldonkey/src/networks/donkey/donkeyProtoClient.ml
diff -u mldonkey/src/networks/donkey/donkeyProtoClient.ml:1.34
mldonkey/src/networks/donkey/donkeyProtoClient.ml:1.35
--- mldonkey/src/networks/donkey/donkeyProtoClient.ml:1.34 Sat Feb 11
14:41:12 2006
+++ mldonkey/src/networks/donkey/donkeyProtoClient.ml Sat Feb 11 14:52:45 2006
@@ -533,6 +533,7 @@
module ReleaseSlot = NoArg(struct let m = "ReleaseSlot" end)
module CloseSlot = NoArg(struct let m = "CloseSlot" end)
module ViewFiles = NoArg(struct let m = "VIEW FILES" end)
+module ViewDirs = NoArg(struct let m = "VIEW DIRS" end)
module ViewFilesReply = struct
@@ -607,6 +608,83 @@
nfiles, prev_len
end
+module ViewDirsReply = struct
+
+ type t = string list
+
+ let rec get_dirs s pos n =
+ if n = 0 then [], pos else
+ let dir, pos = get_string16 s pos in
+ let dirs, pos = get_dirs s pos (n-1) in
+ dir :: dirs, pos
+
+ let parse len s =
+ let dirs, pos = get_dirs s 2 (get_int16 s 0) in
+ dirs
+
+ let print t =
+ lprintf_nl "VIEW DIRS REPLY:";
+ List.iter (fun dir ->
+ lprintf_nl "DIR: %s" dir;) t
+
+ let write buf t =
+ buf_int buf (List.length t);
+ List.iter (fun dir ->
+ buf_string buf dir;) t
+
+ end
+
+module ViewFilesDir = struct
+
+ type t = string
+
+ let print t =
+ lprintf_nl "VIEW FILES DIR: %s" t
+
+ let parse len s =
+ let dir, pos = get_string s 1 in
+ dir
+
+ let write buf t =
+ buf_string buf t
+
+ end
+
+module ViewFilesDirReply = struct
+
+ type t = string * tagged_file list
+
+ let names_of_tag = file_common_tags
+
+ let parse len s =
+ let dir, pos = get_string s 1 in
+ let n = get_int s (pos+1) in
+ let files, pos = ViewFilesReply.get_files s (pos+5) n in
+ dir, files
+
+ let print t =
+ lprintf_nl "VIEW FILES DIR REPLY:";
+ let dir, files = t in begin
+ lprintf_nl "DIR: %s" dir;
+ List.iter (fun file ->
+ lprintf_nl "FILE:";
+ lprintf_nl " MD4: %s" (Md4.to_string file.f_md4);
+ lprintf_nl " ip: %s" (Ip.to_string file.f_ip);
+ lprintf_nl " port: %d" file.f_port;
+ lprintf " tags: ";
+ print_tags file.f_tags;
+ lprint_newline ();) files
+ end
+
+ let write buf t =
+ let dir, files = t in begin
+ buf_string buf dir;
+ buf_int buf (List.length files);
+ ViewFilesReply.write_files buf files
+ end
+
+ end
+
module OtherLocations = struct
type t = Ip.t list
@@ -984,6 +1062,10 @@
| QueryChunkMd4ReplyReq of QueryChunkMd4Reply.t
| ViewFilesReq of ViewFiles.t
| ViewFilesReplyReq of ViewFilesReply.t
+| ViewDirsReq of ViewDirs.t
+| ViewDirsReplyReq of ViewDirsReply.t
+| ViewFilesDirReq of ViewFilesDir.t
+| ViewFilesDirReplyReq of ViewFilesDirReply.t
| QueueReq of OtherLocations.t
| UnknownReq of int * string
| OtherLocationsReq of OtherLocations.t
@@ -1026,6 +1108,10 @@
| QueryChunkMd4ReplyReq t -> QueryChunkMd4Reply.print t
| ViewFilesReplyReq t -> ViewFilesReply.print t
| ViewFilesReq t -> ViewFiles.print t
+ | ViewDirsReq t -> ViewDirs.print t
+ | ViewDirsReplyReq t -> ViewDirsReply.print t
+ | ViewFilesDirReq t -> ViewFilesDir.print t
+ | ViewFilesDirReplyReq t -> ViewFilesDirReply.print t
| QueueReq t -> OtherLocations.print t
| OtherLocationsReq t -> OtherLocations.print t
| SayReq t -> Say.print t
@@ -1254,6 +1340,12 @@
| 88 -> QueryFileReq (QueryFile.parse emule_version len s)
| 89 -> QueryFileReplyReq (QueryFileReply.parse len s)
| 92 -> QueueRankReq (QueueRank.parse len s)
+ | 93 -> ViewDirsReq (ViewDirs.parse len s)
+ | 94 -> ViewFilesDirReq (ViewFilesDir.parse len s)
+ (*
+ | 95 -> ViewDirsReplyReq (ViewDirsReply.parse len s)
+ | 96 -> ViewFilesDirReplyReq (ViewFilesDirReply.parse len s)
+ *)
| 250 -> SourcesReq (Sources.parse len s)
| _ -> raise Not_found
@@ -1373,6 +1465,18 @@
| ViewFilesReplyReq t ->
buf_int8 buf 75;
ViewFilesReply.write buf t
+ | ViewDirsReq t ->
+ buf_int8 buf 93;
+ ViewDirs.write buf t
+ | ViewDirsReplyReq t ->
+ buf_int8 buf 95;
+ ViewDirsReply.write buf t
+ | ViewFilesDirReq t ->
+ buf_int8 buf 94;
+ ViewFilesDir.write buf t
+ | ViewFilesDirReplyReq t ->
+ buf_int8 buf 96;
+ ViewFilesDirReply.write buf t
| OtherLocationsReq t ->
buf_int8 buf 72;
OtherLocations.write buf t
Index: mldonkey/src/networks/donkey/donkeyProtoCom.ml
diff -u mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.29
mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.30
--- mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.29 Thu Feb 9 11:41:39 2006
+++ mldonkey/src/networks/donkey/donkeyProtoCom.ml Sat Feb 11 14:52:45 2006
@@ -398,6 +398,27 @@
str_int s 6 nfiles;
write_string sock s
+let client_send_dir sock dir files =
+ let max_len = !!client_buffer_size - 100 -
+ TcpBufferedSocket.remaining_to_write sock in
+ Buffer.reset buf;
+ buf_int8 buf 227;
+ buf_int buf 0;
+ buf_int8 buf 96; (* ViewFilesDirReply *)
+ buf_string buf dir;
+ buf_int buf 0;
+ let pos = Buffer.length buf in
+ let nfiles, prev_len = DonkeyProtoClient.ViewFilesReply.write_files_max buf (
+ make_tagged (Some sock) files)
+ 0 max_len in
+ let s = Buffer.contents buf in
+ let s = String.sub s 0 prev_len in
+ let len = String.length s - 5 in begin
+ str_int s 1 len;
+ str_int s (pos-4) nfiles;
+ end;
+ write_string sock s
+
let udp_server_send s t =
udp_send (get_udp_sock ()) s.server_ip (s.server_port+4) t
Index: mldonkey/src/networks/donkey/donkeyProtoCom.mli
diff -u mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.6
mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.7
--- mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.6 Mon Jan 16 16:05:14 2006
+++ mldonkey/src/networks/donkey/donkeyProtoCom.mli Sat Feb 11 14:52:45 2006
@@ -72,6 +72,8 @@
bool -> TcpBufferedSocket.t -> file list -> unit
val client_send_files :
TcpBufferedSocket.t -> file list -> unit
+val client_send_dir :
+ TcpBufferedSocket.t -> string -> file list -> unit
val new_string : DonkeyProtoClient.t -> string -> unit
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/03
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/09
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/09
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/11
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/..., mldonkey-commits, 2006/02/17