Reading Badwordlist

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

KingKhong
Posts: 3
Joined: 25 Feb 2009, 08:49

Reading Badwordlist

Postby KingKhong » 25 Feb 2009, 09:09

Hello,
1. is there any function to read the badwordlist?
2. Or can i get the location of config.xml?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 25 Feb 2009, 09:32

What are you trying to do exactly?
Which language are you using on server side?
Lapo
--
gotoAndPlay()
...addicted to flash games
KingKhong
Posts: 3
Joined: 25 Feb 2009, 08:49

Postby KingKhong » 25 Feb 2009, 10:01

I use Java.

I have a private massage system. A user can have more than one private chat window. If he send a massage, the input text displayed in the message window.

My first idea was, to use the message from the server but i don't get a user id nor the name form the recipient. If he has two open privat chats, i can't display the message in the right window.

My second idea is, to send the badwordlist to client and replace it there.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 26 Feb 2009, 06:52

My first idea was, to use the message from the server but i don't get a user id nor the name form the recipient. If he has two open privat chats, i can't display the message in the right window.

Sorry I am not following. When you say you don't receive the userId what are you talking about? Server side? Client side?

Also I don't understand the connection with the bad words list, the Bad Words Filter works automatically on each private message being sent.
Lapo

--

gotoAndPlay()

...addicted to flash games
KingKhong
Posts: 3
Joined: 25 Feb 2009, 08:49

Postby KingKhong » 26 Feb 2009, 08:14

the SmartFoxEvent client side contains only the sender information.

The chatwindows stored by username.


For example

Code: Select all

   /**
    * get a private chat window.
    * @param   sender         user to talk to
    * @return               the chat instance
    */
   private function getPrivateChat(sender:User):PrivateChat
   {
      var id:String = sender.getName();
      
      if (_activeChats[id])
      {
         return PrivateChat(_activeChats[id]);
      }
      else
      {
         _depthCounter++;
         var pc:PrivateChat = new PrivateChat(_canvas, _depthCounter, sender, this, handleCloseChat);
         _activeChats[id] = pc;
         return pc;
      }
   }

Code: Select all

   /**
    * new chat message handler.
    * @param   msg         message
    * @param   sender      from user
    */
   private function handleChatMessage(msg:String, sender:User):Void
   {
      if (sender.getId() == Main.currentUser.uid) return;
      var pc:PrivateChat = getPrivateChat(sender);
      pc.newMessage("<b>" + sender.getName() + ":</b>\n" + msg + "\n" );
   }


the sender get the message from input and has no badwordfilter for the own messages. If i use the message form SmartfoxEvent, i can't find the right window, because i have no information about the receiver at senders client. I wish i had the receiver id or name in the sfsevent.
sstark
Posts: 77
Joined: 21 Nov 2008, 16:06

Postby sstark » 26 Feb 2009, 16:32

I would also like access to the bad words list in a SFS extension.

Works great for usernames, room names and public and private chat... however we also have a few custom communication options which also need to be filtered. These run through a SFS extension already, so I should be able to filter through with the bad words list.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Feb 2009, 07:14

As regards the private messages and the relative userId take a look at our SmartMessenger tutorial -> http://www.smartfoxserver.com/docs/docP ... /index.htm

The example addresses exactly the same use case.

Works great for usernames, room names and public and private chat... however we also have a few custom communication options which also need to be filtered.

In this case you can take a reference to the filter:

Code: Select all

var filter = Packages.it.gotoandplay.smartfoxserver.lib.BadWordsFilter.getInstance()

and the apply it to other messages:

Code: Select all

if (filter.containsBadWords(theMessage))
   theMessage = filter.filterWords(theMessage)

In this case you return the filtered message with **** (asterisks) instead of bad words, otherwise you can avoid to show the entire message, send a warning and whatnot

hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
sstark
Posts: 77
Joined: 21 Nov 2008, 16:06

Postby sstark » 27 Feb 2009, 16:35

Thank you!! that's exactly what I need.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 44 guests