IP*Works! V9

ipworks
Class Xmpp

java.lang.Object
  extended by ipworks.Xmpp

public class Xmpp
extends java.lang.Object

The XMPP Bean is used to create a lightweight messaging client using the XMPP (Jabber) protocol.

A call to the Connect method will perform the entire logon process after which a Connected event will fire indicating connection status. For simplicity, the entire interface is synchronous; the bean will not return until a call is completed.

After a successful connection, the bean will automatically begin the process of receiving the user's buddy list. The bean will parse the XML as it comes in from the server and will set the appropriate properties. Once the entire buddy list has been retrieved, a Sync event will fire.

Sending a message is as simple as calling a single method. One call to the SendMessage method will cause the bean to connect if it has not already done so, send the specified message to a specified user, and return to the original connection state.

The XMPP Bean interface supports messaging, list and presence management. Other features of the XMPP protocol are supported through the SendCommand method and PITrail event.

Example (Connecting and Sending a Message)

 IMControl.Connect("myusername", "mypassword")
 IMControl.MessageText = "My Message"
 IMControl.SendMessage("ToUser") 
Example (Sending a Single Message)

 IMControl.User = "myusername"
 IMControl.Password = "mypassword"
 IMControl.MessageText = "My Message"
 IMControl.SendMessage("ToUser") 


Field Summary
static int mtChat
           
static int mtError
           
static int mtGroupChat
           
static int mtHeadline
           
static int mtNormal
           
static int pcAway
           
static int pcChat
           
static int pcDND
           
static int pcOffline
           
static int pcXA
           
 
Constructor Summary
Xmpp()
          Creates an instance of Xmpp Bean.
Xmpp(java.lang.String runtimeLicense)
          Creates an instance of Xmpp Bean with specified run-time license.
 
Method Summary
 void add(java.lang.String jabberId, java.lang.String name, java.lang.String groups)
          This method will add an entity to this entity's roster.
 void addXmppEventListener(XmppEventListener l)
           
 void cancel(java.lang.String jabberId)
          This will cancel another entity's subscription to this entity's presence.
 void changePassword(java.lang.String password)
          This method will change the current user's password.
 void changePresence(int presenceCode, java.lang.String status)
          This method will set the availability and status of this entity.
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a configuration setting.
 void connect(java.lang.String user, java.lang.String password)
          This method will connect the bean to the server.
 void disconnect()
          This method disconnects the bean from the server.
 void doEvents()
          This method processes events from the internal message queue.
 java.lang.String getAuthDomain()
          The domain under which the user will be authenticated.
 java.lang.String getAuthMethods()
          Controls how the bean authenticates itself with the XMPP server.
 XMPPBuddyList getBuddies()
          Collection of buddies in the buddy list.
 Firewall getFirewall()
          A set of properties related to firewall access.
 int getIMPort()
          The server port for XMPP (default 5222).
 java.lang.String getIMServer()
          This is the instant messaging server.
 java.lang.String getLocalDirectory()
          The directory to which received files are saved.
 java.lang.String getLocalFile()
          The path to the file that will be sent.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 java.lang.String getMessageHTML()
          This is the HTML version of the current message.
 java.lang.String getMessageOtherData()
          This property contains extra data elements for the current message.
 java.lang.String getMessageSubject()
          This is the subject of the current message.
 java.lang.String getMessageText()
          This is the plain text of the current message.
 java.lang.String getMessageThread()
          This is the thread name of the current message.
 int getMessageType()
          This is the type of the current message.
 java.lang.String getPassword()
          This is the user's password.
 int getPresence()
          This is the availability of the entity.
 java.lang.String getResource()
          This is the resource for the current session.
 java.lang.String getServerDomain()
          The XMPP server's domain.
 java.lang.String getStatus()
          Description of the availability of this entity.
 int getTimeout()
          A timeout for the bean.
 java.lang.String getUser()
          The user portion of this entity's Jabber ID.
 java.lang.String getUserDomain()
          Gets or sets the domain value used for Jabber IDs
 XMPPUserInfoMap getUserInfo()
          Collection of named registration fields.
 void interrupt()
          Interrupt the current method.
 boolean isConnected()
          This indicates the bean's login status.
 void probePresence(java.lang.String jabberId)
          Use this method to probe for another entity's presence.
 void queryRegister(java.lang.String XMPPServer)
          This method queries a server for the necessary registration fields.
 void register(java.lang.String XMPPServer)
          This method registers an account with a server.
 void remove(java.lang.String jabberId, java.lang.String name, java.lang.String group)
          This method will remove an entity from this entity's roster.
 void removeXmppEventListener(XmppEventListener l)
           
 void retrieveRoster()
          This method will retrieve this entity's roster from the server.
 void sendCommand(java.lang.String command)
          This method sends a command to the server.
 void sendFile(java.lang.String jabberId)
          Sends a file to the specified user.
 java.lang.String sendMessage(java.lang.String jabberId)
          This method will send a message to the specified user.
 void setAuthDomain(java.lang.String authDomain)
          The domain under which the user will be authenticated.
 void setAuthMethods(java.lang.String authMethods)
          Controls how the bean authenticates itself with the XMPP server.
 void setConnected(boolean connected)
          This indicates the bean's login status.
 void setFirewall(Firewall firewall)
          A set of properties related to firewall access.
 void setIMPort(int IMPort)
          The server port for XMPP (default 5222).
 void setIMServer(java.lang.String IMServer)
          This is the instant messaging server.
 void setLocalDirectory(java.lang.String localDirectory)
          The directory to which received files are saved.
 void setLocalFile(java.lang.String localFile)
          The path to the file that will be sent.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setMessageHTML(java.lang.String messageHTML)
          This is the HTML version of the current message.
 void setMessageOtherData(java.lang.String messageOtherData)
          This property contains extra data elements for the current message.
 void setMessageSubject(java.lang.String messageSubject)
          This is the subject of the current message.
 void setMessageText(java.lang.String messageText)
          This is the plain text of the current message.
 void setMessageThread(java.lang.String messageThread)
          This is the thread name of the current message.
 void setMessageType(int messageType)
          This is the type of the current message.
 void setPassword(java.lang.String password)
          This is the user's password.
 void setPresence(int presence)
          This is the availability of the entity.
 void setReceiveStream(java.io.OutputStream receiveStream)
          Sets the stream to which the received file data from will be written.
 void setResource(java.lang.String resource)
          This is the resource for the current session.
 void setSendStream(java.io.InputStream sendStream, java.lang.String filename)
          Sets the stream to be sent.
 void setServerDomain(java.lang.String serverDomain)
          The XMPP server's domain.
 void setStatus(java.lang.String status)
          Description of the availability of this entity.
 void setTimeout(int timeout)
          A timeout for the bean.
 void setUser(java.lang.String user)
          The user portion of this entity's Jabber ID.
 void setUserDomain(java.lang.String userDomain)
          Gets or sets the domain value used for Jabber IDs
 void setUserInfoField(java.lang.String field, java.lang.String value)
          This method will add a user information field for registration.
 void subscribeTo(java.lang.String jabberId)
          Use this method to subscribe to another entity's presence.
 void unregister()
          This method cancels an account with the host.
 void unsubscribeTo(java.lang.String jabberId)
          This method will cancel a subscription to another entity's presence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mtNormal

