[Gnucash-changes] gnucash

David Hampton hampton at cvs.gnucash.org
Wed Mar 3 18:15:07 EST 2004


Update of /home/cvs/cvsroot/gnucash
In directory cvs.gnucash.org:/tmp/cvs-serv29220

Modified Files:
      Tag: gnucash-gnome2-dev
	ChangeLog configure.in 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/macros
In directory cvs.gnucash.org:/tmp/cvs-serv29220/macros

Added Files:
      Tag: gnucash-gnome2-dev
	openhbci2.m4 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/bin/overrides
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/bin/overrides

Modified Files:
      Tag: gnucash-gnome2-dev
	gnucash-build-env.in 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/business/business-core
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/business/business-core

Modified Files:
      Tag: gnucash-gnome2-dev
	gncJob.c 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/engine
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/engine

Modified Files:
      Tag: gnucash-gnome2-dev
	Account.c gnc-commodity.c iso-4217-currencies.scm kvp_frame.h 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/gnome-utils
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/gnome-utils

Modified Files:
      Tag: gnucash-gnome2-dev
	dialog-transfer.c transfer.glade 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/import-export
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/import-export

Modified Files:
      Tag: gnucash-gnome2-dev
	import-account-matcher.c import-account-matcher.h 
	import-backend.c 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/import-export/hbci
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/import-export/hbci

Modified Files:
      Tag: gnucash-gnome2-dev
	Makefile.am dialog-hbcitrans.c dialog-hbcitrans.h 
	druid-hbci-initial.c druid-hbci-utils.c druid-hbci-utils.h 
	gnc-hbci-actions.c gnc-hbci-getbalance.c gnc-hbci-getbalance.h 
	gnc-hbci-gettrans.c gnc-hbci-gettrans.h gnc-hbci-kvp.c 
	gnc-hbci-kvp.h gnc-hbci-transfer.c gnc-hbci-transfer.h 
	gnc-hbci-utils.c gnc-hbci-utils.h hbci-interaction.c 
	hbci-interaction.h hbci-interactionP.h hbci-progressmon.c 
Added Files:
      Tag: gnucash-gnome2-dev
	gnc-hbci-account.c gnc-hbci-account.h 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/import-export/hbci/glade
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/import-export/hbci/glade

Modified Files:
      Tag: gnucash-gnome2-dev
	hbci.glade 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)
Update of /home/cvs/cvsroot/gnucash/src/register/ledger-core
In directory cvs.gnucash.org:/tmp/cvs-serv29220/src/register/ledger-core

Modified Files:
      Tag: gnucash-gnome2-dev
	split-register-layout.c split-register-load.c 
Log Message:
Sync the g2 branch with the gnome2-merge-7 tag. (2004-03-03)

==================================================
Differences for ChangeLog (revision 1.1487.2.115 -> 1.1487.2.116)
==================================================
--- /home/cvs/cvsroot/gnucash/ChangeLog	2004/02/10 03:42:13	1.1487.2.115
+++ /home/cvs/cvsroot/gnucash/ChangeLog	2004/03/03 23:15:04	1.1487.2.116
@@ -2479,6 +2479,84 @@
 -=-=-=- cvs HEAD ChangeLog is below this line -=-=-=-
 
 
+2004-03-03  Derek Atkins  <derek at ihtfp.com>
+
+	* src/register/ledger-core/split-register-load.c: make the code a
+	  little cleaner by not re-using (and re-defining!) the same
+	  variable name inside a block of code and "over-riding" an
+	  existing variable.  Unlikely to actually fix anything, but
+	  you never know what a compiler might do.
+
+2004-02-14  Christian Stimming  <stimming at tuhh.de>
+
+	* configure.in: Require the correct openhbci2 version. Add verbose
+	error message for the currently unavailable mt940 support.
+
+	* src/import-export/hbci/hbci-druid-initial.c, gnc-hbci-utils.c:
+	Finally finish openhbci2 support, phew. Requires
+	openhbci2-1.9beta7 from http://sourceforge.net/projects/openhbci
+
+2004-02-04  Derek Atkins  <derek at ihtfp.com>
+
+	* src/business/business-core/gncJob.c: Linas checked the wrong
+	  argument in SetOwner() in revision 1.40 thereby causing ALL new
+	  jobs to fail to work.  Check the new owner, not the original.
+	  Fixes #133392.
+
+2004-01-31  Christian Stimming  <stimming at tuhh.de>
+
+	* src/engine/gnc-commodity.c, src/engine/iso-4217-currencies.scm:
+	Change Ukrainian "UAG" into "UAH" #128913
+
+	* src/import-export/import-backend.c: Commented out setting the
+	memo always to "Auto-created split" due to popular request.
+
+	* src/import-export/hbci/druid-hbci-initial.c, hbci-interaction.c,
+	all files: Preliminary completion of openhbci2 support -- getting
+	the transactions seems to work, as well as the HBCI setup.
+
+	* src/engine/kvp_frame.h, src/engine/Account.c: Add clear notice
+	of the semantic change of kvp_frame_get_frame
+	function. Fortunately it seems the only place that still had to be
+	fixed, apart from the hbci module, has been in Account.c.
+
+	* src/import-export/import-account-matcher.h: Make string argument
+	a const char*. Make boolean argument a gboolean.
+
+2004-01-30  Derek Atkins  <derek at ihtfp.com>
+
+	* src/register/ledger-core/split-register-layout.c:  Remove the
+	  RECN cell from payable/receivable to stop confusing people.
+
+2004-01-21  Christian Stimming  <stimming at tuhh.de>
+
+	* src/import-export/hbci/gnc-hbci-utils.c: Set application log
+	directory, needs more work.
+	* src/import-export/hbci/druid-hbci-utils.c:
+	More work for openhbci2 support.
+
+2004-01-20  Christian Stimming  <stimming at tuhh.de>
+
+	* configure.in, macros/openhbci2.m4: Add checking for new
+	openhbci2 library.
+	
+	* src/import-export/hbci/ all files: Switch HBCI code to the new
+	openhbci2 library. Should be working, but needs further testing.
+
+2004-01-20  Derek Atkins  <derek at ihtfp.com>
+
+	* src/bin/overrides/gnucash-build-env.in: add import-export, ofx,
+	  and hbci which should allow running with ofx and hbci in the
+	  build tree.
+
+2004-01-19  Herbert Thoma  <herbie at hthoma.de>
+
+	* src/gnome-utils/transfer.glade: rename from_xxx and to_xxx account
+	  tree widgets to left_xxx and right_xxx
+	* src/gnome-utils/dialog-transfer.c: if in "accountant mode" call
+	  "transfer from" "credit account" and "transfer to" "debit account"
+	  and interchange account trees
+
 2004-01-16  Derek Atkins  <derek at ihtfp.com>
 
 	* configure.in: fix a typo in the help (was --diable-gui).  Fixes #131414

==================================================
Differences for configure.in (revision 1.359.2.28 -> 1.359.2.29)
==================================================
--- /home/cvs/cvsroot/gnucash/configure.in	2004/01/17 01:50:06	1.359.2.28
+++ /home/cvs/cvsroot/gnucash/configure.in	2004/03/03 23:15:05	1.359.2.29
@@ -580,6 +580,7 @@
   fi)
 if test x${MT940_DIR} = xmt940 ;
 then
+    AC_MSG_ERROR([Sorry, MT940 support is currently broken since it depends on the hbci module with the old openhbci 0.9.x library. But the hbci module now has been ported to the new openhbci2 library. The MT940 importer needs to be ported to openhbci2 as well before this can be enabled again.])
     AM_PATH_OPENHBCI(0.9.13.2)
     # Note: HBCI_LIBS is changed again below in the --enable-hbci
     # section. So check for mt940 first and *not* the other way round!
@@ -601,7 +602,10 @@
   fi)
 if test x${HBCI_DIR} = xhbci ;
 then
-    AM_PATH_OPENHBCI(0.9.13)
+    AM_PATH_OPENHBCI2(1.9.0.8)
+    #all_libraries="$all_libraries $OPENHBCI_LIBS"
+    #all_includes="$all_includes $OPENHBCI_CXXFLAGS"
+    #AM_PATH_OPENHBCI(0.9.13)
     HBCI_LIBS="${OPENHBCI_LIBS}"
     HBCI_CFLAGS="${OPENHBCI_CFLAGS}"
 

==================================================
Initial contents of new file openhbci2.m4
==================================================
--- /dev/null	2003-09-15 09:40:47.000000000 -0400
+++ openhbci2.m4	2004-03-03 18:14:55.000000000 -0500
@@ -0,0 +1,196 @@
+# Configure paths for OpenHBCI
+# by Christian Stimming 2002-07-30, updated 2003-05-09
+# Copied from glib-2.0.m4 by Owen Taylor     1997-2001
+
+dnl AM_PATH_OPENHBCI2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for OPENHBCI, and define OPENHBCI_CFLAGS, OPENHBCI_CXXFLAGS and OPENHBCI_LIBS
+dnl
+AC_DEFUN(AM_PATH_OPENHBCI2, [
+dnl 
+dnl Get the c[xx]flags and libraries from openhbci2-config
+dnl
+AC_MSG_CHECKING(for OpenHBCI)
+AC_ARG_ENABLE(openhbcitest, [  --disable-openhbcitest      do not try to compile and run a test OpenHBCI program],
+		    , enable_openhbcitest=yes)
+
+AC_ARG_WITH( openhbci-prefix,
+  [  --with-openhbci-prefix=PFX   Prefix where OpenHBCI is installed],
+  OPENHBCI_PREFIX="$with_openhbci_prefix",
+  OPENHBCI_PREFIX="${prefix} \
+		/usr/local \
+		/usr/local/openhbci \
+		/usr")
+
+hbci_config=""
+for li in $OPENHBCI_PREFIX; do
+  if test -x "${li}/bin/openhbci2-config"; then
+    hbci_config="${li}/bin/openhbci2-config"
+    hbci_dir="${li}"
+    break
+  fi
+done
+
+if test -x "${hbci_config}" ; then
+  OPENHBCI_LIBS="`${hbci_config} --libraries`"
+  OPENHBCI_CFLAGS="`${hbci_config} --includes`"
+  OPENHBCI_CXXFLAGS="`${hbci_config} --includes`"
+  OPENHBCI_PLUGINS="`${hbci_config} --plugins`"
+else
+  AC_MSG_ERROR([
+  Could not find bin/openhbci2-config in prefix ${OPENHBCI_PREFIX}.
+  Please specify the right path by --with-openhbci-prefix=PREFIX.
+  ])
+fi  
+AC_MSG_RESULT($hbci_dir)
+
+min_openhbci_version=ifelse([$1], ,0.9.0.0,$1)
+AC_MSG_CHECKING(for OpenHBCI - version >= $min_openhbci_version)
+dnl AC_LANG_PUSH(C++) -- DON'T use C++ here!!!
+
+if test "x$enable_openhbcitest" = "xyes" ; then
+  ac_save_CFLAGS="$CFLAGS"
+  ac_save_LIBS="$LIBS"
+  CFLAGS="$CFLAGS $OPENHBCI_CFLAGS"
+  LIBS="$OPENHBCI_LIBS $LIBS"
+dnl
+dnl Now check if the installed OpenHBCI is sufficiently new. (Also sanity
+dnl checks the results of path guessing to some extent)
+dnl
+  rm -f conf.openhbcitest
+  AC_TRY_RUN([
+#include <openhbci2.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef OPENHBCI_VERSION_BUILD
+#  define OPENHBCI_VERSION_BUILD 0
+#endif
+int 
+main ()
+{
+  int major, minor, micro, build;
+  int getmajor, getminor, getmicro, getbuild;
+  char *tmp_version;
+
+  system ("touch conf.openhbcitest");
+
+  /* HP/UX 9 writes to sscanf strings */
+  tmp_version = strdup("$min_openhbci_version");
+  build=0;
+  if (sscanf(tmp_version, "%d.%d.%d.%d", &major, &minor, &micro, &build) != 4)
+  {
+    build = 0;
+    if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3)
+    {
+      micro = 0;
+      if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2)
+      {
+        minor = 0;
+        if (sscanf(tmp_version, "%d", &major) != 1)
+        {
+          printf("\n*** AM PATH OPENHBCI: bad version string: %s\n", "$min_openhbci_version");
+          exit(1);
+        }
+      }
+    }
+  }
+
+  HBCI_Hbci_libraryVersion_build(&getmajor, &getminor, &getmicro, &getbuild);
+
+  if ((getmajor != OPENHBCI_VERSION_MAJOR) ||
+      (getminor != OPENHBCI_VERSION_MINOR) ||
+      (getmicro != OPENHBCI_VERSION_PATCHLEVEL) ||
+      (getbuild != OPENHBCI_VERSION_BUILD))
+    {
+      printf("\n*** OpenHBCI header files openhbci2.h "
+	     "(version %d.%d.%d build %d) do not match\n",
+	     OPENHBCI_VERSION_MAJOR, 
+	     OPENHBCI_VERSION_MINOR, 
+	     OPENHBCI_VERSION_PATCHLEVEL,
+	     OPENHBCI_VERSION_BUILD);
+      printf("*** installed library libopenhbci.so "
+	     "(version %d.%d.%d build %d)\n",
+	     getmajor, getminor, getmicro, getbuild);
+      exit(1);
+    }
+  else
+    {
+      if ((getmajor > major) ||
+	  ((getmajor == major) && (getminor > minor)) ||
+	  ((getmajor == major) && (getminor == minor) && (getmicro > micro)) ||
+	  ((getmajor == major) && (getminor == minor) && 
+	   (getmicro == micro) && (getbuild >= build)))
+	{
+	  return 0;
+	}
+      else
+	{
+	  printf("\n*** An old version of OpenHBCI (%d.%d.%d build %d) was found.\n",
+		 getmajor, getminor, getmicro, getbuild);
+	  printf("*** You need OpenHBCI in version %d.%d.%d build %d or newer. The latest\n",
+		 major, minor, micro, build);
+	  printf("*** version of OpenHBCI is always available from http://www.openhbci.de.\n");
+	  if (build > 0)
+	    printf("*** Note: The non-zero build number '%d' indicates that the latest CVS \n"
+		   "*** version of openhbci is required.\n", build);
+	  printf("***\n"
+	"*** If you have already installed a sufficiently new version, this error\n"
+	"*** probably means that you need to specify the right path by\n"
+	"*** --with-openhbci-prefix=PATH.  (Also, check that your LD_LIBRARY_PATH\n"
+	"*** enviroment variable is correct, or edit /etc/ld.so.conf\n"
+	"*** so that the correct libraries are found at run-time)\n");
+	}
+    }
+  return 1;
+}
+],, no_openhbci=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+  CFLAGS="$ac_save_CFLAGS"
+  LIBS="$ac_save_LIBS"
+fi
+if test "x$no_openhbci" = x ; then
+  AC_MSG_RESULT(yes)
+  ifelse([$2], , :, [$2])     
+else
+  AC_MSG_RESULT(no)
+  if test -f conf.openhbcitest ; then
+    :
+  else
+    echo "*** Could not run OpenHBCI test program, checking why..."
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $OPENHBCI_CFLAGS"
+    LIBS="$LIBS $OPENHBCI_LIBS"
+    AC_TRY_LINK([
+#include <openhbci2.h>
+#include <stdio.h>
+],      [ return ((OPENHBCI_VERSION_MAJOR) || (OPENHBCI_VERSION_MINOR)); ],
+        [ echo "***"
+	  echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding OpenHBCI or finding the wrong"
+          echo "*** version of OpenHBCI. If it is not finding OpenHBCI, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system."
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH." 
+	  echo "***" ],
+        [ echo "***"
+	  echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means OpenHBCI is incorrectly installed."])
+    CFLAGS="$ac_save_CFLAGS"
+    LIBS="$ac_save_LIBS"
+  fi
+  OPENHBCI_CFLAGS=""
+  OPENHBCI_LIBS=""
+  ifelse([$3], , :, [$3])
+  exit 1;
+fi
+AC_SUBST(OPENHBCI_CFLAGS)
+AC_SUBST(OPENHBCI_LIBS)
+AC_SUBST(OPENHBCI_CXXFLAGS)
+AC_SUBST(OPENHBCI_PLUGINS)
+dnl AC_LANG_POP(C++)
+rm -f conf.openhbcitest
+])

==================================================
Differences for gnucash-build-env.in (revision 1.10.2.1 -> 1.10.2.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/bin/overrides/gnucash-build-env.in	2003/07/17 07:43:20	1.10.2.1
+++ /home/cvs/cvsroot/gnucash/src/bin/overrides/gnucash-build-env.in	2004/03/03 23:15:05	1.10.2.2
@@ -64,9 +64,12 @@
   --gnc-module-dir ${top_builddir}/src/business/business-ledger \
   --gnc-module-dir ${top_builddir}/src/business/business-gnome \
   --guile-load-dir ${top_builddir}/src/business/business-reports \
+  --gnc-module-dir ${top_builddir}/src/import-export \
   --gnc-module-dir ${top_builddir}/src/import-export/qif-io-core \
   --gnc-module-dir ${top_builddir}/src/import-export/qif-import \
   --gnc-module-dir ${top_builddir}/src/import-export/binary-import \
+  --gnc-module-dir ${top_builddir}/src/import-export/ofx \
+  --gnc-module-dir ${top_builddir}/src/import-export/hbci \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/register/ledger-core \
   --gnc-module-dir ${top_builddir}/src/register/register-gnome \

==================================================
Differences for gncJob.c (revision 1.18.4.2 -> 1.18.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/business/business-core/gncJob.c	2003/10/25 06:37:11	1.18.4.2
+++ /home/cvs/cvsroot/gnucash/src/business/business-core/gncJob.c	2004/03/03 23:15:05	1.18.4.3
@@ -220,12 +220,12 @@
   if (!owner) return;
   if (gncOwnerEqual (owner, &(job->owner))) return;
 
-  switch (gncOwnerGetType (&(job->owner))) {
+  switch (gncOwnerGetType (owner)) {
   case GNC_OWNER_CUSTOMER:
   case GNC_OWNER_VENDOR:
     break;
   default:
-    PERR("Unsupported Owner type");
+    PERR("Unsupported Owner type: %d", gncOwnerGetType(owner));
     return;
   }
 

==================================================
Differences for Account.c (revision 1.222.4.4 -> 1.222.4.5)
==================================================
--- /home/cvs/cvsroot/gnucash/src/engine/Account.c	2004/01/17 02:18:00	1.222.4.4
+++ /home/cvs/cvsroot/gnucash/src/engine/Account.c	2004/03/03 23:15:05	1.222.4.5
@@ -2411,8 +2411,9 @@
 
   xaccAccountBeginEdit (account);
 
-  frame = kvp_frame_get_frame (account->inst.kvp_data, 
+  frame = kvp_frame_get_frame_slash (account->inst.kvp_data, 
          "/reconcile-info/last-interval");
+  g_assert(frame);
 
   kvp_frame_set_gint64 (frame, "months", months);
   kvp_frame_set_gint64 (frame, "days", days);

==================================================
Differences for gnc-commodity.c (revision 1.39.4.8 -> 1.39.4.9)
==================================================
--- /home/cvs/cvsroot/gnucash/src/engine/gnc-commodity.c	2003/11/29 02:56:56	1.39.4.8
+++ /home/cvs/cvsroot/gnucash/src/engine/gnc-commodity.c	2004/03/03 23:15:05	1.39.4.9
@@ -93,6 +93,7 @@
 } gnc_new_iso_codes[] = {
   {"RUB", "RUR"}, // Russian Ruble
   {"PLZ", "PLN"}, // Polish Zloty
+  {"UAG", "UAH"}, // Ukraine Hryvnia
 };
 #define GNC_NEW_ISO_CODES \
         (sizeof(gnc_new_iso_codes) / sizeof(struct gnc_new_iso_code))

==================================================
Differences for iso-4217-currencies.scm (revision 1.7.4.1 -> 1.7.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/engine/iso-4217-currencies.scm	2003/07/17 07:50:44	1.7.4.1
+++ /home/cvs/cvsroot/gnucash/src/engine/iso-4217-currencies.scm	2004/03/03 23:15:05	1.7.4.2
@@ -178,7 +178,7 @@
 ( "Turkmenistan Manat" "manat" "tenga" "ISO4217" "TMM" "795" 100 100 )
 ( "US Dollar" "dollar" "cent" "ISO4217" "USD" "840" 100 100 )
 ( "Uganda Shilling" "shilling" "cent"  "ISO4217" "UGX" "800" 100 100  )
-( "Ukraine Hryvnia" "hryvnia" "kopiyka"  "ISO4217" "UAG" "804" 100 100 )
+( "Ukraine Hryvnia" "hryvnia" "kopiyka"  "ISO4217" "UAH" "804" 100 100 )
 ( "United Arab Emirates Dirham" "dirham" "fil" "ISO4217" "AED" "784" 100 100 )
 ( "Uruguayan Peso" "peso" "centesimo" "ISO4217" "UYU" "858" 100 100 )
 ( "Uzbekistani Sum" "som" "tiyin" "ISO4217" "UZS" "860" 100 100 )

==================================================
Differences for kvp_frame.h (revision 1.22.4.4 -> 1.22.4.5)
==================================================
--- /home/cvs/cvsroot/gnucash/src/engine/kvp_frame.h	2003/10/25 06:45:44	1.22.4.4
+++ /home/cvs/cvsroot/gnucash/src/engine/kvp_frame.h	2004/03/03 23:15:05	1.22.4.5
@@ -286,7 +286,7 @@
   are "non-copying" -- the returned item is the actual item stored.
   Do not delete this item unless you take the required care to avoid
   possible bad pointer derefrences (i.e. core dumps).  Also, be 
-  careful anging on to those references if you are also storing
+  careful hanging on to those references if you are also storing
   at the same path names: the referenced item will be freed during
   the store.
 
@@ -305,22 +305,49 @@
                                    guint64 * size_return); 
 Timespec    kvp_frame_get_timespec(const KvpFrame *frame, const char *path);
 KvpValue  * kvp_frame_get_value(const KvpFrame *frame, const char *path);
+/** Value accessor.  Takes a unix-style slash-separated path as an
+ *  argument, and return the KvpFrame stored at that location.  If the
+ *  KvpFrame does not exist, then a NULL is returned.
+ *
+ *  @note The semantics here have changed: In gnucash-1.8, if the
+ *  KvpFrame did not exist, this function automatically created one
+ *  and returned it. However, now this function will return NULL in
+ *  this case and the caller has to create a KvpFrame on his own. The
+ *  old functionality is now implemented by
+ *  kvp_frame_get_frame_path(). This happened on 2003-09-14, revision
+ *  1.31. FIXME: Is it really a good idea to change the semantics of
+ *  an existing function and move the old semantics to a new
+ *  function??! It would save us a lot of trouble if the new semantics
+ *  would have been available in a new function!
+ *
+ *  @return The KvpFrame at the specified path, or NULL if it doesn't
+ *  exist.
+*/
 KvpFrame  * kvp_frame_get_frame(const KvpFrame *frame, const char *path);
 
 /** This routine returns the last frame of the path.
  *  If the frame path doesn't exist, it is created.  
  *  Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame()
+ *
+ *  @note The semantics of this function implemented the gnucash-1.8
+ *  behaviour of kvp_frame_get_frame: In gnucash-1.8, if the KvpFrame
+ *  did not exist, kvp_frame_get_frame automatically created one and
+ *  returned it. However, now that one will return NULL in this case
+ *  and the caller has to create a KvpFrame on his own. The old
+ *  functionality is implemented by this
+ *  kvp_frame_get_frame_path(). This happened on 2003-09-14, revision
+ *  1.31.
  */
 KvpFrame    * kvp_frame_get_frame_path (KvpFrame *frame, const char *,...);
 
-/** This routine return the last frame of the path.
+/** This routine returns the last frame of the path.
  *  If the frame path doesn't exist, it is created.  
  *  Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame()
  */
 KvpFrame    * kvp_frame_get_frame_gslist (KvpFrame *frame,
                                            GSList *key_path);
 
-/** This routine return the last frame of the path.
+/** This routine returns the last frame of the path.
  *  If the frame path doesn't exist, it is created.  
  *  Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame()
  *

==================================================
Differences for dialog-transfer.c (revision 1.9.4.17 -> 1.9.4.18)
==================================================
--- /home/cvs/cvsroot/gnucash/src/gnome-utils/dialog-transfer.c	2004/03/03 04:42:53	1.9.4.17
+++ /home/cvs/cvsroot/gnucash/src/gnome-utils/dialog-transfer.c	2004/03/03 23:15:05	1.9.4.18
@@ -89,6 +89,9 @@
   gint desc_cursor_position;
   gboolean desc_didquickfill;
 
+  GtkWidget * from_transfer_frame;
+  GtkWidget * to_transfer_frame;
+
   GtkWidget * from_currency_label;
   GtkWidget * to_currency_label;
 
@@ -424,15 +427,47 @@
   GtkTreeView *tree_view;
   const char *show_inc_exp_message = _("Show the income and expense accounts");
   GtkWidget *scroll_win, *box;
-  GtkCheckButton *button;
+  GtkWidget *button;
   GtkTreeSelection *selection;
+  gboolean  use_accounting_labels;
 
-  box = gnc_glade_lookup_widget (xferData->dialog,
-				(direction == XFER_DIALOG_TO) ? "to_tree_box" : "from_tree_box");
-  button = GTK_CHECK_BUTTON (gnc_glade_lookup_widget (xferData->dialog,
-				(direction == XFER_DIALOG_TO) ? "to_show_button" : "from_show_button"));
-  scroll_win = gnc_glade_lookup_widget (xferData->dialog,
-				(direction == XFER_DIALOG_TO) ? "to_window" : "from_window");
+  use_accounting_labels = gnc_lookup_boolean_option("Accounts",
+						    "Use accounting labels",
+						    FALSE);
+
+  /* In "normal" mode (non accounting terms) the account where the
+   * money comes from is displayed on the left side and the account
+   * where the money gets transferred to is displayed on the right
+   * side. In accounting terms the "from" account is called the
+   * "credit" account ("Haben" in german) and the "to" account is
+   * called "debit" account ("Soll" in german). Accountants told me
+   * that they always want the credit account on the right side
+   * and the debit on the left side (like the debit and credit
+   * columns in the register window). So reverse from and to account
+   * trees when in "accountant" mode. -- Herbert Thoma, 2004-01-18
+   */
+  if(use_accounting_labels) {
+    box = gnc_glade_lookup_widget (xferData->dialog,
+				   (direction == XFER_DIALOG_TO) ?
+				   "left_tree_box" : "right_tree_box");
+    button = gnc_glade_lookup_widget (xferData->dialog,
+				      (direction == XFER_DIALOG_TO) ?
+				      "left_show_button" : "right_show_button");
+    scroll_win = gnc_glade_lookup_widget (xferData->dialog,
+					  (direction == XFER_DIALOG_TO) ?
+					  "left_trans_window" : "right_trans_window");
+  }
+  else {
+    box = gnc_glade_lookup_widget (xferData->dialog,
+				   (direction == XFER_DIALOG_TO) ?
+				   "right_tree_box" : "left_tree_box");
+    button = gnc_glade_lookup_widget (xferData->dialog,
+				      (direction == XFER_DIALOG_TO) ?
+				      "right_show_button" : "left_show_button");
+    scroll_win = gnc_glade_lookup_widget (xferData->dialog,
+					  (direction == XFER_DIALOG_TO) ?
+					  "right_trans_window" : "left_trans_window");
+  }
 
   tree_view = GTK_TREE_VIEW(gnc_tree_view_account_new(FALSE));
   gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(tree_view));
@@ -450,9 +485,6 @@
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
   gtk_tooltips_set_tip (xferData->tips, GTK_WIDGET (button), show_inc_exp_message, NULL);
 
-  g_signal_connect (G_OBJECT (button), "toggled",
-		    G_CALLBACK (gnc_xfer_dialog_toggle_cb), tree_view);
-
   if (direction == XFER_DIALOG_TO) {
     xferData->to_tree_view = tree_view;
     xferData->to_window = scroll_win;
@@ -466,6 +498,8 @@
     g_signal_connect (G_OBJECT (selection), "changed",
 		      G_CALLBACK (gnc_xfer_dialog_from_tree_selection_changed_cb), xferData);
   }
+  g_signal_connect (G_OBJECT (button), "toggled",
+		    G_CALLBACK (gnc_xfer_dialog_toggle_cb), tree_view);
 }
 
 
@@ -1588,6 +1622,11 @@
 {
   GtkWidget *dialog;
   GladeXML  *xml;
+  gboolean  use_accounting_labels;
+
+  use_accounting_labels = gnc_lookup_boolean_option("Accounts",
+						    "Use accounting labels",
+						    FALSE);
 
   ENTER(" ");
   xml = gnc_glade_xml_new ("transfer.glade", "Transfer Dialog");
@@ -1658,16 +1697,49 @@
 
   /* from and to */
   {
-    GtkWidget *label;
+    GtkWidget *label, *frame;
 
     gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_TO);
     gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_FROM);
 
-    label = glade_xml_get_widget (xml, "from_currency_label");
-    xferData->from_currency_label = label;
+    /* Reverse from and to account trees when in "accountant" mode,
+       see comment in function gnc_xfer_dialog_fill_tree_frame */
+    if(use_accounting_labels) {
+      frame = glade_xml_get_widget (xml, "right_trans_frame");
+      xferData->from_transfer_frame = frame;
 
-    label = glade_xml_get_widget (xml, "to_currency_label");
-    xferData->to_currency_label = label;
+      frame = glade_xml_get_widget (xml, "left_trans_frame");
+      xferData->to_transfer_frame = frame;
+
+      gtk_frame_set_label(GTK_FRAME(xferData->from_transfer_frame),
+			  _("Credit Account"));
+      gtk_frame_set_label(GTK_FRAME(xferData->to_transfer_frame),
+			  _("Debit Account"));
+
+      label = glade_xml_get_widget (xml, "right_currency_label");
+      xferData->from_currency_label = label;
+
+      label = glade_xml_get_widget (xml, "left_currency_label");
+      xferData->to_currency_label = label;
+    }
+    else {
+      frame = glade_xml_get_widget (xml, "left_trans_frame");
+      xferData->from_transfer_frame = frame;
+
+      frame = glade_xml_get_widget (xml, "right_trans_frame");
+      xferData->to_transfer_frame = frame;
+
+      gtk_frame_set_label(GTK_FRAME(xferData->from_transfer_frame),
+			  _("Transfer From"));
+      gtk_frame_set_label(GTK_FRAME(xferData->to_transfer_frame),
+			  _("Transfer To"));
+
+      label = glade_xml_get_widget (xml, "left_currency_label");
+      xferData->from_currency_label = label;
+
+      label = glade_xml_get_widget (xml, "right_currency_label");
+      xferData->to_currency_label = label;
+    }
 
     label = glade_xml_get_widget (xml, "conv_forward");
     xferData->conv_forward = label;
@@ -1700,7 +1772,7 @@
     gtk_entry_set_activates_default(GTK_ENTRY (entry), TRUE);
 
     edit = gnc_amount_edit_new();
-    hbox = glade_xml_get_widget (xml, "to_amount_hbox");
+    hbox = glade_xml_get_widget (xml, "right_amount_hbox");
     gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
     xferData->to_amount_edit = edit;
     entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (edit));
@@ -1715,8 +1787,17 @@
 
     button = glade_xml_get_widget (xml, "amount_radio");
     xferData->amount_radio = button;
-    g_signal_connect (G_OBJECT (xferData->amount_radio),
-		      "toggled", G_CALLBACK (price_amount_radio_toggled_cb), xferData);
+    g_signal_connect(G_OBJECT(xferData->amount_radio), "toggled",
+		     G_CALLBACK(price_amount_radio_toggled_cb),
+		     xferData);
+    if(use_accounting_labels) {
+      gtk_label_set_text(GTK_LABEL(GTK_BIN(xferData->amount_radio)->child),
+			 _("Debit Amount:"));
+    }
+    else {
+      gtk_label_set_text(GTK_LABEL(GTK_BIN(xferData->amount_radio)->child),
+			 _("To Amount:"));
+    }
   }
   LEAVE(" ");
 }

==================================================
Differences for transfer.glade (revision 1.2.4.4 -> 1.2.4.5)
==================================================
--- /home/cvs/cvsroot/gnucash/src/gnome-utils/transfer.glade	2003/09/06 07:21:25	1.2.4.4
+++ /home/cvs/cvsroot/gnucash/src/gnome-utils/transfer.glade	2004/03/03 23:15:05	1.2.4.5
@@ -353,7 +353,7 @@
 	      <property name="spacing">0</property>
 
 	      <child>
-		<widget class="GtkFrame" id="transferfrom-frame">
+		<widget class="GtkFrame" id="left_trans_frame">
 		  <property name="border_width">3</property>
 		  <property name="visible">True</property>
 		  <property name="label_xalign">0</property>
@@ -368,7 +368,7 @@
 		      <property name="spacing">6</property>
 
 		      <child>
-			<widget class="GtkScrolledWindow" id="from_window">
+			<widget class="GtkScrolledWindow" id="left_trans_window">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
 			  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -382,7 +382,7 @@
 			      <property name="shadow_type">GTK_SHADOW_IN</property>
 
 			      <child>
-				<widget class="GtkHBox" id="from_tree_box">
+				<widget class="GtkHBox" id="left_tree_box">
 				  <property name="visible">True</property>
 				  <property name="homogeneous">False</property>
 				  <property name="spacing">0</property>
@@ -431,7 +431,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="from_currency_label">
+			    <widget class="GtkLabel" id="left_currency_label">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes"> </property>
 			      <property name="use_underline">False</property>
@@ -459,7 +459,7 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="from_show_button">
+			<widget class="GtkCheckButton" id="left_show_button">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
 			  <property name="label" translatable="yes">Show Income/Expense</property>
@@ -505,7 +505,7 @@
 	      </child>
 
 	      <child>
-		<widget class="GtkFrame" id="transferto-frame">
+		<widget class="GtkFrame" id="right_trans_frame">
 		  <property name="border_width">3</property>
 		  <property name="visible">True</property>
 		  <property name="label_xalign">0</property>
@@ -520,7 +520,7 @@
 		      <property name="spacing">6</property>
 
 		      <child>
-			<widget class="GtkScrolledWindow" id="to_window">
+			<widget class="GtkScrolledWindow" id="right_trans_window">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
 			  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -534,7 +534,7 @@
 			      <property name="shadow_type">GTK_SHADOW_IN</property>
 
 			      <child>
-				<widget class="GtkHBox" id="to_tree_box">
+				<widget class="GtkHBox" id="right_tree_box">
 				  <property name="visible">True</property>
 				  <property name="homogeneous">False</property>
 				  <property name="spacing">0</property>
@@ -583,7 +583,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="to_currency_label">
+			    <widget class="GtkLabel" id="right_currency_label">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes"> </property>
 			      <property name="use_underline">False</property>
@@ -611,7 +611,7 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkCheckButton" id="to_show_button">
+			<widget class="GtkCheckButton" id="right_show_button">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
 			  <property name="label" translatable="yes">Show Income/Expense</property>
@@ -744,7 +744,7 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkHBox" id="to_amount_hbox">
+		    <widget class="GtkHBox" id="right_amount_hbox">
 		      <property name="visible">True</property>
 		      <property name="homogeneous">False</property>
 		      <property name="spacing">0</property>

==================================================
Differences for import-account-matcher.c (revision 1.7.4.5 -> 1.7.4.6)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/import-account-matcher.c	2003/11/01 22:41:39	1.7.4.5
+++ /home/cvs/cvsroot/gnucash/src/import-export/import-account-matcher.c	2004/03/03 23:15:06	1.7.4.6
@@ -48,7 +48,7 @@
   GtkWidget       * dialog;
   GncTreeViewAccount *account_tree;
   GtkWidget       * account_tree_box;
-  gchar * account_human_description;
+  const gchar * account_human_description;
   gchar * account_online_id_value;
   gnc_commodity * new_account_default_commodity;
   GNCAccountType new_account_default_type;
@@ -123,8 +123,8 @@
 }
 
 Account * gnc_import_select_account(char * account_online_id_value,
-				    char auto_create,
-				    char * account_human_description,
+				    gboolean auto_create,
+				    const char * account_human_description,
 				    gnc_commodity * new_account_default_commodity,
 				    GNCAccountType new_account_default_type,
 				    Account * default_selection,

==================================================
Differences for import-account-matcher.h (revision 1.3 -> 1.3.4.1)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/import-account-matcher.h	2002/12/09 00:21:36	1.3
+++ /home/cvs/cvsroot/gnucash/src/import-export/import-account-matcher.h	2004/03/03 23:15:06	1.3.4.1
@@ -36,9 +36,10 @@
   again).  If the user refuses to select or create an account, NULL is
   returned.
 
-    @param account_online_id_value The string containing your unique account_id
-    coming from some string of your module.  This is the normal mode of
-    operation.
+    @param account_online_id_value The string containing your unique
+    account_id coming from some string of your module.  This is the
+    normal mode of operation. (FIXME: is this string still owned by
+    the caller or does this function take ownership?)
 
     If account_online_id_value==NULL, you basically end up with an account
     selector that allows you to select an account whose GUID will be 
@@ -83,8 +84,8 @@
   account was found or created.
 */
 Account * gnc_import_select_account(char * account_online_id_value,
-				    char auto_create,
-				    char * account_human_description,
+				    gboolean auto_create,
+				    const char * account_human_description,
 				    gnc_commodity * new_account_default_commodity,
 				    GNCAccountType new_account_default_type,
 				    Account * default_selection,

==================================================
Differences for import-backend.c (revision 1.19.2.3 -> 1.19.2.4)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/import-backend.c	2003/10/25 06:47:49	1.19.2.3
+++ /home/cvs/cvsroot/gnucash/src/import-export/import-backend.c	2004/03/03 23:15:06	1.19.2.4
@@ -837,7 +837,8 @@
 	      xaccSplitSetValue (split, v);
 	      xaccSplitSetAmount (split, v);
 	    }
-	    xaccSplitSetMemo (split, _("Auto-Balance split"));
+	    /*xaccSplitSetMemo (split, _("Auto-Balance split"));
+	      -- disabled due to popular request */
 	  }
 	  
 	  xaccSplitSetReconcile(gnc_import_TransInfo_get_fsplit (trans_info), CREC);

==================================================
Initial contents of new file gnc-hbci-account.c
==================================================
--- /dev/null	2003-09-15 09:40:47.000000000 -0400
+++ gnc-hbci-account.c	2004-03-03 18:15:01.000000000 -0500
@@ -0,0 +1,344 @@
+/********************************************************************\
+ * gnc-hbci-account.c -- hbci account functions                     *
+ * Copyright (C) 2004 Christian Stimming                            *
+ *                                                                  *
+ * 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 of   *
+ * the License, 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
+ * Boston, MA  02111-1307,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+#include "gnc-hbci-account.h"
+
+#include <gnome.h>
+#include <errno.h>
+#include <openhbci2.h>
+#include <openhbci2/error.h>
+#include "Account.h"
+
+#include "hbci-interaction.h"
+
+/* static short module = MOD_IMPORT; */
+
+struct _gnc_HBCI_Account 
+{
+  const HBCI_Bank *bank;
+  char *bankCode;
+  char *accountid;
+  char *name;
+  char *customer;
+  char *currency;
+  char *name1;
+};
+
+gnc_HBCI_Account *gnc_HBCI_Account_new(const HBCI_Bank *bank, 
+				       const char *bankCode,
+				       const char *accountid)
+{
+  gnc_HBCI_Account *r = g_new0(gnc_HBCI_Account, 1);
+  r->bank = bank;
+  r->bankCode = g_strdup (bankCode);
+  r->accountid = g_strdup (accountid);
+  return r;
+}
+void gnc_HBCI_Account_delete (gnc_HBCI_Account *h)
+{
+  if (!h) return;
+  g_free(h->bankCode);
+  g_free(h->accountid);
+  if (h->name) g_free(h->name);
+  if (h->customer) g_free(h->customer);
+  if (h->currency) g_free(h->currency);
+  if (h->name1) g_free(h->name1);
+  g_free(h);
+}
+
+const char *gnc_HBCI_Account_accountId (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->accountid;
+}
+const char *gnc_HBCI_Account_bankCode (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->bankCode;
+}
+const HBCI_Bank *
+gnc_HBCI_Account_bank (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->bank;
+}
+
+
+void gnc_HBCI_Account_set_name (gnc_HBCI_Account *hbci_acc, const char *n)
+{
+  g_assert(hbci_acc);
+  if (hbci_acc->name) g_free(hbci_acc->name);
+  hbci_acc->name = g_strdup(n);
+}
+void gnc_HBCI_Account_set_customer (gnc_HBCI_Account *hbci_acc, const char *n)
+{
+  g_assert(hbci_acc);
+  if (hbci_acc->customer) g_free(hbci_acc->customer);
+  hbci_acc->customer = g_strdup(n);
+}
+void gnc_HBCI_Account_set_currency (gnc_HBCI_Account *hbci_acc, const char *n)
+{
+  g_assert(hbci_acc);
+  if (hbci_acc->currency) g_free(hbci_acc->currency);
+  hbci_acc->currency = g_strdup(n);
+}
+void gnc_HBCI_Account_set_name1 (gnc_HBCI_Account *hbci_acc, const char *n)
+{
+  g_assert(hbci_acc);
+  if (hbci_acc->name1) g_free(hbci_acc->name1);
+  hbci_acc->name1 = g_strdup(n);
+}
+const char *gnc_HBCI_Account_name (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->name;
+}
+const char *gnc_HBCI_Account_customer (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->customer;
+}
+const char *gnc_HBCI_Account_currency (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->currency;
+}
+const char *gnc_HBCI_Account_name1 (const gnc_HBCI_Account *hbci_acc)
+{
+  g_assert(hbci_acc);
+  return hbci_acc->name1;
+}
+
+gchar *gnc_HBCI_Account_longname(const gnc_HBCI_Account *hacc)
+{
+  g_assert(hacc);
+  /* Translators: Strings are 1. Account code, 2. Bank name, 3. Bank code. */
+  return g_strdup_printf(_("%s at %s (code %s)"),
+			 gnc_HBCI_Account_accountId (hacc),
+			 gnc_HBCI_Account_bank (hacc) ? 
+			 HBCI_Bank_name (gnc_HBCI_Account_bank (hacc)) : 
+			 gnc_HBCI_Account_bankCode (hacc),
+			 gnc_HBCI_Account_bankCode (hacc));
+}
+
+void *list_HBCI_Account_foreach(GList *h_list, 
+				void*(*func_cb)(gnc_HBCI_Account *acc,
+						void *user_data), 
+				void *user_data)
+{
+  GList *iter;
+  g_assert(func_cb);
+  void *res = NULL;
+
+  if (!h_list) return NULL;
+
+  for (iter = h_list; iter; iter = iter->next)
+    {
+      if (iter->data)
+	res = func_cb(iter->data, user_data);
+      if (res)
+	break;
+    }
+  return res;
+}
+
+
+static void* del_func(gnc_HBCI_Account *acc, void *user_data)
+{
+    gnc_HBCI_Account_delete(acc);
+    return NULL;
+}
+
+
+void list_HBCI_Account_delete(GList *list_HBCI_Account)
+{
+    list_HBCI_Account_foreach(list_HBCI_Account, del_func, NULL);
+    g_list_free (list_HBCI_Account);
+}
+
+
+static void *hbci_find_acc_cb(gnc_HBCI_Account *acc, void *user_data)
+{
+  gnc_HBCI_Account *new_acc = user_data;
+  if (gnc_HBCI_Account_bank(acc) == gnc_HBCI_Account_bank(new_acc)) {
+    if (strcmp(gnc_HBCI_Account_accountId(acc),
+	       gnc_HBCI_Account_accountId(new_acc))==0) {
+      return acc;
+    }
+  }
+  return NULL;
+}
+
+  
+gnc_HBCI_Account *list_HBCI_Account_find(GList *list,
+					 const HBCI_Bank *bank, 
+					 const char *bankCode,
+					 const char *accountid)
+{
+  gnc_HBCI_Account *acc;
+  gnc_HBCI_Account *res;
+
+  if (list == NULL) return NULL;
+  g_assert(bank);
+  g_assert(bankCode);
+  g_assert(accountid);
+  
+  /* Create the wrapper object */
+  acc = gnc_HBCI_Account_new(bank, bankCode, accountid);
+
+  /* Check if such an account already exists */
+  res = list_HBCI_Account_foreach(list, hbci_find_acc_cb, acc);
+
+  gnc_HBCI_Account_delete(acc);
+  return res;
+}
+
+
+
+
+/* ------------------------------------------------------------ */
+
+#define HBCI_ACCOUNT_ID "account-id"
+#define HBCI_BANK_CODE "bank-code"
+#define HBCI_COUNTRY_CODE "country-code"
+#define HBCI_ACCOUNT_CURRENCY "acc-currency"
+#define HBCI_ACCOUNT_NAME "acc-name"
+#define HBCI_ACCOUNT_NAME1 "acc-name1"
+#define HBCI_ACCOUNT_CUSTOMER "acc-customer"
+
+/** Constructor from a kvp_frame */
+gnc_HBCI_Account *gnc_HBCI_Account_from_kvp(kvp_frame *k, HBCI_API *api)
+{
+  gnc_HBCI_Account *res = NULL;
+  HBCI_Bank *bank;
+  char *bankcode;
+  int countrycode;
+  g_assert(k);
+
+  bankcode = kvp_value_get_string (kvp_frame_get_slot(k, HBCI_BANK_CODE));
+  countrycode = kvp_value_get_gint64 (kvp_frame_get_slot(k, HBCI_COUNTRY_CODE));
+
+  if (bankcode && (strlen(bankcode)>0) && (countrycode > 0)) {
+    bank = HBCI_API_findBank (api, countrycode, bankcode);
+    /*printf("gnc_HBCI_Account_from_kvp: kvpframe has blz %s and ccode %d and accountid %s, bank %p\n",
+      bankcode, countrycode, kvp_value_get_string
+      (kvp_frame_get_slot(k, HBCI_ACCOUNT_ID)), bank);*/
+    if (!bank) {
+      printf("gnc_HBCI_Account_from_kvp: oops, the file has a HBCI_Account but its bank could not be found in the HBCI_API. Ignoring this account.\n");
+      return NULL;
+    }
+    res = gnc_HBCI_Account_new(bank, 
+			       bankcode,
+			       kvp_value_get_string
+			       (kvp_frame_get_slot(k, HBCI_ACCOUNT_ID)));
+    gnc_HBCI_Account_set_currency(res, kvp_value_get_string
+				  (kvp_frame_get_slot(k, HBCI_ACCOUNT_CURRENCY)));
+    gnc_HBCI_Account_set_name(res, kvp_value_get_string
+			      (kvp_frame_get_slot(k, HBCI_ACCOUNT_NAME)));
+    gnc_HBCI_Account_set_name1(res, kvp_value_get_string
+			       (kvp_frame_get_slot(k, HBCI_ACCOUNT_NAME1)));
+    gnc_HBCI_Account_set_customer(res, kvp_value_get_string
+				  (kvp_frame_get_slot(k, HBCI_ACCOUNT_CUSTOMER)));
+  }
+  return res;
+}
+
+/** Creates a kvp_frame from this TransTempl */
+kvp_frame *gnc_HBCI_Account_to_kvp(const gnc_HBCI_Account *t)
+{
+  kvp_frame *k = kvp_frame_new();
+  g_assert(t);
+
+  kvp_frame_set_slot(k, HBCI_ACCOUNT_ID, 
+		     kvp_value_new_string(gnc_HBCI_Account_accountId(t)));
+  kvp_frame_set_slot(k, HBCI_BANK_CODE, 
+		     kvp_value_new_string(gnc_HBCI_Account_bankCode (t)));
+  kvp_frame_set_slot(k, HBCI_ACCOUNT_CURRENCY, 
+		     kvp_value_new_string(gnc_HBCI_Account_currency (t)));
+  kvp_frame_set_slot(k, HBCI_ACCOUNT_NAME, 
+		     kvp_value_new_string(gnc_HBCI_Account_name (t)));
+  kvp_frame_set_slot(k, HBCI_ACCOUNT_NAME1, 
+		     kvp_value_new_string(gnc_HBCI_Account_name1 (t)));
+  kvp_frame_set_slot(k, HBCI_ACCOUNT_CUSTOMER, 
+		     kvp_value_new_string(gnc_HBCI_Account_customer (t)));
+  if (gnc_HBCI_Account_bank(t))
+    kvp_frame_set_slot(k, HBCI_COUNTRY_CODE, 
+		       kvp_value_new_gint64(HBCI_Bank_country 
+					    (gnc_HBCI_Account_bank(t))));
+  return k;
+}
+
+struct _glistapi
+{
+  GList *res;
+  HBCI_API *api;
+};
+/** Creates a GList of gnc_HBCI_Account from a GList of kvp_values which
+    in turn contain a kvp_frame. */
+static void glist_from_kvp_func(gpointer data, gpointer user_data)
+{
+  struct _glistapi *mydata = user_data;
+  kvp_value *k = data;
+  gnc_HBCI_Account *new_acc = gnc_HBCI_Account_from_kvp(kvp_value_get_frame(k),
+							mydata->api);
+  if (new_acc)
+    mydata->res = g_list_append(mydata->res, new_acc);
+}
+
+/** Creates a GList of gnc_HBCI_Account from a GList of kvp_values which
+    in turn contain a kvp_frame. */
+GList *gnc_HBCI_Account_glist_from_kvp_glist(GList *v, HBCI_API *api)
+{
+  struct _glistapi mydata;
+  if (!v) return NULL;
+
+  mydata.res = NULL;
+  mydata.api = api;
+  
+  g_list_foreach (v, glist_from_kvp_func, &mydata);
+  return mydata.res;
+}
+
+
+/** Creates a GList of kvp_value (which in turn contain a kvp_frame)
+    from a GList of gnc_HBCI_Account. */
+static void glist_to_kvp_func(gpointer data, gpointer user_data)
+{
+  GList **tmp = user_data;
+  GList *res = *tmp;
+  gnc_HBCI_Account *g = data;
+  *tmp = g_list_append(res, 
+		       kvp_value_new_frame_nc(gnc_HBCI_Account_to_kvp(g)));
+}
+/** Creates a GList of kvp_value (which in turn contain a kvp_frame)
+    from a GList of gnc_HBCI_Account. */
+GList *gnc_HBCI_Account_kvp_glist_from_glist(GList *k)
+{
+  GList *res = NULL;
+  if (!k) return NULL;
+
+  g_list_foreach (k, glist_to_kvp_func, &res);
+  return res;
+}
+
+

==================================================
Initial contents of new file gnc-hbci-account.h
==================================================
--- /dev/null	2003-09-15 09:40:47.000000000 -0400
+++ gnc-hbci-account.h	2004-03-03 18:15:01.000000000 -0500
@@ -0,0 +1,106 @@
+/********************************************************************\
+ * gnc-hbci-account.h -- hbci account definition                    *
+ * Copyright (C) 2004 Christian Stimming                            *
+ *                                                                  *
+ * 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 of   *
+ * the License, 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
+ * Boston, MA  02111-1307,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+/** @file 
+    Hbci account definition
+*/
+
+#ifndef GNC_HBCI_ACCOUNT_H
+#define GNC_HBCI_ACCOUNT_H
+
+#include <glib.h>
+#include <gnome.h>
+#include <openhbci2/api.h>
+
+#include "gnc-book.h"
+
+typedef struct _gnc_HBCI_Account gnc_HBCI_Account;
+/** @name HBCI_Account wrapper class */
+/*@{*/
+/** Constructor */
+gnc_HBCI_Account *gnc_HBCI_Account_new(const HBCI_Bank *bank, 
+				       const char *bankCode,
+				       const char *accountid);
+/** Returns the account id */
+const char *gnc_HBCI_Account_accountId (const gnc_HBCI_Account *hbci_acc);
+/** Returns the bank code -- this might be different than the actual
+ * bank's bank code */
+const char *gnc_HBCI_Account_bankCode (const gnc_HBCI_Account *hbci_acc);
+
+void gnc_HBCI_Account_set_name (gnc_HBCI_Account *hbci_acc, const char *n);
+void gnc_HBCI_Account_set_customer (gnc_HBCI_Account *hbci_acc, const char *n);
+void gnc_HBCI_Account_set_currency (gnc_HBCI_Account *hbci_acc, const char *n);
+void gnc_HBCI_Account_set_name1 (gnc_HBCI_Account *hbci_acc, const char *n);
+const char *gnc_HBCI_Account_name (const gnc_HBCI_Account *hbci_acc);
+const char *gnc_HBCI_Account_customer (const gnc_HBCI_Account *hbci_acc);
+const char *gnc_HBCI_Account_currency (const gnc_HBCI_Account *hbci_acc);
+const char *gnc_HBCI_Account_name1 (const gnc_HBCI_Account *hbci_acc);
+
+/** Returns the bank this account belongs to */
+const HBCI_Bank *
+gnc_HBCI_Account_bank (const gnc_HBCI_Account *hbci_acc);
+/** Destructor for this account object */
+void gnc_HBCI_Account_delete (gnc_HBCI_Account *hbci_acc);
+
+/** Returns a newly allocated string that is a human-readable
+ * description of this account. The returned string will be owned by
+ * the caller. */
+gchar *gnc_HBCI_Account_longname(const gnc_HBCI_Account *hbci_acc);
+/*@}*/
+
+/** @name List of hbci accounts */
+/*@{*/
+/** Foreach function */
+void *list_HBCI_Account_foreach(GList *list_HBCI_Account, 
+				void*(*func_cb)(gnc_HBCI_Account *acc,
+						void *user_data), 
+				void *user_data);
+/** Delete each element of a GList of HBCI_Accounts and finally the
+ * list itself.  */
+void list_HBCI_Account_delete(GList *list_HBCI_Account);
+
+/** Searches for an account with the given data fields. Returns this
+ * account, or NULL if none was found. */
+gnc_HBCI_Account *list_HBCI_Account_find(GList *list_HBCI_Account,
+					 const HBCI_Bank *bank, 
+					 const char *bankCode,
+					 const char *accountid);
+/*@}*/
+
+/** @name Serialization -- List of gnc_HBCI_Accounts to kvp_frame and
+ * back */
+/*@{*/
+/** Constructor from a kvp_frame (the kvp_frame is left unchanged) */
+gnc_HBCI_Account *gnc_HBCI_Account_from_kvp(kvp_frame *k, HBCI_API *api);
+/** Creates a kvp_frame from this TransTempl */
+kvp_frame *gnc_HBCI_Account_to_kvp(const gnc_HBCI_Account *t);
+
+/** Creates a GList of gnc_HBCI_Account from a GList of kvp_values which
+    in turn contain a kvp_frame. */
+GList *gnc_HBCI_Account_glist_from_kvp_glist(GList *v, HBCI_API *api);
+/** Creates a GList of kvp_value (which in turn contain a kvp_frame)
+    from a GList of gnc_HBCI_Account. */
+GList *gnc_HBCI_Account_kvp_glist_from_glist(GList *k);
+/*@}*/
+
+
+#endif /* GNC_HBCI_ACCOUNT_H */

==================================================
Differences for Makefile.am (revision 1.22.4.4 -> 1.22.4.5)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/Makefile.am	2003/10/26 00:06:26	1.22.4.4
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/Makefile.am	2004/03/03 23:15:06	1.22.4.5
@@ -8,6 +8,7 @@
   dialog-pass.c \
   dialog-hbcitrans.c \
   dialog-daterange.c \
+  gnc-hbci-account.c \
   gnc-hbci-kvp.c \
   gnc-hbci-utils.c \
   gnc-hbci-transfer.c \
@@ -16,7 +17,6 @@
   gnc-hbci-gettrans.c \
   gnc-plugin-hbci.c \
   hbci-interaction.c \
-  hbci-progressmon.c \
   druid-hbci-initial.c 
 
 # Must be included in tarball because they are listed in POTFILES.in
@@ -30,6 +30,7 @@
   druid-hbci-initial.h \
   druid-hbci-utils.h \
   gnc-hbci-actions.h \
+  gnc-hbci-account.h \
   gnc-hbci-getbalance.h \
   gnc-hbci-gettrans.h \
   gnc-hbci-kvp.h \

==================================================
Differences for dialog-hbcitrans.c (revision 1.9.4.7 -> 1.9.4.8)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c	2003/10/25 06:47:58	1.9.4.7
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c	2004/03/03 23:15:06	1.9.4.8
@@ -25,9 +25,8 @@
 #endif
 
 #include <gnome.h>
-#include <openhbci/bank.h>
-#include <openhbci/outboxaccjobs.h>
-#include <openhbci.h>
+#include <openhbci2/bank.h>
+#include <openhbci2.h>
 
 #include "dialog-utils.h"
 #include "gnc-ui.h"
@@ -142,7 +141,7 @@
 /* -------------------------------------- */
 
 HBCI_Transaction *
-hbci_trans_fill_values(const HBCI_Account *h_acc, HBCITransDialog *td);
+hbci_trans_fill_values(const gnc_HBCI_Account *h_acc, HBCITransDialog *td);
 gboolean
 check_ktoblzcheck(GtkWidget *parent, const HBCITransDialog *td, 
 		  const HBCI_Transaction *trans);
@@ -181,7 +180,7 @@
 
 HBCITransDialog *
 gnc_hbci_dialog_new (GtkWidget *parent,
-		const HBCI_Account *h_acc,
+		const gnc_HBCI_Account *h_acc,
 		const HBCI_Customer *customer,
 		Account *gnc_acc,
 		GNC_HBCI_Transtype trans_type,
@@ -198,7 +197,7 @@
   td->trans_type = trans_type;
   g_assert (h_acc);
   g_assert (customer);
-  bank = HBCI_Account_bank (h_acc);
+  bank = gnc_HBCI_Account_bank (h_acc);
   g_assert (bank);
 #if HAVE_KTOBLZCHECK_H
   td->blzcheck = AccountNumberCheck_new();
@@ -297,11 +296,11 @@
     
     /* Fill in the values from the objects */
     gtk_label_set_text (GTK_LABEL (orig_name_label), 
-			(strlen(HBCI_Customer_custName (customer))>0 ? 
-			 HBCI_Customer_custName (customer) :
+			(strlen(HBCI_Customer_name (customer)) > 0 ?
+			 HBCI_Customer_name (customer) :
 			 HBCI_Customer_custId (customer)));
     gtk_label_set_text (GTK_LABEL (orig_account_label), 
-			HBCI_Account_accountId (h_acc));
+			gnc_HBCI_Account_accountId (h_acc));
     gtk_label_set_text (GTK_LABEL (orig_bankname_label), 
 			(strlen(HBCI_Bank_name (bank))>0 ?
 			 HBCI_Bank_name (bank) :
@@ -337,7 +336,7 @@
  */
 
 int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td, 
-				 const HBCI_Account *h_acc)
+				 const gnc_HBCI_Account *h_acc)
 {
   gint result;
   gboolean values_ok;
@@ -407,22 +406,19 @@
     fields into it and return it. The caller must
     HBCI_Transaction_delete() it when finished. */
 HBCI_Transaction *
-hbci_trans_fill_values(const HBCI_Account *h_acc, HBCITransDialog *td)
+hbci_trans_fill_values(const gnc_HBCI_Account *h_acc, HBCITransDialog *td)
 {
+  GWEN_DB_NODE *xnode = GWEN_DB_Group_new("transaction");
   /* Fill in the user-entered values */
-  HBCI_Transaction *trans = HBCI_Transaction_new();
+  HBCI_Transaction *trans = HBCI_Transaction_new(xnode);
 	
   /* OpenHBCI newer than 0.9.8: use account's bankCode values
    * instead of the bank's ones since this is what some banks
    * require. */
-  HBCI_Transaction_setOurCountryCode (trans, 
-				      HBCI_Account_countryCode (h_acc));
   HBCI_Transaction_setOurBankCode (trans, 
-				   HBCI_Account_instituteCode (h_acc));
-  HBCI_Transaction_setOurAccountId (trans, HBCI_Account_accountId (h_acc));
-  HBCI_Transaction_setOurSuffix (trans, HBCI_Account_accountSuffix (h_acc));
+				   gnc_HBCI_Account_bankCode (h_acc));
+  HBCI_Transaction_setOurAccountId (trans, gnc_HBCI_Account_accountId (h_acc));
 	
-  HBCI_Transaction_setOtherCountryCode (trans, 280);
   HBCI_Transaction_setOtherBankCode 
     (trans, gtk_entry_get_text (GTK_ENTRY (td->recp_bankcode_entry)));
   /* printf("Got otherBankCode %s.\n",
@@ -446,8 +442,12 @@
 
   /* If this is a direct debit, a textkey/ "Textschluessel"/
      transactionCode different from the default has to be set. */
-  if (td->trans_type == SINGLE_DEBITNOTE)
+  switch(td->trans_type) {
+  case SINGLE_DEBITNOTE:
     HBCI_Transaction_setTransactionCode (trans, 05);
+  default:
+    HBCI_Transaction_setTransactionCode (trans, 51);
+  }
 
   return trans;
 }
@@ -504,50 +504,50 @@
 
 HBCI_OutboxJob *
 gnc_hbci_trans_dialog_enqueue(HBCITransDialog *td, HBCI_API *api,
+			      HBCI_Outbox *outbox,
 			      const HBCI_Customer *customer, 
-			      HBCI_Account *h_acc, 
+			      gnc_HBCI_Account *h_acc, 
 			      GNC_HBCI_Transtype trans_type) 
 {
   HBCI_OutboxJob *job;
-      
+  const char *jobname;
+
   /* Create a Do-Transaction (Transfer) job. */
   switch (trans_type) {
   case SINGLE_DEBITNOTE:
-    {
-      HBCI_OutboxJobDebitNote *debit_job =
-	HBCI_OutboxJobDebitNote_new (customer, h_acc, td->hbci_trans);
-      job = HBCI_OutboxJobDebitNote_OutboxJob (debit_job);
+    { 
+      jobname = "JobSingleDebitNote";
     }
     break;
   case SINGLE_TRANSFER:
     {
-      HBCI_OutboxJobTransfer *transfer_job = 
-	HBCI_OutboxJobTransfer_new (customer, h_acc, td->hbci_trans);
-      job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job);
+      jobname = "JobSingleTransfer";
     }
     break;
   default:
     {
       /*printf("dialog-hbcitrans: Oops, unknown GNC_HBCI_Transtype %d.\n",
 	trans_type);*/
-      HBCI_OutboxJobTransfer *transfer_job = 
-	HBCI_OutboxJobTransfer_new (customer, h_acc, td->hbci_trans);
-      job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job);
+      jobname = "JobSingleTransfer";
     }
   }
-  g_assert (job);
+  job = HBCI_OutboxJob_new(jobname, (HBCI_Customer *)customer, 
+			   gnc_HBCI_Account_accountId(h_acc));
+  HBCI_Job_addRequestData(HBCI_OutboxJob_Job(job), 
+			  "", HBCI_Transaction_node(td->hbci_trans));
 
   /* Make really sure there is no other job in the queue */
-  HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+  HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
 
   /* Add job to queue */
-  HBCI_API_addJob (api, job);
+  HBCI_Outbox_addJob(outbox, job);
 
   return job;
 }
 
 gboolean 
 gnc_hbci_trans_dialog_execute(HBCITransDialog *td, HBCI_API *api, 
+			      HBCI_Outbox *outbox,
 			      HBCI_OutboxJob *job, GNCInteractor *interactor)
 {
   gboolean successful;
@@ -555,7 +555,7 @@
   g_assert(api);
   g_assert(job);
 
-  successful = gnc_hbci_api_execute (td->parent, api, job, interactor);
+  successful = gnc_hbci_api_execute (td->parent, api, outbox, job, interactor);
 
   /*printf("dialog-hbcitrans: Ok, result of api_execute was %d.\n", 
     successful);*/
@@ -581,7 +581,7 @@
   }
   /* Watch out! The job *has* to be removed from the queue
      here because otherwise it might be executed again. */
-  HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+  HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
   return successful;
 }
 

==================================================
Differences for dialog-hbcitrans.h (revision 1.3.4.1 -> 1.3.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.h	2003/07/17 07:59:57	1.3.4.1
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.h	2004/03/03 23:15:06	1.3.4.2
@@ -25,14 +25,13 @@
 
 #include <gnome.h>
 
-#include <openhbci/api.h>
-#include <openhbci/account.h>
-#include <openhbci/customer.h>
-#include <openhbci/transaction.h>
-#include <openhbci/outboxaccjobs.h>
+#include <openhbci2/api.h>
+#include <openhbci2/customer.h>
+#include <openhbci2/transaction.h>
+#include <openhbci2/outboxjob.h>
 
 #include "Account.h"
-#include "hbci-interaction.h"
+#include "gnc-hbci-utils.h"
 
 /** The dialog data structure. */
 typedef struct _trans_data HBCITransDialog;
@@ -47,7 +46,7 @@
 gnc_hbci_trans (GtkWidget *parent,
 		HBCI_API *api,
 		GNCInteractor *interactor,
-		const HBCI_Account *h_acc,
+		const gnc_HBCI_Account *h_acc,
 		const HBCI_Customer *customer,
 		Account *gnc_acc,
 		GNC_HBCI_Transtype type,
@@ -57,7 +56,7 @@
  * specified by the arguments, and return a pointer to it. */
 HBCITransDialog *
 gnc_hbci_dialog_new (GtkWidget *parent,
-		     const HBCI_Account *h_acc,
+		     const gnc_HBCI_Account *h_acc,
 		     const HBCI_Customer *customer,
 		     Account *gnc_acc,
 		     GNC_HBCI_Transtype trans_type,
@@ -81,11 +80,12 @@
 
 
 int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td, 
-				 const HBCI_Account *h_acc);
+				 const gnc_HBCI_Account *h_acc);
 HBCI_OutboxJob *
 gnc_hbci_trans_dialog_enqueue(HBCITransDialog *td, HBCI_API *api,
+			      HBCI_Outbox *outbox,
 			      const HBCI_Customer *customer, 
-			      HBCI_Account *h_acc, 
+			      gnc_HBCI_Account *h_acc, 
 			      GNC_HBCI_Transtype trans_type);
 /** Callback function for gnc_xfer_dialog_set_txn_cb(). The user_data
  * has to be a pointer to a HBCITransDialog structure.  */
@@ -96,6 +96,7 @@
  * enter this job again.  */
 gboolean 
 gnc_hbci_trans_dialog_execute(HBCITransDialog *td, HBCI_API *api, 
+			      HBCI_Outbox *outbox,
 			      HBCI_OutboxJob *job, GNCInteractor *interactor);
 
 

==================================================
Differences for druid-hbci-initial.c (revision 1.26.4.7 -> 1.26.4.8)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-initial.c	2003/10/26 00:06:27	1.26.4.7
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-initial.c	2004/03/03 23:15:06	1.26.4.8
@@ -38,17 +38,16 @@
 #include "gnc-ui-util.h"
 #include "gnc-ui.h"
 #include "gnc-html.h"
-#include "import-account-matcher.h"
+//#include "import-account-matcher.h"
+#include "gnc-component-manager.h"
 
-#include <openhbci/api.h>
-#include <openhbci/outboxjobs.h>
-#include <openhbci/outboxjobkeys.h>
-#include <openhbci/mediumrdhbase.h>
+#include <openhbci2/api.h>
+#include <openhbci2/outboxjob.h>
+#include <openhbci2/mediumrdhbase.h>
 
-#include <openhbci.h>
-#ifndef OPENHBCI_VERSION_BUILD
-#  define OPENHBCI_VERSION_BUILD 0
-#endif
+#include <openhbci2.h>
+
+#define DEFAULT_HBCI_VERSION 201
 
 typedef enum _infostate {
   INI_ADD_BANK,
@@ -116,6 +115,8 @@
 
   /* OpenHBCI stuff */
   HBCI_API *api;
+  HBCI_Outbox *outbox;
+  GList *hbci_accountlist;
   GNCInteractor *interactor;
 
   /* account match: row_number (int) -> hbci_account */
@@ -155,10 +156,15 @@
 reset_initial_info (HBCIInitialInfo *info)
 {
   if (info == NULL) return;
-  
+
   if (info->api != NULL) 
     gnc_hbci_api_delete (info->api);
   info->api = NULL;
+
+  if (info->outbox != NULL)
+    HBCI_Outbox_delete(info->outbox);
+  info->outbox = NULL;
+
   info->newcustomer = NULL;
   info->newbank = NULL;
   
@@ -171,6 +177,9 @@
   if (info->gnc_hash != NULL)
     g_hash_table_destroy (info->gnc_hash);
   info->gnc_hash = NULL;
+
+  list_HBCI_Account_delete(info->hbci_accountlist);
+  info->hbci_accountlist = NULL;
 }
 
 static void
@@ -180,9 +189,12 @@
 
   reset_initial_info (info);
   
+  if (info->interactor)
+    GNCInteractor_delete(info->interactor);
+
   if (info->window != NULL) 
     gtk_widget_destroy (info->window);
-    
+
   g_free (info);
 }
 
@@ -191,7 +203,7 @@
  * update_accountlist widget
  */
 static gpointer
-update_accountlist_acc_cb (const HBCI_Account *hacc, gpointer user_data)
+update_accountlist_acc_cb (gnc_HBCI_Account *hacc, gpointer user_data)
 {
   HBCIInitialInfo *info = user_data;
   gchar *row_text[3];
@@ -203,12 +215,7 @@
   g_assert(info);
   row_text[2] = "";
   
-  row_text[0] = 
-    /* Translators: Strings are 1. Account code, 2. Bank name, 3. Bank code. */
-    g_strdup_printf(_("%s at %s (code %s)"),
-		    HBCI_Account_accountId (hacc),
-		    HBCI_Bank_name (HBCI_Account_bank (hacc)),
-		    HBCI_Bank_bankCode (HBCI_Account_bank (hacc)));
+  row_text[0] = gnc_HBCI_Account_longname(hacc);
 		
   /* Get corresponding gnucash account */
   gacc = g_hash_table_lookup (info->gnc_hash, hacc);
@@ -230,19 +237,10 @@
   /* Store the row_number -> hbci_account hash reference. */
   row_key = g_new(gint, 1);
   *row_key = row;
-  g_hash_table_insert (info->hbci_hash, row_key, (HBCI_Account*)hacc);
+  g_hash_table_insert (info->hbci_hash, row_key, (gnc_HBCI_Account*)hacc);
 
   return NULL;
 }
-static gpointer
-update_accountlist_bank_cb (const HBCI_Bank *bank, gpointer user_data)
-{
-  g_assert(bank);
-
-  return list_HBCI_Account_foreach (HBCI_Bank_accounts (bank),
-				    &update_accountlist_acc_cb,
-				    user_data);
-}
 
 /* Update the account list GtkCList widget */
 static void
@@ -272,13 +270,13 @@
   info->hbci_hash = g_hash_table_new (&g_int_hash, &g_int_equal);
   g_hash_table_freeze (info->hbci_hash);
   
-  /* Go through all HBCI banks */
-  list_HBCI_Bank_foreach (banklist, 
-			  &update_accountlist_bank_cb,
-			  info);
+  /* Go through all HBCI accounts */
+  list_HBCI_Account_foreach (info->hbci_accountlist,
+			     update_accountlist_acc_cb,
+			     info);
 
-  /*printf("HBCI hash has %d entries.\n", g_hash_table_size(info->hbci_hash));*/
-  /*printf("GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash));*/
+  //printf("update_accountlist: HBCI hash has %d entries.\n", g_hash_table_size(info->hbci_hash));
+  //printf("update_accountlist: GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash));
   
   g_hash_table_thaw (info->hbci_hash);
   gtk_clist_thaw (GTK_CLIST (info->accountlist));
@@ -430,7 +428,8 @@
 }
 
 static gboolean 
-choose_hbciversion_dialog (GtkWindow *parent, HBCI_Bank *bank)
+choose_hbciversion_dialog (GtkWindow *parent, HBCI_Bank *bank,
+			   HBCIInitialInfo *info)
 {
   int retval = -1;
   int selected_row = 0;
@@ -484,11 +483,33 @@
 			 (GTK_CLIST (version_clist), selected_row));
       if (newversion != initial_selection) 
 	{
+	  HBCI_OutboxJob *job;
+
+	  gtk_widget_destroy (dialog);
 	  /*fprintf (stderr, "Setting new HBCI version %d\n", newversion); */
 	  HBCI_Bank_setHbciVersion (bank, newversion);
-	  HBCI_Bank_setBPDVersion (bank, 0);
-	  gtk_widget_destroy (dialog);
+	  /*HBCI_Bank_setBPDVersion (bank, 0);*/
+	  job = HBCI_OutboxJob_new("JobUpdateBankInfo", 
+				   (HBCI_Customer*)info->newcustomer, "");
+	  HBCI_Outbox_addJob(info->outbox, job);
+	  
+	  {
+	    HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+	    /* copied from aqmoney-tng/src/libaqmoney/adminjobs.cpp
+	       JobUpdateBankInfo */
+	    HBCI_Job_setIntProperty(jjob, "open/ident/country", 
+				    HBCI_Bank_country(bank));
+	    HBCI_Job_setProperty(jjob, "open/ident/bankcode", 
+				 HBCI_Bank_bankCode(bank));
+	    HBCI_Job_setIntProperty(jjob, "open/prepare/bpdversion",0);
+	    HBCI_Job_setIntProperty(jjob, "open/prepare/updversion",0);
+	  }
+	  
 	  gnome_ok_dialog_parented 
+	    /* Translators: Strings from this file are really only
+	     * needed inside Germany (HBCI is not supported anywhere
+	     * else). You may safely ignore strings from the
+	     * import-export/hbci subdirectory in other countries. */
 	    (_("You have changed the HBCI version. GnuCash will now need to \n"
 	       "update various system parameters, including the account list.\n"
 	       "Press 'Ok' now to proceed to updating the system and the account list."), parent);
@@ -519,7 +540,7 @@
 {
   HBCI_Bank *bank;
   const HBCI_User *user;
-  HBCI_Account *acc;
+  gnc_HBCI_Account *acc;
 
   GtkWidget *dlg;
   char *prompt;
@@ -532,7 +553,8 @@
 
   /* Ask for new account id by opening a request_dialog -- a druid
      page would be better from GUI design, but I'm too lazy. */
-  prompt = g_strdup_printf(_("Enter account id for new account \nat bank %s (bank code %s):"), 
+  prompt = g_strdup_printf(_("Enter account id for new account \n"
+			     "at bank %s (bank code %s):"), 
 			   HBCI_Bank_name (bank), HBCI_Bank_bankCode (bank));
   
   dlg = gnome_request_dialog(FALSE, prompt, "", 20,
@@ -541,8 +563,12 @@
   
   if ((retval == 0) && accnr && (strlen(accnr) > 0)) {
     
+    /* Search for existing duplicate */
+    acc = list_HBCI_Account_find(info->hbci_accountlist, 
+				 bank, HBCI_Bank_bankCode (bank), accnr);
+
     /* Check if such an account already exists */
-    if ( HBCI_Bank_findAccount (bank, accnr) )
+    if (acc)
       {
 	/* Yes, then don't create it again */
 	gnc_error_dialog
@@ -551,15 +577,9 @@
       }
     else
       {
-	/* No, then create it now */
-	acc = HBCI_API_accountFactory(bank, accnr, "");
-	/* Add it to the bank, and the bank will also own the newly
-	   created object. */
-	HBCI_Bank_addAccount(bank, acc, TRUE);
-	/* and add the given customer as first authorized
-	   customer. This needs more work in case there are different
-	   customers here.  */
-	HBCI_Account_addAuthorizedCustomer(acc, cust);
+	/* No, then create it and add it to our internal list. */
+	acc = gnc_HBCI_Account_new (bank, HBCI_Bank_bankCode (bank), accnr);
+	info->hbci_accountlist = g_list_append(info->hbci_accountlist, acc);
 
 	/* Don't forget to update the account list, otherwise the new
 	   accounts won't show up. */
@@ -574,6 +594,7 @@
 /* -------------------------------------- */
 
 
+
 /*************************************************************
  * GUI callbacks
  */
@@ -594,30 +615,48 @@
 	   gpointer user_data)
 {
   HBCIInitialInfo *info = user_data;
+  gboolean successful = TRUE;
   g_assert (info);
 
-
   if (info->configfile) {
+    //printf("on_finish: Got configfile %s, but the book has %s.\n", info->configfile, gnc_hbci_get_book_configfile (gnc_get_current_book ()));
     if (!gnc_hbci_get_book_configfile (gnc_get_current_book ()) ||
 	(strcmp(info->configfile, 
-		gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0)) 
+		gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0)) {
       /* Name of configfile has changed */
       gnc_hbci_set_book_configfile (gnc_get_current_book (), info->configfile);
+      if ((gnc_hbci_get_book_configfile (gnc_get_current_book ()) == 0) ||
+	  strcmp(info->configfile, 
+		 gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0) 
+	printf("on_finish: OOOPS: I just setted the book_configfile to %s, but the book now still has %s.\n", info->configfile, gnc_hbci_get_book_configfile (gnc_get_current_book ()));
+    }
   }
   
   {
     HBCI_Error *err;
+    //printf("on_finish: trying to save openhbci data to file %s.\n", gnc_hbci_get_book_configfile (gnc_get_current_book ()));
+    
     err = gnc_hbci_api_save (info->api);
+    //printf("on_finish: finished saving openhbci data to file.\n");
+
     if (err != NULL) {
-      if (!HBCI_Error_isOk (err)) 
+      if (!HBCI_Error_isOk (err)) {
+	successful = FALSE;
 	printf("on_finish: Error at saving OpenHBCI data: %s.\n",
 	       HBCI_Error_message (err));
+      }
       HBCI_Error_delete (err);
     }
   }
   
-  if (info->gnc_hash)
+  if (successful && info->gnc_hash)
     accounts_save_kvp (info->gnc_hash);
+  if (successful && info->hbci_accountlist)
+    {
+      GList *kvplist = 
+	gnc_HBCI_Account_kvp_glist_from_glist(info->hbci_accountlist);
+      gnc_hbci_set_book_account_list (gnc_get_current_book (), kvplist);
+    }
   
   delete_initial_druid(info);
 }
@@ -642,7 +681,7 @@
   /* file doesn't need to be created here since OpenHBCI will create
      it automatically.*/
 
-  if (!gnc_test_dir_exist_error (info->window, filename)) {
+  if (!gnc_test_dir_exist_error (GTK_WINDOW (info->window), filename)) {
     g_free (filename);
     return TRUE;
   }
@@ -656,13 +695,15 @@
       /* Create new HBCI_API object, loading its data from filename */
       info->api = gnc_hbci_api_new (filename, TRUE, 
 				    GTK_WIDGET (info->window), 
-				    &(info->interactor));
+				    &(info->interactor),
+				    &(info->hbci_accountlist));
     }
     else if (info->api == NULL)
       /* Create new HBCI_API object, loading its data from filename */
       info->api = gnc_hbci_api_new (filename, TRUE, 
 				    GTK_WIDGET (info->window), 
-				    &(info->interactor));
+				    &(info->interactor),
+				    &(info->hbci_accountlist));
 
     api = info->api;
     g_free (filename);
@@ -679,7 +720,9 @@
 				TRUE);
     }
 
-
+  /* Together with the api, create a new outbox queue */
+  info->outbox = HBCI_Outbox_new();
+  
   /* Get HBCI bank and account list */
   {
     const list_HBCI_Bank *banklist;
@@ -704,7 +747,8 @@
       return TRUE;
     }
     
-    if (HBCI_API_totalAccounts(api) == 0) {
+    if (g_list_length(gnc_hbci_get_book_account_list
+		      (gnc_get_current_book ())) == 0) {
       /* still no accounts? go to account update page*/
       info->state = INI_UPDATE_ACCOUNTS;
       info->newcustomer = choose_customer (info);
@@ -767,9 +811,26 @@
   bank = HBCI_API_findBank(info->api, countrycode, bankcode);
   if (bank == NULL) {
     /*printf("on_bankpage_next: Creating bank with code %s.\n", bankcode);*/
-    bank = HBCI_API_bankFactory (info->api, countrycode, bankcode, ipaddr);
+    bank = HBCI_API_bankFactory (info->api, countrycode, bankcode, ipaddr,
+				 "");
     {
       HBCI_Error *err;
+      HBCI_Transporter *tr;
+      HBCI_MessageEngine *me;
+
+      me = HBCI_API_engineFactory(info->api, 
+				  countrycode,
+				  bankcode,
+				  DEFAULT_HBCI_VERSION,
+				  "msgxml");
+      tr = HBCI_API_transporterFactory(info->api,
+				       ipaddr,
+				       "3000" /* DEFAULT_PORT */,
+				       500 /*AQMONEY_DEFAULT_CONN_TIMEOUT*/,
+				       "xptcp");
+      HBCI_Bank_setMessageEngine(bank, me, TRUE);
+      HBCI_Bank_setTransporter(bank, tr, TRUE);
+
       err = HBCI_API_addBank (info->api, bank, TRUE);
       if (err != NULL) {
 	printf("on_bankpage_next-CRITICAL: Error at addBank: %s.\n",
@@ -777,6 +838,7 @@
 	HBCI_Error_delete (err);
 	return TRUE;
       }
+
     }
   } 
   /*else {
@@ -919,7 +981,8 @@
 	g_free (mediumname);
 	return TRUE;
       }
-      if (!gnc_test_dir_exist_error (info->window, mediumname)) {
+      if (!gnc_test_dir_exist_error (GTK_WINDOW (info->window), 
+				     mediumname)) {
 	g_free (mediumname);
 	return TRUE;
       }
@@ -936,7 +999,7 @@
     medium = HBCI_API_createNewMedium (api, 
 				       mediumtype,
 				       FALSE,
-				       HBCI_Bank_countryCode (bank),
+				       280,
 				       HBCI_Bank_bankCode (bank),
 				       userid, 
 				       mediumname, &err);
@@ -949,8 +1012,8 @@
       return TRUE;
     }
     
-    newuser = HBCI_API_userFactory (bank, medium, TRUE, userid);
-    HBCI_User_setUserName (newuser, username);
+    newuser = HBCI_API_userFactory (bank, medium, TRUE, userid, username);
+    /*HBCI_User_setUserName (newuser, username);*/
     /*printf("on_userid_next: Created user with userid %s.\n", userid);*/
     g_assert(newuser);
     err = HBCI_Bank_addUser (bank, newuser, TRUE);
@@ -977,13 +1040,7 @@
 
     {
       HBCI_Customer *cust;
-      cust = HBCI_API_customerFactory (newuser, customerid, 
-				       customername ? customername : 
-	   /* Translators: Strings from this file are really only
-	    * needed inside Germany (HBCI is not supported anywhere
-	    * else). You may safely ignore strings from the
-	    * import-export/hbci subdirectory in other countries. */
-				       _("Default Customer"));
+      cust = HBCI_API_customerFactory (newuser, customerid, customername);
       g_assert (cust);
       HBCI_User_addCustomer (newuser, cust, TRUE);
       info->newcustomer = cust;
@@ -1032,8 +1089,12 @@
 		     gpointer         user_data)
 {
   HBCIInitialInfo *info = user_data;
+  const HBCI_Customer *customer = NULL;
+  const HBCI_User *user = NULL;
+  const HBCI_Medium *medium = NULL;
+  const HBCI_Bank *bank = NULL;
   g_assert(info);
-
+  
   /* of course we need to know for which customer we do this */
   if (info->newcustomer == NULL) 
     info->newcustomer = choose_customer (info);
@@ -1041,36 +1102,146 @@
   if (info->newcustomer == NULL) 
     return FALSE;
 
+  customer = info->newcustomer;
+  user = HBCI_Customer_user(customer);
+  bank = HBCI_User_bank(user);
+  medium = HBCI_User_medium(user);
+  
   {
-    /* Execute a Synchronize job, then a GetAccounts job. */
     HBCI_OutboxJob *job;
+      
+    /* Execute a Synchronize job, then a GetAccounts job. */
+    if (HBCI_Medium_securityMode(medium) == 
+	HBCI_SECURITY_RDH) {
+      /* Only do this sync job if this is a rdh medium. */
+      if ((strlen(HBCI_User_systemId(user)) == 0) ||
+	  (strcmp(HBCI_User_systemId(user), "0") == 0)) {
+	/* Only do this sync job if we don't have a systemId yet (not
+	   sure whether this is a good idea though */
+	job = HBCI_OutboxJob_new("JobSync", 
+				 (HBCI_Customer *)customer, "");
+	HBCI_Outbox_addJob (info->outbox, job);
+      
+	{
+	  HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+	  HBCI_Job_setIntProperty
+	    (jjob, "open/ident/country", HBCI_Bank_country(bank));
+	  HBCI_Job_setProperty
+	    (jjob, "open/ident/bankcode", HBCI_Bank_bankCode(bank));
+	  HBCI_Job_setProperty
+	    (jjob, "open/ident/customerid", HBCI_Customer_custId(customer));
 
-    job = HBCI_OutboxJobGetSystemId_OutboxJob 
-      (HBCI_OutboxJobGetSystemId_new (info->api,
-				      (HBCI_Customer *)info->newcustomer));
-    HBCI_API_addJob (info->api, job);
+	  /* for getting a system id */
+	  HBCI_Job_setIntProperty(jjob, "open/sync/mode",0);
+	  HBCI_Job_setProperty(jjob, "open/ident/systemid", "0");
+	}
 
-    /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (info->window, info->api, 
-			       job, info->interactor)) {
-      /* HBCI_API_executeOutbox failed. */
-      /*return FALSE;*/
-      /* -- it seems to be no problem if this fails ?! */
-    }
+	/* Execute Outbox. */
+	if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, 
+				   job, info->interactor)) {
+	  /* HBCI_API_executeOutbox failed. */
+	  GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+	  printf("on_accountinfo_next: oops, executeOutbox of JobSync failed.\n");
+
+	  printf("on_accountinfo_next: Complete HBCI_Outbox response:\n");
+	  GWEN_DB_Dump(rsp, stdout, 1);
+	  GWEN_DB_Group_free(rsp);
+
+	  rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+	  printf("on_accountinfo_next: Complete HBCI_Job response:\n");
+	  if (rsp) 
+	    GWEN_DB_Dump(rsp, stderr, 1);
+	  /*return FALSE;*/
+	  /* -- it seems to be no problem if this fails ?! */
+	}
 
+	/* Now process the response of the JobSync */
+	{
+	  const char *sysid = 
+	    HBCI_Job_getProperty(HBCI_OutboxJob_Job(job), 
+				 "response/syncresponse/systemid", "");
+	  g_assert(sysid);
+
+	  if (strlen(sysid) > 0) {
+	    HBCI_User_setSystemId((HBCI_User*) user, sysid);
+	    printf("on_accountinfo_next: Ok. Got sysid '%s'.\n", sysid);
+	  }
+	  else {
+	    /* Got no sysid. */
+	    GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+	    printf("on_accountinfo_next: oops, got no sysid.\n");
+	
+	    printf("on_accountinfo_next: Complete HBCI_Outbox response:\n");
+	    GWEN_DB_Dump(rsp, stdout, 1);
+	    GWEN_DB_Group_free(rsp);
+
+	    rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+	    printf("on_accountinfo_next: Complete HBCI_Job response:\n");
+	    if (rsp) 
+	      GWEN_DB_Dump(rsp, stderr, 1);
+	    return FALSE;
+	  }
+	}
+      } /* if strlen(systemid)==0 */
+    } /* if securityMode == RDH */
+    
+  
     /* Now the GetAccounts job. */
-    job = HBCI_OutboxJobGetAccounts_OutboxJob 
-      (HBCI_OutboxJobGetAccounts_new ((HBCI_Customer *)info->newcustomer));
-    HBCI_API_addJob (info->api, job);
+    job = HBCI_OutboxJob_new("JobGetAccounts", 
+			     (HBCI_Customer *)customer, "");
+    HBCI_Outbox_addJob (info->outbox, job);
+    
+    {
+      HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+      HBCI_Job_setIntProperty
+	(jjob, "open/ident/country", HBCI_Bank_country(bank));
+      HBCI_Job_setProperty
+	(jjob, "open/ident/bankcode", HBCI_Bank_bankCode(bank));
+      HBCI_Job_setProperty
+	(jjob, "open/ident/customerid", HBCI_Customer_custId(customer));
+      HBCI_Job_setIntProperty(jjob, "open/prepare/updversion",0);
+
+      if (HBCI_Medium_securityMode(medium) == 
+	  HBCI_SECURITY_RDH) {
+	/* Only set this for RDH medium */
+	char *mediumid = HBCI_Medium_mediumId((HBCI_Medium *)medium);
+	g_assert(mediumid);
+	if (strlen(mediumid)==0)
+	  HBCI_Job_setProperty(jjob, "open/ident/systemId", "0");
+	else
+	  HBCI_Job_setProperty(jjob, "open/ident/systemId", mediumid);
+	free(mediumid);
+      }
+    }
+    
 
     /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (info->window, info->api, 
+    if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, 
 			       job, info->interactor)) {
       /* HBCI_API_executeOutbox failed. */
+      GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+      printf("on_accountinfo_next: oops, executeOutbox of JobGetAccounts failed.\n");
+
+      printf("on_accountinfo_next: Complete HBCI_Outbox response:\n");
+      GWEN_DB_Dump(rsp, stdout, 1);
+      GWEN_DB_Group_free(rsp);
+
+      rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+      printf("on_accountinfo_next: Complete HBCI_Job response:\n");
+      if (rsp) 
+	GWEN_DB_Dump(rsp, stderr, 1);
+
+      /* And clean everything up */
+      HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
       return FALSE;
     }
 
-    HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE);
+    /* Now evaluate the GetAccounts job. */
+    info->hbci_accountlist =
+      gnc_processOutboxResponse(info->api, info->outbox, info->hbci_accountlist);
+    
+    /* And clean everything up */
+    HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
   }
   
   return FALSE;
