Commit 65847bff3e2dd3525e7efee77793b51efef2afec
Exists in
master
and in
3 other branches
Merge branch 'master'
Showing
3 changed files
with
17 additions
and
8 deletions
Show diff stats
src/core/host.c
... | ... | @@ -219,20 +219,22 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
219 | 219 | trace("%s ends",__FUNCTION__); |
220 | 220 | } |
221 | 221 | |
222 | -static void update_host(H3270 *h) | |
222 | +static void update_url(H3270 *hSession) | |
223 | 223 | { |
224 | - Replace(h->host.full, | |
224 | + Replace(hSession->host.full, | |
225 | 225 | lib3270_strdup_printf( |
226 | 226 | "%s%s:%s", |
227 | 227 | #ifdef HAVE_LIBSSL |
228 | - (h->ssl.enabled ? "tn3270s://" : "tn3270://"), | |
228 | + (hSession->ssl.enabled ? "tn3270s://" : "tn3270://"), | |
229 | 229 | #else |
230 | 230 | "tn3270://", |
231 | 231 | #endif // HAVE_LIBSSL |
232 | - h->host.current, | |
233 | - h->host.srvc | |
232 | + hSession->host.current, | |
233 | + hSession->host.srvc | |
234 | 234 | )); |
235 | 235 | |
236 | + hSession->cbk.update_url(hSession, hSession->host.full); | |
237 | + | |
236 | 238 | } |
237 | 239 | |
238 | 240 | 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) |
381 | 383 | } |
382 | 384 | |
383 | 385 | // Notifica atualização |
384 | - update_host(h); | |
386 | + update_url(h); | |
385 | 387 | |
386 | 388 | return 0; |
387 | 389 | } |
... | ... | @@ -398,7 +400,7 @@ LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname) |
398 | 400 | { |
399 | 401 | CHECK_SESSION_HANDLE(h); |
400 | 402 | Replace(h->host.current,strdup(hostname)); |
401 | - update_host(h); | |
403 | + update_url(h); | |
402 | 404 | } |
403 | 405 | |
404 | 406 | 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) |
412 | 414 | { |
413 | 415 | CHECK_SESSION_HANDLE(h); |
414 | 416 | Replace(h->host.srvc,strdup(srvc)); |
415 | - update_host(h); | |
417 | + update_url(h); | |
416 | 418 | } |
417 | 419 | |
418 | 420 | LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h) | ... | ... |
src/core/session.c
... | ... | @@ -276,6 +276,11 @@ static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_U |
276 | 276 | { |
277 | 277 | } |
278 | 278 | |
279 | +static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) | |
280 | +{ | |
281 | +} | |
282 | + | |
283 | + | |
279 | 284 | void lib3270_reset_callbacks(H3270 *hSession) |
280 | 285 | { |
281 | 286 | // Default calls |
... | ... | @@ -309,6 +314,7 @@ void lib3270_reset_callbacks(H3270 *hSession) |
309 | 314 | hSession->cbk.load = load; |
310 | 315 | hSession->cbk.set_peer_certificate = set_peer_certificate; |
311 | 316 | hSession->cbk.update_luname = default_update_luname; |
317 | + hSession->cbk.update_url = default_update_url; | |
312 | 318 | } |
313 | 319 | |
314 | 320 | static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) | ... | ... |
src/include/lib3270/session.h
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); |
67 | 67 | void (*update_selection)(H3270 *session, int start, int end); |
68 | 68 | void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state); |
69 | + void (*update_url)(H3270 *session, const char *url); | |
69 | 70 | |
70 | 71 | void (*set_timer)(H3270 *session, unsigned char on); |
71 | 72 | void (*erase)(H3270 *session); | ... | ... |