Added getCapabilities() on messaging::store.

This commit is contained in:
Vincent Richard 2004-12-22 13:05:59 +00:00
parent 9207ff73eb
commit cc51a32255
10 changed files with 71 additions and 10 deletions

View File

@ -6,6 +6,9 @@ VERSION 0.6.0-cvs
* Finished 'maildir' implementation. This is EXPERIMENTAL! * Finished 'maildir' implementation. This is EXPERIMENTAL!
* Added a getCapabilities() function on 'vmime::messaging::store' to
quickly check which features are available.
2004-12-19 Vincent Richard <vincent@vincent-richard.net> 2004-12-19 Vincent Richard <vincent@vincent-richard.net>
* Added chaining in exception handling. vmime::exception::other() returns * Added chaining in exception handling. vmime::exception::other() returns

View File

@ -360,7 +360,7 @@ opts.AddOptions(
+ 'This option has no effect if "with_messaging" is not activated.\n' + 'This option has no effect if "with_messaging" is not activated.\n'
+ 'Separate protocols with spaces; string must be quoted with ".\n' + 'Separate protocols with spaces; string must be quoted with ".\n'
+ 'Available protocols: pop3, smtp, imap, maildir.', + 'Available protocols: pop3, smtp, imap, maildir.',
'"pop3 smtp imap"' '"pop3 smtp imap maildir"'
), ),
( (
'with_platforms', 'with_platforms',

View File

@ -125,7 +125,7 @@ folder* IMAPStore::getFolder(const folder::path& path)
} }
const bool IMAPStore::isValidFolderName(const folder::path::component& /* name */) const bool IMAPStore::isValidFolderName(const folder::path::component& /* name */) const
{ {
return true; return true;
} }
@ -219,6 +219,19 @@ void IMAPStore::unregisterFolder(IMAPFolder* folder)
} }
const int IMAPStore::getCapabilities() const
{
return (CAPABILITY_CREATE_FOLDER |
CAPABILITY_RENAME_FOLDER |
CAPABILITY_ADD_MESSAGE |
CAPABILITY_COPY_MESSAGE |
CAPABILITY_DELETE_MESSAGE |
CAPABILITY_PARTIAL_FETCH |
CAPABILITY_MESSAGE_FLAGS |
CAPABILITY_EXTRACT_PART);
}
// Service infos // Service infos

View File

@ -57,7 +57,7 @@ public:
folder* getRootFolder(); folder* getRootFolder();
folder* getFolder(const folder::path& path); folder* getFolder(const folder::path& path);
const bool isValidFolderName(const folder::path::component& name); const bool isValidFolderName(const folder::path::component& name) const;
static const serviceInfos& getInfosInstance(); static const serviceInfos& getInfosInstance();
const serviceInfos& getInfos() const; const serviceInfos& getInfos() const;
@ -68,6 +68,8 @@ public:
void noop(); void noop();
const int getCapabilities() const;
private: private:
// Connection // Connection

View File

@ -82,7 +82,7 @@ folder* POP3Store::getFolder(const folder::path& path)
} }
const bool POP3Store::isValidFolderName(const folder::path::component& /* name */) const bool POP3Store::isValidFolderName(const folder::path::component& /* name */) const
{ {
return true; return true;
} }
@ -565,6 +565,12 @@ void POP3Store::unregisterFolder(POP3Folder* folder)
} }
const int POP3Store::getCapabilities() const
{
return (CAPABILITY_DELETE_MESSAGE);
}
// Service infos // Service infos

View File

@ -51,7 +51,7 @@ public:
folder* getRootFolder(); folder* getRootFolder();
folder* getFolder(const folder::path& path); folder* getFolder(const folder::path& path);
const bool isValidFolderName(const folder::path::component& name); const bool isValidFolderName(const folder::path::component& name) const;
static const serviceInfos& getInfosInstance(); static const serviceInfos& getInfosInstance();
const serviceInfos& getInfos() const; const serviceInfos& getInfos() const;
@ -62,6 +62,8 @@ public:
void noop(); void noop();
const int getCapabilities() const;
private: private:
static const bool isSuccessResponse(const string& buffer); static const bool isSuccessResponse(const string& buffer);