@@ -1120,15 +1291,30 @@
 			   gpointer user_data)
 {
   HBCIInitialInfo *info = user_data;
-  HBCI_Account *hbci_acc;
+  gnc_HBCI_Account *hbci_acc;
   Account *gnc_acc, *old_value;
+  gchar *longname;
+  gnc_commodity *currency = NULL;
   
   hbci_acc = g_hash_table_lookup (info->hbci_hash, &row);
   if (hbci_acc) {
     old_value = g_hash_table_lookup (info->gnc_hash, hbci_acc);
 
-    gnc_acc = gnc_import_select_account(NULL, FALSE, NULL, NULL, NO_TYPE,
+    /*printf("on_accountlist_select_row: Selected hbci_acc id %s; old_value %p \n",
+	   gnc_HBCI_Account_accountId(hbci_acc),
+	   old_value);*/
+
+    longname = gnc_HBCI_Account_longname(hbci_acc);
+    if (gnc_HBCI_Account_currency(hbci_acc) && 
+	(strlen(gnc_HBCI_Account_currency(hbci_acc)) > 0)) {
+      currency = gnc_commodity_table_lookup 
+	(gnc_book_get_commodity_table (gnc_get_current_book ()), 
+	 GNC_COMMODITY_NS_ISO, gnc_HBCI_Account_currency(hbci_acc));
+    }
+
+    gnc_acc = gnc_import_select_account(NULL, TRUE, longname, currency, BANK,
 					old_value, NULL);
+    g_free(longname);
 
     if (gnc_acc) {
       if (old_value) 
@@ -1171,32 +1357,82 @@
 			  gpointer user_data)
 {
   HBCIInitialInfo *info = user_data;
+  const HBCI_Customer *customer = NULL;
+  const HBCI_User *user = NULL;
+  const HBCI_Bank *bank = NULL;
   g_assert(info);
 
   if (info->newcustomer == NULL) 
     return FALSE;
 
+  customer = info->newcustomer;
+  user = HBCI_Customer_user(customer);
+  bank = HBCI_User_bank(user);
+  
   if (info->gotkeysforCustomer == NULL) {
     /* Execute a GetKey job. */
     HBCI_OutboxJob *job;
     
-    job = HBCI_OutboxJobGetKeys_OutboxJob 
-      (HBCI_OutboxJobGetKeys_new (info->api, info->newcustomer));
-    HBCI_API_addJob (info->api, job);
+    job = HBCI_OutboxJob_new("JobGetKeys", (HBCI_Customer*)customer, "");
+    
+    {
+      HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+      /* Copied from libaqmoney's JobGetKeys::JobGetKeys(Pointer<Customer> c) */
+      HBCI_Job_setIntProperty(jjob, "open/ident/country", HBCI_Bank_country(bank));
+      HBCI_Job_setProperty(jjob, "open/ident/bankcode", HBCI_Bank_bankCode(bank));
+      HBCI_Job_setProperty(jjob, "open/ident/customerId", "9999999999");
+      HBCI_Job_setProperty(jjob, "open/ident/systemId", "0");
+
+      HBCI_Job_setIntProperty(jjob, "open/signkey/key/country", 
+			      HBCI_Bank_country(bank));
+      HBCI_Job_setProperty(jjob, "open/signkey/key/bankcode", 
+			   HBCI_Bank_bankCode(bank));
+      /*HBCI_Job_setProperty(jjob, "open/signkey/key/userid", "9999999999");*/
+
+      HBCI_Job_setIntProperty(jjob, "open/cryptkey/key/country", 
+			      HBCI_Bank_country(bank));
+      HBCI_Job_setProperty(jjob, "open/cryptkey/key/bankcode", 
+			   HBCI_Bank_bankCode(bank));
+      /*HBCI_Job_setProperty(jjob, "open/cryptkey/key/userid", "9999999999");*/
+    }
+    HBCI_Outbox_addJob (info->outbox, job);
 
     /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (info->window, info->api, 
+    if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, 
 			       job, info->interactor)) {
       /* HBCI_API_executeOutbox failed. */
+      GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+      printf("on_iniletter_info_next: oops, executeOutbox failed.\n");
+
+      printf("Complete HBCI_Outbox response:\n");
+      GWEN_DB_Dump(rsp, stdout, 1);
+      GWEN_DB_Group_free(rsp);
+
+      rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+      printf("Complete HBCI_Job response:\n");
+      if (rsp) 
+	GWEN_DB_Dump(rsp, stderr, 1);
+
+      /* And clean everything up */
+      HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
       return FALSE;
     }
 
-    HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE);
-    info->gotkeysforCustomer = info->newcustomer;
+    /* Get keys from Job; store them in the customer's medium @§%&! */
+    if (!gnc_hbci_evaluate_GetKeys(info->outbox, job,
+				   (HBCI_Customer *)customer)) {
+      return FALSE;
+    }
+    
+    HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
+    info->gotkeysforCustomer = customer;
 
   }
-  else if (info->gotkeysforCustomer != info->newcustomer) {
+  else if (info->gotkeysforCustomer != customer) {
     printf("on_iniletter_info_next: Oops, already got keys for another customer. Not yet implemented.\n");
+
+    /* And clean everything up */
+    HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
     return TRUE;
   }
 
@@ -1205,7 +1441,6 @@
     char *res;
     const HBCI_Medium *med;
     const HBCI_MediumRDHBase *medr;
-    const HBCI_Bank *bank;
     gboolean use_cryptkey;
     char *tmp, *hash, *exponent, *modulus;
     const char *bankcode, *bankname, *bankip;
@@ -1213,15 +1448,12 @@
     time_t now = time(NULL);
     char *time_now = ctime(&now);
 
-    bank = HBCI_User_bank (HBCI_Customer_user 
-			   ((HBCI_Customer *)info->newcustomer));
     bankcode = HBCI_Bank_bankCode (bank);
     bankname = HBCI_Bank_name (bank);
     bankname = (strlen (bankname) > 0 ? bankname : _("Unknown"));
     bankip = HBCI_Bank_addr (bank);    
 
-    med = HBCI_User_medium (HBCI_Customer_user
-			    ((HBCI_Customer *)info->newcustomer));
+    med = HBCI_User_medium (user);
     medr = HBCI_Medium_MediumRDHBase ((HBCI_Medium *)med);
     g_assert (medr);
 
@@ -1267,6 +1499,7 @@
     g_free (hash);
     
     gnc_html_show_data (info->server_html, res, strlen(res));
+    gnc_html_reload (info->server_html);
     
     g_free (res);
   }
@@ -1312,18 +1545,88 @@
     /* Execute a SendKey job. */
     HBCI_OutboxJob *job;
     
-    job = HBCI_OutboxJobSendKeys_OutboxJob 
-      (HBCI_OutboxJobSendKeys_new (info->api, info->newcustomer));
-    HBCI_API_addJob (info->api, job);
+    job = HBCI_OutboxJob_new("JobSendKeys", 
+			     (HBCI_Customer*)info->newcustomer, "");
+
+    {
+      HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+      const HBCI_Customer *customer = info->newcustomer;
+      const HBCI_User *user = HBCI_Customer_user(customer);
+      const HBCI_Bank *bank = HBCI_User_bank(user);
+      const HBCI_Medium *med = HBCI_User_medium (user);
+      const HBCI_MediumRDHBase *medr = HBCI_Medium_MediumRDHBase ((HBCI_Medium*)med);
+      const HBCI_RSAKey *signkey = HBCI_MediumRDHBase_userPubSignKey(medr);
+      const HBCI_RSAKey *cryptkey = HBCI_MediumRDHBase_userPubCryptKey(medr);
+#define MY_MAXBUF_SIZE 1024
+      unsigned tmp_bufsize = MY_MAXBUF_SIZE;
+      unsigned tmp_actual;
+      char tmp[MY_MAXBUF_SIZE];
+      g_assert (medr);
+      /* Copied from libaqmoney's JobSendKeys::JobSendKeys(Pointer<Customer> c) */
+
+      // prepare identification
+      HBCI_Job_setProperty(jjob, "open/ident/systemid", "0");
+      HBCI_Job_setIntProperty(jjob, "open/ident/country", HBCI_Bank_country(bank));
+      HBCI_Job_setProperty(jjob, "open/ident/bankcode", HBCI_Bank_bankCode(bank));
+      HBCI_Job_setProperty(jjob, "open/ident/customerid", HBCI_Customer_custId(customer));
+
+      // prepare sign key
+      HBCI_Job_setProperty(jjob, "open/signkey/keyname/bankCode", HBCI_Bank_bankCode(bank));
+      HBCI_Job_setProperty(jjob, "open/signkey/keyname/userid", HBCI_User_userId(user));
+      HBCI_Job_setIntProperty(jjob, "open/signkey/keyname/keynum", HBCI_RSAKey_number(signkey));
+      HBCI_Job_setIntProperty(jjob, "open/signkey/keyname/keyversion", HBCI_RSAKey_version(signkey));
+      tmp_actual = HBCI_RSAKey_getModulusData(signkey, tmp, tmp_bufsize);
+      HBCI_Job_setBinProperty(jjob, "open/signkey/key/modulus", tmp, tmp_actual);
+      tmp_actual = HBCI_RSAKey_getExpData(signkey, tmp, tmp_bufsize);
+      HBCI_Job_setBinProperty(jjob, "open/signkey/key/exponent", tmp, tmp_actual);
+
+      // prepare crypt key
+      HBCI_Job_setProperty(jjob, "open/cryptkey/keyname/bankCode", HBCI_Bank_bankCode(bank));
+      HBCI_Job_setProperty(jjob, "open/cryptkey/keyname/userid", HBCI_User_userId(user));
+      HBCI_Job_setIntProperty(jjob, "open/cryptkey/keyname/keynum", HBCI_RSAKey_number(cryptkey));
+      HBCI_Job_setIntProperty(jjob, "open/cryptkey/keyname/keyversion", HBCI_RSAKey_version(cryptkey));
+      tmp_actual = HBCI_RSAKey_getModulusData(cryptkey, tmp, tmp_bufsize);
+      HBCI_Job_setBinProperty(jjob, "open/cryptkey/key/modulus", tmp, tmp_actual);
+      tmp_actual = HBCI_RSAKey_getExpData(cryptkey, tmp, tmp_bufsize);
+      HBCI_Job_setBinProperty(jjob, "open/cryptkey/key/exponent", tmp, tmp_actual);
+    }
+
+    HBCI_Outbox_addJob (info->outbox, job);
 
     /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (info->window, info->api, 
+    if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, 
 			       job, info->interactor)) {
       /* HBCI_API_executeOutbox failed. */
+      GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+      printf("on_iniletter_userinfo_next: Oops, api_execute failed.\n");
+      printf("on_iniletter_userinfo_next: Complete HBCI_Outbox response:\n");
+      GWEN_DB_Dump(rsp, stdout, 1);
+      GWEN_DB_Group_free(rsp);
+
+      rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+      printf("on_iniletter_userinfo_next: Complete HBCI_Job response:\n");
+      if (rsp) 
+	GWEN_DB_Dump(rsp, stderr, 1);
+
+      /* And clean everything up */
+      HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
       return FALSE;
     }
+    
+    {
+      GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox);
+      printf("on_iniletter_userinfo_next: Complete HBCI_Outbox response:\n");
+      GWEN_DB_Dump(rsp, stdout, 1);
+      GWEN_DB_Group_free(rsp);
 
-    HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE);
+      rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+      printf("on_iniletter_userinfo_next: Complete HBCI_Job response:\n");
+      if (rsp) 
+	GWEN_DB_Dump(rsp, stderr, 1);
+    }
+    
+
+    HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE);
   }
   else {
     printf("on_iniletter_userinfo_next: Oops, already got keys for another customer. Not yet implemented.\n");
@@ -1378,7 +1681,7 @@
 "<p>&nbsp;</p>\n"
 "<hr>\n"
 "Ort, Datum, Unterschrift</body></html>",
-			  HBCI_User_userName (user),
+			  HBCI_User_name (user),
 			  time_now,
 			  HBCI_User_userId (user),
 			  keynumber, keyversion,
@@ -1390,6 +1693,7 @@
     g_free (hash);
   }
   gnc_html_show_data (info->user_html, res, strlen(res));
+  gnc_html_reload (info->user_html);
 
   g_free (res);
 
@@ -1456,7 +1760,8 @@
     if (choose_hbciversion_dialog 
 	(GTK_WINDOW (info->window),
 	 (HBCI_Bank *) 
-	 HBCI_User_bank (HBCI_Customer_user (info->newcustomer))))
+	 HBCI_User_bank (HBCI_Customer_user (info->newcustomer)),
+	 info))
       gnome_druid_set_page (GNOME_DRUID (info->druid), 
 			    GNOME_DRUID_PAGE (info->accountinfopage));
   } else if (strcmp (name, "updatelist_button") == 0) {
@@ -1506,6 +1811,7 @@
   GtkWidget *page;
   
   info = g_new0 (HBCIInitialInfo, 1);
+  info->hbci_accountlist = NULL;
   
   xml = gnc_glade_xml_new ("hbci.glade", "HBCI Init Druid");
 
@@ -1519,6 +1825,7 @@
   glade_xml_signal_connect_data (xml, "on_cancel", 
 				 GTK_SIGNAL_FUNC (on_cancel), info);
   
+
   {
     /* Page with config file entry widget */
     page = glade_xml_get_widget(xml, "configfile_page");

==================================================
Differences for druid-hbci-utils.c (revision 1.5.4.3 -> 1.5.4.4)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-utils.c	2003/08/08 23:27:48	1.5.4.3
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-utils.c	2004/03/03 23:15:06	1.5.4.4
@@ -45,10 +45,12 @@
 /* #include "gnc-gui-query.h" */
 /* #include "io-example-account.h" */
 /* #include "top-level.h" */
-#include <openhbci/api.h>
-#include <openhbci/outboxjobs.h>
-
+#include <openhbci2/api.h>
+#include <openhbci2/outboxjob.h>
+#include <openhbci2/mediumrdhbase.h>
+#include <openhbci2/rsakey.h>
 
+#include "gnc-hbci-utils.h"
 
 /**
  * Save the reference strings to the HBCI accounts in the kvp's of the
@@ -56,27 +58,38 @@
 static void
 accounts_save_kvp_cb (gpointer key, gpointer value, gpointer user_data)
 {
-  HBCI_Account *hbci_acc = key;
+  gnc_HBCI_Account *hbci_acc = key;
   Account *gnc_acc = value;
   g_assert(hbci_acc);
   g_assert(gnc_acc);
 
   if ((gnc_hbci_get_account_accountid(gnc_acc) == NULL ) ||
       (strcmp (gnc_hbci_get_account_accountid(gnc_acc), 
-	       HBCI_Account_accountId (hbci_acc)) != 0))
+	       gnc_HBCI_Account_accountId (hbci_acc)) != 0))
     gnc_hbci_set_account_accountid 
-      (gnc_acc, HBCI_Account_accountId (hbci_acc));
+      (gnc_acc, gnc_HBCI_Account_accountId (hbci_acc));
 
   if ((gnc_hbci_get_account_bankcode(gnc_acc) == NULL) ||
       (strcmp (gnc_hbci_get_account_bankcode(gnc_acc), 
-	       HBCI_Bank_bankCode (HBCI_Account_bank (hbci_acc))) != 0))
+	       HBCI_Bank_bankCode (gnc_HBCI_Account_bank (hbci_acc))) != 0))
     gnc_hbci_set_account_bankcode
-      (gnc_acc, HBCI_Bank_bankCode (HBCI_Account_bank (hbci_acc)));
+      (gnc_acc, HBCI_Bank_bankCode (gnc_HBCI_Account_bank (hbci_acc)));
 
   if (gnc_hbci_get_account_countrycode(gnc_acc) !=
-      HBCI_Bank_countryCode (HBCI_Account_bank (hbci_acc)))
+      HBCI_Bank_country (gnc_HBCI_Account_bank (hbci_acc)))
     gnc_hbci_set_account_countrycode
-      (gnc_acc, HBCI_Bank_countryCode (HBCI_Account_bank (hbci_acc)));
+      (gnc_acc, HBCI_Bank_country (gnc_HBCI_Account_bank (hbci_acc)));
+}
+
+static gpointer accounts_clear_kvp (Account *gnc_acc, gpointer user_data)
+{
+  if (gnc_hbci_get_account_accountid(gnc_acc))
+    gnc_hbci_set_account_accountid (gnc_acc, "");
+  if (gnc_hbci_get_account_bankcode(gnc_acc))
+    gnc_hbci_set_account_bankcode (gnc_acc, "");
+  if (gnc_hbci_get_account_countrycode(gnc_acc))
+    gnc_hbci_set_account_countrycode (gnc_acc, 0);
+  return NULL;
 }
 
 /* hash is a DIRECT hash from each HBCI account to each gnucash
@@ -84,7 +97,14 @@
 void
 accounts_save_kvp (GHashTable *hash)
 {
+  AccountGroup *grp;
   g_assert(hash);
+
+  grp = gnc_book_get_group (gnc_get_current_book ());
+  xaccGroupForEachAccount (grp, 
+			   &accounts_clear_kvp,
+			   NULL, TRUE);
+
   g_hash_table_foreach (hash, &accounts_save_kvp_cb, NULL);
 }
 /*
@@ -135,7 +155,7 @@
 			 GNCInteractor *inter)
 {
   const list_HBCI_User *userlist;
-  list_HBCI_User_iter *begin;
+  const HBCI_User *user;
   g_assert(bank);
 
   userlist = HBCI_Bank_users (bank);
@@ -144,15 +164,8 @@
     /* Zero users? nothing to do. */
     return;
   }
-  else if (list_HBCI_User_size (userlist) == 1) {
-    begin = list_HBCI_User_begin (userlist);
-    update_accounts_foruser (parent, api, 
-			     list_HBCI_User_iter_get (begin), inter);
-    list_HBCI_User_iter_delete (begin);
-  }
-  else {
-    printf("update_accounts_forbank: Sorry, multiple users not yet supported.\n");
-  }
+  user = choose_one_user (GNCInteractor_parent(inter), userlist);
+  update_accounts_foruser (parent, api, user, inter);
 }
 static void 
 update_accounts_foruser (GtkWidget *parent, HBCI_API *api, 
@@ -160,7 +173,7 @@
 			 GNCInteractor *inter)
 {
   const list_HBCI_Customer *customerlist;
-  list_HBCI_Customer_iter *begin;
+  const HBCI_Customer *customer;
   g_assert(user);
 
   customerlist = HBCI_User_customers (user);
@@ -169,34 +182,30 @@
     /* Zero customers? nothing to do. */
     return;
   }
-  else if (list_HBCI_Customer_size (customerlist) == 1) {
-    begin = list_HBCI_Customer_begin (customerlist);
-    if (!update_accounts_forcustomer (parent, api, 
-				      list_HBCI_Customer_iter_get (begin),
-				      inter))
-      return;
-    list_HBCI_Customer_iter_delete (begin);
-  }
-  else {
-    printf("update_accounts_foruser: Sorry, multiple customers not yet supported.\n");
-  }
+  customer = choose_one_customer (GNCInteractor_parent(inter), customerlist);
+  update_accounts_forcustomer (parent, api, customer, inter);
 }
 
 static gboolean
 update_accounts_forcustomer (GtkWidget *parent, HBCI_API *api, 
 			     const HBCI_Customer *cust, GNCInteractor *inter)
 {
-  HBCI_OutboxJobGetAccounts* get_job; 
   HBCI_OutboxJob *job;
+  HBCI_Outbox *outbox;
+  gboolean result;
   g_assert(cust);
   
   /* this const-warning is okay and can be ignored. */
-  get_job = HBCI_OutboxJobGetAccounts_new((HBCI_Customer *)cust); 
-  job = HBCI_OutboxJobGetAccounts_OutboxJob(get_job);
-  HBCI_API_addJob(api, job);
+  job = HBCI_OutboxJob_new("JobGetAccounts", (HBCI_Customer *)cust, ""); 
+  outbox = HBCI_Outbox_new();
+  
+  HBCI_Outbox_addJob(outbox, job);
   
   /* Execute Outbox. */
-  return gnc_hbci_api_execute (parent, api, job, inter);
+  result = gnc_hbci_api_execute (parent, api, outbox, job, inter);
+
+  HBCI_Outbox_delete (outbox);
+  return result;
 }
 
 