public static final int mtNormal
See Also:
Constant Field Values

mtChat

public static final int mtChat
See Also:
Constant Field Values

mtGroupChat

public static final int mtGroupChat
See Also:
Constant Field Values

mtHeadline

public static final int mtHeadline
See Also:
Constant Field Values

mtError

public static final int mtError
See Also:
Constant Field Values

pcOffline

public static final int pcOffline
See Also:
Constant Field Values

pcChat

public static final int pcChat
See Also:
Constant Field Values

pcAway

public static final int pcAway
See Also:
Constant Field Values

pcXA

public static final int pcXA
See Also:
Constant Field Values

pcDND

public static final int pcDND
See Also:
Constant Field Values
Constructor Detail

Xmpp

public Xmpp()
Creates an instance of Xmpp Bean.


Xmpp

public Xmpp(java.lang.String runtimeLicense)
Creates an instance of Xmpp Bean with specified run-time license.

Method Detail

getAuthDomain

public java.lang.String getAuthDomain()
The domain under which the user will be authenticated.

Set this value if the user must authenticate via a third party authentication service that requires a different domain than the XMPP user's registered domain.


setAuthDomain

public void setAuthDomain(java.lang.String authDomain)
                   throws IPWorksException
The domain under which the user will be authenticated.

Set this value if the user must authenticate via a third party authentication service that requires a different domain than the XMPP user's registered domain.

Throws:
IPWorksException

getAuthMethods

public java.lang.String getAuthMethods()
Controls how the bean authenticates itself with the XMPP server.

AuthMethods is a comma-separated list of authentication methods to be enabled on the bean, listed in order of preference. When authenticating, the bean will pick the first method in the list that is supported by the server.

The special value * (default) may be supplied to cause the bean to enable all supported authentication methods in order of presumed security. The XMPP bean currently supports the following values for AuthMethods , listed in order of most secure to least secure:


setAuthMethods

public void setAuthMethods(java.lang.String authMethods)
                    throws IPWorksException
Controls how the bean authenticates itself with the XMPP server.

AuthMethods is a comma-separated list of authentication methods to be enabled on the bean, listed in order of preference. When authenticating, the bean will pick the first method in the list that is supported by the server.

The special value * (default) may be supplied to cause the bean to enable all supported authentication methods in order of presumed security. The XMPP bean currently supports the following values for AuthMethods , listed in order of most secure to least secure:

Throws:
IPWorksException

getBuddies

public XMPPBuddyList getBuddies()
Collection of buddies in the buddy list.

After a Sync event is fired, this property will contain a collection of all buddies in the buddy list. The buddy list will be updated by the server when a successful call to RetrieveRoster has been made.

This collection is indexed from 0 to size - 1.


isConnected

public boolean isConnected()
This indicates the bean's login status.

This value shows whether or not the bean has successfully logged into the IMServer . It will not be true until a successful Connected event has fired.


setConnected

public void setConnected(boolean connected)
                  throws IPWorksException
This indicates the bean's login status.

This value shows whether or not the bean has successfully logged into the IMServer . It will not be true until a successful Connected event has fired.

Throws:
IPWorksException

getFirewall

public Firewall getFirewall()
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.


setFirewall

public void setFirewall(Firewall firewall)
                 throws IPWorksException
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.

Throws:
IPWorksException

getIMPort

public int getIMPort()
The server port for XMPP (default 5222).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.


setIMPort

public void setIMPort(int IMPort)
               throws IPWorksException
The server port for XMPP (default 5222).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.

Throws:
IPWorksException

getIMServer

public java.lang.String getIMServer()
This is the instant messaging server.

This is the instant messaging server to which the bean will connect when the Connect method is called. The IMServer property must contain a valid XMPP (Jabber) server, or any subsequent calls to the Connect method will fail.


setIMServer

public void setIMServer(java.lang.String IMServer)
                 throws IPWorksException
This is the instant messaging server.

This is the instant messaging server to which the bean will connect when the Connect method is called. The IMServer property must contain a valid XMPP (Jabber) server, or any subsequent calls to the Connect method will fail.

Throws:
IPWorksException

getLocalDirectory

public java.lang.String getLocalDirectory()
The directory to which received files are saved.

This setting specifies the directory on disk to which received files will be saved. If this property is not set and a file is received the file data will be available through the Transfer event parameters. This property may also be set when the StartTransfer event fires.


setLocalDirectory

public void setLocalDirectory(java.lang.String localDirectory)
                       throws IPWorksException
