long[] ua = getProtocol().fetchSequenceNumbers(start, end);
long[] ua = getProtocol().fetchSequenceNumbers(start, end);
getProtocol().fetchSequenceNumber(uid);
getProtocol().fetchSequenceNumber(uid);
protected synchronized Object doProtocolCommand(ProtocolCommand cmd) throws ProtocolException { /* * Check whether we have a protocol object, not whether we're * opened, to allow use of the exsting protocol object in the * open method before the state is changed to "opened". */ if (protocol != null) { synchronized (messageCacheLock) { return cmd.doCommand(getProtocol()); } } // only get here if using store's connection IMAPProtocol p = null; try { p = getStoreProtocol(); return cmd.doCommand(p); } finally { releaseStoreProtocol(p); } }
protected synchronized Object doProtocolCommand(ProtocolCommand cmd) throws ProtocolException { /* * Check whether we have a protocol object, not whether we're * opened, to allow use of the exsting protocol object in the * open method before the state is changed to "opened". */ if (protocol != null) { synchronized (messageCacheLock) { return cmd.doCommand(getProtocol()); } } // only get here if using store's connection IMAPProtocol p = null; try { p = getStoreProtocol(); return cmd.doCommand(p); } finally { releaseStoreProtocol(p); } }
IMAPProtocol p = getProtocol();
IMAPProtocol p = getProtocol();
/** * Set the specified flags for the given array of messages. */ public synchronized void setFlags(Message[] msgs, Flags flag, boolean value) throws MessagingException { checkOpened(); checkFlags(flag); // validate flags if (msgs.length == 0) // boundary condition return; synchronized(messageCacheLock) { try { IMAPProtocol p = getProtocol(); MessageSet[] ms = Utility.toMessageSetSorted(msgs, null); if (ms == null) throw new MessageRemovedException( "Messages have been removed"); p.storeFlags(ms, flag, value); } catch (ConnectionException cex) { throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } }
/** * Get the deleted message count. */ public synchronized int getDeletedMessageCount() throws MessagingException { if (!opened) { checkExists(); // no way to do this on closed folders return -1; } // if opened, issue server-side search for messages that do // have the DELETED flag. Flags f = new Flags(); f.add(Flags.Flag.DELETED); try { synchronized(messageCacheLock) { int[] matches = getProtocol().search(new FlagTerm(f, true)); return matches.length; // NOTE: 'matches' is never null } } catch (ConnectionException cex) { throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { // Shouldn't happen throw new MessagingException(pex.getMessage(), pex); } }
/** * Set the specified flags for the given array of messages. */ @Override public synchronized void setFlags(Message[] msgs, Flags flag, boolean value) throws MessagingException { checkOpened(); checkFlags(flag); // validate flags if (msgs.length == 0) // boundary condition return; synchronized(messageCacheLock) { try { IMAPProtocol p = getProtocol(); MessageSet[] ms = Utility.toMessageSetSorted(msgs, null); if (ms == null) throw new MessageRemovedException( "Messages have been removed"); p.storeFlags(ms, flag, value); } catch (ConnectionException cex) { throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); } } }
/** * Get the deleted message count. */ @Override public synchronized int getDeletedMessageCount() throws MessagingException { if (!opened) { checkExists(); // no way to do this on closed folders return -1; } // if opened, issue server-side search for messages that do // have the DELETED flag. Flags f = new Flags(); f.add(Flags.Flag.DELETED); try { synchronized(messageCacheLock) { int[] matches = getProtocol().search(new FlagTerm(f, true)); return matches.length; // NOTE: 'matches' is never null } } catch (ConnectionException cex) { throw new FolderClosedException(this, cex.getMessage()); } catch (ProtocolException pex) { // Shouldn't happen throw new MessagingException(pex.getMessage(), pex); } }
IMAPProtocol p = getProtocol(); if (!p.hasCapability("CONDSTORE")) throw new BadCommandException("CONDSTORE not supported");
IMAPProtocol p = getProtocol(); if (!p.hasCapability("CONDSTORE")) throw new BadCommandException("CONDSTORE not supported");
int[] matches = getProtocol().search(term); if (matches != null) matchMsgs = getMessagesBySeqNumbers(matches);
IMAPProtocol p = getProtocol(); MessageSet[] ms = Utility.toMessageSetSorted(msgs, null); if (ms == null)
IMAPProtocol p = getProtocol(); MessageSet[] ms = Utility.toMessageSetSorted(msgs, null); if (ms == null)
int[] matches = getProtocol().sort(term, sterm); if (matches != null) matchMsgs = getMessagesBySeqNumbers(matches);
int[] matches = getProtocol().sort(term, sterm); if (matches != null) matchMsgs = getMessagesBySeqNumbers(matches);
try { synchronized(messageCacheLock) { int[] matches = getProtocol().search(new FlagTerm(f, false)); return matches.length; // NOTE: 'matches' is never null