diff --git a/ft.c b/ft.c index 267eb60..b3efe0f 100644 --- a/ft.c +++ b/ft.c @@ -88,11 +88,34 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state) { + static const struct _msg + { + LIB3270_FT_STATE state; + const char * text; + } msg[] = + { + { LIB3270_FT_STATE_NONE, N_( "No transfer in progress" ) }, + { LIB3270_FT_STATE_RUNNING, N_( "Ack received, data flowing" ) }, + { LIB3270_FT_STATE_ABORT_WAIT, N_( "Awaiting chance to send an abort" ) }, + { LIB3270_FT_STATE_ABORT_SENT, N_( "Abort sent; awaiting response" ) }, + }; + + int f; + if(session->state == state) return; session->state = state; session->state_changed(session,state); + for(f = 0; f < sizeof(msg)/sizeof(msg[0]);f++) + { + if(msg[f].state == state) + { + ft_message(session,msg[f].text); + break; + } + } + } void ft_init(H3270 *hSession) @@ -407,9 +430,9 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); lib3270_emulate_input(ft->host, buffer, strlen(buffer), False); if(ft->flags & LIB3270_FT_OPTION_RECEIVE) - ft->message(ft,N_( "Waiting for GET response" )); + ft_message(ft,N_( "Waiting for GET response" )); else - ft->message(ft,N_( "Waiting for PUT response" )); + ft_message(ft,N_( "Waiting for PUT response" )); return 0; @@ -417,6 +440,11 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); /* External entry points called by ft_dft and ft_cut. */ +void ft_message(H3270FT *ft, const char *msg) +{ + lib3270_trace_event(ft->host,"%s\n",msg); + ft->message(ft,msg); +} /** * Pop up a message, end the transfer, release resources. @@ -444,11 +472,11 @@ void ft_complete(H3270FT *ft, const char *errmsg) ft_update_length(ft); - if(errmsg) - ft->message(ft,errmsg); - ft->complete(ft,ft->ft_length,kbytes_sec); + ft_message(ft,errmsg ? errmsg : N_("Transfer complete")); + + } LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession) diff --git a/ftc.h b/ftc.h index b7442bc..6b12ea1 100644 --- a/ftc.h +++ b/ftc.h @@ -28,17 +28,13 @@ LIB3270_INTERNAL Boolean cr_flag; LIB3270_INTERNAL unsigned long ft_length; -// LIB3270_INTERNAL H3270FT * ftsession; - -// LIB3270_INTERNAL Boolean ft_last_cr; -// LIB3270_INTERNAL Boolean remap_flag; - LIB3270_INTERNAL H3270FT * get_ft_handle(H3270 *hSession); LIB3270_INTERNAL void ft_init(H3270 *hSession); LIB3270_INTERNAL void ft_aborting(H3270FT *h); LIB3270_INTERNAL void ft_complete(H3270FT *h, const char *errmsg); + LIB3270_INTERNAL void ft_message(H3270FT *h, const char *msg); LIB3270_INTERNAL void ft_running(H3270FT *h, Boolean is_cut); LIB3270_INTERNAL void ft_update_length(H3270FT *h); diff --git a/kybd.c b/kybd.c index 3d15120..e005723 100644 --- a/kybd.c +++ b/kybd.c @@ -88,9 +88,9 @@ struct ta; #include "api.h" -#ifdef DEBUG - #define KYBDLOCK_TRACE -#endif // DEBUG +//#ifdef DEBUG +// #define KYBDLOCK_TRACE +//#endif // DEBUG /* Statics */ // static enum { NONE, COMPOSE, FIRST } composing = NONE; -- libgit2 0.21.2