Words FIlter in Public Message

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

styx
Posts: 68
Joined: 13 May 2010, 19:41
Location: Poland

Words FIlter in Public Message

Postby styx » 03 Jul 2013, 14:32

Is it possible to enable "Words Filter" for PublicMessage? I found the only solution to SysControllerFilterChain like:

Code: Select all

public class PublicMessageFilter extends SysControllerFilter {

   @Override
   public FilterAction handleClientRequest(User user, ISFSObject params)
         throws SFSException {
   
      String message  = params.getUtfString(GenericMessage.KEY_MESSAGE);
       IWordFilter filter =  SmartFoxServer.getInstance().getZoneManager().getZoneByName("Chat").getWordFilter();
         
       params.putUtfString(GenericMessage.KEY_MESSAGE,  filter.apply(message).getMessage());
        return FilterAction.CONTINUE;
   }


That is the only way? And also I need to add the code for user attempts and bans?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Words FIlter in Public Message

Postby Lapo » 03 Jul 2013, 18:26

When you turn on the Words Filter it is automatically applied to Public Messages. It is optional on private messages.

The code you are showing is really not necessary.
Lapo
--
gotoAndPlay()
...addicted to flash games
styx
Posts: 68
Joined: 13 May 2010, 19:41
Location: Poland

Re: Words FIlter in Public Message

Postby styx » 04 Jul 2013, 07:56

Ok, thanks. But As I see it turns on in the configuration of the room.
When I open room configuration I get an error:

An unexpected error occurred in the Admin Tool server-side extension, please check the server-side logs; the extension reported: No instance called 'extension' is defined


server log
09:29:59,078 ERROR [com.smartfoxserver.v2.controllers.ExtensionController-3] Extensions - {Admin}: {ZoneConfigurator}: Unable to parse Room configuration settings descriptor; the following error was reported: 'No instance called 'extension' is defined'
styx
Posts: 68
Joined: 13 May 2010, 19:41
Location: Poland

Re: Words FIlter in Public Message

Postby styx » 04 Jul 2013, 08:15

ok, I found

In configuration file zone.xml, in definition rooms must be empty node "extension". If a node does not exist it throws an error.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Words FIlter in Public Message

Postby Lapo » 04 Jul 2013, 09:26

Yes, please avoid modifying the XML by hand. Use the AdminTool instead
Lapo

--

gotoAndPlay()

...addicted to flash games
nino
Posts: 13
Joined: 13 Aug 2014, 11:16

Re: Words FIlter in Public Message

Postby nino » 29 Oct 2014, 04:37

i has created zone.xml (no room extension) but still give error " ERROR | com.smartfoxserver.v2.controllers.ExtensionController-3 | Extensions | | {Admin}: {ZoneMonitor}: Unable to parse Zone parameters descriptor; the following error was reported: 'No instance called 'traffic' is defined' "
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Words FIlter in Public Message

Postby Lapo » 29 Oct 2014, 08:16

How did you add it?
By hand? Or did you create it from the AdminTool?
Which server version?

thnx
Lapo

--

gotoAndPlay()

...addicted to flash games
nino
Posts: 13
Joined: 13 Aug 2014, 11:16

Re: Words FIlter in Public Message

Postby nino » 29 Oct 2014, 10:49

thanks Lapo for reply. I'm using version 2.8 and created zone by admin tool (create, set zone name,, set extension file) and "Monitor selection" zone that created. i got error: ERROR | com.smartfoxserver.v2.controllers.ExtensionController-2 | Extensions | | {Admin}: {ZoneMonitor}: Unable to parse Zone parameters descriptor; the following error was reported: 'No instance called 'traffic' is defined'
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Words FIlter in Public Message

Postby Lapo » 29 Oct 2014, 14:21

Sounds strange. Try clearing your browser's cache, just in case it's caching an old version of the Admin.
Happens pretty often.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
nino
Posts: 13
Joined: 13 Aug 2014, 11:16

Re: Words FIlter in Public Message

Postby nino » 30 Oct 2014, 02:58

i'm using new PC with new browser but still give error. plz help me. i can't monitor any new zone :((
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Words FIlter in Public Message

Postby Lapo » 30 Oct 2014, 08:48

Version 2.8 does not come with an installer so you must have upgraded from version 2.7, right?
Problem is your browser might still have the previous AdminTool in it's cache. It happens all the times when upgrading.

You did not specify if you have cleared the cache and tried again.

If that doesn't help I will presume your installation is corrupt and suggest to install the server from scratch. You can install it side by side with the current copy and then move your settings to the new one.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
nino
Posts: 13
Joined: 13 Aug 2014, 11:16

Re: Words FIlter in Public Message

Postby nino » 30 Oct 2014, 11:03

thanks Lapo. You are right, upgraded from version 2.7. cleared the cache still error and i'm using new computer with new browser. but still got "No instance called 'traffic' is defined" popup. haiz :(

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 123 guests