@@ -213,9 +222,9 @@
 gnc_hbci_new_hash_from_kvp_cb (Account *gnc_acc, gpointer user_data)
 {
   struct hbci_acc_cb_data *data = user_data;
-  HBCI_Account *hbci_acc = NULL;
+  gnc_HBCI_Account *hbci_acc = NULL;
 
-  hbci_acc = (HBCI_Account *) gnc_hbci_get_hbci_acc (data->api, gnc_acc);
+  hbci_acc = (gnc_HBCI_Account *) gnc_hbci_get_hbci_acc (data->api, gnc_acc);
   if (hbci_acc) {
     g_hash_table_insert (data->hash, hbci_acc, gnc_acc);
   }
@@ -258,14 +267,14 @@
 }
 
 gboolean
-gnc_test_dir_exist_error (GtkWidget *parent, const char *filename) 
+gnc_test_dir_exist_error (GtkWindow *parent, const char *filename) 
 {
   char *dirname = g_dirname (filename);
   gboolean dirtest = g_file_test (dirname, G_FILE_TEST_IS_DIR);
   g_free (dirname);
   if (!dirtest) {
     gnc_error_dialog
-      (parent, 
+      (GTK_WIDGET (parent), 
        _("The directory for file\n"
 "%s\n"
 "does not exist. \n"
@@ -276,3 +285,302 @@
   return TRUE;
 }
 
+
+
+GList *
+gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox, 
+			  GList *accountlist)
+{
+  GWEN_DB_NODE *response, *n;
+
+  g_assert(api);
+  g_assert(outbox);
+  /*g_assert(accountlist);*/
+  
+  response = HBCI_Outbox_response(outbox);
+
+  /*printf("gnc_processOutboxResponse: Complete response:\n");
+    GWEN_DB_Dump(response, stdout, 1);*/
+
+  n=GWEN_DB_GetFirstGroup(response);
+  while (n){
+    if (strcasecmp(GWEN_DB_GroupName(n), "AccountData")==0) {
+      /* found account data, create account */
+      const char *accountId;
+      const char *accountSubId;
+      const char *bankCode;
+      int country;
+      const char *custid;
+      const char *currency;
+      const char *acc_name;
+      const char *acc_name1;
+      /*list_HBCI_Customer *customers;*/
+      /*HBCI_User *user;*/
+      HBCI_Bank *bank;
+
+      country=GWEN_DB_GetIntValue(n, "country", 0, 280);
+      custid=GWEN_DB_GetCharValue(n, "customer", 0, "");
+      bankCode=GWEN_DB_GetCharValue(n, "bankcode", 0, "");
+      accountId=GWEN_DB_GetCharValue(n, "accountid", 0, "");
+      accountSubId=GWEN_DB_GetCharValue(n, "accountsubid", 0, "");
+      if (strlen(bankCode)==0 || strlen(accountId)==0 || strlen(custid)==0) {
+	printf("gnc_processOutboxResponse: AccountData without bank code/account id/customer id\n");
+	continue;
+      }
+
+      currency = GWEN_DB_GetCharValue(n, "currency", 0, NULL);
+      acc_name =  GWEN_DB_GetCharValue(n, "name", 0, NULL);
+      acc_name1 = GWEN_DB_GetCharValue(n, "name1", 0, NULL);
+
+      bank = HBCI_API_findBank(api, country, bankCode);
+      if (bank) {
+        /* bank uses a different bank code for the accounts, so find
+         * the matching bank for the given customer */
+        /*customers=getCustomers(country, "*", custid);
+	  if (customers.empty()) {
+          DBG_ERROR(0, "Unknown customer %d/%s/%s",
+	  country, bankCode.c_str(), custid.c_str());
+          GWEN_DB_Group_free(db);
+          return Error("AqMoneyAPI::processOutboxResponse",
+	  ERROR_LEVEL_NORMAL,
+	  HBCI_ERROR_CODE_UNKNOWN,
+	  ERROR_ADVISE_DONTKNOW,
+	  "Unknown customer");
+	  }
+	  if (customers.size()!=1) {
+          DBG_ERROR(0, "Ambiguous customer %d/%s/%s",
+	  country, bankCode.c_str(), custid.c_str());
+          GWEN_DB_Group_free(db);
+          return Error("AqMoneyAPI::processOutboxResponse",
+	  ERROR_LEVEL_NORMAL,
+	  HBCI_ERROR_CODE_UNKNOWN,
+	  ERROR_ADVISE_DONTKNOW,
+	  "Ambiguous customer");
+	  }
+	  user=customers.front().ref().user();
+	  bank=user.ref().bank();*/
+      }
+
+      
+      {
+	/* Check if such an account already exists */
+	gnc_HBCI_Account *acc = 
+	  list_HBCI_Account_find(accountlist, bank, bankCode, accountId);
+	
+	if (acc) {
+	  /* Update account information */
+	  printf("gnc_processOutboxResponse: Account %d/%s/%s already exists, updating.\n",
+		 country, bankCode, accountId);
+	}
+	else {
+	  /* Create new account object */
+	  acc = gnc_HBCI_Account_new(bank, bankCode, accountId);
+
+	  /* Add it to our internal list. */
+	  accountlist = g_list_append(accountlist, acc);
+
+	  printf("gnc_processOutboxResponse: Added account %d/%s/%s\n",
+		 country, bankCode, accountId);
+	}
+	gnc_HBCI_Account_set_currency(acc, currency);
+	gnc_HBCI_Account_set_name(acc, acc_name);
+	gnc_HBCI_Account_set_name1(acc, acc_name1);
+	gnc_HBCI_Account_set_customer(acc, custid);
+      }
+      
+
+    } /* if "AccountData" */
+    else if (strcasecmp(GWEN_DB_GroupName(n), "bankmsg")==0) {
+      /* add to existing bank messages */
+      /*GWEN_DB_AddGroup(_bankMessages, GWEN_DB_Group_dup(n));
+      fprintf(stderr, "------------------------------------\n");
+      fprintf(stderr,
+              "Message from \"%s\":\n",
+              GWEN_DB_GetCharValue(n, "bankCode", 0, "<unknown>"));
+      fprintf(stderr, "Subject: %s\n",
+              GWEN_DB_GetCharValue(n, "subject", 0, "<empty>"));
+      fprintf(stderr, "\n%s\n\n",
+      GWEN_DB_GetCharValue(n, "text", 0, "<empty>"));*/
+    }
+    n=GWEN_DB_GetNextGroup(n);
+  } /* while n */
+
+  GWEN_DB_Group_free(response);
+  //printf("gnc_processOutboxResponse: accountlist.size: %d\n", g_list_length(accountlist));
+  
+  return accountlist;
+}
+
+
+gboolean
+gnc_hbci_evaluate_GetKeys(HBCI_Outbox *outbox, HBCI_OutboxJob *job,
+			  HBCI_Customer *newcustomer)
+{
+  GWEN_DB_NODE *rsp;
+  GWEN_DB_NODE *n;
+  /*HBCI_Error *err;*/
+  HBCI_RSAKey *_cryptKey = NULL;
+  HBCI_RSAKey *_signKey = NULL;
+
+  g_assert(outbox);
+  g_assert(newcustomer);
+  
+  rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+  if (!rsp) {
+    fprintf(stderr, "JobGetKeys::evaluate: no response data\n");
+    return FALSE;
+  }
+
+  /*printf("JobGetKeys: Complete response:\n");
+    GWEN_DB_Dump(rsp, stderr, 1);*/
+
+  n=GWEN_DB_GetFirstGroup(rsp);
+  while(n) {
+    if (strcasecmp(GWEN_DB_GroupName(n), "GetKeyResponse")==0) {
+      unsigned int bs;
+      const void *p;
+      GWEN_DB_NODE *keydb;
+      const char defaultExpo[3]={0x01, 0x00, 0x01};
+      gboolean iscrypt;
+
+      //DBG_NOTICE(0, "Found Key response");
+      iscrypt=FALSE;
+
+      keydb=GWEN_DB_Group_new("key");
+      GWEN_DB_SetCharValue(keydb,
+                           GWEN_DB_FLAGS_OVERWRITE_VARS,
+                           "type",
+                           "RSA");
+      // TODO: check for the correct exponent (for now assume 65537)
+      GWEN_DB_SetBinValue(keydb,
+                          GWEN_DB_FLAGS_OVERWRITE_VARS,
+                          "data/e",
+                          defaultExpo,
+                          sizeof(defaultExpo));
+
+      GWEN_DB_SetIntValue(keydb,
+                          GWEN_DB_FLAGS_OVERWRITE_VARS,
+                          "data/public",
+                          1);
+
+      iscrypt=(strcasecmp(GWEN_DB_GetCharValue(n,
+                                               "keyname/keytype", 0,
+                                               "V"), "V")==0);
+      GWEN_DB_SetCharValue(keydb,
+                           GWEN_DB_FLAGS_OVERWRITE_VARS,
+                           "name",
+                           GWEN_DB_GetCharValue(n,
+                                                "keyname/keytype", 0,
+                                                "V"));
+      GWEN_DB_SetCharValue(keydb,
+                           GWEN_DB_FLAGS_OVERWRITE_VARS,
+                           "owner",
+                           GWEN_DB_GetCharValue(n, "keyname/userId", 0, ""));
+      GWEN_DB_SetIntValue(keydb,
+                          GWEN_DB_FLAGS_OVERWRITE_VARS,
+                          "number",
+                          GWEN_DB_GetIntValue(n, "keyname/keynum", 0, 0));
+      GWEN_DB_SetIntValue(keydb,
+                          GWEN_DB_FLAGS_OVERWRITE_VARS,
+                          "version",
+                          GWEN_DB_GetIntValue(n, "keyname/keyversion", 0, 0));
+
+
+      p=GWEN_DB_GetBinValue(n, "key/modulus", 0, 0, 0 , &bs);
+      if (!p || !bs) {
+	fprintf(stderr, "JobGetKeys::evaluate: no modulus\n");
+	return FALSE;
+      }
+      GWEN_DB_SetBinValue(keydb,
+			  GWEN_DB_FLAGS_OVERWRITE_VARS,
+                          "data/n",
+			  p, bs);
+
+      if (iscrypt)
+	_cryptKey = HBCI_RSAKey_new(iscrypt, keydb);
+      else
+	_signKey = HBCI_RSAKey_new(iscrypt, keydb);
+      fprintf(stderr, "gnc_hbci_evaluate_GetKeys: Created %s key\n", iscrypt?"crypt":"sign");
+    } // if we have a key response
+    n=GWEN_DB_GetNextGroup(n);
+  } // while
+
+  // Key creation finished. Now add them to the medium @§%$!!!
+
+  if (!_cryptKey) {
+    printf("gnc_hbci_evaluate_GetKeys: Oops, no cryptKey received.\n");
+    return FALSE;
+  }
+  
+  
+  {
+    HBCI_MediumRDHBase *mrdh;
+    HBCI_Medium *medium;
+    const HBCI_Bank *bank;
+    const HBCI_User *user;
+    HBCI_Error *err;
+
+    // get some vars
+    user = HBCI_Customer_user(newcustomer);
+    bank = HBCI_User_bank(user);
+    medium = (HBCI_Medium *) HBCI_User_medium(user);
+    mrdh = HBCI_Medium_MediumRDHBase (medium);
+
+    // mount medium
+    err = HBCI_Medium_mountMedium(medium, "");
+    if (err && !HBCI_Error_isOk(err)) {
+      fprintf(stderr, "JobGetKeys::commit: 1\n");
+      return FALSE;
+    }
+
+    // select context
+    err = HBCI_Medium_selectContext(medium, HBCI_Bank_country(bank),
+				    HBCI_Bank_bankCode(bank),
+				    HBCI_User_userId(user));
+    if (err && !HBCI_Error_isOk(err)) {
+      HBCI_Medium_unmountMedium(medium, "");
+      fprintf(stderr, "JobGetKeys::commit: 2\n");
+      return FALSE;
+    }
+
+    // set crypt key
+    if (_cryptKey) {
+      fprintf(stderr, "Setting Institute Crypt Key\n");
+      if (!HBCI_RSAKey_isCryptoKey(_cryptKey)) {
+	fprintf(stderr, "Crypt key expected\n");
+	return FALSE;
+      }
+      err = HBCI_MediumRDHBase_setInstituteCryptKey(mrdh, _cryptKey);
+      if (err && !HBCI_Error_isOk(err)) {
+	HBCI_Medium_unmountMedium(medium, "");
+	fprintf(stderr, "JobGetKeys::commit: 3\n");
+	return FALSE;
+      }
+    }
+
+    // set sign key
+    if (_signKey) {
+      fprintf(stderr, "Setting Institute Sign Key\n");
+      err=HBCI_MediumRDHBase_setInstituteSignKey(mrdh, _signKey);
+      if (err && !HBCI_Error_isOk(err)) {
+	HBCI_Medium_unmountMedium(medium, "");
+	fprintf(stderr, "JobGetKeys::commit: 4\n");
+	return FALSE;
+      }
+      if (!HBCI_MediumRDHBase_hasInstSignKey(mrdh)) {
+	fprintf(stderr, "What ??? I just set the signkey but there is none ?!\n");
+      }
+    }
+
+    err = HBCI_Medium_unmountMedium(medium, "");
+    if (err && !HBCI_Error_isOk(err)) {
+      fprintf(stderr, "JobGetKeys::commit: 5\n");
+      return FALSE;
+    }
+    fprintf(stderr, "New institute keys activated\n");
+  }
+  
+  // use result returned from lower class
+  return TRUE;
+}
+

==================================================
Differences for druid-hbci-utils.h (revision 1.3.4.1 -> 1.3.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-utils.h	2003/08/08 23:27:49	1.3.4.1
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-utils.h	2004/03/03 23:15:06	1.3.4.2
@@ -24,9 +24,9 @@
 #define DRUID_HBCI_UTILS_H
 
 #include <gnome.h>
-#include <openhbci/api.h>
+#include <openhbci2/api.h>
 #include "hbci-interaction.h"
-
+#include "gnc-hbci-utils.h"
 
 /** Save the reference strings to the HBCI accounts in the kvp's of
  * the gnucash accounts. Each value will only be set if it is
@@ -52,7 +52,15 @@
 gnc_verify_exist_or_new_file (GtkWidget *parent, const char *filename);
 
 gboolean
-gnc_test_dir_exist_error (GtkWidget *parent, const char *filename);
+gnc_test_dir_exist_error (GtkWindow *parent, const char *filename);
+
+GList *
+gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox, 
+			  GList *accountlist);
 
+/* Get keys from Job; store them in the customer's medium @§%&! */
+gboolean
+gnc_hbci_evaluate_GetKeys(HBCI_Outbox *outbox, HBCI_OutboxJob *job,
+			  HBCI_Customer *newcustomer);
 
 #endif

==================================================
Differences for gnc-hbci-actions.c (revision 1.10 -> 1.10.4.1)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-actions.c	2002/10/27 18:51:04	1.10
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-actions.c	2004/03/03 23:15:06	1.10.4.1
@@ -22,8 +22,8 @@
 
 #include "gnc-hbci-actions.h"
 
-#include <openhbci/api.h>
-#include <openhbci/outboxaccjobs.h>
+#include <openhbci2/api.h>
+#include <openhbci2/outboxaccjobs.h>
 
 /* File intentionally left blank. */
 

==================================================
Differences for gnc-hbci-getbalance.c (revision 1.13.4.6 -> 1.13.4.7)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c	2003/10/25 06:48:00	1.13.4.6
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c	2004/03/03 23:15:06	1.13.4.7
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "gnc-hbci-getbalance.h"
 
-#include <openhbci/api.h>
+#include <openhbci2/api.h>
 
 #include "gnc-ui.h"
 #include "gnc-numeric.h"
@@ -35,19 +35,20 @@
 #include "dialog-hbcitrans.h"
 
 
-void gnc_hbci_getbalance_debugprint(HBCI_OutboxJobGetBalance *balance_job,
-				    const HBCI_Account *h_acc);
+void gnc_hbci_getbalance_debugprint(HBCI_OutboxJob *balance_job,
+				    const gnc_HBCI_Account *h_acc);
 
 static void 
 bal_print_debug(const char *name,
 		const HBCI_Value *val,
 		gboolean negative,
-		time_t tt)
+		const char *date_str,
+		const char *time_str)
 {
   char *str = HBCI_Value_toReadableString (val);
-  printf("GetBalance: %s%s %s at date %s",
+  printf("GetBalance: %s%s %s at date %s %s",
 	 (negative ? "-" : ""), str, 
-	 name, ctime(&tt));
+	 name, date_str, time_str);
   free (str);
 }
 
@@ -56,16 +57,18 @@
 gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
 {
   HBCI_API *api = NULL;
-  const HBCI_Account *h_acc = NULL;
+  HBCI_Outbox *outbox = NULL;
+  const gnc_HBCI_Account *h_acc = NULL;
   GNCInteractor *interactor = NULL;
   const HBCI_Customer *customer = NULL;
+  GList *hbci_accountlist = NULL;
   
   g_assert(parent);
   if (gnc_acc == NULL)
     return;
 
   /* Get API */
-  api = gnc_hbci_api_new_currentbook (parent, &interactor);
+  api = gnc_hbci_api_new_currentbook (parent, &interactor, &hbci_accountlist);
   if (api == NULL) {
     printf("gnc_hbci_getbalance: Couldn't get HBCI API.\n");
     return;
@@ -79,7 +82,7 @@
     return;
   }
   /* printf("gnc_hbci_getbalance: HBCI account no. %s found.\n",
-     HBCI_Account_accountId (h_acc)); */
+     gnc_HBCI_Account_accountId (h_acc)); */
   
   /* Get the customer that should be doing this job. */
   customer = gnc_hbci_get_first_customer(h_acc);
@@ -90,22 +93,21 @@
 
   {
     /* Execute a GetBalance job. */
-    HBCI_OutboxJobGetBalance *balance_job;
     HBCI_OutboxJob *job;
-    
-    balance_job = 
-      HBCI_OutboxJobGetBalance_new (customer, (HBCI_Account *)h_acc);
-    job = HBCI_OutboxJobGetBalance_OutboxJob (balance_job);
-    g_assert (job);
 
+    job = HBCI_OutboxJob_new("JobGetBalance", (HBCI_Customer *)customer, 
+			     gnc_HBCI_Account_accountId(h_acc));
+    HBCI_Job_setProperty(HBCI_OutboxJob_Job(job), "allAccounts", "N");
+    
     /* Add job to API queue */
-    HBCI_API_addJob (api, job);
+    outbox = HBCI_Outbox_new();
+    HBCI_Outbox_addJob (outbox, job);
 
     /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (parent, api, job, interactor)) {
+    if (!gnc_hbci_api_execute (parent, api, outbox, job, interactor)) {
 
       /* HBCI_API_executeOutbox failed. */
-      HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+      HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
       return;
     }
 
@@ -114,10 +116,11 @@
     /* Finish this job. */
     gnc_hbci_getbalance_finish (parent, 
 				gnc_acc,
-				balance_job);
+				job);
 
     /* Clean up after ourselves. */
-    HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_delete(outbox);
     gnc_hbci_api_save (api);
     GNCInteractor_hide (interactor);
   }
@@ -125,45 +128,53 @@
 
 
 
-void gnc_hbci_getbalance_debugprint(HBCI_OutboxJobGetBalance *balance_job,
-				    const HBCI_Account *h_acc)
+void gnc_hbci_getbalance_debugprint(HBCI_OutboxJob *job,
+				    const gnc_HBCI_Account *h_acc)
 {
-  const HBCI_AccountBalance *acc_bal;
-  const HBCI_Balance *noted_bal, *booked_bal;
-  time_t balance_tt, noted_tt, booked_tt;
-	    
-  acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
-  balance_tt = 
-    HBCI_DateTime_to_time_t (HBCI_AccountBalance_date (acc_bal), 
-			     HBCI_AccountBalance_time (acc_bal));
-    
-  booked_bal = HBCI_AccountBalance_bookedBalance (acc_bal);
-  booked_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (booked_bal), 
-				       HBCI_Balance_time (booked_bal));
-  
-  noted_bal = HBCI_AccountBalance_notedBalance (acc_bal);
-  noted_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (noted_bal), 
-				      HBCI_Balance_time (noted_bal));
+  GWEN_DB_NODE *response, *acc_bal;
+  GWEN_DB_NODE *noted_grp, *booked_grp;
+  HBCI_Value *booked_val, *noted_val;
+  /* time_t balance_tt, noted_tt, booked_tt; */
+	
+  response = HBCI_Job_responseData(HBCI_OutboxJob_Job(job));
+  if (!response)
+    return;
+  acc_bal =GWEN_DB_GetGroup(response, 
+			    GWEN_PATH_FLAGS_NAMEMUSTEXIST, "balance");
+  if (!acc_bal) 
+    return;
+
+  noted_grp = GWEN_DB_GetGroup(response, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "noted");
+  booked_grp = GWEN_DB_GetGroup(response, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "booked");
+
+  booked_val = HBCI_Value_new(GWEN_DB_GetCharValue(booked_grp, "value", 0, "0"),
+			      GWEN_DB_GetCharValue(booked_grp, "currency", 0, "EUR"));
+  noted_val = HBCI_Value_new(GWEN_DB_GetCharValue(noted_grp, "value", 0, "0"),
+			     GWEN_DB_GetCharValue(noted_grp, "currency", 0, "EUR"));
     
   printf("GetBalance: Balances for account %s :\n",
-	 HBCI_Account_accountId (h_acc));
+	 gnc_HBCI_Account_accountId (h_acc));
   bal_print_debug("Booked balance",
-		  HBCI_Balance_value (booked_bal),
-		  HBCI_Balance_isDebit (booked_bal),
-		  booked_tt);
+		  booked_val,
+		  (strcasecmp(GWEN_DB_GetCharValue(booked_grp, "debitmark", 0, "C"),"D")==0),
+		  GWEN_DB_GetCharValue(booked_grp, "date", 0, ""),
+		  GWEN_DB_GetCharValue(booked_grp, "time", 0, ""));
   bal_print_debug("Noted balance",
-		  HBCI_Balance_value (noted_bal),
-		  HBCI_Balance_isDebit (noted_bal),
-		  noted_tt);
-  bal_print_debug("Bank Line", 
-		  HBCI_AccountBalance_bankLine (acc_bal), FALSE,
-		  balance_tt);
-  bal_print_debug("Disposable amount",
-		  HBCI_AccountBalance_disposable (acc_bal), FALSE,
-		  balance_tt);
-  bal_print_debug("Already disposed",
-		  HBCI_AccountBalance_disposed (acc_bal), FALSE,
-		  balance_tt);
+		  noted_val,
+		  (strcasecmp(GWEN_DB_GetCharValue(noted_grp, "debitmark", 0, "C"),"D")==0),
+		  GWEN_DB_GetCharValue(noted_grp, "date", 0, ""),
+		  GWEN_DB_GetCharValue(noted_grp, "time", 0, ""));
+/*   bal_print_debug("Bank Line",  */
+/* 		  gnc_HBCI_AccountBalance_bankLine (acc_bal), FALSE, */
+/* 		  balance_tt); */
+/*   bal_print_debug("Disposable amount", */
+/* 		  gnc_HBCI_AccountBalance_disposable (acc_bal), FALSE, */
+/* 		  balance_tt); */
+/*   bal_print_debug("Already disposed", */
+/* 		  gnc_HBCI_AccountBalance_disposed (acc_bal), FALSE, */
+/* 		  balance_tt); */
+  HBCI_Value_delete(booked_val);
+  HBCI_Value_delete(noted_val);
 }
 
 static gchar*
@@ -184,33 +195,55 @@
 gboolean
 gnc_hbci_getbalance_finish (GtkWidget *parent, 
 			    Account *gnc_acc,
-			    const HBCI_OutboxJobGetBalance *balance_job)
+			    const HBCI_OutboxJob *job)
 {
-  const HBCI_AccountBalance *acc_bal;
-  const HBCI_Balance *noted_bal, *booked_bal;
-  const HBCI_Value *booked_val; 
+  GWEN_DB_NODE *response, *acc_bal;
+  GWEN_DB_NODE *noted_grp, *booked_grp;
+  HBCI_Value *booked_val, *noted_val;
+
   time_t booked_tt;
-  /*time_t balance_tt, noted_tt;*/
-  gboolean booked_debit;
+
+  gboolean booked_debit, noted_debit;
   gboolean dialogres;
 	    
-  acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
-  /*balance_tt = 
-    HBCI_DateTime_to_time_t (HBCI_AccountBalance_date (acc_bal), 
-    HBCI_AccountBalance_time (acc_bal));*/
-    
-  booked_bal = HBCI_AccountBalance_bookedBalance (acc_bal);
-  booked_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (booked_bal), 
-				       HBCI_Balance_time (booked_bal));
-  booked_val = HBCI_Balance_value (booked_bal);
-  booked_debit = HBCI_Balance_isDebit (booked_bal);
+  response = HBCI_Job_responseData((HBCI_Job*)HBCI_OutboxJob_Job_const(job));
+  if (!response) {
+    printf("gnc_hbci_getbalance_finish: Oops, response == NULL.\n");
+    return TRUE;
+  }
+  acc_bal = GWEN_DB_GetGroup(response, 
+			    GWEN_PATH_FLAGS_NAMEMUSTEXIST, "balance");
+  if (!acc_bal) {
+    printf("gnc_hbci_getbalance_finish: Oops, acc_bal == NULL. Response was:\n");
+    GWEN_DB_Dump(response, stdout, 1);
+    return TRUE;
+  }
+
+  noted_grp = GWEN_DB_GetGroup(acc_bal, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "noted");
+  booked_grp = GWEN_DB_GetGroup(acc_bal, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "booked");
+
+  if (!booked_grp || !noted_grp) {
+    printf("gnc_hbci_getbalance_finish: Oops, booked_grp or noted_grp == NULL. Response was:\n");
+    GWEN_DB_Dump(response, stdout, 1);
+    return TRUE;
+  }
+  booked_val = HBCI_Value_new(GWEN_DB_GetCharValue(booked_grp, "value", 0, "0"),
+			      GWEN_DB_GetCharValue(booked_grp, "currency", 0, "EUR"));
+  booked_debit = (strcasecmp(GWEN_DB_GetCharValue(booked_grp, "debitmark", 0, "C"),"D")==0);
   
-  noted_bal = HBCI_AccountBalance_notedBalance (acc_bal);
-  /*noted_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (noted_bal), 
-    HBCI_Balance_time (noted_bal));*/
+  noted_val = HBCI_Value_new(GWEN_DB_GetCharValue(noted_grp, "value", 0, "0"),
+			     GWEN_DB_GetCharValue(noted_grp, "currency", 0, "EUR"));
+  noted_debit = (strcasecmp(GWEN_DB_GetCharValue(noted_grp, "debitmark", 0, "C"),"D")==0);
+  
+  {
+    HBCI_Date *a = HBCI_Date_new_string(GWEN_DB_GetCharValue(booked_grp, "date", 0, ""), 4);
     
-  if ((HBCI_Value_getValue (HBCI_Balance_value (noted_bal)) == 0) &&
-      (HBCI_Value_getValue (HBCI_Balance_value (booked_bal)) == 0))
+    booked_tt = HBCI_Date_to_time_t (a);
+    HBCI_Date_delete(a);
+  }
+    
+  if ((HBCI_Value_getValue (noted_val) == 0) &&
+      (HBCI_Value_getValue (booked_val) == 0))
     {
       gnome_ok_dialog_parented 
 	/* Translators: Strings from this file are really only
@@ -239,7 +272,7 @@
 	 (booked_debit ? "-" : ""),
 	 booked_str);
       char *message2 = 
-	((HBCI_Value_getValue (HBCI_Balance_value (noted_bal)) == 0) ?
+	((HBCI_Value_getValue (noted_val) == 0) ?
 	 g_strdup_printf("%s", "") :
 	 bal_print_balance
 	 /* Translators: The first %s is "-" if this amount is
@@ -247,8 +280,8 @@
 	  * amount. */
 	 (_("For your information: This account also \n"
 	    "has a noted balance of %s%s\n"),
-	  HBCI_Balance_value (noted_bal),
-	  HBCI_Balance_isDebit (noted_bal)));
+	  noted_val,
+	  noted_debit));
       const char *message3 = _("Reconcile account now?");
 
       dialogres = gnc_verify_dialog

