| java.lang.Object net.wastl.webmail.server.WebMailSession
WebMailSession | public class WebMailSession implements HTTPSession(Code) | | A user session for WebMail.
Contains the state of the actual user (loads it from disk).
Has a unique session-ID.
author: Sebastian Schaffert version: $Revision: 1.1.1.1 $ |
Field Summary | |
final public static int | GETMESSAGE_MODE_FORWARD Set this mode in getMessage to indicate that the message is to be forwarded to someone else and a "work"
message should be generated. | final public static int | GETMESSAGE_MODE_REPLY Set this mode in getMessage to indicate that the message is requested to generate a reply message and
should therefore be set as the current "work" message. | final public static int | GETMESSAGE_MODE_STANDARD This indicates standard getMessage behaviour: Fetch the message from the IMAP server and store it in the
current UserModel. | protected boolean | is_logged_out | protected Vector | need_expunge_folders |
Method Summary | |
public void | addFolder(String toid, String name, boolean holds_messages, boolean holds_folders) | public void | addMailbox(String name, String protocol, String host, String login, String password) Add the mailbox with the given parameters to this user's configuration. | public void | addWorkAttachment(String name, ByteStore bs, String description) Add an attachment to the current work message.
Parameters: name - Name of the attachment (e.g. | public String | calcCode(InetAddress a, HTTPRequestHeader h) Calculate session-ID for a session. | public void | changeSetup(HTTPRequestHeader head) Change a user's configuration. | public void | clearAttachments() | public void | clearWork() | public Folder | connect(String name) | public void | connectAll() | protected Store | connectStore(String host, String protocol, String login, String password) | public void | copyMoveMessage(String fromfolder, String tofolder, HTTPRequestHeader head, boolean move) Copy or move the selected messages from folder fromfolder to folder tofolder. | public void | createMessageList(String folderhash, int list_part) Create a Message List. | public void | disconnect(String name) | public void | disconnectAll() | protected void | doInit(WebMailServer parent, HTTPRequestHeader h) This method does the actual initialisation
devink 7/15/2000 - added TwoPassAuthenticationException
- updated call to getUserData(), to use my new one. | public void | expungeFolders() | protected String | generateFolderHash(Folder folder) This method tries to generate a unique folder identifier for the given folder. | public Hashtable | getActiveConnections() | public ByteStore | getAttachment(String key) | public Hashtable | getAttachments() | public Folder | getChildFolder(Folder root, String folderhash) | public String | getEnv(String key) | public Folder | getFolder(String folderhash) Get the folder with the given hashvalue. | protected int | getFolderTree(Folder folder, Element xml_parent, boolean subscribed_only) Construct the folder subtree for the given folder and append it to xml_parent. | public long | getLastAccess() | public Locale | getLocale() | public ByteStore | getMIMEPart(String msgid, String name) | public void | getMessage(String folderhash, int msgnum) This is a wrapper to call getMessage with standard mode. | public void | getMessage(String folderhash, int msgnum, int mode) Fetch a message from a folder.
Will put the messages parameters in the sessions environment
Parameters: foldername - Name of the folder were the message should be fetched from Parameters: msgnum - Number of the message to fetch Parameters: mode - there are three different modes: standard, reply and forward. | public Enumeration | getMimeParts(String msgid) | public Document | getModel() | public InetAddress | getRemoteAddress() | public Folder | getRootFolder(String name) | protected static int[] | getSelectedMessages(HTTPRequestHeader head, int max) | public String | getSessionCode() Return the session id that was generated for this session. | public String | getStringResource(String key) | public long | getTimeout() | public UserData | getUser() | public XMLUserModel | getUserModel() | public String | getUserName() | public void | handleTransportException(SendFailedException e) | public boolean | isLoggedOut() Check whether this session is already logged out. | public boolean | isSent() | public void | login(HTTPRequestHeader h) Login to this session. | public void | login() Login this session. | public void | logout() Terminate this session. | protected void | parseMIMEContent(Part p, XMLMessagePart parent_part, String msgid) Use depth-first search to go through MIME-Parts recursively. | public void | prepareCompose() | public void | refreshFolderInformation() | public void | refreshFolderInformation(boolean subscribed_only) Refresh Information about folders. | public void | refreshFolderInformation(String folderhash) | public void | removeFolder(String id, boolean recurse) | public void | removeMailbox(String name) Remove the mailbox with the given name. | public void | removeWorkAttachment(String name) Remove the attachment with the given name from the current work message. | public void | saveData() | public void | setAddToFolder(String id) | public void | setEnv(String key, String value) | public void | setEnv() | public void | setException(Exception ex) | public void | setFlags(String folderhash, HTTPRequestHeader head) Change the Flags of the messages the user selected. | public void | setLastAccess() Update the last access time. | public void | setSent(boolean b) | public void | setSubscribedAll(String id, boolean subscribed) | public void | storeMessage(HTTPRequestHeader head) Store a message in the environment for further processing. | public void | subscribeFolder(String folderhash) Try to subscribe to a folder (i.e. | public void | timeoutOccured() Handle a timeout for this session. | public void | unsubscribeFolder(String folderhash) Try to unsubscribe from a folder (i.e. |
GETMESSAGE_MODE_FORWARD | final public static int GETMESSAGE_MODE_FORWARD(Code) | | Set this mode in getMessage to indicate that the message is to be forwarded to someone else and a "work"
message should be generated.
See Also: getMessage(String,int,int) |
GETMESSAGE_MODE_REPLY | final public static int GETMESSAGE_MODE_REPLY(Code) | | Set this mode in getMessage to indicate that the message is requested to generate a reply message and
should therefore be set as the current "work" message.
See Also: getMessage(String,int,int) |
GETMESSAGE_MODE_STANDARD | final public static int GETMESSAGE_MODE_STANDARD(Code) | | This indicates standard getMessage behaviour: Fetch the message from the IMAP server and store it in the
current UserModel.
See Also: getMessage(String,int,int) |
is_logged_out | protected boolean is_logged_out(Code) | | |
need_expunge_folders | protected Vector need_expunge_folders(Code) | | |
addFolder | public void addFolder(String toid, String name, boolean holds_messages, boolean holds_folders) throws MessagingException(Code) | | |
addMailbox | public void addMailbox(String name, String protocol, String host, String login, String password) throws MessagingException(Code) | | Add the mailbox with the given parameters to this user's configuration. Subscribe all folders on startup (the
user can later unsubscribe them) and update the model.
Parameters: name - Name for the mailbox (used for identification within the session) Parameters: protocol - The protocol used for this mailbox (most likely IMAP or POP3) Parameters: host - The hostname of the host this mailbox lives on Parameters: login - Login name the user provided for the host Parameters: password - Password the user provided to the given login |
addWorkAttachment | public void addWorkAttachment(String name, ByteStore bs, String description) throws WebMailException(Code) | | Add an attachment to the current work message.
Parameters: name - Name of the attachment (e.g. filename) Parameters: bs - The contents of the attachment, as a ByteStore object Parameters: description - A short description of the contents (will be used as the "Description:" header |
calcCode | public String calcCode(InetAddress a, HTTPRequestHeader h)(Code) | | Calculate session-ID for a session.
Parameters: a - Adress of the remote host Parameters: h - Requestheader of the remote user agent |
changeSetup | public void changeSetup(HTTPRequestHeader head) throws WebMailException(Code) | | Change a user's configuration.
Header fields given in the requestheader are parsed and turned into user options (probably should not be in WebMailSession
but in a plugin or something; this is very hacky).
|
clearAttachments | public void clearAttachments()(Code) | | This method removes all of the attachments of the current "work" message
|
clearWork | public void clearWork()(Code) | | |
connect | public Folder connect(String name) throws MessagingException(Code) | | Connect to mailhost "name"
|
connectAll | public void connectAll()(Code) | | Connect to all Mailhosts
|
copyMoveMessage | public void copyMoveMessage(String fromfolder, String tofolder, HTTPRequestHeader head, boolean move) throws MessagingException(Code) | | Copy or move the selected messages from folder fromfolder to folder tofolder.
|
createMessageList | public void createMessageList(String folderhash, int list_part) throws NoSuchFolderException(Code) | | Create a Message List.
Fetches a list of headers in folder foldername for part list_part.
The messagelist will be stored in the "MESSAGES" environment.
Parameters: foldername - folder for which a message list should be built Parameters: list_part - part of list to display (1 = last xx messages, 2 = total-2*xx - total-xx messages) |
disconnect | public void disconnect(String name)(Code) | | Disconnect from mailhost "name"
|
disconnectAll | public void disconnectAll()(Code) | | Disconnect from all Mailhosts
|
expungeFolders | public void expungeFolders()(Code) | | Expunge all folders that have messages waiting to be deleted
|
generateFolderHash | protected String generateFolderHash(Folder folder)(Code) | | This method tries to generate a unique folder identifier for the given folder.
This method generates an MD5 sum over the complete folder URL, if possible.
See Also: getFolderTree See Also: net.wastl.webmail.misc.MD5 |
getAttachment | public ByteStore getAttachment(String key)(Code) | | This method returns the attachment with the given name of the current "work" message
|
getAttachments | public Hashtable getAttachments()(Code) | | This method returns a table of attachments for the current "work" message
|
getChildFolder | public Folder getChildFolder(Folder root, String folderhash)(Code) | | Get a childfolder of a rootfolder for a specified hash value
|
getFolder | public Folder getFolder(String folderhash)(Code) | | Get the folder with the given hashvalue.
|
getFolderTree | protected int getFolderTree(Folder folder, Element xml_parent, boolean subscribed_only)(Code) | | Construct the folder subtree for the given folder and append it to xml_parent.
Parameters: folder - the folder where we begin Parameters: xml_parent - the XML Element where the gathered information will be appended Parameters: subscribed_only - Only list subscribed folders |
getMessage | public void getMessage(String folderhash, int msgnum) throws NoSuchFolderException(Code) | | This is a wrapper to call getMessage with standard mode.
See Also: getMessage(String,int,int) |
getMessage | public void getMessage(String folderhash, int msgnum, int mode) throws NoSuchFolderException(Code) | | Fetch a message from a folder.
Will put the messages parameters in the sessions environment
Parameters: foldername - Name of the folder were the message should be fetched from Parameters: msgnum - Number of the message to fetch Parameters: mode - there are three different modes: standard, reply and forward. reply and forward will enter the messageinto the current work element of the user and set some additional flags on the message if the userhas enabled this option. See Also: net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_STANDARD See Also: net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_REPLY See Also: net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_FORWARD |
getRootFolder | public Folder getRootFolder(String name) throws MessagingException(Code) | | |
getSessionCode | public String getSessionCode()(Code) | | Return the session id that was generated for this session.
|
getStringResource | public String getStringResource(String key)(Code) | | Return a locale-specific string resource
|
getTimeout | public long getTimeout()(Code) | | |
handleTransportException | public void handleTransportException(SendFailedException e)(Code) | | |
isLoggedOut | public boolean isLoggedOut()(Code) | | Check whether this session is already logged out.
Useful to avoid loops.
|
isSent | public boolean isSent()(Code) | | |
login | public void login()(Code) | | Login this session.
Updates access time, sets initial environment and connects all configured mailboxes.
|
logout | public void logout()(Code) | | Terminate this session.
This will expunge deleted messages, close all mailbox connections, save the user data and then
remove this session from the session list, effectively destroying this session.
|
parseMIMEContent | protected void parseMIMEContent(Part p, XMLMessagePart parent_part, String msgid) throws MessagingException(Code) | | Use depth-first search to go through MIME-Parts recursively.
Parameters: p - Part to begin with |
prepareCompose | public void prepareCompose()(Code) | | |
refreshFolderInformation | public void refreshFolderInformation()(Code) | | |
refreshFolderInformation | public void refreshFolderInformation(boolean subscribed_only)(Code) | | Refresh Information about folders.
Tries to connect folders that are not yet connected.
|
refreshFolderInformation | public void refreshFolderInformation(String folderhash)(Code) | | |
removeFolder | public void removeFolder(String id, boolean recurse) throws MessagingException(Code) | | |
removeMailbox | public void removeMailbox(String name)(Code) | | Remove the mailbox with the given name.
Will first disconnect all mailboxes, remove the given mailbox and then update the model.
Parameters: name - Name of the mailbox that is to be removed. |
removeWorkAttachment | public void removeWorkAttachment(String name)(Code) | | Remove the attachment with the given name from the current work message.
|
saveData | public void saveData()(Code) | | |
setEnv | public void setEnv()(Code) | | |
setFlags | public void setFlags(String folderhash, HTTPRequestHeader head) throws MessagingException(Code) | | Change the Flags of the messages the user selected.
|
setLastAccess | public void setLastAccess()(Code) | | Update the last access time.
Sets the last access time to the current time.
See Also: TimeableConnection |
setSent | public void setSent(boolean b)(Code) | | |
setSubscribedAll | public void setSubscribedAll(String id, boolean subscribed) throws MessagingException(Code) | | Subscribe all folders for a Mailhost
Do it the non-recursive way: Uses a simple Queue :-)
|
storeMessage | public void storeMessage(HTTPRequestHeader head)(Code) | | Store a message in the environment for further processing.
|
subscribeFolder | public void subscribeFolder(String folderhash)(Code) | | Try to subscribe to a folder (i.e. unhide it)
|
timeoutOccured | public void timeoutOccured()(Code) | | Handle a timeout for this session.
This calls the logout method, effectively terminating this session.
See Also: TimeableConnection See Also: logout() |
unsubscribeFolder | public void unsubscribeFolder(String folderhash)(Code) | | Try to unsubscribe from a folder (i.e. hide it)
|
|
|