IMAP: move the handler of UID (E)SEARCH ALL into a single place