Commit 83226739d056dc46516615f2e5f449f069ac05d6

Authored by Perry Werneck
1 parent 32077591

Preventing emit of "save-settings" signal on v3270 when the host URL is

set to the same value.
Showing 1 changed file with 15 additions and 2 deletions   Show diff stats
src/core/host.c
@@ -248,7 +248,7 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) @@ -248,7 +248,7 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode)
248 248
249 static void update_url(H3270 *hSession) 249 static void update_url(H3270 *hSession)
250 { 250 {
251 - Replace(hSession->host.url, 251 + char * url =
252 lib3270_strdup_printf( 252 lib3270_strdup_printf(
253 "%s%s:%s", 253 "%s%s:%s",
254 #ifdef HAVE_LIBSSL 254 #ifdef HAVE_LIBSSL
@@ -258,7 +258,20 @@ static void update_url(H3270 *hSession) @@ -258,7 +258,20 @@ static void update_url(H3270 *hSession)
258 #endif // HAVE_LIBSSL 258 #endif // HAVE_LIBSSL
259 hSession->host.current, 259 hSession->host.current,
260 hSession->host.srvc 260 hSession->host.srvc
261 - )); 261 + );
  262 +
  263 + if(hSession->host.url && !strcmp(hSession->host.url,url))
  264 + {
  265 + debug("%s: Same url, ignoring",__FUNCTION__);
  266 + lib3270_free(url);
  267 + return;
  268 + }
  269 +
  270 + debug("URL %s -> %s",hSession->host.url,url);
  271 +
  272 + lib3270_write_event_trace(hSession,"Host URL was changed\nFrom: %s\nTo: %s\n",hSession->host.url,url);
  273 + lib3270_free(hSession->host.url);
  274 + hSession->host.url = url;
262 275
263 #ifdef SSL_ENABLE_CRL_CHECK 276 #ifdef SSL_ENABLE_CRL_CHECK
264 lib3270_crl_free(hSession); 277 lib3270_crl_free(hSession);