The directory to which received files are saved.

This setting specifies the directory on disk to which received files will be saved. If this property is not set and a file is received the file data will be available through the Transfer event parameters. This property may also be set when the StartTransfer event fires.

Throws:
IPWorksException

getLocalFile

public java.lang.String getLocalFile()
The path to the file that will be sent.

This property specifies the local file that will be sent when calling SendFile . This property must be set before calling SendFile .


setLocalFile

public void setLocalFile(java.lang.String localFile)
                  throws IPWorksException
The path to the file that will be sent.

This property specifies the local file that will be sent when calling SendFile . This property must be set before calling SendFile .

Throws:
IPWorksException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.

Throws:
IPWorksException

getMessageHTML

public java.lang.String getMessageHTML()
This is the HTML version of the current message.

If the user wishes to send any HTML as a part of the message, it must be set in the MessageHTML property. The HTML must be an entire HTML document, including the <html> and <body> tags. If the HTML has unbalanced tags, the XMPP bean will fail with an error.


setMessageHTML

public void setMessageHTML(java.lang.String messageHTML)
                    throws IPWorksException
This is the HTML version of the current message.

If the user wishes to send any HTML as a part of the message, it must be set in the MessageHTML property. The HTML must be an entire HTML document, including the <html> and <body> tags. If the HTML has unbalanced tags, the XMPP bean will fail with an error.

Throws:
IPWorksException

getMessageOtherData

public java.lang.String getMessageOtherData()
This property contains extra data elements for the current message.

MessageOtherData will contain zero or more complete XML elements associated with the message, but which are not defined in the Jabber specification.


setMessageOtherData

public void setMessageOtherData(java.lang.String messageOtherData)
                         throws IPWorksException
This property contains extra data elements for the current message.

MessageOtherData will contain zero or more complete XML elements associated with the message, but which are not defined in the Jabber specification.

Throws:
IPWorksException

getMessageSubject

public java.lang.String getMessageSubject()
This is the subject of the current message.

MessageSubject will contain any subject associated with the message. Most Jabber clients will ignore the subject unless the message is of type "headline".


setMessageSubject

public void setMessageSubject(java.lang.String messageSubject)
                       throws IPWorksException
This is the subject of the current message.

MessageSubject will contain any subject associated with the message. Most Jabber clients will ignore the subject unless the message is of type "headline".

Throws:
IPWorksException

getMessageText

public java.lang.String getMessageText()
This is the plain text of the current message.

MessageText is the plain text version of the current message, taken from the message's "body" child element. The text in this property is automatically escaped to ensure valid XML parsing on the other end.


setMessageText

public void setMessageText(java.lang.String messageText)
                    throws IPWorksException
This is the plain text of the current message.

MessageText is the plain text version of the current message, taken from the message's "body" child element. The text in this property is automatically escaped to ensure valid XML parsing on the other end.

Throws:
IPWorksException

getMessageThread

public java.lang.String getMessageThread()
This is the thread name of the current message.

MessageThread will contain the name of the thread associated with the message. Threads are useful for tracking messages of type "chat" or "groupchat".


setMessageThread

public void setMessageThread(java.lang.String messageThread)
                      throws IPWorksException
This is the thread name of the current message.

MessageThread will contain the name of the thread associated with the message. Threads are useful for tracking messages of type "chat" or "groupchat".

Throws:
IPWorksException

getMessageType

public int getMessageType()
This is the type of the current message.

MessageType is the type of the message as specified in the XMPP RFC. The possible values are defined in the protocol specification as follows:

normal (mtNormal - 0)
A single message.
chat (mtChat - 1)
A message sent in the context of two-way chat between two entities.
groupchat (mtGroupChat - 2)
A message sent in the context of multi-user chat among multiple entities.
headline (mtHeadline - 3)
A message that represents one of a list of items (e.g., in a news feed or information ticker).
error (mtError - 4)
A message returned to a sender specifying an error associated with a previous message sent by the sender to an intended recipient.


setMessageType

public void setMessageType(int messageType)
                    throws IPWorksException
This is the type of the current message.

MessageType is the type of the message as specified in the XMPP RFC. The possible values are defined in the protocol specification as follows:

normal (mtNormal - 0)
A single message.
chat (mtChat - 1)
A message sent in the context of two-way chat between two entities.
groupchat (mtGroupChat - 2)
A message sent in the context of multi-user chat among multiple entities.
headline (mtHeadline - 3)
A message that represents one of a list of items (e.g., in a news feed or information ticker).
error (mtError - 4)
A message returned to a sender specifying an error associated with a previous message sent by the sender to an intended recipient.

Throws:
IPWorksException

getPassword

public java.lang.String getPassword()
This is the user's password.

This must be set before a connection is attempted. If a call to the Connect method is made specifying a password, the Password property will contain that password.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
This is the user's password.

This must be set before a connection is attempted. If a call to the Connect method is made specifying a password, the Password property will contain that password.

Throws:
IPWorksException

getPresence

public int getPresence()
This is the availability of the entity.

When the bean completes the initial log in, it will send information telling other entities subscribed to this entity's presence that it is online. The application must provide different status and availability information as the user changes them.

The Presence property has one of four values representing general information about the user's status as defined in the Jabber protocol specification:

pcOffline (0)
Invisible: JabberId is offline.
pcChat (1)
Available: JabberId is online.
pcAway (2)
Away: JabberId is online, but the user is away from their computer.
pcXA (3)
Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)
Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the bean sets the client presence to pcChat , meaning that the user is available. To change the initial status sent by the bean set Presence to the desired presence before calling Connect .

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error .

The Status property is a pure-text string representing the user's presence information. Its value maybe be any random string, including the empty string, "".

Whenever the value in Presence or Status are changed, the bean will send that information to the server. If the application or user wishes to associate a specific status message with a new presence value, it should use the ChangePresence method. ChangePresence will update both the Presence and Status properties, and then send that information to the server.


