1 /** 2 * @file 3 * Flags to control mutt_expando_format() 4 * 5 * @authors 6 * Copyright (C) 2017 Richard Russon <rich@flatcap.org> 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_FORMAT_FLAGS_H 24 #define MUTT_FORMAT_FLAGS_H 25 26 #include <stddef.h> 27 #include <stdint.h> 28 29 typedef uint8_t MuttFormatFlags; ///< Flags for mutt_expando_format(), e.g. #MUTT_FORMAT_FORCESUBJ 30 #define MUTT_FORMAT_NO_FLAGS 0 ///< No flags are set 31 #define MUTT_FORMAT_FORCESUBJ (1 << 0) ///< Print the subject even if unchanged 32 #define MUTT_FORMAT_TREE (1 << 1) ///< Draw the thread tree 33 #define MUTT_FORMAT_OPTIONAL (1 << 2) ///< Allow optional field processing 34 #define MUTT_FORMAT_STAT_FILE (1 << 3) ///< Used by attach_format_str 35 #define MUTT_FORMAT_ARROWCURSOR (1 << 4) ///< Reserve space for arrow_cursor 36 #define MUTT_FORMAT_INDEX (1 << 5) ///< This is a main index entry 37 #define MUTT_FORMAT_NOFILTER (1 << 6) ///< Do not allow filtering on this pass 38 #define MUTT_FORMAT_PLAIN (1 << 7) ///< Do not prepend DISP_TO, DISP_CC ... 39 40 /** 41 * @defgroup expando_api Expando API 42 * 43 * Prototype for a mutt_expando_format() Callback Function 44 * 45 * @param[out] buf Buffer in which to save string 46 * @param[in] buflen Buffer length 47 * @param[in] col Starting column 48 * @param[in] cols Number of screen columns 49 * @param[in] op printf-like operator, e.g. 't' 50 * @param[in] src printf-like format string 51 * @param[in] prec Field precision, e.g. "-3.4" 52 * @param[in] if_str If condition is met, display this string 53 * @param[in] else_str Otherwise, display this string 54 * @param[in] data Pointer to the mailbox Context 55 * @param[in] flags Flags, see #MuttFormatFlags 56 * @retval ptr src (unchanged) 57 * 58 * Each callback function implements some expandos, e.g. 59 * 60 * | Expando | Description 61 * |:--------|:----------- 62 * | \%t | Title 63 */ 64 typedef const char *(*format_t)(char *buf, size_t buflen, size_t col, int cols, 65 char op, const char *src, const char *prec, 66 const char *if_str, const char *else_str, 67 intptr_t data, MuttFormatFlags flags); 68 69 #endif /* MUTT_FORMAT_FLAGS_H */ 70