com.multisoftgroup.jerry.webchat.plugin
Interface ChatPlugin

All Known Implementing Classes:
ChatLogPlugin

public interface ChatPlugin

Interface of Jerry Messenger plug-ins.
The plug-ins are used to extend Jerry Messenger functionality. The plug-ins should be defined in jerry.xml configuration file:

 <plugins>
 <plugin class="classname">
 <param name="paramname" value="paramvalue" />
 ....
 </plugin>
 .....
 
 </plugins> 
 
 classname - full class name of plug-in
 paramname, paramvalue - key and value passed to plug-in  init  method.
 

Each of web chat creates a set of plug-ins instances and release them on closing.

Author:
Pavel Savin
See Also:
String.equals(Object)

Method Summary
 void close()
          Called on closing chat.
 void init(Chat chat, JID visitor, JID operator, Map<String,String> configParams)
          Called for the plug-in initializaion.
 boolean toOperator(Packet packet)
          Called before the message packet is sent to the operator.
 void toOperator(String message)
          Called before the message is sent to the operator.
 void toOperator(String subject, String message)
          Called before sending the offline message to the operator.
 boolean toVisitor(Packet packet)
          Called before the message packet is sent to the web visitor.
 void toVisitor(String message)
          Called before the message is sent to the web visitor.
 

Method Detail

init

void init(Chat chat,
          JID visitor,
          JID operator,
          Map<String,String> configParams)
Called for the plug-in initializaion.

Parameters:
chat - Chat which creates this plug-in instance
visitor - jabber address of web visitor
operator - jabber address of operator
configParams - map of the plug-in parameters (name, value) passed from jerry.xml config file

toOperator

boolean toOperator(Packet packet)
Called before the message packet is sent to the operator. It can be used as a message filter. If the method returns true, the message will be sent to operator otherwise it will be dropped.

Parameters:
packet - message packet
Returns:
true - send packet; false - drop packet

toOperator

void toOperator(String message)
Called before the message is sent to the operator. It can be used to log messages.

Parameters:
message - text of the message

toOperator

void toOperator(String subject,
                String message)
Called before sending the offline message to the operator.

Parameters:
subject - subject of the message
message - text of the message

toVisitor

boolean toVisitor(Packet packet)
Called before the message packet is sent to the web visitor. It can be used as a message filter or in command processor to extend the messenger functionality.

Parameters:
packet - message packet
Returns:
true - send packet; false - drop packet

toVisitor

void toVisitor(String message)
Called before the message is sent to the web visitor. It can be used to log messages.

Parameters:
message - text of the message

close

void close()
Called on closing chat.