JML

net.sf.jml.impl
Class BasicMessenger

java.lang.Object
  extended by net.sf.jml.impl.AbstractMessenger
      extended by net.sf.jml.impl.BasicMessenger
All Implemented Interfaces:
MsnMessenger
Direct Known Subclasses:
SimpleMessenger

public abstract class BasicMessenger
extends AbstractMessenger

basic MsnMessenger implement, communication with MSN DS/NS

Author:
Roger Chen

Constructor Summary
BasicMessenger(Email email, String password)
           
 
Method Summary
 void addSessionListener(net.sf.cindy.SessionListener listener)
           
 MsnSwitchboard[] getActiveSwitchboards()
          Get all active MsnSwitchboard.
 MsnConnection getConnection()
          Get current connection information.
 MsnContactList getContactList()
          Get contact list.
 MsnMessageChain getIncomingMessageChain()
          Get the incoming message chain.
 MsnMessageChain getOutgoingMessageChain()
          Get the outgoing message chain.
 MsnOwner getOwner()
          Get current user.
 void login()
          Login.
 void login(String ip, int port)
           
 void logout()
          Logout.
 MsnSwitchboard newSwitchboard(String ip, int port, boolean createdByOwner, String authStr, int sessionId, Object attachment)
          Start a new switchboard use the given infomation.
 void removeSessionListener(net.sf.cindy.SessionListener listener)
           
 boolean send(MsnOutgoingMessage message, boolean block)
          Send a message to DS/NS server.
 void sendText(Email email, String text)
          Send text message to someone without format.
 void setActualMsnProtocol(MsnProtocol protocol)
          Sets the actual version of the protocol used.
 String toString()
           
 
Methods inherited from class net.sf.jml.impl.AbstractMessenger
addContactListListener, addEmailListener, addFileTransferListener, addListener, addMessageListener, addMessengerListener, addSwitchboardListener, fireContactAddCompleted, fireContactAddedMe, fireContactJoinSwitchboard, fireContactLeaveSwitchboard, fireContactListInitCompleted, fireContactListSyncCompleted, fireContactRemoveCompleted, fireContactRemovedMe, fireContactStatusChanged, fireControlMessageReceived, fireDatacastMessageReceived, fireEmailActivityNotificationReceived, fireExceptionCaught, fireFileTransferFinished, fireFileTransferProcess, fireFileTransferRequestReceived, fireFileTransferStarted, fireGroupAddCompleted, fireGroupRemoveCompleted, fireInitialEmailDataReceived, fireInitialEmailNotificationReceived, fireInstantMessageReceived, fireLoginCompleted, fireLogout, fireNewEmailNotificationReceived, fireOwnerStatusChanged, fireP2PMessageReceived, fireSwitchboardClosed, fireSwitchboardStarted, fireSystemMessageReceived, fireUnknownMessageReceived, getActualMsnProtocol, getAttachment, getDisplayPictureDuelManager, getSupportedProtocol, isLogIncoming, isLogOutgoing, removeContactListListener, removeEmailListener, removeFileTransferListener, removeListener, removeMessageListener, removeMessengerListener, removeSwitchboardListener, retrieveDisplayPicture, send, setAttachment, setLogIncoming, setLogOutgoing, setSupportedProtocol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.jml.MsnMessenger
addFriend, addGroup, blockFriend, copyFriend, moveFriend, newSwitchboard, removeFriend, removeFriend, removeGroup, renameFriend, renameGroup, unblockFriend
 

Constructor Detail

BasicMessenger

public BasicMessenger(Email email,
                      String password)
Method Detail

getOwner

public MsnOwner getOwner()
Description copied from interface: MsnMessenger
Get current user.

Returns:
current user

getContactList

public MsnContactList getContactList()
Description copied from interface: MsnMessenger
Get contact list.

Returns:
contact list

getConnection

public MsnConnection getConnection()
Description copied from interface: MsnMessenger
Get current connection information.

Returns:
current connect information

login

public void login()
Description copied from interface: MsnMessenger
Login.


logout

public void logout()
Description copied from interface: MsnMessenger
Logout.


send

public boolean send(MsnOutgoingMessage message,
                    boolean block)
Description copied from interface: MsnMessenger
Send a message to DS/NS server. If block, the method will return after the message successfully sent or failed. If not block, the method always return false.

Parameters:
message - MsnOutgoingMessage
block - is block
Returns:
if block, return message send successful, else return false

getActiveSwitchboards

public MsnSwitchboard[] getActiveSwitchboards()
Description copied from interface: MsnMessenger
Get all active MsnSwitchboard.

Returns:
all active MsnSwitchboard

getIncomingMessageChain

public MsnMessageChain getIncomingMessageChain()
Description copied from interface: MsnMessenger
Get the incoming message chain.

Returns:
incoming message chain

getOutgoingMessageChain

public MsnMessageChain getOutgoingMessageChain()
Description copied from interface: MsnMessenger
Get the outgoing message chain.

Returns:
outgoing message chain

login

public void login(String ip,
                  int port)

setActualMsnProtocol

public void setActualMsnProtocol(MsnProtocol protocol)
Description copied from class: AbstractMessenger
Sets the actual version of the protocol used.

Overrides:
setActualMsnProtocol in class AbstractMessenger
Parameters:
protocol - Instance of the protocol version used.

addSessionListener

public void addSessionListener(net.sf.cindy.SessionListener listener)

removeSessionListener

public void removeSessionListener(net.sf.cindy.SessionListener listener)

toString

public String toString()
Overrides:
toString in class Object

sendText

public void sendText(Email email,
                     String text)
Description copied from interface: MsnMessenger
Send text message to someone without format. If the email address is not in any switchboard, will create a switchboard and send the text.

Parameters:
email - email
text - text

newSwitchboard

public MsnSwitchboard newSwitchboard(String ip,
                                     int port,
                                     boolean createdByOwner,
                                     String authStr,
                                     int sessionId,
                                     Object attachment)
Start a new switchboard use the given infomation.

Parameters:
ip - connect ip
port - connect port
createdByOwner - is this switchboard created by owner
authStr - switchboard authStr
sessionId - switchboard session id
attachment - attachment
Returns:
switchboard

JML