setPresence

public void setPresence(int presence)
                 throws IPWorksException
This is the availability of the entity.

When the bean completes the initial log in, it will send information telling other entities subscribed to this entity's presence that it is online. The application must provide different status and availability information as the user changes them.

The Presence property has one of four values representing general information about the user's status as defined in the Jabber protocol specification:

pcOffline (0)
Invisible: JabberId is offline.
pcChat (1)
Available: JabberId is online.
pcAway (2)
Away: JabberId is online, but the user is away from their computer.
pcXA (3)
Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)
Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the bean sets the client presence to pcChat , meaning that the user is available. To change the initial status sent by the bean set Presence to the desired presence before calling Connect .

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error .

The Status property is a pure-text string representing the user's presence information. Its value maybe be any random string, including the empty string, "".

Whenever the value in Presence or Status are changed, the bean will send that information to the server. If the application or user wishes to associate a specific status message with a new presence value, it should use the ChangePresence method. ChangePresence will update both the Presence and Status properties, and then send that information to the server.

Throws:
IPWorksException

getResource

public java.lang.String getResource()
This is the resource for the current session.

Whenever an entity logs in to an XMPP (Jabber) server, it must provide account information as well as a resource. Resources allow multiple clients to log in using the same account. The server will forward all messages and PI data aimed at a specific resource to that resource. If a command or message is to be sent to a Jabber ID with no specified resource, the server will push that command or message out to all connected resources.


setResource

public void setResource(java.lang.String resource)
                 throws IPWorksException
This is the resource for the current session.

Whenever an entity logs in to an XMPP (Jabber) server, it must provide account information as well as a resource. Resources allow multiple clients to log in using the same account. The server will forward all messages and PI data aimed at a specific resource to that resource. If a command or message is to be sent to a Jabber ID with no specified resource, the server will push that command or message out to all connected resources.

Throws:
IPWorksException

getServerDomain

public java.lang.String getServerDomain()
The XMPP server's domain.

The domain of the XMPP server itself. Set this value if the domain of the server is different from the DNS name of the IMServer .


setServerDomain

public void setServerDomain(java.lang.String serverDomain)
                     throws IPWorksException
The XMPP server's domain.

The domain of the XMPP server itself. Set this value if the domain of the server is different from the DNS name of the IMServer .

Throws:
IPWorksException

getStatus

public java.lang.String getStatus()
Description of the availability of this entity.

When the bean completes the initial log in, it will send information telling other entities subscribed to this entity's presence that it is online. The application must provide different status and availability information as the user changes them.

The Presence property has one of four values representing general information about the user's status as defined in the Jabber protocol specification:

pcOffline (0)
Invisible: JabberId is offline.
pcChat (1)
Available: JabberId is online.
pcAway (2)
Away: JabberId is online, but the user is away from their computer.
pcXA (3)
Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)
Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the bean sets the client presence to pcChat , meaning that the user is available. To change the initial status sent by the bean set Presence to the desired presence before calling Connect .

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error .

The Status property is a pure-text string representing the user's presence information. Its value maybe be any random string, including the empty string, "".

Whenever the value in Presence or Status are changed, the bean will send that information to the server. If the application or user wishes to associate a specific status message with a new presence value, it should use the ChangePresence method. ChangePresence will update both the Presence and Status properties, and then send that information to the server.


setStatus

public void setStatus(java.lang.String status)
               throws IPWorksException
Description of the availability of this entity.

When the bean completes the initial log in, it will send information telling other entities subscribed to this entity's presence that it is online. The application must provide different status and availability information as the user changes them.

The Presence property has one of four values representing general information about the user's status as defined in the Jabber protocol specification:

pcOffline (0)
Invisible: JabberId is offline.
pcChat (1)
Available: JabberId is online.
pcAway (2)
Away: JabberId is online, but the user is away from their computer.
pcXA (3)
Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)
Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the bean sets the client presence to pcChat , meaning that the user is available. To change the initial status sent by the bean set Presence to the desired presence before calling Connect .

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error .

The Status property is a pure-text string representing the user's presence information. Its value maybe be any random string, including the empty string, "".

Whenever the value in Presence or Status are changed, the bean will send that information to the server. If the application or user wishes to associate a specific status message with a new presence value, it should use the ChangePresence method. ChangePresence will update both the Presence and Status properties, and then send that information to the server.

Throws:
IPWorksException

getTimeout

public int getTimeout()
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an exception.

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by the AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an exception.

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by the AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).

Throws:
IPWorksException

getUser

public java.lang.String getUser()
The user portion of this entity's Jabber ID.

The User property is a unique username associated with this entity and set at time of registration under the field "user".


setUser

public void setUser(java.lang.String user)
             throws IPWorksException
The user portion of this entity's Jabber ID.

The User property is a unique username associated with this entity and set at time of registration under the field "user".

Throws:
IPWorksException

getUserDomain

public java.lang.String getUserDomain()
Gets or sets the domain value used for Jabber IDs

A Jabber ID (JID) is a unique identifier of the format " User @ Domain / Resource ". user@domain denotes the account by username and domain. The Resource is given during the login process to distinguish individual connections under the same account. If the IMServer contains multiple domains, this property setting allows the user to specify the domain under which to login.

If Domain is empty, the value in IMServer is used by default when creating the client's JID.


setUserDomain

public void setUserDomain(java.lang.String userDomain)
                   throws IPWorksException
Gets or sets the domain value used for Jabber IDs

A Jabber ID (JID) is a unique identifier of the format " User @ Domain / Resource ". user@domain denotes the account by username and domain. The Resource is given during the login process to distinguish individual connections under the same account. If the IMServer contains multiple domains, this property setting allows the user to specify the domain under which to login.

If Domain is empty, the value in IMServer is used by default when creating the client's JID.

Throws:
IPWorksException

getUserInfo

public XMPPUserInfoMap getUserInfo()
Collection of named registration fields.

