61 if (!message_ptr && !thread_ptr)
65 if ((!message_ptr && thread_ptr) || (thread_ptr > message_ptr))
76 const char *variants[6] = {
"&type=threads",
"&type=messages",
77 "type=threads&",
"type=messages&",
78 "type=threads",
"type=messages" };
81 for (
int i = 0; i < variants_size; i++)
207 const short duration,
const short cur_pos,
const char *cur_search,
208 const char *timebase,
const char *or_terms)
212 if (!force_enable && (duration <= 0))
217 int beg = duration * (cur_pos + 1);
218 int end = duration * cur_pos;
222 if ((duration == 0) && (cur_pos != 0))
238 length = snprintf(buf, buflen,
"date:%d%s..", beg, timebase);
242 length = snprintf(buf, buflen,
"date:%d%s..%d%s", beg, timebase, end, timebase);
248 length = snprintf(buf, buflen,
"(%s or (%s))", date_part, or_terms);
253 snprintf(buf + length, buflen - length,
" and %s", cur_search);
#define mutt_array_size(x)
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
const char * mutt_istrn_rfind(const char *haystack, size_t haystack_length, const char *needle)
Find last instance of a substring, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
int mutt_istr_remall(char *str, const char *target)
Remove all occurrences of substring, ignoring case.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
enum NmQueryType nm_string_to_query_type(const char *str)
Lookup a query type.
enum NmQueryType nm_string_to_query_type_mapper(const char *str)
Lookup a query type.
enum NmQueryType nm_parse_type_from_query(char *buf, enum NmQueryType fallback)
Parse a query type out of a query.
bool nm_query_window_check_timebase(const char *timebase)
Checks if a given timebase string is valid.
const char * nm_query_type_to_string(enum NmQueryType query_type)
Turn a query type into a string.
enum NmWindowQueryRc nm_windowed_query_from_query(char *buf, size_t buflen, const bool force_enable, const short duration, const short cur_pos, const char *cur_search, const char *timebase, const char *or_terms)
Windows buf with notmuch date: search term.
NmWindowQueryRc
Return codes for nm_windowed_query_from_query()
@ NM_WINDOW_QUERY_SUCCESS
Query was successful.
@ NM_WINDOW_QUERY_INVALID_DURATION
Invalid duration.
@ NM_WINDOW_QUERY_INVALID_TIMEBASE
Invalid timebase.
NmQueryType
Notmuch Query Types.
@ NM_QUERY_TYPE_UNKNOWN
Unknown query type. Error in notmuch query.
@ NM_QUERY_TYPE_THREADS
Whole threads.
@ NM_QUERY_TYPE_MESGS
Default: Messages only.