1 /** 2 * @file 3 * Notmuch query functions 4 * 5 * @authors 6 * Copyright (C) 2021 Austin Ray <austin@austinray.io> 7 * 8 * @copyright 9 * This program is free software: you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License as published by the Free Software 11 * Foundation, either version 2 of the License, or (at your option) any later 12 * version. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef MUTT_NOTMUCH_QUERY_H 24 #define MUTT_NOTMUCH_QUERY_H 25 26 #include <stddef.h> 27 #include <stdbool.h> 28 29 /** 30 * enum NmQueryType - Notmuch Query Types 31 * 32 * Read whole-thread or matching messages only? 33 */ 34 enum NmQueryType 35 { 36 NM_QUERY_TYPE_MESGS = 1, ///< Default: Messages only 37 NM_QUERY_TYPE_THREADS, ///< Whole threads 38 NM_QUERY_TYPE_UNKNOWN, ///< Unknown query type. Error in notmuch query. 39 }; 40 41 /** 42 * enum NmWindowQueryRc - Return codes for nm_windowed_query_from_query() 43 */ 44 enum NmWindowQueryRc 45 { 46 NM_WINDOW_QUERY_SUCCESS = 1, ///< Query was successful 47 NM_WINDOW_QUERY_INVALID_TIMEBASE, ///< Invalid timebase 48 NM_WINDOW_QUERY_INVALID_DURATION ///< Invalid duration 49 }; 50 51 enum NmQueryType nm_parse_type_from_query(char *buf); 52 enum NmQueryType nm_string_to_query_type(const char *str); 53 enum NmQueryType nm_string_to_query_type_mapper(const char *str); 54 const char *nm_query_type_to_string(enum NmQueryType query_type); 55 enum NmWindowQueryRc 56 nm_windowed_query_from_query(char *buf, size_t buflen, const bool force_enable, 57 const short duration, const short current_pos, 58 const char *current_search, const char *timebase, 59 const char *or_terms); 60 bool nm_query_window_check_timebase(const char *timebase); 61 62 #endif /* MUTT_NOTMUCH_QUERY_H */ 63