NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
command2.h File Reference

Parse colour commands. More...

#include "config.h"
#include <stdint.h>
#include "core/lib.h"
#include "mutt/lib.h"
+ Include dependency graph for command2.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum CommandResult(* parser_callback_t) (struct Buffer *buf, struct Buffer *s, struct AttrColor *ac, struct Buffer *err)
 

Functions

enum CommandResult mutt_parse_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'color' command - Implements Command::parse() -.
 
enum CommandResult mutt_parse_mono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'mono' command - Implements Command::parse() -.
 
enum CommandResult mutt_parse_uncolor (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'uncolor' command - Implements Command::parse() -.
 
enum CommandResult mutt_parse_unmono (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unmono' command - Implements Command::parse() -.
 
void get_colorid_name (unsigned int color_id, struct Buffer *buf)
 Get the name of a color id.
 

Detailed Description

Parse colour commands.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file command2.h.

Typedef Documentation

◆ parser_callback_t

typedef enum CommandResult(* parser_callback_t) (struct Buffer *buf, struct Buffer *s, struct AttrColor *ac, struct Buffer *err)

Definition at line 1 of file command2.h.

Function Documentation

◆ get_colorid_name()

void get_colorid_name ( unsigned int  cid,
struct Buffer buf 
)

Get the name of a color id.

Parameters
cidColour, e.g. MT_COLOR_HEADER
bufBuffer for result

Definition at line 128 of file command.c.

129{
130 const char *name = NULL;
131
133 {
135 if (name)
136 {
137 buf_printf(buf, "compose %s", name);
138 return;
139 }
140 }
141
142 name = mutt_map_get_name(cid, ColorFields);
143 if (name)
144 buf_addstr(buf, name);
145 else
146 buf_printf(buf, "UNKNOWN %d", cid);
147}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:161
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:226
const struct Mapping ComposeColorFields[]
Mapping of compose colour names to their IDs.
Definition: command.c:112
const struct Mapping ColorFields[]
Mapping of colour names to their IDs.
Definition: command.c:56
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:46
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:42
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function: