import MessageException; import FolderException; import LoginException; import NetworkConnection; import MessageHeader; import MailMessage; /** * A protocal for Java to interact with an IMAP server * * @author Ben Kaiser * @author Josh Vickery * @version 1.1 of October 1999 * * @modified from version 1.0 to include better headers, separate into multiple * @classes, and actually compile. */ public interface MailboxInterface { /** * Attempt to login to the server * This will attempt to create a NetworkConnection using the * NetworkConnection class, with a server name and port deterimined by * the preferances class. If successful it will attemp to login using * the given name and passwd * @exception LoginExcpetion * when it is a bad UserName Password combo */ public void login(String username, String passwd) throws LoginException, Exception; /**closes the imap socket. Pre: there is an IMAP socket open.*/ public void bye(); /* Folder Commands */ /** list the folders in the account, in the form of an array. pre: we are currently logged in to an imap server. returns: an array of strings, which are the folder names of the account currently logged in to teh server.*/ public String listFolders(); /**delete a specific folder and its contenets. throws FolderException if the given folder does not exist. pre: we are currently logged in to an imap server.*/ public void deleteFolder(String folderName) throws FolderException; /**create an empty folder with the specified name. Throws folderException if a folder of that name cannot be created. pre: we are currently logged in to an imap server.*/ public void createFolder(String folderName) throws FolderException; /** get the contents of a folder, returns an array of headers, throws FolderException if the specified folder doesn't exist or cannot be accessed. pre: we are currently logged into an IMAP server. returns an array of MessageHeaders, which are teh headers of the messages in teh active folder.*/ /*will return an array of MessageHeaders when they exist, but strings for now.*/ public String[] getFolderContents() throws Exception; /**renames a folder, throws FolderException when a folder cannot be created with that name. Pre: we are currently logged into an IMAP server.*/ public void renameFolder(String folderName, String newFolderName) throws FolderException; /**Sets the active folder. throws FolderException that folder doesn't exist, or is otherwise unavaliable. Pre: we are currently logged in to an IMAP server. */ public void setFolder(String folderName) throws FolderException, Exception; /** Message Commands */ /**Deletes a message, throws MessageException if the message in question doesn't exist. Pre: we're logged in to an IMAP server, and have a valid folder set as active.*/ public void deleteMessage(int MessageName) throws MessageException; /**Get the contents of a message, returns a MailMessage, throws MessageException when teh message in question doesn't exist, or is otherwise unabaliable. pre: we are logged in to an IMAP server.*/ public String getMessage(int messageID, String[] headers) throws MessageException;//, java.io.IOException; }//Mailbox