diff options
| author | Vincent Richard <[email protected]> | 2006-04-23 08:48:19 +0000 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2006-04-23 08:48:19 +0000 |
| commit | 6933fb8a30cf17ae90394fca5114b8e600ef2cfd (patch) | |
| tree | 7f35e7226f7179993eb0a7cbdb9953a4fa19fa26 /src/net/imap/IMAPFolder.cpp | |
| parent | Renamed 'byte' to 'byte_t'. (diff) | |
| download | vmime-6933fb8a30cf17ae90394fca5114b8e600ef2cfd.tar.gz vmime-6933fb8a30cf17ae90394fca5114b8e600ef2cfd.zip | |
Folder deletion.
Diffstat (limited to 'src/net/imap/IMAPFolder.cpp')
| -rw-r--r-- | src/net/imap/IMAPFolder.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp index 0179620b..09d33b68 100644 --- a/src/net/imap/IMAPFolder.cpp +++ b/src/net/imap/IMAPFolder.cpp @@ -371,6 +371,43 @@ void IMAPFolder::create(const int type) } +void IMAPFolder::destroy() +{ + ref <IMAPStore> store = m_store.acquire(); + + if (!store) + throw exceptions::illegal_state("Store disconnected"); + + if (isOpen()) + throw exceptions::illegal_state("Folder is open"); + + const string mailbox = IMAPUtils::pathToString + (m_connection->hierarchySeparator(), getFullPath()); + + std::ostringstream oss; + oss << "DELETE " << IMAPUtils::quoteString(mailbox); + + m_connection->send(true, oss.str(), true); + + + utility::auto_ptr <IMAPParser::response> resp(m_connection->readResponse()); + + if (resp->isBad() || resp->response_done()->response_tagged()-> + resp_cond_state()->status() != IMAPParser::resp_cond_state::OK) + { + throw exceptions::command_error("DELETE", + m_connection->getParser()->lastLine(), "bad response"); + } + + // Notify folder deleted + events::folderEvent event + (thisRef().dynamicCast <folder>(), + events::folderEvent::TYPE_DELETED, m_path, m_path); + + notifyFolder(event); +} + + const bool IMAPFolder::exists() { ref <IMAPStore> store = m_store.acquire(); |
