diff options
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | src/common.h | 1 | ||||
-rw-r--r-- | src/fe-common/core/chat-completion.c | 14 | ||||
-rw-r--r-- | src/fe-common/core/fe-server.c | 17 | ||||
-rw-r--r-- | src/fe-text/term-terminfo.c | 13 |
5 files changed, 46 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml index 804dc58c..b4b93919 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,15 @@ sudo: false +dist: trusty language: perl perl: - - "5.20-shrplib" - - "5.18-shrplib" + # ~stretch + - "5.24-shrplib" + # ~xenial + # - "5.22-shrplib" + # ~jessie + # - "5.20-shrplib" + # ~trusty + # - "5.18-shrplib" - "system-perl" env: - CC=clang diff --git a/src/common.h b/src/common.h index b6f9153e..ddbb1deb 100644 --- a/src/common.h +++ b/src/common.h @@ -9,6 +9,7 @@ #define IRSSI_ABI_VERSION 9 #define DEFAULT_SERVER_ADD_PORT 6667 +#define DEFAULT_SERVER_ADD_TLS_PORT 6697 #ifdef HAVE_CONFIG_H #include "irssi-config.h" diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index 1f00feaf..97cd0565 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -1011,13 +1011,17 @@ static void sig_complete_target(GList **list, WINDOW_REC *window, } } +static void event_text(const char *data, SERVER_REC *server, WI_ITEM_REC *item); + /* expand \n, \t and \\ */ static char *expand_escapes(const char *line, SERVER_REC *server, WI_ITEM_REC *item) { char *ptr, *ret; - int chr; + const char *prev; + int chr; + prev = line; ret = ptr = g_malloc(strlen(line)+1); for (; *line != '\0'; line++) { if (*line != '\\') { @@ -1036,9 +1040,11 @@ static char *expand_escapes(const char *line, SERVER_REC *server, /* newline .. we need to send another "send text" event to handle it (or actually the text before the newline..) */ - if (ret != ptr) { - *ptr = '\0'; - signal_emit("send text", 3, ret, server, item); + if (prev != line) { + char *prev_line = g_strndup(prev, (line - prev) - 1); + event_text(prev_line, server, item); + g_free(prev_line); + prev = line + 1; ptr = ret; } } else if (chr != -1) { diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index e8e9f33f..810afe83 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -117,7 +117,18 @@ static void cmd_server_add_modify(const char *data, gboolean add) return; if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - port = *portstr == '\0' ? DEFAULT_SERVER_ADD_PORT : atoi(portstr); + + value = g_hash_table_lookup(optlist, "port"); + + if (*portstr != '\0') + port = atoi(portstr); + else if (value != NULL && *value != '\0') + port = atoi(value); + else if (g_hash_table_lookup(optlist, "tls") || + g_hash_table_lookup(optlist, "ssl")) + port = DEFAULT_SERVER_ADD_TLS_PORT; + else + port = DEFAULT_SERVER_ADD_PORT; chatnet = g_hash_table_lookup(optlist, "network"); @@ -139,8 +150,8 @@ static void cmd_server_add_modify(const char *data, gboolean add) rec->address = g_strdup(addr); rec->port = port; } else { - value = g_hash_table_lookup(optlist, "port"); - if (value != NULL && *value != '\0') rec->port = atoi(value); + if (*portstr != '\0' || g_hash_table_lookup(optlist, "port")) + rec->port = port; if (*password != '\0') g_free_and_null(rec->password); if (g_hash_table_lookup(optlist, "host")) { diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 3098a4e4..bca37efc 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -102,6 +102,17 @@ static GSourceFuncs sigcont_funcs = { .dispatch = sigcont_dispatch }; +static void term_atexit(void) +{ + if (!quitting && current_term && current_term->TI_rmcup) { + /* Unexpected exit, avoid switching out of alternate screen + to keep any on-screen errors (like noperl_die()'s) */ + current_term->TI_rmcup = NULL; + } + + term_deinit(); +} + int term_init(void) { struct sigaction act; @@ -140,7 +151,7 @@ int term_init(void) term_set_input_type(TERM_TYPE_8BIT); term_common_init(); - atexit(term_deinit); + atexit(term_atexit); return TRUE; } |