input
stringlengths
10
828
output
stringlengths
5
107
public object clone rights r null try r rights super clone r rights new boolean 128 system arraycopy this rights 0 r rights 0 this rights length catch clone not supported exception cex ignore can t happen return r
returns a clone of this rights object
protected boolean supports non sync literals return has capability literal
returns whether this protocol supports non synchronizing literals
public response read response throws ioexception protocol exception assert thread holds lock this can t assert because it s called from constructor return imapresponse read response this
read a response from the server
private void check seen if peek if we re peeking don t set the seen flag return try folder f msg get folder if f null f get mode folder read only msg is set flags flag seen msg set flag flags flag seen true catch messaging exception ex ignore it
normally the seen flag will have been set by now but if not
public boolean has capability string c return capabilities contains key c to upper case locale english
check whether the given capability is supported by
protected int simple command byte cmd throws messaging exception assert thread holds lock this send command cmd return read server response
send the command to the server and return the response code
public map get capabilities return capabilities
return the map of capabilities returned by the server
private void empty connection pool boolean force synchronized pool for int index pool authenticated connections size 1 index 0 index try imapprotocol p imapprotocol pool authenticated connections element at index p remove response handler this if force p disconnect else p logout catch protocol exception pex pool authenticated connections remove all elements if pool debug out println debug removed all authenticated connections
empty the connection pool
public void disconnect super disconnect authenticated false just in case
close socket connection
protected void send command string cmd throws messaging exception send command asciiutility get bytes cmd
sends command code cmd code to the server terminating
public void noop throws protocol exception if debug out println imap debug imapprotocol noop simple command noop null
the noop command
protected void check connected if super is connected throw new illegal state exception not connected
check if were in the connected state
public boolean supports extension string ext return ext map null ext map get ext to upper case locale english null
return true if the smtp server supports the specified service
public string get extension parameter string ext return ext map null null string ext map get ext to upper case locale english
return the parameter the server provided for the specified
protected boolean supports authentication string auth assert thread holds lock this if ext map null return false string a string ext map get auth if a null return false string tokenizer st new string tokenizer a while st has more tokens string tok st next token if tok equals ignore case auth return true return false
does the server were connected to support the specified
public void set quota quota quota throws messaging exception check connected imapprotocol p null try p get store protocol p set quota quota catch bad command exception bex throw new messaging exception quota not supported bex catch connection exception cex throw new store closed exception this cex get message catch protocol exception pex throw new messaging exception pex get message pex finally release store protocol p if p null failed to get a store connection have to force store to be closed cleanup
set the quotas for the quota root specified in the quota argument
protected object get message cache lock return imapfolder folder message cache lock
get the message cache lock associated with this messages
protected int get sequence number return seqnum
get this messages imap sequence number
protected void set sequence number int seqnum this seqnum seqnum
set this messages imap sequence number
protected void set message number int msgnum super set message number msgnum
wrapper around the protected method message
public element find enclosing element final int pos return find enclosing element pos null
returns the most nested
private append uid get append uid response r if r is ok return null byte b while b r read byte 0 b byte if b 0 return null string s s r read atom if s equals ignore case appenduid return null long uidvalidity r read long long uid r read long return new append uid uidvalidity uid
if the response contains an appenduid response code extract
public element find enclosing element final int pos string name int start before pos if name null name name to lower case final boolean is xmltag name tag is xmlname name while true start tag start tag start tag find previous this start before name start tag type normal is xmltag name if start tag null return null element element start tag get element if pos element end return element start before start tag begin 1
returns the most nested
public address get sender throws messaging exception check expunged load envelope if envelope sender null return envelope sender 0 there can be only one sender else return null
get the sender attribute
public string get subject throws messaging exception check expunged if subject null already cached return subject load envelope if envelope subject null no subject return null cache and return the decoded value try subject mime utility decode text envelope subject catch unsupported encoding exception ex subject envelope subject return subject
get the decoded subject
public void uidexpunge uidset set throws protocol exception if has capability uidplus throw new bad command exception uid expunge not supported simple command uid expunge uidset to string set null
uid expunge command
private int find name list info li string lname int i if the name contains a wildcard there might be more than one for i 0 i li length i if li i name equals lname break if i li length nothing matched exactly xxx possibly should fail but what if server is case insensitive and returns the preferred case of the name here i 0 use first one return i
which entry in code li code matches code lname code
public date get sent date throws messaging exception check expunged load envelope if envelope date null return null else return new date envelope date get time
get the sent date
public int find name end int pos if tag is xmlname start char string char at pos return 1 while pos string length tag is xmlname char string char at pos pos return pos
returns the end position of the a target blank href http www
public date get received date throws messaging exception check expunged load envelope if received date null return null else return new date received date get time
get the recieved date internaldate
public int get size throws messaging exception check expunged if size 1 load envelope xxx could just fetch the size return size
get the message size
public int get line count throws messaging exception check expunged load bodystructure return bs lines
get the total number of lines
public string get in reply to throws messaging exception check expunged load envelope return envelope in reply to
get the in reply to header
public string get content type throws messaging exception check expunged if we haven t cached the type yet if type null load bodystructure generate content type from bodystructure content type ct new content type bs type bs subtype bs c params type ct to string return type
get the content type
public void ignore when parsing final int begin final int end if was full sequential parse called throw new illegal state exception ignore when parsing can not be used after full sequential parse has been called if parse text output document null parse text output document new output document get parse text parse text null parse text output document replace with spaces begin end
causes the specified range of the source text to be ignored when parsing
public string get disposition throws messaging exception check expunged load bodystructure return bs disposition
get the content disposition
public string get encoding throws messaging exception check expunged load bodystructure return bs encoding
get the content transfer encoding
public string get content id throws messaging exception check expunged load bodystructure return bs id
get the content id
public string get content md5 throws messaging exception check expunged load bodystructure return bs md5
get the content md5
public folder get folder string name throws messaging exception if we know that this folder is not a directory don t send the request to the server at all if attributes null is directory throw new messaging exception cannot contain subfolders char c get separator return new imapfolder full name c name c imapstore store
get the named subfolder
public string get description throws messaging exception check expunged if description null cached value return description load bodystructure if bs description null return null try description mime utility decode text bs description catch unsupported encoding exception ex description bs description return description
get the decoded content description
protected byte array get response buffer byte array ret ba ba null return ret
return a buffer to read a response into
public string get message id throws messaging exception check expunged load envelope return envelope message id
get the message id
public string get file name throws messaging exception check expunged string filename null load bodystructure if bs d params null filename bs d params get filename if filename null bs c params null filename bs c params get name return filename
get the filename disposition parameter
public flags fetch flags int msgno throws protocol exception flags flags null response r fetch msgno flags search for our flags response for int i 0 len r length i len i if r i null r i instanceof fetch response fetch response r i get number msgno continue fetch response fr fetch response r i if flags flags fr get item flags class null r i null remove this response break dispatch untagged responses notify response handlers r handle result r r length 1 return flags
fetch the flags for the given message
public string get cache debug info return cache to string
returns a string representation of the tag cache useful for debugging purposes
public uid fetch uid int msgno throws protocol exception response r fetch msgno uid dispatch untagged responses notify response handlers r response response r r length 1 if response is ok return uid fetch response get item r msgno uid class else if response is no xxx issue noop return null else handle result response return null notreached
fetch the imap uid for the given message
public uid fetch sequence number long uid throws protocol exception uid u null response r fetch string value of uid uid true for int i 0 len r length i len i if r i null r i instanceof fetch response continue fetch response fr fetch response r i if u uid fr get item uid class null if u uid uid this is the one we want break else u null notify response handlers r handle result r r length 1 return u
get the sequence number for the given uid
public writer get log writer if logger instanceof writer logger return null return writer logger get logger get writer
returns the destination code writer code for log messages
public enumeration get all headers throws messaging exception check expunged load headers return super get all headers
get all headers
public void log final string message logger info message
writes the specified message to the log
public boolean is logging enabled return logger is info enabled
indicates whether logging is currently enabled
public void set quota final quota q throws messaging exception do optional command quota not supported new protocol command public object do command imapprotocol p throws protocol exception p set quota q return null
set the quotas for the quotaroot specified in the quota argument
public object get content data source ds throws ioexception try return new multipart report ds catch messaging exception e ioexception ioex new ioexception exception while constructing multipart report ioex init cause e throw ioex
return the content
public int get size return 0
return the size of this message
public void set data handler data handler dh throws messaging exception throw new messaging exception can t set content for message headers
cant set any content for a message headers object
public void set message dsn internet headers message dsn this message dsn message dsn
set the per message fields in the delivery status notification
public int get recipient dsncount return recipient dsn length
return the number of recipients for which we have
public internet headers get recipient dsn int n return recipient dsn n
return the delivery status notification information for
public void add recipient dsn internet headers h internet headers rh new internet headers recipient dsn length 1 system arraycopy recipient dsn 0 rh 0 recipient dsn length recipient dsn rh recipient dsn recipient dsn length 1 h
add deliver status notification information for another
public boolean remove body part body part part throws messaging exception throw new messaging exception can t remove body parts from multipart report
remove the specified part from the multipart message
public void remove body part int index throws messaging exception throw new messaging exception can t remove body parts from multipart report
remove the part at specified location starting from 0
public folder get folder string name throws messaging exception check connected return new pop3 folder this name
only the name inbox is supported
public void add acl acl acl throws messaging exception set acl acl 0
add an access control list entry to the access control list
public char get separator return 0
always returns a nul character because pop3 doesnt support a hierarchy
public boolean create int type throws messaging exception return false
always returns code false code the pop3 protocol doesnt
public boolean has new messages throws messaging exception return false no way to know
always returns code false code the pop3 protocol provides
public folder get folder string name throws messaging exception throw new messaging exception not a directory
always throws code messaging exception code because no pop3 folders
public boolean delete boolean recurse throws messaging exception throw new method not supported exception delete
always throws code method not supported exception code
public input stream top int n throws messaging exception try synchronized this return folder get protocol top msgnum n catch eofexception eex folder close false throw new folder closed exception folder eex to string catch ioexception ex throw new messaging exception error getting size ex
fetch the header of the message and the first code n code lines
public boolean rename to folder f throws messaging exception throw new method not supported exception rename to
always throws code method not supported exception code
public flags get permanent flags return new flags empty flags object
always returns an empty code flags code object because
public void remove acl final string name throws messaging exception do optional command acl not supported new protocol command public object do command imapprotocol p throws protocol exception p delete acl full name name return null
remove any access control list entry for the given identifier
public void append messages message msgs throws messaging exception throw new method not supported exception append not supported
always throws code method not supported exception code
public enumeration get all headers throws messaging exception if headers null load headers return headers get all headers
return all the headers from this message as an enumeration
protected void finalize throws throwable super finalize close false
close the folder when were finalized
public void add header line string line throws messaging exception xxx should check for read only folder throw new illegal write exception pop3 messages are read only
add a raw rfc822 header line
private string get digest string password string key apop challenge password byte digest try message digest md message digest get instance md5 digest md digest key get bytes iso 8859 1 xxx catch no such algorithm exception nsae return null catch unsupported encoding exception uee return null return to hex digest
gets the apop message digest
public enumeration get all header lines throws messaging exception if headers null load headers return headers get all header lines
get all header lines as an enumeration of strings
private response multiline command string cmd int size throws ioexception response r simple command cmd if r ok return r shared byte array output stream buf new shared byte array output stream size int b lastb n while b input read 0 if lastb n b b input read if b r end of response consume lf as well b input read break buf write b lastb b if b 0 throw new eofexception eof on socket r bytes buf to stream return r
issue a pop3 command that expects a multi line response
public void save changes throws messaging exception pop3 messages are read only throw new illegal write exception pop3 messages are read only
pop3 message cant be changed
public void set sub type string subtype throws messaging exception throw new method not supported exception can t change sun v3 multipart subtype
set the subtype
public boolean process idle response response r throws protocol exception response responses new response 1 responses 0 r boolean done false done reading responses notify response handlers responses if r is bye shouldn t wait for command completion response done true if this is a matching command completion response we are done if r is tagged r get tag equals idle tag done true if done idle tag null no longer in idle handle result r return done
process a response returned by read idle response
public int get size throws messaging exception string s get header x sun content length null try return integer parse int s catch number format exception ex return 1
return the size of the content of this body part in bytes
public int get line count throws messaging exception string s get header x sun content lines null try return integer parse int s catch number format exception ex return 1
return the number of lines for the content of this part
public date get received date throws messaging exception if rcv date null unix from null int i find the space after the address before the date i unix from index of 5 if i 5 try rcv date new date unix from substring i catch illegal argument exception iae ignore it return rcv date null null new date rcv date get time
get the date this message was received from the unix from line
public string get content type throws messaging exception string ct get header content type null if ct null ct get header x sun data type null if ct null ct text plain else if ct index of 0 ct mime v3 map to mime ct return ct
returns the value of the rfc822 content type header field
public int get line count throws messaging exception if line count 0 is mime type text plain line counter lc new line counter null output stream write to will set the seen flag remember the original state boolean seen is set flags flag seen try get data handler write to lc line count lc get line count lc close catch ioexception ex ignore it can t happen if seen set flag flags flag seen false return line count
return the number of lines for the content of this message
public string get encoding throws messaging exception string enc super get encoding if enc null enc get header x sun encoding info null return enc
returns the value of the content transfer encoding header
public string get description throws messaging exception string desc super get description if desc null desc get header x sun data description null return desc
returns the content description header field of this body part
public string get content type throws messaging exception string ct super get content type if ct index of 0 ct sun v3 body part mime v3 map to mime ct return ct
return the content type mapping from sun v3 types to mime types
public void add rights acl acl throws messaging exception set acl acl
add the rights specified in the acl to the entry for the
public void set description string description throws messaging exception throw new method not supported exception sun v3 body part not writable
set the content description header field for this body part
protected input stream get content stream throws messaging exception if is set flags flag seen set flag flags flag seen true return super get content stream
produce the raw bytes of the content
public string get file name throws messaging exception string name super get file name if name null name get header x sun data name null return name
get the filename associated with this body part
public void set file name string filename throws messaging exception throw new method not supported exception sun v3 body part not writable
set the filename associated with this body part if possible
public void idle abort throws protocol exception output stream os get output stream try os write done os flush catch ioexception ex nothing to do hope to detect it again later
abort an idle command
protected void update headers throws messaging exception throw new method not supported exception sun v3 body part update headers
this is the method that has the smarts to query the content
public void remove rights acl acl throws messaging exception set acl acl
remove the rights specified in the acl from the entry for the
public void close throws ioexception stream close
closes the underlying stream