summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/core/completion.c2
-rw-r--r--src/fe-common/core/fe-common-core.c11
-rw-r--r--src/fe-common/core/fe-settings.c2
-rw-r--r--src/fe-text/gui-entry.c3
-rw-r--r--src/fe-text/term-terminfo.c8
-rw-r--r--src/fe-text/terminfo-core.c31
-rw-r--r--src/fe-text/terminfo-core.h3
-rw-r--r--src/irc/core/irc-servers.c18
-rw-r--r--src/irc/core/sasl.c22
-rw-r--r--src/irc/dcc/dcc.c4
10 files changed, 71 insertions, 33 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 1e7833a4..861054b5 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -762,7 +762,7 @@ static void cmd_completion(const char *data)
int len;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS |
- PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS,
+ PARAM_FLAG_GETREST,
"completion", &optlist, &key, &value))
return;
diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c
index ee7f9424..1b2ab1e2 100644
--- a/src/fe-common/core/fe-common-core.c
+++ b/src/fe-common/core/fe-common-core.c
@@ -459,15 +459,24 @@ gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest)
{
g_return_val_if_fail(array != NULL, FALSE);
+ if (strarray_find(array, "*") != -1)
+ return TRUE;
+
if (strarray_find(array, dest->target) != -1)
return TRUE;
if (dest->server_tag != NULL) {
- char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
+ char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, "*");
int ret = strarray_find(array, tagtarget);
g_free(tagtarget);
if (ret != -1)
return TRUE;
+
+ tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
+ ret = strarray_find(array, tagtarget);
+ g_free(tagtarget);
+ if (ret != -1)
+ return TRUE;
}
return FALSE;
}
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c
index 3bb43bf7..b689cbf9 100644
--- a/src/fe-common/core/fe-settings.c
+++ b/src/fe-common/core/fe-settings.c
@@ -109,7 +109,7 @@ static void cmd_set(char *data)
SETTINGS_REC *rec;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
- PARAM_FLAG_OPTIONS | PARAM_FLAG_STRIP_TRAILING_WS,
+ PARAM_FLAG_OPTIONS,
"set", &optlist, &key, &value))
return;
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c
index 27778b2b..f275c235 100644
--- a/src/fe-text/gui-entry.c
+++ b/src/fe-text/gui-entry.c
@@ -582,7 +582,8 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_
if (size == 0 || entry->pos < size)
return;
- if (entry->cutbuffer_len == 0) {
+ if (update_cutbuffer != CUTBUFFER_UPDATE_NOOP
+ && entry->cutbuffer_len == 0) {
update_cutbuffer = CUTBUFFER_UPDATE_REPLACE;
}
int cutbuffer_new_size = entry->cutbuffer_len + size;
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 3582b9e4..27be904e 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -710,11 +710,3 @@ void term_gets(GArray *buffer, int *line_count)
}
}
}
-
-void term_set_bracketed_paste_mode(int enable)
-{
- if (enable)
- tputs("\e[?2004h", 0, term_putchar);
- else
- tputs("\e[?2004l", 0, term_putchar);
-}
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index 60927f1a..aa833abf 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -395,6 +395,14 @@ static void _ignore_parm(TERM_REC *term, int param)
{
}
+static void term_dec_set_bracketed_paste_mode(int enable)
+{
+ if (enable)
+ tputs("\e[?2004h", 0, term_putchar);
+ else
+ tputs("\e[?2004l", 0, term_putchar);
+}
+
static void term_fill_capabilities(TERM_REC *term)
{
int i, ival;
@@ -496,7 +504,7 @@ void terminfo_setup_colors(TERM_REC *term, int force)
}
}
-static void terminfo_input_init(TERM_REC *term)
+static void terminfo_input_init0(TERM_REC *term)
{
tcgetattr(fileno(term->in), &term->old_tio);
memcpy(&term->tio, &term->old_tio, sizeof(term->tio));
@@ -518,8 +526,11 @@ static void terminfo_input_init(TERM_REC *term)
term->tio.c_cc[VSUSP] = _POSIX_VDISABLE;
#endif
- tcsetattr(fileno(term->in), TCSADRAIN, &term->tio);
+}
+static void terminfo_input_init(TERM_REC *term)
+{
+ tcsetattr(fileno(term->in), TCSADRAIN, &term->tio);
}
static void terminfo_input_deinit(TERM_REC *term)
@@ -535,6 +546,9 @@ void terminfo_cont(TERM_REC *term)
if (term->TI_smkx)
tput(tparm(term->TI_smkx));
+ if (term->bracketed_paste_enabled)
+ term_dec_set_bracketed_paste_mode(TRUE);
+
terminfo_input_init(term);
}
@@ -545,6 +559,9 @@ void terminfo_stop(TERM_REC *term)
/* move cursor to bottom of the screen */
terminfo_move(0, term->height-1);
+ if (term->bracketed_paste_enabled)
+ term_dec_set_bracketed_paste_mode(FALSE);
+
/* stop cup-mode */
if (term->TI_rmcup)
tput(tparm(term->TI_rmcup));
@@ -673,10 +690,20 @@ static int term_setup(TERM_REC *term)
term->beep = term->TI_bel ? _beep : _ignore;
terminfo_setup_colors(term, FALSE);
+ terminfo_input_init0(term);
terminfo_cont(term);
return 1;
}
+void term_set_bracketed_paste_mode(int enable)
+{
+ if (current_term->bracketed_paste_enabled == enable)
+ return;
+
+ current_term->bracketed_paste_enabled = enable;
+ term_dec_set_bracketed_paste_mode(enable);
+}
+
TERM_REC *terminfo_core_init(FILE *in, FILE *out)
{
TERM_REC *old_term, *term;
diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h
index 21398791..0ef280a1 100644
--- a/src/fe-text/terminfo-core.h
+++ b/src/fe-text/terminfo-core.h
@@ -92,6 +92,9 @@ struct _TERM_REC {
/* Keyboard-transmit mode */
const char *TI_smkx;
const char *TI_rmkx;
+
+ /* Terminal mode states */
+ int bracketed_paste_enabled;
};
extern TERM_REC *current_term;
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 81f0c269..1df95f70 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -78,17 +78,23 @@ static int ischannel_func(SERVER_REC *server, const char *data)
IRC_SERVER_REC *irc_server = (IRC_SERVER_REC *) server;
char *chantypes, *statusmsg;
+ g_return_val_if_fail(data != NULL, FALSE);
+
+ /* empty string is no channel */
+ if (*data == '\0')
+ return FALSE;
+
chantypes = g_hash_table_lookup(irc_server->isupport, "chantypes");
if (chantypes == NULL)
chantypes = "#&!+"; /* normal, local, secure, modeless */
- statusmsg = g_hash_table_lookup(irc_server->isupport, "statusmsg");
- if (statusmsg == NULL)
- statusmsg = "@+";
- while (strchr(statusmsg, *data) != NULL)
- data++;
+ statusmsg = g_hash_table_lookup(irc_server->isupport, "statusmsg");
+ if (statusmsg != NULL)
+ data += strspn(data, statusmsg);
- return strchr(chantypes, *data) != NULL;
+ /* strchr(3) considers the trailing NUL as part of the string, make sure
+ * we didn't advance too much. */
+ return *data != '\0' && strchr(chantypes, *data) != NULL;
}
static char **split_line(const SERVER_REC *server, const char *line,
diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c
index db099368..b74b6a8c 100644
--- a/src/irc/core/sasl.c
+++ b/src/irc/core/sasl.c
@@ -34,7 +34,7 @@ static gboolean sasl_timeout(IRC_SERVER_REC *server)
irc_send_cmd_now(server, "AUTHENTICATE *");
cap_finish_negotiation(server);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
signal_emit("server sasl failure", 2, server, "The authentication timed out");
@@ -64,9 +64,9 @@ static void sasl_fail(IRC_SERVER_REC *server, const char *data, const char *from
char *params, *error;
/* Stop any pending timeout, if any */
- if (server->sasl_timeout != -1) {
+ if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
}
params = event_get_params(data, 2, NULL, &error);
@@ -81,9 +81,9 @@ static void sasl_fail(IRC_SERVER_REC *server, const char *data, const char *from
static void sasl_already(IRC_SERVER_REC *server, const char *data, const char *from)
{
- if (server->sasl_timeout != -1) {
+ if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
}
signal_emit("server sasl success", 1, server);
@@ -94,9 +94,9 @@ static void sasl_already(IRC_SERVER_REC *server, const char *data, const char *f
static void sasl_success(IRC_SERVER_REC *server, const char *data, const char *from)
{
- if (server->sasl_timeout != -1) {
+ if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
}
signal_emit("server sasl success", 1, server);
@@ -114,9 +114,9 @@ static void sasl_step(IRC_SERVER_REC *server, const char *data, const char *from
conn = server->connrec;
/* Stop the timer */
- if (server->sasl_timeout != -1) {
+ if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
}
switch (conn->sasl_mechanism) {
@@ -161,9 +161,9 @@ static void sasl_disconnected(IRC_SERVER_REC *server)
return;
}
- if (server->sasl_timeout != -1) {
+ if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
- server->sasl_timeout = -1;
+ server->sasl_timeout = 0;
}
}
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index 7f35585e..17f6c477 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -496,8 +496,8 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
g_return_if_fail(data != NULL);
- if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST |
- PARAM_FLAG_STRIP_TRAILING_WS, &typestr, &nick, &arg))
+ if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
+ &typestr, &nick, &arg))
return;
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);