Before a registration can be attempted, the application should use the QueryRegister method to poll the host to which the user wishes to register. This will gather all of the necessary fields that the user must send to the server, and will populate the UserInfo collection accordingly. After a successful query, all entries in UserInfo values will be empty strings.

The possible registration fields are defined in the Jabber protocol specification as follows:

instructions
Special instructions sent from the server.
username
The username to be associated with this account.
password
The initial password for this account.
name
The user's name.
email
The user's email address.
address
The user's physical address.
city
The user's city of residence.
state
The user's state (for United States citizens).
zip
The user's postal code (for United States citizens).
phone
The user's phone number.
URL
The user's website.
date
The date of registration.
misc
Any miscellaneous data.
text
Any extra text (potentially for a personal bio).
remove
Specifies a request to unregister.

After the user has set all of the values in UserInfo , and added any extra fields they may wish to include in their registration, the application should make a call to Register .

If the bean is not already connected when this method is called, it will connect, poll the registration fields, and then disconnect.

This collection is a hashtable type of collection where the field string is used as the key to the desired XMPP user info object.

Example (Setting New User Information)

 xmpp1.queryRegister("server");
 
 xmpp1.getUserInfo().item("Username").setValue("newuser");
 xmpp1.getUserInfo().item("Password").setValue("newpass");
 
 xmpp1.register("server"); 


add

public void add(java.lang.String jabberId,
                java.lang.String name,
                java.lang.String groups)
         throws IPWorksException
This method will add an entity to this entity's roster.

JabberId is the Jabber ID of the entity to be added. It should be of form "user@host". If no hostname is specified, the bean will assume the user's account is with the server in IMServer , and will append that hostname to JabberId before sending the request.

Name will contain the name that is to be associated with JabberId in this entity's roster. It may be the empty string, "".

Groups is either the empty string ("") or a comma- separated list of groups to which JabberId is to be added. If JabberId already exists in the buddy list, it will be updated to exist only in the specified groups. A buddy's group list can also be modified by the Buddies property.

The Add method will make a subscription request to the presence of the specified JabberId . Upon receiving this request, the server will add an entry into this user's buddy list with a subscription of type subscriptionNone (0) if there was no previous entry (if this user has already allowed JabberId to subscribe to this user's presence, there will already be an entry of type subscriptionFrom (2)). If the contact chooses to allow the subscription, the server will update the entry and a BuddyUpdate event will fire with the new subscription value ( subscriptionTo (1) if this is a new contact, or subscriptionBoth (3) if the contact is now mutual).

The XMPP protocol permits XMPP (Jabber) clients to communicate with foreign IM networks such as AIM, MSN, SMS, and others through the use of gateway servers that translate between the foreign protocol and XMPP. When sending or receiving presence information, messages, or subscription requests, Domain will be a gateway for the foreign network on which the contact resides and with which this user has registered an account for that foreign network. The Register method can be used to register with a foreign network gateway.

Throws:
IPWorksException

cancel

public void cancel(java.lang.String jabberId)
            throws IPWorksException
This will cancel another entity's subscription to this entity's presence.

If for any reason the user should want to undo a previously granted subscription, this can be achieved through the Cancel method. The method will unsubscribe the target from this user's presence, thus preventing the target from seeing this user in the future.

Throws:
IPWorksException

changePassword

public void changePassword(java.lang.String password)
                    throws IPWorksException
This method will change the current user's password.

This method changes the current user's password to the password that is specified. The bean must be connected to the server when this method is called.

Throws:
IPWorksException

changePresence

public void changePresence(int presenceCode,
                           java.lang.String status)
                    throws IPWorksException
This method will set the availability and status of this entity.

PresenceCode should correspond the possible values of the Presence property:

pcOffline (0)
Invisible: JabberId is offline.
pcChat (1)
Available: JabberId is online.
pcAway (2)
Away: JabberId is online, but the user is away from their computer.
pcXA (3)
Extended Away: JabberId is online, but the user is away from their computer for an extended period of time.
pcDND (4)
Do not Disturb: JabberId is online, but is busy and does not wish to be disturbed.

By default, the bean sets the client presence to pcChat , meaning that the user is available. To change the initial status sent by the bean set Presence to the desired presence before calling Connect .

Note: offline is not officially supported by the XMPP specification, however some XMPP server implementations may recognize the value. Setting the client's presence state to this value may cause the server to respond with an Error .

Status can be any random string, including the empty string "".

Throws:
IPWorksException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksException
Sets or retrieves a configuration setting.

Config is a generic method available in every bean. It is used to set and retrieve configuration settings for the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

The bean accepts one or more of the following configuration settings . Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

XMPP Configuration Settings

AccessToken
The OAuth access token used for authentication
Specifies the OAuth access token used during authentication. This can be used when connecting to Facebook or Windows Live Messenger.
ClientId
The OAuth client Id used for authentication
Specifies the OAuth client Id used during authentication. This can be used when connecting to Facebook. Windows Live Messenger does not require this value.
MessageXML
Returns the last root-level element received by the component
This returns the last root-level element received by the component. This could be a message, iq, presence, or any other element type.
ParseHTML
Tells XMPP whether or not to parse MessageHTML when it's set
If ParseHTML is true, the bean will take any value sent to MessageHTML , compute a plaintext version of the text, and put it into the MessageText property.
SendSubscriptionResponse
Determines whether a response will be sent to a Subscription Request
When set to true, a response will be sent to a subscription request based upon the Accept parameter value of the SubscriptionRequest event. When set to false, a response will not be sent. Therefore a response can be created and sent using SendCommand outside of the SubscriptionRequest event. The default value is true.
UseCompression
Specified whether or not stream compression is used
The default value is false. If set to true, the bean will use stream compression when communicating with the IMServer .
Overwrite
Specifies whether or not to overwrite received files
The default value is false. If set to true, the bean will overwrite the existing files in LocalDirectory if another file with the same name is received. This is only applicable when receiving file transfers.
BlockSize
Specifies the block size for file transfers
The size in bytes of the block size used when sending files. The default value is 4096. Increasing this value may improve performance. However, some servers may not support larger block sizes.

