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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user