Hi,

this diff is far from complete. Currently it only supports active
queueing client side as implemented by Bearshare, LimeWire and Shareaza.
For me the patch is running still stable for me. However, I hope some
can get a look at it, review and please comment on things I did. Perhaps
(probably) I did things not the way it was supposed to be done.

Kind regards.
Jeroen

PS. I didn't know how to include a new file in a patch, so they are
attached as separated files.

PS2. I am still not 100% sure the file_info lifecount goes correct
(during download_free(struct download *d))

? Makefile
? config.cache
? config.h
? config.log
? config.status
? gtk-gnutella.spec
? stamp-h
? src/.deps
? src/Makefile
? src/downloads.c.dbg
? src/downloads.hdif
? src/getdate.c
? src/gtk-gnutella
? src/parq.c
? src/parq.h
Index: Makefile.in
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/Makefile.in,v
retrieving revision 1.25
diff -u -r1.25 Makefile.in
--- Makefile.in	17 Dec 2002 22:24:33 -0000	1.25
+++ Makefile.in	30 Jan 2003 19:37:39 -0000
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
 
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -115,7 +115,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
 .SUFFIXES:
@@ -129,7 +129,7 @@
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in 
 	cd $(srcdir) && $(ACLOCAL)
 
-config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES)
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
 	$(SHELL) ./config.status --recheck
 $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
 	cd $(srcdir) && $(AUTOCONF)
@@ -200,7 +200,7 @@
 	dot_seen=no; \
 	rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
 	  rev="$$subdir $$rev"; \
-	  test "$$subdir" = "." && dot_seen=yes; \
+	  test "$$subdir" != "." || dot_seen=yes; \
 	done; \
 	test "$$dot_seen" = "no" && rev=". $$rev"; \
 	target=`echo $@ | sed s/-recursive//`; \
Index: aclocal.m4
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/aclocal.m4,v
retrieving revision 1.20
diff -u -r1.20 aclocal.m4
--- aclocal.m4	17 Dec 2002 22:24:33 -0000	1.20
+++ aclocal.m4	30 Jan 2003 19:37:42 -0000
@@ -1,6 +1,6 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p4
+dnl aclocal.m4 generated automatically by aclocal 1.4-p6
 
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -19,8 +19,9 @@
 dnl Usage:
 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
 
-AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AC_PROG_INSTALL])
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
 PACKAGE=[$1]
 AC_SUBST(PACKAGE)
 VERSION=[$2]
@@ -36,18 +37,47 @@
 AC_REQUIRE([AC_ARG_PROGRAM])
 dnl FIXME This is truly gross.
 missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
 AC_REQUIRE([AC_PROG_MAKE_SET])])
 
+# Copyright 2002  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.4-p6])])
+
 #
 # Check to make sure that the build environment is sane.
 #
 
