private void checkOpen() throws MessagingException { if (!isOpen()) { throw new MessagingException("Folder " + getPrefixedName() + " is not open."); } }
@Override public boolean create() throws MessagingException { /* * This method needs to operate in the unselected mode as well as the selected mode * so we must get the connection ourselves if it's not there. We are specifically * not calling checkOpen() since we don't care if the folder is open. */ ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderNameCodec.encode(getPrefixedName()); String escapedFolderName = ImapUtility.encodeString(encodedFolderName); connection.executeSimpleCommand(String.format("CREATE %s", escapedFolderName)); return true; } catch (NegativeImapResponseException e) { return false; } catch (IOException ioe) { throw ioExceptionHandler(this.connection, ioe); } finally { if (this.connection == null) { store.releaseConnection(connection); } } }
String encodedFolderName = folderNameCodec.encode(getPrefixedName()); String escapedFolderName = ImapUtility.encodeString(encodedFolderName); connection.executeSimpleCommand(String.format("STATUS %s (UIDVALIDITY)", escapedFolderName));
String encodedDestinationFolderName = folderNameCodec.encode(imapFolder.getPrefixedName()); String escapedDestinationFolderName = ImapUtility.encodeString(encodedDestinationFolderName);
@Override public void delete(List<? extends Message> messages, String trashFolder) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolder == null || getServerId().equals(trashFolder)) { setFlags(messages, Collections.singleton(Flag.DELETED), true); } else { ImapFolder remoteTrashFolder = getStore().getFolder(trashFolder); String encodedTrashFolderName = folderNameCodec.encode(remoteTrashFolder.getPrefixedName()); String escapedTrashFolderName = ImapUtility.encodeString(encodedTrashFolderName); if (!exists(escapedTrashFolderName)) { if (K9MailLib.isDebug()) { Timber.i("ImapFolder.delete: couldn't find remote trash folder '%s' for %s", trashFolder, getLogId()); } throw new FolderNotFoundException(remoteTrashFolder.getServerId()); } if (K9MailLib.isDebug()) { Timber.d("IMAPMessage.delete: copying remote %d messages to '%s' for %s", messages.size(), trashFolder, getLogId()); } moveMessages(messages, remoteTrashFolder); } }
String encodedFolderName = folderNameCodec.encode(getPrefixedName()); String escapedFolderName = ImapUtility.encodeString(encodedFolderName); String command = String.format("%s %s", openCommand, escapedFolderName);
long messageSize = message.calculateSize(); String encodeFolderName = folderNameCodec.encode(getPrefixedName()); String escapedFolderName = ImapUtility.encodeString(encodeFolderName); String combinedFlags = ImapUtility.combineFlags(message.getFlags(),