When the message uses a language with no configured blacklist, use default

This commit is contained in:
Badlop 2019-01-28 23:14:07 +01:00
parent 2be66bb69f
commit eb39a4f3af
1 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,15 @@ filterWords(L) ->
lists:map(fun censorWord/1, L).
filterMessageText(Lang, MessageText) ->
try filterMessageText2(Lang, MessageText) of
R ->
R
catch exit:{noproc,{gen_server,call,[_,_]}} ->
?DEBUG("Blacklist of language '~p' not found, using 'default' list.", [Lang]),
filterMessageText2(default, MessageText)
end.
filterMessageText2(Lang, MessageText) ->
% we want to token-ize utf8 'words'
MessageWords = string:tokens(unicode:characters_to_list(MessageText, utf8), " "),
MessageTerms = [{Lang, Word} || Word <- MessageWords],