FileDocCategorySizeDatePackage
MailboxInfo.javaAPI DocGlassfish v2 API4139Mon May 14 15:28:44 BST 2007com.sun.mail.imap.protocol

MailboxInfo

public class MailboxInfo extends Object
This class
version
1.11, 07/05/04
author
John Mani

Fields Summary
public Flags
availableFlags
public Flags
permanentFlags
public int
total
public int
recent
public int
first
public long
uidvalidity
public long
uidnext
public int
mode
Constructors Summary
public MailboxInfo(Response[] r)


         
	for (int i = 0; i < r.length; i++) {
	    if (r[i] == null || !(r[i] instanceof IMAPResponse))
		continue;

	    IMAPResponse ir = (IMAPResponse)r[i];

	    if (ir.keyEquals("EXISTS")) {
		total = ir.getNumber();
		r[i] = null; // remove this response
	    }
	    else if (ir.keyEquals("RECENT")) {
		recent = ir.getNumber();
		r[i] = null; // remove this response
	    }
	    else if (ir.keyEquals("FLAGS")) {
		availableFlags = new FLAGS(ir);
		r[i] = null; // remove this response
	    }
	    else if (ir.isUnTagged() && ir.isOK()) {
		/* should be one of:
		   	* OK [UNSEEN 12]
		   	* OK [UIDVALIDITY 3857529045]
		   	* OK [PERMANENTFLAGS (\Deleted)]
		   	* OK [UIDNEXT 44]
		*/
		ir.skipSpaces();

		if (ir.readByte() != '[") {	// huh ???
		    ir.reset();
		    continue;
		}

		boolean handled = true;
		String s = ir.readAtom();
		if (s.equalsIgnoreCase("UNSEEN"))
		    first = ir.readNumber();
		else if (s.equalsIgnoreCase("UIDVALIDITY"))
		    uidvalidity = ir.readLong();
		else if (s.equalsIgnoreCase("PERMANENTFLAGS"))
		    permanentFlags = new FLAGS(ir);
		else if (s.equalsIgnoreCase("UIDNEXT"))
		    uidnext = ir.readLong();
		else
		    handled = false;	// possibly an ALERT

		if (handled)
		    r[i] = null; // remove this response
		else
		    ir.reset();	// so ALERT can be read
	    }
	}

	/*
	 * The PERMANENTFLAGS response code is optional, and if
	 * not present implies that all flags in the required FLAGS
	 * response can be changed permanently.
	 */
	if (permanentFlags == null) {
	    if (availableFlags != null)
		permanentFlags = new Flags(availableFlags);
	    else
		permanentFlags = new Flags();
	}
    
Methods Summary