[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/ip_set.ml
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/ip_set.ml |
Date: |
Wed, 01 Mar 2006 20:06:50 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Branch:
Changes by: spiralvoice <address@hidden> 06/03/01 20:06:50
Modified files:
distrib : ChangeLog
src/utils/net : ip_set.ml
Log message:
patch #4939
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.755&tr2=1.756&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/net/ip_set.ml.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.755 mldonkey/distrib/ChangeLog:1.756
--- mldonkey/distrib/ChangeLog:1.755 Wed Mar 1 20:04:09 2006
+++ mldonkey/distrib/ChangeLog Wed Mar 1 20:06:50 2006
@@ -15,6 +15,7 @@
=========
2006/03/01
+4939: Support for compressed ipfilter.dat files (.gz, .bz2 or .zip) (pango)
4930: giFT GUI: Authentication support (pango)
- login with giFTcurs now has to be done like this: giFTcurs -p user:password
Index: mldonkey/src/utils/net/ip_set.ml
diff -u mldonkey/src/utils/net/ip_set.ml:1.23
mldonkey/src/utils/net/ip_set.ml:1.24
--- mldonkey/src/utils/net/ip_set.ml:1.23 Thu Jan 19 02:13:19 2006
+++ mldonkey/src/utils/net/ip_set.ml Wed Mar 1 20:06:50 2006
@@ -234,67 +234,66 @@
optimized_bl
let load filename =
- lprintf_nl () "loading %s" filename;
- if Sys.file_exists filename then
- let ext = String.lowercase (Filename2.extension filename) in
+ lprintf_nl () "loading %s" filename;
+ if Sys.file_exists filename then
let last_ext = String.lowercase (Filename2.last_extension filename) in
- let real_ext = if last_ext = ".zip" then
- last_ext
- else
- ext
- in
- match real_ext with
- ".zip" ->
- begin
- try
- let ic = Zip.open_in filename in
- try
- let file = Zip.find_entry ic "guarding.p2p" in
- Zip.close_in ic;
- lprintf_nl () "guarding.p2p found in zip file";
- let _ = Misc.archive_extract filename "zip" in
- load_merge bl_empty file.Zip.filename true
- with e ->
- begin
- try
- let file = Zip.find_entry ic "guarding_full.p2p" in
- Zip.close_in ic;
- lprintf_nl () "guarding_full.p2p found in zip file";
- let _ = Misc.archive_extract filename "zip" in
- load_merge bl_empty file.Zip.filename true
- with e ->
- Zip.close_in ic;
- lprintf_nl () "Exception %s while extracting
guarding.p2p/guarding_full.p2p from %s"
- (Printexc2.to_string e) filename;
- lprintf_nl () "One of the mentioned files has to be
present in the zip file";
- bl_empty
- end
- with e ->
- lprintf_nl () "Exception %s while opening %s"
- (Printexc2.to_string e) filename;
- bl_empty
- end
- | ".bz2" | ".p2p.bz2" | ".gz" | ".p2p.gz" ->
- begin
- let filetype =
- if ext = ".bz2" || ext = ".p2p.bz2" then "bz2" else "gz" in
- try
- let s = Misc.archive_extract filename filetype in
- load_merge bl_empty s true
- with e ->
- lprintf_nl () "Exception %s while extracting from %s"
- (Printexc2.to_string e) filename;
- bl_empty
- end
- | ".tar.bz2" | ".p2p.tar.bz2" | ".tar.gz" | ".p2p.tar.gz" ->
+ if last_ext = ".zip" then
+ let filenames_list =
+ ["guarding.p2p"; "guarding_full.p2p"; "ipfilter.dat"] in
+ (try
+ let ic = Zip.open_in filename in
+ try
+ let rec find_in_zip l =
+ match l with
+ | [] -> raise Not_found
+ | h :: q ->
+ try
+ let file = Zip.find_entry ic h in
+ lprintf_nl () "%s found in zip file" h;
+ ignore(Misc.archive_extract filename "zip");
+ load_merge bl_empty file.Zip.filename true
+ with Not_found ->
+ find_in_zip q in
+ let bl = find_in_zip filenames_list in
+ Zip.close_in ic;
+ bl
+ with e ->
+ Zip.close_in ic;
+ lprintf_nl () "Exception %s while extracting %s from %s"
+ (Printexc2.to_string e)
+ (String.concat "/" filenames_list)
+ filename;
+ lprintf_nl () "One of the mentioned files has to be present in the
zip file";
+ bl_empty
+ with e ->
+ lprintf_nl () "Exception %s while opening %s"
+ (Printexc2.to_string e)
+ filename;
+ bl_empty)
+ else
+ let ext = String.lowercase (Filename2.extension filename) in
+ match ext with
+ | ".bz2" | ".p2p.bz2" | ".dat.bz2"
+ | ".gz" | ".p2p.gz" | ".dat.gz" ->
+ let filetype =
+ if String2.check_suffix ext ".bz2" then "bz2" else "gz" in
+ (try
+ let s = Misc.archive_extract filename filetype in
+ load_merge bl_empty s true
+ with e ->
+ lprintf_nl () "Exception %s while extracting from %s"
+ (Printexc2.to_string e) filename;
+ bl_empty)
+ | ".tar.bz2" | ".p2p.tar.bz2" | ".dat.tar.bz2"
+ | ".tar.gz" | ".p2p.tar.gz" | ".dat.tar.gz" ->
lprintf_nl () "tar files are not (yet) supported, please untar %s"
filename;
bl_empty
- | _ -> load_merge bl_empty filename false
- else
- begin
- lprintf_nl () "file %s not found" filename;
- bl_empty
- end
+ | _ -> load_merge bl_empty filename false
+ else
+ begin
+ lprintf_nl () "file %s not found" filename;
+ bl_empty
+ end
let of_list l =
let rec of_list_aux l bl =
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/ip_set.ml,
mldonkey-commits <=