NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
quoted.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <stddef.h>
31#include "mutt/lib.h"
32#include "core/lib.h"
33#include "quoted.h"
34#include "color.h"
35#include "module_data.h"
36#include "notify2.h"
37#include "simple2.h"
38
43{
44 if (nc->event_type != NT_COLOR)
45 return 0;
46 if (!nc->event_data)
47 return -1;
48
49 struct EventColor *ev_c = nc->event_data;
50 enum ColorId cid = ev_c->cid;
51
52 if (!COLOR_QUOTED(cid))
53 return 0;
54
56
57 // Find the highest-numbered quotedN in use
58 for (int i = MT_COLOR_QUOTED9; i >= MT_COLOR_QUOTED0; i--)
59 {
61 {
62 mod_data->num_quoted_colors = i - MT_COLOR_QUOTED0 + 1;
63 break;
64 }
65 }
66
67 return 0;
68}
69
77
82{
84 mod_data->num_quoted_colors = 0;
85}
86
95
102{
104 if (mod_data->num_quoted_colors == 0)
105 return NULL;
106
107 // If we have too few colours, cycle around
108 q %= mod_data->num_quoted_colors;
109
111}
112
118{
120 return mod_data->num_quoted_colors;
121}
Color private Module data.
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition notify.c:73
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition notify.c:62
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
Definition simple.c:119
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition simple.c:97
Color and attribute parsing.
ColorId
List of all coloured objects.
Definition color.h:35
@ MT_COLOR_QUOTED0
Pager: quoted text, level 0.
Definition color.h:57
@ MT_COLOR_QUOTED9
Pager: quoted text, level 9.
Definition color.h:66
Convenience wrapper for the core headers.
static int quoted_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition quoted.c:42
@ MODULE_ID_COLOR
ModuleColor, Color
Definition module_api.h:53
Convenience wrapper for the library headers.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:665
Colour notifications.
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition notify_type.h:41
struct AttrColor * quoted_colors_get(int q)
Return the color of a quote, cycling through the used quotes.
Definition quoted.c:101
int quoted_colors_num_used(void)
Return the number of used quotes.
Definition quoted.c:117
void quoted_colors_init(void)
Initialise the Quoted colours.
Definition quoted.c:73
void quoted_colors_reset(void)
Reset the quoted-email colours.
Definition quoted.c:81
void quoted_colors_cleanup(void)
Cleanup the quoted-email colours.
Definition quoted.c:90
Quoted-Email colours.
#define COLOR_QUOTED(cid)
Definition quoted.h:28
Simple colour.
A curses colour and its attributes.
Definition attr.h:65
Color private Module data.
Definition module_data.h:35
int num_quoted_colors
Number of colours for quoted email text.
Definition module_data.h:41
An Event that happened to a Colour.
Definition notify2.h:52
enum ColorId cid
Colour ID that has changed.
Definition notify2.h:53
Container for Accounts, Notifications.
Definition neomutt.h:41
Data passed to a notification function.
Definition observer.h:34
void * event_data
Data from notify_send()
Definition observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition observer.h:36