java.lang.Object
i2p.susi.webmail.WebMail.SessionObject
All Implemented Interfaces:
NewMailListener, EventListener, HttpSessionBindingListener
Enclosing class:
WebMail

private static class WebMail.SessionObjectextends Object implements HttpSessionBindingListener, NewMailListener
Data structure to hold any persistent data (to store them in session dictionary).
  • Field Details

    • smtpPort

      int smtpPort
      SMTP port this session sends through.
    • mailbox

      POP3MailBox mailbox
      The connected mailbox, null until login succeeds.
    • caches

      final Map<String, MailCache> caches
      The message caches, by folder.
    • isFetching

      boolean isFetching
      True while the threaded connector is fetching.
    • connectError

      String connectError
      Error from the threaded connector, null if it connected.
    • newMails

      int newMails
      New messages from the last fetch, -1 until it completes.
    • user

      String user
      The login user.
    • pass

      String pass
      The login password.
    • host

      String host
      The mail server host.
    • error

      String error
      Error message to show the user.
    • info

      String info
      Info message to show the user.
    • draftUIDL

      String draftUIDL
      UIDL of the draft being edited.
    • _sessionSalt

      private String _sessionSalt
      Local password verification for session protection @since 0.9.70+.
    • _sessionKey

      private String _sessionKey
      Key for signing session identifiers.
    • attachments

      public ArrayList<Attachment> attachments
      Attachments staged for this session, cleared and deleted together.
    • reallyDelete

      public boolean reallyDelete
      P-R-G.
    • themePath

      String themePath
      Path prefix for the theme's links.
    • imgPath

      String imgPath
      Path prefix for the images' links.
    • isMobile

      boolean isMobile
      True when serving the mobile layout.
    • nonces

      private final List<String> nonces
      The form nonces still accepted.
    • MAX_NONCES

      private static final int MAX_NONCES
      How many issued nonces stay valid.
      See Also:
    • log

      public final Log log
      Log scoped to this session's requests.
    • lastError

      public String lastError
      Cached error text from the last render, to avoid repeating it.
    • lastInfo

      public String lastInfo
      Cached informational text from the last render, to avoid repeating it.
    • lastNotice

      public String lastNotice
      Status message slot for the session, alongside lastError and lastInfo.
  • Constructor Details

    • SessionObject

      SessionObject(Log log)
      Creates the session state for one browser.
      Parameters:
      log - the logger to report through
  • Method Details

    • setLocalPassword

      public void setLocalPassword(String password)
      Hash and store a local password.
      Parameters:
      password - the plain text password to store
    • verifyLocalPassword

      public boolean verifyLocalPassword(String password)
      Verify a password against the stored hash.
      Parameters:
      password - the password to check
      Returns:
      true if password matches
    • hashPassword

      private static String hashPassword(String password, String salt)
      PBKDF2 hash for password verification with high iteration count.
      Parameters:
      password - the password to hash
      salt - the per-user salt
      Returns:
      the hashed password
    • valueBound

      public void valueBound(HttpSessionBindingEvent event)
      No-op, nothing to do when the session is bound.
      Specified by:
      valueBound in interface HttpSessionBindingListener
    • valueUnbound

      public void valueUnbound(HttpSessionBindingEvent event)
      Called when the session attribute is removed.
      Specified by:
      valueUnbound in interface HttpSessionBindingListener
    • foundNewMail

      public void foundNewMail(boolean yes)
      Handle new mail notification.
      Specified by:
      foundNewMail in interface NewMailListener
      Parameters:
      yes - true if new mail was found
    • addNonce

      public void addNonce(String nonce)
      Record a form nonce for the session.
      Parameters:
      nonce - the nonce to record
    • isValidNonce

      public boolean isValidNonce(String nonce)
      Check and consume a form nonce.
      Parameters:
      nonce - the nonce to check
      Returns:
      true if the nonce was issued and not yet used
    • clearAttachments

      public void clearAttachments()
      Clear the attachment list.
    • deleteAttachments

      public void deleteAttachments()
      Delete attachment files.