Class GIT.GVU.IMAP.Protocol
All Packages Class Hierarchy This Package Previous Next Index
Class GIT.GVU.IMAP.Protocol
java.lang.Object
|
+----GIT.GVU.IMAP.Protocol
- public class Protocol
- extends Object
Class to initiate and control the protocol level exchange with an
IMAP server. This class is used *before* connection is established as
well as to hold onto a non-authenticated connection before logging in.
See RFC1730 for more info on the system states.
-
Protocol()
-
Create a protocol object.
-
LOGIN(String, String)
- Login with a connection to the IMAP server.
-
LOGOUT()
- Logout of an IMAP server.
-
NOOP()
- This command is used to "do nothing" to the server.
-
connect(String)
- Connect to server.
-
getConnection()
-
Get the connection object associated with this protocol object.
-
getIO()
- Get the IO object associated with this connection.
-
setByeAction(AsynchronousAction)
- This lets you set the object that gets called if we get the BYE message from
the server.
Protocol
public Protocol()
- Create a protocol object. This can't do anything useful until you
call connect.
- See Also:
- connect
connect
public void connect(String s) throws IMAPException, InternalErr
- Connect to server. Stupidly, this doesn't result in a connection
object, the LOGIN() command does.
- Parameters:
- s - the String with the server name to connect to
- Throws: IMAPException
- is thrown if the connection cannot be completed (check the detail message)
- Throws: InternalErr
- is thrown if we fail to ascertain the capability of the IMAP server
LOGIN
public boolean LOGIN(String u,
String p) throws InternalErr, IMAPException
- Login with a connection to the IMAP server. This will allow you to
proceed and call getConnection(). Note: BOGUS! This passes your
password over the network in the clear! We are no worse off than
rlogin or telnet I guess, but I should be using AUTHENTICATE
instead of LOGIN.
- Parameters:
- u - the user name for whom this authentication is being checked
- p - the password of this user
- Throws: IMAPException
- if the protocol state is violated
- Throws: InternalErr
- is thrown if we get a message back from the server that the LOGIN was badly formed... we do this do make it easy to distinguish bad logins from bad protocol since bad protocol is very unlikely.
q * @return true if the login procedure succeeded, false if not
LOGOUT
public boolean LOGOUT() throws IMAPException, InternalErr
- Logout of an IMAP server. This will both disconnect and log you out, so
further connections will require a connect() and a LOGIN().
- Returns:
- true if logout was successful, false otherwise
- Throws: IMAPException
- if the protocol state is violated
- Throws: InternalErr
- is propagated
NOOP
public boolean NOOP() throws IMAPException, InternalErr
- This command is used to "do nothing" to the server. It returns true or
false to tell if it worked or not. It is useful in that it resets the
autologout timer inside the server and may result in the number
messages changing in a mailbox (due to new mail). Also, the status of
messages in mailboxes might have changed and might be updated.
Note: this call doesn't require you have called LOGIN() yet,
but it isn't terribly useful if you haven't.
- Returns:
- true if NOOP was successful, false otherwise
- Throws: IMAPException
- is thrown if the protocol state is violated
- Throws: InternalErr
- is propagated
getConnection
public Connection getConnection()
- Get the connection object associated with this protocol object. Note:
you can call this anytime, but you'll get a null if we are not yet
logged in and connected and all that mess.
- Returns:
- current connection object
getIO
public IO getIO()
- Get the IO object associated with this connection.
- Returns:
- current IO object
setByeAction
public void setByeAction(AsynchronousAction a)
- This lets you set the object that gets called if we get the BYE message from
the server. By the time the action object gets notified, the Connection object
associated with this Protocol object (and everything further downstream) is
already gone. You should probably use this to inform the user what is happening.
The parameter given to this Action object is a String with the reason (if any)
for the demise of this connection.
- Parameters:
- AsynchronousAction - a object to be invoked on a BYE message
All Packages Class Hierarchy This Package Previous Next Index