Package com.sun.mail.gimap.protocol

# Class GmailProtocol

java.lang.Object
com.sun.mail.iap.Protocol
com.sun.mail.imap.protocol.IMAPProtocol
com.sun.mail.gimap.protocol.GmailProtocol

public class GmailProtocol extends IMAPProtocol
Extend IMAP support to handle Gmail-specific protocol extensions.

Since:
  JavaMail 1.4.6
Author:
  Bill Shannon

## Field Summary

Fields
Modifier and Type
Field
Description
`static final FetchItem`
`LABELS_ITEM`
`static final FetchItem`
`MSGID_ITEM`
`static final FetchItem`
`THRID_ITEM`

### Fields inherited from class com.sun.mail.imap.protocol.IMAPProtocol

`enabled, searchCharsets, searchSequence`

### Fields inherited from class com.sun.mail.iap.Protocol

`host, logger, prefix, props, quote, traceLogger`

## Constructor Summary

Constructors
Constructor
Description
`GmailProtocol(String name, String host, int port, Properties props, boolean isSSL, MailLogger logger)`
Connect to Gmail.

## Method Summary

Modifier and Type
Method
Description
`FetchItem[]`
`getFetchItems()`
Return the additional fetch items supported by the Gmail protocol.
`protected SearchSequence`
`getSearchSequence()`
Return a GmailSearchSequence.
`void`
`storeLabels(int start, int end, String[] labels, boolean set)`
Set the specified labels on this message.
`void`
`storeLabels(int msg, String[] labels, boolean set)`
Set the specified labels on this message.
`void`
`storeLabels(MessageSet[] msgsets, String[] labels, boolean set)`
Set the specified labels on this message.

### Methods inherited from class com.sun.mail.imap.protocol.IMAPProtocol

`append, appenduid, appenduid, authlogin, authntlm, authoauth2, authplain, capability, check, close, compress, copy, copy, copyuid, copyuid, create, createFlagList, delete, deleteACL, disconnect, doList, enable, examine, examine, expunge, fetch, fetch, fetch, fetchBody, fetchBody, fetchBody, fetchBody, fetchBody, fetchBodyStructure, fetchFlags, fetchMODSEQ, fetchRFC822, fetchSectionBody, fetchSequenceNumber, fetchSequenceNumbers, fetchSequenceNumbers, fetchUID, getACL, getCapabilities, getCopyUID, getProxyAuthUser, getQuota, getQuotaRoot, getResponseBuffer, handleCapabilityResponse, handleLoginResult, hasCapability, id, id, idleAbort, idleStart, isAuthenticated, isEnabled, isREV1, list, listRights, login, logout, lsub, move, move, moveuid, moveuid, myRights, namespace, noop, parseCapabilities, peekBody, peekBody, peekBody, processGreeting, processIdleResponse, proxyauth, readIdleResponse, readResponse, rename, sasllogin, search, search, select, select, setACL, setCapabilities, setQuota, sort, startTLS, status, storeFlags, storeFlags, storeFlags, subscribe, supportsNonSyncLiterals, supportsUtf8, uidexpunge, uidfetchChangedSince, unauthenticate, unselect, unsubscribe, writeMailboxName`

### Methods inherited from class com.sun.mail.iap.Protocol

`addResponseHandler, command, finalize, getChannel, getInetAddress, getInputStream, getLocalHost, getLocalSocketAddress, getOutputStream, getTimestamp, handleResult, hasResponse, isSSL, isTracing, notifyResponseHandlers, removeResponseHandler, resumeTracing, simpleCommand, startCompression, startTLS, suspendTracing, writeCommand`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### MSGID_ITEM

public static final FetchItem MSGID_ITEM

### THRID_ITEM

public static final FetchItem THRID_ITEM

### LABELS_ITEM

public static final FetchItem LABELS_ITEM

## Constructor Details

### GmailProtocol

public GmailProtocol(String name, String host, int port, Properties props, boolean isSSL, MailLogger logger) throws IOException, ProtocolException
Connect to Gmail.

Parameters:
  `name` - the protocol name
  `host` - host to connect to
  `port` - portnumber to connect to
  `props` - Properties object used by this protocol
  `isSSL` - use SSL?
  `logger` - for log messages
Throws:
  `IOException` - for I/O errors
  `ProtocolException` - for protocol failures

## Method Details

### getFetchItems

public FetchItem[] getFetchItems()
Return the additional fetch items supported by the Gmail protocol. Combines our fetch items with those supported by the superclass.

Overrides:
  `getFetchItems` in class `IMAPProtocol`
Returns:
  an array of FetchItem objects

### storeLabels

public void storeLabels(MessageSet[] msgsets, String[] labels, boolean set) throws ProtocolException
Set the specified labels on this message.

Parameters:
  `msgsets` - the message sets
  `labels` - the labels
  `set` - true to set, false to clear
Throws:
  `ProtocolException` - for protocol failures
Since:
  JavaMail 1.5.5

### storeLabels

public void storeLabels(int start, int end, String[] labels, boolean set) throws ProtocolException
Set the specified labels on this message.

Parameters:
  `start` - the first message number
  `end` - the last message number
  `labels` - the labels
  `set` - true to set, false to clear
Throws:
  `ProtocolException` - for protocol failures
Since:
  JavaMail 1.5.5

### storeLabels

public void storeLabels(int msg, String[] labels, boolean set) throws ProtocolException
Set the specified labels on this message.

Parameters:
  `msg` - the message number
  `labels` - the labels
  `set` - true to set, false to clear
Throws:
  `ProtocolException` - for protocol failures
Since:
  JavaMail 1.5.5

### getSearchSequence

protected SearchSequence getSearchSequence()
Return a GmailSearchSequence.

Overrides:
  `getSearchSequence` in class `IMAPProtocol`
Returns:
  the SearchSequence