==================================================
Differences for gnc-hbci-getbalance.h (revision 1.1.4.1 -> 1.1.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.h	2003/07/17 08:00:05	1.1.4.1
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.h	2004/03/03 23:15:06	1.1.4.2
@@ -25,7 +25,7 @@
 
 #include <gnome.h>
 #include "Account.h"
-#include <openhbci/outboxaccjobs.h>
+#include <openhbci2/outboxjob.h>
 
 /** Starts a GetBalance job, adds the job to the HBCI_API, and
  * (currently) calls executeOutbox. */
@@ -37,7 +37,7 @@
 gboolean
 gnc_hbci_getbalance_finish (GtkWidget *parent, 
 			    Account *gnc_acc,
-			    const HBCI_OutboxJobGetBalance *balance_job);
+			    const HBCI_OutboxJob *job);
 
 
 #endif /* GNC_HBCI_GETBALANCE_H */

==================================================
Differences for gnc-hbci-gettrans.c (revision 1.20.4.5 -> 1.20.4.6)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c	2003/09/19 05:56:51	1.20.4.5
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c	2004/03/03 23:15:06	1.20.4.6
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "gnc-hbci-gettrans.h"
 
-#include <openhbci/api.h>
+#include <openhbci2/api.h>
 
 #include "gnc-ui.h"
 #include "gnc-numeric.h"
@@ -48,7 +48,8 @@
 gettrans_dates(GtkWidget *parent, Account *gnc_acc, 
 	       HBCI_Date **from_date, HBCI_Date **to_date);
 
-static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data);
+static void *trans_list_cb (GWEN_DB_NODE *trans_node, void *user_data);
+static void *reports_cb(GWEN_DB_NODE *reportn, void *user_data);
 
 struct trans_list_data 
 {
@@ -61,20 +62,23 @@
 gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
 {
   HBCI_API *api = NULL;
-  const HBCI_Account *h_acc = NULL;
+  HBCI_Outbox *outbox = NULL;
+  const gnc_HBCI_Account *h_acc = NULL;
   GNCInteractor *interactor = NULL;
   const HBCI_Customer *customer = NULL;
+  GList *hbci_accountlist = NULL;
   
   g_assert(parent);
   g_assert(gnc_acc);
 
   /* Get the api */
-  api = gnc_hbci_api_new_currentbook (parent, &interactor);
+  api = gnc_hbci_api_new_currentbook (parent, &interactor, &hbci_accountlist);
   if (api == NULL) {
     printf("gnc_hbci_gettrans: Couldn't get HBCI API.\n");
     return;
   }
   g_assert (interactor);
+  outbox = HBCI_Outbox_new();
 
   /* Get the HBCI account */
   h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
@@ -83,7 +87,7 @@
     return;
   }
   /* printf("gnc_hbci_gettrans: HBCI account no. %s found.\n",
-     HBCI_Account_accountId (h_acc)); */
+     gnc_HBCI_Account_accountId (h_acc)); */
 
   /* Get the customer that should be doing this job. */
   customer = gnc_hbci_get_first_customer(h_acc);
