# Chat Room Message Handler

###### Identifier:

org.eclipse.ecf.presence.bot.chatRoomMessageHandler

###### Since:

1.0.0 milestone 6

###### Description:

This extension point allows message handlers to be associated with a given chatroomrobot (via chatroomrobotid attribute). Note that the chatroomrobotid must exist or the handler will not be called.

###### Configuration Markup:

<!ELEMENT extension (handler)+>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED

>

<!ELEMENT handler EMPTY>

<!ATTLIST handler

chatRoomRobotId CDATA #REQUIRED

filterExpression CDATA #IMPLIED

class CDATA #REQUIRED

>

The chat room message handler

- chatRoomRobotId - Required chatRoomRobotId. The value of this field must match a chatRoomRobot id
- filterExpression - Optional filter expression. If filterexpression is provided, then chatroom messages will be filtered via given regular expression. If match, then the handleChatRoomMessage method will be called. If not matched, then the received message will be ignored.
- class - The class of the message handler instance to create. Must implement org.eclipse.ecf.presence.bot.IChatRoomMessageHandler.

###### Examples:

       <extension
             point="org.eclipse.ecf.presence.bot.chatRoomMessageHandler">
          <handler
                chatRoomRobotId="org.eclipse.ecf.presence.bot.defaultbot"
                class="org.eclipse.ecf.presence.bot.DefaultChatRoomMessageHandler">
          </handler>
       </extension>

Note that the given chatroomrobotid=org.eclipse.ecf.presence.bot.defaultbot must be previously defined via the chatroomrobot extension point. Here is an example:

       <extension
             point="org.eclipse.ecf.presence.bot.chatRoomRobot">
          <chatRoomRobot
                chat
                chatRoom="#eclipse-ecf"
                connectId="irc://slewis2_@irc.freenode.net"
                containerFactoryName="ecf.irc.irclib"
                id="org.eclipse.ecf.presence.bot.defaultbot">
          </chatRoomRobot>
       </extension>

###### API Information:

The class implementation provided in extension point must implement the following interface:

    public interface IChatRoomMessageHandler extends IChatRoomContainerAdvisor {

     /**
      * This method is called when a {@link IChatRoomMessage} is received.
      *
      * @param message
      *            the {@link IChatRoomMessage} received. Will not be
      *            <code>null</code>. Implementers should not block the
      *            calling thread. Any methods on the given <code>message</code>
      *            parameter may be called.
      */
     public void handleRoomMessage(IChatRoomMessage message);

    }

###### Supplied Implementation:

No supplied implementation.

Copyright (c) 2007 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html