Commit bfcf5f04d3153e05874abeabec7ae3bf869246a6
1 parent
e295905b
Exists in
master
and in
5 other branches
Implementando novo mecanismo de conexao
Showing
16 changed files
with
68 additions
and
113 deletions
Show diff stats
src/classlib/local.cc
@@ -279,7 +279,8 @@ | @@ -279,7 +279,8 @@ | ||
279 | const char * (*_get_version)(void); | 279 | const char * (*_get_version)(void); |
280 | LIB3270_CSTATE (*_get_connection_state)(H3270 *h); | 280 | LIB3270_CSTATE (*_get_connection_state)(H3270 *h); |
281 | int (*_disconnect)(H3270 *h); | 281 | int (*_disconnect)(H3270 *h); |
282 | - int (*_connect)(H3270 *h,const char *n, int wait); | 282 | + int (*_connect)(H3270 *h,int wait); |
283 | + const char (*_set_host)(H3270 *h, const char *n); | ||
283 | int (*_is_connected)(H3270 *h); | 284 | int (*_is_connected)(H3270 *h); |
284 | void (*_main_iterate)(H3270 *h, int wait); | 285 | void (*_main_iterate)(H3270 *h, int wait); |
285 | int (*_wait)(H3270 *hSession, int seconds); | 286 | int (*_wait)(H3270 *hSession, int seconds); |
@@ -334,6 +335,7 @@ | @@ -334,6 +335,7 @@ | ||
334 | { (void **) & _get_version, "lib3270_get_version" }, | 335 | { (void **) & _get_version, "lib3270_get_version" }, |
335 | { (void **) & _disconnect, "lib3270_disconnect" }, | 336 | { (void **) & _disconnect, "lib3270_disconnect" }, |
336 | { (void **) & _connect, "lib3270_connect" }, | 337 | { (void **) & _connect, "lib3270_connect" }, |
338 | + { (void **) & _set_host, "lib3270_set_host" }, | ||
337 | { (void **) & _main_iterate, "lib3270_main_iterate" }, | 339 | { (void **) & _main_iterate, "lib3270_main_iterate" }, |
338 | { (void **) & _wait, "lib3270_wait" }, | 340 | { (void **) & _wait, "lib3270_wait" }, |
339 | { (void **) & _enter, "lib3270_enter" }, | 341 | { (void **) & _enter, "lib3270_enter" }, |
@@ -416,9 +418,14 @@ | @@ -416,9 +418,14 @@ | ||
416 | return _get_connection_state(hSession); | 418 | return _get_connection_state(hSession); |
417 | } | 419 | } |
418 | 420 | ||
419 | - int connect(const char *uri, bool wait) | 421 | + int connect(bool wait) |
420 | { | 422 | { |
421 | - return _connect(hSession,uri,(int) wait); | 423 | + return _connect(hSession,(int) wait); |
424 | + } | ||
425 | + | ||
426 | + int set_host(const char *uri) | ||
427 | + { | ||
428 | + return _set_host(hSession,uri) != NULL; | ||
422 | } | 429 | } |
423 | 430 | ||
424 | int disconnect(void) | 431 | int disconnect(void) |
src/classlib/remote.cc
@@ -651,7 +651,7 @@ | @@ -651,7 +651,7 @@ | ||
651 | return (LIB3270_CSTATE) query_intval(HLLAPI_PACKET_GET_CSTATE); | 651 | return (LIB3270_CSTATE) query_intval(HLLAPI_PACKET_GET_CSTATE); |
652 | } | 652 | } |
653 | 653 | ||
654 | - int connect(const char *uri, bool wait) | 654 | + int connect(bool wait) |
655 | { | 655 | { |
656 | #if defined(WIN32) | 656 | #if defined(WIN32) |
657 | 657 | ||
@@ -660,9 +660,6 @@ | @@ -660,9 +660,6 @@ | ||
660 | 660 | ||
661 | pkt->packet_id = HLLAPI_PACKET_CONNECT; | 661 | pkt->packet_id = HLLAPI_PACKET_CONNECT; |
662 | pkt->wait = (unsigned char) wait; | 662 | pkt->wait = (unsigned char) wait; |
663 | - strcpy(pkt->hostname,uri); | ||
664 | - | ||
665 | - trace("Sending %s",pkt->hostname); | ||
666 | 663 | ||
667 | return query_intval((void *) pkt,cbSize,true); | 664 | return query_intval((void *) pkt,cbSize,true); |
668 | 665 |
src/include/lib3270.h
@@ -421,17 +421,13 @@ | @@ -421,17 +421,13 @@ | ||
421 | /** | 421 | /** |
422 | * Network connect operation, keep main loop running | 422 | * Network connect operation, keep main loop running |
423 | * | 423 | * |
424 | - * Sets 'reconnect_host', 'current_host' and 'full_current_host' as | ||
425 | - * side-effects. | ||
426 | - * | ||
427 | * @param h Session handle. | 424 | * @param h Session handle. |
428 | - * @param n Host ID (NULL to use the last one) | ||
429 | * @param wait Non zero to wait for connection to be ok. | 425 | * @param wait Non zero to wait for connection to be ok. |
430 | * | 426 | * |
431 | * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. | 427 | * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. |
432 | * | 428 | * |
433 | */ | 429 | */ |
434 | - LIB3270_EXPORT int lib3270_connect(H3270 *h,const char *n, int wait); | 430 | + LIB3270_EXPORT int lib3270_connect(H3270 *h,int wait); |
435 | 431 | ||
436 | /** | 432 | /** |
437 | * Connect to defined host, keep main loop running. | 433 | * Connect to defined host, keep main loop running. |
@@ -456,14 +452,6 @@ | @@ -456,14 +452,6 @@ | ||
456 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h); | 452 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h); |
457 | 453 | ||
458 | /** | 454 | /** |
459 | - * Reconnect. | ||
460 | - * | ||
461 | - * @param h Session handle. | ||
462 | - * @param wait Non zero to wait for connection to be ok. | ||
463 | - */ | ||
464 | - LIB3270_EXPORT int lib3270_reconnect(H3270 *h,int wait); | ||
465 | - | ||
466 | - /** | ||
467 | * Get connection state. | 455 | * Get connection state. |
468 | * | 456 | * |
469 | * @param h Session handle. | 457 | * @param h Session handle. |
src/include/pw3270/class.h
@@ -128,7 +128,8 @@ | @@ -128,7 +128,8 @@ | ||
128 | virtual string * get_display_charset(void); | 128 | virtual string * get_display_charset(void); |
129 | 129 | ||
130 | // Connection & Network | 130 | // Connection & Network |
131 | - virtual int connect(const char *uri, bool wait = true) = 0; | 131 | + virtual int connect(bool wait = true) = 0; |
132 | + virtual int set_host(const char *hostname) = 0; | ||
132 | virtual int disconnect(void) = 0; | 133 | virtual int disconnect(void) = 0; |
133 | virtual int wait_for_ready(int seconds) = 0; | 134 | virtual int wait_for_ready(int seconds) = 0; |
134 | virtual int wait(int seconds) = 0; | 135 | virtual int wait(int seconds) = 0; |
src/include/pw3270/ipcpackets.h
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | typedef enum _hllapi_packet | 30 | typedef enum _hllapi_packet |
31 | { | 31 | { |
32 | HLLAPI_PACKET_CONNECT, | 32 | HLLAPI_PACKET_CONNECT, |
33 | + HLLAPI_PACKET_SET_HOST, | ||
33 | HLLAPI_PACKET_DISCONNECT, | 34 | HLLAPI_PACKET_DISCONNECT, |
34 | HLLAPI_PACKET_GET_PROGRAM_MESSAGE, | 35 | HLLAPI_PACKET_GET_PROGRAM_MESSAGE, |
35 | HLLAPI_PACKET_GET_TEXT_AT_OFFSET, | 36 | HLLAPI_PACKET_GET_TEXT_AT_OFFSET, |
@@ -90,7 +91,6 @@ struct hllapi_packet_connect | @@ -90,7 +91,6 @@ struct hllapi_packet_connect | ||
90 | { | 91 | { |
91 | unsigned char packet_id; | 92 | unsigned char packet_id; |
92 | unsigned char wait; | 93 | unsigned char wait; |
93 | - char hostname[1]; | ||
94 | }; | 94 | }; |
95 | 95 | ||
96 | struct hllapi_packet_keycode | 96 | struct hllapi_packet_keycode |
src/lib3270/api.h
@@ -324,8 +324,8 @@ | @@ -324,8 +324,8 @@ | ||
324 | 324 | ||
325 | #include <lib3270/actions.h> | 325 | #include <lib3270/actions.h> |
326 | 326 | ||
327 | - #define host_connect(n,wait) lib3270_connect(NULL,n,wait) | ||
328 | - #define host_reconnect(w) lib3270_reconnect(NULL,w) | 327 | + // #define host_connect(n,wait) lib3270_connect(NULL,n,wait) |
328 | + // #define host_reconnect(w) lib3270_reconnect(NULL,w) | ||
329 | 329 | ||
330 | 330 | ||
331 | #ifdef __cplusplus | 331 | #ifdef __cplusplus |
src/lib3270/connect.c
@@ -201,7 +201,7 @@ static void net_connected(H3270 *hSession) | @@ -201,7 +201,7 @@ static void net_connected(H3270 *hSession) | ||
201 | sockstart(hSession); | 201 | sockstart(hSession); |
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | - hSession->host.opt = opt; | 204 | + hSession->host.opt = opt & ~LIB3270_CONNECT_OPTION_WAIT; |
205 | Replace(hSession->host.current,strdup(hostname)); | 205 | Replace(hSession->host.current,strdup(hostname)); |
206 | 206 | ||
207 | Replace(hSession->host.full, | 207 | Replace(hSession->host.full, |
src/lib3270/host.c
@@ -457,17 +457,7 @@ static int do_connect(H3270 *hSession) | @@ -457,17 +457,7 @@ static int do_connect(H3270 *hSession) | ||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
460 | -/** | ||
461 | - * Connect to selected host. | ||
462 | - * | ||
463 | - * @param h Session handle. | ||
464 | - * @param n Hostname (null to reconnect to the last one; | ||
465 | - * @param wait Wait for connection ok before return. | ||
466 | - * | ||
467 | - * @return 0 if the connection was ok, non zero on error. | ||
468 | - * | ||
469 | - */ | ||
470 | -int lib3270_connect(H3270 *hSession, const char *n, int wait) | 460 | +int lib3270_connect(H3270 *hSession, int wait) |
471 | { | 461 | { |
472 | int rc; | 462 | int rc; |
473 | 463 | ||
@@ -475,18 +465,18 @@ int lib3270_connect(H3270 *hSession, const char *n, int wait) | @@ -475,18 +465,18 @@ int lib3270_connect(H3270 *hSession, const char *n, int wait) | ||
475 | 465 | ||
476 | lib3270_main_iterate(hSession,0); | 466 | lib3270_main_iterate(hSession,0); |
477 | 467 | ||
478 | - if(hSession->auto_reconnect_inprogress) | ||
479 | - return EAGAIN; | ||
480 | - | ||
481 | - if(PCONNECTED) | 468 | + if (CONNECTED || HALF_CONNECTED) |
482 | return EBUSY; | 469 | return EBUSY; |
483 | 470 | ||
484 | - if(n) | ||
485 | - lib3270_set_host(hSession,n); | ||
486 | - | ||
487 | if(!hSession->host.full) | 471 | if(!hSession->host.full) |
488 | return EINVAL; | 472 | return EINVAL; |
489 | 473 | ||
474 | + if (hSession->auto_reconnect_inprogress) | ||
475 | + return EBUSY; | ||
476 | + | ||
477 | + if(PCONNECTED) | ||
478 | + return EBUSY; | ||
479 | + | ||
490 | rc = do_connect(hSession); | 480 | rc = do_connect(hSession); |
491 | if(rc) | 481 | if(rc) |
492 | return rc; | 482 | return rc; |
@@ -514,7 +504,7 @@ static void try_reconnect(H3270 *session) | @@ -514,7 +504,7 @@ static void try_reconnect(H3270 *session) | ||
514 | { | 504 | { |
515 | lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->host.full ? session->host.full : "-"); | 505 | lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->host.full ? session->host.full : "-"); |
516 | session->auto_reconnect_inprogress = 0; | 506 | session->auto_reconnect_inprogress = 0; |
517 | - lib3270_reconnect(session,0); | 507 | + lib3270_connect(session,0); |
518 | } | 508 | } |
519 | 509 | ||
520 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) | 510 | LIB3270_EXPORT int lib3270_disconnect(H3270 *h) |
@@ -689,8 +679,6 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | @@ -689,8 +679,6 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | ||
689 | } | 679 | } |
690 | } | 680 | } |
691 | 681 | ||
692 | - trace("SRVC=[%s]",srvc); | ||
693 | - | ||
694 | if(!*hostname) | 682 | if(!*hostname) |
695 | return h->host.current; | 683 | return h->host.current; |
696 | 684 | ||
@@ -709,18 +697,22 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | @@ -709,18 +697,22 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) | ||
709 | query = ""; | 697 | query = ""; |
710 | } | 698 | } |
711 | 699 | ||
700 | + trace("SRVC=[%s]",srvc); | ||
701 | + | ||
712 | Replace(h->host.current,strdup(hostname)); | 702 | Replace(h->host.current,strdup(hostname)); |
713 | Replace(h->host.srvc,strdup(srvc)); | 703 | Replace(h->host.srvc,strdup(srvc)); |
714 | Replace(h->host.full, | 704 | Replace(h->host.full, |
715 | lib3270_strdup_printf( | 705 | lib3270_strdup_printf( |
716 | "%s%s:%s%s%s", | 706 | "%s%s:%s%s%s", |
717 | - h->host.opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "", | 707 | + h->host.opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://", |
718 | hostname, | 708 | hostname, |
719 | srvc, | 709 | srvc, |
720 | *query ? "?" : "", | 710 | *query ? "?" : "", |
721 | query | 711 | query |
722 | )); | 712 | )); |
723 | 713 | ||
714 | + trace("hosturl=[%s]",h->host.full); | ||
715 | + | ||
724 | free(str); | 716 | free(str); |
725 | } | 717 | } |
726 | 718 | ||
@@ -733,6 +725,7 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) | @@ -733,6 +725,7 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) | ||
733 | return h->host.current; | 725 | return h->host.current; |
734 | } | 726 | } |
735 | 727 | ||
728 | +/* | ||
736 | LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) | 729 | LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) |
737 | { | 730 | { |
738 | int rc; | 731 | int rc; |
@@ -742,13 +735,13 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) | @@ -742,13 +735,13 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) | ||
742 | if (CONNECTED || HALF_CONNECTED) | 735 | if (CONNECTED || HALF_CONNECTED) |
743 | return EBUSY; | 736 | return EBUSY; |
744 | 737 | ||
745 | - if (hSession->host.full == CN) | 738 | + if (!hSession->host.full) |
746 | return EINVAL; | 739 | return EINVAL; |
747 | 740 | ||
748 | if (hSession->auto_reconnect_inprogress) | 741 | if (hSession->auto_reconnect_inprogress) |
749 | return EBUSY; | 742 | return EBUSY; |
750 | 743 | ||
751 | - rc = lib3270_connect(hSession,hSession->host.full,wait); | 744 | + rc = lib3270_connect(hSession,wait); |
752 | 745 | ||
753 | if(rc) | 746 | if(rc) |
754 | { | 747 | { |
@@ -758,6 +751,7 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) | @@ -758,6 +751,7 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) | ||
758 | 751 | ||
759 | return 0; | 752 | return 0; |
760 | } | 753 | } |
754 | +*/ | ||
761 | 755 | ||
762 | LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h) | 756 | LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h) |
763 | { | 757 | { |
src/lib3270/macros.c
@@ -254,15 +254,17 @@ | @@ -254,15 +254,17 @@ | ||
254 | switch(argc) | 254 | switch(argc) |
255 | { | 255 | { |
256 | case 1: | 256 | case 1: |
257 | - rc = lib3270_reconnect(hSession,0); | 257 | + rc = lib3270_connect(hSession,0); |
258 | break; | 258 | break; |
259 | 259 | ||
260 | case 2: | 260 | case 2: |
261 | - rc = lib3270_connect(hSession,argv[1],0); | 261 | + lib3270_set_host(hSession,argv[1]); |
262 | + rc = lib3270_connect(hSession,0); | ||
262 | break; | 263 | break; |
263 | 264 | ||
264 | case 3: | 265 | case 3: |
265 | - rc = lib3270_connect(hSession,argv[1],atoi(argv[2])); | 266 | + lib3270_set_host(hSession,argv[1]); |
267 | + rc = lib3270_connect(hSession,atoi(argv[2])); | ||
266 | break; | 268 | break; |
267 | 269 | ||
268 | default: | 270 | default: |
src/plugins/hllapi/calls.cc
@@ -100,7 +100,9 @@ | @@ -100,7 +100,9 @@ | ||
100 | 100 | ||
101 | try | 101 | try |
102 | { | 102 | { |
103 | - rc = session::get_default()->connect(uri,wait); | 103 | + if(uri && *uri) |
104 | + session::get_default()->set_host(uri); | ||
105 | + rc = session::get_default()->connect(wait); | ||
104 | } | 106 | } |
105 | catch(std::exception &e) | 107 | catch(std::exception &e) |
106 | { | 108 | { |
src/plugins/hllapi/pluginmain.c
@@ -197,7 +197,6 @@ | @@ -197,7 +197,6 @@ | ||
197 | { | 197 | { |
198 | case HLLAPI_PACKET_CONNECT: | 198 | case HLLAPI_PACKET_CONNECT: |
199 | send_result(source,lib3270_connect( lib3270_get_default_session_handle(), | 199 | send_result(source,lib3270_connect( lib3270_get_default_session_handle(), |
200 | - ((struct hllapi_packet_connect *) source->buffer)->hostname, | ||
201 | ((struct hllapi_packet_connect *) source->buffer)->wait)); | 200 | ((struct hllapi_packet_connect *) source->buffer)->wait)); |
202 | break; | 201 | break; |
203 | 202 |
src/plugins/rx3270/pluginmain.cc
@@ -89,7 +89,7 @@ | @@ -89,7 +89,7 @@ | ||
89 | const string get_version(void); | 89 | const string get_version(void); |
90 | LIB3270_CSTATE get_cstate(void); | 90 | LIB3270_CSTATE get_cstate(void); |
91 | int disconnect(void); | 91 | int disconnect(void); |
92 | - int connect(const char *uri, bool wait = true); | 92 | + int connect(bool wait = true); |
93 | bool is_connected(void); | 93 | bool is_connected(void); |
94 | bool is_ready(void); | 94 | bool is_ready(void); |
95 | 95 | ||
@@ -542,9 +542,9 @@ extern "C" | @@ -542,9 +542,9 @@ extern "C" | ||
542 | return 0; | 542 | return 0; |
543 | } | 543 | } |
544 | 544 | ||
545 | - int plugin::connect(const char *uri, bool wait) | 545 | + int plugin::connect(bool wait) |
546 | { | 546 | { |
547 | - return lib3270_connect(hSession,uri,wait); | 547 | + return lib3270_connect(hSession,wait); |
548 | } | 548 | } |
549 | 549 | ||
550 | bool plugin::is_connected(void) | 550 | bool plugin::is_connected(void) |
src/plugins/rx3270/rexx_methods.cc
@@ -100,7 +100,11 @@ RexxMethod3(int, rx3270_method_connect, CSELF, sessionPtr, CSTRING, uri, OPTIONA | @@ -100,7 +100,11 @@ RexxMethod3(int, rx3270_method_connect, CSELF, sessionPtr, CSTRING, uri, OPTIONA | ||
100 | session *hSession = (session *) sessionPtr; | 100 | session *hSession = (session *) sessionPtr; |
101 | if(!hSession) | 101 | if(!hSession) |
102 | return -1; | 102 | return -1; |
103 | - return hSession->connect(uri,wait != 0); | 103 | + |
104 | + if(uri) | ||
105 | + hSession->set_hostname(uri); | ||
106 | + | ||
107 | + return hSession->connect(wait != 0); | ||
104 | } | 108 | } |
105 | 109 | ||
106 | RexxMethod1(int, rx3270_method_disconnect, CSELF, sessionPtr) | 110 | RexxMethod1(int, rx3270_method_disconnect, CSELF, sessionPtr) |
src/plugins/rx3270/typed_routines.cc
@@ -93,7 +93,12 @@ RexxRoutine0(int, rx3270Disconnect) | @@ -93,7 +93,12 @@ RexxRoutine0(int, rx3270Disconnect) | ||
93 | 93 | ||
94 | RexxRoutine2(int, rx3270Connect, CSTRING, hostname, int, wait) | 94 | RexxRoutine2(int, rx3270Connect, CSTRING, hostname, int, wait) |
95 | { | 95 | { |
96 | - return session::get_default()->connect(hostname,wait); | 96 | + session * hSession = session::get_default(); |
97 | + | ||
98 | + if(hostname && *hostname) | ||
99 | + hSession->set_hostname(hostname); | ||
100 | + | ||
101 | + return hSession->connect(wait); | ||
97 | } | 102 | } |
98 | 103 | ||
99 | RexxRoutine0(int, rx3270isConnected) | 104 | RexxRoutine0(int, rx3270isConnected) |
src/pw3270/hostdialog.c
@@ -393,12 +393,14 @@ | @@ -393,12 +393,14 @@ | ||
393 | case GTK_RESPONSE_ACCEPT: | 393 | case GTK_RESPONSE_ACCEPT: |
394 | gtk_widget_set_sensitive(dialog,FALSE); | 394 | gtk_widget_set_sensitive(dialog,FALSE); |
395 | 395 | ||
396 | + /* | ||
396 | hostname = g_strconcat( gtk_toggle_button_get_active(sslcheck) ? "L:" : "", | 397 | hostname = g_strconcat( gtk_toggle_button_get_active(sslcheck) ? "L:" : "", |
397 | gtk_entry_get_text(host), | 398 | gtk_entry_get_text(host), |
398 | ":", | 399 | ":", |
399 | gtk_entry_get_text(port), | 400 | gtk_entry_get_text(port), |
400 | NULL | 401 | NULL |
401 | ); | 402 | ); |
403 | + */ | ||
402 | 404 | ||
403 | #if GTK_CHECK_VERSION(2,18,0) | 405 | #if GTK_CHECK_VERSION(2,18,0) |
404 | gtk_widget_set_visible(dialog,FALSE); | 406 | gtk_widget_set_visible(dialog,FALSE); |
@@ -411,7 +413,11 @@ | @@ -411,7 +413,11 @@ | ||
411 | v3270_set_session_options(widget,host_type[iHostType].option); | 413 | v3270_set_session_options(widget,host_type[iHostType].option); |
412 | v3270_set_session_color_type(widget,colortable[iColorTable].colors); | 414 | v3270_set_session_color_type(widget,colortable[iColorTable].colors); |
413 | 415 | ||
414 | - if(!lib3270_connect(v3270_get_session(widget),hostname,1)) | 416 | +// if(!lib3270_connect(v3270_get_session(widget),hostname,1)) |
417 | + if(!lib3270_connect_host( v3270_get_session(widget), | ||
418 | + gtk_entry_get_text(host), | ||
419 | + gtk_entry_get_text(port), | ||
420 | + gtk_toggle_button_get_active(sslcheck) ? LIB3270_CONNECT_OPTION_SSL : LIB3270_CONNECT_OPTION_DEFAULTS)) | ||
415 | { | 421 | { |
416 | again = FALSE; | 422 | again = FALSE; |
417 | } | 423 | } |
src/pw3270/v3270/widget.c
@@ -1400,64 +1400,14 @@ int v3270_connect(GtkWidget *widget, const gchar *uri) | @@ -1400,64 +1400,14 @@ int v3270_connect(GtkWidget *widget, const gchar *uri) | ||
1400 | 1400 | ||
1401 | terminal = GTK_V3270(widget); | 1401 | terminal = GTK_V3270(widget); |
1402 | 1402 | ||
1403 | -#ifdef DEBUG | ||
1404 | if(uri) | 1403 | if(uri) |
1405 | { | 1404 | { |
1406 | - LIB3270_CONNECT_OPTION opt = LIB3270_CONNECT_OPTION_DEFAULTS; | ||
1407 | - gchar * scheme = g_uri_unescape_string(uri,NULL); | ||
1408 | - gchar * hostname = strchr(scheme,':'); | ||
1409 | - gchar * srvc; | ||
1410 | - gchar * query; | ||
1411 | - | ||
1412 | - if(hostname) | ||
1413 | - { | ||
1414 | - *(hostname++) = 0; | ||
1415 | - | ||
1416 | - while(*hostname && !g_ascii_isalnum(*hostname)) | ||
1417 | - hostname++; | ||
1418 | - | ||
1419 | - if(*hostname) | ||
1420 | - { | ||
1421 | - if( ! (g_ascii_strcasecmp(scheme,"l") && g_ascii_strcasecmp(scheme,"ssl")) ) | ||
1422 | - opt |= LIB3270_CONNECT_OPTION_SSL; | ||
1423 | - | ||
1424 | - srvc = strchr(hostname,':'); | ||
1425 | - if(srvc) | ||
1426 | - { | ||
1427 | - *(srvc++) = 0; | ||
1428 | - query = strchr(srvc,'?'); | ||
1429 | - if(query) | ||
1430 | - *(query++) = 0; | ||
1431 | - else | ||
1432 | - query = ""; | ||
1433 | - } | ||
1434 | - else | ||
1435 | - { | ||
1436 | - srvc = "telnet"; | ||
1437 | - } | ||
1438 | - | ||
1439 | - rc = lib3270_connect_host(terminal->host,hostname,srvc,opt); | ||
1440 | - | ||
1441 | - } | ||
1442 | - | ||
1443 | - } | ||
1444 | - | ||
1445 | - | ||
1446 | - g_free(scheme); | ||
1447 | - | ||
1448 | - } | ||
1449 | - else | ||
1450 | - { | ||
1451 | - rc = lib3270_connect(terminal->host,uri,0); | 1405 | + trace("%s(%s)",__FUNCTION__,uri); |
1406 | + lib3270_set_host(terminal->host,uri); | ||
1452 | } | 1407 | } |
1453 | 1408 | ||
1454 | -#else | ||
1455 | - rc = lib3270_connect(terminal->host,uri,0); | ||
1456 | -#endif // DEBUG | ||
1457 | - | ||
1458 | - trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); | 1409 | + return lib3270_connect(terminal->host,0); |
1459 | 1410 | ||
1460 | - return rc; | ||
1461 | } | 1411 | } |
1462 | 1412 | ||
1463 | static gboolean notify_focus(GtkWidget *widget, GdkEventFocus *event) | 1413 | static gboolean notify_focus(GtkWidget *widget, GdkEventFocus *event) |