-AC_DEFUN(AM_SANITY_CHECK,
+AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
 # Just in case
 sleep 1
@@ -88,7 +118,7 @@
 
 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
 dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
+AC_DEFUN([AM_MISSING_PROG],
 [AC_MSG_CHECKING(for working $2)
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -107,7 +137,7 @@
 
 # serial 1
 
-AC_DEFUN(AM_MAINTAINER_MODE,
+AC_DEFUN([AM_MAINTAINER_MODE],
 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode is disabled by default
   AC_ARG_ENABLE(maintainer-mode,
@@ -124,7 +154,7 @@
 
 # Define a conditional.
 
-AC_DEFUN(AM_CONDITIONAL,
+AC_DEFUN([AM_CONDITIONAL],
 [AC_SUBST($1_TRUE)
 AC_SUBST($1_FALSE)
 if $2; then
@@ -137,7 +167,7 @@
 
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
-AC_DEFUN(AM_CONFIG_HEADER,
+AC_DEFUN([AM_CONFIG_HEADER],
 [AC_PREREQ([2.12])
 AC_CONFIG_HEADER([$1])
 dnl When config.status generates a header, we must update the stamp-h file.
@@ -158,6 +188,33 @@
 done<<>>dnl>>)
 changequote([,]))])
 
+# isc-posix.m4 serial 2 (gettext-0.11.2)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
+
 
 # serial 1
 
@@ -176,7 +233,7 @@
 # program @code{ansi2knr}, which comes with Ghostscript.
 # @end defmac
 
-AC_DEFUN(AM_PROG_CC_STDC,
+AC_DEFUN([AM_PROG_CC_STDC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_BEFORE([$0], [AC_C_INLINE])
 AC_BEFORE([$0], [AC_C_CONST])
@@ -655,10 +712,8 @@
      echo "*** to the full path to pkg-config."
      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
   else
-     if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7.0; then
-        echo "*** Your version of pkg-config is too old. You need version 0.7.0 or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig";
-     else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
         AC_MSG_CHECKING(for $2)
 
         if $PKG_CONFIG --exists "$2" ; then
@@ -683,6 +738,9 @@
 
         AC_SUBST($1_CFLAGS)
         AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig";
      fi
   fi
 
Index: config.h.in
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/config.h.in,v
retrieving revision 1.20
diff -u -r1.20 config.h.in
--- config.h.in	17 Dec 2002 22:24:33 -0000	1.20
+++ config.h.in	30 Jan 2003 19:37:42 -0000
@@ -1,7 +1,4 @@
-/* config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
-
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
 
 /* Define if you have the ANSI C header files.  */
 #undef STDC_HEADERS
Index: configure
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/configure,v
retrieving revision 1.37
diff -u -r1.37 configure
--- configure	19 Jan 2003 18:45:58 -0000	1.37
+++ configure	30 Jan 2003 19:38:02 -0000
@@ -568,6 +568,7 @@
 ac_config_sub=$ac_aux_dir/config.sub
 ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 
+am__api_version="1.4"
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -580,7 +581,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:584: checking for a BSD compatible install" >&5
+echo "configure:585: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -633,7 +634,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:637: checking whether build environment is sane" >&5
+echo "configure:638: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -690,7 +691,7 @@
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:694: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:695: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -735,21 +736,21 @@
 
 
 missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:740: checking for working aclocal" >&5
+echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
+echo "configure:741: checking for working aclocal-${am__api_version}" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
-if (aclocal --version) < /dev/null > /dev/null 2>&1; then
-   ACLOCAL=aclocal
+if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   ACLOCAL=aclocal-${am__api_version}
    echo "$ac_t""found" 1>&6
 else
-   ACLOCAL="$missing_dir/missing aclocal"
+   ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
    echo "$ac_t""missing" 1>&6
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:753: checking for working autoconf" >&5
+echo "configure:754: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -761,21 +762,21 @@
    echo "$ac_t""missing" 1>&6
 fi
 
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:766: checking for working automake" >&5
+echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
+echo "configure:767: checking for working automake-${am__api_version}" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
-if (automake --version) < /dev/null > /dev/null 2>&1; then
-   AUTOMAKE=automake
+if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-${am__api_version}
    echo "$ac_t""found" 1>&6
 else
-   AUTOMAKE="$missing_dir/missing automake"
+   AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
    echo "$ac_t""missing" 1>&6
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:779: checking for working autoheader" >&5
+echo "configure:780: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -788,7 +789,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:792: checking for working makeinfo" >&5
+echo "configure:793: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -802,7 +803,7 @@
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:806: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:807: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -828,253 +829,53 @@
 
 
 
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:835: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:865: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_prog_rejected=no
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-        ac_prog_rejected=yes
-	continue
-      fi
-      ac_cv_prog_CC="cc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# -gt 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" "$@"
-    shift
-    ac_cv_prog_CC="$@"
-  fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
 
-  if test -z "$CC"; then
-    case "`uname -s`" in
-    *win32* | *WIN32*)
-      # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:916: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+        echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
+echo "configure:835: checking for strerror in -lcposix" >&5
+ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="cl"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
- ;;
-    esac
-  fi
-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:948: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 959 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lcposix  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 843 "configure"
 #include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char strerror();
 
-main(){return(0);}
+int main() {
+strerror()
+; return 0; }
 EOF
-if { (eval echo configure:964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  ac_cv_prog_cc_works=yes
-  # If we can't run a trivial program, we are probably using a cross compiler.
-  if (./conftest; exit) 2>/dev/null; then
-    ac_cv_prog_cc_cross=no
-  else
-    ac_cv_prog_cc_cross=yes
-  fi
+if { (eval echo configure:854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
-  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:990: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:995: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-  ac_cv_prog_gcc=yes
-else
-  ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1023: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-  ac_cv_prog_cc_g=yes
-else
-  ac_cv_prog_cc_g=no
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1055: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
-  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  ISC=yes # If later tests want to check for ISC.
-  cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
-  if test "$GCC" = yes; then
-    CC="$CC -posix"
-  else
-    CC="$CC -Xp"
-  fi
+  LIBS="$LIBS -lcposix"
 else
   echo "$ac_t""no" 1>&6
-  ISC=
 fi
 
+  
+
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1078: checking for $ac_word" >&5
+echo "configure:879: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1104,7 +905,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1108: checking for $ac_word" >&5
+echo "configure:909: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1155,7 +956,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1159: checking for $ac_word" >&5
+echo "configure:960: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1187,7 +988,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1191: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:992: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1198,12 +999,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1202 "configure"
+#line 1003 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1229,12 +1030,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1233: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1034: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1238: checking whether we are using GNU C" >&5
+echo "configure:1039: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1243,7 +1044,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1262,7 +1063,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1266: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1067: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1294,7 +1095,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1298: checking how to run the C preprocessor" >&5
+echo "configure:1099: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1309,13 +1110,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1313 "configure"
+#line 1114 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1326,13 +1127,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1330 "configure"
+#line 1131 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1343,13 +1144,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1347 "configure"
+#line 1148 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1377,7 +1178,7 @@
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1381: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:1182: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1393,7 +1194,7 @@
 do
   CC="$ac_save_CC $ac_arg"
   cat > conftest.$ac_ext <<EOF
-#line 1397 "configure"
+#line 1198 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -1430,7 +1231,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_prog_cc_stdc="$ac_arg"; break
 else
@@ -1454,12 +1255,12 @@
 esac
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1458: checking for ANSI C header files" >&5
+echo "configure:1259: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1463 "configure"
+#line 1264 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1467,7 +1268,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1484,7 +1285,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1488 "configure"
+#line 1289 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1502,7 +1303,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1506 "configure"
+#line 1307 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1523,7 +1324,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1527 "configure"
+#line 1328 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1534,7 +1335,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1562,7 +1363,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1566: checking for $ac_word" >&5
+echo "configure:1367: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1680,7 +1481,7 @@
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1684: checking for $ac_word" >&5
+echo "configure:1485: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1715,7 +1516,7 @@
 
   min_gtk_version=1.2.0
   echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:1719: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:1520: checking for GTK - version >= $min_gtk_version" >&5
   no_gtk=""
   if test "$GTK_CONFIG" = "no" ; then
     no_gtk=yes
@@ -1738,7 +1539,7 @@
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 1742 "configure"
+#line 1543 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1816,7 +1617,7 @@
 }
 
 EOF
-if { (eval echo configure:1820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1850,7 +1651,7 @@
           CFLAGS="$CFLAGS $GTK_CFLAGS"
           LIBS="$LIBS $GTK_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 1854 "configure"
+#line 1655 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1860,7 +1661,7 @@
  return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:1864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding GTK or finding the wrong"
@@ -1952,7 +1753,7 @@
   # Extract the first word of "glib-config", so it can be a program name with args.
 set dummy glib-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1956: checking for $ac_word" >&5
+echo "configure:1757: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1987,7 +1788,7 @@
 
   min_glib_version=1.2.10
   echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6
-echo "configure:1991: checking for GLIB - version >= $min_glib_version" >&5
+echo "configure:1792: checking for GLIB - version >= $min_glib_version" >&5
   no_glib=""
   if test "$GLIB_CONFIG" = "no" ; then
     no_glib=yes
@@ -2010,7 +1811,7 @@
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 2014 "configure"
+#line 1815 "configure"
 #include "confdefs.h"
 
 #include <glib.h>
@@ -2086,7 +1887,7 @@
 }
 
 EOF
-if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2120,7 +1921,7 @@
           CFLAGS="$CFLAGS $GLIB_CFLAGS"
           LIBS="$LIBS $GLIB_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 2124 "configure"
+#line 1925 "configure"
 #include "confdefs.h"
 
 #include <glib.h>
@@ -2130,7 +1931,7 @@
  return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
@@ -2177,7 +1978,7 @@
     # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2181: checking for $ac_word" >&5
+echo "configure:1982: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2218,24 +2019,22 @@
      echo "*** to the full path to pkg-config."
      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
   else
-     if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7.0; then
-        echo "*** Your version of pkg-config is too old. You need version 0.7.0 or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig";
-     else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
         echo $ac_n "checking for gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0""... $ac_c" 1>&6
-echo "configure:2227: checking for gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0" >&5
+echo "configure:2026: checking for gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0" >&5
 
         if $PKG_CONFIG --exists "gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0" ; then
             echo "$ac_t""yes" 1>&6
             succeeded=yes
 
             echo $ac_n "checking GTK_GNUTELLA_CFLAGS""... $ac_c" 1>&6
-echo "configure:2234: checking GTK_GNUTELLA_CFLAGS" >&5
+echo "configure:2033: checking GTK_GNUTELLA_CFLAGS" >&5
             GTK_GNUTELLA_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0"`
             echo "$ac_t""$GTK_GNUTELLA_CFLAGS" 1>&6
 
             echo $ac_n "checking GTK_GNUTELLA_LIBS""... $ac_c" 1>&6
-echo "configure:2239: checking GTK_GNUTELLA_LIBS" >&5
+echo "configure:2038: checking GTK_GNUTELLA_LIBS" >&5
             GTK_GNUTELLA_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.0.0 glib-2.0 >= 2.0.0"`
             echo "$ac_t""$GTK_GNUTELLA_LIBS" 1>&6
         else
@@ -2249,6 +2048,9 @@
 
         
         
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig";
      fi
   fi
 
@@ -2282,9 +2084,9 @@
 
 need_lresolv=yes
 echo $ac_n "checking whether inet_aton needs libresolv""... $ac_c" 1>&6
-echo "configure:2286: checking whether inet_aton needs libresolv" >&5
+echo "configure:2088: checking whether inet_aton needs libresolv" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2288 "configure"
+#line 2090 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2295,7 +2097,7 @@
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:2299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   need_lresolv=no
 else
@@ -2310,14 +2112,14 @@
 # Checks for libsocket and libnsl needed by Solaris
 
 echo $ac_n "checking for library containing socket""... $ac_c" 1>&6
-echo "configure:2314: checking for library containing socket" >&5
+echo "configure:2116: checking for library containing socket" >&5
 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_socket="no"
 cat > conftest.$ac_ext <<EOF
-#line 2321 "configure"
+#line 2123 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2328,7 +2130,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socket="none required"
 else
@@ -2339,7 +2141,7 @@
 test "$ac_cv_search_socket" = "no" && for i in socket; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2343 "configure"
+#line 2145 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2350,7 +2152,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socket="-l$i"
 break
@@ -2372,14 +2174,14 @@
 fi                                               
 
 echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6
-echo "configure:2376: checking for library containing gethostbyname" >&5
+echo "configure:2178: checking for library containing gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_gethostbyname="no"
 cat > conftest.$ac_ext <<EOF
-#line 2383 "configure"
+#line 2185 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2390,7 +2192,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_gethostbyname="none required"
 else
@@ -2401,7 +2203,7 @@
 test "$ac_cv_search_gethostbyname" = "no" && for i in nsl socket; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2405 "configure"
+#line 2207 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2412,7 +2214,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_gethostbyname="-l$i"
 break
@@ -2461,7 +2263,7 @@
 
 
 echo $ac_n "checking whether to enable RFC1918 network avoidance mode""... $ac_c" 1>&6
-echo "configure:2465: checking whether to enable RFC1918 network avoidance mode" >&5
+echo "configure:2267: checking whether to enable RFC1918 network avoidance mode" >&5
 if test "x$enable_no_rfc1918" = "xno"
 then
 	echo "$ac_t""no" 1>&6
@@ -2475,7 +2277,7 @@
 # Extract the first word of "xml2-config", so it can be a program name with args.
 set dummy xml2-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2479: checking for $ac_word" >&5
+echo "configure:2281: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_XML_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2510,14 +2312,14 @@
 
 if test "x$XML_CONFIG" != "xno"; then
     echo $ac_n "checking whether to enable XML persistance backend""... $ac_c" 1>&6
-echo "configure:2514: checking whether to enable XML persistance backend" >&5
+echo "configure:2316: checking whether to enable XML persistance backend" >&5
     if test "x$enable_xml_store" = "xno"
     then
     	echo "$ac_t""no" 1>&6
     else
         echo "$ac_t""yes" 1>&6
         echo $ac_n "checking libxml2 version""... $ac_c" 1>&6
-echo "configure:2521: checking libxml2 version" >&5
+echo "configure:2323: checking libxml2 version" >&5
         libxml2_version=`$XML_CONFIG --version | awk '{print $1;}'`
         echo "$ac_t""$libxml2_version" 1>&6
         libxml2_version=`echo $libxml2_version | awk -F. '{print $1 * 10000 + $2 * 100 + $3;}'`
@@ -2537,7 +2339,7 @@
     fi
 else
     echo $ac_n "checking whether to enable XML persistance backend""... $ac_c" 1>&6
-echo "configure:2541: checking whether to enable XML persistance backend" >&5
+echo "configure:2343: checking whether to enable XML persistance backend" >&5
    	echo "$ac_t""no" 1>&6
     enable_xml_store="no"
 fi
@@ -2579,12 +2381,12 @@
 for ac_func in herror inet_aton
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2583: checking for $ac_func" >&5
+echo "configure:2385: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2588 "configure"
+#line 2390 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2607,7 +2409,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2634,12 +2436,12 @@
 for ac_func in strcasestr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2638: checking for $ac_func" >&5
+echo "configure:2440: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2643 "configure"
+#line 2445 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2662,7 +2464,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2689,12 +2491,12 @@
 for ac_func in srandom random
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2693: checking for $ac_func" >&5
+echo "configure:2495: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2698 "configure"
+#line 2500 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2717,7 +2519,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2743,12 +2545,12 @@
 
 
 echo $ac_n "checking for sendfile""... $ac_c" 1>&6
-echo "configure:2747: checking for sendfile" >&5
+echo "configure:2549: checking for sendfile" >&5
 if eval "test \"`echo '$''{'ac_cv_func_sendfile'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2752 "configure"
+#line 2554 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char sendfile(); below.  */
@@ -2771,7 +2573,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_sendfile=yes"
 else
@@ -2789,7 +2591,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for sendfile in -lsendfile""... $ac_c" 1>&6
-echo "configure:2793: checking for sendfile in -lsendfile" >&5
+echo "configure:2595: checking for sendfile in -lsendfile" >&5
 ac_lib_var=`echo sendfile'_'sendfile | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2797,7 +2599,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsendfile  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2801 "configure"
+#line 2603 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2808,7 +2610,7 @@
 sendfile()
 ; return 0; }
 EOF
-if { (eval echo configure:2812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2839,17 +2641,17 @@
 
 ac_safe=`echo "sys/sendfile.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/sendfile.h""... $ac_c" 1>&6
-echo "configure:2843: checking for sys/sendfile.h" >&5
+echo "configure:2645: checking for sys/sendfile.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2848 "configure"
+#line 2650 "configure"
 #include "confdefs.h"
 #include <sys/sendfile.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2880,17 +2682,17 @@
 
 ac_safe=`echo "ctype.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ctype.h""... $ac_c" 1>&6
-echo "configure:2884: checking for ctype.h" >&5
+echo "configure:2686: checking for ctype.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2889 "configure"
+#line 2691 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2922,17 +2724,17 @@
 
 ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
-echo "configure:2926: checking for zlib.h" >&5
+echo "configure:2728: checking for zlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2931 "configure"
+#line 2733 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2949,7 +2751,7 @@
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:2953: checking for deflate in -lz" >&5
+echo "configure:2755: checking for deflate in -lz" >&5
 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2957,7 +2759,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lz  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2961 "configure"
+#line 2763 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2968,7 +2770,7 @@
 deflate()
 ; return 0; }
 EOF
-if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/Makefile.am,v
retrieving revision 1.80
diff -u -r1.80 Makefile.am
--- src/Makefile.am	27 Jan 2003 05:02:17 -0000	1.80
+++ src/Makefile.am	30 Jan 2003 19:38:04 -0000
@@ -123,6 +123,7 @@
 	pcache.c pcache.h \
 	routing.c routing.h \
 	search.c search.h search_gui.h \
+	parq.c parq.h \
 	downloads.c downloads.h downloads_gui.h \
 	fileinfo.c fileinfo.h \
 	fuzzy.c fuzzy.h \
Index: src/Makefile.in
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/Makefile.in,v
retrieving revision 1.90
diff -u -r1.90 Makefile.in
--- src/Makefile.in	27 Jan 2003 05:02:17 -0000	1.90
+++ src/Makefile.in	30 Jan 2003 19:38:21 -0000
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 #
-# $Id: Makefile.in,v 1.90 2003/01/27 05:02:17 cbiere Exp $
+# $Id: Makefile.am,v 1.80 2003/01/27 05:02:17 cbiere Exp $
 #
 # Copyright (c) 2001-2002, Raphael Manfredi
 #
@@ -124,7 +124,7 @@
 @ENABLE_REMOTE_SHELL_FALSE@REMOTE_SHELL = 
 
 # interface.h must come before any .c files that include it so that it is built.
-gtk_gnutella_SOURCES =  	$(XML_STORE) 	$(GLADE_UI) 	$(ADDITIONAL_DROPIN) 	$(REMOTE_SHELL) 	gnutella.h listener.h 	gnet.h 	common.c common.h 	misc.c misc.h 	prop.c prop.h 	gnet_property.c gnet_property.h gnet_property_priv.h 	guid.c guid.h 	settings.c settings.h oldconfig.c oldconfig.h 	sockets.c sockets.h 	nodes.c nodes.h 	hosts.c hosts.h 	hcache.c hcache.h 	pcache.c pcache.h 	routing.c routing.h 	search.c search.h search_gui.h 	downloads.c downloads.h downloads_gui.h 	fileinfo.c fileinfo.h 	fuzzy.c fuzzy.h 	whitelist.c whitelist.h 	share.c share.h 	uploads.c uploads.h uploads_gui.h 	upload_stats.c upload_stats.h 	main.c 	matching.c matching.h 	getline.c getline.h 	header.c header.h 	ioheader.c ioheader.h 	url.c url.h 	pmsg.c pmsg.h 	gmsg.c gmsg.h 	cq.c cq.h 	mq.c mq.h 	sq.c sq.h 	bsched.c bsched.h 	tx.c tx.h 	tx_link.c tx_link.h 	tx_deflate.c tx_deflate.h 	rxbuf.c rxbuf.h 	rx.c rx.h 	rx_link.c rx_link.h 	rx_inflate.c rx_inflate.h 	zlib_util.c zlib_util.h 	sha1.c sha1.h huge.c huge.h 	base32.c base32.h 	utf8.c utf8.h 	ban.c ban.h 	inet.c inet.h 	qrp.c qrp.h 	getdate.y getdate.h 	atoms.c atoms.h 	extensions.c extensions.h 	cobs.c cobs.h 	ggep.c ggep.h 	dmesh.c dmesh.h 	http.c http.h 	version.c version.h 	alive.c alive.h 	zalloc.c zalloc.h 	walloc.c walloc.h 	vendors.c vendors.h 	idtable.c idtable.h 	namesize.c namesize.h 	ignore.c ignore.h 	gnet_stats.c gnet_stats.h 	gwcache.c gwcache.h 	bg.c bg.h 	verify.c verify.h 	move.c move.h 	file.c file.h 	inputevt.c inputevt.h 	vmsg.c vmsg.h
+gtk_gnutella_SOURCES =  	$(XML_STORE) 	$(GLADE_UI) 	$(ADDITIONAL_DROPIN) 	$(REMOTE_SHELL) 	gnutella.h listener.h 	gnet.h 	common.c common.h 	misc.c misc.h 	prop.c prop.h 	gnet_property.c gnet_property.h gnet_property_priv.h 	guid.c guid.h 	settings.c settings.h oldconfig.c oldconfig.h 	sockets.c sockets.h 	nodes.c nodes.h 	hosts.c hosts.h 	hcache.c hcache.h 	pcache.c pcache.h 	routing.c routing.h 	search.c search.h search_gui.h 	parq.c parq.h 	downloads.c downloads.h downloads_gui.h 	fileinfo.c fileinfo.h 	fuzzy.c fuzzy.h 	whitelist.c whitelist.h 	share.c share.h 	uploads.c uploads.h uploads_gui.h 	upload_stats.c upload_stats.h 	main.c 	matching.c matching.h 	getline.c getline.h 	header.c header.h 	ioheader.c ioheader.h 	url.c url.h 	pmsg.c pmsg.h 	gmsg.c gmsg.h 	cq.c cq.h 	mq.c mq.h 	sq.c sq.h 	bsched.c bsched.h 	tx.c tx.h 	tx_link.c tx_link.h 	tx_deflate.c tx_deflate.h 	rxbuf.c rxbuf.h 	rx.c rx.h 	rx_link.c rx_link.h 	rx_inflate.c rx_inflate.h 	zlib_util.c zlib_util.h 	sha1.c sha1.h huge.c huge.h 	base32.c base32.h 	utf8.c utf8.h 	ban.c ban.h 	inet.c inet.h 	qrp.c qrp.h 	getdate.y getdate.h 	atoms.c atoms.h 	extensions.c extensions.h 	cobs.c cobs.h 	ggep.c ggep.h 	dmesh.c dmesh.h 	http.c http.h 	version.c version.h 	alive.c alive.h 	zalloc.c zalloc.h 	walloc.c walloc.h 	vendors.c vendors.h 	idtable.c idtable.h 	namesize.c namesize.h 	ignore.c ignore.h 	gnet_stats.c gnet_stats.h 	gwcache.c gwcache.h 	bg.c bg.h 	verify.c verify.h 	move.c move.h 	file.c file.h 	inputevt.c inputevt.h 	vmsg.c vmsg.h
 
 
 GLADE_WARNING1 = "Warning: gtk-gnutella.glade is newer than glade-built files and"
@@ -186,6 +186,7 @@
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
@@ -286,6 +287,7 @@
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
@@ -388,6 +390,7 @@
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
@@ -489,6 +492,7 @@
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
@@ -592,6 +596,7 @@
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
@@ -693,6 +698,7 @@
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_TRUE@@[EMAIL PROTECTED] \
@@ -795,6 +801,7 @@
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_TRUE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
@@ -896,6 +903,7 @@
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
+@ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
 @ENABLE_REMOTE_SHELL_FALSE@@ENABLE_XML_STORE_FALSE@@[EMAIL PROTECTED] \
@@ -965,7 +973,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 DEP_FILES =  .deps/alive.P .deps/atoms.P .deps/ban.P .deps/base32.P \
 .deps/bg.P .deps/bsched.P .deps/callbacks.P .deps/cobs.P .deps/common.P \
@@ -983,10 +991,10 @@
 .deps/matching.P .deps/misc.P .deps/monitor_cb.P .deps/monitor_cb2.P \
 .deps/monitor_gui.P .deps/monitor_gui2.P .deps/move.P .deps/mq.P \
 .deps/namesize.P .deps/nodes.P .deps/nodes_cb.P .deps/nodes_cb2.P \
-.deps/nodes_gui.P .deps/nodes_gui2.P .deps/oldconfig.P .deps/pcache.P \
-.deps/pmsg.P .deps/prop.P .deps/qrp.P .deps/routing.P .deps/rx.P \
-.deps/rx_inflate.P .deps/rx_link.P .deps/rxbuf.P .deps/search.P \
-.deps/search_cb.P .deps/search_cb2.P .deps/search_gui.P \
+.deps/nodes_gui.P .deps/nodes_gui2.P .deps/oldconfig.P .deps/parq.P \
+.deps/pcache.P .deps/pmsg.P .deps/prop.P .deps/qrp.P .deps/routing.P \
+.deps/rx.P .deps/rx_inflate.P .deps/rx_link.P .deps/rxbuf.P \
+.deps/search.P .deps/search_cb.P .deps/search_cb2.P .deps/search_gui.P \
 .deps/search_gui2.P .deps/search_stats_gui.P .deps/search_stats_gui2.P \
 .deps/search_xml.P .deps/settings.P .deps/settings_cb.P \
 .deps/settings_gui.P .deps/sha1.P .deps/share.P .deps/shell.P \
Index: src/downloads.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/downloads.c,v
retrieving revision 1.193
diff -u -r1.193 downloads.c
--- src/downloads.c	27 Jan 2003 22:20:32 -0000	1.193
+++ src/downloads.c	30 Jan 2003 19:38:53 -0000
@@ -47,6 +47,8 @@
 #include "settings.h"
 #include "nodes.h"
 
+#include "parq.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -313,6 +315,7 @@
 		l = l->next;
 
 		switch (d->status) {
+		case GTA_DL_ACTIVE_QUEUED:
 		case GTA_DL_RECEIVING:
 		case GTA_DL_HEADERS:
 		case GTA_DL_PUSH_SENT:
@@ -327,6 +330,9 @@
 			}
 
 			switch (d->status) {
+			case GTA_DL_ACTIVE_QUEUED:
+ 				t = d->queue_status.pollMin;
+ 				break;
 			case GTA_DL_PUSH_SENT:
 			case GTA_DL_FALLBACK:
 				t = download_push_sent_timeout;
@@ -342,7 +348,9 @@
 			}
 
 			if (now - d->last_update > t) {
-				if (d->status == GTA_DL_CONNECTING)
+				if (d->status == GTA_DL_ACTIVE_QUEUED)
+					parq_download_retry_active_queued(d);
+				else if (d->status == GTA_DL_CONNECTING)
 					download_fallback_to_push(d, TRUE, FALSE);
 				else if (d->status == GTA_DL_HEADERS)
 					download_incomplete_header(d);
@@ -750,6 +758,7 @@
 	downloads_with_name_dec(fi->file_name);		/* File name can change! */
 	file_info_clear_download(d, TRUE);			/* `d' might be running */
 
+	printf("Download info reget \n\r");
 	fi->lifecount--;
 	file_info_free(fi, FALSE);					/* Keep it around for others */
 
@@ -1456,6 +1465,7 @@
 	case GTA_DL_COMPLETED:
 	case GTA_DL_ABORTED:
 	case GTA_DL_ERROR:
+		printf("Stopping download\n\r");
 		g_assert(d->file_info->lifecount <= d->file_info->refcount);
 		g_assert(d->file_info->lifecount > 0);
 		d->file_info->lifecount--;
@@ -1902,7 +1912,7 @@
  * Returns TRUE if we may continue with the download, FALSE if it has been
  * stopped due to a problem.
  */
-static gboolean download_start_prepare_running(struct download *d)
+gboolean download_start_prepare_running(struct download *d)
 {
 	struct dl_file_info *fi = d->file_info;
 
@@ -1986,7 +1996,7 @@
  * Returns TRUE if we may continue with the download, FALSE if it has been
  * stopped due to a problem.
  */
-static gboolean download_start_prepare(struct download *d)
+gboolean download_start_prepare(struct download *d)
 {
     g_assert(d != NULL);
 	g_assert(d->list_idx != DL_LIST_RUNNING);	/* Not already running */
@@ -2973,12 +2983,16 @@
 	 * make sure we decrement it here (e.g. if the download was queued).
 	 */
 
-	if (DOWNLOAD_IS_RUNNING(d))
+	if (DOWNLOAD_IS_RUNNING(d)) {
+		printf("Download abort %d \n\r", d->status);			
+		if (d->status == GTA_DL_ACTIVE_QUEUED)
+				printf("Which was active queued\n\r");
 		download_stop(d, GTA_DL_ABORTED, NULL);
-	else if (DOWNLOAD_IS_STOPPED(d))
+	} else if (DOWNLOAD_IS_STOPPED(d))
 		/* nothing, lifecount already decremented */;
 	else {
 		g_assert(d->file_info->lifecount > 0);
+		printf("Download free\n\r");	
 		d->file_info->lifecount--;
 	}
 
@@ -4042,7 +4056,7 @@
 {
 	gchar *buf;
 	gchar *available = "X-Available-Ranges";
-
+	
 	if (d->ranges != NULL) {
 		http_range_free(d->ranges);
 		d->ranges = NULL;
@@ -4051,6 +4065,9 @@
 	if (!d->file_info->use_swarming)
 		return;
 
+	g_assert(header != NULL);
+	g_assert(header->headers != NULL);
+	
 	buf = header_get(header, available);
 
 	if (buf == NULL)
@@ -4173,7 +4190,13 @@
 	struct dl_file_info *fi;
 	gchar short_read[80];
 	guint delay;
-
+	
+	/*
+	 * Clear queue status. Will be set again if a 503 was received with queued
+	 * as status.
+	 */
+	parq_download_clear_status(d);
+	
 	/*
 	 * If `ok' is FALSE, we might not even have fully read the status line,
 	 * in which case `s->getline' will be null.
@@ -4236,7 +4259,7 @@
 
 	ack_code = http_status_parse(status, "HTTP",
 		&ack_message, &http_major, &http_minor);
-
+	
 	if (!download_check_status(d, s->getline, ack_code))
 		return;
 
@@ -4284,20 +4307,57 @@
 			"[short %d line%s header] ", count, count == 1 ? "" : "s");
 	}
 
-	/*
-	 * If we made a /uri-res/N2R? request, yet if the download still
-	 * has the old index/name indication, convert it to a /uri-res/.
-	 */
-
+	
 	if (ack_code == 503 || (ack_code >= 200 && ack_code <= 299)) {
+
+		/*
+		 * If we made a /uri-res/N2R? request, yet if the download still
+		 * has the old index/name indication, convert it to a /uri-res/.
+	 	 */
 		if (d->record_index != URN_INDEX && (d->flags & DL_F_URIRES))
 			if (!download_convert_to_urires(d))
 				return;
+		
+		/*
+		 * The download could be remotely queued. Check this now before
+		 * continueing at all.
+		 */			
+		if (ack_code == 503) {
+			
+			/* Check for queued status */
+			if (parq_download_supports_parq(header)) {		
+
+				parq_download_parse_queue_status(d, header);
+			
+				/* If we are queued there is nothing anymore we can do for now*/
+				if (parq_download_is_active_queued(d)) {
+					
+					/* Make sure we're waiting for the right file, 
+					   collect alt-locs */
+					if (check_content_urn(d, header)) {
+
+						/* Update mesh */
+						if (!d->always_push && d->sha1)
+							dmesh_add(d->sha1, ip, port, d->record_index,
+								d->file_name, 0);
+			
+						return;
+						
+					} /* Check content urn failed */
+
+					return;
+					
+				} /* Download not active queued */
+				d->status = GTA_DL_HEADERS;
+			}
+		}
 	}
 
 	update_available_ranges(d, header);		/* Updates `d->ranges' */
 	delay = extract_retry_after(header);
 
+
+		
 	/*
 	 * Partial File Sharing Protocol (PFSP) -- client-side
 	 *
@@ -4411,11 +4471,13 @@
 					gui_update_download(d, TRUE);
 				}
 			} else {
+				/* Host might support queueing. If so, retreive queue status */
 				/* Server has nothing for us yet, give it time */
 				download_queue_delay(d,
 					MAX(delay, download_retry_refused_delay),
 					"Partial file on server, waiting");
 			}
+			
 			return;
 		default:
 			break;
@@ -4459,11 +4521,10 @@
 			if (download_retry_no_urires(d, delay, ack_code))
 				return;
 			break;
-		case 503:				/* Busy */
+		case 503:				/* Busy */			
 			/* Make sure we're waiting for the right file, collect alt-locs */
 			if (!check_content_urn(d, header))
 				return;
-
 			/*
 			 * If we made a follow-up request, mark host as not reliable.
 			 *
@@ -4509,10 +4570,11 @@
 
 	/*
 	 * If an URN is present, validate that we can continue this download.
-	 */
+ 	 */
+ 
+ 	if (!check_content_urn(d, header))
+ 		return;
 
-	if (!check_content_urn(d, header))
-		return;
 
 	/*
 	 * If they configured us to require a server name, and we have none
@@ -4918,8 +4980,10 @@
 
 	rw += g_snprintf(&dl_tmp[rw], sizeof(dl_tmp)-rw,
 		"Host: %s\r\n"
-		"User-Agent: %s\r\n",
-		ip_port_to_gchar(download_ip(d), download_port(d)), version_string);
+		"User-Agent: %s\r\n"
+		"X-Queue: %d.%d\r\n",
+		ip_port_to_gchar(download_ip(d), download_port(d)), version_string,
+		PARQ_VERSION_MAJOR, PARQ_VERSION_MINOR);
 
 	/*
 	 * If server is known to NOT support keepalives, then request only
Index: src/downloads.h
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/downloads.h,v
retrieving revision 1.59
diff -u -r1.59 downloads.h
--- src/downloads.h	27 Jan 2003 22:20:37 -0000	1.59
+++ src/downloads.h	30 Jan 2003 19:38:56 -0000
@@ -66,6 +66,19 @@
 	guint32 attrs;
 };
 
+struct dl_queued {	
+	guint16 position;			/* Current position in the queue */
+	guint16 length;				/* Current queue length */
+	guint16 limit;				/* Number of concurrent uploads */
+	guint16 pollMin;			/* Minimum retry time => Retry after */
+	guint16 ETA;				/* Estimated time till upload slot retreived */
+	guint16 lifetime;			/* = pollMax, maximum interval before loosing
+							     *   queue position */
+	gchar* ID;					/* PARQ Queue ID	*/
+	guint8 MajorVersion;		/* Not sure if we are gonna need this */
+	guint8 MinorVersion;		/*  .....Should this be in dl_server? */
+};
+
 struct download {
 	gchar error_str[256];	/* Used to sprintf() error strings with vars */
 	guint32 status;			/* Current status of the download */
@@ -113,6 +126,8 @@
 	gboolean visible;		/* The download is visible in the GUI */
 	gboolean push;			/* Currently in push mode */
 	gboolean always_push;	/* Always use the push method for this download */
+	
+	struct dl_queued queue_status;	/* Queuing status */
 };
 
 /*
@@ -138,6 +153,8 @@
 #define GTA_DL_MOVING			17	/* Being moved to "done/bad" dir */
 #define GTA_DL_DONE				18	/* All done! */
 #define GTA_DL_SINKING			19	/* Sinking HTML reply */
+#define GTA_DL_ACTIVE_QUEUED	20	/* Actively queued */
+#define GTA_DL_PASSIVE_QUEUED	21	/* Passively queued */
 
 /*
  * Download flags.
@@ -214,6 +231,7 @@
 	|| (d)->status == GTA_DL_PUSH_SENT	\
 	|| (d)->status == GTA_DL_FALLBACK	\
 	|| (d)->status == GTA_DL_REQ_SENT	\
+	|| (d)->status == GTA_DL_ACTIVE_QUEUED \
 	|| (d)->status == GTA_DL_HEADERS	)
 
 #define DOWNLOAD_IS_EXPECTING_GIV(d)	\
@@ -256,6 +274,7 @@
 void download_abort(struct download *);
 void download_resume(struct download *);
 void download_start(struct download *, gboolean);
+gboolean download_start_prepare_running(struct download *d);
 void download_requeue(struct download *);
 void download_send_request(struct download *);
 void download_retry(struct download *);
@@ -278,5 +297,7 @@
 void download_move_done(struct download *d, time_t elapsed);
 void download_move_error(struct download *d);
 
+gboolean download_start_prepare(struct download *d);
+	
 #endif /* _downloads_h_ */
 
Index: src/downloads_gui.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/downloads_gui.c,v
retrieving revision 1.16
diff -u -r1.16 downloads_gui.c
--- src/downloads_gui.c	27 Jan 2003 22:20:37 -0000	1.16
+++ src/downloads_gui.c	30 Jan 2003 19:39:01 -0000
@@ -28,6 +28,7 @@
 #include "downloads.h" // FIXME: remove this dependency
 #include "statusbar_gui.h"
 #include "downloads_cb.h"
+#include "parq.h"
 
 RCSID("$Id: downloads_gui.c,v 1.16 2003/01/27 22:20:37 rmanfredi Exp $");
 
@@ -83,6 +84,29 @@
 	fi = d->file_info;
 
 	switch (d->status) {
+	case GTA_DL_ACTIVE_QUEUED:
+		{
+			gint when = d->timeout_delay - (now - d->last_update);
+			rw = g_snprintf(tmpstr, sizeof(tmpstr),
+				"Retry in %ds ", MAX(0, when));
+
+			if (d->queue_status.position > 0) {
+				rw += g_snprintf(&tmpstr[rw], sizeof(tmpstr)-rw,
+					"Remotely queued at position %d ",	d->queue_status.position);
+				
+				if (d->queue_status.length > 0) {
+					rw += g_snprintf(&tmpstr[rw], sizeof(tmpstr)-rw,
+						"out of %d ",	d->queue_status.length);
+				}
+			}
+			
+			if (d->queue_status.limit > 0) {
+				rw += g_snprintf(&tmpstr[rw], sizeof(tmpstr)-rw,
+					"Maximum uploads: %d ", d->queue_status.limit);
+			}
+		a = tmpstr;
+		}
+		break;
 	case GTA_DL_QUEUED:
 		a = (gchar *) ((d->remove_msg) ? d->remove_msg : "");
 		break;
/*
 * Copyright (c) 2003 Jeroen Asselman
 *
 *----------------------------------------------------------------------
 * This file is part of gtk-gnutella.
 *
 *  gtk-gnutella is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  gtk-gnutella is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with gtk-gnutella; if not, write to the Free Software
 *  Foundation, Inc.:
 *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *----------------------------------------------------------------------
 */
 
#ifndef _PARQ_H_
#define _PARQ_H_

#include "header.h"
#include "downloads.h"

/*
 * PARQ Version information
 */
 
#define PARQ_VERSION_MAJOR	1
#define	PARQ_VERSION_MINOR	0

void parq_download_retry_active_queued(struct download *d);
void parq_download_clear_status(struct download *d);
gboolean parq_download_supports_parq(header_t *header);
void parq_download_parse_queue_status(struct download *d, header_t *header);
gboolean parq_download_is_active_queued(struct download *d);
	
#endif /* _PARQ_H_ */
/*
 * Copyright (c) 2003 Jeroen Asselman
 *
 *----------------------------------------------------------------------
 * This file is part of gtk-gnutella.
 *
 *  gtk-gnutella is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  gtk-gnutella is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with gtk-gnutella; if not, write to the Free Software
 *  Foundation, Inc.:
 *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *----------------------------------------------------------------------
 */
 
#include "parq.h"
#include "ioheader.h"
#include "sockets.h"

RCSID("$Id$");


gchar*	get_header_value(gchar const * const s, gchar const * const attribute)
{
	gchar* lowercase_header;

	g_assert(s != NULL);
	g_assert(attribute != NULL);

	lowercase_header = strcasestr(s, attribute);

	if (lowercase_header == NULL)
		return NULL;

	lowercase_header = strchr(lowercase_header, '=');
	if (lowercase_header == NULL)
		return NULL;

	lowercase_header += sizeof((gchar) '=');
	
	/* Could be NULL */
	return lowercase_header;
}


/*
 * Active queued means we didn't close the http connection on a HTTP 503 busy
 * when the server supports queueing. So prepare the download structure
 * for a 'valid' segment. And re-request the segment.
 */
void parq_download_retry_active_queued(struct download *d)
{
	g_assert(d != NULL);
	g_assert(d->socket != NULL);
	g_assert(d->status == GTA_DL_ACTIVE_QUEUED);
	g_assert(parq_download_is_active_queued(d));
	
	if (download_start_prepare_running(d)) {
		struct gnutella_socket *s = d->socket;
		
 		/* Will be re initialised in download_send_request */
		io_free(d->io_opaque);
		d->io_opaque = NULL;
		getline_free(s->getline);		/* No longer need this */
		s->getline = NULL;

		/* Resend request for download */
		download_send_request(d);
	}
}

/*
 * Removes the is queued status from the download.
 */
void parq_download_clear_status(struct download *d)
{
	g_assert(d != NULL);
	
	d->queue_status.position = 0;	// PARQ && Active queueing
	d->queue_status.length   = 0;	// PARQ && Active queueing
	d->queue_status.limit    = 0;	// Active queueing
	d->queue_status.pollMin  = 0;	// Active queueing
	d->queue_status.lifetime  = 0;	// PARQ && Active queueing

//	if (d->queue_status.ID)			// PARQ
//		free(d->queue_status.ID);
	
}
	
/*
 * Wether the server supports queueing or not.
 */
gboolean parq_download_supports_parq(header_t *header)
{
	g_assert(header != NULL);	
	
	return (NULL != header_get(header, "X-Queue") || 
			NULL != header_get(header, "X-Queued"));
}

/*
 * Retreive and parse queueing information.
 */
void parq_download_parse_queue_status(struct download *d, header_t *header)
{	
	gchar *buf;
	gchar *value;

	buf = header_get(header, "X-Queue");
	if (buf == NULL)
		buf = header_get(header, "X-Queued");
	
	
	g_assert(d != NULL);
	g_assert(header != NULL);
	g_assert(buf != NULL);

	parq_download_clear_status(d);
	
	value = get_header_value(buf, "position");
	d->queue_status.position = value == NULL ? 0 : strtoul(value, NULL, 0);
	
	value = get_header_value(buf, "length");
	d->queue_status.length   = value == NULL ? 0 : strtoul(value, NULL, 0);
	
	value = get_header_value(buf, "limit");
	d->queue_status.limit    = value == NULL ? 0 : strtoul(value, NULL, 0);
	
	value = get_header_value(buf, "pollMin");
	d->queue_status.pollMin  = value == NULL ? 0 : strtoul(value, NULL, 0);
		
	value = get_header_value(buf, "pollmax");
	d->queue_status.lifetime  = value == NULL ? 0 : strtoul(value, NULL, 0);

	value = get_header_value(buf, "lifetime");
	if (value != NULL)
		d->queue_status.lifetime = strtoul(value, NULL, 0);
	
	value = get_header_value(buf, "ETA");
	d->queue_status.ETA  = value == NULL ? 0 : strtoul(value, NULL, 0);

//	value = get_header_value(buf, "ID");
	
	/* FIXME: This isn't 100% correct yet for PARQ, it is for active queueing */
	if (parq_download_is_active_queued(d)) {
		d->status=GTA_DL_ACTIVE_QUEUED;
		d->timeout_delay = d->queue_status.pollMin;
	}
	
	if (d->queue_status.pollMin)
		d->timeout_delay = d->queue_status.pollMin;
}

/*
 * Wether the download is queued remotely or not.
 */
gboolean parq_download_is_active_queued(struct download *d)
{
	g_assert(d != NULL);

	return d->queue_status.position > 0 && d->keep_alive;
}

Reply via email to