[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey config/Makefile.config.in config/Makef...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey config/Makefile.config.in config/Makef... |
Date: |
Fri, 12 May 2006 21:08:31 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Branch:
Changes by: spiralvoice <address@hidden> 06/05/12 21:08:31
Modified files:
config : Makefile.config.in Makefile.in configure.in
distrib : ChangeLog
src/daemon/common: commonComplexOptions.ml commonFile.ml
commonFile.mli commonGlobals.ml
commonShared.ml commonShared.mli
commonUploads.ml guiDecoding.ml
guiEncoding.ml guiTypes.ml
src/daemon/driver: driverCommands.ml driverInteractive.ml
driverMain.ml
src/networks/bittorrent: bTComplexOptions.ml bTGlobals.ml
bTInteractive.ml bTMain.ml bTShare.ml
bTTypes.ml
src/networks/donkey: donkeyShare.ml
src/networks/fileTP: fileTPInteractive.ml
src/utils/lib : autoconf.ml.new.in
Added files:
src/utils/lib : magic.ml.in magic_magic.ml magic_nomagic.ml
magiclib.ml magiclib.mli magiclib_stub.c
Log message:
patch #4976
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/config/Makefile.config.in.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/config/Makefile.in.diff?tr1=1.157&tr2=1.158&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/config/configure.in.diff?tr1=1.262&tr2=1.263&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.819&tr2=1.820&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.ml.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonFile.ml.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonFile.mli.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonShared.ml.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonShared.mli.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonUploads.ml.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiEncoding.ml.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiTypes.ml.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.138&tr2=1.139&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml.diff?tr1=1.72&tr2=1.73&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverMain.ml.diff?tr1=1.106&tr2=1.107&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTComplexOptions.ml.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTGlobals.ml.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml.diff?tr1=1.88&tr2=1.89&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTMain.ml.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTShare.ml.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTTypes.ml.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyShare.ml.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fileTP/fileTPInteractive.ml.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/autoconf.ml.new.in.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magic.ml.in?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magic_magic.ml?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magic_nomagic.ml?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magiclib.ml?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magiclib.mli?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/magiclib_stub.c?rev=1.1
Patches:
Index: mldonkey/config/Makefile.config.in
diff -u mldonkey/config/Makefile.config.in:1.58
mldonkey/config/Makefile.config.in:1.59
--- mldonkey/config/Makefile.config.in:1.58 Sat Feb 11 19:52:57 2006
+++ mldonkey/config/Makefile.config.in Fri May 12 21:08:30 2006
@@ -50,6 +50,7 @@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
Index: mldonkey/config/Makefile.in
diff -u mldonkey/config/Makefile.in:1.157 mldonkey/config/Makefile.in:1.158
--- mldonkey/config/Makefile.in:1.157 Tue May 9 16:31:37 2006
+++ mldonkey/config/Makefile.in Fri May 12 21:08:30 2006
@@ -193,6 +193,14 @@
$(LIB)/stubs_c.c $(LIB)/set2.ml $(LIB)/queues.ml \
$(LIB)/charsetstubs.c $(LIB)/charset.ml
+ifeq ("$(MAGIC)", "yes")
+ MAGIC_LIBS_flags += -cclib -lmagic
+ MAGIC_SRCS = $(LIB)/magiclib.ml $(LIB)/magic_magic.ml $(LIB)/magiclib_stub.c
+else
+ MAGIC_SRCS = $(LIB)/magic_nomagic.ml
+endif
+MAGIC_SRCS += $(LIB)/magic.ml
+
NET_SRCS = \
$(NET)/basicSocket.ml \
$(NET)/ip.ml $(NET)/ip_set.ml $(NET)/geoip.ml $(NET)/mailer.ml
$(NET)/base64.ml \
@@ -519,7 +527,7 @@
$(CDK_SRCS) $(LIB_SRCS) tools/mlsplit.ml
MAKE_TORRENT_SRCS = \
- $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS) \
+ $(MAGIC_SRCS) $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS) \
$(CHAT_SRCS) $(COMMON_SRCS) $(COMMON_CLIENT_SRCS) $(BITTORRENT_SRCS) \
tools/make_torrent.ml
@@ -562,16 +570,16 @@
ICONS_CMXA=icons.cmxa
CDK_CMXA=cdk.cmxa
-MLNET_CMXA=cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa
+MLNET_CMXA=$(CDK_CMXA) magic.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa
MLNET_SRCS= $(MAIN_SRCS)
ifeq ("$(GUI)", "newgui2")
mlnet+gui_CMXA= \
- cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
+ magic.cmxa cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
icons.cmxa guibase.cmxa gui.cmxa
else
mlnet+gui_CMXA= \
- cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
+ magic.cmxa cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
gmisc.cmxa icons.cmxa guibase.cmxa gui.cmxa
endif
@@ -749,6 +757,7 @@
$(COMMON)/commonTypes.ml \
$(COMMON)/commonOptions.ml \
$(COMMON)/commonMessages.ml \
+ $(COMMON)/commonUserDb.ml \
$(COMMON)/commonGlobals.ml \
$(COMMON)/commonWeb.ml \
$(COMMON)/commonHasher.ml \
@@ -1362,7 +1371,7 @@
runtop: top
./mldonkeytop $(INCLUDES)
-TOP_CMXA=cdk.cmxa common.cmxa client.cmxa core.cmxa
+TOP_CMXA+=cdk.cmxa magic.cmxa common.cmxa client.cmxa core.cmxa
TOP_SRCS=
define([[EXPAND_LIB]],[[
@@ -1403,7 +1412,7 @@
endif
-$1_CMXA= cdk.cmxa common.cmxa client.cmxa $1.cmxa driver.cmxa
+$1_CMXA+= cdk.cmxa magic.cmxa common.cmxa client.cmxa $1.cmxa driver.cmxa
ifeq ("$2", "DONKEY")
$1_SRCS+= $(CRYPTOPP_SRCS) $(MAIN_SRCS)
@@ -1438,6 +1447,7 @@
EXPAND_DRIVER(mlslsk,SOULSEEK,soulseek)
libcdk_SRCS= $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS)
+libmagic_SRCS= $(MAGIC_SRCS)
libcommon_SRCS= $(CHAT_SRCS) $(COMMON_SRCS)
libclient_SRCS= $(COMMON_CLIENT_SRCS)
ifeq ("$(GUI)", "newgui2")
@@ -1452,6 +1462,7 @@
EXPAND_LIB(libicons,icons)
EXPAND_LIB(libcdk,cdk)
+EXPAND_LIB(libmagic,magic)
EXPAND_LIB(libcommon,common)
EXPAND_LIB(libclient,client)
EXPAND_LIB(DRIVER,driver)
@@ -1506,17 +1517,43 @@
TMPSOURCES += $($1_ML4:.ml4=.ml) $($1_MLT:.mlt=.ml) $($1_MLP:.mlcpp=.ml)
$($1_MLL:.mll=.ml) $($1_MLY:.mly=.ml) $($1_MLY:.mly=.mli) $($1_ZOG:.zog=.ml)
$2: $($1_OBJS) $($1_CMXS) $($1_CMXAS)
- $(OCAMLOPT) -linkall $(PLUGIN_FLAG) -o address@hidden $($1_OBJS)
$(LIBS_opt) $(LIBS_flags) $($3_LIBS_opt) $($3_LIBS_flags) $($5_LIBS_opt)
$($5_LIBS_flags) $($6_LIBS_opt) $($6_LIBS_flags) -I build $($1_CMXAS)
$($1_CMXS)
+ $(OCAMLOPT) -linkall $(PLUGIN_FLAG) -o address@hidden \
+ $($1_OBJS) $(LIBS_opt) $(LIBS_flags) \
+ $($3_LIBS_opt) $($3_LIBS_flags) \
+ $($5_LIBS_opt) $($5_LIBS_flags) \
+ $($6_LIBS_opt) $($6_LIBS_flags) \
+ $($7_LIBS_opt) $($7_LIBS_flags) \
+ -I build $($1_CMXAS) $($1_CMXS)
$2.byte: $($1_OBJS) $($1_CMOS) $($1_CMAS)
- $(OCAMLC) -linkall -o address@hidden $($1_OBJS) $(LIBS_byte)
$(LIBS_flags) $($3_LIBS_byte) $($3_LIBS_flags) $($5_LIBS_byte) $($5_LIBS_flags)
$($6_LIBS_byte) $($6_LIBS_flags) -I build $($1_CMAS) $($1_CMOS)
+ $(OCAMLC) -linkall -o address@hidden \
+ $($1_OBJS) $(LIBS_byte) $(LIBS_flags) \
+ $($3_LIBS_byte) $($3_LIBS_flags) \
+ $($5_LIBS_byte) $($5_LIBS_flags) \
+ $($6_LIBS_byte) $($6_LIBS_flags) \
+ $($7_LIBS_byte) $($7_LIBS_flags) \
+ -I build $($1_CMAS) $($1_CMOS)
$2.static: $($1_OBJS) $($1_CMXS) $($1_CMXAS)
- $(OCAMLOPT) -linkall $(PLUGIN_FLAG) -ccopt -static -o address@hidden
$($1_OBJS) $(LIBS_opt) $(LIBS_flags) $($3_LIBS_flags) $($3_STATIC_LIBS_opt)
$($5_LIBS_flags) $($5_STATIC_LIBS_opt) $($6_LIBS_flags) $($6_STATIC_LIBS_opt)
-I build $($1_CMXAS) $($1_CMXS)
+ $(OCAMLOPT) -linkall $(PLUGIN_FLAG) -ccopt -static -o address@hidden \
+ $($1_OBJS) $(LIBS_opt) $(LIBS_flags) \
+ $($3_LIBS_flags) $($3_STATIC_LIBS_opt) \
+ $($5_LIBS_flags) $($5_STATIC_LIBS_opt) \
+ $($6_LIBS_flags) $($6_STATIC_LIBS_opt) \
+ $($7_LIBS_flags) $($7_STATIC_LIBS_opt) \
+ -I build $($1_CMXAS) $($1_CMXS)
]])
-EXPAND(mldonkey,mldonkey,NO,mldonkey,GD,CRYPTOPP)
-EXPAND(mldonkey+gui,mldonkey+gui,GTK,mldonkey+gui,GD,CRYPTOPP)
+# $1 = source-code collection
+# $2 = make target
+# $3 = GUI type (NO/GTK)
+# $4 = not used
+# $5 = if set link GD code
+# $6 = if set link CryptoPP code (only for targets mlnet, mldonkey)
+# $7 = if set link libmagic code (only for p2p core, not for GUIs, tools etc.)
+
+EXPAND(mldonkey,mldonkey,NO,mldonkey,GD,CRYPTOPP,MAGIC)
+EXPAND(mldonkey+gui,mldonkey+gui,GTK,mldonkey+gui,GD,CRYPTOPP,MAGIC)
EXPAND(MLPROGRESS, mlprogress,GTK, MLPROGRESS)
EXPAND(MLDONKEYGUI,mlgui,GTK,MLDONKEYGUI)
@@ -1524,31 +1561,31 @@
EXPAND(MLDONKEYGUI2,mlgui2,GTK,MLDONKEYGUI2)
endif
-EXPAND(mldc,mldc,NO,mldc,GD)
-EXPAND(mldc+gui,mldc+gui,GTK,mldc+gui,GD)
-EXPAND(mlnap,mlnap,NO,mlnap,GD)
-EXPAND(mlnap+gui,mlnap+gui,GTK,mlnap+gui,GD)
-EXPAND(MLNET,mlnet,NO,MLNET,GD,CRYPTOPP)
-EXPAND(mlnet+gui,mlnet+gui,GTK,mlnet+gui,GD,CRYPTOPP)
-EXPAND(mlgnut,mlgnut,NO,mlgnut,GD)
-EXPAND(mlgnut+gui,mlgnut+gui,GTK,mlgnut+gui,GD)
-EXPAND(mlg2,mlg2,NO,mlg2,GD)
-EXPAND(mlg2+gui,mlg2+gui,GTK,mlg2+gui,GD)
-EXPAND(mlbt,mlbt,NO,mlbt,GD)
-EXPAND(mlbt+gui,mlbt+gui,GTK,mlbt+gui,GD)
-EXPAND(mlfasttrack,mlfasttrack,NO,mlfasttrack,GD)
-EXPAND(mlfasttrack+gui,mlfasttrack+gui,GTK,mlfasttrack+gui,GD)
-EXPAND(mlfileTP,mlfiletp,NO,mlfileTP,GD)
-EXPAND(mlfileTP+gui,mlfiletp+gui,GTK,mlfileTP+gui,GD)
-EXPAND(mlslsk,mlslsk,NO,mlslsk,GD)
-EXPAND(mlslsk+gui,mlslsk+gui,GTK,mlslsk+gui,GD)
+EXPAND(mldc,mldc,NO,mldc,GD,NO,MAGIC)
+EXPAND(mldc+gui,mldc+gui,GTK,mldc+gui,GD,NO,MAGIC)
+EXPAND(mlnap,mlnap,NO,mlnap,GD,NO,MAGIC)
+EXPAND(mlnap+gui,mlnap+gui,GTK,mlnap+gui,GD,NO,MAGIC)
+EXPAND(MLNET,mlnet,NO,MLNET,GD,CRYPTOPP,MAGIC)
+EXPAND(mlnet+gui,mlnet+gui,GTK,mlnet+gui,GD,CRYPTOPP,MAGIC)
+EXPAND(mlgnut,mlgnut,NO,mlgnut,GD,NO,MAGIC)
+EXPAND(mlgnut+gui,mlgnut+gui,GTK,mlgnut+gui,GD,NO,MAGIC)
+EXPAND(mlg2,mlg2,NO,mlg2,GD,NO,MAGIC)
+EXPAND(mlg2+gui,mlg2+gui,GTK,mlg2+gui,GD,NO,MAGIC)
+EXPAND(mlbt,mlbt,NO,mlbt,GD,NO,MAGIC)
+EXPAND(mlbt+gui,mlbt+gui,GTK,mlbt+gui,GD,NO,MAGIC)
+EXPAND(mlfasttrack,mlfasttrack,NO,mlfasttrack,GD,NO,MAGIC)
+EXPAND(mlfasttrack+gui,mlfasttrack+gui,GTK,mlfasttrack+gui,GD,NO,MAGIC)
+EXPAND(mlfileTP,mlfiletp,NO,mlfileTP,GD,NO,MAGIC)
+EXPAND(mlfileTP+gui,mlfiletp+gui,GTK,mlfileTP+gui,GD,NO,MAGIC)
+EXPAND(mlslsk,mlslsk,NO,mlslsk,GD,NO,MAGIC)
+EXPAND(mlslsk+gui,mlslsk+gui,GTK,mlslsk+gui,GD,NO,MAGIC)
EXPAND(MLDONKEY_IM,mlim,GTK,MLDONKEY_IM)
EXPAND(STARTER,mlguistarter,GTK)
EXPAND(MLCHAT,mlchat,GTK,MLCHAT)
EXPAND(OBSERVER,observer)
EXPAND(MLD_HASH,mld_hash)
EXPAND(OCAMLPP,ocamlpp)
-EXPAND(MAKE_TORRENT,make_torrent)
+EXPAND(MAKE_TORRENT,make_torrent,NO,NO,NO,NO,MAGIC)
EXPAND(SUBCONV,subconv)
EXPAND(MLSPLIT,mlsplit)
EXPAND(CONTESTER,contester,CRYPT)
@@ -1590,8 +1627,12 @@
TMPSOURCES += $(TOP_ML4:.ml4=.ml) $(TOP_MLL:.mll=.ml) $(TOP_MLY:.mly=.ml)
$(TOP_MLY:.mly=.mli) $(TOP_ZOG:.zog=.ml)
mldonkeytop: $(TOP_OBJS) $(TOP_CMOS) $(TOP_CMAS)
- $(OCAMLMKTOP) -linkall $(PLUGIN_FLAG) -o $@ $(TOP_OBJS) $(LIBS_byte)
$(LIBS_flags) $(_LIBS_byte) $(_LIBS_flags) $(CRYPTOPP_LIBS_byte)
$(CRYPTOPP_LIBS_flags) -I build $(TOP_CMAS) $(TOP_CMOS)
-
+ $(OCAMLMKTOP) -linkall $(PLUGIN_FLAG) -o $@ \
+ $(TOP_OBJS) \
+ $(LIBS_byte) $(LIBS_flags) $(_LIBS_byte) $(_LIBS_flags) \
+ $(CRYPTOPP_LIBS_byte) $(CRYPTOPP_LIBS_flags) \
+ $(MAGIC_LIBS_byte) $(MAGIC_LIBS_flags) \
+ -I build $(TOP_CMAS) $(TOP_CMOS)
#######################################################################
@@ -1699,6 +1740,7 @@
rm -f src/utils/lib/autoconf.ml.new
rm -f src/utils/lib/gAutoconf.ml
rm -f src/utils/lib/gAutoconf.ml.new
+ rm -f src/utils/lib/magic.ml
rm -f src/utils/lib/misc2.ml
rm -f src/utils/cdk/tar.ml
rm -f icons/tux/*.ml_icons
Index: mldonkey/config/configure.in
diff -u mldonkey/config/configure.in:1.262 mldonkey/config/configure.in:1.263
--- mldonkey/config/configure.in:1.262 Fri May 5 22:52:26 2006
+++ mldonkey/config/configure.in Fri May 12 21:08:30 2006
@@ -253,6 +253,9 @@
BZIP2=yes
AC_ARG_ENABLE(bzip2, [ --disable-bzip2 disable the use of
bzip2], [BZIP2="$enableval"])
+MAGIC=yes
+AC_ARG_ENABLE(magic, [ --disable-magic disable the use of
libmagic (GNU file)], [MAGIC="$enableval"])
+
ifelse(AC_ACVERSION, [2.13], [],
[dnl Large file enabled
AC_SYS_LARGEFILE
@@ -594,6 +597,16 @@
AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
fi
+if test "$MAGIC" != "no"; then
+
AC_CHECK_HEADERS(magic.h,[AC_CHECK_LIB(magic,magic_file,[MAGIC=yes],[MAGIC=no])],[MAGIC=no])
+fi
+
+if test "$MAGIC" = "yes"; then
+ MAGICLIB=Magic_magic
+else
+ MAGICLIB=Magic_nomagic
+fi
+
AC_CHECK_HEADERS(byteswap.h,,)
if test "$ICONV" = "yes"; then
@@ -1238,6 +1251,8 @@
AC_SUBST(GD_CFLAGS)
AC_SUBST(GD_LDFLAGS)
AC_SUBST(BZIP2)
+AC_SUBST(MAGIC)
+AC_SUBST(MAGICLIB)
BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
AC_SUBST(BUILD_SYSTEM)
@@ -1253,6 +1268,7 @@
Makefile.config \
mldonkey.rc \
$AUTOCONF.new $GTK_AUTOCONF.new \
+ ../src/utils/lib/magic.ml \
../src/networks/donkey/donkeySui.ml \
../src/daemon/driver/driverGraphics.ml \
../packages/rpm/mldonkey.spec \
@@ -1372,6 +1388,13 @@
echo " disabled"
fi
+echo -n " - libmagic "
+if test "$MAGIC" = "yes"; then
+ echo "enabled"
+else
+ echo " disabled"
+fi
+
echo -n " - graphical stats "
if test "$GD" = "yes"; then
echo "enabled"
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.819 mldonkey/distrib/ChangeLog:1.820
--- mldonkey/distrib/ChangeLog:1.819 Fri May 12 21:02:38 2006
+++ mldonkey/distrib/ChangeLog Fri May 12 21:08:30 2006
@@ -15,6 +15,10 @@
=========
2006/05/12
+4976: Filetype recognition with libmagic
+- new debug command: debug_dir, prints magic values for all files
+- display file magic values in vd & upstats HTML popup & vd #num
+
5088: Gnutella/FT/http_client fixes (zet)
- Gnutella (G1) is working again
Index: mldonkey/src/daemon/common/commonComplexOptions.ml
diff -u mldonkey/src/daemon/common/commonComplexOptions.ml:1.52
mldonkey/src/daemon/common/commonComplexOptions.ml:1.53
--- mldonkey/src/daemon/common/commonComplexOptions.ml:1.52 Mon Apr 3
20:50:08 2006
+++ mldonkey/src/daemon/common/commonComplexOptions.ml Fri May 12 21:08:30 2006
@@ -99,18 +99,20 @@
normalize_time (get_value "file_age" value_to_int)
with _ -> ());
set_file_state file file_state;
- if !verbose then
- (match file_state with
- FileDownloading -> lprintf_nl () "New downloading file - check
complete";
- | FileDownloaded -> lprintf_nl () "New downloaded file - check
complete";
- | _ -> lprintf_nl () "New file with other state - check complete"
- );
-
+
(try
set_file_best_name file
(get_value "file_filename" value_to_string)
with _ -> ());
set_file_priority file priority;
+
+ if !verbose then lprintf_nl () "New %s file %s"
+ (match file_state with
+ FileDownloading -> "downloading"
+ | FileDownloaded -> "downloaded"
+ | _ -> "other")
+ (file_best_name file);
+
file
| _ -> assert false
Index: mldonkey/src/daemon/common/commonFile.ml
diff -u mldonkey/src/daemon/common/commonFile.ml:1.50
mldonkey/src/daemon/common/commonFile.ml:1.51
--- mldonkey/src/daemon/common/commonFile.ml:1.50 Mon Jan 16 16:05:14 2006
+++ mldonkey/src/daemon/common/commonFile.ml Fri May 12 21:08:30 2006
@@ -58,6 +58,7 @@
mutable impl_file_last_received : (int64 * int) list;
mutable impl_file_last_rate : float;
mutable impl_file_best_name : string;
+ mutable impl_file_magic : string option;
mutable impl_file_priority: int; (* normal = 0, low < 0, high > 0 *)
mutable impl_file_last_seen : int;
mutable impl_file_probable_name : string option;
@@ -128,6 +129,7 @@
impl_file_last_received = [];
impl_file_last_rate = 0.0;
impl_file_best_name = "<UNKNOWN>";
+ impl_file_magic = None;
impl_file_priority = 0;
impl_file_last_seen = 0;
impl_file_comment = "";
@@ -442,6 +444,14 @@
file_must_update file
end
+let file_magic file =
+ (as_file_impl file).impl_file_magic
+
+let set_file_magic file magic =
+ match magic with
+ None -> ()
+ | Some magic -> (as_file_impl file).impl_file_magic <- Some (HashMagic.merge
files_magic magic)
+
let set_file_last_seen file age =
let impl = as_file_impl file in
impl.impl_file_last_seen <- age
@@ -614,6 +624,13 @@
info.G.file_chunks
) ];
+ (match file_magic file with
+ Some magic ->
+ Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-2\\\"\\>";
+ html_mods_td buf [
+ ("File type computed by libmagic", "sr br", "File magic");
+ ("", "sr", magic) ]
+ | _ -> ());
file_print_html file buf;
@@ -622,10 +639,13 @@
end else
begin
- Printf.bprintf buf "[%-s %5d]\n%s\n%s\nTotal %10s\nPartial
%10s\npriority %d\n"
+ Printf.bprintf buf "[%-s %5d]\n%s\n%s%s\nTotal %10s\nPartial
%10s\npriority %d\n"
n.network_name
(file_num file)
(String2.shorten 80 (file_best_name file))
+ (match file_magic file with
+ Some magic -> Printf.sprintf "%s\n" magic
+ | None -> "")
(string_of_uids info.G.file_uids)
(Int64.to_string info.G.file_size)
(Int64.to_string info.G.file_downloaded)
@@ -867,6 +887,9 @@
) files_by_num;
Printf.bprintf buf " files: %d\n" !counter;
Printf.bprintf buf " files_ops: %d\n" (List.length !files_ops);
+ let counter = ref 0 in
+ HashMagic.iter (fun _ -> incr counter) files_magic;
+ Printf.bprintf buf " files_magic: %d\n" !counter;
)
Index: mldonkey/src/daemon/common/commonFile.mli
diff -u mldonkey/src/daemon/common/commonFile.mli:1.13
mldonkey/src/daemon/common/commonFile.mli:1.14
--- mldonkey/src/daemon/common/commonFile.mli:1.13 Mon Jan 16 16:05:14 2006
+++ mldonkey/src/daemon/common/commonFile.mli Fri May 12 21:08:30 2006
@@ -33,6 +33,7 @@
mutable impl_file_last_received : (int64 * int) list;
mutable impl_file_last_rate : float;
mutable impl_file_best_name : string;
+ mutable impl_file_magic : string option;
mutable impl_file_priority : int;
mutable impl_file_last_seen : int;
mutable impl_file_probable_name : string option;
@@ -116,6 +117,8 @@
val file_debug : CommonTypes.file -> string
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 recover_bytes : CommonTypes.file -> (int64 * int64) list
val file_write : CommonTypes.file -> int64 -> string -> int -> int -> unit
Index: mldonkey/src/daemon/common/commonGlobals.ml
diff -u mldonkey/src/daemon/common/commonGlobals.ml:1.63
mldonkey/src/daemon/common/commonGlobals.ml:1.64
--- mldonkey/src/daemon/common/commonGlobals.ml:1.63 Mon Apr 3 20:50:08 2006
+++ mldonkey/src/daemon/common/commonGlobals.ml Fri May 12 21:08:30 2006
@@ -865,3 +865,10 @@
activity := new_activity ()
)
+module HashMagic = Weak.Make(struct
+ type t = string
+ let hash s = Hashtbl.hash s
+ let equal x y = x = y
+ end)
+
+let files_magic = HashMagic.create 100
Index: mldonkey/src/daemon/common/commonShared.ml
diff -u mldonkey/src/daemon/common/commonShared.ml:1.30
mldonkey/src/daemon/common/commonShared.ml:1.31
--- mldonkey/src/daemon/common/commonShared.ml:1.30 Fri Mar 17 18:11:24 2006
+++ mldonkey/src/daemon/common/commonShared.ml Fri May 12 21:08:30 2006
@@ -43,6 +43,7 @@
mutable impl_shared_size : int64;
mutable impl_shared_id : Md4.t;
mutable impl_shared_requests : int;
+ mutable impl_shared_magic : string option
}
and 'a shared_ops = {
@@ -131,8 +132,6 @@
let files_scanned_size = ref zero
let new_shared dirname prio filename fullname =
-(* lprintf "XXXXXXX\ndirname %s \nfilename %s \nfullname %s\n"
- dirname filename fullname; *)
let fullname = Filename2.normalize fullname in
let filename = Filename2.normalize filename in
let dirname = try
@@ -209,6 +208,7 @@
impl_shared_size = zero;
impl_shared_id = Md4.null;
impl_shared_requests = 0;
+ impl_shared_magic = None;
}
Index: mldonkey/src/daemon/common/commonShared.mli
diff -u mldonkey/src/daemon/common/commonShared.mli:1.5
mldonkey/src/daemon/common/commonShared.mli:1.6
--- mldonkey/src/daemon/common/commonShared.mli:1.5 Mon Aug 8 16:47:30 2005
+++ mldonkey/src/daemon/common/commonShared.mli Fri May 12 21:08:30 2006
@@ -9,6 +9,7 @@
mutable impl_shared_size : int64;
mutable impl_shared_id : Md4.Md4.t;
mutable impl_shared_requests : int;
+ mutable impl_shared_magic : string option
}
and 'a shared_ops = {
mutable op_shared_info : 'a -> GuiTypes.shared_info;
Index: mldonkey/src/daemon/common/commonUploads.ml
diff -u mldonkey/src/daemon/common/commonUploads.ml:1.41
mldonkey/src/daemon/common/commonUploads.ml:1.42
--- mldonkey/src/daemon/common/commonUploads.ml:1.41 Sun Feb 5 13:17:40 2006
+++ mldonkey/src/daemon/common/commonUploads.ml Fri May 12 21:08:30 2006
@@ -690,6 +690,7 @@
impl_shared_ops = shared_ops;
impl_shared_val = sh;
impl_shared_requests = 0;
+ impl_shared_magic = None
}
and sh = {
shared_info = index;
Index: mldonkey/src/daemon/common/guiDecoding.ml
diff -u mldonkey/src/daemon/common/guiDecoding.ml:1.53
mldonkey/src/daemon/common/guiDecoding.ml:1.54
--- mldonkey/src/daemon/common/guiDecoding.ml:1.53 Fri Mar 17 18:33:16 2006
+++ mldonkey/src/daemon/common/guiDecoding.ml Fri May 12 21:08:30 2006
@@ -509,7 +509,7 @@
get_list (fun s pos ->
let name, pos = get_string s pos in
let size, pos = get_int64 s pos, pos+8 in
- (name, size), pos
+ (name, size, Some ""), pos
) s pos
let get_file proto s pos =
Index: mldonkey/src/daemon/common/guiEncoding.ml
diff -u mldonkey/src/daemon/common/guiEncoding.ml:1.51
mldonkey/src/daemon/common/guiEncoding.ml:1.52
--- mldonkey/src/daemon/common/guiEncoding.ml:1.51 Wed Mar 29 15:41:33 2006
+++ mldonkey/src/daemon/common/guiEncoding.ml Fri May 12 21:08:30 2006
@@ -541,7 +541,7 @@
buf_string buf x
let buf_sub_files buf l =
- buf_list buf (fun buf (name, size) ->
+ buf_list buf (fun buf (name, size, _) ->
buf_string buf name;
buf_int64 buf size
) l
Index: mldonkey/src/daemon/common/guiTypes.ml
diff -u mldonkey/src/daemon/common/guiTypes.ml:1.26
mldonkey/src/daemon/common/guiTypes.ml:1.27
--- mldonkey/src/daemon/common/guiTypes.ml:1.26 Mon Jan 16 16:05:14 2006
+++ mldonkey/src/daemon/common/guiTypes.ml Fri May 12 21:08:30 2006
@@ -142,7 +142,7 @@
mutable file_last_seen : int;
mutable file_priority : int;
mutable file_uids : Uid.t list;
- mutable file_sub_files : (string * int64) list;
+ mutable file_sub_files : (string * int64 * string option) list;
}
type user_info = {
@@ -246,7 +246,7 @@
mutable shared_uploaded : int64;
mutable shared_requests : int;
mutable shared_uids : Uid.t list; (* net file UID *)
- mutable shared_sub_files : (string * int64) list;
+ mutable shared_sub_files : (string * int64 * string option) list;
}
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.138
mldonkey/src/daemon/driver/driverCommands.ml:1.139
--- mldonkey/src/daemon/driver/driverCommands.ml:1.138 Thu May 11 21:24:41 2006
+++ mldonkey/src/daemon/driver/driverCommands.ml Fri May 12 21:08:30 2006
@@ -2044,6 +2044,23 @@
_s ""
), "debug command (example: disk .)";
+ "debug_dir", Arg_one (fun arg o ->
+ let buf = o.conn_buf in
+ let filelist = Unix2.list_directory arg in
+ Printf.bprintf buf "%d entries in dir %s\n" (List.length filelist)
arg;
+ List.iter (fun file ->
+ Printf.bprintf buf "%s\n %s\nMime %s\n\n"
+ file
+ (match Magic.M.magic_fileinfo (Filename.concat arg file) false with
+ None -> "unknown"
+ | Some fileinfo -> fileinfo)
+ (match Magic.M.magic_fileinfo (Filename.concat arg file) true with
+ None -> "unknown"
+ | Some fileinfo -> fileinfo)
+ ) filelist;
+ _s ""
+ ), "debug command (example: disk .)";
+
"debug_fileinfo", Arg_one (fun arg o ->
let buf = o.conn_buf in
(try
@@ -2285,10 +2302,9 @@
(if !!html_mods_use_js_tooltips then
Printf.bprintf buf "
onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%s\\\\\')',%d);setTimeout('hideLayer()',%d);return
true;\\\"
onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
(Http_server.html_real_escaped (Filename.basename
impl.impl_shared_codedname))
-(* (match file_magic (file_find file.file_num) with
+ (match impl.impl_shared_magic with
None -> ""
- | Some magic -> "File type: " ^ magic ^ "<br>") *)
- ""
+ | Some magic -> "File type: " ^ magic ^ "<br>")
!!html_mods_js_tooltips_wait
!!html_mods_js_tooltips_timeout
!!html_mods_js_tooltips_wait
Index: mldonkey/src/daemon/driver/driverInteractive.ml
diff -u mldonkey/src/daemon/driver/driverInteractive.ml:1.72
mldonkey/src/daemon/driver/driverInteractive.ml:1.73
--- mldonkey/src/daemon/driver/driverInteractive.ml:1.72 Wed Mar 29
15:41:33 2006
+++ mldonkey/src/daemon/driver/driverInteractive.ml Fri May 12 21:08:30 2006
@@ -125,6 +125,23 @@
close_log ()
end
+let file_magic_check () =
+ if !Autoconf.magic_works then begin
+ if !verbose then lprintf_nl () "computing file magic values";
+ let check_magic file =
+ match Magic.M.magic_fileinfo (file_disk_name file) false with
+ None -> ()
+ | Some magic -> set_file_magic file (Some magic)
+ in
+ List.iter (fun file ->
+ let magic = file_magic file in
+ match magic with
+ None -> check_magic file
+ | Some magic when magic = "data" -> check_magic file
+ | _ -> ()
+ ) !!files
+ end
+
(* ripped from gui_downloads *)
let calc_file_eta f =
@@ -669,8 +686,11 @@
[|
(if !!html_mods_use_js_tooltips then
Printf.sprintf "
-
onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>File#:
%d<br>Network: %s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\"
onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
+
onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%sFile#:
%d<br>Network: %s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\"
onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
(Http_server.html_real_escaped file.file_name)
+ (match file_magic (file_find file.file_num) with
+ None -> ""
+ | Some magic -> "File type: " ^ magic ^ "<br>")
file.file_num
(net_name file)
!!html_mods_js_tooltips_wait
@@ -1774,6 +1794,14 @@
^ (if Autoconf.has_gd && not Autoconf.has_gd_png &&
Autoconf.has_gd_jpg then " gd(jpg)" else "")
^ (if not Autoconf.has_gd then " no-gd" else "")
^ (if Autoconf.has_iconv then " iconv" else " no-iconv")
+ ^ (if Autoconf.magic then
+ begin
+ if !Autoconf.magic_works then
+ " magic(active)"
+ else
+ " magic(inactive)"
+ end
+ else " no-magic")
^ (if Autoconf.check_bounds then " check-bounds" else "
no-check-bounds")
)
in
@@ -1814,6 +1842,12 @@
^ (Printf.sprintf "\nIP blocking local: %d ranges, web: %d ranges"
(Ip_set.bl_length !CommonBlocking.ip_blocking_list)
(Ip_set.bl_length !CommonBlocking.web_ip_blocking_list))
+ ^ (if Autoconf.magic then
+ if !Autoconf.magic_works then
+ Printf.sprintf "\nLibmagic:\t file-type recognition database
present"
+ else
+ Printf.sprintf "\nLibmagic:\t file-type recognition database not
present"
+ else "")
^ (if not !dns_works then
Printf.sprintf "\nDNS:\t\t DNS resolution not available, web_infos
%s not work"
(if Autoconf.bittorrent = "yes" then "and BT does" else "do")
Index: mldonkey/src/daemon/driver/driverMain.ml
diff -u mldonkey/src/daemon/driver/driverMain.ml:1.106
mldonkey/src/daemon/driver/driverMain.ml:1.107
--- mldonkey/src/daemon/driver/driverMain.ml:1.106 Sun Apr 9 00:27:03 2006
+++ mldonkey/src/daemon/driver/driverMain.ml Fri May 12 21:08:30 2006
@@ -69,6 +69,7 @@
let minute_timer () =
DriverInteractive.hdd_check ();
+ DriverInteractive.file_magic_check ();
CommonShared.shared_check_files ();
CommonUploads.upload_credit_timer ();
CommonInteractive.force_download_quotas ();
@@ -417,12 +418,26 @@
or getting a binary compiled with glibc %s.\n\n")
real_glibc_version Autoconf.glibc_version Autoconf.glibc_version
);
+ (
+ if Autoconf.magic then
+ if Magic.M.magic_works () then
+ begin
+ Autoconf.magic_works := true;
+ lprintf_nl () (_b "Libmagic file-type recognition database present")
+ end
+ else
+ begin
+ Autoconf.magic_works := false;
+ lprintf_nl () (_b "Libmagic file-type recognition database not
present")
+ end
+ );
load_config ();
add_infinite_option_timer download_sample_rate CommonFile.sample_timer;
(* lprintf "(1) CommonComplexOptions.load\n"; *)
CommonComplexOptions.load ();
+ DriverInteractive.file_magic_check ();
CommonUploads.load ();
(* lprintf "(2) CommonComplexOptions.load done\n"; *)
Index: mldonkey/src/networks/bittorrent/bTComplexOptions.ml
diff -u mldonkey/src/networks/bittorrent/bTComplexOptions.ml:1.31
mldonkey/src/networks/bittorrent/bTComplexOptions.ml:1.32
--- mldonkey/src/networks/bittorrent/bTComplexOptions.ml:1.31 Sun Apr 9
00:27:03 2006
+++ mldonkey/src/networks/bittorrent/bTComplexOptions.ml Fri May 12
21:08:30 2006
@@ -254,7 +254,7 @@
("file_hashes", array_to_value
(to_value Sha1.option) file.file_chunks) ::
("file_files", list_to_value
- (fun (name, p1) ->
+ (fun (name, p1, _) ->
SmallList [string_to_value name; int64_to_value p1])
file.file_files) ::
assocs
Index: mldonkey/src/networks/bittorrent/bTGlobals.ml
diff -u mldonkey/src/networks/bittorrent/bTGlobals.ml:1.56
mldonkey/src/networks/bittorrent/bTGlobals.ml:1.57
--- mldonkey/src/networks/bittorrent/bTGlobals.ml:1.56 Fri May 5 22:02:37 2006
+++ mldonkey/src/networks/bittorrent/bTGlobals.ml Fri May 12 21:08:30 2006
@@ -235,7 +235,7 @@
file_swarmer = None;
file_trackers = [];
file_chunks = t.torrent_pieces;
- file_files = t.torrent_files;
+ file_files = (List.map (fun (file,size) -> (file,size,None))
t.torrent_files);
file_blocks_downloaded = [];
file_uploaded = Int64.zero;
file_torrent_diskname = torrent_diskname;
Index: mldonkey/src/networks/bittorrent/bTInteractive.ml
diff -u mldonkey/src/networks/bittorrent/bTInteractive.ml:1.88
mldonkey/src/networks/bittorrent/bTInteractive.ml:1.89
--- mldonkey/src/networks/bittorrent/bTInteractive.ml:1.88 Sun Apr 9
00:27:03 2006
+++ mldonkey/src/networks/bittorrent/bTInteractive.ml Fri May 12 21:08:30 2006
@@ -110,7 +110,9 @@
(* During the commit operation, for security, the file_fd is destroyed. So
we create it again to be able to share this file again. *)
- set_file_fd (as_file file) (create_temp_file new_name file.file_files
(file_state file));
+ set_file_fd
+ (as_file file)
+ (create_temp_file new_name (List.map (fun (file,size,_) ->
(file,size)) file.file_files) (file_state file));
if Unix32.destroyed (file_fd file) then
lprintf_nl () "op_file_commit: FD is destroyed... could not repair!";
@@ -263,12 +265,17 @@
print_first_tracker file.file_trackers;
let cntr = ref 0 in
- List.iter (fun (filename, size) ->
+ List.iter (fun (filename, size, magic) ->
Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr
());
let fs = Printf.sprintf "File %d" !cntr in
+ let magic_string =
+ match magic with
+ None -> ""
+ | Some magic -> Printf.sprintf " / %s" magic
+ in
html_mods_td buf [
(fs, "sr br", fs);
- ("", "sr", (Printf.sprintf "%s (%Ld bytes)" filename size))
+ ("", "sr", (Printf.sprintf "%s (%Ld bytes)%s" filename size
magic_string))
];
incr cntr;
) file.file_files
@@ -619,6 +626,32 @@
lprintf_nl () "ft_retry: exception %s" (Printexc2.to_string e)
) ft_by_num
+let file_magic_check () =
+ if !Autoconf.magic_works then begin
+ if !verbose then lprintf_nl () "computing sub_file magic values";
+ let check_magic file =
+ match Magic.M.magic_fileinfo file false with
+ None -> None
+ | Some s -> Some (HashMagic.merge CommonGlobals.files_magic s)
+ in
+ Hashtbl.iter (fun _ file ->
+ let updated = ref false in
+ let new_file_files = ref [] in
+ List.iter (fun (filename, size, magic) ->
+ let subfile = Filename.concat (file_disk_name file) filename in
+ let new_magic =
+ match magic with
+ None -> check_magic subfile
+ | Some magic when magic = "data" || magic = "empty" -> check_magic
subfile
+ | _ -> magic
+ in
+ if new_magic <> magic then updated := true;
+ new_file_files := (filename, size, new_magic) :: !new_file_files
+ ) file.file_files;
+ if !updated then file.file_files <- !new_file_files
+ ) files_by_uid
+ end
+
let load_torrent_from_web r ft =
if !verbose then
lprintf_nl () "Loading torrent from web";
Index: mldonkey/src/networks/bittorrent/bTMain.ml
diff -u mldonkey/src/networks/bittorrent/bTMain.ml:1.19
mldonkey/src/networks/bittorrent/bTMain.ml:1.20
--- mldonkey/src/networks/bittorrent/bTMain.ml:1.19 Sun Mar 5 10:40:04 2006
+++ mldonkey/src/networks/bittorrent/bTMain.ml Fri May 12 21:08:30 2006
@@ -110,6 +110,7 @@
BTClients.recover_files ();
add_session_timer enabler 60.0 (fun timer ->
BTClients.recover_files ();
+ BTInteractive.file_magic_check ()
);
add_session_timer enabler 120.0 (fun timer ->
@@ -125,6 +126,7 @@
) !current_files;
);
+ BTInteractive.file_magic_check ();
BTClients.listen ();
()
Index: mldonkey/src/networks/bittorrent/bTShare.ml
diff -u mldonkey/src/networks/bittorrent/bTShare.ml:1.2
mldonkey/src/networks/bittorrent/bTShare.ml:1.3
--- mldonkey/src/networks/bittorrent/bTShare.ml:1.2 Thu Apr 7 16:02:50 2005
+++ mldonkey/src/networks/bittorrent/bTShare.ml Fri May 12 21:08:30 2006
@@ -44,6 +44,7 @@
impl_shared_ops = shared_ops;
impl_shared_val = file;
impl_shared_requests = 0;
+ impl_shared_magic = None;
} in
file.file_shared <- Some impl;
incr CommonGlobals.nshared_files;
Index: mldonkey/src/networks/bittorrent/bTTypes.ml
diff -u mldonkey/src/networks/bittorrent/bTTypes.ml:1.33
mldonkey/src/networks/bittorrent/bTTypes.ml:1.34
--- mldonkey/src/networks/bittorrent/bTTypes.ml:1.33 Sun Apr 9 00:27:03 2006
+++ mldonkey/src/networks/bittorrent/bTTypes.ml Fri May 12 21:08:30 2006
@@ -248,7 +248,7 @@
mutable file_clients : ((Ip.t*int), client) Hashtbl.t ;
mutable file_clients_num : int ;
mutable file_chunks : Sha1.t array;
- mutable file_files : (string * int64) list;
+ mutable file_files : (string * int64 * string option) list;
mutable file_blocks_downloaded : int list;
(* vvv probably a network specific value vvv ?what about file_downloaded?*)
mutable file_uploaded : int64;
Index: mldonkey/src/networks/donkey/donkeyShare.ml
diff -u mldonkey/src/networks/donkey/donkeyShare.ml:1.41
mldonkey/src/networks/donkey/donkeyShare.ml:1.42
--- mldonkey/src/networks/donkey/donkeyShare.ml:1.41 Sun Apr 9 00:27:03 2006
+++ mldonkey/src/networks/donkey/donkeyShare.ml Fri May 12 21:08:30 2006
@@ -48,9 +48,16 @@
| Some _ -> ()
| None ->
new_shared := true;
+ let full_name = file_disk_name file in
+ let magic =
+ match Magic.M.magic_fileinfo full_name false with
+ None -> None
+ | Some magic -> Some (HashMagic.merge files_magic magic)
+ in
+
let impl = {
impl_shared_update = 1;
- impl_shared_fullname = file_disk_name file;
+ impl_shared_fullname = full_name;
impl_shared_codedname = codedname;
impl_shared_size = file_size file;
impl_shared_id = file.file_md4;
@@ -59,6 +66,7 @@
impl_shared_ops = shared_ops;
impl_shared_val = file;
impl_shared_requests = 0;
+ impl_shared_magic = magic;
} in
file.file_shared <- Some impl;
new_shared_files := file :: !new_shared_files;
@@ -268,6 +276,7 @@
lprintf "Searching %s" fullname; lprint_newline ();
*)
let mtime = Unix32.mtime fullname in
+
let s = Hashtbl.find shared_files_info
(fullname, size, mtime) in
(* if s.sh_mtime = mtime && s.sh_size = size then begin *)
@@ -289,6 +298,12 @@
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 (HashMagic.merge files_magic magic)
+ in
+
let rec impl = {
impl_shared_update = 1;
impl_shared_fullname = fullname;
@@ -300,6 +315,7 @@
impl_shared_id = Md4.null;
impl_shared_val = pre_shared;
impl_shared_requests = 0;
+ impl_shared_magic = magic;
} and
pre_shared = {
shared_shared = impl;
Index: mldonkey/src/networks/fileTP/fileTPInteractive.ml
diff -u mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.35
mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.36
--- mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.35 Mon Apr 10
19:16:36 2006
+++ mldonkey/src/networks/fileTP/fileTPInteractive.ml Fri May 12 21:08:31 2006
@@ -73,21 +73,12 @@
remove_file file;
);
file_ops.op_file_info <- (fun file ->
- {
+ { (impl_file_info file.file_file) with
P.file_fields = P.Fields_file_info.all;
- P.file_comment = file_comment (as_file file);
- P.file_name = file_best_name file;
- P.file_num = (file_num file);
P.file_network = network.network_num;
P.file_names = file.file_filenames;
- P.file_md4 = Md4.null;
- P.file_size = file_size file;
- P.file_downloaded = file_downloaded file;
P.file_all_sources = (List.length file.file_clients);
P.file_active_sources = (List.length file.file_clients);
- P.file_state = file_state file;
- P.file_sources = None;
- P.file_download_rate = file_download_rate file.file_file;
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
CommonSwarming.verified_bitmap swarmer);
@@ -96,12 +87,7 @@
None -> "" | Some swarmer ->
CommonSwarming.availability swarmer)];
P.file_format = FormatNotComputed 0;
- P.file_chunks_age = [|0|];
- P.file_age = file_age file;
- P.file_last_seen = BasicSocket.last_time ();
- P.file_priority = file_priority (as_file file);
P.file_uids = [Uid.create (FileTP file.file_id)];
- P.file_sub_files = [];
}
)
Index: mldonkey/src/utils/lib/autoconf.ml.new.in
diff -u mldonkey/src/utils/lib/autoconf.ml.new.in:1.23
mldonkey/src/utils/lib/autoconf.ml.new.in:1.24
--- mldonkey/src/utils/lib/autoconf.ml.new.in:1.23 Sat Apr 8 01:27:29 2006
+++ mldonkey/src/utils/lib/autoconf.ml.new.in Fri May 12 21:08:31 2006
@@ -46,6 +46,8 @@
let has_gd_jpg = if "@GD_JPG@" = "yes" then true else false
let bzip2 = if "@BZIP2@" = "yes" then true else false
+let magic = if "@MAGIC@" = "yes" then true else false
+let magic_works = ref false
let zlib__uncompress_string2 s = Zlib.uncompress_string2 s
let zlib__compress_string s = Zlib.compress_string s
- [Mldonkey-commits] mldonkey config/Makefile.config.in config/Makef...,
mldonkey-commits <=