IdSet idSet = parser.set( request );
StoreDirective directive = parser.storeDirective( request );
MessageFlags flags = parser.flagList( request );
parser.endLine( request );
ImapMailbox mailbox = session.getSelected();
long[] uids = mailbox.getMessageUids();
for ( int i = 0; i < uids.length; i++ ) {
long uid = uids[i];
int msn = mailbox.getMsn( uid );
if ( ( useUids && idSet.includes( uid ) ) ||
( !useUids && idSet.includes( msn ) ) )
{
SimpleImapMessage imapMessage = mailbox.getMessage( uid );
storeFlags( imapMessage, directive, flags );
mailbox.updateMessage( imapMessage );
if ( ! directive.isSilent() ) {
StringBuffer out = new StringBuffer( "FLAGS " );
out.append( imapMessage.getFlags().format() );
response.fetchResponse( msn, out.toString() );