commLibs
Class MSNLib

java.lang.Object
  |
  +--org.hn.sleek.jmml.MessengerClientAdapter
        |
        +--commLibs.MSNLib
All Implemented Interfaces:
CommLib, org.hn.sleek.jmml.MessengerClientListener

public class MSNLib
extends org.hn.sleek.jmml.MessengerClientAdapter
implements CommLib

The MSNLib class implements the MSN communication protocal within the CommLib specification. It uses the jmml MSN library by Tony Tang (http://www.sfu.ca/~tonyt/.

Author:
Ryan Michela

Constructor Summary
MSNLib()
           
 
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 incomingMessage(org.hn.sleek.jmml.IncomingMessageEvent inMsg)
           
 void sendMessage(IM message)
          Sends an instant message over the network.
 void sendWarning(String screenName, boolean anonymous)
          Attempts to warn an individual.
 
Methods inherited from class org.hn.sleek.jmml.MessengerClientAdapter
contactAdded, contactPropertyChanged, contactReceived, contactRemoved, groupReceived, loginAccepted, loginError, reverseListChanged, serverDisconnected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MSNLib

public MSNLib()
Method Detail

bindCallback

public void bindCallback(CommLibCallback callback)
Description copied from interface: CommLib
Binds the communication library to a callback object.

Specified by:
bindCallback in interface CommLib
Parameters:
callback -

connect

public boolean connect(String loggin,
                       String password)
Description copied from interface: CommLib
Establishes a connection to the IM server.

Specified by:
connect in interface CommLib
Parameters:
loggin -
password -
Returns:
TRUE if successfull. FALSE if not.

disconnect

public void disconnect()
Description copied from interface: CommLib
Terminates connection to the IM server.

Specified by:
disconnect in interface CommLib

doPing

public void doPing()
Description copied from interface: CommLib

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.

Specified by:
doPing in interface CommLib

getWarningLevel

public String getWarningLevel()
Description copied from interface: CommLib
Gets the current warning level of this account.

Specified by:
getWarningLevel in interface CommLib
Returns:
"###" if warning level supported, "N/A" if not.

identifyProtocal

public String identifyProtocal()
Description copied from interface: CommLib
Returns a string identifying the protocal this library implements.

Specified by:
identifyProtocal in interface CommLib
Returns:
The protocal string.

sendMessage

public void sendMessage(IM message)
Description copied from interface: CommLib
Sends an instant message over the network.

Specified by:
sendMessage in interface CommLib
Parameters:
message -

sendWarning

public void sendWarning(String screenName,
                        boolean anonymous)
Description copied from interface: CommLib
Attempts to warn an individual. May not have an effect on all networks.

Specified by:
sendWarning in interface CommLib
Parameters:
screenName - The target.
anonymous - If true, attempt to warn anonymously.

incomingMessage

public void incomingMessage(org.hn.sleek.jmml.IncomingMessageEvent inMsg)
Specified by:
incomingMessage in interface org.hn.sleek.jmml.MessengerClientListener
Overrides:
incomingMessage in class org.hn.sleek.jmml.MessengerClientAdapter