org.wso2.mashup.hostobjects.im
Class IM

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.wso2.mashup.hostobjects.im.IM
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class IM
extends org.mozilla.javascript.ScriptableObject

The IM host object is a generic host object designed to send Instant Messages (IM) using various IM protocols. The underlying protocol implementation is kept transparent. MSN, Yahoo, AIM, ICQ and Jabber are the supporetd protocols.

Notes:

1. When instantiating a IM object, the user is expected to pass in the IM protocol expected to be used.Valid values are msn, yahoo, aim, icq and jabber 2. When the jabber protocol is used the userID should be of the form username@server e.g. username@gmail.com 3. The login function can be called with or without user credentials. If its called with credentials they are used to authenticate the user. If the function is called without credentials the details are taken from the server.xml found under conf directory where the mashup server is located. So if you wish to keep the credentials in server.xml please update it with the needed usernames and passwords. The section that corresponds to this is as follows.

username password username password username password username password username@jabberServer password

 eg:
     //Sending an IM using MSN.
 

function sendIM(){ var im = new IM("msn"); im.login("username","password"); im.sendMessage("yourFriendsID","hi! This IM was sent using the WSO2 Mashup Server"); im.disconnect(); }

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
IM()
           
 
Method Summary
 java.lang.String getClassName()
          Return the name of the class.
static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx, java.lang.Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr)
           
 void jsFunction_disconnect()
           
static void jsFunction_login(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
           
 void jsFunction_sendMessage(java.lang.String to, java.lang.String message)
           
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IM

public IM()
Method Detail

jsConstructor

public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx,
                                                              java.lang.Object[] args,
                                                              org.mozilla.javascript.Function ctorObj,
                                                              boolean inNewExpr)
                                                       throws java.io.IOException
Throws:
java.io.IOException

getClassName

public java.lang.String getClassName()
Return the name of the class.

This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.

Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject

jsFunction_login

public static void jsFunction_login(org.mozilla.javascript.Context cx,
                                    org.mozilla.javascript.Scriptable thisObj,
                                    java.lang.Object[] args,
                                    org.mozilla.javascript.Function funObj)
                             throws org.wso2.imwrapper.core.IMException,
                                    org.wso2.mashup.MashupFault
Throws:
org.wso2.imwrapper.core.IMException
org.wso2.mashup.MashupFault

jsFunction_sendMessage

public void jsFunction_sendMessage(java.lang.String to,
                                   java.lang.String message)
                            throws org.wso2.imwrapper.core.IMException
Throws:
org.wso2.imwrapper.core.IMException

jsFunction_disconnect

public void jsFunction_disconnect()
                           throws org.wso2.imwrapper.core.IMException
Throws:
org.wso2.imwrapper.core.IMException