JML

net.sf.jml.impl
Class AbstractMessenger

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

public abstract class AbstractMessenger
extends Object
implements MsnMessenger

Implement MsnMessenger basic method.

Author:
Roger Chen

Constructor Summary
AbstractMessenger()
           
 
Method Summary
 void addContactListListener(MsnContactListListener listener)
          Add a new listener for the contact list icoming events.
 void addEmailListener(MsnEmailListener listener)
          Add a email events listener.
 void addFileTransferListener(MsnFileTransferListener listener)
          Add a file transfer events listener.
 void addListener(MsnAdapter listener)
          Add a new listener for all interfaces.
 void addMessageListener(MsnMessageListener listener)
          Add a new listener for incoming messages.
 void addMessengerListener(MsnMessengerListener listener)
          Add a new Messenger events listener.
 void addSwitchboardListener(MsnSwitchboardListener listener)
          Add a new switchboard incominf events listener.
 void fireContactAddCompleted(MsnContact contact)
          Notify the listeners about the completion of a contact addition.
 void fireContactAddedMe(MsnContact contact)
          Notify the listeners because someone has added me to his contact list.
 void fireContactJoinSwitchboard(MsnSwitchboard switchboard, MsnContact contact)
          Notify the listeners about the addition of a contact to a Switchboard.
 void fireContactLeaveSwitchboard(MsnSwitchboard switchboard, MsnContact contact)
          Notify the listeners about the removal of a contact from a Switchboard.
 void fireContactListInitCompleted()
          Notify the listeners about the contact list initialization completion.
 void fireContactListSyncCompleted()
          Notify the listeners about the contact list synchronization completion.
 void fireContactRemoveCompleted(MsnContact contact)
          Notify the listeners about the completion of a contact removal.
 void fireContactRemovedMe(MsnContact contact)
          Notify the listeners because someone has removed me from his contact list.
 void fireContactStatusChanged(MsnContact contact)
          Notify the listeners about the status change of a contact.
 void fireControlMessageReceived(MsnSwitchboard switchboard, MsnControlMessage message, MsnContact contact)
          Notify the listeners about a control message arrival.
 void fireDatacastMessageReceived(MsnSwitchboard switchboard, MsnDatacastMessage message, MsnContact contact)
          Notify the listeners about a datacast message arrival.
 void fireEmailActivityNotificationReceived(MsnSwitchboard switchboard, MsnEmailActivityMessage message, MsnContact contact)
           
 void fireExceptionCaught(Throwable throwable)
          Notify the listeners about an exception.
 void fireFileTransferFinished(MsnFileTransfer transfer)
          Notify the listeners that a file transfer has finished.
 void fireFileTransferProcess(MsnFileTransfer transfer)
          Notify the listeners about the process of a file transfer.
 void fireFileTransferRequestReceived(MsnFileTransfer transfer)
          Notify the listeners that a request for a file transfer has been received.
 void fireFileTransferStarted(MsnFileTransfer transfer)
          Notify the listeners that a file transfer has started.
 void fireGroupAddCompleted(MsnGroup group)
          Notify the listeners about the completion of a group addition.
 void fireGroupRemoveCompleted(MsnGroup group)
          Notify the listeners about the completion of a group removal.
 void fireInitialEmailDataReceived(MsnSwitchboard switchboard, MsnEmailInitEmailData message, MsnContact contact)
           
 void fireInitialEmailNotificationReceived(MsnSwitchboard switchboard, MsnEmailInitMessage message, MsnContact contact)
           
 void fireInstantMessageReceived(MsnSwitchboard switchboard, MsnInstantMessage message, MsnContact contact)
          Notify the listeners about an instant message arrival.
 void fireLoginCompleted()
          Notify the listeners about login completion.
 void fireLogout()
          Notify the listeners about logout completion.
 void fireNewEmailNotificationReceived(MsnSwitchboard switchboard, MsnEmailNotifyMessage message, MsnContact contact)
           
 void fireOwnerStatusChanged()
          Notify the listeners about the change of the owner status.
 void fireP2PMessageReceived(MsnSwitchboard switchboard, MsnP2PMessage message, MsnContact contact)
          Notify the listeners about a P2P message arrival.
 void fireSwitchboardClosed(MsnSwitchboard switchboard)
          Notify the listeners about the finalization of a Switchboard.
 void fireSwitchboardStarted(MsnSwitchboard switchboard)
          Notify the listeners about the start of a new Switchboard.
 void fireSystemMessageReceived(MsnSystemMessage message)
          Notify the listeners about a system message arrival.
 void fireUnknownMessageReceived(MsnSwitchboard switchboard, MsnUnknownMessage message, MsnContact contact)
          Notify the listeners about a control message arrival.
 MsnProtocol getActualMsnProtocol()
          Get actual used protocol.
 Object getAttachment()
          Get the attachment.
 DisplayPictureDuelManager getDisplayPictureDuelManager()
          Retrieves the instance of the duel manager to be used by this session.
 MsnProtocol[] getSupportedProtocol()
          Get supported protocols.
 boolean isLogIncoming()
          Is log incoming message.
 boolean isLogOutgoing()
          Is log outgoing message.
 void removeContactListListener(MsnContactListListener listener)
          Removes a listener for incoming events for the contact list.
 void removeEmailListener(MsnEmailListener listener)
          Removes a email listener.
 void removeFileTransferListener(MsnFileTransferListener listener)
          Removes a file transfer listener.
 void removeListener(MsnAdapter listener)
          Remove the MsnAdapter listener.
 void removeMessageListener(MsnMessageListener listener)
          Remosves a listener for incoming messages.
 void removeMessengerListener(MsnMessengerListener listener)
          Remove the Messenger listener.
 void removeSwitchboardListener(MsnSwitchboardListener listener)
          Remove a switchboard listener.
 void retrieveDisplayPicture(MsnObject displayPicture, DisplayPictureListener listener)
          Retrieves the content of a display picture, given as a MsnObject.
 void send(MsnOutgoingMessage message)
          This method is a shorthand for:
 void setActualMsnProtocol(MsnProtocol protocol)
          Sets the actual version of the protocol used.
 void setAttachment(Object attachment)
          Set the attachment.
 void setLogIncoming(boolean logIncoming)
          Set log incoming message.
 void setLogOutgoing(boolean logOutgoing)
          Set log outgoing message.
 void setSupportedProtocol(MsnProtocol[] supportedProtocol)
          Set supported protocols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jml.MsnMessenger
