Skip to content

Commit

Permalink
Fix slashguard
Browse files Browse the repository at this point in the history
Slashguard wasn't working since merging
#1943.

In 7eac636 the user input processing
was moved to be in gmainloop via inp_add_watch().

Fix #1955
  • Loading branch information
jubalh committed Feb 18, 2024
1 parent 569e37f commit 9b193b1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/ui/inputwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@ _inp_callback(GIOChannel* source, GIOCondition condition, gpointer data)
ui_reset_idle_time();

if (inp_line) {
if (!get_password && prefs_get_boolean(PREF_SLASH_GUARD)) {
// ignore quoted messages
if (strlen(inp_line) > 1 && inp_line[0] != '>') {
char* res = (char*)memchr(inp_line + 1, '/', 3);
if (res) {
cons_show("Your text contains a slash in the first 4 characters");
free(inp_line);
inp_line = NULL;
return TRUE;
}
}
}

ProfWin* window = wins_get_current();

if (!cmd_process_input(window, inp_line))
Expand Down Expand Up @@ -242,16 +255,6 @@ inp_readline(void)
}

if (inp_line) {
if (!get_password && prefs_get_boolean(PREF_SLASH_GUARD)) {
// ignore quoted messages
if (strlen(inp_line) > 1 && inp_line[0] != '>') {
char* res = (char*)memchr(inp_line + 1, '/', 3);
if (res) {
cons_show("Your text contains a slash in the first 4 characters");
return NULL;
}
}
}
return strdup(inp_line);
} else {
return NULL;
Expand Down

0 comments on commit 9b193b1

Please sign in to comment.