chat filter: fix filtering messages containing nbsp

The chat history plugin replays messages by replacing spaces with nbsp to avoid triggering notifications and chat commands, and this was preventing the chat filter from filtering replayed messages. censorMessage already does a nbsp to space replacement.
This commit is contained in:
Sander de Groot
2019-07-24 14:01:47 -05:00
committed by Adam
parent 4f71fb91f0
commit b59405eec0
2 changed files with 11 additions and 1 deletions

View File

@@ -34,6 +34,6 @@ class JagexPrintableCharMatcher extends CharMatcher
// Characters which are printable
return (c >= 32 && c <= 126)
|| c == 128
|| (c >= 161 && c <= 255);
|| (c >= 160 && c <= 255);
}
}

View File

@@ -120,6 +120,16 @@ public class ChatFilterPluginTest
assertNull(chatFilterPlugin.censorMessage("te\u008Cst"));
}
@Test
public void testReplayedMessage()
{
when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE);
when(chatFilterConfig.filteredWords()).thenReturn("hello osrs");
chatFilterPlugin.updateFilteredPatterns();
assertNull(chatFilterPlugin.censorMessage("hello\u00A0osrs"));
}
@Test
public void testMessageFromFriendIsFiltered()
{