* mu-str.[ch]: add mu_str_ascii_xapian_escape_in_place, for escaping some

Xapian fields; also add some tests
This commit is contained in:
Dirk-Jan C. Binnema
2010-11-29 21:21:55 +02:00
parent c6dadad978
commit bb5b1304e5
3 changed files with 180 additions and 4 deletions

View File

@ -138,7 +138,7 @@ char* mu_str_summarize (const char* str,
* 'Latin-1 Supplement' and 'Latin Extended-A'
*
* @param str a valid utf8 string or NULL
* @param downcase if TRUE, convert the string to lowercase
* @param downcase if TRUE, convert the string to lowercase
*
* @return the normalize string, or NULL in case of error or str was NULL
*/
@ -153,12 +153,29 @@ char* mu_str_normalize (const char *str, gboolean downcase);
*
* @param str a valid utf8 string or NULL
* @param downcase if TRUE, convert the string to lowercase
*
* @return the normalize string, or NULL in case of error or str was NULL
*
* @return the normalized string, or NULL in case of error or str was
* NULL
*/
char* mu_str_normalize_in_place (char *str, gboolean downcase);
/**
* escape the string for use with xapian matching. in practice, if the
* string contains an '@', replace '@', single-'.' with '_'. Also,
* replace ':' with '_', if it's not following a xapian-prefix (such
* as 'subject:', 't:' etc, as defined in mu-msg-fields.[ch]).
* changing is done in-place (by changing the argument string). in
* any, case, the string will be downcased.
*
* works for ascii strings, like e-mail addresses and message-id.
*
* @param query a query string
*
* @return the escaped string or NULL in case of error
*/
char* mu_str_ascii_xapian_escape_in_place (char *query);
/**
*
* parse strings like 1h, 3w, 2m to mean '1 hour before now', '3 weeks