it.gotoandplay.smartfoxserver.events
Class InternalEventObject

java.lang.Object
  extended by it.gotoandplay.smartfoxserver.events.InternalEventObject

public class InternalEventObject
extends java.lang.Object

The InternalEventObject describes the type of event dispatched by the Server and contains the parameters passed by the Server.

Here's a list of the internal events dispatched by the Server and the parameters passed:

loginRequest

userJoin

userExit

userLost

logOut

newRoom

roomLost

spectatorSwitched

pubMsg

fileUpload


Usage Examples:


 
 public class ExampleExtension extends AbstractExtension
 {
        private ExtensionHelper helper;
        
        public void init()
        {
                helper = ExtensionHelper.instance();
        }
 
        public void handleInternalEvent(InternalEventObject evt)
        {
                String evtName = evt.getName();
                
                if (evtName.equals("loginRequest"))
                {
                        String nick = ieo.getParam("nick");
                        String pass = ieo.getParam("pass");
                        SocketChannel chan = (SocketChannel) ieo.getObject("chan");
          
                        if (nick.equals("test") && pass.equals("test"))
                        {
                                helper.trace("Nick and password correct!", this);
                        } 
                        else
                        {
                                helper.trace("Wrong name or password", this);
                        }
 
                }
        } 
 
 }
 
 
 


Constructor Summary
InternalEventObject(java.lang.String evtName)
          Creates a new instance of EventObject
 
Method Summary
 void addObject(java.lang.String key, java.lang.Object o)
          Adds an object to the event
 void addParam(java.lang.String key, java.lang.String value)
           
 java.lang.String getEventName()
           
 java.lang.Object getObject(java.lang.String key)
           
 java.lang.String getParam(java.lang.String key)
           
 java.lang.Object[] getTypedObject(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalEventObject

public InternalEventObject(java.lang.String evtName)
Creates a new instance of EventObject

Method Detail

getEventName

public java.lang.String getEventName()
Returns:
Returns the name of the event

addParam

public void addParam(java.lang.String key,
                     java.lang.String value)
Parameters:
key - Name of the parameter to attach to the event
value - Value for the parameter. All values are represented through String objects.

getParam

public java.lang.String getParam(java.lang.String key)
Parameters:
key - the name of the parameter to get
Returns:
returns a String parameter

addObject

public void addObject(java.lang.String key,
                      java.lang.Object o)
Adds an object to the event

Parameters:
key - the name of the parameter
o - the object

getObject

public java.lang.Object getObject(java.lang.String key)
Parameters:
key - the name of the object to get
Returns:
get the object

getTypedObject

public java.lang.Object[] getTypedObject(java.lang.String key)