de.hagenah.diplomacy.diptool
Class EmailAccount

java.lang.Object
  extended by de.hagenah.diplomacy.diptool.EmailAccount
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class EmailAccount
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

An email account. Note: This class is not thread-safe. So even if some methods may be called by other threads than the event dispatching thread it's still so that in this case the event-dispatching thread must not modify this object in parallel.

See Also:
Serialized Form

Method Summary
 boolean canGetMessages()
          Is a POP3 or IMAP server configured?
 boolean canSendMessage()
          Is a SMTP server configured?
 int compareTo(java.lang.Object obj)
          Compares two accounts by Name
 boolean equals(java.lang.Object obj)
          Compares two accounts by Name
 java.util.Collection getMessages(javax.swing.JFrame owner, de.hagenah.util.ModalProgressMonitor progressmonitor)
          Get all new messages.
 int hashCode()
          Returns a hashcode for this account.
 boolean isSMTPPasswordUnknown()
          Is a password for the SMTP server necessary and is this password unknown?
 void sendMessage(java.awt.Window owner, java.lang.String to, java.lang.String subject, java.lang.String body, java.lang.String password, boolean savepassword)
          Sends an e-mail message using the SMTP server of this account.
 java.lang.String toString()
          Returns the name of the account, e.g.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two accounts by Name

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)
Compares two accounts by Name

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Returns a hashcode for this account.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns the name of the account, e.g. "diptool@hagenah.de".

Overrides:
toString in class java.lang.Object

canGetMessages

public boolean canGetMessages()
Is a POP3 or IMAP server configured? This method is multi-threading safe.


getMessages

public java.util.Collection getMessages(javax.swing.JFrame owner,
                                        de.hagenah.util.ModalProgressMonitor progressmonitor)
Get all new messages. This method is multi-threading safe.

Parameters:
owner - Owner frame for dialogs if no progressmonitor is null
progressmonitor - A progress monitor (can be null)
Returns:
A list with the errors

canSendMessage

public boolean canSendMessage()
Is a SMTP server configured?


isSMTPPasswordUnknown

public boolean isSMTPPasswordUnknown()
Is a password for the SMTP server necessary and is this password unknown?


sendMessage

public void sendMessage(java.awt.Window owner,
                        java.lang.String to,
                        java.lang.String subject,
                        java.lang.String body,
                        java.lang.String password,
                        boolean savepassword)
                 throws javax.mail.MessagingException
Sends an e-mail message using the SMTP server of this account.

Parameters:
owner - A owner window for dialogs
to - The recipient of the the message
subject - The subject of the message
body - The body of the message
password - A password to use if the password is unknown (can be null)
savepassword - true if the password shall be saved in the properties
Throws:
javax.mail.MessagingException