addFriend, addGroup, blockFriend, copyFriend, getActiveSwitchboards, getConnection, getContactList, getIncomingMessageChain, getOutgoingMessageChain, getOwner, login, logout, moveFriend, newSwitchboard, removeFriend, removeFriend, removeGroup, renameFriend, renameGroup, send, sendText, unblockFriend
 

Constructor Detail

AbstractMessenger

public AbstractMessenger()
Method Detail

getAttachment

public Object getAttachment()
Description copied from interface: MsnMessenger
Get the attachment.

Specified by:
getAttachment in interface MsnMessenger
Returns:
attachment
See Also:
MsnMessenger.getAttachment()

setAttachment

public void setAttachment(Object attachment)
Description copied from interface: MsnMessenger
Set the attachment.

Specified by:
setAttachment in interface MsnMessenger
Parameters:
attachment - attachment
See Also:
MsnMessenger.setAttachment(Object)

isLogIncoming

public boolean isLogIncoming()
Description copied from interface: MsnMessenger
Is log incoming message. For debug purpose.

Specified by:
isLogIncoming in interface MsnMessenger
Returns:
is log incoming message
See Also:
MsnMessenger.isLogIncoming()

setLogIncoming

public void setLogIncoming(boolean logIncoming)
Description copied from interface: MsnMessenger
Set log incoming message. For debug purpose.

Specified by:
setLogIncoming in interface MsnMessenger
Parameters:
logIncoming - set log incoming message
See Also:
MsnMessenger.setLogIncoming(boolean)

isLogOutgoing

public boolean isLogOutgoing()
Description copied from interface: MsnMessenger
Is log outgoing message. For debug purpose.

Specified by:
isLogOutgoing in interface MsnMessenger
Returns:
is log outgoing message
See Also:
MsnMessenger.isLogOutgoing()

setLogOutgoing

public void setLogOutgoing(boolean logOutgoing)
Description copied from interface: MsnMessenger
Set log outgoing message. For debug purpose.

Specified by:
setLogOutgoing in interface MsnMessenger
Parameters:
logOutgoing - set log outgoing message
See Also:
MsnMessenger.setLogOutgoing(boolean)

getSupportedProtocol

public MsnProtocol[] getSupportedProtocol()
Description copied from interface: MsnMessenger
Get supported protocols.

