From 1d9e0016d63f9b5d86d54cfa0f396d3ea24a2db6 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 12 Jan 2017 11:57:48 +0100 Subject: The template arguments are no longer required. --- examples/imapresource/imapresource.cpp | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'examples/imapresource/imapresource.cpp') diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index c608b04..25d905b 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -260,7 +260,7 @@ public: //Next we synchronize the full set that is given by the date limit. //We fetch all data for this set. //This will also pull in any new messages in subsequent runs. - .then([=]() { + .then([=] { auto job = [&] { SinkLogCtx(mLogCtx) << "Fetching messages since: " << dateFilter; if (dateFilter.isValid()) { @@ -269,7 +269,7 @@ public: return imap->fetchUids(imap->mailboxFromFolder(folder)); } }(); - return job.then>([=](const QVector &uidsToFetch) { + return job.then([=](const QVector &uidsToFetch) { SinkTraceCtx(mLogCtx) << "Received result set " << uidsToFetch; SinkTraceCtx(mLogCtx) << "About to fetch mail" << folder.path(); const auto uidNext = syncStore().readValue(folderRemoteId, "uidnext").toLongLong(); @@ -303,7 +303,7 @@ public: commit(); } }) - .then([=]() { + .then([=] { SinkLogCtx(mLogCtx) << "UIDMAX: " << *maxUid << folder.path(); if (*maxUid > 0) { syncStore().writeValue(folderRemoteId, "uidnext", QByteArray::number(*maxUid)); @@ -321,7 +321,7 @@ public: SinkLogCtx(mLogCtx) << "Fetching headers until: " << fullsetLowerbound; return imap->fetchUids(imap->mailboxFromFolder(folder)) - .then>([=] (const QVector &uids) { + .then([=] (const QVector &uids) { //sort in reverse order and remove everything greater than fullsetLowerbound QVector toFetch = uids; qSort(toFetch.begin(), toFetch.end(), qGreater()); @@ -345,7 +345,7 @@ public: } }); }) - .then([=]() { + .then([=] { SinkLogCtx(mLogCtx) << "Headers fetched: " << folder.path(); syncStore().writeValue(folderRemoteId, "headersFetched", "true"); commit(); @@ -357,7 +357,7 @@ public: return KAsync::null(); }) //Finally remove messages that are no longer existing on the server. - .then([=]() { + .then([=] { //TODO do an examine with QRESYNC and remove VANISHED messages if supported instead return imap->fetchUids(folder).then([=](const QVector &uids) { SinkTraceCtx(mLogCtx) << "Syncing removals: " << folder.path(); @@ -425,7 +425,7 @@ public: .onError([](const KAsync::Error &error) { SinkWarning() << "Folder list sync failed."; }) - .then([folderList]() { return *folderList; } ); + .then([folderList] { return *folderList; } ); } } @@ -434,7 +434,7 @@ public: auto imap = QSharedPointer::create(mServer, mPort); if (query.type() == ApplicationDomain::getTypeName()) { return login(imap) - .then([=]() { + .then([=] { auto folderList = QSharedPointer>::create(); return imap->fetchFolders([folderList](const Folder &folder) { *folderList << folder; @@ -443,7 +443,7 @@ public: synchronizeFolders(*folderList); }); }) - .then([=] (const KAsync::Error &error) { + .then([=] (const KAsync::Error &error) { if (error) { SinkWarning() << "Error during folder sync: " << error.errorMessage; } @@ -460,7 +460,7 @@ public: //if we have no folder filter: //* fetch list of folders from server directly and sync (because we have no guarantee that the folder sync was already processed by the pipeline). return login(imap) - .then([=] () -> KAsync::Job { + .then([=] { if (!query.ids().isEmpty()) { //If we have mail id's simply fetch the full payload of those mails QVector toFetch; @@ -495,7 +495,7 @@ public: bool syncHeaders = query.hasFilter(); //FIXME If we were able to to flush in between we could just query the local store for the folder list. return getFolderList(imap, query) - .then>([=] (const QVector &folders) { + .then([=] (const QVector &folders) { //Synchronize folders return KAsync::value(folders) .serialEach([=](const Folder &folder) { @@ -514,7 +514,7 @@ public: }); } }) - .then([=] (const KAsync::Error &error) { + .then([=] (const KAsync::Error &error) { if (error) { SinkWarning() << "Error during sync: " << error.errorMessage; } @@ -574,7 +574,7 @@ public: set.add(uid); job = login.then(imap->append(mailbox, content, flags, internalDate)) .addToContext(imap) - .then([=](qint64 uid) { + .then([=](qint64 uid) { const auto remoteId = assembleMailRid(mail, uid); SinkTrace() << "Finished creating a modified mail: " << remoteId; return imap->remove(oldMailbox, set).then(KAsync::value(remoteId)); @@ -593,14 +593,14 @@ public: } } return job - .then([=] (const KAsync::Error &error, const QByteArray &remoteId) { + .then([=] (const KAsync::Error &error, const QByteArray &remoteId) { if (error) { SinkWarning() << "Error during changereplay: " << error.errorMessage; return imap->logout() - .then(KAsync::error(error)); + .then(KAsync::error(error)); } return imap->logout() - .then(KAsync::value(remoteId)); + .then(KAsync::value(remoteId)); }); } @@ -615,7 +615,7 @@ public: } SinkTrace() << "Creating a new folder: " << parentFolder << folder.getName(); auto rid = QSharedPointer::create(); - auto createFolder = login.then(imap->createSubfolder(parentFolder, folder.getName())) + auto createFolder = login.then(imap->createSubfolder(parentFolder, folder.getName())) .then([imap, rid](const QString &createdFolder) { SinkTrace() << "Finished creating a new folder: " << createdFolder; *rid = createdFolder.toUtf8(); @@ -628,12 +628,12 @@ public: } else { //We try to merge special purpose folders first auto specialPurposeFolders = QSharedPointer>::create(); auto mergeJob = imap->login(mUser, mPassword) - .then(imap->fetchFolders([=](const Imap::Folder &folder) { + .then(imap->fetchFolders([=](const Imap::Folder &folder) { if (SpecialPurpose::isSpecialPurposeFolderName(folder.name())) { specialPurposeFolders->insert(SpecialPurpose::getSpecialPurposeType(folder.name()), folder.path()); }; })) - .then([specialPurposeFolders, folder, imap, parentFolder, rid]() -> KAsync::Job { + .then([specialPurposeFolders, folder, imap, parentFolder, rid]() -> KAsync::Job { for (const auto &purpose : folder.getSpecialPurpose()) { if (specialPurposeFolders->contains(purpose)) { auto f = specialPurposeFolders->value(purpose); @@ -657,20 +657,20 @@ public: } } else if (operation == Sink::Operation_Removal) { SinkTrace() << "Removing a folder: " << oldRemoteId; - return login.then(imap->remove(oldRemoteId)) - .then([oldRemoteId, imap]() { + return login.then(imap->remove(oldRemoteId)) + .then([oldRemoteId, imap] { SinkTrace() << "Finished removing a folder: " << oldRemoteId; return QByteArray(); }); } else if (operation == Sink::Operation_Modification) { SinkTrace() << "Renaming a folder: " << oldRemoteId << folder.getName(); auto rid = QSharedPointer::create(); - return login.then(imap->renameSubfolder(oldRemoteId, folder.getName())) + return login.then(imap->renameSubfolder(oldRemoteId, folder.getName())) .then([imap, rid](const QString &createdFolder) { SinkTrace() << "Finished renaming a folder: " << createdFolder; *rid = createdFolder.toUtf8(); }) - .then([rid](){ + .then([rid] { return *rid; }); } @@ -730,15 +730,15 @@ protected: SinkTrace() << "Connecting to:" << mServer << mPort; SinkTrace() << "as:" << mUser; auto inspectionJob = imap->login(mUser, mPassword) - .then(imap->select(folderRemoteId)) + .then(imap->select(folderRemoteId)) .then([](Imap::SelectResult){}) - .then(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) { + .then(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) { messageByUid->insert(message.uid, message); })); if (inspectionType == Sink::ResourceControl::Inspection::PropertyInspectionType) { if (property == "unread") { - return inspectionJob.then([=]() { + return inspectionJob.then([=] { auto msg = messageByUid->value(uid); if (expectedValue.toBool() && msg.flags.contains(Imap::Flags::Seen)) { return KAsync::error(1, "Expected unread but couldn't find it."); @@ -750,7 +750,7 @@ protected: }); } if (property == "subject") { - return inspectionJob.then([=]() { + return inspectionJob.then([=] { auto msg = messageByUid->value(uid); if (msg.msg->subject(true)->asUnicodeString() != expectedValue.toString()) { return KAsync::error(1, "Subject not as expected: " + msg.msg->subject(true)->asUnicodeString()); @@ -760,7 +760,7 @@ protected: } } if (inspectionType == Sink::ResourceControl::Inspection::ExistenceInspectionType) { - return inspectionJob.then([=]() { + return inspectionJob.then([=] { if (!messageByUid->contains(uid)) { SinkWarning() << "Existing messages are: " << messageByUid->keys(); SinkWarning() << "We're looking for: " << uid; @@ -792,11 +792,11 @@ protected: auto imap = QSharedPointer::create(mServer, mPort); auto messageByUid = QSharedPointer>::create(); return imap->login(mUser, mPassword) - .then(imap->select(remoteId).then([](){})) - .then(imap->fetch(set, scope, [=](const Imap::Message message) { + .then(imap->select(remoteId)) + .then(imap->fetch(set, scope, [=](const Imap::Message message) { messageByUid->insert(message.uid, message); })) - .then([imap, messageByUid, expectedCount]() { + .then([imap, messageByUid, expectedCount] { if (messageByUid->size() != expectedCount) { return KAsync::error(1, QString("Wrong number of messages on the server; found %1 instead of %2.").arg(messageByUid->size()).arg(expectedCount)); } @@ -809,11 +809,11 @@ protected: auto imap = QSharedPointer::create(mServer, mPort); auto inspectionJob = imap->login(mUser, mPassword) - .then(imap->fetchFolders([=](const Imap::Folder &f) { + .then(imap->fetchFolders([=](const Imap::Folder &f) { *folderByPath << f.path(); *folderByName << f.name(); })) - .then([this, folderByName, folderByPath, folder, remoteId, imap]() { + .then([this, folderByName, folderByPath, folder, remoteId, imap] { if (!folderByName->contains(folder.getName())) { SinkWarning() << "Existing folders are: " << *folderByPath; SinkWarning() << "We're looking for: " << folder.getName(); -- cgit v1.2.3