VMime
|
Public Member Functions | |
IMAPFolder (const folder::path &path, shared_ptr< IMAPStore > store, shared_ptr< folderAttributes > attribs) | |
~IMAPFolder () | |
int | getMode () const |
const folderAttributes | getAttributes () |
const folder::path::component | getName () const |
const folder::path | getFullPath () const |
void | open (const int mode, bool failIfModeIsNotAvailable=false) |
void | close (const bool expunge) |
void | create (const folderAttributes &attribs) |
bool | exists () |
void | destroy () |
bool | isOpen () const |
shared_ptr< message > | getMessage (const int num) |
std::vector< shared_ptr < message > > | getMessages (const messageSet &msgs) |
std::vector< int > | getMessageNumbersStartingOnUID (const message::uid &uid) |
int | getMessageCount () |
shared_ptr< folder > | getFolder (const folder::path::component &name) |
std::vector< shared_ptr< folder > > | getFolders (const bool recursive=false) |
void | rename (const folder::path &newPath) |
void | deleteMessages (const messageSet &msgs) |
void | setMessageFlags (const messageSet &msgs, const int flags, const int mode=message::FLAG_MODE_SET) |
messageSet | addMessage (shared_ptr< vmime::message > msg, const int flags=-1, vmime::datetime *date=NULL, utility::progressListener *progress=NULL) |
messageSet | addMessage (utility::inputStream &is, const size_t size, const int flags=-1, vmime::datetime *date=NULL, utility::progressListener *progress=NULL) |
messageSet | copyMessages (const folder::path &dest, const messageSet &msgs) |
void | status (int &count, int &unseen) |
shared_ptr< folderStatus > | getStatus () |
void | noop () |
void | expunge () |
shared_ptr< folder > | getParent () |
shared_ptr< const store > | getStore () const |
shared_ptr< store > | getStore () |
void | fetchMessages (std::vector< shared_ptr< message > > &msg, const fetchAttributes &options, utility::progressListener *progress=NULL) |
void | fetchMessage (shared_ptr< message > msg, const fetchAttributes &options) |
std::vector< shared_ptr < message > > | getAndFetchMessages (const messageSet &msgs, const fetchAttributes &attribs) |
int | getFetchCapabilities () const |
vmime_uint32 | getUIDValidity () const |
vmime_uint64 | getHighestModSequence () const |
Public Member Functions inherited from folder | |
virtual | ~folder () |
int | getType () |
int | getFlags () |
void | addMessageChangedListener (events::messageChangedListener *l) |
void | removeMessageChangedListener (events::messageChangedListener *l) |
void | addMessageCountListener (events::messageCountListener *l) |
void | removeMessageCountListener (events::messageCountListener *l) |
void | addFolderListener (events::folderListener *l) |
void | removeFolderListener (events::folderListener *l) |
Additional Inherited Members | |
Public Types inherited from folder | |
enum | Modes { MODE_READ_ONLY, MODE_READ_WRITE } |
typedef vmime::utility::path | path |
Protected Types inherited from folder | |
enum | PrivateConstants { TYPE_UNDEFINED = 9999, FLAG_UNDEFINED = 9999 } |
Protected Member Functions inherited from folder | |
folder (const folder &) | |
folder () | |
void | notifyMessageChanged (shared_ptr< events::messageChangedEvent > event) |
void | notifyMessageCount (shared_ptr< events::messageCountEvent > event) |
void | notifyFolder (shared_ptr< events::folderEvent > event) |
void | notifyEvent (shared_ptr< events::event > event) |
Protected Member Functions inherited from object | |
object () | |
object (const object &) | |
object & | operator= (const object &) |
virtual | ~object () |
IMAP folder implementation.
IMAPFolder | ( | const folder::path & | path, |
shared_ptr< IMAPStore > | store, | ||
shared_ptr< folderAttributes > | attribs | ||
) |
~IMAPFolder | ( | ) |
References IMAPFolder::close().
|
virtual |
Add a message to this folder.
msg | message to add (data: header + body) |
flags | flags for the new message (if -1, default flags are used) |
date | date/time for the new message (if NULL, the current time is used) |
progress | progress listener, or NULL if not used |
exceptions::net_exception | if an error occurs |
Implements folder.
|
virtual |
Add a message to this folder.
is | message to add (data: header + body) |
size | size of the message to add (in bytes) |
flags | flags for the new message (if -1, default flags are used) |
date | date/time for the new message (if NULL, the current time is used) |
progress | progress listener, or NULL if not used |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::APPEND(), stringUtils::bytesFromString(), messageSet::empty(), inputStream::eof(), stream::getBlockSize(), progressListener::progress(), inputStream::read(), progressListener::start(), and progressListener::stop().
|
virtual |
Close this folder.
expunge | if set to true, deleted messages are expunged |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::CLOSE(), IMAPFolder::isOpen(), and folder::MODE_READ_ONLY.
Referenced by IMAPFolder::~IMAPFolder().
|
virtual |
Copy messages from this folder to another folder.
dest | destination folder path |
msgs | index set of messages to copy |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::COPY(), messageSet::empty(), and IMAPFolder::isOpen().
|
virtual |
Create this folder.
attribs | attributes of the new folder |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::CREATE(), IMAPFolder::exists(), IMAPFolder::getFullPath(), folderAttributes::getSpecialUse(), folderAttributes::getType(), IMAPFolder::isOpen(), folder::notifyFolder(), folderAttributes::SPECIALUSE_ALL, folderAttributes::SPECIALUSE_ARCHIVE, folderAttributes::SPECIALUSE_DRAFTS, folderAttributes::SPECIALUSE_FLAGGED, folderAttributes::SPECIALUSE_IMPORTANT, folderAttributes::SPECIALUSE_JUNK, folderAttributes::SPECIALUSE_NONE, folderAttributes::SPECIALUSE_SENT, folderAttributes::SPECIALUSE_TRASH, folderAttributes::TYPE_CONTAINS_FOLDERS, and folderEvent::TYPE_CREATED.
|
virtual |
Remove one or more messages from this folder.
msgs | index set of messages to delete |
exceptions::net_exception | if an error occurs |
Implements folder.
References message::FLAG_DELETED, message::FLAG_MODE_ADD, messageSet::isEmpty(), IMAPFolder::isOpen(), folder::MODE_READ_ONLY, and IMAPCommand::STORE().
|
virtual |
Delete this folder.
The folder should be closed before attempting to delete it.
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::DELETE(), IMAPFolder::getFullPath(), IMAPFolder::isOpen(), folder::notifyFolder(), and folderEvent::TYPE_DELETED.
|
virtual |
Test whether this folder exists.
Implements folder.
References IMAPFolder::isOpen().
Referenced by IMAPFolder::create().
|
virtual |
Expunge deleted messages.
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::EXPUNGE(), IMAPFolder::isOpen(), and folder::MODE_READ_ONLY.
|
virtual |
Fetch objects for the specified message.
msg | the message |
attribs | set of attributes to fetch |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPFolder::fetchMessages().
|
virtual |
Fetch objects for the specified messages.
msg | list of message sequence numbers |
attribs | set of attributes to fetch |
progress | progress listener, or NULL if not used |
exceptions::net_exception | if an error occurs |
Implements folder.
References messageSet::byNumber(), IMAPFolder::isOpen(), progressListener::progress(), progressListener::start(), and progressListener::stop().
Referenced by IMAPFolder::fetchMessage().
|
virtual |
Get new references to messages in this folder, given either their sequence numbers or UIDs, and fetch objects for them at the same time.
msgs | index set of messages to retrieve |
attribs | set of attributes to fetch |
exceptions::net_exception | if an error occurs |
Implements folder.
References fetchAttributes::add(), messageSet::isEmpty(), and fetchAttributes::UID.
|
virtual |
Return the attributes of the folder.
Implements folder.
References folderAttributes::FLAG_HAS_CHILDREN, folderAttributes::FLAG_NO_OPEN, path::isEmpty(), folderAttributes::setFlags(), folderAttributes::setType(), and folderAttributes::TYPE_CONTAINS_FOLDERS.
|
virtual |
Return the list of fetchable objects supported by the underlying protocol (see folder::fetchAttributes).
Implements folder.
References fetchAttributes::CONTENT_INFO, fetchAttributes::ENVELOPE, fetchAttributes::FLAGS, fetchAttributes::FULL_HEADER, fetchAttributes::IMPORTANCE, fetchAttributes::SIZE, fetchAttributes::STRUCTURE, and fetchAttributes::UID.
|
virtual |
Get a new reference to a sub-folder in this folder.
name | sub-folder name |
exceptions::net_exception | if an error occurs |
Implements folder.
|
virtual |
Get the list of all sub-folders in this folder.
recursive | if set to true, all the descendant are returned. If set to false, only the direct children are returned. |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPFolder::getFullPath(), path::isDirectParentOf(), IMAPFolder::isOpen(), IMAPCommand::LIST(), and mailbox::mailbox().
|
virtual |
Return the fully qualified path name of this folder.
Implements folder.
Referenced by IMAPFolder::create(), IMAPFolder::destroy(), IMAPFolder::getFolders(), IMAPFolder::getStatus(), IMAPFolder::open(), and IMAPFolder::rename().
vmime_uint64 getHighestModSequence | ( | ) | const |
Returns the highest modification sequence of this folder, ie the modification sequence of the last message that changed in this folder.
References IMAPFolder::isOpen().
|
virtual |
Get a new reference to a message in this folder, given its number.
num | message sequence number |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPFolder::isOpen().
|
virtual |
Return the number of messages in this folder.
Implements folder.
References IMAPFolder::isOpen().
|
virtual |
Return the sequence numbers of messages whose UID equal or greater than the specified UID.
uid | the uid of the first message |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::SEARCH().
|
virtual |
Get new references to messages in this folder, given either their sequence numbers or UIDs.
To retrieve messages by their number, use:
Or, to retrieve messages by their UID, use:
msgs | index set of messages to retrieve |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::FETCH(), messageSet::isEmpty(), messageSet::isNumberSet(), IMAPFolder::isOpen(), and messageSet::isUIDSet().
|
virtual |
Return the mode in which the folder has been open.
Implements folder.
References IMAPFolder::isOpen().
|
virtual |
|
virtual |
Return a new folder object referencing the parent folder of this folder.
Implements folder.
References path::getParent(), and path::isEmpty().
|
virtual |
Request folder status without opening it.
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPFolder::getFullPath(), IMAPCommand::STATUS(), and IMAPFolder::status().
Referenced by IMAPFolder::status().
|
virtual |
Return a reference to the store to which this folder belongs.
Implements folder.
|
virtual |
Return a reference to the store to which this folder belongs.
Implements folder.
vmime_uint32 getUIDValidity | ( | ) | const |
Returns the UID validity of the folder for the current session.
If the server is capable of persisting UIDs accross sessions, this value should never change for a folder. If the UID validity differs across sessions, then the UIDs obtained during a previous session may not correspond to the UIDs of the same messages in this session.
References IMAPFolder::isOpen().
|
virtual |
Test whether this folder is open.
Implements folder.
Referenced by IMAPFolder::close(), IMAPFolder::copyMessages(), IMAPFolder::create(), IMAPFolder::deleteMessages(), IMAPFolder::destroy(), IMAPFolder::exists(), IMAPFolder::expunge(), IMAPFolder::fetchMessages(), IMAPFolder::getFolders(), IMAPFolder::getHighestModSequence(), IMAPFolder::getMessage(), IMAPFolder::getMessageCount(), IMAPFolder::getMessages(), IMAPFolder::getMode(), and IMAPFolder::getUIDValidity().
void noop | ( | ) |
References IMAPCommand::NOOP().
|
virtual |
Open this folder.
mode | open mode (see folder::Modes) |
failIfModeIsNotAvailable | if set to false and if the requested mode is not available, a more restricted mode will be selected automatically. If set to true and if the requested mode is not available, the opening will fail. |
exceptions::net_exception | if an error occurs |
exceptions::folder_already_open | if the folder is already open in the same session |
Implements folder.
References IMAPFolder::getFullPath(), folder::MODE_READ_ONLY, folder::MODE_READ_WRITE, and IMAPCommand::SELECT().
|
virtual |
Rename (move) this folder to another location.
newPath | new path of the folder |
exceptions::net_exception | if an error occurs |
Implements folder.
References word::getBuffer(), IMAPFolder::getFullPath(), path::getLastComponent(), path::getSize(), path::isEmpty(), path::isParentOf(), folder::notifyFolder(), IMAPCommand::RENAME(), and folderEvent::TYPE_RENAMED.
|
virtual |
Change the flags for one or more messages in this folder.
msgs | index set of messages on which to set the flags |
flags | set of flags (see message::Flags) |
mode | indicate how to treat old and new flags (see message::FlagsModes) |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPCommand::STORE().
|
virtual |
Request folder status without opening it.
count | will receive the number of messages in the folder |
unseen | will receive the number of unseen messages in the folder |
exceptions::net_exception | if an error occurs |
Implements folder.
References IMAPFolder::getStatus().
Referenced by IMAPFolder::getStatus().