Class GIT.GVU.IMAP.Connection
All Packages Class Hierarchy This Package Previous Next Index
Class GIT.GVU.IMAP.Connection
java.lang.Object
|
+----GIT.GVU.IMAP.Connection
- public class Connection
- extends Object
Class to hold onto a logged-in connection to an IMAP server.
This class is generally used to get at mailboxes (SELECT them). This
class is basically a representation of the Authenticated state in
RFC1730. Once you have used SELECT or EXAMINE, you are in the
selected state of the protocol and then call getMailbox() to get the
mailbox object that has your mail data.
-
CREATE(String)
- This function creates a new mailbox.
-
DELETE(String)
- This command PERMANENTLY removes a mailbox.
-
EXAMINE(String)
-
Examine a mailbox (i.e.
-
LIST(String, String)
-
List the available mailboxes on this connection.
-
RENAME(String, String)
-
This command renames a mailbox.
-
SELECT(String)
- Select a mailbox for use on this connection.
-
getMailbox()
- This function returns the current mailbox.
-
getMailboxNames()
- This function returns a vector of MailboxNames (although you'll have
to cast them to get them out.
SELECT
public boolean SELECT(String s) throws InternalErr, IMAPException
- Select a mailbox for use on this connection.
- Parameters:
- s - name of the mailbox
- Returns:
- true if the command was successful, false otherwise
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
EXAMINE
public boolean EXAMINE(String s) throws InternalErr, IMAPException
- Examine a mailbox (i.e. select but readonly) on this connection.
- Parameters:
- s - name of the mailbox
- Returns:
- true if the command succeeded, false otherwise
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
LIST
public boolean LIST(String refname,
String mailbox) throws InternalErr, IMAPException
- List the available mailboxes on this connection. Note: you can always
list mailboxes, even when selected.
To list the mailboxes in the user foo's Mail directory use:
EXAMINE("~foo/Mail/","*");
- Parameters:
- refname - string with reference name (prefix)
- mailbox - string with mailbox name (suffix)
- Returns:
- true if LIST succeeded, false otherwise
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
getMailbox
public Mailbox getMailbox()
- This function returns the current mailbox. Note: you can always call
this function but it will return null if no mailbox is selected. Also,
if you call SELECT or EXAMINE when you are already selecting a mailbox
the value of this function WILL change. It will replace the old mailbox
with the new mailbox or set it to null if the SELECT or EXAMINE fails.
getMailboxNames
public Vector getMailboxNames()
- This function returns a vector of MailboxNames (although you'll have
to cast them to get them out. This is a the set of MailboxName objects
which was created with the last LIST command. Note: If you call LIST
with bad parameters or with a mailbox specifiers which don't result
in any mailbox names you'll get an empty vector from this function.
- Returns:
- a vector containing zero or more mailbox objects
CREATE
public boolean CREATE(String s) throws InternalErr, IMAPException
- This function creates a new mailbox. You'll need to be careful to
use the correct separator character if you want to create a directory
on the server side.
You can not and should not CREATE an INBOX. It is always there.
- Returns:
- true if the creation succeeded, false otherwise
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
DELETE
public boolean DELETE(String s) throws InternalErr, IMAPException
- This command PERMANENTLY removes a mailbox. Be careful!
You can not and should not DELETE the INBOX. The system needs it.
- Parameters:
- s - string with the name of the mailbox to delete
- Returns:
- true only if the mailbox was actually deleted
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
RENAME
public boolean RENAME(String s,
String n) throws InternalErr, IMAPException
- This command renames a mailbox. Note: As per RFC 1730, you can rename
the INBOX. If you do so, a new INBOX is created. Note: You cannot
DELETE or CREATE the INBOX so this seems a little funny to me.
- Parameters:
- s - string with the mailbox's current name
- n - string with the mailbox's new name
- Returns:
- true if the RENAME succeeded, false otherwise
- Throws: IMAPException
- is propagated
- Throws: InternalErr
- is propagated
All Packages Class Hierarchy This Package Previous Next Index