[Gnucash-changes] More HBCI work.

Christian Stimming cstim at cvs.gnucash.org
Fri Sep 17 16:54:17 EDT 2004


Log Message:
-----------
More HBCI work.

Modified Files:
--------------
    gnucash/src/import-export/hbci:
        dialog-hbcitrans.c
        gnc-hbci-getbalance.c
        hbci-interaction.c

Revision Data
-------------
Index: hbci-interaction.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lsrc/import-export/hbci/hbci-interaction.c -Lsrc/import-export/hbci/hbci-interaction.c -u -r1.38 -r1.39
--- src/import-export/hbci/hbci-interaction.c
+++ src/import-export/hbci/hbci-interaction.c
@@ -209,12 +209,23 @@
   int retval = 0;
   int newPin;
   int hideInput;
+  GWEN_BUFFER *buffer1, *buffer2;
+  int bufsize = 10+strlen(text);
+  const char *latin1text;
+  const char *latin1title;
 
   g_assert(ab);
   data = AB_Banking_GetUserData(ab);
   g_assert(data);
   g_assert(maxLen > minsize);
 
+  buffer1 = GWEN_Buffer_new(0, bufsize, 0, 0);
+  buffer2 = GWEN_Buffer_new(0, bufsize, 0, 0);
+  AB_ImExporter_Utf8ToDta (title, bufsize, buffer1);
+  AB_ImExporter_Utf8ToDta (text, bufsize, buffer2);
+  latin1title = GWEN_Buffer_GetStart (buffer1);
+  latin1text = GWEN_Buffer_GetStart (buffer2);
+
   newPin = (flags | AB_BANKING_INPUT_FLAGS_CONFIRM) == 0;
   /*   printf("inputBoxCB: Requesting newPind: %s\n", newPin ? "true" : "false"); */
   hideInput = (flags | AB_BANKING_INPUT_FLAGS_SHOW) != 0;
@@ -224,7 +235,7 @@
   while (TRUE) {
 
     if (newPin) {
-      msgstr = g_strdup_printf("%s\n\n%s", title, text);
+      msgstr = g_strdup_printf("%s\n\n%s", latin1title, latin1text);
       retval = gnc_hbci_get_initial_password (data->parent,
 					      msgstr,
 					      &passwd);
@@ -238,7 +249,7 @@
 	return 0;
       }
       else {
-	msgstr = g_strdup_printf("%s\n\n%s", title, text);
+	msgstr = g_strdup_printf("%s\n\n%s", latin1title, latin1text);
 	
 	retval = gnc_hbci_get_password (data->parent,
 					msgstr,
@@ -276,11 +287,15 @@
       }
       else 
 	g_free (memset (passwd, 0, strlen (passwd)));
+      GWEN_Buffer_free (buffer1);
+      GWEN_Buffer_free (buffer2);
       return 0;
     }
   }
   
   /* User wanted to abort. */
+  GWEN_Buffer_free (buffer1);
+  GWEN_Buffer_free (buffer2);
   return 1;
 }
 
@@ -449,17 +464,26 @@
 {
   GNCInteractor *data;
   //GtkWidget *dialog;
+  GWEN_BUFFER *buffer;
+  int bufsize = 10+strlen(text);
+  const char *latin1text;
+
   g_assert(ab);
   data = AB_Banking_GetUserData(ab);
   g_assert(data);
 
+  buffer = GWEN_Buffer_new(0, bufsize, 0, 0);
+  AB_ImExporter_Utf8ToDta (text, bufsize, buffer);
+  latin1text = GWEN_Buffer_GetStart (buffer);
+
   if ((id != 0) && (id != progress_id)) {
     printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id);
   }
 
-  printf("progressLogCB: Logging msg: %s\n", text);
-  GNCInteractor_add_log_text (data, text);
+  printf("progressLogCB: Logging msg: %s\n", latin1text);
+  GNCInteractor_add_log_text (data, latin1text);
 
+  GWEN_Buffer_free (buffer);
   keepAlive(data);
   return 0;
 }
Index: dialog-hbcitrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -Lsrc/import-export/hbci/dialog-hbcitrans.c -Lsrc/import-export/hbci/dialog-hbcitrans.c -u -r1.35 -r1.36
--- src/import-export/hbci/dialog-hbcitrans.c
+++ src/import-export/hbci/dialog-hbcitrans.c
@@ -495,7 +495,7 @@
     /* FIXME: If this is a direct debit, set the textkey/ "Textschluessel"/
        transactionCode according to some GUI selection here!! */
     /*if (td->trans_type == SINGLE_DEBITNOTE)
-      AB_TRANSACTION_setTransactionCode (td->hbci_trans, 05);*/
+      AB_TRANSACTION_setTextKey (td->hbci_trans, 05);*/
 
     /* And finally check the account code, if ktoblzcheck is available. */
     values_ok = check_ktoblzcheck(GTK_WIDGET (td->dialog), td, td->hbci_trans);
@@ -521,6 +521,7 @@
   AB_Transaction_SetLocalBankCode (trans, 
 				   AB_Account_GetBankCode (h_acc));
   AB_Transaction_SetLocalAccountNumber (trans, AB_Account_GetAccountNumber (h_acc));
+  AB_Transaction_SetLocalCountryCode (trans, 280);
 	
   AB_Transaction_SetRemoteBankCode
     (trans, gtk_entry_get_text (GTK_ENTRY (td->recp_bankcode_entry)));
@@ -530,6 +531,7 @@
     (trans, gtk_entry_get_text (GTK_ENTRY (td->recp_account_entry)));
   /* printf("Got otherAccountId %s.\n",
      AB_Transaction_otherAccountId (trans)); */
+  AB_Transaction_SetRemoteCountryCode (trans, 280);
   AB_Transaction_AddRemoteName
     (trans, gtk_entry_get_text (GTK_ENTRY (td->recp_name_entry)), FALSE);
 	
@@ -553,9 +555,12 @@
      transactionCode different from the default has to be set. */
   switch(td->trans_type) {
   case SINGLE_DEBITNOTE:
-    AB_Transaction_SetTransactionCode (trans, 05);
+    /* AB_Transaction_SetTransactionCode (trans, 05); */
+    AB_Transaction_SetTextKey (trans, 05);
+    break;
   default:
-    AB_Transaction_SetTransactionCode (trans, 51);
+    /* AB_Transaction_SetTransactionCode (trans, 51); */
+    AB_Transaction_SetTextKey (trans, 51);
   }
 
   return trans;
Index: gnc-hbci-getbalance.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -u -r1.27 -r1.28
--- src/import-export/hbci/gnc-hbci-getbalance.c
+++ src/import-export/hbci/gnc-hbci-getbalance.c
@@ -102,7 +102,9 @@
     if (!gnc_AB_BANKING_execute (parent, api, job, interactor)) {
 
       /* AB_BANKING_executeOutbox failed. */
-      /* AB_Banking_DequeueJob(api, job); FIXME: Which one to use here? */
+      AB_Banking_DequeueJob(api, job);
+      AB_Banking_DelFinishedJob(api, job);
+      AB_Banking_DelPendingJob(api, job);
       /* FIXME: free unneeded data */
       return;
     }
@@ -115,7 +117,9 @@
 				job);
 
     /* Clean up after ourselves. */
+    AB_Banking_DequeueJob(api, job);
     AB_Banking_DelFinishedJob(api, job);
+    AB_Banking_DelPendingJob(api, job);
     gnc_AB_BANKING_fini (api);
     GNCInteractor_hide (interactor);
   }


More information about the gnucash-changes mailing list