Class ImapUrlFetcher.

Inherits EventHandler

Returns the texts referenced by a List of IMAP URLs.

This class takes a list of ImapUrls and retrieves the corresponding text from the database, subject to validation and access control. It is the basis for our CATENATE/URLFETCH/BURL support.

For each submitted URL, this class does the following:

1. Verify that the ImapUrl::user() is valid. 2. Verify that the ImapUrl::mailboxName() refers to an existing mailbox in the relevant user's namespace; and, if the URL has a UIDVALIDITY, check that it's the same as that of the mailbox. 3. Verify that the user has read access to that mailbox. 4. Fetch the access key for that (user,mailbox). 5. Verify that the URLAUTH token matches the URL. (We assume that the caller has checked ImapUrl::access() already.) 6. Verify that the URL has not EXPIREd. 7. Fetch and set the text corresponding to the URL. 8. Notify the caller of completion.

ImapUrlFetcher::ImapUrlFetcher( List<ImapUrl> * l, EventHandler * ev )

Creates an ImapUrlFetcher object to retrieve the ImapUrls in the list l for the EventHandler ev, which will be notified upon completion. The URL objects in l are assumed to be valid.

EString ImapUrlFetcher::badUrl() const

Returns the ImapUrl (in EString form) that caused the error(). This function is meaningful only when failed() is true, and it is meant to set the BADURL resp-text-code.

bool ImapUrlFetcher::done() const

Returns true only if this object has finished retrieving the text for the ImapUrls it was given; and false if it's still working.

EString ImapUrlFetcher::error() const

Returns a message describing why this object failed(), or an empty string if it's still working, or completed successfully.

bool ImapUrlFetcher::failed() const

Returns true only if this object encountered an error in trying to retrieve the text for the ImapUrls it was given, and false if the attempt is still in progress, or completed successfully. If this function returns true, badUrl() and error() describe the problem.

void ImapUrlFetcher::setError( const EString & msg, const EString & url )

Records the given error msg for the url. After the first call, done() and failed() will return true, error() will return msg, and badUrl() will return url. Subsequent calls are ignored.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.