IPPort Configuration Settings

FirewallAutoDetect
Tells the bean whether or not to automatically detect and use firewall system settings, if available
This is the same as AutoDetect . This setting is provided for use by beans that do not directly expose Firewall properties.
FirewallHost
Name or IP address of firewall (optional)
If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.If the FirewallHost setting is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost setting is set to the corresponding address. If the search is not successful, an error is returned.

NOTE: This is the same as Host . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallListener
If true, the component binds to a SOCKS firewall as a server (IPPort only)
This entry is for IPPort only and does not work for other components that descend from IPPort.If this entry is set, the bean acts as a server. RemoteHost and RemotePort are used to tell the SOCKS firewall in which address and port to listen to. The firewall rules may ignore RemoteHost , and it is recommended that RemoteHost be set to empty string in this case.

RemotePort is the port in which the firewall will listen to. If set to 0, the firewall will select a random port. The binding (address and port) is provided through the ConnectionStatus event.

The connection to the firewall is made by calling the Connect method.

FirewallPassword
Password to be used if authentication is to be used when connecting through the firewall
If FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the given firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as Password . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallPort
The TCP port for the FirewallHost;
Note that the FirewallPort is set automatically when FirewallType is set to a valid value.NOTE: This is the same as Port . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallType
Determines the type of firewall to connect through
The appropriate values are as follows:
0
No firewall (default setting).
1
Connect through a tunneling proxy. FirewallPort is set to 80.
2
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
3
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.
NOTE: This is the same as FirewallType . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallUser
A user name if authentication is to be used connecting through a firewall
If the FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the Firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as User . This setting is provided for use by beans that do not directly expose Firewall properties.

KeepAliveTime
The inactivity time in milliseconds before a TCP keep-alive packet is sent
When set, TCPKeepAlive will automatically be set to true. By default the operating system will determine the time a connection is idle before a TCP keep-alive packet is sent. This system default if this value is not specified here is 2 hours. In many cases a shorter interval is more useful. Set this value to the desired interval in milliseconds.Note: This value is not applicable in Java.

KeepAliveInterval
The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received
When set, TCPKeepAlive will automatically be set to true. A TCP keep-alive packet will be sent after a period of inactivity as defined by KeepAliveTime . If no acknowledgement is received from the remote host the keep-alive packet will be re-sent. This setting specifies the interval at which the successive keep-alive packets are sent in milliseconds. This system default if this value is not specified here is 1 second.Note: This value is not applicable in Java or MAC.

Linger
When set to True, connections are terminated gracefully
This property controls how a connection is closed. The default is True.In the case that Linger is True (default), there are two scenarios for determining how long the connection will linger. The first, if LingerTime is 0 (default), the system will attempt to send pending data for a connection until the default IP protocol timeout expires.

In the second scenario, LingerTime is a positive value, the system will attempt to send pending data until the specified LingerTime is reached. If this attempt fails, then the system will reset the connection.

The default behavior (which is also the default mode for stream sockets) might result in a long delay in closing the connection. Although the bean returns control immediately, the system could hold system resources until all pending data is sent (even after your application closes).

Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you sent (by a client acknowledgment, for example), setting this property to False might be the appropriate course of action.

LingerTime
Time in seconds to have the connection linger
LingerTime is the time, in seconds, to leave the socket connection linger. This value is 0 by default, which means it will use the default IP protocol timeout.
LocalHost
The name of the local host through which connections are initiated or accepted
The LocalHost setting contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost setting shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface).

LocalPort
The TCP port in the local host where the bean binds
This must be set before a connection is attempted. It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.Setting this to 0 (default) enables the system to choose a port at random. The chosen port will be shown by LocalPort after the connection is established.

LocalPort cannot be changed once a connection is made. Any attempt to set this when a connection is active will generate an error.

This; setting is useful when trying to connect to services that require a trusted port in the client side. An example is the remote shell (rsh) service in UNIX systems.

MaxLineLength
The maximum amount of data to accumulate when no EOL is found
MaxLineLength is the size of an internal buffer, which holds received data while waiting for an EOL string.If an EOL string is found in the input stream before MaxLineLength bytes are received, the DataIn event is fired with the EOL parameter set to True, and the buffer is reset.

If no EOL is found, and MaxLineLength bytes are accumulated in the buffer, the DataIn event is fired with the EOL parameter set to False, and the buffer is reset.

The minimum value for MaxLineLength is 256 bytes. The default value is 2048 bytes. The maximum value is 65536 bytes.

MaxTransferRate
The transfer rate limit in bytes per second
This setting can be used to throttle outbound TCP traffic. Set this to the number of bytes to be sent per second. By default this is not set and there is no limit.
TCPKeepAlive
Determines whether or not the keep alive socket option is enabled
If set to true, the socket's keep-alive option is enabled and keep-alive packets will be sent periodically to maintain the connection. Set KeepAliveTime and KeepAliveInterval to configure the timing of the keep-alive packets.Note: This value is not applicable in Java.

UseIPv6
Whether or not to use IPv6
By default, the component expects an IPv4 address for local and remote host properties, and will create an IPv4 socket. To use IPv6 instead, set this to True.
CloseStreamAfterTransfer
If true, the component will close the upload or download stream after the transfer
This entry is for bean and all the components that descend from it.This property is true by default. Therefore, by default, all streams will be closed after a transfer is completed. In order to keep streams open after the transfer of data, you must set this config to false.

TcpNoDelay
Whether or not to delay when sending packets
When true, the socket will send all data that is ready to send at once. When false, the socket will send smaller buffered packets of data at small intervals. This is known as the Nagle algorithm.By default, this config is set to false.

Socket Configuration Settings

