|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jChatBox.Chat.Filter.Filter
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 !
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 |
protected java.lang.String _name
protected java.lang.String _id
protected java.lang.String _description
protected java.util.Vector _params
Constructor Detail |
public Filter()
Method Detail |
public abstract void init()
public java.lang.String eprocess(java.lang.String input, Msg cMsg, ChatroomUser cUser)
input
- string to filtercMsg
- current Msg instancecUser
- current user instance
public abstract java.lang.String process(java.lang.String input)
input
- string to filter
public java.lang.String getID()
public java.lang.String getDescription()
public java.lang.String getName()
public java.util.Vector getParams()
public void setParams(java.util.Vector v)
v
- custom parametersprotected void trace(int level, java.lang.String msg)
level
- log levelmsg
- trace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |