diff --git a/src/classlib/local.cc b/src/classlib/local.cc index bde2278..0ba7485 100644 --- a/src/classlib/local.cc +++ b/src/classlib/local.cc @@ -425,7 +425,7 @@ int set_host(const char *uri) { - return _set_host(hSession,uri) != NULL; + return _set_host(hSession,uri) != NULL ? 1 : 0; } int disconnect(void) diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 8d247cb..7c38555 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -419,6 +419,25 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); /** + * Get servic or port for the connect/reconnect operations. + * + * @param h Session handle. + * + * @return Pointer to service name (internal data, do not change it) + * + */ + LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h); + + + /** + * Get connection options. + * + * @param h Session handle. + * + */ + LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h); + + /** * Get URL of the hostname for the connect/reconnect operations. * * @param h Session handle. @@ -630,15 +649,6 @@ */ LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); - /** - * Check if the active connection is secure. - * - * @param h Session handle. - * - * @return Non 0 if the connection is SSL secured, 0 if not. - */ - LIB3270_EXPORT int lib3270_get_ssl_state(H3270 *h); - /** Callback table * * Structure with GUI unblocking I/O calls, used to replace the lib3270´s internal ones. diff --git a/src/lib3270/host.c b/src/lib3270/host.c index f4eabee..92b9bd6 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -582,6 +582,18 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) return h->host.current; } +LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h) +{ + CHECK_SESSION_HANDLE(h); + return h->host.srvc; +} + +LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h) +{ + CHECK_SESSION_HANDLE(h); + return h->host.opt; +} + LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) { CHECK_SESSION_HANDLE(h); diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 7e1bb25..6c59915 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -781,7 +781,7 @@ const char * plugin::asc2ebc(unsigned char *str, int sz) int plugin::set_host(const char *uri) { - return lib3270_set_host(hSession,uri) != NULL; + return lib3270_set_host(hSession,uri) != NULL ? 1 : 0; } const char * plugin::ebc2asc(unsigned char *str, int sz) diff --git a/src/pw3270/hostdialog.c b/src/pw3270/hostdialog.c index 123ba02..9153934 100644 --- a/src/pw3270/hostdialog.c +++ b/src/pw3270/hostdialog.c @@ -133,8 +133,8 @@ void hostname_action(GtkAction *action, GtkWidget *widget) { const gchar * title = g_object_get_data(G_OBJECT(action),"title"); - gchar * cfghost = get_string_from_config("host","uri",""); - gchar * hostname; +// gchar * cfghost = get_string_from_config("host","uri",""); +// gchar * hostname; gchar * ptr; gboolean again = TRUE; int iHostType = 0; @@ -353,6 +353,24 @@ gtk_widget_show_all(GTK_WIDGET(table)); #endif + gchar *uri = get_string_from_config("host","uri",""); + + if(uri && *uri && lib3270_set_host(v3270_get_session(widget),uri)) + { + H3270 *hSession = v3270_get_session(widget); + gtk_entry_set_text(host,lib3270_get_hostname(hSession)); + gtk_entry_set_text(port,lib3270_get_srvcname(hSession)); + gtk_toggle_button_set_active(sslcheck,(lib3270_get_connect_options(hSession) & LIB3270_CONNECT_OPTION_SSL) ? TRUE : FALSE); + } + else + { + gtk_entry_set_text(host,""); + gtk_entry_set_text(port,"telnet"); + } + + g_free(uri); + +/* hostname = cfghost; trace("hostname=[%s]",hostname); @@ -382,8 +400,7 @@ { gtk_entry_set_text(port,"23"); } - - gtk_entry_set_text(host,hostname); +*/ while(again) { @@ -430,7 +447,7 @@ #endif } - g_free(hostname); +// g_free(hostname); break; case GTK_RESPONSE_REJECT: @@ -441,6 +458,6 @@ gtk_widget_destroy(dialog); - g_free(cfghost); +// g_free(cfghost); } -- libgit2 0.21.2