From ceaa55b937deb4c1965c667a740928b06fcf47e8 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 7 Feb 2004 11:08:08 +0000 Subject: [PATCH] More openhbci2 work. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9828 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/import-export/hbci/hbci-interaction.c | 29 ++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/import-export/hbci/hbci-interaction.c b/src/import-export/hbci/hbci-interaction.c index b35c82509f..c61d35f922 100644 --- a/src/import-export/hbci/hbci-interaction.c +++ b/src/import-export/hbci/hbci-interaction.c @@ -194,6 +194,15 @@ void GNCInteractor_reparent (GNCInteractor *i, GtkWidget *new_parent) /******************************************************** * 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, @@ -207,10 +216,7 @@ static int msgInputPin(const HBCI_User *user, g_assert(data); while (TRUE) { - const char *username = - (HBCI_User_name (user) ? HBCI_User_name (user) : - (HBCI_User_userId (user) ? HBCI_User_userId (user) : - _("Unknown"))); + const char *username = username_from_user(user); g_assert (username); if (newPin) { @@ -331,10 +337,7 @@ static int msgInsertMediumOrAbort(const HBCI_User *user, g_assert(data); if (user != NULL) { - const char *username = - (HBCI_User_name (user) ? HBCI_User_name (user) : - (HBCI_User_userId (user) ? HBCI_User_userId (user) : - _("Unknown"))); + const char *username = username_from_user(user); b = HBCI_User_bank (user); switch (mtype) { @@ -407,10 +410,7 @@ static int msgInsertCorrectMediumOrAbort(const HBCI_User *user, g_assert(data); if (user != NULL) { - const char *username = - (HBCI_User_name (user) ? HBCI_User_name (user) : - (HBCI_User_userId (user) ? HBCI_User_userId (user) : - _("Unknown"))); + const char *username = username_from_user(user); b = HBCI_User_bank (user); switch (mtype) { @@ -527,10 +527,7 @@ msgStartInputPinViaKeypadCB(const HBCI_User *user, void *user_data) /* Create message string */ if (user != NULL) { - const char *username = - (HBCI_User_name (user) ? HBCI_User_name (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 */