Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jChatBox.Chat.Filter
Class Filter

    java.lang.Object
      |
      +--jChatBox.Chat.Filter.Filter

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  HTMLFilter, URLFilter

public abstract class Filter
extends java.lang.Object
implements java.io.Serializable

This class defines a generic Filter.
Extended classes must implement process(String) method and fill in :
_name, _id and _description Strings in constructor.
All skins using filters will call eprocess(String, Msg, ChatroomUser) method.
Msg parameter will be null when filtering usernames in userlist.
Default implementation of eprocess calls process(String) to have backward compatibility.
So, you could overload eprocess method to implement a filter based on input string, current message and current user.
Note that jChatBox conf/ folder path is available thanks to XMLConfig.CONFFOLDER static field.
All chatrooms and userlist is available through ChatroomManager.getInstance();
Pay attention to performances because all messages for all users will be filtered !

See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `_description` Default value is Filter Description
`protected java.lang.String` | `_id` Default value is filter_id
`protected java.lang.String` | `_name` Default value is Filter Name
`protected java.util.Vector` | `_params`

Constructor Summary
`Filter()`

Method Summary
`java.lang.String` | `eprocess(java.lang.String input, Msg cMsg, ChatroomUser cUser)` Processes filter for input string and Msg and User instances.
`java.lang.String` | `getDescription()` Returns Filter's description.
`java.lang.String` | `getID()` Returns Filter's ID.
`java.lang.String` | `getName()` Returns Filter's name.
`java.util.Vector` | `getParams()` Returns Filter's parameters.
`abstract void` | `init()` Initialize the Filter.
`abstract java.lang.String` | `process(java.lang.String input)` Processes filter from input string (message content) to output.
`void` | `setParams(java.util.Vector v)` Sets Filter's parameters.
`protected void` | `trace(int level, java.lang.String msg)` Sends trace to debug.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _name

    protected java.lang.String _name

  Default value is Filter Name

### _id

    protected java.lang.String _id

  Default value is filter_id

### _description

    protected java.lang.String _description

  Default value is Filter Description

### _params

    protected java.util.Vector _params

Constructor Detail

### Filter

    public Filter()

Method Detail

### init

    public abstract void init()

  Initialize the Filter.
  This method will be called after filter's instantiation.

### eprocess

    public java.lang.String eprocess(java.lang.String input,
                                     Msg cMsg,
                                     ChatroomUser cUser)

  Processes filter for input string and Msg and User instances. Default implementation calls process(String) method.

  Parameters:
    `input` - string to filter
    `cMsg` - current Msg instance
    `cUser` - current user instance
  Returns:
    filtered message content
  Since:
    2.6

### process

    public abstract java.lang.String process(java.lang.String input)

  Processes filter from input string (message content) to output.

  Parameters:
    `input` - string to filter
  Returns:
    filtered string

### getID

    public java.lang.String getID()

  Returns Filter's ID.

  Returns:
    id

### getDescription

    public java.lang.String getDescription()

  Returns Filter's description.

  Returns:
    description

### getName

    public java.lang.String getName()

  Returns Filter's name.

  Returns:
    name

### getParams

    public java.util.Vector getParams()

  Returns Filter's parameters.

  Returns:
    custom parameters

### setParams

    public void setParams(java.util.Vector v)

  Sets Filter's parameters.

  Parameters:
    `v` - custom parameters

### trace

    protected void trace(int level,
                         java.lang.String msg)

  Sends trace to debug.

  Parameters:
    `level` - log level
    `msg` - trace

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD