folder Class Reference

Abstract representation of a folder in a message store. More...

Inheritance diagram for folder:
Inheritance graph
[legend]
Collaboration diagram for folder:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Modes { MODE_READ_ONLY, MODE_READ_WRITE }
enum  Types { TYPE_CONTAINS_FOLDERS = (1 << 0), TYPE_CONTAINS_MESSAGES = (1 << 1), TYPE_UNDEFINED = 9999 }
enum  Flags { FLAG_CHILDREN = (1 << 0), FLAG_NO_OPEN = (1 << 1), FLAG_UNDEFINED = 9999 }
enum  FetchOptions {
  FETCH_ENVELOPE = (1 << 0), FETCH_STRUCTURE = (1 << 1), FETCH_CONTENT_INFO = (1 << 2), FETCH_FLAGS = (1 << 3),
  FETCH_SIZE = (1 << 4), FETCH_FULL_HEADER = (1 << 5), FETCH_UID = (1 << 6), FETCH_IMPORTANCE = (1 << 7),
  FETCH_CUSTOM = (1 << 16)
}
typedef vmime::utility::path path

Public Member Functions

virtual ~folder ()
virtual int getType ()=0
virtual int getFlags ()=0
virtual int getMode () const =0
virtual const
folder::path::component 
getName () const =0
virtual const folder::path getFullPath () const =0
virtual void open (const int mode, bool failIfModeIsNotAvailable=false)=0
virtual void close (const bool expunge)=0
virtual void create (const int type)=0
virtual bool exists ()=0
virtual void destroy ()=0
virtual bool isOpen () const =0
virtual ref< messagegetMessage (const int num)=0
virtual std::vector< ref
< message > > 
getMessages (const int from=1, const int to=-1)=0
virtual std::vector< ref
< message > > 
getMessages (const std::vector< int > &nums)=0
virtual int getMessageCount ()=0
virtual ref< foldergetFolder (const folder::path::component &name)=0
virtual std::vector< ref
< folder > > 
getFolders (const bool recursive=false)=0
virtual void rename (const folder::path &newPath)=0
virtual void deleteMessage (const int num)=0
virtual void deleteMessages (const int from=1, const int to=-1)=0
virtual void deleteMessages (const std::vector< int > &nums)=0
virtual void setMessageFlags (const int from, const int to, const int flags, const int mode=message::FLAG_MODE_SET)=0
virtual void setMessageFlags (const std::vector< int > &nums, const int flags, const int mode=message::FLAG_MODE_SET)=0
virtual void addMessage (ref< vmime::message > msg, const int flags=message::FLAG_UNDEFINED, vmime::datetime *date=NULL, utility::progressListener *progress=NULL)=0
virtual void addMessage (utility::inputStream &is, const int size, const int flags=message::FLAG_UNDEFINED, vmime::datetime *date=NULL, utility::progressListener *progress=NULL)=0
virtual void copyMessage (const folder::path &dest, const int num)=0
virtual void copyMessages (const folder::path &dest, const int from=1, const int to=-1)=0
virtual void copyMessages (const folder::path &dest, const std::vector< int > &nums)=0
virtual void status (int &count, int &unseen)=0
virtual void expunge ()=0
virtual ref< foldergetParent ()=0
virtual ref< const storegetStore () const =0
virtual ref< storegetStore ()=0
virtual void fetchMessages (std::vector< ref< message > > &msg, const int options, utility::progressListener *progress=NULL)=0
virtual void fetchMessage (ref< message > msg, const int options)=0
virtual int getFetchCapabilities () const =0
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)

Protected Member Functions

 folder (const folder &)
 folder ()
void notifyMessageChanged (const events::messageChangedEvent &event)
void notifyMessageCount (const events::messageCountEvent &event)
void notifyFolder (const events::folderEvent &event)

Detailed Description

Abstract representation of a folder in a message store.


Member Typedef Documentation

Type used for fully qualified path name of a folder.


Member Enumeration Documentation

Fetchable objects.

Enumerator:
FETCH_ENVELOPE 

Fetch sender, recipients, date, subject.

FETCH_STRUCTURE 

Fetch structure (body parts).

FETCH_CONTENT_INFO 

Fetch top-level content type.

FETCH_FLAGS 

Fetch message flags.

FETCH_SIZE 

Fetch message size (exact or estimated).

FETCH_FULL_HEADER 

Fetch full RFC-[2]822 header.

FETCH_UID 

Fetch unique identifier (protocol specific).

FETCH_IMPORTANCE 

Fetch header fields suitable for use with misc::importanceHelper.

FETCH_CUSTOM 

Reserved for future use.

enum Flags

Folder flags.

Enumerator:
FLAG_CHILDREN 

Folder contains subfolders.

FLAG_NO_OPEN 

Folder cannot be open.

FLAG_UNDEFINED 

Used internally (this should not be returned by the type() function).

enum Modes

Open mode.

Enumerator:
MODE_READ_ONLY 

Read-only mode (no modification to folder or messages is possible).

MODE_READ_WRITE 

Full access mode (read and write).

enum Types

Folder types.

Enumerator:
TYPE_CONTAINS_FOLDERS 

Folder can contain folders.

TYPE_CONTAINS_MESSAGES 

Folder can contain messages.

TYPE_UNDEFINED 

Used internally (this should not be returned by the type() function).


Constructor & Destructor Documentation

folder ( const folder  )  [protected]
folder (  )  [protected]
virtual ~folder (  )  [virtual]

Member Function Documentation

void addFolderListener ( events::folderListener l  ) 
virtual void addMessage ( utility::inputStream is,
const int  size,
const int  flags = message::FLAG_UNDEFINED,
vmime::datetime date = NULL,
utility::progressListener progress = NULL 
) [pure virtual]

Add a message to this folder.

Parameters:
is message to add (data: header + body)
size size of the message to add (in bytes)
flags flags for the new message
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void addMessage ( ref< vmime::message msg,
const int  flags = message::FLAG_UNDEFINED,
vmime::datetime date = NULL,
utility::progressListener progress = NULL 
) [pure virtual]

Add a message to this folder.

Parameters:
msg message to add (data: header + body)
flags flags for the new message
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

void addMessageChangedListener ( events::messageChangedListener l  ) 
void addMessageCountListener ( events::messageCountListener l  ) 
virtual void close ( const bool  expunge  )  [pure virtual]

Close this folder.

Parameters:
expunge if set to true, deleted messages are expunged
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void copyMessage ( const folder::path dest,
const int  num 
) [pure virtual]

Copy a message from this folder to another folder.

Parameters:
dest destination folder path
num sequence number of the message to copy
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void copyMessages ( const folder::path dest,
const std::vector< int > &  nums 
) [pure virtual]

Copy messages from this folder to another folder.

Parameters:
dest destination folder path
nums sequence numbers of the messages to copy
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void copyMessages ( const folder::path dest,
const int  from = 1,
const int  to = -1 
) [pure virtual]

Copy messages from this folder to another folder.

Parameters:
dest destination folder path
from sequence number of the first message to copy
to sequence number of the last message to copy
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void create ( const int  type  )  [pure virtual]

Create this folder.

Parameters:
type folder type (see folder::Types)
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void deleteMessage ( const int  num  )  [pure virtual]

Remove a message in this folder.

Parameters:
num sequence number of the message to delete
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void deleteMessages ( const std::vector< int > &  nums  )  [pure virtual]

Remove one or more messages from this folder.

Parameters:
nums sequence numbers of the messages to delete
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void deleteMessages ( const int  from = 1,
const int  to = -1 
) [pure virtual]

Remove one or more messages from this folder.

Parameters:
from sequence number of the first message to delete
to sequence number of the last message to delete
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void destroy (  )  [pure virtual]

Delete this folder.

The folder should be closed before attempting to delete it.

Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual bool exists (  )  [pure virtual]

Test whether this folder exists.

Returns:
true if the folder exists, false otherwise

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void expunge (  )  [pure virtual]

Expunge deleted messages.

Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void fetchMessage ( ref< message msg,
const int  options 
) [pure virtual]

Fetch objects for the specified message.

Parameters:
msg the message
options objects to fetch (combination of folder::FetchOptions flags)
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void fetchMessages ( std::vector< ref< message > > &  msg,
const int  options,
utility::progressListener progress = NULL 
) [pure virtual]

Fetch objects for the specified messages.

Parameters:
msg list of message sequence numbers
options objects to fetch (combination of folder::FetchOptions flags)
progress progress listener, or NULL if not used
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual int getFetchCapabilities (  )  const [pure virtual]

Return the list of fetchable objects supported by the underlying protocol (see folder::FetchOptions).

Returns:
list of supported fetchable objects

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual int getFlags (  )  [pure virtual]

Return the flags of this folder.

Returns:
folder flags (see folder::Flags)

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual ref<folder> getFolder ( const folder::path::component name  )  [pure virtual]

Get a new reference to a sub-folder in this folder.

Parameters:
name sub-folder name
Returns:
a new object referencing the specified folder
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual std::vector<ref <folder> > getFolders ( const bool  recursive = false  )  [pure virtual]

Get the list of all sub-folders in this folder.

Parameters:
recursive if set to true, all the descendant are returned. If set to false, only the direct children are returned.
Returns:
list of sub-folders
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual const folder::path getFullPath (  )  const [pure virtual]

Return the fully qualified path name of this folder.

Returns:
absolute path of the folder

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual ref<message> getMessage ( const int  num  )  [pure virtual]

Get a new reference to a message in this folder.

Parameters:
num message sequence number
Returns:
a new object referencing the specified message
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual int getMessageCount (  )  [pure virtual]

Return the number of messages in this folder.

Returns:
number of messages in the folder

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual std::vector<ref <message> > getMessages ( const std::vector< int > &  nums  )  [pure virtual]

Get new references to messages in this folder.

Parameters:
nums sequence numbers of the messages to delete
Returns:
new objects referencing the specified messages
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual std::vector<ref <message> > getMessages ( const int  from = 1,
const int  to = -1 
) [pure virtual]

Get new references to messages in this folder.

Parameters:
from sequence number of the first message to get
to sequence number of the last message to get
Returns:
new objects referencing the specified messages
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual int getMode (  )  const [pure virtual]

Return the mode in which the folder has been open.

Returns:
folder opening mode (see folder::Modes)

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual const folder::path::component getName (  )  const [pure virtual]

Return the name of this folder.

Returns:
folder name

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual ref<folder> getParent (  )  [pure virtual]

Return a new folder object referencing the parent folder of this folder.

Returns:
parent folder object

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual ref<store> getStore (  )  [pure virtual]

Return a reference to the store to which this folder belongs.

Returns:
the store object to which this folder is attached

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual ref<const store> getStore (  )  const [pure virtual]

Return a reference to the store to which this folder belongs.

Returns:
the store object to which this folder is attached

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual int getType (  )  [pure virtual]

Return the type of this folder.

Returns:
folder type (see folder::Types)

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual bool isOpen (  )  const [pure virtual]

Test whether this folder is open.

Returns:
true if the folder is open, false otherwise

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

void notifyFolder ( const events::folderEvent event  )  [protected]
void notifyMessageChanged ( const events::messageChangedEvent event  )  [protected]
void notifyMessageCount ( const events::messageCountEvent event  )  [protected]
virtual void open ( const int  mode,
bool  failIfModeIsNotAvailable = false 
) [pure virtual]

Open this folder.

Parameters:
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

void removeFolderListener ( events::folderListener l  ) 
void removeMessageChangedListener ( events::messageChangedListener l  ) 
void removeMessageCountListener ( events::messageCountListener l  ) 
virtual void rename ( const folder::path newPath  )  [pure virtual]

Rename (move) this folder to another location.

Parameters:
newPath new path of the folder
Exceptions:
net_exception if an error occurs

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void setMessageFlags ( const std::vector< int > &  nums,
const int  flags,
const int  mode = message::FLAG_MODE_SET 
) [pure virtual]

Change the flags for one or more messages in this folder.

Parameters:
nums sequence numbers of the messages to modify
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void setMessageFlags ( const int  from,
const int  to,
const int  flags,
const int  mode = message::FLAG_MODE_SET 
) [pure virtual]

Change the flags for one or more messages in this folder.

Parameters:
from sequence number of the first message to modify
to sequence number of the last message to modify
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.

virtual void status ( int &  count,
int &  unseen 
) [pure virtual]

Request folder status without opening it.

Parameters:
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

Implemented in IMAPFolder, maildirFolder, and POP3Folder.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2