AbsoluteTimeout
Determines whether timeouts are inactivity timeouts or absolute timeouts
If AbsoluteTimeout is set to True, any method which does not complete within Timeout seconds will be aborted. By default, AbsoluteTimeout is False, and the timeout is an inactivity timeout.
FirewallData
Used to send extra data to the firewall
When the firewall is a tunneling proxy, use this property to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).
InBufferSize
The size in bytes of the incoming queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the InBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

OutBufferSize
The size in bytes of the outgoing queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the OutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

Base Configuration Settings

GUIAvailable
Tells the bean whether or not a message loop is available for processing events
In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The bean will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the bean does not attempt to process external events.

Throws:
IPWorksException

connect

public void connect(java.lang.String user,
                    java.lang.String password)
             throws IPWorksException
This method will connect the bean to the server.

The Connect method performs the entire connection routine. This includes connection to the IMServer , user logon and authentication, and session initialization.

The Connected event will not fire until all these steps are complete. The event will fire for either of two situations: a) the bean has successfully completed a login; or b) the login process has failed. Once the event has fired, the Connected property will be set accordingly.

Since Connect is called with a user and password specified, the User and Password properties will updated accordingly.

Throws:
IPWorksException

disconnect

public void disconnect()
                throws IPWorksException
This method disconnects the bean from the server.

The Disconnect method will send the disconnect command to the notification server. Upon disconnection, a Disconnected event will be fired.

Throws:
IPWorksException

doEvents

public void doEvents()
              throws IPWorksException
This method processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

Throws:
IPWorksException

interrupt

public void interrupt()
               throws IPWorksException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns, doing nothing.

Throws:
IPWorksException

probePresence

public void probePresence(java.lang.String jabberId)
                   throws IPWorksException
Use this method to probe for another entity's presence.

In the case that the user needs to update a particular entity's presence this method can be used to retrieve it. After a successful call, the server will either respond with the last known presence for Jabber , or will send a presence element of type "error". In either case, the respond will be returned by a Presence event.

Throws:
IPWorksException

queryRegister

public void queryRegister(java.lang.String XMPPServer)
                   throws IPWorksException
This method queries a server for the necessary registration fields.

Before a registration can be attempted, the application should use the QueryRegister method to poll the host to which the user wishes to register. This will gather all of the necessary fields that the user must send to the server, and will populate the UserInfo collection accordingly. After a successful query, all entries in UserInfo values will be empty strings.

The possible registration fields are defined in the Jabber protocol specification as follows:

instructions
Special instructions sent from the server.
username
The username to be associated with this account.
password
The initial password for this account.
name
The user's name.
email
The user's email address.
address
The user's physical address.
city
The user's city of residence.
state
The user's state (for United States citizens).
zip
The user's postal code (for United States citizens).
phone
The user's phone number.
URL
The user's website.
date
The date of registration.
misc
Any miscellaneous data.
text
Any extra text (potentially for a personal bio).
remove
Specifies a request to unregister.

After the user has set all of the values in UserInfo , and added any extra fields they may wish to include in their registration, the application should make a call to Register .

If the bean is not already connected when this method is called, it will connect, poll the registration fields, and then disconnect.

Throws:
IPWorksException

register

public void register(java.lang.String XMPPServer)
              throws IPWorksException
This method registers an account with a server.

Before a registration can be attempted, the application should use the QueryRegister method to poll the host to which the user wishes to register. This will gather all of the necessary fields that the user must send to the server, and will populate the UserInfo collection accordingly. After a successful query, all entries in UserInfo values will be empty strings.

The possible registration fields are defined in the Jabber protocol specification as follows:

instructions
Special instructions sent from the server.
username
The username to be associated with this account.
password
The initial password for this account.
name
The user's name.
email
The user's email address.
address
The user's physical address.
city
The user's city of residence.
state
The user's state (for United States citizens).
zip
The user's postal code (for United States citizens).
phone
The user's phone number.
URL
The user's website.
date
The date of registration.
misc
Any miscellaneous data.
text
Any extra text (potentially for a personal bio).
remove
Specifies a request to unregister.

After the user has set all of the values in UserInfo , and added any extra fields they may wish to include in their registration, the application should make a call to Register .

If the bean is not already connected when this method is called, it will connect, poll the registration fields, and then disconnect.

A new account can be registered at any time, including while the bean is logged into the host under an existing account.

Throws:
IPWorksException

remove

public void remove(java.lang.String jabberId,
                   java.lang.String name,
                   java.lang.String group)
            throws IPWorksException
This method will remove an entity from this entity's roster.

JabberId is the Jabber ID of the entity to be removed. It should be of form "user@host". If no hostname is specified, the bean will assume the user's account is with the server in IMServer , and will append that hostname to JabberId before sending the request.

Name should contain the name that is to be associated with JabberId in this entity's roster. It may be the empty string, "".

Groups may be either the empty string ("") or a comma- separated list of groups from which JabberId is to be removed. If no group is specified, the buddy will be completely removed from the buddy list.

After calling the Remove method, the server will remove the entry from the server-side roster, and will push the result out to all connected resources. A BuddyUpdate event will fire with subscription of type subscriptionRemove , and the entry will be removed from the Jabber bean's internally stored list.

Throws:
IPWorksException

retrieveRoster

public void retrieveRoster()
                    throws IPWorksException
This method will retrieve this entity's roster from the server.

After the bean connects, it will automatically send a request to the server to retrieve the roster. However, should the user or application wish to update the entire roster, this method may be used to do so.

After a successful call to the RetrieveRoster method, the server will respond with this entity's roster. The bean will parse the roster and fire the Sync event once per item. This event may also fire for each entity added to or removed from the roster.

Throws:
IPWorksException

sendCommand

public void sendCommand(java.lang.String command)
                 throws IPWorksException
This method sends a command to the server.

The SendCommand method will send the Command parameter to the server. The command must be in valid XML format, and must be recognizable to the IMServer .

