Add ability to mute keywords from chat (#413)
* Added ability to mute keywords from chat * Muted words logic in widget, added Json Converter Created a json converter to to serialize the observable list of muted keywords, this required a static method for the default value. Also moved the logic for the muted keyword widget to the widget itself * Removed JSON Converter and ObservableList * remove unused imports --------- Co-authored-by: Tommy Chow <tommyxchow@gmail.com>
This commit is contained in:
parent
5276ddb8d4
commit
a7619027af
5 changed files with 225 additions and 0 deletions
|
|
@ -311,6 +311,21 @@ abstract class ChatStoreBase with Store {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Filter messages containing any muted words.
|
||||
if (parsedIRCMessage.message != null) {
|
||||
final List<String> mutedWords = settings.mutedWords;
|
||||
|
||||
// check if the message contains any of the muted words
|
||||
for (final word in mutedWords) {
|
||||
if (parsedIRCMessage.message!
|
||||
.toLowerCase()
|
||||
.split(settings.matchWholeWord ? ' ' : '')
|
||||
.contains(word.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (parsedIRCMessage.command) {
|
||||
case Command.privateMessage:
|
||||
case Command.notice:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue