org.nukesoft.commlib
Interface CommLib

All Known Implementing Classes:
AIMLib

public interface CommLib

The CommLib interface describes the contract all communication libraries must abide by. It provides a common interface for all IM services.

Author:
Ryan Michela

Method Summary
 void bindCallback(CommLibCallback callback)
          Binds the communication library to a callback object.
 boolean connect(String loggin, String password)
          Establishes a connection to the IM server.
 void disconnect()
          Terminates connection to the IM server.
 void doPing()
          Force the CommLib to ping its connection.
 String getWarningLevel()
          Gets the current warning level of this account.
 String identifyProtocal()
          Returns a string identifying the protocal this library implements.
 void sendMessage(IM message)
          Sends an instant message over the network.
 void sendWarning(String screenName, boolean anonymous)
          Attempts to warn an individual.
 

Method Detail

bindCallback

public void bindCallback(CommLibCallback callback)
Binds the communication library to a callback object.

Parameters:
callback -

connect

public boolean connect(String loggin,
                       String password)
Establishes a connection to the IM server.

Parameters:
loggin -
password -
Returns:
TRUE if successfull. FALSE if not.

disconnect

public void disconnect()
Terminates connection to the IM server.


sendMessage

public void sendMessage(IM message)
Sends an instant message over the network.

Parameters:
message -

sendWarning

public void sendWarning(String screenName,
                        boolean anonymous)
Attempts to warn an individual. May not have an effect on all networks.

Parameters:
screenName - The target.
anonymous - If true, attempt to warn anonymously.

getWarningLevel

public String getWarningLevel()
Gets the current warning level of this account.

Returns:
"###" if warning level supported, "N/A" if not.

identifyProtocal

public String identifyProtocal()
Returns a string identifying the protocal this library implements.

Returns:
The protocal string.

doPing

public void doPing()

Force the CommLib to ping its connection.

This will always be called from the connection maintnance thread, thus, the doPing implementation must block until the action is complete. The spirit of this method is to attempt to send a self addressed message, and reconnect to the network if the message fails to come through.