@@ -96,7 +100,6 @@
 
   {
     /* Execute a GetTransactions job. */
-    HBCI_OutboxJobGetTransactions *trans_job;
     HBCI_OutboxJob *job;
     Timespec until_timespec;
     HBCI_Date *from_date, *to_date;
@@ -108,23 +111,30 @@
     timespecFromTime_t(&until_timespec, HBCI_Date_to_time_t(to_date));
     
     /* Create OutboxJob */
-    trans_job = 
-      HBCI_OutboxJobGetTransactions_new (customer, 
-					 (HBCI_Account *)h_acc,
-					 from_date,
-					 to_date);
+    job = HBCI_OutboxJob_new("JobGetTransactions", (HBCI_Customer *)customer, 
+			     gnc_HBCI_Account_accountId(h_acc));
+    
+    {
+      HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
+      char *tmp;
+      
+      tmp = HBCI_Date_toString(from_date);
+      HBCI_Job_setProperty(jjob, "fromDate", tmp);
+      free(tmp);
+      tmp = HBCI_Date_toString(to_date);
+      HBCI_Job_setProperty(jjob, "toDate", tmp);
+      free(tmp);
+    }
     HBCI_Date_delete (from_date);
     HBCI_Date_delete (to_date);
-    job = HBCI_OutboxJobGetTransactions_OutboxJob (trans_job);
-    g_assert (job);
 
     /* Add job to HBCI_API queue. */
-    HBCI_API_addJob (api, job);
+    HBCI_Outbox_addJob (outbox, job);
 
     /* Execute Outbox. */
-    if (!gnc_hbci_api_execute (parent, api, job, interactor)) {
+    if (!gnc_hbci_api_execute (parent, api, outbox, job, interactor)) {
       /* HBCI_API_executeOutbox failed. */
-      HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+      HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
       return;
     }
 
@@ -132,10 +142,11 @@
     gnc_hbci_set_account_trans_retrieval (gnc_acc, until_timespec);
 
     /* Now finish the job duties. */
-    gnc_hbci_gettrans_final(parent, gnc_acc, trans_job, FALSE);
+    gnc_hbci_gettrans_final(parent, gnc_acc, job, FALSE);
 
     /* Clean up behind ourself. */
-    HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_delete(outbox);
     gnc_hbci_api_save (api);
     GNCInteractor_hide (interactor);
   }
@@ -201,17 +212,40 @@
 gboolean
 gnc_hbci_gettrans_final(GtkWidget *parent, 
 			Account *gnc_acc, 
-			const HBCI_OutboxJobGetTransactions *trans_job,
+			const HBCI_OutboxJob *trans_job,
 			gboolean run_until_done)
 {
   /* Now add the retrieved transactions to the gnucash account. */
-  const list_HBCI_Transaction *trans_list;
-      
-  trans_list = HBCI_OutboxJobGetTransactions_transactions (trans_job);
-  /*printf("gnc_hbci_gettrans: Got %d transactions.\n", 
-    list_HBCI_Transaction_size(trans_list));*/
+  GWEN_DB_NODE *trans_list, *response;
 
-  if (list_HBCI_Transaction_size(trans_list) > 0) {
+
+  response = HBCI_Job_responseData((HBCI_Job*)HBCI_OutboxJob_Job_const(trans_job));
+  if (!response) {
+    printf("gnc_hbci_gettrans_final: Got no responseData.\n");
+    return FALSE;
+  }
+
+  trans_list = GWEN_DB_GetGroup(response, GWEN_PATH_FLAGS_NAMEMUSTEXIST, 
+				"transactions");
+  if (!trans_list) {
+    printf("gnc_hbci_gettrans_final: No transactions section. Response was:\n");
+    GWEN_DB_Dump(response, stdout, 1);
+
+    gnome_ok_dialog_parented 
+      (_("The HBCI import returned no transactions for the selected time period."),
+       GTK_WINDOW (parent));
+    return TRUE;
+  }
+  
+  trans_list = GWEN_DB_GetGroup(trans_list,
+				GWEN_PATH_FLAGS_NAMEMUSTEXIST,
+				"booked");
+
+  if (!trans_list) {
+    printf("gnc_hbci_gettrans_final: No booked section. Response was:\n");
+    GWEN_DB_Dump(response, stdout, 1);
+  }
+  if (trans_list && (GWEN_DB_Groups_Count(trans_list) > 0)) {
     struct trans_list_data data;
     GNCImportMainMatcher *importer_generic_gui = 
       gnc_gen_trans_list_new(NULL, NULL, TRUE);
@@ -219,7 +253,7 @@
     data.importer_generic = importer_generic_gui;
     data.gnc_acc = gnc_acc;
 	
-    list_HBCI_Transaction_foreach (trans_list, trans_list_cb, &data);
+    GWEN_DB_Groups_Foreach (trans_list, reports_cb, &data);
 
     if (run_until_done)
       return gnc_gen_trans_list_run (importer_generic_gui);
@@ -235,102 +269,144 @@
 }
 
 
+static void *reports_cb(GWEN_DB_NODE *reportn, void *user_data)
+{
+  if (!reportn) {
+    /*DBG_INFO(0, "Oops: reportn is NULL");*/
+    return NULL;
+  }
+  if (strcasecmp(GWEN_DB_GroupName(reportn), "report")==0) {
+    return GWEN_DB_Groups_Foreach(reportn, trans_list_cb, user_data);
+  } // if report
+  else {
+    /*DBG_WARN(0, "Unknown section \"%s\"", GWEN_DB_GroupName(reportn));*/
+  }
+  return NULL;
+}
+
 
 /* list_HBCI_Transaction_foreach callback. The Conversion from HBCI to
    GNC transaction is done here, once for each HBCI_Transaction.  */
-static void *trans_list_cb (const HBCI_Transaction *h_trans, 
+static void *trans_list_cb (GWEN_DB_NODE *trans_node, 
 			    void *user_data)
 {
+  HBCI_Transaction *h_trans;
+  time_t current_time, tt1, tt2; 
+  /*struct tm tm1, tm2;*/
   Account *gnc_acc;
+  GNCBook *book;
+  Transaction *gnc_trans;
+  Split *split;
   struct trans_list_data *data = user_data;
   g_assert(data);
-  g_assert(h_trans);
+
+  if (!trans_node) return NULL;
 
   gnc_acc = data->gnc_acc;
   g_assert(gnc_acc);
+  book = xaccAccountGetBook(gnc_acc);
 
-  gnc_hbci_trans_import(h_trans,data->importer_generic,gnc_acc);
-
-  return NULL;
-}
-
-void gnc_hbci_trans_import(const HBCI_Transaction *h_trans,
-		GNCImportMainMatcher *importer_generic,
-		Account *gnc_acc)
-{
-  time_t current_time, tt1, tt2; 
-  /*struct tm tm1, tm2;*/
-  GNCBook *book;
-  Transaction *gnc_trans;
-  Split *split;
+  if (strcasecmp(GWEN_DB_GroupName(trans_node), "transaction")==0) {
+    /* Create wrapper HBCI_Transaction */
+    h_trans = HBCI_Transaction_new(trans_node);
 
-  book = xaccAccountGetBook(gnc_acc);
-  gnc_trans = xaccMallocTransaction(book);
-  xaccTransBeginEdit(gnc_trans);
+    gnc_trans = xaccMallocTransaction(book);
+    xaccTransBeginEdit(gnc_trans);
 
-  /*if(data.fi_id_valid==true){
-    gnc_import_set_trans_online_id(gnc_trans, data.fi_id);
-    }*/
+    /*if(data.fi_id_valid==true){
+      gnc_import_set_trans_online_id(gnc_trans, data.fi_id);
+      }*/
 
-  tt1 = HBCI_Date_to_time_t (HBCI_Transaction_date(h_trans));
-  tt2 = HBCI_Date_to_time_t (HBCI_Transaction_valutaDate(h_trans));
-  /*printf("Date? %s ValutaDate? %s", ctime(&tt1), ctime(&tt2));*/
-  /*tm1 = HBCI_Date_to_tm (HBCI_Transaction_date(h_trans));
-    tm2 = HBCI_Date_to_tm (HBCI_Transaction_valutaDate(h_trans));
-    printf("Date asc %s ValutaDate asc %s", asctime(&tm1), asctime(&tm2));*/
+    tt1 = HBCI_Date_to_time_t (HBCI_Transaction_date(h_trans));
+    tt2 = HBCI_Date_to_time_t (HBCI_Transaction_valutaDate(h_trans));
+    /*printf("Date? %s ValutaDate? %s", ctime(&tt1), ctime(&tt2));*/
+    /*tm1 = HBCI_Date_to_tm (HBCI_Transaction_date(h_trans));
+      tm2 = HBCI_Date_to_tm (HBCI_Transaction_valutaDate(h_trans));
+      printf("Date asc %s ValutaDate asc %s", asctime(&tm1), asctime(&tm2));*/
   
   
-  /* Date / Time */
-  xaccTransSetDateSecs
-    (gnc_trans, HBCI_Date_to_time_t (HBCI_Transaction_valutaDate (h_trans)));
-
-  current_time = time(NULL);
-  xaccTransSetDateEnteredSecs(gnc_trans, mktime(localtime(&current_time)));
+    /* Date / Time */
+    xaccTransSetDateSecs
+      (gnc_trans, HBCI_Date_to_time_t (HBCI_Transaction_valutaDate (h_trans)));
+    
+    current_time = time(NULL);
+    xaccTransSetDateEnteredSecs(gnc_trans, mktime(localtime(&current_time)));
+    
+    /* Currency; we take simply the default currency of the gnucash account */
+    xaccTransSetCurrency(gnc_trans, xaccAccountGetCommodity(gnc_acc));
+    
+    {
+      /* Number. We use the "customer reference", if there is one. */
+      const char *custref = HBCI_Transaction_customerReference (h_trans);
+      if (custref && (strlen (custref) > 0) && 
+	  (g_strncasecmp (custref, "NONREF", 6) != 0))
+	xaccTransSetNum (gnc_trans, custref);
+    }
+    
+    /* Description */
+    {
+      char *g_descr = gnc_hbci_descr_tognc (h_trans);
+      xaccTransSetDescription (gnc_trans, g_descr);
+      g_free (g_descr);
+    }
   
-  /* Currency; we take simply the default currency of the gnucash account */
-  xaccTransSetCurrency(gnc_trans, xaccAccountGetCommodity(gnc_acc));
+    /* Notes. */
+    /*xaccTransSetNotes (gnc_trans, g_notes);*/
+    /* But Nobody ever uses the Notes field? */
+    
+    /* Add one split */
+    split=xaccMallocSplit(book);
+    xaccTransAppendSplit(gnc_trans, split);
+    xaccAccountInsertSplit(gnc_acc, split);
+    
+    {
+      /* Amount into the split */
+      gnc_numeric gnc_amount = double_to_gnc_numeric
+	(HBCI_Value_getValue (HBCI_Transaction_value (h_trans)),
+	 xaccAccountGetCommoditySCU(gnc_acc),
+	 GNC_RND_ROUND);
+    xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
+    }
+    
+    /* Memo in the Split. */
+    {
+      char *g_memo = gnc_hbci_memo_tognc (h_trans);
+      xaccSplitSetMemo(split, g_memo);
+      g_free (g_memo);
+    }
+    
+    /* Instead of xaccTransCommitEdit(gnc_trans)  */
+    g_assert (data->importer_generic);
+    gnc_gen_trans_list_add_trans (data->importer_generic, gnc_trans);
 
-  {
-    /* Number. We use the "customer reference", if there is one. */
-    const char *custref = HBCI_Transaction_customerReference (h_trans);
-    if (custref && (strlen (custref) > 0) && 
-	(g_strncasecmp (custref, "NONREF", 6) != 0))
-      xaccTransSetNum (gnc_trans, custref);
+    HBCI_Transaction_delete(h_trans);
   }
-  
-  /* Description */
-  {
-    char *g_descr = gnc_hbci_descr_tognc (h_trans);
-    xaccTransSetDescription (gnc_trans, g_descr);
-    g_free (g_descr);
+  else if (strcasecmp(GWEN_DB_GroupName(trans_node), "startsaldo")==0) {
+    /*DBG_INFO(0, "Found opening balance");*/
   }
-  
-  /* Notes. */
-  /*xaccTransSetNotes (gnc_trans, g_notes);*/
-  /* But Nobody ever uses the Notes field? */
-
-  /* Add one split */
-  split=xaccMallocSplit(book);
-  xaccTransAppendSplit(gnc_trans, split);
-  xaccAccountInsertSplit(gnc_acc, split);
-
-  {
-    /* Amount into the split */
-    gnc_numeric gnc_amount = double_to_gnc_numeric
-      (HBCI_Value_getValue (HBCI_Transaction_value (h_trans)),
-       xaccAccountGetCommoditySCU(gnc_acc),
-       GNC_RND_ROUND);
-    xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
+  else if (strcasecmp(GWEN_DB_GroupName(trans_node), "endsaldo")==0) {
+    /* Found closing balance */
+    trans_node = GWEN_DB_GetGroup(trans_node,
+				  GWEN_PATH_FLAGS_NAMEMUSTEXIST,
+				  "value");
+    /*if (trans_node) {
+      HBCI_Value *bal;
+      char *val;
+      DBG_INFO(0, "Found closing balance");
+      
+      bal = HBCI_Value_new(GWEN_DB_GetCharValue(trans_node, "value", 0, "0"),
+			   GWEN_DB_GetCharValue(trans_node, "currency", 0, "EUR"));
+      
+      val = HBCI_Value_toReadableString(bal);
+      printf("Got closing balance %s\n", val);
+      
+      free(val);
+      HBCI_Value_delete(bal);
+      }*/
   }
-
-  /* Memo in the Split. */
-  {
-    char *g_memo = gnc_hbci_memo_tognc (h_trans);
-    xaccSplitSetMemo(split, g_memo);
-    g_free (g_memo);
+  else {
+    /*DBG_WARN(0, "Unknown section \"%s\"", GWEN_DB_GroupName(trans_node));*/
   }
-    
-  /* Instead of xaccTransCommitEdit(gnc_trans)  */
-  g_assert (importer_generic);
-  gnc_gen_trans_list_add_trans (importer_generic, gnc_trans);
+  return NULL;
+  
 }

==================================================
Differences for gnc-hbci-gettrans.h (revision 1.1.4.2 -> 1.1.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.h	2003/09/19 05:56:52	1.1.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.h	2004/03/03 23:15:06	1.1.4.3
@@ -24,11 +24,8 @@
 #define GNC_HBCI_GETTRANS_H
 
 #include <gnome.h>
-#include <openhbci/outboxaccjobs.h>
-#include <openhbci/transaction.h>
-
+#include <openhbci2/outboxjob.h>
 #include "Account.h"
-#include "import-main-matcher.h"
 
 /** Start a GetTrans job. */
 void
@@ -39,13 +36,8 @@
 gboolean
 gnc_hbci_gettrans_final(GtkWidget *parent, 
 			Account *gnc_acc, 
-			const HBCI_OutboxJobGetTransactions *trans_job,
+			const HBCI_OutboxJob *trans_job,
 			gboolean run_until_done);
 
-/** Import HBCI transaction into gnucash account using importer_generic
- */
-void gnc_hbci_trans_import(const HBCI_Transaction *h_trans,
-		GNCImportMainMatcher *importer_generic,
-		Account *gnc_acc);
 
 #endif /* GNC_HBCI_GETTRANS_H */

==================================================
Differences for gnc-hbci-kvp.c (revision 1.4.4.2 -> 1.4.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.c	2003/09/19 05:56:53	1.4.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.c	2004/03/03 23:15:06	1.4.4.3
@@ -21,12 +21,14 @@
 \********************************************************************/
 
 #include "gnc-hbci-kvp.h"
+#include <stdio.h>
 
 #define HBCI_KEY "hbci"
 #define HBCI_ACCOUNT_ID "account-id"
 #define HBCI_BANK_CODE "bank-code"
 #define HBCI_COUNTRY_CODE "country-code"
 #define HBCI_TRANS_RETRIEVAL "trans-retrieval"
+#define HBCI_ACCOUNTS "hbci-accounts"
 
 /* Account */
 char *gnc_hbci_get_account_accountid (Account *a)
@@ -119,13 +121,32 @@
   qof_book_kvp_changed (b);
 }
 
+GList *gnc_hbci_get_book_account_list (GNCBook *b)
+{
+  kvp_frame *frame = gnc_hbci_get_book_kvp (b);
+  kvp_value *value = kvp_frame_get_slot (frame, HBCI_ACCOUNTS);
+  return kvp_value_get_glist (value);
+}
+void gnc_hbci_set_book_account_list (GNCBook *b, GList *account_list)
+{
+  kvp_frame *frame = gnc_hbci_get_book_kvp (b);
+  kvp_value *value = kvp_value_new_glist_nc (account_list);
+  kvp_frame_set_slot_nc (frame, HBCI_ACCOUNTS, value);
+  qof_book_kvp_changed (b);
+}
+
 
 /* lowlevel */
 /* getters  for kvp frame in book */
 kvp_frame *gnc_hbci_get_book_kvp (GNCBook *b)
 {
-  kvp_frame *toplevel = gnc_book_get_slots (b);
-  return kvp_frame_get_frame (toplevel, HBCI_KEY);
+  kvp_frame *toplevel = qof_book_get_slots (b);
+  kvp_frame *result = kvp_frame_get_frame (toplevel, HBCI_KEY);
+  if (!result) {
+      result = kvp_frame_new();
+      kvp_frame_add_frame_nc (toplevel, HBCI_KEY, result);
+  }
+  return result;
 }
 
 
@@ -134,5 +155,10 @@
 kvp_frame *gnc_hbci_get_account_kvp (Account *a)
 {
   kvp_frame *toplevel = xaccAccountGetSlots (a);
-  return kvp_frame_get_frame (toplevel, HBCI_KEY);
+  kvp_frame *result = kvp_frame_get_frame (toplevel, HBCI_KEY);
+  if (!result) {
+      result = kvp_frame_new();
+      kvp_frame_add_frame_nc (toplevel, HBCI_KEY, result);
+  }
+  return result;
 }

==================================================
Differences for gnc-hbci-kvp.h (revision 1.5.4.1 -> 1.5.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.h	2003/07/17 08:00:10	1.5.4.1
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.h	2004/03/03 23:15:06	1.5.4.2
@@ -75,6 +75,12 @@
 GList *gnc_hbci_get_book_template_list (GNCBook *b);
 void gnc_hbci_set_book_template_list (GNCBook *b, GList *template_list);
 
+/** Returns a non-copied pointer to the GList of kvp_frames which
+ * eventually are the available HBCI accounts, stored in the given
+ * book. */
+GList *gnc_hbci_get_book_account_list (GNCBook *b);
+void gnc_hbci_set_book_account_list (GNCBook *b, GList *account_list);
+
 /* lowlevel */
 
 /* internal getter for kvp frame in book */

==================================================
Differences for gnc-hbci-transfer.c (revision 1.7.4.2 -> 1.7.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.c	2003/08/08 23:27:52	1.7.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.c	2004/03/03 23:15:06	1.7.4.3
@@ -23,8 +23,8 @@
 #include "config.h"
 #include "gnc-hbci-transfer.h"
 
-#include <openhbci/api.h>
-#include <openhbci/outboxaccjobs.h>
+#include <openhbci2/api.h>
+#include <openhbci2/outboxjob.h>
 
 #include "gnc-ui.h"
 #include "gnc-numeric.h"
@@ -47,20 +47,23 @@
 		    GNC_HBCI_Transtype trans_type)
 {
   HBCI_API *api = NULL;
-  const HBCI_Account *h_acc = NULL;
+  HBCI_Outbox *outbox = NULL;
+  const gnc_HBCI_Account *h_acc = NULL;
   GNCInteractor *interactor = NULL;
   const HBCI_Customer *customer = NULL;
+  GList *hbci_accountlist = NULL;
   
   g_assert(parent);
   g_assert(gnc_acc);
 
   /* Get API */
-  api = gnc_hbci_api_new_currentbook (parent, &interactor);
+  api = gnc_hbci_api_new_currentbook (parent, &interactor, &hbci_accountlist);
   if (api == NULL) {
     printf("gnc_hbci_maketrans: Couldn't get HBCI API. Nothing will happen.\n");
     return;
   }
   g_assert (interactor);
+  outbox = HBCI_Outbox_new();
 
   /* Get HBCI account */
   h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
@@ -69,7 +72,7 @@
     return;
   }
   /*printf("gnc_hbci_maketrans: HBCI account no. %s found.\n",
-    HBCI_Account_accountId (h_acc));*/
+    gnc_HBCI_Account_accountId (h_acc));*/
   
   /* Get the customer that should be doing this job. */
   customer = gnc_hbci_get_first_customer(h_acc);
@@ -116,8 +119,8 @@
 
       {
 	HBCI_OutboxJob *job = 
-	  gnc_hbci_trans_dialog_enqueue(td, api, customer, 
-					(HBCI_Account *)h_acc, trans_type);
+	  gnc_hbci_trans_dialog_enqueue(td, api, outbox, customer, 
+					(gnc_HBCI_Account *)h_acc, trans_type);
       
 	/* HBCI Transaction has been created and enqueued, so now open
 	 * the gnucash transaction dialog and fill in all values. */
@@ -131,7 +134,8 @@
 
 	  /* If the user pressed "execute now", then execute this job
 	     now. This function already delete()s the job. */
-	  successful = gnc_hbci_trans_dialog_execute(td, api, job, interactor);
+	  successful = gnc_hbci_trans_dialog_execute(td, api, outbox, 
+						     job, interactor);
 
 	  if (!successful) {
 	    /* HBCI job failed -- then remove gnc txn from the books. */
@@ -160,7 +164,8 @@
       }*/
 
     /* Just to be on the safe side, clear queue once again. */
-    HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE);
+    HBCI_Outbox_delete(outbox);
     gnc_hbci_api_save (api);
     gnc_hbci_dialog_delete(td);
     gnc_trans_templ_delete_glist (template_list);

==================================================
Differences for gnc-hbci-transfer.h (revision 1.1.4.1 -> 1.1.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.h	2003/07/17 08:00:13	1.1.4.1
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.h	2004/03/03 23:15:06	1.1.4.2
@@ -24,7 +24,7 @@
 #define GNC_HBCI_TRANSFER_H
 
 #include <gnome.h>
-#include <openhbci/transaction.h>
+#include <openhbci2/transaction.h>
 #include "Account.h"
 #include "dialog-hbcitrans.h"
 

==================================================
Differences for gnc-hbci-utils.c (revision 1.23.4.5 -> 1.23.4.6)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c	2004/01/17 02:18:35	1.23.4.5
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c	2004/03/03 23:15:06	1.23.4.6
@@ -25,8 +25,9 @@
 
 #include <gnome.h>
 #include <errno.h>
-#include <openhbci.h>
-#include <openhbci/error.h>
+#include <openhbci2.h>
+#include <openhbci2/error.h>
+#include <gwenhywfar/directory.h>
 
 #include "gnc-ui.h"
 #include "gnc-hbci-kvp.h"
@@ -38,14 +39,25 @@
 
 /* static short module = MOD_IMPORT; */
 
+/* Globale variables for HBCI_API caching. */
+static HBCI_API *gnc_hbci_api = NULL;
+static char *gnc_hbci_configfile = NULL;
+static GNCInteractor *gnc_hbci_inter = NULL;
+static GList *gnc_hbci_accountlist = NULL;
+
+
+/* ------------------------------------------------------------ */
 HBCI_API *
 gnc_hbci_api_new (const char *filename, gboolean allowNewFile,
-		  GtkWidget *parent, GNCInteractor **inter)
+		  GtkWidget *parent, GNCInteractor **inter,
+		  GList **list_accounts)
 {
   HBCI_API *api = NULL;
   HBCI_Error *err = NULL;
   char *errstring;
   
+  g_assert(inter);
+  
   if (!filename)
       return NULL;
   if (!allowNewFile && 
@@ -53,7 +65,7 @@
     {
       /* ENOENT is "No such file or directory" */
       gchar *errstring = g_strdup_printf ("%s: %s", filename, strerror (ENOENT));
-      gnc_warning_dialog 
+      gnc_warning_dialog
 	(parent,
 	 /* Translators: Strings from this file are really only needed
 	  * inside Germany (HBCI is not supported anywhere else). You
@@ -67,11 +79,37 @@
 
   api = HBCI_API_new (FALSE, TRUE);
   
+  {
+    unsigned hbci_major, hbci_minor;
+    HBCI_Error *er;
+    er = HBCI_API_configHbciVersion(filename, &hbci_major, &hbci_minor);
+    if (er) {
+      HBCI_Error_delete(er);
+      /* do nothing else; new file */
+    }
+    else {
+      if ((hbci_major == 0) && (hbci_minor == 9)) {
+	gnc_warning_dialog
+	  (parent,
+	   _(
+"The file %s seems to be from a previous version of OpenHBCI.\n"
+"With the new version of OpenHBCI, you need to run the HBCI Setup \n"
+"Druid again and create a new configuration file before you can work \n"
+"with HBCI. You need to create \n"
+"your User and Customer in the HBCI Setup Druid, but you can \n"
+"directly re-use your existing keyfile or chip card."), filename);
+	HBCI_API_delete (api);
+	return NULL;
+      }
+    }
+  }
+  
+  
   err = HBCI_API_loadEnvironment (api, filename);
   if (!HBCI_Error_isOk (err) && !allowNewFile) {
     errstring = HBCI_Error_errorString (err);
     HBCI_Error_delete (err);
-    gnc_warning_dialog 
+    gnc_warning_dialog
 	(parent,
 	 /* Translators: Strings from this file are really only needed
 	  * inside Germany (HBCI is not supported anywhere else). You
@@ -84,42 +122,72 @@
   }
   HBCI_Error_delete (err);
 
-  if (inter)
-    *inter = gnc_hbci_api_interactors (api, parent);
-  else
-    gnc_hbci_api_interactors (api, parent);
+  *inter = gnc_hbci_api_interactors (api, parent);
+
+  gnc_hbci_accountlist =
+      gnc_HBCI_Account_glist_from_kvp_glist
+      (gnc_hbci_get_book_account_list(gnc_get_current_book ()),
+       api);
+  if (list_accounts)
+    *list_accounts = gnc_hbci_accountlist;
+
+  {
+    /* Well, currently gnucash doesn't offer a way to uniformly ask
+       for the ~/.gnucash directory, so we have to generate that path
+       here by hand. */
+    gchar *homebuffer;
+    gchar *databuffer;
+
+    /* Get home directory */
+    gnc_init_default_directory(&homebuffer);
+
+    /* Join it with the directory name */
+    databuffer = g_strjoin("", homebuffer, "/.gnucash/hbci");
+
+    /*fprintf(stderr, "Setting log dir to %s\n", databuffer);*/
+    HBCI_Hbci_setApplicationDataDir(HBCI_API_Hbci(api), databuffer);
+
+    g_free(databuffer);
+    g_free(homebuffer);
+  }
 
   return api;
 }
 
-static HBCI_API *gnc_hbci_api = NULL;
-static char *gnc_hbci_configfile = NULL;
-static GNCInteractor *gnc_hbci_inter = NULL;
-
 HBCI_API * gnc_hbci_api_new_currentbook (GtkWidget *parent, 
-					 GNCInteractor **inter)
+					 GNCInteractor **inter,
+					 GList **list_accounts)
 {
   if (gnc_hbci_api == NULL) {
     /* No API cached -- create new one. */
     gnc_hbci_configfile = 
       g_strdup (gnc_hbci_get_book_configfile (gnc_get_current_book ()));
     gnc_hbci_api = gnc_hbci_api_new (gnc_hbci_configfile, 
-				     FALSE, parent, inter);
-    gnc_hbci_inter = *inter;
+				     FALSE, parent, &gnc_hbci_inter, 
+				     list_accounts);
+    if (inter)
+      *inter = gnc_hbci_inter;
+
     return gnc_hbci_api;
+
   } else if ((gnc_hbci_configfile != NULL) && 
 	     (strcmp(gnc_hbci_configfile, 
 		     gnc_hbci_get_book_configfile (gnc_get_current_book ()))
-	     != 0)) {
+	      != 0)) {
     /* Wrong API cached -- delete old and create new. */
     gnc_hbci_api_delete (gnc_hbci_api);
     fprintf(stderr,
 	    "gnc_hbci_api_new_currentbook: Wrong HBCI_API cached; creating new one.\n");
-    return gnc_hbci_api_new_currentbook (parent, inter);
+    return gnc_hbci_api_new_currentbook (parent, inter, list_accounts);
   } else {
     /* Correct API cached. */
-    *inter = gnc_hbci_inter;
-    GNCInteractor_reparent (*inter, parent);
+    if (inter) {
+      *inter = gnc_hbci_inter;
+      GNCInteractor_reparent (*inter, parent);
+    }
+    if (list_accounts)
+      *list_accounts = gnc_hbci_accountlist;
+    
     return gnc_hbci_api;
   }
 }
@@ -131,6 +199,8 @@
     gnc_hbci_inter = NULL;
     g_free (gnc_hbci_configfile);
     gnc_hbci_configfile = NULL;
+    list_HBCI_Account_delete (gnc_hbci_accountlist);
+    gnc_hbci_accountlist = NULL;
   }
   HBCI_API_delete (api);
 }
@@ -142,40 +212,39 @@
   if ((file == NULL) || (strlen (file) == 0)) 
     return HBCI_Error_new ("gnc_hbci_api_save", ERROR_LEVEL_NORMAL, 0, 
 			   ERROR_ADVISE_ABORT, 
-			   "No filename for config file.", "");
+			   "No filename for config file in gnc_book.", "");
   
   return HBCI_API_saveEnvironment (api, file);
 }
 
 
 
-const HBCI_Account *
+const gnc_HBCI_Account *
 gnc_hbci_get_hbci_acc (const HBCI_API *api, Account *gnc_acc) 
 {
   const char *bankcode = NULL, *accountid = NULL;
   int countrycode = 0;
-  const HBCI_Bank *bank = NULL;
-  const HBCI_Account *hbci_acc = NULL;
+  const HBCI_Bank *bank;
+  gnc_HBCI_Account *hbci_acc = NULL;
 
   bankcode = gnc_hbci_get_account_bankcode (gnc_acc);
   countrycode = gnc_hbci_get_account_countrycode (gnc_acc);
   if (bankcode && (strlen(bankcode)>0) && (countrycode > 0)) {
-    /*printf("gnc_acc %s has blz %s and ccode %d\n",
+    /*printf("gnc_hbci_get_hbci_acc: gnc_acc %s has blz %s and ccode %d\n",
       xaccAccountGetName (gnc_acc), bankcode, countrycode);*/
     bank = HBCI_API_findBank (api, countrycode, bankcode);
     if (bank) {
       accountid = gnc_hbci_get_account_accountid (gnc_acc);
+      /*printf("gnc_hbci_get_hbci_acc: gnc_acc %s found blz %s and ccode %d and accountid %s, bank %p\n",
+	xaccAccountGetName (gnc_acc), bankcode, countrycode, accountid, bank);*/
       if (accountid && (strlen(accountid)>0)) {
-	hbci_acc = HBCI_Bank_findAccount (bank, accountid);
-	if (hbci_acc) {
-	  /*printf("can connect gnc_acc %s to hbci_acc %s\n",
-	    xaccAccountGetName (gnc_acc), 
-	    HBCI_Account_accountId (hbci_acc));*/
-	  return hbci_acc;
-	} /* hbci_acc */
-      } /* accountid */
-    } /* bank */
-  } /* bankcode */
+	hbci_acc = list_HBCI_Account_find(gnc_hbci_accountlist, 
+					  bank, bankcode, accountid);
+	/*printf("gnc_hbci_get_hbci_acc: return HBCI_Account %p\n", hbci_acc);*/
+	return hbci_acc;
+      }
+    }
+  }
   return NULL;
 }
 
@@ -304,39 +373,39 @@
   case HBCI_ERROR_CODE_PIN_WRONG:
     GNCInteractor_erasePIN (inter);
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("The PIN you entered was wrong.\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("The PIN you entered was wrong.\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_PIN_WRONG_0:
     GNCInteractor_erasePIN (inter);
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("The PIN you entered was wrong.\n"
-				"ATTENTION: You have zero further wrong retries left!\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("The PIN you entered was wrong.\n"
+					 "ATTENTION: You have zero further wrong retries left!\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_PIN_WRONG_1:
     GNCInteractor_erasePIN (inter);
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("The PIN you entered was wrong.\n"
-				"You have one further wrong retry left.\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("The PIN you entered was wrong.\n"
+					 "You have one further wrong retry left.\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_PIN_WRONG_2:
     GNCInteractor_erasePIN (inter);
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("The PIN you entered was wrong.\n"
-				"You have two further wrong retries left.\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("The PIN you entered was wrong.\n"
+					 "You have two further wrong retries left.\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_PIN_ABORTED:
     /*     printf("gnc_hbci_error_feedback: PIN dialog was aborted.\n"); */
     return FALSE;
   case HBCI_ERROR_CODE_PIN_TOO_SHORT:
     GNCInteractor_erasePIN (inter);
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("The PIN you entered was too short.\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("The PIN you entered was too short.\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_CARD_DESTROYED:
     GNCInteractor_hide (inter);
     gnc_error_dialog
@@ -349,12 +418,12 @@
     return FALSE;
   case HBCI_ERROR_CODE_NO_CARD:
     return gnc_verify_dialog (parent,
-			      TRUE,
-			      _("No chip card has been found in the chip card reader.\n"
-				"Do you want to try again?"));
+				       TRUE,
+				       _("No chip card has been found in the chip card reader.\n"
+					 "Do you want to try again?"));
   case HBCI_ERROR_CODE_JOB_NOT_SUPPORTED:
     GNCInteractor_hide (inter);
-    gnc_error_dialog
+    gnc_error_dialog 
       (parent,
        _("Unfortunately this HBCI job is not supported \n"
 	 "by your bank or for your account. Aborting."));
@@ -389,8 +458,60 @@
   
 }
 
+/* Prints all results that can be found in the outbox into the interactor */
+static void gnc_hbci_printresult(HBCI_Outbox *outbox, GNCInteractor *inter)
+{
+  /* Got no sysid. */
+  GWEN_DB_NODE *rsp, *n;
+  g_assert(outbox);
+  if (!inter) 
+    return;
+  
+  rsp = HBCI_Outbox_response(outbox);
+  n = GWEN_DB_GetFirstGroup(rsp);
+  while(n) {
+    if (strcasecmp(GWEN_DB_GroupName(n), "msgresult")==0) {
+      GWEN_DB_NODE *r = GWEN_DB_GetFirstGroup(n);
+      while (r) {
+	if (strcasecmp(GWEN_DB_GroupName(r), "result") == 0) {
+	  gchar *logtext;
+	  int resultcode;
+	  const char *text, *elementref, *param;
+	  
+	  resultcode = GWEN_DB_GetIntValue(r, "resultcode", 0, 0);
+	  text = GWEN_DB_GetCharValue(r, "text", 0, "Response without text");
+	  elementref = GWEN_DB_GetCharValue(r, "elementref", 0, "");
+	  param = GWEN_DB_GetCharValue(r, "param", 0, "");
+
+	  if (strlen(elementref)>0 || strlen(param) > 0)
+	    logtext = g_strdup_printf("%s (%d; Elementref %s; Param %s)", text, 
+				      resultcode, elementref, param);
+	  else
+	    logtext = g_strdup_printf("%s (%d)", text, resultcode);
+	  GNCInteractor_add_log_text(inter, logtext);
+	  g_free(logtext);
+	}
+	r = GWEN_DB_GetNextGroup(r);
+      }
+    } 
+    else if (strcasecmp(GWEN_DB_GroupName(n), "segresult")==0) {
+      GWEN_DB_NODE *r = GWEN_DB_GetFirstGroup(n);
+      while (r) {
+	if (strcasecmp(GWEN_DB_GroupName(r), "result") == 0) {
+	}
+	r = GWEN_DB_GetNextGroup(r);
+      }
+    } 
+    n=GWEN_DB_GetNextGroup(n);
+  } // while
+
+  GWEN_DB_Group_free(rsp);
+}
+
+
 gboolean
 gnc_hbci_api_execute (GtkWidget *parent, HBCI_API *api,
+		      HBCI_Outbox *queue,
 		      HBCI_OutboxJob *job, GNCInteractor *inter)
 {
   HBCI_Error *err;
@@ -400,14 +521,22 @@
     GNCInteractor_show (inter);
 
   if (gnc_lookup_boolean_option("_+Advanced", 
-				"HBCI Verbose Debug Messages", FALSE))
+				"HBCI Verbose Debug Messages", FALSE)) {
+    GWEN_Logger_SetLevel(0, GWEN_LoggerLevelDebug);
     HBCI_Hbci_setDebugLevel (4);
+  }
   else
     HBCI_Hbci_setDebugLevel (0);
 
   do {
-    err = HBCI_API_executeQueue (api, TRUE);
+    if (inter)
+      GNCInteractor_show_nodelete (inter);
+    err = HBCI_API_executeQueue (api, queue);
     g_assert (err);
+
+    /* Print result codes to interactor */
+    gnc_hbci_printresult(queue, inter);
+    
   } while (gnc_hbci_error_retry (parent, err, inter));
   
   resultcode = gnc_hbci_debug_outboxjob (job, FALSE);
@@ -508,31 +637,25 @@
 {
   /* Memo in the Split. HBCI's transactionText contains strings like
    * "STANDING ORDER", "UEBERWEISUNGSGUTSCHRIFT", etc.  */
-  char *h_transactionText = 
-    g_strdup (HBCI_Transaction_transactionText (h_trans));
+  /*   char *h_transactionText =  */
+  /*     g_strdup (HBCI_Transaction_transactionText (h_trans)); */
   char *h_otherAccountId =
     g_strdup (HBCI_Transaction_otherAccountId (h_trans));
   char *h_otherBankCode =
     g_strdup (HBCI_Transaction_otherBankCode (h_trans));
   char *g_memo;
 
-  g_strstrip (h_transactionText);
+  /*   g_strstrip (h_transactionText); */
   g_strstrip (h_otherAccountId);
   g_strstrip (h_otherBankCode);
 
   g_memo = 
-    (h_transactionText && (strlen(h_transactionText) > 0) ?
-     g_strdup_printf ("%s %s %s %s %s",
-		      h_transactionText,
+    (h_otherAccountId && (strlen (h_otherAccountId) > 0) ?
+     g_strdup_printf ("%s %s %s %s",
 		      _("Account"), h_otherAccountId,
 		      _("Bank"), h_otherBankCode) :
-     (h_otherAccountId && (strlen (h_otherAccountId) > 0) ?
-      g_strdup_printf ("%s %s %s %s",
-		       _("Account"), h_otherAccountId,
-		       _("Bank"), h_otherBankCode) :
-      g_strdup ("")));
+     g_strdup (""));
     
-  g_free (h_transactionText);
   g_free (h_otherAccountId);
   g_free (h_otherBankCode);
   return g_memo;
@@ -542,14 +665,20 @@
 /** Return the only customer that can act on the specified account, or
     NULL if none was found. */
 const HBCI_Customer *
-gnc_hbci_get_first_customer(const HBCI_Account *h_acc)
+gnc_hbci_get_first_customer(const gnc_HBCI_Account *h_acc)
 {
   /* Get one customer. */
-  const list_HBCI_Customer *custlist;
-    
-  custlist = HBCI_Account_authorizedCustomers (h_acc);
-  g_assert (custlist);
-  return choose_one_customer(gnc_ui_get_toplevel (), custlist);
+  const list_HBCI_User *userlist;
+  const HBCI_Bank *bank;
+  const HBCI_User *user;
+  g_assert(h_acc);
+  
+  bank = gnc_HBCI_Account_bank (h_acc);
+  userlist = HBCI_Bank_users (bank);
+  g_assert (userlist);
+  user = choose_one_user(gnc_ui_get_toplevel (), userlist);
+  g_assert (user);
+  return choose_one_customer(gnc_ui_get_toplevel (), HBCI_User_customers (user));
 }
 
 const char *bank_to_str (const HBCI_Bank *bank)
@@ -676,7 +805,7 @@
 			 * is the name of the bank. %s is the bank
 			 * code. */
 			g_strdup_printf (_("%s (%s) at bank %s (%s)"),
-					 HBCI_Customer_custName (customer),
+					 HBCI_Customer_name (customer),
 					 HBCI_Customer_custId (customer),
 					 bank_to_str (HBCI_User_bank(HBCI_Customer_user(customer))),
 					 HBCI_Bank_bankCode (HBCI_User_bank(HBCI_Customer_user(customer)))));
@@ -752,7 +881,7 @@
 	radio_list = g_list_append
 	    (radio_list, 
 	     g_strdup_printf (_("%s (%s) at bank %s (%s)"),
-			      HBCI_User_userName (user),
+			      HBCI_User_name (user),
 			      HBCI_User_userId (user),
 			      bank_to_str (HBCI_User_bank(user)),
 			      HBCI_Bank_bankCode (HBCI_User_bank(user))));

==================================================
Differences for gnc-hbci-utils.h (revision 1.12.4.2 -> 1.12.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.h	2003/10/25 06:48:01	1.12.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.h	2004/03/03 23:15:06	1.12.4.3
@@ -25,14 +25,17 @@
 
 #include <glib.h>
 #include <gnome.h>
-#include <openhbci/account.h>
-#include <openhbci/api.h>
+/*#include <openhbci2/account.h>*/
+#include <openhbci2/api.h>
+#include <openhbci2/transaction.h>
 #include "gnc-ui.h"
 #include "Account.h"
 #include "Transaction.h"
 #include "gnc-book.h"
 
 #include "hbci-interaction.h"
+#include "gnc-hbci-account.h"
+
 
 /** Create a new HBCI_API and let it load its environment from the
  * configuration file filename. If the file doesn't exist and
@@ -49,7 +52,8 @@
 HBCI_API * gnc_hbci_api_new (const char *filename, 
 			     gboolean allowNewFile, 
 			     GtkWidget *parent,
-			     GNCInteractor **inter);
+			     GNCInteractor **inter,
+			     GList **list_accounts);
 
 /** Same as above, but takes the filename already from the current
  * book's kvp frame AND caches a pointer to the api. Returns NULL if
@@ -61,7 +65,8 @@
  * May be NULL.
  */ 
 HBCI_API * gnc_hbci_api_new_currentbook (GtkWidget *parent,
-					 GNCInteractor **inter);
+					 GNCInteractor **inter,
+					 GList **list_accounts);
 
 /** Delete the given HBCI_API. If this is also the one that was cached
     by gnc_hbci_api_new_currentbook, then that reference is deleted, too. */
@@ -77,14 +82,13 @@
 /* Get the corresponding HBCI account to a gnucash account. Of course
  * this only works after the gnucash account has been set up for HBCI
  * use, i.e. the kvp_frame "hbci/..." have been filled with
- * information. Returns NULL if no HBCI_Account was found.
+ * information. Returns NULL if no gnc_HBCI_Account was found.
  *
- * @param api The HBCI_API to get the HBCI_Account from.
- * @param gnc_acc The gnucash account to query for HBCI_Account reference data. */
-const HBCI_Account *
+ * @param api The HBCI_API to get the gnc_HBCI_Account from.
+ * @param gnc_acc The gnucash account to query for gnc_HBCI_Account reference data. */
+const gnc_HBCI_Account *
 gnc_hbci_get_hbci_acc (const HBCI_API *api, Account *gnc_acc);
 
-
 /* Return the HBCI return code of the given 'job', or zero if none was
  * found. If 'verbose' is TRUE, make a lot of debugging messages about
  * this outboxjob. */
@@ -105,6 +109,7 @@
  * should abort. */
 gboolean
 gnc_hbci_api_execute (GtkWidget *parent, HBCI_API *api,
+		      HBCI_Outbox *queue,
 		      HBCI_OutboxJob *job, GNCInteractor *inter);
 
 
@@ -122,7 +127,7 @@
     or NULL if none was found (and an error message is printed on
     stdout). */
 const HBCI_Customer *
-gnc_hbci_get_first_customer(const HBCI_Account *h_acc);
+gnc_hbci_get_first_customer(const gnc_HBCI_Account *h_acc);
 
 /** Returns the name of this bank. This function is helpful because it
  * always makes sure to return a valid const char pointer, even if no

==================================================
Differences for hbci-interaction.c (revision 1.16.4.7 -> 1.16.4.8)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.c	2004/01/17 02:18:37	1.16.4.7
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.c	2004/03/03 23:15:06	1.16.4.8
@@ -28,8 +28,7 @@
 #include "hbci-interaction.h"
 #include "hbci-interactionP.h"
 
-#include <openhbci/interactorcb.h>
-#include <openhbci/progressmonitorcb.h>
+#include <openhbci2/interactorcb.h>
 #include "dialog-utils.h"
 #include "druid-utils.h"
 #include "gnc-ui-util.h"
@@ -39,14 +38,12 @@
 #include "dialog-pass.h"
 #include "gnc-hbci-utils.h"
 
-#include <openhbci.h>
-#ifndef OPENHBCI_VERSION_BUILD
-#  define OPENHBCI_VERSION_BUILD 0
-#endif
+#include <openhbci2.h>
 
 #define PREF_TAB_ONLINE_BANKING N_("Online Banking & Importing")
 
 
+
 /** Adds the interactor and progressmonitor classes to the api. */
 GNCInteractor *gnc_hbci_api_interactors (HBCI_API *api, GtkWidget *parent)
 {
@@ -64,11 +61,48 @@
   /* set HBCI_Interactor */
   HBCI_Hbci_setInteractor(HBCI_API_Hbci(api), 
 			  gnc_hbci_new_interactor(data), TRUE);
-  /* Set HBCI_Progressmonitor */
-  HBCI_API_setMonitor(api, gnc_hbci_new_pmonitor(data), TRUE);
   return data;
 }
 
+
+
+/* ************************************************************
+ */
+
+
+GtkWidget *GNCInteractor_parent(GNCInteractor *i)
+{
+  g_assert(i);
+  return i->parent;
+}
+
+static void GNCInteractor_setRunning (GNCInteractor *data)
+{
+  g_assert(data);
+  data->state = RUNNING;
+  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), TRUE);
+  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), FALSE);
+}
+static void GNCInteractor_setFinished (GNCInteractor *data)
+{
+  g_assert(data);
+  data->state = FINISHED;
+  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
+  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), TRUE);
+  if (gtk_toggle_button_get_active
+      (GTK_TOGGLE_BUTTON (data->close_checkbutton)))
+    GNCInteractor_hide (data);
+}
+static void GNCInteractor_setAborted (GNCInteractor *data)
+{
+  g_assert(data);
+  data->state = ABORTED;
+  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
+  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), TRUE);
+  data->keepAlive = FALSE;
+}
+
+
 gboolean GNCInteractor_aborted(const GNCInteractor *i)
 {
   g_assert(i);
@@ -160,6 +194,15 @@
 /********************************************************
  * Now all the callback functions 
  */
+static const char *username_from_user(const HBCI_User *user)
+{
+  return (user ? 
+	  (HBCI_User_name (user) ? HBCI_User_name (user) :
+	   (HBCI_User_userId (user) ? HBCI_User_userId (user) :
+	    _("Unknown"))) :
+	  _("Newly created user"));
+}
+
 static int msgInputPin(const HBCI_User *user,
 		       char **pinbuf,
 		       int minsize,
@@ -173,13 +216,7 @@
   g_assert(data);
 
   while (TRUE) {
-    const char *username;
-    username =
-      (user ?
-       (strlen (HBCI_User_userName (user)) > 0 ? HBCI_User_userName (user) :
-	(HBCI_User_userId (user) ? HBCI_User_userId (user) :
-	 _("Unknown"))) : 
-       _("Unknown"));
+    const char *username = username_from_user(user);
     g_assert (username);
     
     if (newPin) {
@@ -262,7 +299,9 @@
 	g_strdup_printf (  _("The PIN needs to be at least %d characters \n"
 			     "long. Do you want to try again?"),
 			   minsize);
-      retval = gnc_verify_dialog (data->parent, TRUE, msg);
+      retval = gnc_verify_dialog (GTK_WIDGET (data->parent), 
+					   TRUE,
+					   msg);
       g_free (msg);
       if (!retval)
 	break;
@@ -298,10 +337,7 @@
   g_assert(data);
 
   if (user != NULL) {
-    const char *username = 
-      (HBCI_User_userName (user) ? HBCI_User_userName (user) :
-       (HBCI_User_userId (user) ? HBCI_User_userId (user) :
-	_("Unknown")));
+    const char *username = username_from_user(user);
     b = HBCI_User_bank (user);
     switch (mtype) 
       {
@@ -354,7 +390,9 @@
 			      "the newly created user."));
       }
     
-  retval = gnc_ok_cancel_dialog (data->parent, GTK_RESPONSE_OK, "%s", msgstr);
+  retval = gnc_ok_cancel_dialog (data->parent,
+					  GTK_RESPONSE_OK, 
+					  "%s", msgstr);
   g_free (msgstr);
   
   return (retval == GTK_RESPONSE_OK);
@@ -372,10 +410,7 @@
   g_assert(data);
 
   if (user != NULL) {
-    const char *username = 
-      (HBCI_User_userName (user) ? HBCI_User_userName (user) :
-       (HBCI_User_userId (user) ? HBCI_User_userId (user) :
-	_("Unknown")));
+    const char *username = username_from_user(user);
     b = HBCI_User_bank (user);
     switch (mtype) 
       {
@@ -421,23 +456,23 @@
 			      "the newly created user."));
       }
   
-  retval = gnc_ok_cancel_dialog (data->parent, GTK_RESPONSE_OK, "%s", msgstr);
+  retval = gnc_ok_cancel_dialog (data->parent,
+					  GTK_RESPONSE_OK,
+					  "%s", msgstr);
   g_free (msgstr);
   
   return (retval == GTK_RESPONSE_OK);
 }
 
 
-static void msgStateResponse(const char *msg, void *user_data)
+/*static void msgStateResponse(const char *msg, void *user_data)
 {
   GNCInteractor *data = user_data;
   g_assert(data);
 
-  add_log_text (data, msg);
-  /*fprintf(stdout,"hbci-initial-druid-msgStateResponse: %s\n",msg);*/
-  /* Let the widgets be redrawn */
+  GNCInteractor_add_log_text (data, msg);
   while (g_main_iteration (FALSE));
-}
+  }*/
 
 static int keepAlive(void *user_data)
 {
@@ -492,10 +527,7 @@
 
   /* Create message string */
   if (user != NULL) {
-    const char *username = 
-      (HBCI_User_userName (user) ? HBCI_User_userName (user) :
-       (HBCI_User_userId (user) ? HBCI_User_userId (user) :
-	_("Unknown")));
+    const char *username = username_from_user(user);
     bank = HBCI_User_bank (user);
     if (bank != NULL) {
       /* xgettext:c-format */	    
@@ -527,6 +559,184 @@
   g_free (msgstr);
 }
 
+/* ************************************************************ 
+ */
+
+int debug_pmonitor = FALSE;
+
+
+/* old ProgressMonitor callbacks
+ */
+
+static void actStarted (ActionProgressType type, void *user_data)
+{
+  GNCInteractor *data = user_data;
+  const char *msg = NULL;
+  g_assert(data);
+  switch (type) {
+    /** Creating HBCI job. Number of Job will follow in string argument. */
+  case ACT_FILLINGQUEUE:
+    msg = _("Creating HBCI Job");
+    break;
+    /** Contacting server. Server IP address will follow in string argument. */
+  case ACT_CONTACTINGSERVER:
+    msg = _("Contacting Server");
+    break;
+    /** Checking Job result. */
+  case ACT_CHKRESULT:
+    msg = _("Checking Job result");
+    break;
+    /** Updating local system. */
+  case ACT_UPDATESYSTEM:
+    msg = _("Updating local system");
+    break;
+    /** Closing connection. */
+  case ACT_CLOSECONNECTION:
+    msg = _("Closing connection");
+    break;
+  case ACT_OPENSESSION:
+    msg = _("Open session");
+    break;
+  case ACT_CLOSESESSION:
+    msg = _("Close session");
+    break;
+  case ACT_OPENDIALOG:
+    msg = _("Open dialog");
+    break;
+  case ACT_CLOSEDIALOG:
+    msg = _("Close dialog");
+    break;
+  case ACT_PROCESSMSG:
+    msg = _("Process message");
+    break;
+  case ACT_CREATEJOB:
+    msg = _("Create job");
+    break;
+  case ACT_HANDLEJOBS:
+    msg = _("Handle jobs");
+    break;
+  case ACT_SIGNMSG:
+    msg = _("Sign message");
+    break;
+  case ACT_ENCRYPTMSG:
+    msg = _("Encrypt message");
+    break;
+  case ACT_VERIFYMSG:
+    msg = _("Verify message");
+    break;
+  case ACT_DECRYPTMSG:
+    msg = _("Decrypt message");
+    break;
+  case ACT_ENCODEMSG:
+    msg = _("Encode message");
+    break;
+  case ACT_DECODEMSG:
+    msg = _("Decode message");
+    break;
+    /** Sending message. */
+  case ACT_SENDINGMESSAGE:
+    /* Note: the ACT_SENDINGMESSAGE doesn't seem to be used. */
+  case ACT_LOW_SENDMSG:
+    msg = _("Sending message");
+    break;
+  case ACT_LOW_RECEIVEMSG:
+    msg = _("Receiving message");
+    break;
+    /*default:
+      msg = _("Unknown");
+      break;*/
+  }
+  
+  g_assert(msg);
+  gtk_entry_set_text (GTK_ENTRY (data->action_entry), msg);
+  /* Let the widgets be redrawn */
+  while (g_main_iteration (FALSE));
+  if (debug_pmonitor)
+    printf("actStarted-cb: current_job %d, jobs %d, current_act %d, actions %d, msg %s.\n", 
+	   data->current_job, data->jobs, data->current_act, data->actions, msg);
+
+  GNCInteractor_setRunning (data);
+ 
+  /* Let the widgets be redrawn */
+  while (g_main_iteration (FALSE));
+}
+
+static void closeConnection(TransportType t, void *user_data)
+{
+  GNCInteractor *data = user_data;
+  g_assert(data);
+  data->current_act++;
+  gtk_entry_set_text (GTK_ENTRY (data->action_entry), _("Done"));
+  /*gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 
+    1.0);*/
+
+  if (debug_pmonitor)
+    printf("actFinished-cb: current_job %d, jobs %d, current_act %d, actions %d.\n", 
+	   data->current_job, data->jobs, data->current_act, data->actions);
+  /*if (data->current_act > data->actions) {
+    printf("actFinished-cb: oops, current_act==%d is > than actions==%d.\n",
+    data->current_act, data->actions);
+    }*/
+  
+  GNCInteractor_setFinished (data);
+ 
+  while (g_main_iteration (FALSE));
+}
+static void logMsg (const char *msg, void *user_data)
+{
+  /* Note: this isn't used anyway. */
+  GNCInteractor *data = user_data;
+  g_assert(data);
+  
+  printf("logMsg: Logging msg: %s\n", msg);
+  GNCInteractor_add_log_text (data, msg);
+			    
+  /* Let the widgets be redrawn */
+  while (g_main_iteration (FALSE));
+}
+
+void GNCInteractor_add_log_text (GNCInteractor *data, const char *msg)
+{
+  int pos;
+  g_assert(data);
+
+  //
+  // DRH - Fix me. This is a GtkTextView now, not a GtkText. These
+  // casts to an editable will fail at runtime.
+  //
+  //  pos = gtk_text_get_length (GTK_TEXT (data->log_text));
+  gtk_editable_insert_text (GTK_EDITABLE (data->log_text),
+			    msg, strlen (msg),
+			    &pos);
+  gtk_editable_insert_text (GTK_EDITABLE (data->log_text),
+			    "\n", 1,
+			    &pos);
+}
+
+static void
+on_button_clicked (GtkButton *button,
+		   gpointer user_data)
+{
+  GNCInteractor *data = user_data;
+  const char *name;
+  g_assert(data);
+  
+  name = gtk_widget_get_name (GTK_WIDGET (button));
+  if (strcmp (name, "abort_button") == 0) {
+    GNCInteractor_setAborted(data);
+  } else if (strcmp (name, "close_button") == 0) {
+    if (data->state != RUNNING) {
+      gtk_widget_hide_all (data->dialog); 
+      /*data->dont_hide = FALSE;*/
+      /*GNCInteractor_hide (data);*/
+    }
+  } else {
+    printf("on_button_clicked: Oops, unknown button: %s\n",
+	   name);
+  }
+  /* Let the widgets be redrawn */
+  while (g_main_iteration (FALSE));
+}
 
 
 /********************************************************
@@ -536,15 +746,55 @@
 gnc_hbci_new_interactor(GNCInteractor *data)
 {
   HBCI_InteractorCB *inter;
+  GtkWidget *dialog;
+  GladeXML *xml;
 
-  inter = HBCI_InteractorCB_new2(&destr,
+  /* Create the progress dialog window */
+  xml = gnc_glade_xml_new ("hbci.glade", "HBCI_connection_dialog");
+
+  g_assert ((dialog = glade_xml_get_widget (xml, "HBCI_connection_dialog")) != NULL);
+  data->dialog = dialog;
+  g_assert ((data->job_entry = glade_xml_get_widget (xml, "job_entry")) != NULL);
+  g_assert ((data->action_entry = glade_xml_get_widget (xml, "action_entry")) != NULL);
+  g_assert ((data->action_progress = 
+	     glade_xml_get_widget (xml, "action_progress")) != NULL);
+  g_assert ((data->log_text = glade_xml_get_widget (xml, "log_text")) != NULL);
+  g_assert ((data->abort_button = glade_xml_get_widget (xml, "abort_button")) != NULL);
+  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
+  g_assert ((data->close_button = glade_xml_get_widget (xml, "close_button")) != NULL);
+  g_assert ((data->close_checkbutton = 
+	     glade_xml_get_widget (xml, "close_checkbutton")) != NULL);
+
+  /* grey out the progress bar -- its unused at the moment */
+  gtk_widget_set_sensitive (data->action_progress, FALSE);
+  gtk_toggle_button_set_active 
+    (GTK_TOGGLE_BUTTON (data->close_checkbutton), 
+     gnc_lookup_boolean_option("__gui", "hbci_close_on_finish", TRUE));
+
+  gtk_signal_connect (GTK_OBJECT (data->abort_button), "clicked", 
+		      GTK_SIGNAL_FUNC (on_button_clicked), data);
+  gtk_signal_connect (GTK_OBJECT (data->close_button), "clicked", 
+		      GTK_SIGNAL_FUNC (on_button_clicked), data);
+
+  if (data->parent)
+    gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (data->parent));
+  /*gtk_widget_set_parent (GTK_WIDGET (dialog), data->parent);*/
+
+  gtk_object_ref (GTK_OBJECT (dialog));
+  gtk_widget_hide_all (dialog);
+
+
+  inter = HBCI_InteractorCB_new4(&destr,
 				 &msgInputPin,
 				 &msgInsertMediumOrAbort,
 				 &msgInsertCorrectMediumOrAbort,
-				 &msgStateResponse,
 				 &keepAlive,
 				 &msgStartInputPinViaKeypadCB,
 				 &msgEndInputPinViaKeypadCB,
+				 NULL,
+				 &closeConnection,
+				 &actStarted,
+				 &logMsg,
 				 data);
 
   return HBCI_InteractorCB_Interactor(inter);

==================================================
Differences for hbci-interaction.h (revision 1.6.4.2 -> 1.6.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.h	2004/01/17 02:18:38	1.6.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.h	2004/03/03 23:15:06	1.6.4.3
@@ -23,7 +23,7 @@
 #ifndef HBCI_INTERACTION_H
 #define HBCI_INTERACTION_H
 
-#include <openhbci/api.h>
+#include <openhbci2/api.h>
 #include <gnome.h>
 
 typedef struct _inter_data GNCInteractor;
@@ -39,6 +39,8 @@
 void GNCInteractor_erasePIN(GNCInteractor *i);
 void GNCInteractor_reparent (GNCInteractor *i, GtkWidget *new_parent);
 void GNCInteractor_set_cache_valid(GNCInteractor *i, gboolean value);
+GtkWidget *GNCInteractor_parent(GNCInteractor *i);
+void GNCInteractor_add_log_text (GNCInteractor *i, const char *msg);
 
 
 #endif

==================================================
Differences for hbci-interactionP.h (revision 1.4.4.2 -> 1.4.4.3)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interactionP.h	2004/01/17 02:18:38	1.4.4.2
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interactionP.h	2004/03/03 23:15:06	1.4.4.3
@@ -24,8 +24,7 @@
 #ifndef HBCI_INTERACTIONP_H
 #define HBCI_INTERACTIONP_H
 
-#include <openhbci/interactor.h>
-#include <openhbci/progressmonitor.h>
+#include <openhbci2/interactor.h>
 #include <gnome.h>
 
 
@@ -83,14 +82,7 @@
 
 void delete_GNCInteractor (GNCInteractor *data);
 
-HBCI_ProgressMonitor *
-gnc_hbci_new_pmonitor(GNCInteractor *data);
-
 HBCI_Interactor *
 gnc_hbci_new_interactor(GNCInteractor *data);
 
-void add_log_text (GNCInteractor *data, const char *msg);
-
-
-
 #endif

==================================================
Differences for hbci-progressmon.c (revision 1.10.4.4 -> 1.10.4.5)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-progressmon.c	2003/07/17 08:00:24	1.10.4.4
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-progressmon.c	2004/03/03 23:15:06	1.10.4.5
@@ -26,370 +26,12 @@
 #include "hbci-interaction.h"
 #include "hbci-interactionP.h"
 
-#include <openhbci/interactorcb.h>
-#include <openhbci/progressmonitorcb.h>
-#include <openhbci.h>
+#include <openhbci2/interactorcb.h>
+#include <openhbci2.h>
 #include "dialog-utils.h"
 #include "druid-utils.h"
 #include "gnc-ui-util.h"
 #include "gnc-ui.h"
 #include "global-options.h"
 
-int debug_pmonitor = FALSE;
-
-
-static void GNCInteractor_setRunning (GNCInteractor *data)
-{
-  g_assert(data);
-  data->state = RUNNING;
-  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), TRUE);
-  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), FALSE);
-}
-static void GNCInteractor_setFinished (GNCInteractor *data)
-{
-  g_assert(data);
-  data->state = FINISHED;
-  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
-  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), TRUE);
-  if (gtk_toggle_button_get_active
-      (GTK_TOGGLE_BUTTON (data->close_checkbutton)))
-    GNCInteractor_hide (data);
-}
-static void GNCInteractor_setAborted (GNCInteractor *data)
-{
-  g_assert(data);
-  data->state = ABORTED;
-  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
-  gtk_widget_set_sensitive (GTK_WIDGET (data->close_button), TRUE);
-  data->keepAlive = FALSE;
-}
-
-
-/*******************************************************************
- * now the callbacks
- */
-static void transStarted (TransProgressType type,
-			  int jobs, void *user_data)
-{
-  GNCInteractor *data = user_data;
-  g_assert(data);
-  
-  GNCInteractor_setRunning (data);
-
-  /*printf("Executing %d jobs.\n",jobs);*/
-  data->jobs = jobs;
-  data->current_job = 0;
-
-  gtk_entry_set_text (GTK_ENTRY (data->job_entry), "");
-  gtk_entry_set_text (GTK_ENTRY (data->action_entry), "");
-  gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 0.0);
-  if (debug_pmonitor)
-    printf("transStarted-cb: current_job %d, jobs %d, current_act %d, actions %d.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions);
-
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-}
-static void transFinished (void *user_data)
-{
-  GNCInteractor *data = user_data;
-  g_assert(data);
-  GNCInteractor_setFinished (data);
-  gtk_entry_set_text (GTK_ENTRY (data->job_entry), _("Finished"));
-  gtk_entry_set_text (GTK_ENTRY (data->action_entry), _("Finished"));
-  gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 1.0);
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-  if (debug_pmonitor)
-    printf("transFinished-cb: current_job %d, jobs %d, current_act %d, actions %d.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions);
-}
-static void jobStarted(JobProgressType type, int actions, void *user_data)
-{
-  GNCInteractor *data = user_data;
-  const char *msg = NULL;
-  g_assert(data);
-    
-  switch(type){
-  case JOB_OPENINGDIALOG:
-    /* Translators: Strings from this file are really only needed
-     * inside Germany (HBCI is not supported anywhere else). You may
-     * safely ignore strings from the import-export/hbci subdirectory
-     * in other countries. */
-    msg = _("Opening Dialog");
-    break;
-  case JOB_CLOSINGDIALOG:
-    msg = _("Closing Dialog");
-    break;
-    /** Opening network connection. */
-  case    JOB_OPENINGNETWORK:
-    msg = _("Opening Network Connection");
-    break;
-    /** Closing network connection. */
-  case    JOB_CLOSINGNETWORK:
-    msg = _("Closing Network Connection");
-    break;
-    /** Get balance */
-  case    JOB_GET_BALANCE:
-    /* Translate those with keeping the leading "Job:", but of course
-       using a translation for "Job". */
-    msg = _("Job: Get Balance");
-    break;
-    /** Get transaction statement */
-  case    JOB_GET_TRANS:
-    msg = _("Job: Get Transactions");
-    break;
-    /** Transfer money */
-  case    JOB_NEW_TRANSFER:
-    msg = _("Job: New Transfer");
-    break;
-    /** Debit note */
-  case    JOB_DEBIT_NOTE:
-    msg = _("Job: Debit Note");
-    break;
-    /** Get standing orders */
-  case    JOB_GET_STO:
-    msg = _("Job: Get Standing Orders");
-    break;
-    /** Create a new standing order */
-  case    JOB_NEW_STO:
-    msg = _("Job: New Standing Order");
-    break;
-    /** Delete a standing order */
-  case    JOB_DELETE_STO:
-    msg = _("Job: Delete Standing Order");
-    break;
-    /** Get account list */
-  case    JOB_GET_ACCOUNTS:
-    msg = _("Job: Retrieve Account List");
-    break;
-    /** Get SystemId */
-  case    JOB_GET_SYSTEMID:
-    msg = _("Job: Get System ID");
-    break;
-    /** Get keys */
-  case    JOB_GET_KEYS:
-    msg = _("Job: Get Keys");
-    break;
-    /** Send keys */
-  case    JOB_SEND_KEYS:
-    msg = _("Job: Send Keys");
-    break;
-    /** Disable keys */
-  case JOB_DISABLE_KEYS:
-    msg = _("Job: Disable Keys");
-    break;
-    /** Change keys */
-  case JOB_CHANGE_KEYS:
-    msg = _("Job: Change Keys");
-    break;
-    /** Change keys */
-  case JOB_GET_STATUS:
-    msg = _("Job: Get Status Reports");
-    break;
-#if 0
-  default:
-    msg = _("Unknown");
-#endif 
-  }
-  g_assert(msg);
-    
-  /*printf("Jobstart (w/ %d actions): %s\n",actions, msg);*/
-  data->actions = actions;
-  data->current_act = 0;
-  gtk_entry_set_text (GTK_ENTRY (data->job_entry), msg);
-  gtk_entry_set_text (GTK_ENTRY (data->action_entry), "");
-  gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 0.0);
-  if (debug_pmonitor)
-    printf("jobStarted-cb: current_job %d, jobs %d, current_act %d, actions %d, msg %s.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions, msg);
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-}
-static void jobFinished (void *user_data)
-{
-  GNCInteractor *data = user_data;
-  g_assert(data);
-  data->current_job++;
-  gtk_entry_set_text (GTK_ENTRY (data->job_entry), _("Done"));
-  /*gtk_entry_set_text (GTK_ENTRY (data->action_entry), _("Done"));
-    GNCInteractor_setFinished (data);
-    gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 1.0);*/
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-  if (debug_pmonitor)
-    printf("jobFinished-cb: current_job %d, jobs %d, current_act %d, actions %d.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions);
-}
-
-static void actStarted (ActionProgressType type, void *user_data)
-{
-  GNCInteractor *data = user_data;
-  const char *msg = NULL;
-  g_assert(data);
-  switch (type) {
-    /** Sending message. */
-  case ACT_SENDINGMESSAGE:
-    msg = _("Sending message");
-    break;
-    /** Waiting for response. */
-  case ACT_WAITRESPONSE:
-    msg = _("Waiting for response");
-    break;
-    /** Creating HBCI job. Number of Job will follow in string argument. */
-  case ACT_CREATEHBCIJOB:
-    msg = _("Creating HBCI Job");
-    break;
-    /** Contacting server. Server IP address will follow in string argument. */
-  case ACT_CONTACTINGSERVER:
-    msg = _("Contacting Server");
-    break;
-    /** Checking Job result. */
-  case ACT_CHKRESULT:
-    msg = _("Checking Job result");
-    break;
-    /** Updating local system. */
-  case ACT_UPDATESYSTEM:
-    msg = _("Updating local system");
-    break;
-    /** Closing connection. */
-  case ACT_CLOSECONNECTION:
-    msg = _("Closing connection");
-    break;
-  }
-  
-  g_assert(msg);
-  gtk_entry_set_text (GTK_ENTRY (data->action_entry), msg);
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-  if (debug_pmonitor)
-    printf("actStarted-cb: current_job %d, jobs %d, current_act %d, actions %d, msg %s.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions, msg);
-}
-static void actFinished (void *user_data)
-{
-  GNCInteractor *data = user_data;
-  g_assert(data);
-  data->current_act++;
-  gtk_entry_set_text (GTK_ENTRY (data->action_entry), _("Done"));
-  gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 
-			       (data->current_act < data->actions) ?
-			       ((float) data->current_act / 
-				(float) data->actions) : 
-			       1.0);
-  if (debug_pmonitor)
-    printf("actFinished-cb: current_job %d, jobs %d, current_act %d, actions %d.\n", 
-	   data->current_job, data->jobs, data->current_act, data->actions);
-  if (data->current_act > data->actions) {
-    printf("actFinished-cb: oops, current_act==%d is > than actions==%d.\n",
-	   data->current_act, data->actions);
-  }
-  
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-}
-static void logMsg (const char *msg, void *user_data)
-{
-  /* Note: this isn't used anyway. */
-  GNCInteractor *data = user_data;
-  g_assert(data);
-  
-  printf("logMsg: Logging msg: %s\n", msg);
-  add_log_text (data, msg);
-			    
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-}
-
-void add_log_text (GNCInteractor *data, const char *msg)
-{
-  /*int pos;*/
-  g_assert(data);
-  
-  /* pos = gtk_text_get_length (GTK_TEXT_VIEW (data->log_text)); */
-  gtk_text_buffer_insert_at_cursor
-      (gtk_text_view_get_buffer(GTK_TEXT_VIEW (data->log_text)),
-       msg, -1);
-  gtk_text_buffer_insert_at_cursor
-      (gtk_text_view_get_buffer(GTK_TEXT_VIEW (data->log_text)),
-       "\n", -1);
-}
-
-static void destr(void *user_data) 
-{
-  GNCInteractor *data = user_data;
-
-  GNCInteractor_delete (data);
-}
-static void
-on_button_clicked (GtkButton *button,
-		   gpointer user_data)
-{
-  GNCInteractor *data = user_data;
-  const char *name;
-  g_assert(data);
-  
-  name = gtk_widget_get_name (GTK_WIDGET (button));
-  if (strcmp (name, "abort_button") == 0) {
-    GNCInteractor_setAborted(data);
-  } else if (strcmp (name, "close_button") == 0) {
-    if (data->state != RUNNING) {
-      gtk_widget_hide_all (data->dialog); 
-      /*data->dont_hide = FALSE;*/
-      /*GNCInteractor_hide (data);*/
-    }
-  } else {
-    printf("on_button_clicked: Oops, unknown button: %s\n",
-	   name);
-  }
-  /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
-}
-
-HBCI_ProgressMonitor *
-gnc_hbci_new_pmonitor(GNCInteractor *data)
-{
-  HBCI_ProgressMonitorCB *pmon;
-  GtkWidget *dialog;
-  GladeXML *xml;
-
-  xml = gnc_glade_xml_new ("hbci.glade", "HBCI_connection_dialog");
-
-  (dialog = glade_xml_get_widget (xml, "HBCI_connection_dialog"));
-  data->dialog = dialog;
-  (data->job_entry = glade_xml_get_widget (xml, "job_entry"));
-  (data->action_entry = glade_xml_get_widget (xml, "action_entry"));
-  (data->action_progress = 
-	    glade_xml_get_widget (xml, "action_progress"));
-  (data->log_text = glade_xml_get_widget (xml, "log_text"));
-  (data->abort_button = glade_xml_get_widget (xml, "abort_button"));
-  gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE);
-  (data->close_button = glade_xml_get_widget (xml, "close_button"));
-  (data->close_checkbutton = 
-   glade_xml_get_widget (xml, "close_checkbutton"));
-
-  gtk_toggle_button_set_active 
-    (GTK_TOGGLE_BUTTON (data->close_checkbutton), 
-     gnc_lookup_boolean_option("__gui", "hbci_close_on_finish", TRUE));
-
-  gtk_signal_connect (GTK_OBJECT (data->abort_button), "clicked", 
-		      GTK_SIGNAL_FUNC (on_button_clicked), data);
-  gtk_signal_connect (GTK_OBJECT (data->close_button), "clicked", 
-		      GTK_SIGNAL_FUNC (on_button_clicked), data);
-
-  if (data->parent)
-    gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (data->parent));
-  /*gtk_widget_set_parent (GTK_WIDGET (dialog), data->parent);*/
-
-  gtk_object_ref (GTK_OBJECT (dialog));
-  gtk_widget_hide_all (dialog);
-
-  pmon = HBCI_ProgressMonitorCB_new(&destr,
-				    &transStarted, &transFinished,
-				    &jobStarted, &jobFinished, 
-				    &actStarted, &actFinished, 
-				    &logMsg,
-				    data);
-
-  return HBCI_ProgressMonitorCB_ProgressMonitor(pmon);
-}
+/* currently empty */

