summaryrefslogtreecommitdiff
path: root/src/operator-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-store.cc')
-rw-r--r--src/operator-store.cc75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/operator-store.cc b/src/operator-store.cc
index efb5a48..b6e1b99 100644
--- a/src/operator-store.cc
+++ b/src/operator-store.cc
@@ -4,9 +4,6 @@
* @author Andreas Aardal Hanssen
* @date 2002-2005
* ------------------------------------------------------------------ **/
-#include <string>
-#include <iostream>
-
#include "depot.h"
#include "imapparser.h"
#include "mailbox.h"
@@ -15,18 +12,17 @@
#include "recursivedescent.h"
#include "session.h"
+#include <iostream>
+#include <string>
+
using namespace ::std;
using namespace Binc;
//----------------------------------------------------------------------
-StoreOperator::StoreOperator(void)
-{
-}
+StoreOperator::StoreOperator(void) {}
//----------------------------------------------------------------------
-StoreOperator::~StoreOperator(void)
-{
-}
+StoreOperator::~StoreOperator(void) {}
//----------------------------------------------------------------------
const string StoreOperator::getName(void) const
@@ -41,38 +37,41 @@ int StoreOperator::getState(void) const
}
//------------------------------------------------------------------------
-Operator::ProcessResult StoreOperator::process(Depot &depot,
- Request &command)
+Operator::ProcessResult StoreOperator::process(Depot &depot, Request &command)
{
Mailbox *mailbox = depot.getSelected();
// mask all passed flags together
- unsigned int newflags = (unsigned int) Message::F_NONE;
+ unsigned int newflags = (unsigned int)Message::F_NONE;
vector<string> newCustomFlags;
vector<string>::const_iterator f_i = command.flags.begin();
while (f_i != command.flags.end()) {
- if (*f_i == "\\Deleted") newflags |= Message::F_DELETED;
- else if (*f_i == "\\Answered") newflags |= Message::F_ANSWERED;
- else if (*f_i == "\\Seen") newflags |= Message::F_SEEN;
- else if (*f_i == "\\Draft") newflags |= Message::F_DRAFT;
- else if (*f_i == "\\Flagged") newflags |= Message::F_FLAGGED;
- else newCustomFlags.push_back(*f_i);
+ if (*f_i == "\\Deleted")
+ newflags |= Message::F_DELETED;
+ else if (*f_i == "\\Answered")
+ newflags |= Message::F_ANSWERED;
+ else if (*f_i == "\\Seen")
+ newflags |= Message::F_SEEN;
+ else if (*f_i == "\\Draft")
+ newflags |= Message::F_DRAFT;
+ else if (*f_i == "\\Flagged")
+ newflags |= Message::F_FLAGGED;
+ else
+ newCustomFlags.push_back(*f_i);
++f_i;
}
// pass through all messages
- unsigned int mode
- = command.getUidMode() ? Mailbox::UID_MODE : Mailbox::SQNR_MODE;
+ unsigned int mode = command.getUidMode() ? Mailbox::UID_MODE : Mailbox::SQNR_MODE;
- Mailbox::iterator i
- = mailbox->begin(command.bset, Mailbox::SKIP_EXPUNGED | mode);
+ Mailbox::iterator i = mailbox->begin(command.bset, Mailbox::SKIP_EXPUNGED | mode);
for (; i != mailbox->end(); ++i) {
Message &message = *i;
// get and reset the old flags
- unsigned int flags = (unsigned int) message.getStdFlags();
+ unsigned int flags = (unsigned int)message.getStdFlags();
bool recent = (flags & Message::F_RECENT) != 0;
flags &= (~Message::F_RECENT);
@@ -81,21 +80,18 @@ Operator::ProcessResult StoreOperator::process(Depot &depot,
switch (command.getMode()[0]) {
case '+':
flags |= newflags;
- for (vector<string>::const_iterator it = newCustomFlags.begin();
- it != newCustomFlags.end(); ++it)
- message.setCustomFlag(*it);
+ for (vector<string>::const_iterator it = newCustomFlags.begin(); it != newCustomFlags.end(); ++it)
+ message.setCustomFlag(*it);
break;
case '-':
flags &= ~newflags;
- for (vector<string>::const_iterator it = newCustomFlags.begin();
- it != newCustomFlags.end(); ++it)
+ for (vector<string>::const_iterator it = newCustomFlags.begin(); it != newCustomFlags.end(); ++it)
message.removeCustomFlag(*it);
break;
default:
flags = newflags;
message.resetCustomFlags();
- for (vector<string>::const_iterator it = newCustomFlags.begin();
- it != newCustomFlags.end(); ++it)
+ for (vector<string>::const_iterator it = newCustomFlags.begin(); it != newCustomFlags.end(); ++it)
message.setCustomFlag(*it);
break;
};
@@ -111,21 +107,26 @@ Operator::ProcessResult StoreOperator::process(Depot &depot,
// check mailbox for updates, and report them
if (command.getMode().find(".SILENT") != string::npos)
- pendingUpdates(mailbox, PendingUpdates::EXISTS
- | PendingUpdates::RECENT, false, false, false,
+ pendingUpdates(mailbox,
+ PendingUpdates::EXISTS | PendingUpdates::RECENT,
+ false,
+ false,
+ false,
command.getUidMode());
else
- pendingUpdates(mailbox, PendingUpdates::EXISTS
- | PendingUpdates::RECENT
- | PendingUpdates::EXPUNGE
- | PendingUpdates::FLAGS, false, false, false,
+ pendingUpdates(mailbox,
+ PendingUpdates::EXISTS | PendingUpdates::RECENT | PendingUpdates::EXPUNGE
+ | PendingUpdates::FLAGS,
+ false,
+ false,
+ false,
command.getUidMode());
return OK;
}
//----------------------------------------------------------------------
-Operator::ParseResult StoreOperator::parse(Request & c_in) const
+Operator::ParseResult StoreOperator::parse(Request &c_in) const
{
Session &session = Session::getInstance();