james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r596767 - in /james/server/trunk: core-library/src/main/java/org/apache/james/mailboxmanager/ core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/ core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ experiment...
Date Tue, 20 Nov 2007 18:28:39 GMT
Author: rdonkin
Date: Tue Nov 20 10:28:34 2007
New Revision: 596767

URL: http://svn.apache.org/viewvc?rev=596767&view=rev
Log:
Altered setFlags so that changed results are returned. Completed store implementation and testing. Store parser improvements.

Added:
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestEvents.java
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/AppendToSelected.test
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParserTest.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalEventTest.java
Removed:
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/StoreDirective.java
Modified:
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResult.java
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Store.test
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/IdRange.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/imap4rev1/StoreRequest.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java
    james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/FetchCommand.java
    james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/StoreCommand.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalSelectedStateTest.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java
    james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResult.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResult.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResult.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/MessageResult.java Tue Nov 20 10:28:34 2007
@@ -79,6 +79,9 @@
 
     public static final int UID = 0x04;
 
+    /**
+     * TODO: should message number be managed by protocol client?
+     */
     public static final int MSN = 0x08;
 
     /**

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java Tue Nov 20 10:28:34 2007
@@ -19,6 +19,8 @@
 
 package org.apache.james.mailboxmanager.mailbox;
 
+import java.util.Iterator;
+
 import javax.mail.Flags;
 
 import org.apache.james.mailboxmanager.GeneralMessageSet;
@@ -75,9 +77,12 @@
      *            replace all Flags with this flags, value has to be true
      * @param set
      *            the range of messages
+     * @param result fetch group for results 
+     * @return {@link MessageResult} <code>Iterator</code> containing messages
+     * whose flags have been updated, not null
      * @throws MailboxManagerException
      */
-
-    void setFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set) throws MailboxManagerException;
+    Iterator setFlags(Flags flags, boolean value, boolean replace, 
+            GeneralMessageSet set, int result) throws MailboxManagerException;
 
 }

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java Tue Nov 20 10:28:34 2007
@@ -19,11 +19,14 @@
 
 package org.apache.james.mailboxmanager.wrapper;
 
+import java.util.Iterator;
+
 import javax.mail.Flags;
 
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
+import org.apache.james.mailboxmanager.impl.MessageResultImpl;
 import org.apache.james.mailboxmanager.mailbox.FlaggedMailbox;
 
 public class FlaggedSessionMailboxWrapper extends SessionMailboxWrapper {
@@ -53,9 +56,34 @@
         return ((FlaggedMailbox) mailbox).getUnseenCount();
     }
 
-    public void setFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set) throws MailboxManagerException {
-        ((FlaggedMailbox) mailbox).setFlags(flags, value, replace,toUidSet(set));
+    public Iterator setFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set, int result) throws MailboxManagerException {
+        final Iterator results = ((FlaggedMailbox) mailbox).setFlags(flags, value, replace,toUidSet(set), result);
+        return new MsnIterator(results, getNumberCache());
     }
     
-
+    private static final class MsnIterator implements Iterator {
+        private final Iterator it;
+        private final UidToMsnBidiMap map;
+        
+        public MsnIterator(final Iterator it, final UidToMsnBidiMap map) {
+            this.it = it;
+            this.map = map;
+        }
+        
+        public boolean hasNext() {
+            return it.hasNext();
+        }
+
+        public Object next() {
+            final MessageResult next = (MessageResult) it.next();
+            final MessageResultImpl result = new MessageResultImpl(next);
+            result.setMsn(map.getMsn(result.getUid()));
+            return result;
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
 }

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java Tue Nov 20 10:28:34 2007
@@ -19,8 +19,6 @@
 
 package org.apache.james.mailboxmanager.wrapper;
 
-import javax.mail.search.SearchTerm;
-
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java Tue Nov 20 10:28:34 2007
@@ -76,12 +76,12 @@
         if (numberCache == null && mailbox != null) {
             startingNumberCache = true;
             try {
-            MessageResult[] mr = mailbox.getMessages(GeneralMessageSetImpl
-                    .all(), MessageResult.UID);
-            numberCache = new UidToMsnBidiMap();
-            for (int i = 0; i < mr.length; i++) {
-                numberCache.add(mr[i].getUid());
-            }
+                MessageResult[] mr = mailbox.getMessages(GeneralMessageSetImpl
+                        .all(), MessageResult.UID);
+                numberCache = new UidToMsnBidiMap();
+                for (int i = 0; i < mr.length; i++) {
+                    numberCache.add(mr[i].getUid());
+                }
             } finally {
                 startingNumberCache = false;
             }
@@ -201,6 +201,8 @@
         }
     }
 