Specified by:
getSupportedProtocol in interface MsnMessenger
Returns:
supported protocols
See Also:
MsnMessenger.getSupportedProtocol()

setSupportedProtocol

public void setSupportedProtocol(MsnProtocol[] supportedProtocol)
Description copied from interface: MsnMessenger
Set supported protocols. This will take effect only after re-login.

Specified by:
setSupportedProtocol in interface MsnMessenger
Parameters:
supportedProtocol - supported protocols
See Also:
MsnMessenger.setSupportedProtocol(MsnProtocol[])

getActualMsnProtocol

public MsnProtocol getActualMsnProtocol()
Description copied from interface: MsnMessenger
Get actual used protocol.

Specified by:
getActualMsnProtocol in interface MsnMessenger
Returns:
current used protocol
See Also:
MsnMessenger.getActualMsnProtocol()

setActualMsnProtocol

public void setActualMsnProtocol(MsnProtocol protocol)
Sets the actual version of the protocol used.

Parameters:
protocol - Instance of the protocol version used.

send

public void send(MsnOutgoingMessage message)
Description copied from interface: MsnMessenger
This method is a shorthand for:
     send(message, false);
 

Specified by:
send in interface MsnMessenger
Parameters:
message - MsnOutgoingMessage
See Also:
MsnMessenger.send(MsnOutgoingMessage)

retrieveDisplayPicture

public void retrieveDisplayPicture(MsnObject displayPicture,
                                   DisplayPictureListener listener)
                            throws JmlException
Description copied from interface: MsnMessenger
Retrieves the content of a display picture, given as a MsnObject. This method can only be used with display pictures and emoticons. If the file specified already exists, then it is removed first.

Specified by:
retrieveDisplayPicture in interface MsnMessenger
Parameters:
displayPicture - Instance of the MsnObject for the display picture.
listener - Listener for the display pictura retrieval progress.
Throws:
JmlException - If the MsnObject instance is null, or isn't a display picture or emoticon.
See Also:
MsnMessenger.retrieveDisplayPicture(MsnObject, DisplayPictureListener)

getDisplayPictureDuelManager

public DisplayPictureDuelManager getDisplayPictureDuelManager()
Description copied from interface: MsnMessenger
Retrieves the instance of the duel manager to be used by this session.

Specified by:
getDisplayPictureDuelManager in interface MsnMessenger
Returns:
Instance of the duel manager.
See Also:
MsnMessenger.getDisplayPictureDuelManager()

addListener

public void addListener(MsnAdapter listener)
Description copied from interface: MsnMessenger
Add a new listener for all interfaces.

Specified by:
addListener in interface MsnMessenger
Parameters:
listener - Instance of MsnAdapter that listen to all interfaces.
See Also:
MsnMessenger.addListener(MsnAdapter)

removeListener

public void removeListener(MsnAdapter listener)
Description copied from interface: MsnMessenger
Remove the MsnAdapter listener.

Specified by:
removeListener in interface MsnMessenger
Parameters:
listener - Instance of the listener to be removed.
See Also:
MsnMessenger.removeListener(MsnAdapter)

addMessengerListener

public void addMessengerListener(MsnMessengerListener listener)
Description copied from interface: MsnMessenger
Add a new Messenger events listener.

Specified by:
addMessengerListener in interface MsnMessenger
Parameters:
listener - New Messenger listener.
See Also:
MsnMessenger.addMessengerListener(MsnMessengerListener)

removeMessengerListener

public void removeMessengerListener(MsnMessengerListener listener)
Description copied from interface: MsnMessenger
Remove the Messenger listener.

Specified by:
removeMessengerListener in interface MsnMessenger
Parameters:
listener - Instance of Messenger listener to be removed.
See Also:
MsnMessenger.removeMessengerListener(MsnMessengerListener)

fireLoginCompleted

public void fireLoginCompleted()
Notify the listeners about login completion.


fireLogout

public void fireLogout()
Notify the listeners about logout completion.


fireExceptionCaught

public void fireExceptionCaught(Throwable throwable)
Notify the listeners about an exception.

Parameters:
throwable - Instance of the exception.

addMessageListener

public void addMessageListener(MsnMessageListener listener)
Description copied from interface: MsnMessenger
Add a new listener for incoming messages.

Specified by:
addMessageListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.
See Also:
MsnMessenger.addMessageListener(MsnMessageListener)

removeMessageListener

