about summary refs log tree commit homepage
path: root/lib/PublicInbox/IMAPsearchqp.pm
DateCommit message (Collapse)
2020-08-30imapd: filter out unusable flags from search
Quiet down logs from -imapd when clients are blindly sending some unsupported flag conditions (e.g. "DRAFT", "DELETED") specified in RFC 3501.
2020-08-07imap: search support BODY key
This is specified in RFC 3501 but was accidentally omitted :x I probably got it confused with TEXT, so add a comment about TEXT being "everything" in the message.
2020-06-16imap: *SEARCH: reinstate "TEXT" search-key
I accidentally dropped "TEXT" handling while porting the IMAP search query parser to Parse::RecDescent. This reinstates it and adds a test to prevent future regression, and the additional test fixes a counting error for non-Xapian-enabled systems.
2020-06-16imap: *SEARCH: fix CHARSET handling
We no longer pass an arrayref to search_common() or parse_query(), so handle the CHARSET directive in the Parse::RecDescent-generated parser directly.
2020-06-16imap: *SEARCH: use Parse::RecDescent
For properly parsing IMAP search requests, it's easier to use a recursive descent parser generator to deal with subqueries and the "OR" statement. Parse::RecDescent was chosen since it's mature, well-known, widely available and already used by our optional dependencies: Inline::C and Mail::IMAPClient. While it's possible to build Xapian queries without using the Xapian string query parser; this iteration of the IMAP parser still builds a string which is passed to Xapian's query parser for ease-of-diagnostics. Since this is a recursive descent parser dealing with untrusted inputs, subqueries have a nesting limit of 10. I expect that is more than adequate for real-world use.