+    
+    
     /**
      * @see org.apache.james.mailboxmanager.MailboxListener#event(org.apache.james.mailboxmanager.MailboxListener.Event)
      */

Added: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestEvents.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestEvents.java?rev=596767&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestEvents.java (added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestEvents.java Tue Nov 20 10:28:34 2007
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.test.functional.imap;
+
+import java.util.Locale;
+
+public abstract class AbstractTestEvents extends BaseTestSelectedState {
+
+    public AbstractTestEvents(HostSystem system) {
+        super(system);
+    }
+
+    public void testAppendToSelectedUS() throws Exception {
+        scriptTest("AppendToSelected", Locale.US);
+    }
+    
+    public void testAppendToSelectedKOREA() throws Exception {
+        scriptTest("AppendToSelected", Locale.KOREA);
+    }
+    
+    public void testAppendToSelectedITALY() throws Exception {
+        scriptTest("AppendToSelected", Locale.ITALY);
+    }
+}

Added: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/AppendToSelected.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/AppendToSelected.test?rev=596767&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/AppendToSelected.test (added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/AppendToSelected.test Tue Nov 20 10:28:34 2007
@@ -0,0 +1,63 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+C: a1 CREATE appendBox
+S: a1 OK CREATE completed.
+
+C: A003 APPEND appendBox {310}
+# Use command continuation request
+S: \+
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <foobar@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B27397-0100000@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:00pm tomorrow?
+C:
+S: A003 OK APPEND completed.
+
+C: a7 select appendBox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 1 EXISTS
+S: \* 1 RECENT
+S: \* OK \[UIDVALIDITY \d+\]
+S: \* OK \[UNSEEN 1\] Message 1 is the first unseen
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
+S: a7 OK \[READ-WRITE\] SELECT completed.
+
+C: A007 APPEND appendBox (\Seen) "17-Jul-1996 02:44:25 -0700" {310+}
+# use synchronising literal
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <foobar@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B27397-0100000@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:00pm tomorrow?
+C:
+S: \* 2 EXISTS
+S: \* 1 RECENT
+S: A007 OK APPEND completed.
+
+C: a1 DELETE appendBox
+S: a1 OK DELETE completed.
\ No newline at end of file

Modified: james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Store.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Store.test?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Store.test (original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/Store.test Tue Nov 20 10:28:34 2007
@@ -59,13 +59,13 @@
 S: f1 OK FETCH completed.
 
 C: f4 STORE 3:4 FLAGS (\Flagged)
-S: \* 3 FETCH \(FLAGS \(\\Flagged\)
-S: \* 4 FETCH \(FLAGS \(\\Flagged\)
+S: \* 3 FETCH \(FLAGS \(\\Flagged\)\)
+S: \* 4 FETCH \(FLAGS \(\\Flagged\)\)
 S: f4 OK STORE completed.
 
 C: f1 FETCH 1:4 (FLAGS)
 S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged\)\)
 S: \* 2 FETCH \(FLAGS \(\)\)
-S: \* 3 FETCH \(FLAGS \(\\Flagged\)
-S: \* 4 FETCH \(FLAGS \(\\Flagged\)
+S: \* 3 FETCH \(FLAGS \(\\Flagged\)\)
+S: \* 4 FETCH \(FLAGS \(\\Flagged\)\)
 S: f1 OK FETCH completed.

Modified: james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java (original)
+++ james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/imap4rev1/Imap4Rev1MessageFactory.java Tue Nov 20 10:28:34 2007
@@ -29,7 +29,6 @@
 import org.apache.james.api.imap.message.FetchData;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.StatusDataItems;
-import org.apache.james.api.imap.message.StoreDirective;
 
 /**
  * Creates messages.
@@ -87,8 +86,8 @@
 
     public ImapMessage createStatusMessage(final ImapCommand command, final String mailboxName, final StatusDataItems statusDataItems, final String tag) ;
 
-    public ImapMessage createStoreMessage(final ImapCommand command, final IdRange[] idSet, final StoreDirective directive, final Flags flags, 
-         final boolean useUids, final String tag); 
+    public ImapMessage createStoreMessage(final ImapCommand command, final IdRange[] idSet, boolean silent, Boolean sign, 
+         final Flags flags, final boolean useUids, final String tag); 
     
     public ImapMessage createSubscribeMessage(final ImapCommand command, final String mailboxName, final String tag); 
 

Modified: james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/IdRange.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/IdRange.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/IdRange.java (original)
+++ james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/message/IdRange.java Tue Nov 20 10:28:34 2007
@@ -49,4 +49,49 @@
         return _lowVal <= uid && uid <= _highVal;
     }
 
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + (int) (_highVal ^ (_highVal >>> 32));
+        result = PRIME * result + (int) (_lowVal ^ (_lowVal >>> 32));
+        return result;
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final IdRange other = (IdRange) obj;
+        if (_highVal != other._highVal)
+            return false;
+        if (_lowVal != other._lowVal)
+            return false;
+        return true;
+    }
+
+    /**
+     * Renders text suitable for logging.
+     *
+     * @return a <code>String</code> representation 
+     * of this object.
+     */
+    public String toString()
+    {
+        final String retValue = "IdRange ( "
+            + this._lowVal + "->" + this._highVal 
+            + " )";
+    
+        return retValue;
+    }
+
+    
 }

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java (original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/base/BaseImap4Rev1MessageFactory.java Tue Nov 20 10:28:34 2007
@@ -30,7 +30,6 @@
 import org.apache.james.api.imap.message.FetchData;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.StatusDataItems;
-import org.apache.james.api.imap.message.StoreDirective;
 import org.apache.james.imap.message.request.imap4rev1.AppendRequest;
 import org.apache.james.imap.message.request.imap4rev1.AuthenticateRequest;
 import org.apache.james.imap.message.request.imap4rev1.CapabilityRequest;
@@ -143,8 +142,8 @@
         return new StatusRequest(command, mailboxName, statusDataItems, tag);
     }
 
-    public ImapMessage createStoreMessage(ImapCommand command, IdRange[] idSet, StoreDirective directive, Flags flags, boolean useUids, String tag) {
-        return new StoreRequest(command, idSet, directive, flags, useUids, tag);
+    public ImapMessage createStoreMessage(ImapCommand command, IdRange[] idSet, boolean silent, Boolean sign, Flags flags, boolean useUids, String tag) {
+        return new StoreRequest(command, idSet, silent, flags, useUids, tag, sign);
     }
 
     public ImapMessage createSubscribeMessage(ImapCommand command, String mailboxName, String tag) {

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/imap4rev1/StoreRequest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/imap4rev1/StoreRequest.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/imap4rev1/StoreRequest.java (original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imap/message/request/imap4rev1/StoreRequest.java Tue Nov 20 10:28:34 2007
@@ -22,30 +22,67 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.message.IdRange;
-import org.apache.james.api.imap.message.StoreDirective;
 import org.apache.james.imap.message.request.base.AbstractImapRequest;
 
 public class StoreRequest extends AbstractImapRequest {
+    
     private final IdRange[] idSet;
 
-    private final StoreDirective directive;
-
     private final Flags flags;
 
     private final boolean useUids;
+    
+    private final boolean silent;
+    private final boolean signedMinus;
+    private final boolean signedPlus;
 
     public StoreRequest(final ImapCommand command, final IdRange[] idSet,
-            final StoreDirective directive, final Flags flags,
-            final boolean useUids, final String tag) {
+            final boolean silent, final Flags flags,
+            final boolean useUids, final String tag, final Boolean sign) {
         super(tag, command);
         this.idSet = idSet;
-        this.directive = directive;
+        this.silent = silent;
         this.flags = flags;
         this.useUids = useUids;
+        if (sign == null) {
+            signedMinus = false;
+            signedPlus = false;
+        } else if (sign.booleanValue()) {
+            signedMinus = false;
+            signedPlus = true;
+        } else {
+            signedMinus = true;
+            signedPlus = false;
+        }
+    }
+
+    /**
+     * Is this store silent?
+     * @return true if store silent, 
+     * false otherwise
+     */
+    public final boolean isSilent() {
+        return silent;
+    }
+    
+    /**
+     * Is the store signed MINUS?
+     * Note that {@link #isSignedPlus()} must be false
+     * when this property is true.
+     * @return true if the store is subtractive
+     */
+    public final boolean isSignedMinus() {
+        return signedMinus;
     }
 
-    public final StoreDirective getDirective() {
-        return directive;
+    /**
+     * Is the store signed PLUS?
+     * Note that {@link #isSignedMinus()} must be false
+     * when this property is true.
+     * @return true if the store is additive
+     */
+    public final boolean isSignedPlus() {
+        return signedPlus;
     }
 
     public final Flags getFlags() {

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java (original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java Tue Nov 20 10:28:34 2007
@@ -363,11 +363,15 @@
         }
         // Got the closing ")", may be attached to a word.
         if ( nextWord.length() > 1 ) {
-            DecoderUtils.setFlag( nextWord.substring(0, nextWord.length() - 1 ), flags );
+            int parenIndex = nextWord.indexOf(')');
+            if (parenIndex > 0) {
+                final String nextFlag = nextWord.substring(0, parenIndex );
+                DecoderUtils.setFlag( nextFlag, flags );
+            }
         }
 
         return flags;
-        }
+    }
 
     /**
      * Reads an argument of type "number" from the request.

Modified: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java (original)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java Tue Nov 20 10:28:34 2007
@@ -25,7 +25,6 @@
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
 import org.apache.james.api.imap.message.IdRange;
-import org.apache.james.api.imap.message.StoreDirective;
 import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
 import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
 
@@ -42,23 +41,23 @@
         final ImapCommand command = factory.getStore();
         setCommand(command);
     }
-    
-    StoreDirective storeDirective( ImapRequestLineReader request ) throws ProtocolException
-    {
-        int sign = 0;
+
+    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException {
+        final IdRange[] idSet = parseIdRange( request );
+        final Boolean sign;
         boolean silent = false;
 
         char next = request.nextWordChar();
         if ( next == '+' ) {
-            sign = 1;
+            sign = Boolean.TRUE;
             request.consume();
         }
         else if ( next == '-' ) {
-            sign = -1;
+            sign = Boolean.FALSE;
             request.consume();
         }
         else {
-            sign = 0;
+            sign = null;
         }
 
         String directive = consumeWord( request, new NoopCharValidator() );
@@ -71,15 +70,11 @@
         else {
             throw new ProtocolException( "Invalid Store Directive: '" + directive + "'" );
         }
-        return new StoreDirective( sign, silent );
-    }
-
-    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException {
-        final IdRange[] idSet = parseIdRange( request );
-        final StoreDirective directive = storeDirective( request );
+        
         final Flags flags = flagList( request );
         endLine( request );
-        final ImapMessage result = getMessageFactory().createStoreMessage(command, idSet, directive, flags, useUids, tag);
+        final ImapMessage result = getMessageFactory().createStoreMessage(
+                command, idSet, silent, sign, flags, useUids, tag);
         return result;
     }
 }

Added: james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParserTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParserTest.java?rev=596767&view=auto
==============================================================================
--- james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParserTest.java (added)
+++ james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParserTest.java Tue Nov 20 10:28:34 2007
@@ -0,0 +1,85 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import javax.mail.Flags;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.api.imap.message.IdRange;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+import org.jmock.core.Constraint;
+
+public class StoreCommandParserTest extends MockObjectTestCase {
+
+    StoreCommandParser parser;
+    Mock mockCommandFactory;
+    Mock mockMessageFactory;
+    Mock mockCommand;
+    Mock mockMessage;
+    ImapCommand command;
+    ImapMessage message;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        parser = new StoreCommandParser();
+        mockCommandFactory = mock(Imap4Rev1CommandFactory.class);
+        mockCommandFactory.expects(once()).method("getStore");
+        mockMessageFactory = mock(Imap4Rev1MessageFactory.class);
+        mockCommand = mock(ImapCommand.class);
+        command = (ImapCommand) mockCommand.proxy();
+        mockMessage = mock(ImapMessage.class);
+        message = (ImapMessage) mockMessage.proxy();
+        parser.init((Imap4Rev1CommandFactory) mockCommandFactory.proxy());
+        parser.setMessageFactory((Imap4Rev1MessageFactory) mockMessageFactory.proxy());
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testShouldParseSilentDraftFlagged() throws Exception {
+        IdRange[] ranges = {new IdRange(1)};
+        Flags flags = new Flags();
+        flags.add(Flags.Flag.DRAFT);
+        flags.add(Flags.Flag.FLAGGED);
+        check("1 FLAGS.SILENT (\\Draft \\Flagged)\r\n", ranges, true, null, flags, 
+                false, "A01");
+    }
+    
+    private void check(String input, final IdRange[] idSet, boolean silent, Boolean sign, 
+            final Flags flags, final boolean useUids, String tag) throws Exception {
+        ImapRequestLineReader reader = new ImapRequestLineReader(new ByteArrayInputStream(input.getBytes("US-ASCII")), 
+                    new ByteArrayOutputStream());
+
+        Constraint[] constraints = {eq(command), eq(idSet), eq(silent), eq(sign), 
+                eq(flags), eq(useUids), same(tag)};
+        mockMessageFactory.expects(once()).method("createStoreMessage").with(constraints).will(returnValue(message));
+        parser.decode(command, reader, tag, useUids);
+    }
+}

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java Tue Nov 20 10:28:34 2007
@@ -168,7 +168,7 @@
             if (fetch.isSetSeen()
                     && !result.getFlags().contains(Flags.Flag.SEEN)) {
                 mailbox.setFlags(new Flags(Flags.Flag.SEEN), true, false,
-                        GeneralMessageSetImpl.oneUid(result.getUid()));
+                        GeneralMessageSetImpl.oneUid(result.getUid()), MessageResult.NOTHING);
                 result.getFlags().add(Flags.Flag.SEEN);
                 ensureFlagsResponse = true;
             }

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java (original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java Tue Nov 20 10:28:34 2007
@@ -19,29 +19,32 @@
 
 package org.apache.james.imapserver.processor.imap4rev1;
 
+import java.util.Iterator;
+
 import javax.mail.Flags;
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
-import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.IdRange;
-import org.apache.james.api.imap.message.StoreDirective;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.StoreRequest;
+import org.apache.james.imap.message.response.imap4rev1.FetchResponse;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 
 public class StoreProcessor extends AbstractImapRequestProcessor {
 
+    private static final int STORE_FETCH_GROUP = MessageResult.FLAGS | MessageResult.MSN | MessageResult.UID;
+
     public StoreProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
         super(next, factory);
     }
@@ -52,29 +55,23 @@
 
     protected void doProcess(ImapRequest message,
             ImapSession session, String tag, ImapCommand command, Responder responder)
-            throws MailboxException, AuthorizationException, ProtocolException {
+            throws MailboxException {
         final StoreRequest request = (StoreRequest) message;
         final IdRange[] idSet = request.getIdSet();
-        final StoreDirective directive = request.getDirective();
         final Flags flags = request.getFlags();
         final boolean useUids = request.isUseUids();
-        doProcess(idSet, directive, flags, useUids, session, tag, command, responder);
-    }
-
-    private void doProcess(final IdRange[] idSet,
-            final StoreDirective directive, final Flags flags,
-            final boolean useUids, ImapSession session, String tag,
-            ImapCommand command, Responder responder) throws MailboxException,
-            AuthorizationException, ProtocolException {
-
+        final boolean silent = request.isSilent();
+        final boolean isSignedPlus = request.isSignedPlus();
+        final boolean isSignedMinus = request.isSignedMinus();
+        
         ImapMailboxSession mailbox = ImapSessionUtils.getMailbox(session);
 
         final boolean replace;
         final boolean value;
-        if (directive.getSign() < 0) {
+        if (isSignedMinus) {
             value = false;
             replace = false;
-        } else if (directive.getSign() > 0) {
+        } else if (isSignedPlus) {
             value = true;
             replace = false;
         } else {
@@ -86,8 +83,23 @@
                 final GeneralMessageSet messageSet = GeneralMessageSetImpl
                         .range(idSet[i].getLowVal(), idSet[i].getHighVal(),
                                 useUids);
-
-                mailbox.setFlags(flags, value, replace, messageSet);
+                final Iterator it = mailbox.setFlags(flags, value, 
+                        replace, messageSet, STORE_FETCH_GROUP);
+                if (!silent) {
+                    while(it.hasNext()) {
+                        final MessageResult result = (MessageResult) it.next();
+                        final int msn = result.getMsn();
+                        final Flags resultFlags = result.getFlags();
+                        final Long resultUid;
+                        if (useUids) {
+                            resultUid = new Long(result.getUid());
+                        } else {
+                            resultUid = null;
+                        }
+                        final FetchResponse response = new FetchResponse(msn, resultFlags, resultUid);
+                        responder.respond(response);
+                    }
+                }
             }
         } catch (MailboxManagerException e) {
             throw new MailboxException(e);

Modified: james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/FetchCommand.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/FetchCommand.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/FetchCommand.java (original)
+++ james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/FetchCommand.java Tue Nov 20 10:28:34 2007
@@ -114,7 +114,7 @@
             if (fetch.isSetSeen()
                     && !result.getFlags().contains(Flags.Flag.SEEN)) {
                 mailbox.setFlags(new Flags(Flags.Flag.SEEN), true, false,
-                        GeneralMessageSetImpl.oneUid(result.getUid()));
+                        GeneralMessageSetImpl.oneUid(result.getUid()), MessageResult.NOTHING);
                 result.getFlags().add(Flags.Flag.SEEN);
                 ensureFlagsResponse = true;
             }

Modified: james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/StoreCommand.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/StoreCommand.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/StoreCommand.java (original)
+++ james/server/trunk/imapserver-function/src/main/java/org/apache/james/imapserver/commands/StoreCommand.java Tue Nov 20 10:28:34 2007
@@ -29,6 +29,7 @@
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 
@@ -91,7 +92,7 @@
                     .range(idSet[i].getLowVal(), idSet[i].getHighVal(),
                             useUids);
 
-                    mailbox.setFlags(flags, value, replace, messageSet);
+                    mailbox.setFlags(flags, value, replace, messageSet, MessageResult.NOTHING);
                 }
             } catch (MailboxManagerException e) {
                 throw new MailboxException(e);

Added: james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalEventTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalEventTest.java?rev=596767&view=auto
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalEventTest.java (added)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalEventTest.java Tue Nov 20 10:28:34 2007
@@ -0,0 +1,30 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.experimental.imapserver;
+
+import org.apache.james.test.functional.imap.AbstractTestEvents;
+
+public class ExperimentalEventTest extends AbstractTestEvents {
+
+    public ExperimentalEventTest() throws Exception {
+        super(HostSystemFactory.createStandardImap());
+    }
+
+}

Modified: james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalSelectedStateTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalSelectedStateTest.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalSelectedStateTest.java (original)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalSelectedStateTest.java Tue Nov 20 10:28:34 2007
@@ -47,11 +47,6 @@
         //super.testFetchSingleMessage();
     }
 
-    public void testStoreUS() throws Exception {
-//      STORE FLAGS.SILENT does not work
-//        super.testStore();
-    }
-
     public void testUidUS() throws Exception {
         // UID fetch not working very well
         // super.testUid();
@@ -83,11 +78,6 @@
         //super.testFetchSingleMessage();
     }
 
-    public void testStoreKOREA() throws Exception {
-//      STORE FLAGS.SILENT does not work
-//        super.testStore();
-    }
-
     public void testUidKOREA() throws Exception {
         // UID fetch not working very well
         // super.testUid();
@@ -116,11 +106,6 @@
         // BODY octet count is buggy.
         // The total size of the message is ITALYed rather than the size of the part
         //super.testFetchSingleMessage();
-    }
-
-    public void testStoreITALY() throws Exception {
-//      STORE FLAGS.SILENT does not work
-//        super.testStore();
     }
 
     public void testUidITALY() throws Exception {

Modified: james/server/trunk/phoenix-deployment/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java (original)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java Tue Nov 20 10:28:34 2007
@@ -188,7 +188,7 @@
     
     public void deleteAll(String folder) throws MailboxManagerException {
         ImapMailboxSession mailbox=getImapMailboxSession(folder);
-        mailbox.setFlags(new Flags(Flag.DELETED),true,false,GeneralMessageSetImpl.all());
+        mailbox.setFlags(new Flags(Flag.DELETED),true,false,GeneralMessageSetImpl.all(), MessageResult.NOTHING);
         mailbox.expunge(GeneralMessageSetImpl.all(),MessageResult.NOTHING);
         mailbox.close();
     }
@@ -274,7 +274,7 @@
     
     public void setFlags(String mailboxName,long fromUid,long toUid,Flags flags, boolean value, boolean replace) throws MailboxManagerException {
         ImapMailboxSession mailbox=getImapMailboxSession(mailboxName);
-        mailbox.setFlags(flags, value, replace, GeneralMessageSetImpl.uidRange(fromUid, toUid));
+        mailbox.setFlags(flags, value, replace, GeneralMessageSetImpl.uidRange(fromUid, toUid), MessageResult.NOTHING);
         mailbox.close();
     }
     private ImapMailboxSession getImapMailboxSession(String mailboxName) throws MailboxManagerException {

Modified: james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java (original)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java Tue Nov 20 10:28:34 2007
@@ -74,7 +74,7 @@
         assertNotNull(mr);
         assertEquals(6, mr.getUid());
         assertEquals(6, mr.getMsn());
-        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.uidRange(1,3));
+        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.uidRange(1,3), MessageResult.NOTHING);
         mailbox.expunge(GeneralMessageSetImpl.all(), 0);
         mailbox.getExpungedEvents(true);
         mr=mailbox.getFirstUnseen(MessageResult.UID | MessageResult.MSN);
@@ -89,7 +89,7 @@
             assertEquals(i+1, mr.getUid());
             assertEquals(i+1, mr.getMsn());
         }
-        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.uidRange(2, 4));
+        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.uidRange(2, 4), MessageResult.NOTHING);
         final MessageResult[] expungeResult1=mailbox.expunge(GeneralMessageSetImpl.all(), MessageResult.UID | MessageResult.MSN);
         checkMessageResults(new long[] {2,3,4},new int[] {2,3,4},expungeResult1);
         
@@ -115,8 +115,8 @@
         final MessageResult[] getResult3 = mailbox.getMessages(GeneralMessageSetImpl.all(), MessageResult.UID | MessageResult.MSN);
         checkMessageResults(new long[] {1,5,6,7,8,9,10},new int[] {1,2,3,4,5,6,7},getResult3);
         
-        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.msnRange(2,4));
-        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.oneMsn(6));
+        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.msnRange(2,4), MessageResult.NOTHING);
+        mailbox.setFlags(new Flags(Flags.Flag.DELETED), true, false, GeneralMessageSetImpl.oneMsn(6), MessageResult.NOTHING);
         
         final MessageResult[] expungeResult2=mailbox.expunge(GeneralMessageSetImpl.all(), MessageResult.UID | MessageResult.MSN);
         checkMessageResults(new long[] {5,6,7,9},new int[] {2,3,4,6},expungeResult2);

Modified: james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java (original)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java Tue Nov 20 10:28:34 2007
@@ -86,7 +86,7 @@
         
         Flags f=new Flags();
         f.add(Flags.Flag.DELETED);
-        torqueMailbox.setFlags(f,true,false, GeneralMessageSetImpl.oneUid(1l));
+        torqueMailbox.setFlags(f,true,false, GeneralMessageSetImpl.oneUid(1l), MessageResult.NOTHING);
         MessageResult[] messageResults=torqueMailbox.expunge(GeneralMessageSetImpl.all(),MessageResult.UID);
         assertEquals(1,messageResults.length);
         assertEquals(1l,messageResults[0].getUid());

Modified: james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=596767&r1=596766&r2=596767&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Tue Nov 20 10:28:34 2007
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -375,6 +376,10 @@
             messageResult.setFullMessage(createFullContent(messageRow, messageResult.getHeaders()));
             result -= MessageResult.FULL_CONTENT;
         }
+        if ((result & MessageResult.MSN) > 0) {
+            // ATM implemented by wrappers
+            result -= MessageResult.MSN;
+        }
         if (result != 0) {
             throw new RuntimeException("Unsupported result: " + result);
         }
@@ -667,13 +672,13 @@
         }
     }
 
-    public void setFlags(Flags flags, boolean value, boolean replace,
-            GeneralMessageSet set)
+    public Iterator setFlags(Flags flags, boolean value, boolean replace,
+            GeneralMessageSet set, int result)
             throws MailboxManagerException {
         try {
             lock.writeLock().acquire();
             try {
-                doSetFlags(flags, value, replace, set);
+                return doSetFlags(flags, value, replace, set, result);
             } finally {
                 lock.writeLock().release();
             }
@@ -683,11 +688,12 @@
         }
     }
 
-    private void doSetFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set) throws MailboxManagerException {
+    private Iterator doSetFlags(Flags flags, boolean value, boolean replace, 
+            GeneralMessageSet set, int results) throws MailboxManagerException {
         checkAccess();
         set=toUidSet(set);  
         if (!set.isValid() || set.getType()==GeneralMessageSet.TYPE_NOTHING) {
-            return;
+            return Collections.EMPTY_LIST.iterator();
         }        
         try {
             // TODO put this into a serializeable transaction
@@ -717,9 +723,10 @@
                 }
             }
             final MessageResult[] afterResults = fillMessageResult(messageRows,
-                    MessageResult.UID | MessageResult.FLAGS);
+                    results | MessageResult.UID | MessageResult.FLAGS);
             tracker.flagsUpdated(afterResults, sessionId);
             tracker.found(uidRange, afterResults);
+            return Arrays.asList(afterResults).iterator();
         } catch (Exception e) {
             throw new MailboxManagerException(e);
         }
@@ -949,7 +956,7 @@
             lock.writeLock().acquire();
             try {
                 final Flags flags = new Flags(Flags.Flag.DELETED);
-                doSetFlags(flags, true, false, set);
+                doSetFlags(flags, true, false, set, MessageResult.NOTHING);
                 doExpunge(set, MessageResult.NOTHING);
             } finally {
                 lock.writeLock().release();



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message