diff --git a/src/core/host.c b/src/core/host.c index 400c271..630b110 100644 --- a/src/core/host.c +++ b/src/core/host.c @@ -219,20 +219,22 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) trace("%s ends",__FUNCTION__); } -static void update_host(H3270 *h) +static void update_url(H3270 *hSession) { - Replace(h->host.full, + Replace(hSession->host.full, lib3270_strdup_printf( "%s%s:%s", #ifdef HAVE_LIBSSL - (h->ssl.enabled ? "tn3270s://" : "tn3270://"), + (hSession->ssl.enabled ? "tn3270s://" : "tn3270://"), #else "tn3270://", #endif // HAVE_LIBSSL - h->host.current, - h->host.srvc + hSession->host.current, + hSession->host.srvc )); + hSession->cbk.update_url(hSession, hSession->host.full); + } LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname) @@ -381,7 +383,7 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) } // Notifica atualização - update_host(h); + update_url(h); return 0; } @@ -398,7 +400,7 @@ LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname) { CHECK_SESSION_HANDLE(h); Replace(h->host.current,strdup(hostname)); - update_host(h); + update_url(h); } LIB3270_EXPORT const char * lib3270_get_srvcname(const H3270 *h) @@ -412,7 +414,7 @@ LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc) { CHECK_SESSION_HANDLE(h); Replace(h->host.srvc,strdup(srvc)); - update_host(h); + update_url(h); } LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h) diff --git a/src/core/session.c b/src/core/session.c index a46a0aa..da74682 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -273,6 +273,11 @@ static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_U { } +static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) +{ +} + + void lib3270_reset_callbacks(H3270 *hSession) { // Default calls @@ -306,6 +311,7 @@ void lib3270_reset_callbacks(H3270 *hSession) hSession->cbk.load = load; hSession->cbk.set_peer_certificate = set_peer_certificate; hSession->cbk.update_luname = default_update_luname; + hSession->cbk.update_url = default_update_url; } static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index c7134e7..4717bea 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -66,6 +66,7 @@ void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); void (*update_selection)(H3270 *session, int start, int end); void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state); + void (*update_url)(H3270 *session, const char *url); void (*set_timer)(H3270 *session, unsigned char on); void (*erase)(H3270 *session); -- libgit2 0.21.2