mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Fix slashguard
Slashguard wasn't working since merging
https://github.com/profanity-im/profanity/pull/1943.
In 7eac636fc8
the user input processing
was moved to be in gmainloop via inp_add_watch().
Fix https://github.com/profanity-im/profanity/issues/1955
This commit is contained in:
parent
569e37f018
commit
9b193b1f26
@ -183,6 +183,19 @@ _inp_callback(GIOChannel* source, GIOCondition condition, gpointer data)
|
|||||||
ui_reset_idle_time();
|
ui_reset_idle_time();
|
||||||
|
|
||||||
if (inp_line) {
|
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();
|
ProfWin* window = wins_get_current();
|
||||||
|
|
||||||
if (!cmd_process_input(window, inp_line))
|
if (!cmd_process_input(window, inp_line))
|
||||||
@ -242,16 +255,6 @@ inp_readline(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inp_line) {
|
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);
|
return strdup(inp_line);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user