public void removeMessageListener(MsnMessageListener listener)
Description copied from interface: MsnMessenger
Remosves a listener for incoming messages.

Specified by:
removeMessageListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.
See Also:
MsnMessenger.removeMessageListener(MsnMessageListener)

fireInstantMessageReceived

public void fireInstantMessageReceived(MsnSwitchboard switchboard,
                                       MsnInstantMessage message,
                                       MsnContact contact)
Notify the listeners about an instant message arrival.

Parameters:
switchboard - Instance of the switchboard where the message was received.
message - Instance of the received message.
contact - MsnContact that has sended the instant message.

fireControlMessageReceived

public void fireControlMessageReceived(MsnSwitchboard switchboard,
                                       MsnControlMessage message,
                                       MsnContact contact)
Notify the listeners about a control message arrival.

Parameters:
switchboard - Instance of the switchboard where the message was received.
message - Instance of the received message.
contact - MsnContact that has sended the instant message.

fireSystemMessageReceived

public void fireSystemMessageReceived(MsnSystemMessage message)
Notify the listeners about a system message arrival.

Parameters:
message - Instance of the received message.

fireDatacastMessageReceived

public void fireDatacastMessageReceived(MsnSwitchboard switchboard,
                                        MsnDatacastMessage message,
                                        MsnContact contact)
Notify the listeners about a datacast message arrival.

Parameters:
switchboard - Instance of the switchboard where the message was received.
message - Instance of the received message.
contact - MsnContact that has sended the instant message.

fireUnknownMessageReceived

public void fireUnknownMessageReceived(MsnSwitchboard switchboard,
                                       MsnUnknownMessage message,
                                       MsnContact contact)
Notify the listeners about a control message arrival.

Parameters:
switchboard - Instance of the switchboard where the message was received.
message - Instance of the received message.
contact - MsnContact that has sended the instant message.

fireP2PMessageReceived

public void fireP2PMessageReceived(MsnSwitchboard switchboard,
                                   MsnP2PMessage message,
                                   MsnContact contact)
Notify the listeners about a P2P message arrival.

Parameters:
switchboard - Instance of the switchboard where the message was received.
message - Instance of the received message.
contact - MsnContact that has sended the instant message.

addEmailListener

public void addEmailListener(MsnEmailListener listener)
Description copied from interface: MsnMessenger
Add a email events listener.

Specified by:
addEmailListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.

removeEmailListener

public void removeEmailListener(MsnEmailListener listener)
Description copied from interface: MsnMessenger
Removes a email listener.

Specified by:
removeEmailListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.

fireInitialEmailNotificationReceived

public void fireInitialEmailNotificationReceived(MsnSwitchboard switchboard,
                                                 MsnEmailInitMessage message,
                                                 MsnContact contact)

fireInitialEmailDataReceived

public void fireInitialEmailDataReceived(MsnSwitchboard switchboard,
                                         MsnEmailInitEmailData message,
                                         MsnContact contact)

fireNewEmailNotificationReceived

public void fireNewEmailNotificationReceived(MsnSwitchboard switchboard,
                                             MsnEmailNotifyMessage message,
                                             MsnContact contact)

fireEmailActivityNotificationReceived

public void fireEmailActivityNotificationReceived(MsnSwitchboard switchboard,
                                                  MsnEmailActivityMessage message,
                                                  MsnContact contact)

addContactListListener

public void addContactListListener(MsnContactListListener listener)
Description copied from interface: MsnMessenger
Add a new listener for the contact list icoming events.

Specified by:
addContactListListener in interface MsnMessenger
Parameters:
listener - New instance of the listener.
See Also:
MsnMessenger.addContactListListener(MsnContactListListener)

removeContactListListener

public void removeContactListListener(MsnContactListListener listener)
Description copied from interface: MsnMessenger
Removes a listener for incoming events for the contact list.

Specified by:
removeContactListListener in interface MsnMessenger
Parameters:
listener - Instance of the listener to be removed.
See Also:
MsnMessenger.removeContactListListener(MsnContactListListener)

fireContactListSyncCompleted

public void fireContactListSyncCompleted()
Notify the listeners about the contact list synchronization completion.


fireContactListInitCompleted

public void fireContactListInitCompleted()
Notify the listeners about the contact list initialization completion.


fireContactStatusChanged

public void fireContactStatusChanged(MsnContact contact)
Notify the listeners about the status change of a contact.

