it.gotoandplay.smartfoxserver.extensions.examples
Class SimpleExtension

java.lang.Object
  extended by it.gotoandplay.smartfoxserver.extensions.AbstractExtension
      extended by it.gotoandplay.smartfoxserver.extensions.examples.SimpleExtension
All Implemented Interfaces:
it.gotoandplay.smartfoxserver.events.IEventListener, it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension

public class SimpleExtension
extends AbstractExtension

This is the most simple SmartFoxServer extension possible.
In a nutshell, every extension has to accomplish four different tasks:


Extensions must implement the following methods:


Field Summary
 
Fields inherited from class it.gotoandplay.smartfoxserver.extensions.AbstractExtension
adminExtension
 
Constructor Summary
SimpleExtension()
           
 
Method Summary
 void destroy()
          Destroy the extension
 void handleInternalEvent(InternalEventObject ieo)
          Handles an event dispateched by the Server
 void handleRequest(java.lang.String cmd, ActionscriptObject ao, User u, int fromRoom)
          Handle client requests sent in XML format.
 void handleRequest(java.lang.String cmd, java.lang.String[] params, User u, int fromRoom)
          Handle client requests sent in String format.
 void init()
          Initialize the extension.
 
Methods inherited from class it.gotoandplay.smartfoxserver.extensions.AbstractExtension
getOwnerRoom, getOwnerZone, handleRequest, isActive, loadConfig, registerForEvents, sendResponse, sendResponse, sendResponse, setActive, setOwner, trace, unRegister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleExtension

public SimpleExtension()
Method Detail

init

public void init()
Initialize the extension.
It's always good practice to keep a reference to the ExtensionHelper object

Specified by:
init in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension
Overrides:
init in class AbstractExtension

destroy

public void destroy()
Destroy the extension

Specified by:
destroy in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension
Overrides:
destroy in class AbstractExtension

handleRequest

public void handleRequest(java.lang.String cmd,
                          ActionscriptObject ao,
                          User u,
                          int fromRoom)
Handle client requests sent in XML format. The AS objects sent by the client are serialized to an ActionscriptObject

Parameters:
ao - the ActionscriptObject with the serialized data coming from the client
cmd - the cmd name invoked by the client
fromRoom - the id of the room where the user is in
u - the User who sent the message

handleRequest

public void handleRequest(java.lang.String cmd,
                          java.lang.String[] params,
                          User u,
                          int fromRoom)
Handle client requests sent in String format. The parameters sent by the client are split in a String[]

Parameters:
params - an array of data coming from the client
cmd - the cmd name invoked by the client
fromRoom - the id of the room where the user is in
u - the User who sent the message

handleInternalEvent

public void handleInternalEvent(InternalEventObject ieo)
Handles an event dispateched by the Server

Parameters:
ieo - the InternalEvent object