final MailboxPath existingPath = buildFullPath(session, request.getExistingName());
final MailboxPath newPath = buildFullPath(session, request.getNewName());
try {
final MailboxManager mailboxManager = getMailboxManager();
MailboxSession mailboxsession = ImapSessionUtils.getMailboxSession(session);
mailboxManager.renameMailbox(existingPath, newPath, mailboxsession);
if (existingPath.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME) && mailboxManager.mailboxExists(existingPath, mailboxsession) == false) {
mailboxManager.createMailbox(existingPath, mailboxsession);
}
okComplete(command, tag, responder);