From a4251085d24e870104e1b3bf76c66ba71a69a78b Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 22 Dec 2004 11:01:17 +0000 Subject: Done rename() operation on 'maildir' + fixed some bugs/limitations in maildir/IMAP. --- src/messaging/IMAPFolder.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/messaging/IMAPFolder.cpp') diff --git a/src/messaging/IMAPFolder.cpp b/src/messaging/IMAPFolder.cpp index 5ae268a2..4a3cc5fb 100644 --- a/src/messaging/IMAPFolder.cpp +++ b/src/messaging/IMAPFolder.cpp @@ -323,6 +323,8 @@ void IMAPFolder::create(const int type) throw exceptions::illegal_state("Folder is open"); else if (exists()) throw exceptions::illegal_state("Folder already exists"); + else if (!m_store->isValidFolderName(m_name)) + throw exceptions::invalid_folder_name(); // Emit the "CREATE" command // @@ -1258,10 +1260,12 @@ void IMAPFolder::rename(const folder::path& newPath) { if (!m_store) throw exceptions::illegal_state("Store disconnected"); - else if (isOpen()) - throw exceptions::illegal_state("Folder open"); + else if (m_path.isEmpty() || newPath.isEmpty()) + throw exceptions::illegal_operation("Cannot rename root folder"); else if (m_path.getSize() == 1 && m_name.getBuffer() == "INBOX") throw exceptions::illegal_operation("Cannot rename 'INBOX' folder"); + else if (!m_store->isValidFolderName(newPath.getLastComponent())) + throw exceptions::invalid_folder_name(); // Build the request text std::ostringstream command; -- cgit v1.2.3