2003-06-08 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/*.c: Remove old unused code.

	* src/import-export/hbci/hbci-interaction.c: Add more user
	feedback functions.

	* src/import-export/hbci/gnc-hbci-utils.c: Improve error handling.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8490 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2003-06-08 13:05:42 +00:00
parent 25e52baa69
commit 89368a99bb
12 changed files with 107 additions and 157 deletions

View File

@@ -1,3 +1,12 @@
2003-06-08 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/*.c: Remove old unused code.
* src/import-export/hbci/hbci-interaction.c: Add more user
feedback functions.
* src/import-export/hbci/gnc-hbci-utils.c: Improve error handling.
2003-06-01 Derek Atkins <derek@ihtfp.com>
* src/gnome-utils/gnc-date-format.*: Create a new "date format"

View File

@@ -344,7 +344,6 @@ src/import-export/gncmod-generic-import.c
src/import-export/hbci/glade/hbci.glade
src/import-export/hbci/glade/hbcipass.glade
src/import-export/hbci/dialog-pass.c
src/import-export/hbci/druid-hbci-final.c
src/import-export/hbci/druid-hbci-initial.c
src/import-export/hbci/druid-hbci-utils.c
src/import-export/hbci/gnc-hbci-kvp.c

View File

@@ -21,14 +21,12 @@ libgncmod_hbci_la_SOURCES = \
# Must be included in tarball because they are listed in POTFILES.in
libgncmod_hbci_la_empty = \
druid-hbci-final.c \
gnc-hbci-actions.c
noinst_HEADERS = \
dialog-daterange.h \
dialog-hbcitrans.h \
dialog-pass.h \
druid-hbci-final.h \
druid-hbci-initial.h \
druid-hbci-utils.h \
gnc-hbci-actions.h \

View File

@@ -284,7 +284,6 @@ gnc_hbci_trans (GtkWidget *parent,
/* Fill in the user-entered values */
trans = HBCI_Transaction_new();
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>8)
/* OpenHBCI newer than 0.9.8: use account's bankCode values
* instead of the bank's ones since this is what some banks
* require. */
@@ -292,10 +291,6 @@ gnc_hbci_trans (GtkWidget *parent,
HBCI_Account_countryCode (h_acc));
HBCI_Transaction_setOurBankCode (trans,
HBCI_Account_instituteCode (h_acc));
#else
HBCI_Transaction_setOurCountryCode (trans, HBCI_Bank_countryCode (bank));
HBCI_Transaction_setOurBankCode (trans, HBCI_Bank_bankCode (bank));
#endif
HBCI_Transaction_setOurAccountId (trans, HBCI_Account_accountId (h_acc));
HBCI_Transaction_setOurSuffix (trans, HBCI_Account_accountSuffix (h_acc));

View File

@@ -1,32 +0,0 @@
/********************************************************************\
* druid-hbci-final.c -- hbci creation functionality *
* Copyright (C) 2002 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@gnu.org *
\********************************************************************/
#include "config.h"
#include <gnome.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "druid-hbci-final.h"
/* Empty file at the moment. */

View File

@@ -1,30 +0,0 @@
/********************************************************************\
* druid-hbci-final.h -- hbci final creation functionality *
* Copyright (C) 2002 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@gnu.org *
\********************************************************************/
#ifndef DRUID_HBCI_FINAL_H
#define DRUID_HBCI_FINAL_H
#include <libguile.h>
/* Empty file at the moment. */
#endif

View File

@@ -45,9 +45,6 @@
#include <openhbci/mediumrdhbase.h>
#include <openhbci.h>
#ifndef OPENHBCI_VERSION_BUILD
# define OPENHBCI_VERSION_BUILD 0
#endif
typedef enum _infostate {
INI_ADD_BANK,
@@ -670,12 +667,7 @@ on_configfile_next (GnomeDruidPage *gnomedruidpage,
return TRUE;
}
// no libchipcard? Make that button greyed out
if
#if ((OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>13))
(HBCI_API_mediumType(info->api, "DDVCard") != MediumTypeCard)
#else /* openhbci > 0.9.9.13 */
(! HBCI_Hbci_hasLibchipcard ())
#endif /* openhbci <= 0.9.9.13 */
if (HBCI_API_mediumType(info->api, "DDVCard") != MediumTypeCard)
{
gtk_widget_set_sensitive (GTK_WIDGET (info->mediumddv),
FALSE);
@@ -939,7 +931,6 @@ on_userid_next (GnomeDruidPage *gnomedruidpage,
mediumtype = "DDVCard";
}
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
medium = HBCI_API_createNewMedium (api,
mediumtype,
FALSE,
@@ -947,13 +938,6 @@ on_userid_next (GnomeDruidPage *gnomedruidpage,
HBCI_Bank_bankCode (bank),
userid,
mediumname, &err);
#else /* openhbci > 0.9.9.5 */
medium = HBCI_API_createNewMedium (api,
HBCI_Bank_countryCode (bank),
HBCI_Bank_bankCode (bank),
userid,
mediumname, secmode, &err);
#endif /* openhbci > 0.9.9.5 */
g_free(mediumname);
if (medium == NULL) {
@@ -977,11 +961,7 @@ on_userid_next (GnomeDruidPage *gnomedruidpage,
/* Test mounting only for DDV cards. RDH files should work... */
if (secmode == HBCI_SECURITY_DDV) {
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
err = HBCI_Medium_mountMedium (medium, NULL);
#else /* openhbci > 0.9.9.5 */
err = HBCI_Medium_mountMedium (medium, newuser, NULL);
#endif /* openhbci > 0.9.9.5 */
if (err != NULL) {
printf("on_userid_next: Mounting medium failed: %s.\n",
HBCI_Error_message (err));

View File

@@ -307,7 +307,6 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
TRUE,
_("The PIN you entered was wrong.\n"
"Do you want to try again?"));
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>5)
case HBCI_ERROR_CODE_PIN_WRONG_0:
GNCInteractor_erasePIN (inter);
return gnc_verify_dialog_parented (parent,
@@ -329,7 +328,6 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
_("The PIN you entered was wrong.\n"
"You have two further wrong retries left.\n"
"Do you want to try again?"));
#endif
case HBCI_ERROR_CODE_PIN_ABORTED:
/* printf("gnc_hbci_error_feedback: PIN dialog was aborted.\n"); */
return FALSE;
@@ -339,7 +337,6 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
TRUE,
_("The PIN you entered was too short.\n"
"Do you want to try again?"));
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>5)
case HBCI_ERROR_CODE_CARD_DESTROYED:
GNCInteractor_hide (inter);
gnc_error_dialog_parented
@@ -347,17 +344,14 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
_("Unfortunately you entered a wrong PIN for too many times.\n"
"Your chip card is therefore destroyed. Aborting."));
return FALSE;
#endif
case HBCI_ERROR_CODE_FILE_NOT_FOUND:
/* printf("gnc_hbci_error_feedback: File not found error.\n"); */
return FALSE;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>5)
case HBCI_ERROR_CODE_NO_CARD:
return gnc_verify_dialog_parented (parent,
TRUE,
_("No chip card has been found in the chip card reader.\n"
"Do you want to try again?"));
#endif
case HBCI_ERROR_CODE_JOB_NOT_SUPPORTED:
GNCInteractor_hide (inter);
gnc_error_dialog_parented
@@ -365,7 +359,6 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
_("Unfortunately this HBCI job is not supported \n"
"by your bank or for your account. Aborting."));
return FALSE;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>5)
case HBCI_ERROR_CODE_SOCKET_NO_CONNECT:
GNCInteractor_hide (inter);
gnc_error_dialog_parented
@@ -373,7 +366,22 @@ gnc_hbci_error_retry (GtkWidget *parent, HBCI_Error *error,
_("The server of your bank refused the HBCI connection.\n"
"Please try again later. Aborting."));
return FALSE;
#endif
case HBCI_ERROR_CODE_MEDIUM:
gnc_error_dialog_parented
(GTK_WINDOW (parent),
_("There was an error when loading the plugin for your security medium \n"
"(see log window). Probably the versions of your currently installed \n"
"OpenHBCI library and of the plugin do not match. In that case you need \n"
"to recompile and reinstall the plugin again. Aborting now."));
GNCInteractor_hide (inter);
return FALSE;
case HBCI_ERROR_CODE_BAD_MEDIUM:
gnc_error_dialog_parented
(GTK_WINDOW (parent),
_("Your security medium is not supported. No appropriate plugin \n"
"has been found for that medium. Aborting."));
GNCInteractor_hide (inter);
return FALSE;
default:
return FALSE;

View File

@@ -74,8 +74,6 @@ libgncmod_hbci_LTX_gnc_module_init(int refcount)
gnc_hbci_addmenus();
//scm_c_define_gsubr("gnc:hbci-finish-setup",
// 0, 0, 0, scm_hbci_final_druid);
return TRUE;
}

View File

@@ -39,9 +39,6 @@
#include "dialog-pass.h"
#include <openhbci.h>
#ifndef OPENHBCI_VERSION_BUILD
# define OPENHBCI_VERSION_BUILD 0
#endif
#define PREF_TAB_ONLINE_BANKING N_("Online Banking & Importing")
@@ -307,12 +304,7 @@ static int msgInsertMediumOrAbort(const HBCI_User *user,
b = HBCI_User_bank (user);
switch (mtype)
{
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeFile:
#else /* openhbci > 0.9.9.5 */
case MediumRDHFile:
case MediumRDHFileOld:
#endif /* openhbci > 0.9.9.5 */
if (b != NULL)
/* xgettext:c-format */
msgstr = g_strdup_printf ( _("Please make sure the key file for \n"
@@ -324,12 +316,7 @@ static int msgInsertMediumOrAbort(const HBCI_User *user,
"user '%s' at unknown bank can be accessed."),
username);
break;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeCard:
#else /* openhbci > 0.9.9.5 */
case MediumDDVCard:
case MediumRDHCard:
#endif /* openhbci > 0.9.9.5 */
default:
if (b != NULL)
/* xgettext:c-format */
@@ -346,21 +333,11 @@ static int msgInsertMediumOrAbort(const HBCI_User *user,
else
switch (mtype)
{
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeFile:
#else /* openhbci > 0.9.9.5 */
case MediumRDHFile:
case MediumRDHFileOld:
#endif /* openhbci > 0.9.9.5 */
msgstr = g_strdup ( _("Please make sure the key file for \n"
"unknown user at unknown bank can be accessed."));
break;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeCard:
#else /* openhbci > 0.9.9.5 */
case MediumDDVCard:
case MediumRDHCard:
#endif /* openhbci > 0.9.9.5 */
default:
msgstr = g_strdup ( _("Please insert chip card for \n"
"unknown user at unknown bank."));
@@ -393,12 +370,7 @@ static int msgInsertCorrectMediumOrAbort(const HBCI_User *user,
b = HBCI_User_bank (user);
switch (mtype)
{
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeFile:
#else /* openhbci > 0.9.9.5 */
case MediumRDHFile:
case MediumRDHFileOld:
#endif /* openhbci > 0.9.9.5 */
if (b != NULL)
/* xgettext:c-format */
msgstr = g_strdup_printf ( _("The key file does not seem to be the correct \n"
@@ -412,12 +384,7 @@ static int msgInsertCorrectMediumOrAbort(const HBCI_User *user,
"sure the correct key file can be accessed."),
username);
break;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeCard:
#else /* openhbci > 0.9.9.5 */
case MediumDDVCard:
case MediumRDHCard:
#endif /* openhbci > 0.9.9.5 */
default:
if (b != NULL)
/* xgettext:c-format */
@@ -434,22 +401,12 @@ static int msgInsertCorrectMediumOrAbort(const HBCI_User *user,
else
switch (mtype)
{
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeFile:
#else /* openhbci > 0.9.9.5 */
case MediumRDHFile:
case MediumRDHFileOld:
#endif /* openhbci > 0.9.9.5 */
msgstr = g_strdup ( _("The key file does not seem to be the correct \n"
"file for unknown user at unknown bank. Please make \n"
"sure the correct key file can be accessed."));
break;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5)
case MediumTypeCard:
#else /* openhbci > 0.9.9.5 */
case MediumDDVCard:
case MediumRDHCard:
#endif /* openhbci > 0.9.9.5 */
default:
msgstr = g_strdup ( _("Please insert the correct chip card for \n"
"unknown user at unknown bank."));
@@ -499,21 +456,89 @@ static void destr(void *user_data)
}
}
static void
msgEndInputPinViaKeypadCB(const HBCI_User *user, void *user_data)
{
GNCInteractor *data = user_data;
g_assert(data);
if (data->pin_keypad_dialog) {
gnome_dialog_close (GNOME_DIALOG (data->pin_keypad_dialog));
gtk_widget_destroy (data->pin_keypad_dialog);
data->pin_keypad_dialog = NULL;
}
}
static void
msgStartInputPinViaKeypadCB(const HBCI_User *user, void *user_data)
{
const HBCI_Bank *bank;
char *msgstr;
GtkWidget *dialog;
GNCInteractor *data = user_data;
g_assert(data);
/* Already an existing dialog? Shouldn't happen. Better delete
existing dialog first. */
if (data->pin_keypad_dialog != NULL)
msgEndInputPinViaKeypadCB(user, user_data);
/* 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")));
bank = HBCI_User_bank (user);
if (bank != NULL) {
/* xgettext:c-format */
msgstr = g_strdup_printf (_("Please enter PIN for \n"
"user '%s' at bank '%s'\n"
"at the keypad of your chip card reader."),
username,
bank_to_str (bank));
}
else {
/* xgettext:c-format */
msgstr = g_strdup_printf ( _("Please enter PIN for \n"
"user '%s' at unknown bank\n"
"at the keypad of your chip card reader."),
username);
}
}
else
msgstr = g_strdup ( _("Please enter PIN for \n"
"unknown user at unknown bank\n"
"at the keypad of your chip card reader."));
/* Create new dialog */
dialog = gnome_ok_dialog_parented (msgstr, GTK_WINDOW (data->parent));
gnome_dialog_close_hides (GNOME_DIALOG(dialog), TRUE);
gtk_widget_show_all (dialog);
data->pin_keypad_dialog = dialog;
g_free (msgstr);
}
/********************************************************
* Constructor
*/
HBCI_Interactor *
gnc_hbci_new_interactor(GNCInteractor *data)
{
HBCI_InteractorCB *inter;
inter = HBCI_InteractorCB_new2(&destr,
&msgInputPin,
&msgInsertMediumOrAbort,
&msgInsertCorrectMediumOrAbort,
&msgStateResponse,
&keepAlive,
NULL,
NULL,
data);
&msgInputPin,
&msgInsertMediumOrAbort,
&msgInsertCorrectMediumOrAbort,
&msgStateResponse,
&keepAlive,
&msgStartInputPinViaKeypadCB,
&msgEndInputPinViaKeypadCB,
data);
return HBCI_InteractorCB_Interactor(inter);
}

View File

@@ -57,6 +57,9 @@ struct _inter_data
const char *format_pin_user_bank;
const char *format_pin_min_char;
/* PinKeypad dialog, if used */
GtkWidget *pin_keypad_dialog;
/* Flags to keep track on whether an HBCI action is running or
not. */

View File

@@ -175,7 +175,6 @@ static void jobStarted(JobProgressType type, int actions, void *user_data)
case JOB_SEND_KEYS:
msg = _("Job: Send Keys");
break;
#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>8)
/** Disable keys */
case JOB_DISABLE_KEYS:
msg = _("Job: Disable Keys");
@@ -184,16 +183,14 @@ static void jobStarted(JobProgressType type, int actions, void *user_data)
case JOB_CHANGE_KEYS:
msg = _("Job: Change Keys");
break;
# if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>10) || (OPENHBCI_VERSION_BUILD>0)
/** Change keys */
case JOB_GET_STATUS:
msg = _("Job: Get Status Reports");
break;
# endif /* OPENHBCI_VERSION > 0.9.10.0 */
#else /* OPENHBCI_VERSION > 0.9.8 */
#if 0
default:
msg = _("Unknown");
#endif /* OPENHBCI_VERSION > 0.9.8 */
#endif
}
g_assert(msg);