host/user_interface.c
/** Ask user if they want to allow some action.
  * \param command The action to ask the user about. See #AskUserCommandEnum.
  * \return false if the user accepted, true if the user denied.
  */
Ask user if they want to allow some action.
\param command The action to ask the user about.
Ask user if they want to allow some action . \ param command The action to ask the user about .
bool userDenied(AskUserCommand command)
{
    int i;
    bool response = true;
    printf("\n");
    switch(command)
    {
        case ASKUSER_NEW_WALLET:
        case ASKUSER_NEW_ADDRESS:
        case ASKUSER_CHANGE_NAME:
        case ASKUSER_BACKUP_WALLET:
        case ASKUSER_RESTORE_WALLET:
        case ASKUSER_CHANGE_KEY:
        case ASKUSER_GET_MASTER_KEY:
        case ASKUSER_DELETE_WALLET:
            printAction(command);
            return getUserConfirmation();
            break;
        case ASKUSER_SIGN_TRANSACTION:
            for (i = 0; i < num_outputs_seen; i++)
            {
                printf("Send ");
                printf("%s", amount_list[i]);
                printf(" BTC to ");
                printf("%s", address_list[i]);
                printf("? ");
                response = getUserConfirmation();
                if (response)
                {
                    break;
                }
            }
            if (!response && transaction_fee_set)                       
            {
                printf("Transaction fee: ");
                printf("%s", transaction_fee_amount);
                printf("BTC.\n");
                printf("Is this okay? ");
                response = getUserConfirmation();
            }
            break;
        case ASKUSER_FORMAT:
            printf("Format storage? This will delete everything!");
            response = getUserConfirmation();
            if (!response)
            {
                printf("Are you sure you you want to nuke all wallets?");
                response = getUserConfirmation();
                if (!response)
                {
                    printf("Are you really really sure?");
                    response = getUserConfirmation();
                }
            }
            break;
        default:
            printf("Unknown command in userDenied().\n");
            response = true;
            break;
    }
    return response;
}
bool userDenied ( AskUserCommand command ) { int i ; bool response = true ; printf ( " \n " ) ; switch ( command ) { case ASKUSER_NEW_WALLET : case ASKUSER_NEW_ADDRESS : case ASKUSER_CHANGE_NAME : case ASKUSER_BACKUP_WALLET : case ASKUSER_RESTORE_WALLET : case ASKUSER_CHANGE_KEY : case ASKUSER_GET_MASTER_KEY : case ASKUSER_DELETE_WALLET : printAction ( command ) ; return getUserConfirmation ( ) ; break ; case ASKUSER_SIGN_TRANSACTION : for ( i = 0 ; i < num_outputs_seen ; i ++ ) { printf ( " " ) ; printf ( " " , amount_list [ i ] ) ; printf ( " " ) ; printf ( " " , address_list [ i ] ) ; printf ( " " ) ; response = getUserConfirmation ( ) ; if ( response ) { break ; } } if ( ! response && transaction_fee_set ) { printf ( " " ) ; printf ( " " , transaction_fee_amount ) ; printf ( " \n " ) ; printf ( " " ) ; response = getUserConfirmation ( ) ; } break ; case ASKUSER_FORMAT : printf ( " " ) ; response = getUserConfirmation ( ) ; if ( ! response ) { printf ( " " ) ; response = getUserConfirmation ( ) ; if ( ! response ) { printf ( " " ) ; response = getUserConfirmation ( ) ; } } break ; default : printf ( " \n " ) ; response = true ; break ; } return response ; }
Ask user if they want to allow some action.
Ask user if they want to allow some action .
/*
                    All outputs must be approved in order for a transaction
                    to be signed. Thus if the user denies spending to one
                    output, the entire transaction is forfeit.
                    */ /* JUST ONE TRANSACTION FEE FOR ALL THE TRANSACTIONS? */