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/completion.c | 25 | ||||
-rw-r--r-- | src/fe-common/core/fe-server.c | 17 | ||||
-rw-r--r-- | src/fe-text/term-terminfo.c | 13 |
6 files changed, 66 insertions, 15 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/completion.c b/src/fe-common/core/completion.c index a97adc21..78b1b24b 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -137,8 +137,9 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i int old_startpos, old_wordlen; GString *result; - char *word, *wordstart, *linestart, *ret; - int continue_complete, want_space; + const char *cmdchars; + char *word, *wordstart, *linestart, *ret, *data; + int continue_complete, want_space, expand_escapes; g_return_val_if_fail(line != NULL, NULL); g_return_val_if_fail(pos != NULL, NULL); @@ -241,14 +242,24 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i if (complist == NULL) return NULL; + /* get the cmd char */ + cmdchars = settings_get_str("cmdchars"); + + /* get the expand_escapes setting */ + expand_escapes = settings_get_bool("expand_escapes"); + + /* escape if the word doesn't begin with '/' and expand_escapes are turned on */ + data = strchr(cmdchars, *line) == NULL && expand_escapes ? + escape_string(complist->data) : g_strdup(complist->data); + /* word completed */ - *pos = startpos+strlen(complist->data); + *pos = startpos + strlen(data); /* replace the word in line - we need to return a full new line */ result = g_string_new(line); g_string_erase(result, startpos, wordlen); - g_string_insert(result, startpos, complist->data); + g_string_insert(result, startpos, data); if (want_space) { if (!isseparator(result->str[*pos])) @@ -256,13 +267,17 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i (*pos)++; } - wordlen = strlen(complist->data); + wordlen = strlen(data); last_line_pos = *pos; g_free_not_null(last_line); last_line = g_strdup(result->str); ret = result->str; g_string_free(result, FALSE); + + /* free the data */ + g_free(data); + return ret; } 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; } |