The SendCommand method should only be used by programmers or users who are connecting to non-standard servers whose command list is not covered by the bean. Any responses that are defined in the protocol specification will be returned by the appropriate event. Any non-standard IQ message will be returned by the IQ event. All other responses will be returned by the PITrail event.

Throws:
IPWorksException

sendFile

public void sendFile(java.lang.String jabberId)
              throws IPWorksException
Sends a file to the specified user.

This method sends the file specified by LocalFile to the user specified by the JabberId parameter.

JabberId is the intended recipient of the message. It is of the form user@domain/resource . If a resource is not supplied, all logged-in instances of the user's account will receive the message.

If SetSendStream is called, the stream will be used as the source when sending the file.

The bean supports sending files using In-Band Bystestreams as defined in XEP-0047 and XEP-0096.

Throws:
IPWorksException

sendMessage

public java.lang.String sendMessage(java.lang.String jabberId)
                             throws IPWorksException
This method will send a message to the specified user.

JabberId is the intended recipient of the message. It is of the form user@domain/resource . If a resource is not supplied, all logged-in instances of the user's account will receive the message.

The bean associates several properties with messages it receives and sends. When it receives a message, the bean will parse out the corresponding values and set these properties before firing a MessageIn event. After the event returns control to the bean, the properties will be cleared (ie, they will be set to the empty string, "").

Before sending a message, the application should set the appropriate properties to be associated with the message. The bean will send only properties with non-empty string values (""), and will clear all properties after a successful send.

The associated properties are the following:

MessageType
the type of the message to be sent
MessageSubject
for "headline" type messages, this is the subject
MessageThread
for "chat" type messages, this is the thread on which the current message is a follow-up
MessageText
the plain text of the message
MessageHTML
the HTML version of the message
MessageOtherData
any extra data associated with the message but not required by the protocol.

If the parameter passed to SendMessage is prefixed with "@" the component will interpret the value as a domain when constructing the message. This allows for sending directly to sub-domains.

Note: the XMPP bean will generate and return a unique identifier for each message sent. This identifier can be used to track messages in conjunction with various Jabber Extension Protocols.

Throws:
IPWorksException

setReceiveStream

public void setReceiveStream(java.io.OutputStream receiveStream)
                      throws IPWorksException
Sets the stream to which the received file data from will be written.

This method sets the stream to which the incoming file will be written. This can be set from within the StartTransfer event when a file is received.

The file data will be written to the stream. The stream should be open and normally set to position 0. The bean will automatically close this stream if CloseStreamAfterTransfer is true (default). The downloaded content will be written starting at the current position in the stream.

If a download stream is set, the incoming file will not be written to LocalDirectory .

Throws:
IPWorksException

setSendStream

public void setSendStream(java.io.InputStream sendStream,
                          java.lang.String filename)
                   throws IPWorksException
Sets the stream to be sent.

This method sets the stream to be sent to the recipient. Filename specifies the name of the file. If an upload stream is set before the SendFile method is called, the content of the stream will be read by the bean and sent. The stream should be open and normally set to position 0.

The bean will automatically close this stream if CloseStreamAfterTransfer is true (default). If the stream is closed, you will need to call SetSendStream again before calling SendFile again.

The content of the stream will be read from the current position all the way to the end.

Note: SetSendStream and LocalFile will reset the other.

Throws:
IPWorksException

setUserInfoField

public void setUserInfoField(java.lang.String field,
                             java.lang.String value)
                      throws IPWorksException
This method will add a user information field for registration.

This method will search through UserInfo for the field name in Field and set the corresponding value to Value . If the field was not previously contained in UserInfo , it will automatically added.

Before a registration can be attempted, the application should use the QueryRegister method to poll the host to which the user wishes to register. This will gather all of the necessary fields that the user must send to the server, and will populate the UserInfo collection accordingly. After a successful query, all entries in UserInfo values will be empty strings.

The possible registration fields are defined in the Jabber protocol specification as follows:

instructions
Special instructions sent from the server.
username
The username to be associated with this account.
password
The initial password for this account.
name
The user's name.
email
The user's email address.
address
The user's physical address.
city
The user's city of residence.
state
The user's state (for United States citizens).
zip
The user's postal code (for United States citizens).
phone
The user's phone number.
URL
The user's website.
date
The date of registration.
misc
Any miscellaneous data.
text
Any extra text (potentially for a personal bio).
remove
Specifies a request to unregister.

After the user has set all of the values in UserInfo , and added any extra fields they may wish to include in their registration, the application should make a call to Register .

If the bean is not already connected when this method is called, it will connect, poll the registration fields, and then disconnect.

Throws:
IPWorksException

subscribeTo

public void subscribeTo(java.lang.String jabberId)
                 throws IPWorksException
Use this method to subscribe to another entity's presence.

This method will send a request for a subscription to JabberId 's presence. If the entity allows the subscription, a new item will be stored in the buddy list with the appropriate subscription type. Otherwise, no change will take place.

Throws:
IPWorksException

unregister

public void unregister()
                throws IPWorksException
This method cancels an account with the host.

If the user or application wishes to terminate an account with the IMServer it should make a call to this method. After a successful call, the account will be canceled and the bean will be logged off the server, but not disconnected.

Throws:
IPWorksException

unsubscribeTo

public void unsubscribeTo(java.lang.String jabberId)
                   throws IPWorksException
This method will cancel a subscription to another entity's presence.

This method will inform the server of the cancellation of subscription to JabberId 's presence. After a successful call the subscription type of the associated buddy list item will be updated.

Throws:
IPWorksException

addXmppEventListener

public void addXmppEventListener(XmppEventListener l)
                          throws java.util.TooManyListenersException
Throws:
java.util.TooManyListenersException

removeXmppEventListener

public void removeXmppEventListener(XmppEventListener l)

IP*Works! V9

Copyright (c) 2013 /n software inc. - All rights reserved.