Parameters:
contact - Instance of the contact that has changed its status.

fireOwnerStatusChanged

public void fireOwnerStatusChanged()
Notify the listeners about the change of the owner status.


fireContactAddedMe

public void fireContactAddedMe(MsnContact contact)
Notify the listeners because someone has added me to his contact list.

Parameters:
contact - Instance of the contact that added me.

fireContactRemovedMe

public void fireContactRemovedMe(MsnContact contact)
Notify the listeners because someone has removed me from his contact list.

Parameters:
contact - Instance of the contact that removed me.

fireContactAddCompleted

public void fireContactAddCompleted(MsnContact contact)
Notify the listeners about the completion of a contact addition.

Parameters:
contact - Instance of the added contact.

fireContactRemoveCompleted

public void fireContactRemoveCompleted(MsnContact contact)
Notify the listeners about the completion of a contact removal.

Parameters:
contact - Instance of the removed contact.

fireGroupAddCompleted

public void fireGroupAddCompleted(MsnGroup group)
Notify the listeners about the completion of a group addition.

Parameters:
group - Instance of the added group.

fireGroupRemoveCompleted

public void fireGroupRemoveCompleted(MsnGroup group)
Notify the listeners about the completion of a group removal.

Parameters:
group - Instance of the removed group.

addSwitchboardListener

public void addSwitchboardListener(MsnSwitchboardListener listener)
Description copied from interface: MsnMessenger
Add a new switchboard incominf events listener.

Specified by:
addSwitchboardListener in interface MsnMessenger
Parameters:
listener - New listener instance.
See Also:
MsnMessenger.addSwitchboardListener(MsnSwitchboardListener)

removeSwitchboardListener

public void removeSwitchboardListener(MsnSwitchboardListener listener)
Description copied from interface: MsnMessenger
Remove a switchboard listener.

Specified by:
removeSwitchboardListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.
See Also:
MsnMessenger.removeSwitchboardListener(MsnSwitchboardListener)

fireSwitchboardStarted

public void fireSwitchboardStarted(MsnSwitchboard switchboard)
Notify the listeners about the start of a new Switchboard.

Parameters:
switchboard - Instance of the started switchboard.

fireSwitchboardClosed

public void fireSwitchboardClosed(MsnSwitchboard switchboard)
Notify the listeners about the finalization of a Switchboard.

Parameters:
switchboard - Instance of the closed switchboard.

fireContactJoinSwitchboard

public void fireContactJoinSwitchboard(MsnSwitchboard switchboard,
                                       MsnContact contact)
Notify the listeners about the addition of a contact to a Switchboard.

Parameters:
switchboard - Instance of the switchboard.
contact - Instance of the added contact.

fireContactLeaveSwitchboard

public void fireContactLeaveSwitchboard(MsnSwitchboard switchboard,
                                        MsnContact contact)
Notify the listeners about the removal of a contact from a Switchboard.

Parameters:
switchboard - Instance of the switchboard.
contact - Instance of the removed contact.

addFileTransferListener

public void addFileTransferListener(MsnFileTransferListener listener)
Description copied from interface: MsnMessenger
Add a file transfer events listener.

Specified by:
addFileTransferListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.
See Also:
MsnMessenger.addFileTransferListener(MsnFileTransferListener)

removeFileTransferListener

public void removeFileTransferListener(MsnFileTransferListener listener)
Description copied from interface: MsnMessenger
Removes a file transfer listener.

Specified by:
removeFileTransferListener in interface MsnMessenger
Parameters:
listener - Instance of the listener.
See Also:
MsnMessenger.removeFileTransferListener(MsnFileTransferListener)

fireFileTransferRequestReceived

public void fireFileTransferRequestReceived(MsnFileTransfer transfer)
Notify the listeners that a request for a file transfer has been received.

Parameters:
transfer - Instance of the file transfer.

fireFileTransferStarted

public void fireFileTransferStarted(MsnFileTransfer transfer)
Notify the listeners that a file transfer has started.

Parameters:
transfer - Instance of the file transfer.

fireFileTransferProcess

public void fireFileTransferProcess(MsnFileTransfer transfer)
Notify the listeners about the process of a file transfer.

Parameters:
transfer - Instance of the file transfer.

fireFileTransferFinished

public void fireFileTransferFinished(MsnFileTransfer transfer)
Notify the listeners that a file transfer has finished.

Parameters:
transfer - Instance of the file transfer.

JML