aboutsummaryrefslogtreecommitdiffstats
path: root/src/messaging/maildirUtils.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2004-12-21 09:04:19 +0000
committerVincent Richard <[email protected]>2004-12-21 09:04:19 +0000
commit706c270073daeb2b303ab34b7c5c9862da62b1ae (patch)
treecc081dd5ac849d27ea825b6ddc958c76818ab24a /src/messaging/maildirUtils.cpp
parentAdded component::getChildComponents() function. (diff)
downloadvmime-706c270073daeb2b303ab34b7c5c9862da62b1ae.tar.gz
vmime-706c270073daeb2b303ab34b7c5c9862da62b1ae.zip
Fixed ',2' in filename/flags + fixed file renaming when moving from 'new' to 'cur' + new functions random::getString() and maildirUtils::generateId().
Diffstat (limited to 'src/messaging/maildirUtils.cpp')
-rw-r--r--src/messaging/maildirUtils.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/messaging/maildirUtils.cpp b/src/messaging/maildirUtils.cpp
index e620ce0a..aba91372 100644
--- a/src/messaging/maildirUtils.cpp
+++ b/src/messaging/maildirUtils.cpp
@@ -20,6 +20,8 @@
#include "maildirUtils.hpp"
#include "maildirStore.hpp"
+#include "../utility/random.hpp"
+
namespace vmime {
namespace messaging {
@@ -125,7 +127,9 @@ const int maildirUtils::extractFlags(const utility::file::path::component& comp)
const utility::file::path::component maildirUtils::buildFlags(const int flags)
{
string str;
- str.reserve(6);
+ str.reserve(8);
+
+ str += "2,";
if (flags & message::FLAG_MARKED) str += "F";
if (flags & message::FLAG_PASSED) str += "P";
@@ -151,6 +155,20 @@ const utility::file::path::component maildirUtils::buildFilename
}
+const utility::file::path::component maildirUtils::generateId()
+{
+ std::ostringstream oss;
+
+ oss << utility::random::getTime();
+ oss << ".";
+ oss << utility::random::getProcess();
+ oss << ".";
+ oss << utility::random::getString(6);
+
+ return (utility::file::path::component(oss.str()));
+}
+
+
//
// messageIdComparator