diff --git a/AUTHORS b/AUTHORS index 8391c188..f0b5e2d5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,7 @@ VMIME CONTRIBUTORS - Georg Sauthoff - Pierre Thierry (patches for STL algorithms) - Zarafa + - Bartek Szurgot Please apologize if I have forgotten someone here. ;) See SVN Changelog for full list. diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp index 6dbda80b..721517e8 100644 --- a/src/net/maildir/format/courierMaildirFormat.cpp +++ b/src/net/maildir/format/courierMaildirFormat.cpp @@ -49,7 +49,7 @@ const string courierMaildirFormat::getName() const void courierMaildirFormat::createFolder(const folder::path& path) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); @@ -80,7 +80,7 @@ void courierMaildirFormat::createFolder(const folder::path& path) void courierMaildirFormat::destroyFolder(const folder::path& path) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); // Recursively delete directories of subfolders const std::vector folders = listFolders(path, true); @@ -119,7 +119,7 @@ void courierMaildirFormat::renameFolder void courierMaildirFormat::renameFolderImpl (const folder::path& oldPath, const folder::path& newPath) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); const utility::file::path oldFSPath = folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY); @@ -134,7 +134,7 @@ void courierMaildirFormat::renameFolderImpl bool courierMaildirFormat::folderExists(const folder::path& path) const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); @@ -254,7 +254,7 @@ const std::vector courierMaildirFormat::listFolders bool courierMaildirFormat::listDirectories(const folder::path& root, std::vector & dirs, const bool onlyTestForExistence) const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (getContext()->getStore()->getFileSystemPath()); @@ -496,7 +496,7 @@ const folder::path::component courierMaildirFormat::fromModifiedUTF7(const strin bool courierMaildirFormat::supports() const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (getContext()->getStore()->getFileSystemPath()); diff --git a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp index 5fb75feb..a21d1061 100644 --- a/src/net/maildir/format/kmailMaildirFormat.cpp +++ b/src/net/maildir/format/kmailMaildirFormat.cpp @@ -49,7 +49,7 @@ const string kmailMaildirFormat::getName() const void kmailMaildirFormat::createFolder(const folder::path& path) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY))) throw exceptions::invalid_folder_name(); @@ -75,7 +75,7 @@ void kmailMaildirFormat::createFolder(const folder::path& path) void kmailMaildirFormat::destroyFolder(const folder::path& path) { // Delete 'folder' and '.folder.directory' directories - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); maildirUtils::recursiveFSDelete(fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY))); // root @@ -87,7 +87,7 @@ void kmailMaildirFormat::destroyFolder(const folder::path& path) bool kmailMaildirFormat::folderExists(const folder::path& path) const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (folderPathToFileSystemPath(path, ROOT_DIRECTORY)); @@ -177,7 +177,7 @@ const std::vector kmailMaildirFormat::listFolders void kmailMaildirFormat::listFoldersImpl (std::vector & list, const folder::path& root, const bool recursive) const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create(folderPathToFileSystemPath(root, root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY)); @@ -226,7 +226,7 @@ bool kmailMaildirFormat::isSubfolderDirectory(const utility::file& file) void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder::path& newPath) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY)); @@ -277,7 +277,7 @@ void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder: bool kmailMaildirFormat::folderHasSubfolders(const folder::path& path) const { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref rootDir = fsf->create (folderPathToFileSystemPath(path, CONTAINER_DIRECTORY)); diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp index 3e361ae1..dd680c9c 100644 --- a/src/net/maildir/maildirFolder.cpp +++ b/src/net/maildir/maildirFolder.cpp @@ -264,7 +264,7 @@ void maildirFolder::scanFolder() m_messageCount = 0; m_unreadMessageCount = 0; - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path newDirPath = store->getFormat()->folderPathToFileSystemPath (m_path, maildirFormat::NEW_DIRECTORY); @@ -760,7 +760,7 @@ void maildirFolder::setMessageFlagsImpl { ref store = m_store.acquire(); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path curDirPath = store->getFormat()-> folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); @@ -832,7 +832,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size, else if (m_mode == MODE_READ_ONLY) throw exceptions::illegal_state("Folder is read-only"); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path tmpDirPath = store->getFormat()-> folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY); @@ -918,7 +918,7 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath, utility::inputStream& is, const utility::stream::size_type size, utility::progressListener* progress) { - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); ref file = fsf->create(tmpDirPath / filename); @@ -1058,7 +1058,7 @@ void maildirFolder::copyMessagesImpl(const folder::path& dest, const std::vector { ref store = m_store.acquire(); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path curDirPath = store->getFormat()->folderPathToFileSystemPath (m_path, maildirFormat::CUR_DIRECTORY); @@ -1200,7 +1200,7 @@ void maildirFolder::expunge() else if (m_mode == MODE_READ_ONLY) throw exceptions::illegal_state("Folder is read-only"); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path curDirPath = store->getFormat()-> folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp index ed87cdb3..8999d847 100644 --- a/src/net/maildir/maildirMessage.cpp +++ b/src/net/maildir/maildirMessage.cpp @@ -346,7 +346,7 @@ void maildirMessage::extractImpl(utility::outputStream& os, utility::progressLis { ref folder = m_folder.acquire(); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); const utility::file::path path = folder->getMessageFSPath(m_num); ref file = fsf->create(path); @@ -393,7 +393,7 @@ void maildirMessage::fetchPartHeader(ref p) ref mp = p.dynamicCast (); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); const utility::file::path path = folder->getMessageFSPath(m_num); ref file = fsf->create(path); @@ -430,7 +430,7 @@ void maildirMessage::fetch(ref msgFolder, const int options) if (folder != msgFolder) throw exceptions::folder_not_found(); - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); const utility::file::path path = folder->getMessageFSPath(m_num); ref file = fsf->create(path); diff --git a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp index 3b770246..26f4593a 100644 --- a/src/net/maildir/maildirStore.cpp +++ b/src/net/maildir/maildirStore.cpp @@ -132,7 +132,7 @@ void maildirStore::connect() throw exceptions::already_connected(); // Get root directory - utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); + ref fsf = platform::getHandler()->getFileSystemFactory(); m_fsPath = fsf->stringToPath(GET_PROPERTY(string, PROPERTY_SERVER_ROOTPATH)); diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp index f43972ee..104bc404 100644 --- a/src/platforms/posix/posixHandler.cpp +++ b/src/platforms/posix/posixHandler.cpp @@ -55,18 +55,14 @@ posixHandler::posixHandler() m_socketFactory = vmime::create (); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - m_fileSysFactory = new posixFileSystemFactory(); - m_childProcFactory = new posixChildProcessFactory(); + m_fileSysFactory = vmime::create (); + m_childProcFactory = vmime::create (); #endif } posixHandler::~posixHandler() { -#if VMIME_HAVE_FILESYSTEM_FEATURES - delete (m_fileSysFactory); - delete (m_childProcFactory); -#endif } @@ -173,9 +169,9 @@ unsigned int posixHandler::getProcessId() const #if VMIME_HAVE_MESSAGING_FEATURES -ref posixHandler::getSocketFactory() const +ref posixHandler::getSocketFactory() { - return m_socketFactory.dynamicCast (); + return m_socketFactory; } #endif @@ -183,15 +179,15 @@ ref posixHandler::getSocketFactory() const #if VMIME_HAVE_FILESYSTEM_FEATURES -vmime::utility::fileSystemFactory* posixHandler::getFileSystemFactory() const +ref posixHandler::getFileSystemFactory() { - return (m_fileSysFactory); + return m_fileSysFactory; } -vmime::utility::childProcessFactory* posixHandler::getChildProcessFactory() const +ref posixHandler::getChildProcessFactory() { - return (m_childProcFactory); + return m_childProcFactory; } #endif diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index 404d3cbc..1a37c839 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -49,17 +49,13 @@ windowsHandler::windowsHandler() m_socketFactory = vmime::create (); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - m_fileSysFactory = new windowsFileSystemFactory(); + m_fileSysFactory = vmime::create (); #endif } windowsHandler::~windowsHandler() { -#if VMIME_HAVE_FILESYSTEM_FEATURES - delete (m_fileSysFactory); -#endif - WSACleanup(); } @@ -240,9 +236,9 @@ unsigned int windowsHandler::getProcessId() const #if VMIME_HAVE_MESSAGING_FEATURES -ref windowsHandler::getSocketFactory() const +ref windowsHandler::getSocketFactory() { - return m_socketFactory.dynamicCast (); + return m_socketFactory; } #endif @@ -250,13 +246,13 @@ ref windowsHandler::getSocketFactory() const #if VMIME_HAVE_FILESYSTEM_FEATURES -vmime::utility::fileSystemFactory* windowsHandler::getFileSystemFactory() const +ref windowsHandler::getFileSystemFactory() { - return (m_fileSysFactory); + return m_fileSysFactory; } -vmime::utility::childProcessFactory* windowsHandler::getChildProcessFactory() const +ref windowsHandler::getChildProcessFactory() { // TODO: Not implemented return (NULL); diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp index 5f8c7033..3b1980e7 100644 --- a/tests/net/maildir/maildirStoreTest.cpp +++ b/tests/net/maildir/maildirStoreTest.cpp @@ -501,7 +501,7 @@ private: const vmime::utility::url getStoreURL() { - vmime::utility::fileSystemFactory* fsf = + vmime::ref fsf = vmime::platform::getHandler()->getFileSystemFactory(); vmime::utility::url url(std::string("maildir://localhost") @@ -512,7 +512,7 @@ private: void createMaildir(const vmime::string* const dirs, const vmime::string* const files) { - vmime::utility::fileSystemFactory* fsf = + vmime::ref fsf = vmime::platform::getHandler()->getFileSystemFactory(); vmime::ref rootDir = fsf->create(m_tempPath); @@ -544,7 +544,7 @@ private: void destroyMaildir() { - vmime::utility::fileSystemFactory* fsf = + vmime::ref fsf = vmime::platform::getHandler()->getFileSystemFactory(); recursiveDelete(fsf->create(m_tempPath)); diff --git a/vmime/platform.hpp b/vmime/platform.hpp index d3905710..02815542 100644 --- a/vmime/platform.hpp +++ b/vmime/platform.hpp @@ -108,7 +108,7 @@ public: * * @return socket factory */ - virtual ref getSocketFactory() const = 0; + virtual ref getSocketFactory() = 0; #endif #if VMIME_HAVE_FILESYSTEM_FEATURES @@ -116,14 +116,14 @@ public: * * @return file-system factory */ - virtual utility::fileSystemFactory* getFileSystemFactory() const = 0; + virtual ref getFileSystemFactory() = 0; /** Return a pointer to a factory that creates child process objects, * which are used to spawn processes (run executable files). * * @return child process factory */ - virtual utility::childProcessFactory* getChildProcessFactory() const = 0; + virtual ref getChildProcessFactory() = 0; #endif }; @@ -135,7 +135,7 @@ public: sm_handler = vmime::create (); } - static ref getHandler() + static ref getHandler() { if (!sm_handler) throw exceptions::no_platform_handler(); diff --git a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp index 397a5dd9..8e572a21 100644 --- a/vmime/platforms/posix/posixHandler.hpp +++ b/vmime/platforms/posix/posixHandler.hpp @@ -61,13 +61,13 @@ public: unsigned int getProcessId() const; #if VMIME_HAVE_MESSAGING_FEATURES - ref getSocketFactory() const; + ref getSocketFactory(); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - vmime::utility::fileSystemFactory* getFileSystemFactory() const; + ref getFileSystemFactory(); - vmime::utility::childProcessFactory* getChildProcessFactory() const; + ref getChildProcessFactory(); #endif void wait() const; @@ -79,8 +79,8 @@ private: #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - posixFileSystemFactory* m_fileSysFactory; - posixChildProcessFactory* m_childProcFactory; + ref m_fileSysFactory; + ref m_childProcFactory; #endif }; diff --git a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp index 701edf00..53df3636 100644 --- a/vmime/platforms/windows/windowsHandler.hpp +++ b/vmime/platforms/windows/windowsHandler.hpp @@ -60,13 +60,13 @@ public: unsigned int getProcessId() const; #if VMIME_HAVE_MESSAGING_FEATURES - ref getSocketFactory() const; + ref getSocketFactory(); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - vmime::utility::fileSystemFactory* getFileSystemFactory() const; + ref getFileSystemFactory(); - vmime::utility::childProcessFactory* getChildProcessFactory() const; + ref getChildProcessFactory(); #endif void wait() const; @@ -78,7 +78,7 @@ private: #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - windowsFileSystemFactory* m_fileSysFactory; + ref m_fileSysFactory; #endif }; diff --git a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp index 33cb6338..b5405f7e 100644 --- a/vmime/utility/childProcess.hpp +++ b/vmime/utility/childProcess.hpp @@ -85,7 +85,7 @@ public: /** Create 'childProcess' objects. */ -class childProcessFactory +class childProcessFactory : public object { public: diff --git a/vmime/utility/file.hpp b/vmime/utility/file.hpp index 61ede808..f1d877e5 100644 --- a/vmime/utility/file.hpp +++ b/vmime/utility/file.hpp @@ -214,7 +214,7 @@ private: /** Constructs 'file' objects. */ -class fileSystemFactory +class fileSystemFactory : public object { public: