summaryrefslogtreecommitdiff
path: root/src/operator-copy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-copy.cc')
-rw-r--r--src/operator-copy.cc48
1 files changed, 18 insertions, 30 deletions
diff --git a/src/operator-copy.cc b/src/operator-copy.cc
index cbe8767..50afe77 100644
--- a/src/operator-copy.cc
+++ b/src/operator-copy.cc
@@ -4,8 +4,7 @@
* @author Andreas Aardal Hanssen
* @date 2002-2005
* ----------------------------------------------------------------- **/
-#include <string>
-
+#include "convert.h"
#include "depot.h"
#include "iodevice.h"
#include "iofactory.h"
@@ -13,20 +12,17 @@
#include "operators.h"
#include "recursivedescent.h"
#include "session.h"
-#include "convert.h"
+
+#include <string>
using namespace ::std;
using namespace Binc;
//----------------------------------------------------------------------
-CopyOperator::CopyOperator(void)
-{
-}
+CopyOperator::CopyOperator(void) {}
//----------------------------------------------------------------------
-CopyOperator::~CopyOperator(void)
-{
-}
+CopyOperator::~CopyOperator(void) {}
//----------------------------------------------------------------------
const string CopyOperator::getName(void) const
@@ -41,8 +37,7 @@ int CopyOperator::getState(void) const
}
//------------------------------------------------------------------------
-Operator::ProcessResult CopyOperator::process(Depot &depot,
- Request &command)
+Operator::ProcessResult CopyOperator::process(Depot &depot, Request &command)
{
Session &session = Session::getInstance();
@@ -67,14 +62,12 @@ Operator::ProcessResult CopyOperator::process(Depot &depot,
for (; success && i != srcMailbox->end(); ++i) {
Message &source = *i;
- if (srcMailbox->fastCopy(source, *destMailbox,
- depot.mailboxToFilename(toCanonMailbox(dmailbox))))
+ if (srcMailbox->fastCopy(source, *destMailbox, depot.mailboxToFilename(toCanonMailbox(dmailbox))))
continue;
// Have the destination mailbox create a message for us.
- Message *dest
- = destMailbox->createMessage(depot.mailboxToFilename(toCanonMailbox(dmailbox)),
- source.getInternalDate());
+ Message *dest = destMailbox->createMessage(depot.mailboxToFilename(toCanonMailbox(dmailbox)),
+ source.getInternalDate());
if (!dest) {
session.setLastError(destMailbox->getLastError());
success = false;
@@ -91,18 +84,15 @@ Operator::ProcessResult CopyOperator::process(Depot &depot,
do {
int readSize = source.readChunk(chunk);
- if (readSize == 0) break;
+ if (readSize == 0)
+ break;
else if (readSize == -1) {
- bincWarning << "when reading from message "
- << i.getSqnr() << "/" << source.getUID()
- << " in \"" << srcMailbox->getName() << "\": "
- << source.getLastError() << endl;
+ bincWarning << "when reading from message " << i.getSqnr() << "/" << source.getUID() << " in \""
+ << srcMailbox->getName() << "\": " << source.getLastError() << endl;
success = false;
} else if (!dest->appendChunk(chunk)) {
- bincWarning << "when writing to \""
- << dmailbox << "\": "
- << dest->getLastError() << endl;
- success = false;
+ bincWarning << "when writing to \"" << dmailbox << "\": " << dest->getLastError() << endl;
+ success = false;
}
} while (success);
@@ -110,16 +100,14 @@ Operator::ProcessResult CopyOperator::process(Depot &depot,
}
if (!success && !destMailbox->rollBackNewMessages()) {
- session.setLastError("Failed to rollback after unsuccessful copy: "
- + destMailbox->getLastError());
+ session.setLastError("Failed to rollback after unsuccessful copy: " + destMailbox->getLastError());
return NO;
}
if (success)
if (!destMailbox->commitNewMessages(depot.mailboxToFilename(toCanonMailbox(dmailbox)))) {
- session.setLastError("Failed to commit after successful copy: "
- + destMailbox->getLastError());
- return NO;
+ session.setLastError("Failed to commit after successful copy: " + destMailbox->getLastError());
+ return NO;
}
if (!success)