View File

@ -308,7 +308,7 @@ public:
*/ */
virtual store* getStore() = 0; virtual store* getStore() = 0;
/** Possible fetchable objects. /** Fetchable objects.
*/ */
enum FetchOptions enum FetchOptions
{ {

View File

@ -75,7 +75,7 @@ folder* maildirStore::getFolder(const folder::path& path)
} }
const bool maildirStore::isValidFolderName(const folder::path::component& name) const bool maildirStore::isValidFolderName(const folder::path::component& name) const
{ {
if (!platformDependant::getHandler()->getFileSystemFactory()->isValidPathComponent(name)) if (!platformDependant::getHandler()->getFileSystemFactory()->isValidPathComponent(name))
return false; return false;
@ -154,6 +154,19 @@ const utility::path& maildirStore::getFileSystemPath() const
} }
const int maildirStore::getCapabilities() const
{
return (CAPABILITY_CREATE_FOLDER |
CAPABILITY_RENAME_FOLDER |
CAPABILITY_ADD_MESSAGE |
CAPABILITY_COPY_MESSAGE |
CAPABILITY_DELETE_MESSAGE |
CAPABILITY_PARTIAL_FETCH |
CAPABILITY_MESSAGE_FLAGS |
CAPABILITY_EXTRACT_PART);
}
// Service infos // Service infos

View File

@ -56,7 +56,7 @@ public:
folder* getRootFolder(); folder* getRootFolder();
folder* getFolder(const folder::path& path); folder* getFolder(const folder::path& path);
const bool isValidFolderName(const folder::path::component& name); const bool isValidFolderName(const folder::path::component& name) const;
static const serviceInfos& getInfosInstance(); static const serviceInfos& getInfosInstance();
const serviceInfos& getInfos() const; const serviceInfos& getInfos() const;
@ -69,6 +69,8 @@ public:
const utility::path& getFileSystemPath() const; const utility::path& getFileSystemPath() const;
const int getCapabilities() const;
private: private:
void registerFolder(maildirFolder* folder); void registerFolder(maildirFolder* folder);

View File

@ -50,7 +50,7 @@ public:
virtual folder* getDefaultFolder() = 0; virtual folder* getDefaultFolder() = 0;
/** Return the root folder. This is protocol dependant /** Return the root folder. This is protocol dependant
* and usually is the user's mail drop root folder * and usually is the user's mail drop root folder.
* *
* @return root folder * @return root folder
*/ */
@ -68,7 +68,27 @@ public:
* *
* @return true if the specified folder name is valid, false otherwise * @return true if the specified folder name is valid, false otherwise
*/ */
virtual const bool isValidFolderName(const folder::path::component& name) = 0; virtual const bool isValidFolderName(const folder::path::component& name) const = 0;
/** Store capabilities. */
enum Capabilities
{
CAPABILITY_CREATE_FOLDER = (1 << 0), /**< Can create folders. */
CAPABILITY_RENAME_FOLDER = (1 << 1), /**< Can rename folders. */
CAPABILITY_ADD_MESSAGE = (1 << 2), /**< Can append message to folders. */
CAPABILITY_COPY_MESSAGE = (1 << 3), /**< Can copy messages from a folder to another one. */
CAPABILITY_DELETE_MESSAGE = (1 << 4), /**< Can delete messages. */
CAPABILITY_PARTIAL_FETCH = (1 << 5), /**< Is partial fetch supported? */
CAPABILITY_MESSAGE_FLAGS = (1 << 6), /**< Can set flags on messages. */
CAPABILITY_EXTRACT_PART = (1 << 7) /**< Can extract a specific part of the message. */
};
/** Return the features supported by this service. This is
* a combination of store::CAPABILITY_xxx flags.
*
* @return features supported by this service
*/
virtual const int getCapabilities() const = 0;
const Type getType() const { return (TYPE_STORE); } const Type getType() const { return (TYPE_STORE); }