==================================================
Differences for hbci.glade (revision 1.27.2.8 -> 1.27.2.9)
==================================================
--- /home/cvs/cvsroot/gnucash/src/import-export/hbci/glade/hbci.glade	2003/10/20 03:02:09	1.27.2.8
+++ /home/cvs/cvsroot/gnucash/src/import-export/hbci/glade/hbci.glade	2004/03/03 23:15:06	1.27.2.9
@@ -1540,7 +1540,8 @@
 		      <child>
 			<widget class="GtkLabel" id="label8477411">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">Do these values match the values on your paper Ini-Letter?</property>
+			  <property name="label" translatable="yes">Do these values match the values on your paper Ini-Letter?
+(If you cannot see anything, press the 'Print' button.)</property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_CENTER</property>
@@ -1747,7 +1748,8 @@
 		  <child>
 		    <widget class="GtkLabel" id="label8477345">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">This is the Ini-Letter of you, the user. Please print out a paper copy 
+		      <property name="label" translatable="yes">This is the Ini-Letter of you, the user. (If you cannot see anything, please 
+press the 'Print' button.)  Please print out a paper copy 
 by pressing 'Print'. Then press 'Next'.</property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">False</property>

==================================================
Differences for split-register-layout.c (revision 1.14.4.1 -> 1.14.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/register/ledger-core/split-register-layout.c	2003/07/17 08:04:09	1.14.4.1
+++ /home/cvs/cvsroot/gnucash/src/register/ledger-core/split-register-layout.c	2004/03/03 23:15:06	1.14.4.2
@@ -178,10 +178,9 @@
         gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 3);
         gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 4);
         gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0, 5);
-        gnc_table_layout_set_cell (layout, curs, RECN_CELL,  0, 6);
-	gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 7);
-	gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 8);
-        gnc_table_layout_set_cell (layout, curs, BALN_CELL,  0, 9);
+	gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 6);
+	gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 7);
+        gnc_table_layout_set_cell (layout, curs, BALN_CELL,  0, 8);
 
         curs_last = curs;
         curs = gnc_table_layout_get_cursor (layout,
@@ -201,9 +200,9 @@
         gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 3);
         gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 4);
 
-        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 7);
-        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 8);
-        gnc_table_layout_set_cell (layout, curs, TBALN_CELL, 0, 9);
+        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 6);
+        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 7);
+        gnc_table_layout_set_cell (layout, curs, TBALN_CELL, 0, 8);
 
         curs_last = curs;
         curs = gnc_table_layout_get_cursor (layout,
@@ -219,9 +218,8 @@
         gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 3);
         gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 4);
         gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 5);
-        gnc_table_layout_set_cell (layout, curs, RECN_CELL, 0, 6);
-	gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 7);
-	gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 8);
+	gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 6);
+	gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 7);
 
         break;
       }

==================================================
Differences for split-register-load.c (revision 1.23.4.1 -> 1.23.4.2)
==================================================
--- /home/cvs/cvsroot/gnucash/src/register/ledger-core/split-register-load.c	2003/07/17 08:04:11	1.23.4.1
+++ /home/cvs/cvsroot/gnucash/src/register/ledger-core/split-register-load.c	2004/03/03 23:15:06	1.23.4.2
@@ -174,7 +174,7 @@
   /* make sure we have a blank split */
   if (blank_split == NULL)
   {
-    Transaction *trans;
+    Transaction *new_trans;
     gnc_commodity * currency = NULL;
 
     /* Determine the proper currency to use for this transaction.
@@ -193,14 +193,14 @@
 
     gnc_suspend_gui_refresh ();
 
-    trans = xaccMallocTransaction (gnc_get_current_book ());
+    new_trans = xaccMallocTransaction (gnc_get_current_book ());
 
-    xaccTransBeginEdit (trans);
-    xaccTransSetCurrency (trans, currency ? currency : gnc_default_currency ());
-    xaccTransSetDateSecs (trans, info->last_date_entered);
+    xaccTransBeginEdit (new_trans);
+    xaccTransSetCurrency (new_trans, currency ? currency : gnc_default_currency ());
+    xaccTransSetDateSecs (new_trans, info->last_date_entered);
     blank_split = xaccMallocSplit (gnc_get_current_book ());
-    xaccTransAppendSplit (trans, blank_split);
-    xaccTransCommitEdit (trans);
+    xaccTransAppendSplit (new_trans, blank_split);
+    xaccTransCommitEdit (new_trans);
 
     info->blank_split_guid = *xaccSplitGetGUID (blank_split);
     info->blank_split_edited = FALSE;


More information about the Gnucash-changes mailing list