I have a question about using the word filter.
I want to use it, but I really don't want to use SmartFox's system of issuing warnings and bans for using bad words. However, I am not sure how to disable that particular piece of functionality.
While I see no option in the admin tool, the zone.xml does have a <useWarnings> tag under <wordsFilter>. This, however, does not seem to do anything.
Is there a way to turn off the SmartFox warnings and bans? If not, will one be added?
On a separate note, I store my words list in a database rather than a .txt file, and read the expressions in when the server starts. Failing to specify a file generates a FileNotFoundException, although the filter does still appear to function properly. It would be nice if not specifying a file didn't cause an exception.
Word Filter kick/ban
First of all, the <useWarnings> parameter should be available in the Admin Tool too, but it seems we missed it. We will add it in the next release together with another missing parameter containing the warning message.
Anyway, if <useWarnings> is set to false, the warning are not sent to the client. Kicking and banning can't be disabled, but you can set the "Warnings before kick" and "Kicks before ban" parameters at a very high value.
About the FileNotFoundException, we will take a look. Thank you for pointing out.
Anyway, if <useWarnings> is set to false, the warning are not sent to the client. Kicking and banning can't be disabled, but you can set the "Warnings before kick" and "Kicks before ban" parameters at a very high value.
About the FileNotFoundException, we will take a look. Thank you for pointing out.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
I was just fiddling with word filter customization myself - worth nothing is you can always grab the word filter from a zone and then force it to filter anything it seems
I'm using it in my custom zone filter, where the messages arrive unfiltered even if word filter is on(I suppose they get filtered after my custom filter is finished), but I needed to check for filtering before that. So basically, you can "prefilter" like this in your filter:
Maybe there is another way, who knows. Anyway, I can imagine that you can also dynamically load words from a database, if you use the same class, there is one interesting method "addExpression(java.lang.String word)", sounds like it adds something into dictionary, but I didn't try it out
Code: Select all
IWordFilter wordFilter = ext.getParentZone().getWordFilter();
I'm using it in my custom zone filter, where the messages arrive unfiltered even if word filter is on(I suppose they get filtered after my custom filter is finished), but I needed to check for filtering before that. So basically, you can "prefilter" like this in your filter:
Code: Select all
if (theRoom.isUseWordsFilter()) {
message = wordFilter.apply(message, theUser).getMessage();
}
Maybe there is another way, who knows. Anyway, I can imagine that you can also dynamically load words from a database, if you use the same class, there is one interesting method "addExpression(java.lang.String word)", sounds like it adds something into dictionary, but I didn't try it out
Yes, that is basically what I do. I load all my expressions from a database, using addFilter. I've had to replace the standard requests for public and private messages with my own, and apply the filter to the messages as you describe. I also have requests for GMs to add or remove expressions, so we can update the filter realtime without needing to restart the server. It all works really well, other than a minor issue when one expression is a subset of another (it will sometimes filter the smaller one and then not catch the longer, detailed in this post:.http://www.smartfoxserver.com/forums/viewtopic.php?t=10165), but I've been building my expressions to work around that.
Who is online
Users browsing this forum: Stevenor and 85 guests