From fff65d14341b5f70facf9fb345bf34e38b49de8f Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Thu, 5 May 2005 11:41:28 +0000 Subject: [PATCH] Improve HBCI debugging messages. 2005-05-05 Christian Stimming * src/import-export/hbci/gnc-hbci-utils.c: Improve debugging messages. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11021 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 ++++ src/import-export/hbci/druid-hbci-initial.c | 12 +++++++- src/import-export/hbci/gnc-hbci-utils.c | 31 +++++++++++++++++---- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfac26ead5..f2bde8f410 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-05-05 Christian Stimming + + * src/import-export/hbci/gnc-hbci-utils.c: Improve debugging + messages. + 2005-04-21 Christian Stimming * src/import-export/hbci/gnc-hbci-getbalance.c: Fix forgotten NULL diff --git a/src/import-export/hbci/druid-hbci-initial.c b/src/import-export/hbci/druid-hbci-initial.c index 51f4e3c6e1..f77b23fa81 100644 --- a/src/import-export/hbci/druid-hbci-initial.c +++ b/src/import-export/hbci/druid-hbci-initial.c @@ -450,7 +450,8 @@ on_aqhbci_button (GtkButton *button, HBCIInitialInfo *info = user_data; GWEN_BUFFER *buf; int res; - const char *backend_name = "aqhbci"; + const GWEN_STRINGLIST *active_backends; + const char *backend_name; /* This is the point where we look for and start an external application shipped with aqhbci that contains the setup druid for @@ -466,6 +467,15 @@ on_aqhbci_button (GtkButton *button, AB_BANKING *banking = info->api; g_assert(info->druid); + active_backends = AB_Banking_GetActiveProviders (banking); + if (GWEN_StringList_Count(active_backends) <= 1) + backend_name = "aqhbci"; + else { + /* FIXME: Present a selection dialog to select a particular + backend */ + backend_name = "aqhbci"; + } + buf = GWEN_Buffer_new(NULL, 300, 0, 0); AB_Banking_FindWizard(banking, backend_name, NULL, buf); wizard_exists = (strlen(GWEN_Buffer_GetStart(buf)) > 0); diff --git a/src/import-export/hbci/gnc-hbci-utils.c b/src/import-export/hbci/gnc-hbci-utils.c index 2888feaadc..7424478b9b 100644 --- a/src/import-export/hbci/gnc-hbci-utils.c +++ b/src/import-export/hbci/gnc-hbci-utils.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "gnc-ui.h" #include "gnc-hbci-kvp.h" @@ -189,6 +190,7 @@ gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose) /* list_int *list; */ /* const char *msg; */ int cause = 0; + AB_JOB_STATUS jobstatus; g_assert (job); /* if (AB_JOB_status (job) != HBCI_JOB_STATUS_DONE) */ @@ -197,12 +199,23 @@ gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose) /* return; */ if (verbose) { - printf("OutboxJob status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job))); + printf("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job))); printf(", result: %s", AB_Job_GetResultText(job)); printf("\n"); } + jobstatus = AB_Job_GetStatus (job); + if (jobstatus == AB_Job_StatusError) { + if (!verbose) + printf("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n", + AB_Job_Type2Char(AB_Job_GetType(job)), + AB_Job_GetResultText(job)); + cause = 9000; + } else { + cause = 0; + } + #if 0 list = AB_JOB_resultCodes (job); if (list_int_size (list) > 0) { @@ -420,17 +433,23 @@ gnc_AB_BANKING_execute (GtkWidget *parent, AB_BANKING *api, { int err; int resultcode; + int be_verbose = FALSE; if (inter) GNCInteractor_show (inter); if (gnc_lookup_boolean_option("_+Advanced", "HBCI Verbose Debug Messages", FALSE)) { -/* GWEN_Logger_SetLevel(0, GWEN_LoggerLevelDebug); */ -/* HBCI_Hbci_setDebugLevel (4); */ + GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevelNotice); + GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevelInfo); + GWEN_Logger_SetLevel("aqhbci", GWEN_LoggerLevelInfo); + be_verbose = TRUE; + } + else { + GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevelError); + GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevelError); + GWEN_Logger_SetLevel("aqhbci", GWEN_LoggerLevelError); } -/* else */ -/* HBCI_Hbci_setDebugLevel (0); */ do { if (inter) { @@ -450,7 +469,7 @@ gnc_AB_BANKING_execute (GtkWidget *parent, AB_BANKING *api, } while (gnc_hbci_Error_retry (parent, err, inter)); - resultcode = gnc_hbci_debug_outboxjob (job, FALSE); + resultcode = gnc_hbci_debug_outboxjob (job, be_verbose); if (!hbci_Error_isOk(err)) { /* char *errstr = */ /* g_strdup_printf("gnc_AB_BANKING_execute: Error at executeQueue: %s", */