summaryrefslogtreecommitdiffstats
path: root/examples/maildirresource/libmaildir/maildir.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-13 14:39:57 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-13 14:39:57 +0200
commit82ca7ebb9c24fef6f1860eeca9577d998af03c7f (patch)
treeb3e43325ccf1d315f351424e178cac1fbd7e9933 /examples/maildirresource/libmaildir/maildir.cpp
parent29cca3919ed373c486c3c9acec32481918baeb58 (diff)
downloadsink-82ca7ebb9c24fef6f1860eeca9577d998af03c7f.tar.gz
sink-82ca7ebb9c24fef6f1860eeca9577d998af03c7f.zip
Implemented maildir mail moves and got it to pass tests again
Diffstat (limited to 'examples/maildirresource/libmaildir/maildir.cpp')
-rw-r--r--examples/maildirresource/libmaildir/maildir.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/maildirresource/libmaildir/maildir.cpp b/examples/maildirresource/libmaildir/maildir.cpp
index c55e00e..de704f2 100644
--- a/examples/maildirresource/libmaildir/maildir.cpp
+++ b/examples/maildirresource/libmaildir/maildir.cpp
@@ -141,6 +141,10 @@ public:
141 141
142 QString findRealKey(const QString& key) const 142 QString findRealKey(const QString& key) const
143 { 143 {
144 if (key.isEmpty()) {
145 qWarning() << "Empty key: " << key;
146 return key;
147 }
144 // KeyCache* keyCache = KeyCache::self(); 148 // KeyCache* keyCache = KeyCache::self();
145 // if (keyCache->isNewKey(path, key)) { 149 // if (keyCache->isNewKey(path, key)) {
146 if (QFile::exists(path + QString::fromLatin1("/new/") + key)) { 150 if (QFile::exists(path + QString::fromLatin1("/new/") + key)) {
@@ -670,7 +674,7 @@ QString Maildir::addEntry(const QByteArray& data)
670 do { 674 do {
671 uniqueKey = createUniqueFileName() + d->hostName; 675 uniqueKey = createUniqueFileName() + d->hostName;
672 key = d->path + QLatin1String("/tmp/") + uniqueKey; 676 key = d->path + QLatin1String("/tmp/") + uniqueKey;
673 finalKey = d->path + QLatin1String("/new/") + uniqueKey; 677 finalKey = d->path + QLatin1String("/cur/") + uniqueKey;
674 curKey = d->path + QLatin1String("/cur/") + uniqueKey; 678 curKey = d->path + QLatin1String("/cur/") + uniqueKey;
675 } while (QFile::exists(key) || QFile::exists(finalKey) || QFile::exists(curKey)); 679 } while (QFile::exists(key) || QFile::exists(finalKey) || QFile::exists(curKey));
676 680
@@ -911,7 +915,7 @@ QString Maildir::moveEntryTo(const QString &key, const Maildir &destination)
911 } 915 }
912 QFile f(realKey); 916 QFile f(realKey);
913 // ### is this safe regarding the maildir locking scheme? 917 // ### is this safe regarding the maildir locking scheme?
914 const QString targetKey = destination.path() + QDir::separator() + QLatin1String("new") + QDir::separator() + key; 918 const QString targetKey = destination.path() + QDir::separator() + QLatin1String("cur") + QDir::separator() + key;
915 if (!f.rename(targetKey)) { 919 if (!f.rename(targetKey)) {
916 qDebug() << "Failed to rename" << realKey << "to" << targetKey << "! Error: " << f.errorString();; 920 qDebug() << "Failed to rename" << realKey << "to" << targetKey << "! Error: " << f.errorString();;
917 d->lastError = f.errorString(); 921 d->lastError = f.errorString();