NeoMutt  2023-03-22-27-g3cb248
Teaching an old dog new tricks
DOXYGEN
Observer API

Prototype for a notification callback function. More...

Functions

static int alias_alias_observer (struct NotifyCallback *nc)
 Notification that an Alias has changed - Implements observer_t -. More...
 
static int alias_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int query_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int attach_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int attach_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int autocrypt_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int autocrypt_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int browser_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int browser_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int attach_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -. More...
 
int cbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
int cbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int cbar_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -. More...
 
static int cbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int compose_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int compose_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -. More...
 
static int compose_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int env_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int env_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int env_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -. More...
 
static int env_header_observer (struct NotifyCallback *nc)
 Notification that a User Header has changed - Implements observer_t -. More...
 
static int env_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int alldialogs_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int msgwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int rootwin_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int rootwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int helpbar_binding_observer (struct NotifyCallback *nc)
 Notification that a Key Binding has changed - Implements observer_t -. More...
 
static int helpbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int helpbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int helpbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int ibar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int ibar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ibar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int ibar_menu_observer (struct NotifyCallback *nc)
 Notification that a Menu has changed - Implements observer_t -. More...
 
static int ibar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_altern_observer (struct NotifyCallback *nc)
 Notification that an 'alternates' command has occurred - Implements observer_t -. More...
 
static int index_attach_observer (struct NotifyCallback *nc)
 Notification that an 'attachments' command has occurred - Implements observer_t -. More...
 
static int index_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int index_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int index_global_observer (struct NotifyCallback *nc)
 Notification that a Global event occurred - Implements observer_t -. More...
 
static int index_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int index_menu_observer (struct NotifyCallback *nc)
 Notification that the Menu has changed - Implements observer_t -. More...
 
static int index_score_observer (struct NotifyCallback *nc)
 Notification that a 'score' command has occurred - Implements observer_t -. More...
 
static int index_subjrx_observer (struct NotifyCallback *nc)
 Notification that a 'subjectrx' command has occurred - Implements observer_t -. More...
 
static int index_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int ipanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ipanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_shared_context_observer (struct NotifyCallback *nc)
 Notification that the MailboxView has changed - Implements observer_t -. More...
 
static int index_shared_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -. More...
 
static int index_shared_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int index_shared_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -. More...
 
int main_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int remailer_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int remailer_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
int mview_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int dopager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int dopager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pager_global_observer (struct NotifyCallback *nc)
 Notification that a Global Event occurred - Implements observer_t -. More...
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -. More...
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int pbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pbar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int pbar_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -. More...
 
static int pbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int ppanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ppanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pattern_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pattern_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int postponed_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int postponed_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int sb_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -. More...
 
static int sb_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int sb_command_observer (struct NotifyCallback *nc)
 Notification that a Command has occurred - Implements observer_t -. More...
 
static int sb_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int sb_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int sb_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int sb_insertion_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 

Detailed Description

Prototype for a notification callback function.

Parameters
[in]ncCallback data
Return values
0Success
-1Error
Precondition
nc is not NULL
nc->current is not NULL

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 203 of file dlg_alias.c.

204{
205 if (nc->event_type != NT_ALIAS)
206 return 0;
207 if (!nc->global_data || !nc->event_data)
208 return -1;
209
210 struct EventAlias *ev_a = nc->event_data;
211 struct Menu *menu = nc->global_data;
212 struct AliasMenuData *mdata = menu->mdata;
213 struct Alias *alias = ev_a->alias;
214
215 if (nc->event_subtype == NT_ALIAS_ADD)
216 {
217 alias_array_alias_add(&mdata->ava, alias);
218
219 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
220 {
221 mutt_pattern_alias_func(NULL, mdata, menu);
222 }
223 }
224 else if (nc->event_subtype == NT_ALIAS_DELETE)
225 {
226 alias_array_alias_delete(&mdata->ava, alias);
227
228 int vcount = alias_array_count_visible(&mdata->ava);
229 int index = menu_get_index(menu);
230 if ((index > (vcount - 1)) && (index > 0))
231 menu_set_index(menu, index - 1);
232 }
233
234 alias_array_sort(&mdata->ava, mdata->sub);
235
236 menu->max = alias_array_count_visible(&mdata->ava);
238 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
239
240 return 0;
241}
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:156
@ NT_ALIAS_ADD
Alias has been added.
Definition: alias.h:54
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:55
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition: array.c:95
int alias_array_alias_delete(struct AliasViewArray *ava, const struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition: array.c:73
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition: array.c:47
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:86
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:60
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:178
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:154
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:168
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:37
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition: pattern.c:244
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:53
struct Menu * menu
Menu.
Definition: gui.h:56
struct ConfigSubset * sub
Config items.
Definition: gui.h:55
A shortcut for an email address or addresses.
Definition: alias.h:34
An alias-change event.
Definition: alias.h:64
struct Alias * alias
Alias that changed.
Definition: alias.h:65
Definition: lib.h:70
void * mdata
Private data.
Definition: lib.h:138
int max
Number of entries in the menu.
Definition: lib.h:72
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
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:37
void * global_data
Data from notify_observer_add()
Definition: observer.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_window_observer()

static int alias_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 250 of file dlg_alias.c.

251{
252 if (nc->event_type != NT_WINDOW)
253 return 0;
254 if (!nc->global_data || !nc->event_data)
255 return -1;
257 return 0;
258
259 struct MuttWindow *win_menu = nc->global_data;
260 struct EventWindow *ev_w = nc->event_data;
261 if (ev_w->win != win_menu)
262 return 0;
263
264 struct Menu *menu = win_menu->wdata;
265
269
270 mutt_debug(LL_DEBUG5, "window delete done\n");
271 return 0;
272}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:250
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:203
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: gui.c:43
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition: notify.c:228
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:205
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
An Event that happened to a Window.
Definition: mutt_window.h:215
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:216
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_window_observer()

static int query_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 323 of file dlg_query.c.

324{
325 if (nc->event_type != NT_WINDOW)
326 return 0;
327 if (!nc->global_data || !nc->event_data)
328 return -1;
330 return 0;
331
332 struct MuttWindow *win_menu = nc->global_data;
333 struct EventWindow *ev_w = nc->event_data;
334 if (ev_w->win != win_menu)
335 return 0;
336
337 struct Menu *menu = win_menu->wdata;
338
341
342 mutt_debug(LL_DEBUG5, "window delete done\n");
343 return 0;
344}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:323
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_config_observer()

int alias_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_alias.

Definition at line 43 of file gui.c.

44{
45 if (nc->event_type != NT_CONFIG)
46 return 0;
47 if (!nc->global_data || !nc->event_data)
48 return -1;
49
50 struct EventConfig *ev_c = nc->event_data;
51
52 if (!mutt_str_equal(ev_c->name, "sort_alias"))
53 return 0;
54
55 struct Menu *menu = nc->global_data;
56
58 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
59
60 return 0;
61}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
A config-change event.
Definition: subset.h:70
const char * name
Name of config item that changed.
Definition: subset.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_attach.

Definition at line 110 of file dlg_attach.c.

111{
112 if (nc->event_type != NT_CONFIG)
113 return 0;
114 if (!nc->global_data || !nc->event_data)
115 return -1;
116
117 struct EventConfig *ev_c = nc->event_data;
118
119 if (!mutt_str_equal(ev_c->name, "attach_format") && !mutt_str_equal(ev_c->name, "message_format"))
120 return 0;
121
122 struct Menu *menu = nc->global_data;
124 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
125
126 return 0;
127}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_window_observer()

static int attach_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 431 of file dlg_attach.c.

432{
433 if (nc->event_type != NT_WINDOW)
434 return 0;
435 if (!nc->global_data || !nc->event_data)
436 return -1;
438 return 0;
439
440 struct MuttWindow *win_menu = nc->global_data;
441 struct EventWindow *ev_w = nc->event_data;
442 if (ev_w->win != win_menu)
443 return 0;
444
445 struct Menu *menu = win_menu->wdata;
446
449
450 mutt_debug(LL_DEBUG5, "window delete done\n");
451 return 0;
452}
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_attach.c:110
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_attach.c:431
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_config_observer()

static int autocrypt_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_autocrypt.

Definition at line 254 of file dlg_autocrypt.c.

255{
256 if (nc->event_type != NT_CONFIG)
257 return 0;
258 if (!nc->global_data || !nc->event_data)
259 return -1;
260
261 struct EventConfig *ev_c = nc->event_data;
262
263 if (!mutt_str_equal(ev_c->name, "autocrypt_acct_format"))
264 return 0;
265
266 struct Menu *menu = nc->global_data;
268 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
269
270 return 0;
271}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_window_observer()

static int autocrypt_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 280 of file dlg_autocrypt.c.

281{
282 if (nc->event_type != NT_WINDOW)
283 return 0;
284 if (!nc->global_data || !nc->event_data)
285 return -1;
287 return 0;
288
289 struct MuttWindow *win_menu = nc->global_data;
290 struct EventWindow *ev_w = nc->event_data;
291 if (ev_w->win != win_menu)
292 return 0;
293
294 struct Menu *menu = win_menu->wdata;
295
298
299 mutt_debug(LL_DEBUG5, "window delete done\n");
300 return 0;
301}
static int autocrypt_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int autocrypt_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_config_observer()

static int browser_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 1066 of file browser.c.

1067{
1068 if (nc->event_type != NT_CONFIG)
1069 return 0;
1070 if (!nc->global_data || !nc->event_data)
1071 return -1;
1072
1073 struct EventConfig *ev_c = nc->event_data;
1074
1075 if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1076 !mutt_str_equal(ev_c->name, "date_format") && !mutt_str_equal(ev_c->name, "folder") &&
1077 !mutt_str_equal(ev_c->name, "folder_format") &&
1078 !mutt_str_equal(ev_c->name, "group_index_format") &&
1079 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1080 !mutt_str_equal(ev_c->name, "sort_browser"))
1081 {
1082 return 0;
1083 }
1084
1085 struct Menu *menu = nc->global_data;
1087 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1088
1089 return 0;
1090}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_window_observer()

static int browser_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 1099 of file browser.c.

1100{
1101 if (nc->event_type != NT_WINDOW)
1102 return 0;
1103 if (!nc->global_data || !nc->event_data)
1104 return -1;
1106 return 0;
1107
1108 struct MuttWindow *win_menu = nc->global_data;
1109 struct EventWindow *ev_w = nc->event_data;
1110 if (ev_w->win != win_menu)
1111 return 0;
1112
1113 struct Menu *menu = win_menu->wdata;
1114
1117
1118 mutt_debug(LL_DEBUG5, "window delete done\n");
1119 return 0;
1120}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: browser.c:1066
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: browser.c:1099
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_email_observer()

static int attach_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 127 of file attach.c.

128{
129 if (nc->event_type != NT_EMAIL)
130 return 0;
131 if (!nc->global_data)
132 return -1;
134 return 0;
135
136 struct MuttWindow *win_attach = nc->global_data;
137
138 win_attach->actions |= WA_RECALC;
139 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
140
141 return 0;
142}
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:152
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
+ Here is the caller graph for this function:

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback nc)

Notification that a Color has changed - Implements observer_t -.

Definition at line 204 of file cbar.c.

205{
206 if (nc->event_type != NT_COLOR)
207 return 0;
208 if (!nc->global_data || !nc->event_data)
209 return -1;
210
211 struct EventColor *ev_c = nc->event_data;
212
213 // MT_COLOR_MAX is sent on `uncolor *`
214 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
215 (ev_c->cid != MT_COLOR_MAX))
216 {
217 return 0;
218 }
219
220 struct MuttWindow *win_cbar = nc->global_data;
221 win_cbar->actions |= WA_REPAINT;
222 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
223
224 return 0;
225}
@ MT_COLOR_MAX
Definition: color.h:92
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:75
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:57
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
An Event that happened to a Colour.
Definition: notify2.h:53
enum ColorId cid
Colour ID that has changed.
Definition: notify2.h:54
+ Here is the caller graph for this function:

◆ cbar_config_observer()

int cbar_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 230 of file cbar.c.

231{
232 if (nc->event_type != NT_CONFIG)
233 return 0;
234 if (!nc->global_data || !nc->event_data)
235 return -1;
236
237 struct EventConfig *ev_c = nc->event_data;
238 if (!mutt_str_equal(ev_c->name, "compose_format"))
239 return 0;
240
241 struct MuttWindow *win_cbar = nc->global_data;
242 win_cbar->actions |= WA_RECALC;
243 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
244
245 return 0;
246}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cbar_email_observer()

static int cbar_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 251 of file cbar.c.

252{
253 if (nc->event_type != NT_EMAIL)
254 return 0;
255 if (!nc->global_data || !nc->event_data)
256 return -1;
257
258 struct MuttWindow *win_cbar = nc->global_data;
259 win_cbar->actions |= WA_RECALC;
260 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
261
262 return 0;
263}
+ Here is the caller graph for this function:

◆ cbar_window_observer()

static int cbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 268 of file cbar.c.

269{
270 if (nc->event_type != NT_WINDOW)
271 return 0;
272 if (!nc->global_data || !nc->event_data)
273 return -1;
274
275 struct MuttWindow *win_cbar = nc->global_data;
276 struct EventWindow *ev_w = nc->event_data;
277 if (ev_w->win != win_cbar)
278 return 0;
279
281 {
282 win_cbar->actions |= WA_RECALC;
283 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
284 }
285 else if (nc->event_subtype == NT_WINDOW_DELETE)
286 {
287 struct MuttWindow *dlg = win_cbar->parent;
288 struct ComposeSharedData *shared = dlg->wdata;
289
294
295 mutt_debug(LL_DEBUG5, "window delete done\n");
296 }
297
298 return 0;
299}
int cbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: cbar.c:204
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: cbar.c:230
static int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: cbar.c:268
static int cbar_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: cbar.c:251
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:206
Shared Compose Data.
Definition: shared_data.h:33
struct Email * email
Email being composed.
Definition: shared_data.h:36
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:71
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_config_observer()

static int compose_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 130 of file compose.c.

131{
132 if (nc->event_type != NT_CONFIG)
133 return 0;
134 if (!nc->global_data || !nc->event_data)
135 return -1;
136
137 struct EventConfig *ev_c = nc->event_data;
138 struct MuttWindow *dlg = nc->global_data;
139
140 if (!mutt_str_equal(ev_c->name, "status_on_top"))
141 return 0;
142
144 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
145 return 0;
146}
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:760
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_email_observer()

static int compose_email_observer ( struct NotifyCallback nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 151 of file compose.c.

152{
153 if (nc->event_type != NT_ENVELOPE)
154 return 0;
155 if (!nc->global_data || !nc->event_data)
156 return -1;
157
158 struct ComposeSharedData *shared = nc->global_data;
159
161 shared->fcc_set = true;
162
164 return 0;
165}
@ NT_ENVELOPE_FCC
"Fcc:" header has changed
Definition: envelope.h:107
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:656
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:49
@ NT_ENVELOPE
Envelope has changed, NotifyEnvelope.
Definition: notify_type.h:45
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:35
bool fcc_set
User has edited the Fcc: field.
Definition: shared_data.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_window_observer()

static int compose_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 170 of file compose.c.

171{
172 if (nc->event_type != NT_WINDOW)
173 return 0;
174 if (!nc->global_data || !nc->event_data)
175 return -1;
177 return 0;
178
179 struct MuttWindow *dlg = nc->global_data;
180 struct EventWindow *ev_w = nc->event_data;
181 if (ev_w->win != dlg)
182 return 0;
183
186 mutt_debug(LL_DEBUG5, "window delete done\n");
187
188 return 0;
189}
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: compose.c:130
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: compose.c:170
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_color_observer()

static int env_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 802 of file window.c.

803{
804 if (nc->event_type != NT_COLOR)
805 return 0;
806 if (!nc->global_data || !nc->event_data)
807 return -1;
808
809 struct EventColor *ev_c = nc->event_data;
810 struct MuttWindow *win_env = nc->global_data;
811
812 enum ColorId cid = ev_c->cid;
813
814 switch (cid)
815 {
816 case MT_COLOR_BOLD:
822 case MT_COLOR_NORMAL:
823 case MT_COLOR_STATUS:
824 case MT_COLOR_MAX: // Sent on `uncolor *`
825 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
826 win_env->actions |= WA_REPAINT;
827 break;
828
829 default:
830 break;
831 }
832 return 0;
833}
ColorId
List of all colored objects.
Definition: color.h:38
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:46
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:47
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:43
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:45
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:48
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:44
+ Here is the caller graph for this function:

◆ env_config_observer()

static int env_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 838 of file window.c.

839{
840 if (nc->event_type != NT_CONFIG)
841 return 0;
842 if (!nc->global_data || !nc->event_data)
843 return -1;
844
845 struct EventConfig *ev_c = nc->event_data;
846 struct MuttWindow *win_env = nc->global_data;
847
848 switch (ev_c->name[0])
849 {
850 case 'a':
851 if (mutt_str_equal(ev_c->name, "autocrypt"))
852 break;
853 return 0;
854 case 'c':
855 if (mutt_str_equal(ev_c->name, "compose_show_user_headers") ||
856 mutt_str_equal(ev_c->name, "crypt_opportunistic_encrypt"))
857 {
858 break;
859 }
860 return 0;
861 case 'p':
862 if (mutt_str_equal(ev_c->name, "pgp_sign_as"))
863 break;
864 return 0;
865 case 's':
866 if (mutt_str_equal(ev_c->name, "smime_encrypt_with") ||
867 mutt_str_equal(ev_c->name, "smime_sign_as"))
868 {
869 break;
870 }
871 return 0;
872 case 'x':
873 if (mutt_str_equal(ev_c->name, "x_comment_to"))
874 break;
875 return 0;
876 default:
877 return 0;
878 }
879
880 win_env->actions |= WA_RECALC;
881 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
882 return 0;
883}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_email_observer()

static int env_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 888 of file window.c.

889{
890 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
891 return 0;
892 if (!nc->global_data)
893 return -1;
894
895 struct MuttWindow *win_env = nc->global_data;
896
897 // pgp/smime/autocrypt menu, or external change
898 if (nc->event_type == NT_EMAIL)
899 {
900 struct EnvelopeWindowData *wdata = win_env->wdata;
901 update_crypt_info(wdata);
902 }
903
904 win_env->actions |= WA_RECALC;
905 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
906 return 0;
907}
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition: functions.c:146
Data to fill the Envelope Window.
Definition: wdata.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_header_observer()

static int env_header_observer ( struct NotifyCallback nc)
static

Notification that a User Header has changed - Implements observer_t -.

Definition at line 912 of file window.c.

913{
914 if (nc->event_type != NT_HEADER)
915 return 0;
916 if (!nc->global_data || !nc->event_data)
917 return -1;
918
919 const struct EventHeader *ev_h = nc->event_data;
920 struct MuttWindow *win_env = nc->global_data;
921 struct EnvelopeWindowData *wdata = win_env->wdata;
922
923 struct Envelope *env = wdata->email->env;
924
926 {
927 header_set(&env->userhdrs, ev_h->header);
928 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
929 win_env->actions |= WA_RECALC;
930 return 0;
931 }
932
934 {
935 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
936 if (removed)
937 {
938 header_free(&env->userhdrs, removed);
939 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
940 win_env->actions |= WA_RECALC;
941 }
942 return 0;
943 }
944
945 return 0;
946}
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:245
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:233
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:180
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:174
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:172
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:173
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:47
struct Envelope * env
Envelope information.
Definition: email.h:66
struct Email * email
Email being composed.
Definition: wdata.h:40
The header of an Email.
Definition: envelope.h:57
struct ListHead userhdrs
user defined headers
Definition: envelope.h:87
An event that happened to a header.
Definition: email.h:181
char * header
The contents of the header.
Definition: email.h:182
A List node for strings.
Definition: list.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_window_observer()

static int env_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 951 of file window.c.

952{
953 if (nc->event_type != NT_WINDOW)
954 return 0;
955 if (!nc->global_data || !nc->event_data)
956 return -1;
957
958 struct MuttWindow *win_env = nc->global_data;
959 struct EventWindow *ev_w = nc->event_data;
960 if (ev_w->win != win_env)
961 return 0;
962
964 {
965 win_env->actions |= WA_RECALC;
966 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
967 }
968 else if (nc->event_subtype == NT_WINDOW_DELETE)
969 {
970 struct EnvelopeWindowData *wdata = win_env->wdata;
971
977 mutt_debug(LL_DEBUG5, "window delete done\n");
978 }
979
980 return 0;
981}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:888
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:802
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:951
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:838
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:912
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alldialogs_window_observer()

static int alldialogs_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the All Dialogs window

Definition at line 179 of file dialog.c.

180{
181 if (nc->event_type != NT_WINDOW)
182 return 0;
183 if (!nc->global_data || !nc->event_data)
184 return -1;
186 return 0;
187
188 struct MuttWindow *win_alldlgs = nc->global_data;
189 struct EventWindow *ev_w = nc->event_data;
190 if (ev_w->win != win_alldlgs)
191 return 0;
192
193 notify_observer_remove(win_alldlgs->notify, alldialogs_window_observer, win_alldlgs);
194
195 AllDialogsWindow = NULL;
196 mutt_debug(LL_DEBUG5, "window delete done\n");
197 return 0;
198}
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:74
static int alldialogs_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dialog.c:179
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_window_observer()

static int msgwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • State (this window): refresh the window
  • Delete (this window): clean up the resources held by the Message Window

Definition at line 142 of file msgwin.c.

143{
144 if (nc->event_type != NT_WINDOW)
145 return 0;
146 if (!nc->global_data || !nc->event_data)
147 return -1;
148
149 struct MuttWindow *win_msg = nc->global_data;
150 struct EventWindow *ev_w = nc->event_data;
151 if (ev_w->win != win_msg)
152 return 0;
153
155 {
156 win_msg->actions |= WA_RECALC;
157 mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
158 }
159 else if (nc->event_subtype == NT_WINDOW_DELETE)
160 {
162 MessageWindow = NULL;
163 mutt_debug(LL_DEBUG5, "window delete done\n");
164 }
165 return 0;
166}
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: msgwin.c:142
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
static struct MuttWindow * MessageWindow
Message Window for messages, warnings, errors etc.
Definition: msgwin.c:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_config_observer()

static int rootwin_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Root Window is affected by changes to $status_on_top.

Definition at line 111 of file rootwin.c.

112{
113 if (nc->event_type != NT_CONFIG)
114 return 0;
115 if (!nc->global_data || !nc->event_data)
116 return -1;
117
118 struct EventConfig *ev_c = nc->event_data;
119 struct MuttWindow *win_root = nc->global_data;
120
121 if (!mutt_str_equal(ev_c->name, "status_on_top"))
122 return 0;
123
124 struct MuttWindow *first = TAILQ_FIRST(&win_root->children);
125 if (!first)
126 return 0;
127
128 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
129 if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
130 (!c_status_on_top && (first->type != WT_HELP_BAR)))
131 {
132 // Swap the HelpBar and the AllDialogsWindow
133 struct MuttWindow *next = TAILQ_NEXT(first, entries);
134 if (!next)
135 return 0;
136 TAILQ_REMOVE(&win_root->children, next, entries);
137 TAILQ_INSERT_HEAD(&win_root->children, next, entries);
138
139 mutt_window_reflow(win_root);
140 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
141 }
142
143 return 0;
144}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:341
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:96
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
#define TAILQ_NEXT(elm, field)
Definition: queue.h:832
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:796
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Root Window

Definition at line 153 of file rootwin.c.

154{
155 if (nc->event_type != NT_WINDOW)
156 return 0;
157 if (!nc->global_data || !nc->event_data)
158 return -1;
160 return 0;
161
162 struct MuttWindow *win_root = nc->global_data;
163 struct EventWindow *ev_w = nc->event_data;
164 if (ev_w->win != win_root)
165 return 0;
166
168 if (NeoMutt)
170
171 mutt_debug(LL_DEBUG5, "window delete done\n");
172 return 0;
173}
static int rootwin_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: rootwin.c:111
static int rootwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: rootwin.c:153
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sbar_color_observer()

static int sbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

This function is triggered by changes to the colour settings, from the color or uncolor, mono or unmono commands.

Definition at line 114 of file sbar.c.

115{
116 if (nc->event_type != NT_COLOR)
117 return 0;
118 if (!nc->global_data)
119 return -1;
120
121 struct EventColor *ev_c = nc->event_data;
122
123 // MT_COLOR_MAX is sent on `uncolor *`
124 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
125 (ev_c->cid != MT_COLOR_MAX))
126 {
127 return 0;
128 }
129
130 struct MuttWindow *win_sbar = nc->global_data;
131
132 win_sbar->actions |= WA_REPAINT;
133 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
134
135 return 0;
136}
+ Here is the caller graph for this function:

◆ sbar_window_observer()

static int sbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • State (this window): refresh the window
  • Delete (this window): clean up the resources held by the Simple Bar

Definition at line 146 of file sbar.c.

147{
148 if (nc->event_type != NT_WINDOW)
149 return 0;
150 if (!nc->global_data || !nc->event_data)
151 return -1;
152
153 struct MuttWindow *win_sbar = nc->global_data;
154 struct EventWindow *ev_w = nc->event_data;
155 if (ev_w->win != win_sbar)
156 return 0;
157
159 {
160 win_sbar->actions |= WA_REPAINT;
161 mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
162 }
163 else if (nc->event_subtype == NT_WINDOW_DELETE)
164 {
167 mutt_debug(LL_DEBUG5, "window delete done\n");
168 }
169
170 return 0;
171}
static int sbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: sbar.c:114
static int sbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: sbar.c:146
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_config_observer()

static int simple_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Simple Dialog is affected by changes to $status_on_top.

Definition at line 77 of file simple.c.

78{
79 if (nc->event_type != NT_CONFIG)
80 return 0;
81 if (!nc->global_data || !nc->event_data)
82 return -1;
83
84 struct EventConfig *ev_c = nc->event_data;
85 if (!mutt_str_equal(ev_c->name, "status_on_top"))
86 return 0;
87
88 struct MuttWindow *dlg = nc->global_data;
90 mutt_debug(LL_DEBUG5, "config done\n");
91 return 0;
92}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_window_observer()

static int simple_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Simple Dialog

Definition at line 101 of file simple.c.

102{
103 if (nc->event_type != NT_WINDOW)
104 return 0;
105 if (!nc->global_data || !nc->event_data)
106 return -1;
108 return 0;
109
110 struct MuttWindow *dlg = nc->global_data;
111 struct EventWindow *ev_w = nc->event_data;
112 if (ev_w->win != dlg)
113 return 0;
114
117
118 mutt_debug(LL_DEBUG5, "window delete done\n");
119 return 0;
120}
static int simple_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: simple.c:77
static int simple_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: simple.c:101
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_binding_observer()

static int helpbar_binding_observer ( struct NotifyCallback nc)
static

Notification that a Key Binding has changed - Implements observer_t -.

This function is triggered by changes to the key bindings, from either of the bind or macro commands.

Definition at line 200 of file helpbar.c.

201{
202 if (nc->event_type != NT_BINDING)
203 return 0;
204 if (!nc->global_data || !nc->event_data)
205 return -1;
206 if (nc->event_subtype >= NT_MACRO_ADD)
207 return 0;
208
209 struct MuttWindow *win_helpbar = nc->global_data;
210 struct HelpbarWindowData *wdata = helpbar_wdata_get(win_helpbar);
211 if (!wdata)
212 return 0;
213
214 struct EventBinding *ev_b = nc->event_data;
215 if (wdata->help_menu != ev_b->menu)
216 return 0;
217
218 win_helpbar->actions |= WA_RECALC;
219 mutt_debug(LL_DEBUG5, "binding done, request WA_RECALC\n");
220 return 0;
221}
struct HelpbarWindowData * helpbar_wdata_get(struct MuttWindow *win)
Get the Helpbar data for this window.
Definition: wdata.c:61
@ NT_MACRO_ADD
Key macro has been added.
Definition: keymap.h:129
@ NT_BINDING
Key binding has changed, NotifyBinding, EventBinding.
Definition: notify_type.h:40
A key binding Event.
Definition: keymap.h:110
enum MenuType menu
Menu, e.g. MENU_PAGER.
Definition: keymap.h:111
Help Bar Window data -.
Definition: private.h:34
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: private.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_color_observer()

static int helpbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

This function is triggered by changes to the colour settings, from the color or uncolor, mono or unmono commands.

Definition at line 229 of file helpbar.c.

230{
231 if (nc->event_type != NT_COLOR)
232 return 0;
233 if (!nc->global_data || !nc->event_data)
234 return -1;
235
236 struct EventColor *ev_c = nc->event_data;
237
238 // MT_COLOR_MAX is sent on `uncolor *`
239 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
240 (ev_c->cid != MT_COLOR_MAX))
241 {
242 return 0;
243 }
244
245 struct MuttWindow *win_helpbar = nc->global_data;
246
247 win_helpbar->actions |= WA_REPAINT;
248 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
249 return 0;
250}
+ Here is the caller graph for this function:

◆ helpbar_config_observer()

static int helpbar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

This function is triggered by changes to the config by the set, unset, reset, toggle, etc commands.

Definition at line 258 of file helpbar.c.

259{
260 if (nc->event_type != NT_CONFIG)
261 return 0;
262 if (!nc->global_data || !nc->event_data)
263 return -1;
264
265 struct EventConfig *ev_c = nc->event_data;
266 if (!mutt_str_equal(ev_c->name, "help"))
267 return 0;
268
269 struct MuttWindow *win_helpbar = nc->global_data;
270 win_helpbar->state.visible = cs_subset_bool(NeoMutt->sub, "help");
271
272 mutt_window_reflow(win_helpbar->parent);
273 mutt_debug(LL_DEBUG5, "config done: '%s', request WA_REFLOW on parent\n", ev_c->name);
274 return 0;
275}
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
bool visible
Window is visible.
Definition: mutt_window.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_window_observer()

static int helpbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Focus (global): regenerate the list of key bindings
  • State (this window): regenerate the list of key bindings
  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 286 of file helpbar.c.

287{
288 if (nc->event_type != NT_WINDOW)
289 return 0;
290 if (!nc->global_data || !nc->event_data)
291 return -1;
292
293 struct MuttWindow *win_helpbar = nc->global_data;
294
296 {
297 if (!mutt_window_is_visible(win_helpbar))
298 return 0;
299
300 win_helpbar->actions |= WA_RECALC;
301 mutt_debug(LL_DEBUG5, "window focus: request WA_RECALC\n");
302 return 0;
303 }
304
305 // The next two notifications must be specifically for us
306 struct EventWindow *ew = nc->event_data;
307 if (ew->win != win_helpbar)
308 return 0;
309
311 {
312 win_helpbar->actions |= WA_RECALC;
313 mutt_debug(LL_DEBUG5, "window state: request WA_RECALC\n");
314 }
315 else if (nc->event_subtype == NT_WINDOW_DELETE)
316 {
321 mutt_debug(LL_DEBUG5, "window delete done\n");
322 }
323
324 return 0;
325}
static int helpbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: helpbar.c:229
static int helpbar_binding_observer(struct NotifyCallback *nc)
Notification that a Key Binding has changed - Implements observer_t -.
Definition: helpbar.c:200
static int helpbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: helpbar.c:286
static int helpbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: helpbar.c:258
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:502
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:208
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:104
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_mailbox_observer()

static int index_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

If a Mailbox is closed, then set a pointer to NULL.

Definition at line 591 of file dlg_index.c.

592{
593 if (nc->event_type != NT_MAILBOX)
594 return 0;
595 if (!nc->global_data)
596 return -1;
598 return 0;
599
600 struct Mailbox **ptr = nc->global_data;
601 if (!ptr || !*ptr)
602 return 0;
603
604 *ptr = NULL;
605 mutt_debug(LL_DEBUG5, "mailbox done\n");
606 return 0;
607}
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:169
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:49
A mailbox.
Definition: mailbox.h:79
+ Here is the caller graph for this function:

◆ ibar_color_observer()

static int ibar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 166 of file ibar.c.

167{
168 if (nc->event_type != NT_COLOR)
169 return 0;
170 if (!nc->global_data || !nc->event_data)
171 return -1;
172
173 struct EventColor *ev_c = nc->event_data;
174
175 // MT_COLOR_MAX is sent on `uncolor *`
176 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
177 (ev_c->cid != MT_COLOR_MAX))
178 {
179 return 0;
180 }
181
182 struct MuttWindow *win_ibar = nc->global_data;
183 win_ibar->actions |= WA_REPAINT;
184 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
185
186 return 0;
187}
+ Here is the caller graph for this function:

◆ ibar_config_observer()

static int ibar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 192 of file ibar.c.

193{
194 if (nc->event_type != NT_CONFIG)
195 return 0;
196 if (!nc->global_data || !nc->event_data)
197 return -1;
198
199 struct EventConfig *ev_c = nc->event_data;
200 if ((ev_c->name[0] != 's') && (ev_c->name[0] != 't'))
201 return 0;
202
203 if (!mutt_str_equal(ev_c->name, "status_format") &&
204 !mutt_str_equal(ev_c->name, "ts_enabled") &&
205 !mutt_str_equal(ev_c->name, "ts_icon_format") &&
206 !mutt_str_equal(ev_c->name, "ts_status_format"))
207 {
208 return 0;
209 }
210
211 struct MuttWindow *win_ibar = nc->global_data;
212 win_ibar->actions |= WA_RECALC;
213 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
214
215 return 0;
216}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ibar_index_observer()

static int ibar_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

This function receives two sorts of notification:

  • NT_INDEX: User has changed to a different Mailbox/Email
  • NT_CONTEXT/NT_ACCOUNT/NT_MAILBOX/NT_EMAIL: The state of an object has changed

Definition at line 227 of file ibar.c.

228{
229 if (!nc->global_data)
230 return -1;
231
232 struct MuttWindow *win_ibar = nc->global_data;
233 win_ibar->actions |= WA_RECALC;
234 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
235
236 return 0;
237}
+ Here is the caller graph for this function:

◆ ibar_menu_observer()

static int ibar_menu_observer ( struct NotifyCallback nc)
static

Notification that a Menu has changed - Implements observer_t -.

Definition at line 242 of file ibar.c.

243{
244 if (nc->event_type != NT_MENU)
245 return 0;
246 if (!nc->global_data)
247 return -1;
248
249 struct MuttWindow *win_ibar = nc->global_data;
250 win_ibar->actions |= WA_RECALC;
251 mutt_debug(LL_DEBUG5, "menu done, request WA_RECALC\n");
252
253 return 0;
254}
@ NT_MENU
Menu has changed, MenuRedrawFlags.
Definition: notify_type.h:51
+ Here is the caller graph for this function:

◆ ibar_window_observer()

static int ibar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 259 of file ibar.c.

260{
261 if (nc->event_type != NT_WINDOW)
262 return 0;
263 if (!nc->global_data)
264 return -1;
265
266 struct MuttWindow *win_ibar = nc->global_data;
267 struct EventWindow *ev_w = nc->event_data;
268 if (ev_w->win != win_ibar)
269 return 0;
270
272 {
273 win_ibar->actions |= WA_REPAINT;
274 mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
275 }
276 else if (nc->event_subtype == NT_WINDOW_DELETE)
277 {
278 struct MuttWindow *dlg = window_find_parent(win_ibar, WT_DLG_INDEX);
279 struct IndexSharedData *shared = dlg->wdata;
280
286
287 mutt_debug(LL_DEBUG5, "window delete done\n");
288 }
289
290 return 0;
291}
static int ibar_menu_observer(struct NotifyCallback *nc)
Notification that a Menu has changed - Implements observer_t -.
Definition: ibar.c:242
static int ibar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ibar.c:259
static int ibar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ibar.c:192
static int ibar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: ibar.c:166
static int ibar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: ibar.c:227
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:548
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
Definition: mutt_window.h:86
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition: shared_data.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_altern_observer()

static int index_altern_observer ( struct NotifyCallback nc)
static

Notification that an 'alternates' command has occurred - Implements observer_t -.

Definition at line 228 of file index.c.

229{
230 if (nc->event_type != NT_ALTERN)
231 return 0;
232 if (!nc->global_data)
233 return -1;
234
235 struct MuttWindow *win = nc->global_data;
236 struct MuttWindow *dlg = dialog_find(win);
237 struct IndexSharedData *shared = dlg->wdata;
238
240 mutt_debug(LL_DEBUG5, "alternates done\n");
241 return 0;
242}
void mutt_alternates_reset(struct Mailbox *m)
Clear the recipient valid flag of all emails.
Definition: alternates.c:71
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
@ NT_ALTERN
Alternates command changed, NotifyAlternates.
Definition: notify_type.h:38
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_attach_observer()

static int index_attach_observer ( struct NotifyCallback nc)
static

Notification that an 'attachments' command has occurred - Implements observer_t -.

Definition at line 247 of file index.c.

248{
249 if (nc->event_type != NT_ATTACH)
250 return 0;
251 if (!nc->global_data)
252 return -1;
253
254 struct MuttWindow *win = nc->global_data;
255 struct MuttWindow *dlg = dialog_find(win);
256 struct IndexSharedData *shared = dlg->wdata;
257
259 mutt_debug(LL_DEBUG5, "attachments done\n");
260 return 0;
261}
void mutt_attachments_reset(struct Mailbox *m)
Reset the attachment count for all Emails.
Definition: attachments.c:286
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition: notify_type.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_color_observer()

static int index_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 266 of file index.c.

267{
268 if (nc->event_type != NT_COLOR)
269 return 0;
270 if (!nc->global_data || !nc->event_data)
271 return -1;
272
273 struct EventColor *ev_c = nc->event_data;
274
275 const int cid = ev_c->cid;
276
277 // MT_COLOR_MAX is sent on `uncolor *`
278 if (!((cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
284 (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_TREE)))
285 {
286 // The changes aren't relevant to the index menu
287 return 0;
288 }
289
290 struct MuttWindow *win = nc->global_data;
291 struct MuttWindow *dlg = dialog_find(win);
292 struct IndexSharedData *shared = dlg->wdata;
293
294 struct Mailbox *m = shared->mailbox;
295 if (!m)
296 return 0;
297
298 // Force re-caching of index colours
299 for (int i = 0; i < m->msg_count; i++)
300 {
301 struct Email *e = m->emails[i];
302 if (!e)
303 break;
304 e->attr_color = NULL;
305 }
306
307 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
308 struct IndexPrivateData *priv = panel_index->wdata;
309 struct Menu *menu = priv->menu;
310 menu->redraw = MENU_REDRAW_FULL;
312 mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
313
314 return 0;
315}
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:82
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:88
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:91
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:89
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:84
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:90
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:77
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:86
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:81
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:87
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:85
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:83
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:523
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
The envelope/body of an email.
Definition: email.h:37
struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:111
Private state data for the Index.
Definition: private_data.h:35
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:43
int msg_count
Total number of messages.
Definition: mailbox.h:88
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_config_observer()

static int index_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 320 of file index.c.

321{
322 if (nc->event_type != NT_CONFIG)
323 return 0;
324 if (!nc->global_data || !nc->event_data)
325 return -1;
326
327 struct EventConfig *ev_c = nc->event_data;
328 struct MuttWindow *win = nc->global_data;
329
330 const struct ConfigDef *cdef = ev_c->he->data;
331 ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
332
333 if (flags & R_RESORT_SUB)
334 OptSortSubthreads = true;
335 if (flags & R_RESORT)
336 OptNeedResort = true;
337 if (flags & R_RESORT_INIT)
338 OptResortInit = true;
339 if (!(flags & R_INDEX))
340 return 0;
341
342 if (mutt_str_equal(ev_c->name, "reply_regex"))
343 {
344 struct MuttWindow *dlg = dialog_find(win);
345 struct IndexSharedData *shared = dlg->wdata;
347 mutt_debug(LL_DEBUG5, "config done\n");
348 }
349 else if (mutt_str_equal(ev_c->name, "sort"))
350 {
351 config_sort(ev_c->sub);
352 mutt_debug(LL_DEBUG5, "config done\n");
353 }
354 else if (mutt_str_equal(ev_c->name, "use_threads"))
355 {
356 config_use_threads(ev_c->sub);
357 mutt_debug(LL_DEBUG5, "config done\n");
358 }
359
361 return 0;
362}
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: globals.c:84
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: globals.c:87
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: globals.c:76
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:109
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:157
static int config_reply_regex(struct Mailbox *m)
React to changes to $reply_regex.
Definition: index.c:193
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:57
Definition: set.h:64
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:71
struct HashElem * he
Config item that changed.
Definition: subset.h:73
void * data
User-supplied data.
Definition: hash.h:47
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:69
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:65
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:72
#define R_INDEX
Redraw the index menu (MENU_INDEX)
Definition: types.h:67
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_global_observer()

static int index_global_observer ( struct NotifyCallback nc)
static

Notification that a Global event occurred - Implements observer_t -.

Definition at line 367 of file index.c.

368{
369 if (nc->event_type != NT_GLOBAL)
370 return 0;
371 if (!nc->global_data)
372 return -1;
374 return 0;
375
376 struct MuttWindow *win = nc->global_data;
377 struct MuttWindow *dlg = dialog_find(win);
378 if (!dlg)
379 return 0;
380
381 struct IndexSharedData *shared = dlg->wdata;
383
384 return 0;
385}
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:55
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition: notify_type.h:46
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition: score.c:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_index_observer()

static int index_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 390 of file index.c.

391{
392 if (!nc->global_data)
393 return -1;
394
395 struct MuttWindow *win = nc->global_data;
396 win->actions |= WA_RECALC;
397
398 struct Menu *menu = win->wdata;
400 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
401
402 struct IndexPrivateData *priv = menu->mdata;
403 struct IndexSharedData *shared = priv->shared;
404 if (shared && shared->mailbox)
405 menu->max = shared->mailbox->vcount;
406 else
407 menu->max = 0;
408
409 return 0;
410}
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:42
int vcount
The number of virtual messages.
Definition: mailbox.h:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_menu_observer()

static int index_menu_observer ( struct NotifyCallback nc)
static

Notification that the Menu has changed - Implements observer_t -.

Definition at line 415 of file index.c.

416{
417 if (nc->event_type != NT_MENU)
418 return 0;
419 if (!nc->global_data)
420 return -1;
421
422 struct MuttWindow *win = nc->global_data;
423 struct MuttWindow *dlg = dialog_find(win);
424 struct IndexSharedData *shared = dlg->wdata;
425 struct Menu *menu = win->wdata;
426
427 const int index = menu_get_index(menu);
428 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
430
431 return 0;
432}
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
Definition: shared_data.c:230
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:414
int index
The absolute (unsorted) message number.
Definition: email.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback nc)
static

Notification that a 'score' command has occurred - Implements observer_t -.

Definition at line 437 of file index.c.

438{
439 if (nc->event_type != NT_SCORE)
440 return 0;
441 if (!nc->global_data)
442 return -1;
443
444 struct MuttWindow *win = nc->global_data;
445 struct MuttWindow *dlg = dialog_find(win);
446 struct IndexSharedData *shared = dlg->wdata;
447
448 struct Mailbox *m = shared->mailbox;
449 if (!m)
450 return 0;
451
452 for (int i = 0; i < m->msg_count; i++)
453 {
454 struct Email *e = m->emails[i];
455 if (!e)
456 break;
457
458 mutt_score_message(m, e, true);
459 e->attr_color = NULL; // Force recalc of colour
460 }
461
462 mutt_debug(LL_DEBUG5, "score done\n");
463 return 0;
464}
@ NT_SCORE
Email scoring has changed.
Definition: notify_type.h:53
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:159
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_subjrx_observer()

static int index_subjrx_observer ( struct NotifyCallback nc)
static

Notification that a 'subjectrx' command has occurred - Implements observer_t -.

Definition at line 469 of file index.c.

470{
471 if (nc->event_type != NT_SUBJRX)
472 return 0;
473 if (!nc->global_data)
474 return -1;
475
476 struct MuttWindow *win = nc->global_data;
477 struct MuttWindow *dlg = dialog_find(win);
478 struct IndexSharedData *shared = dlg->wdata;
479
480 subjrx_clear_mods(shared->mailbox);
481 mutt_debug(LL_DEBUG5, "subjectrx done\n");
482 return 0;
483}
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:54
void subjrx_clear_mods(struct Mailbox *m)
Clear out all modified email subjects.
Definition: subjectrx.c:145
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_observer()

static int index_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 488 of file index.c.

489{
490 if (nc->event_type != NT_WINDOW)
491 return 0;
492 if (!nc->global_data || !nc->event_data)
493 return -1;
494
495 struct MuttWindow *win = nc->global_data;
496 struct Menu *menu = win->wdata;
498 {
500 return 0;
501 }
502
503 struct EventWindow *ev_w = nc->event_data;
504 if (ev_w->win != win)
505 return 0;
506
507 struct IndexPrivateData *priv = menu->mdata;
508
519
520 mutt_debug(LL_DEBUG5, "window delete done\n");
521 return 0;
522}
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:266
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:320
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: index.c:390
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:415
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:437
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:367
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:228
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:469
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:247
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:488
struct Notify * notify
Notifications.
Definition: lib.h:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 72 of file ipanel.c.

73{
74 if (nc->event_type != NT_CONFIG)
75 return 0;
76 if (!nc->global_data || !nc->event_data)
77 return -1;
78
79 struct EventConfig *ev_c = nc->event_data;
80 struct MuttWindow *panel_index = nc->global_data;
81
82 if (mutt_str_equal(ev_c->name, "status_on_top"))
83 {
84 window_status_on_top(panel_index, NeoMutt->sub);
85 mutt_debug(LL_DEBUG5, "config done\n");
86 }
87
88 return 0;
89}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ipanel.c.

95{
96 if (nc->event_type != NT_WINDOW)
97 return 0;
98 if (!nc->global_data || !nc->event_data)
99 return -1;
101 return 0;
102
103 struct MuttWindow *panel_index = nc->global_data;
104 struct EventWindow *ev_w = nc->event_data;
105 if (ev_w->win != panel_index)
106 return 0;
107
109 notify_observer_remove(panel_index->notify, ipanel_window_observer, panel_index);
110 mutt_debug(LL_DEBUG5, "window delete done\n");
111
112 return 0;
113}
static int ipanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ipanel.c:72
static int ipanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ipanel.c:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_context_observer()

static int index_shared_context_observer ( struct NotifyCallback nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 41 of file shared_data.c.

42{
43 if (nc->event_type != NT_MVIEW)
44 return 0;
45 if (!nc->global_data || !nc->event_data)
46 return -1;
47 if (nc->event_subtype == NT_MVIEW_ADD)
48 return 0;
49
50 struct EventMview *ev_m = nc->event_data;
51 struct IndexSharedData *shared = nc->global_data;
52 if (ev_m->mv != shared->mailboxview)
53 return 0;
54
56 shared->mailboxview = NULL;
57
58 mutt_debug(LL_NOTIFY, "relay NT_MVIEW to shared data observers\n");
59 notify_send(shared->notify, nc->event_type, nc->event_subtype, shared);
60 return 0;
61}
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
@ NT_MVIEW_DELETE
The Mview is about to be destroyed.
Definition: mview.h:61
@ NT_MVIEW_ADD
The Mview has been opened.
Definition: mview.h:60
@ NT_MVIEW
MailboxView has changed, NotifyMview, EventMview.
Definition: notify_type.h:50
An Event that happened to an MailboxView.
Definition: mview.h:69
struct MailboxView * mv
The MailboxView this Event relates to.
Definition: mview.h:70
struct MailboxView * mailboxview
Current Mailbox view.
Definition: shared_data.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_account_observer()

static int index_shared_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 66 of file shared_data.c.

67{
68 if (nc->event_type != NT_ACCOUNT)
69 return 0;
70 if (!nc->global_data || !nc->event_data)
71 return -1;
73 return 0;
74
75 struct EventAccount *ev_a = nc->event_data;
76 struct IndexSharedData *shared = nc->global_data;
77 if (ev_a->account != shared->account)
78 return 0;
79
81 shared->account = NULL;
82
83 mutt_debug(LL_NOTIFY, "relay NT_ACCOUNT to shared data observers\n");
84 notify_send(shared->notify, nc->event_type, nc->event_subtype, shared);
85 return 0;
86}
@ NT_ACCOUNT_ADD
Account has been added.
Definition: account.h:68
@ NT_ACCOUNT_DELETE
Account is about to be deleted.
Definition: account.h:69
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:36
An Event that happened to an Account.
Definition: account.h:78
struct Account * account
The Account this Event relates to.
Definition: account.h:79
struct Account * account
Current Account.
Definition: shared_data.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_mailbox_observer()

static int index_shared_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 91 of file shared_data.c.

92{
93 if (nc->event_type != NT_MAILBOX)
94 return 0;
95 if (!nc->global_data || !nc->event_data)
96 return -1;
98 return 0;
99
100 struct EventMailbox *ev_m = nc->event_data;
101 struct IndexSharedData *shared = nc->global_data;
102 if (ev_m->mailbox != shared->mailbox)
103 return 0;
104
106 shared->mailbox = NULL;
107
108 mutt_debug(LL_NOTIFY, "relay NT_MAILBOX to shared data observers\n");
109 notify_send(shared->notify, nc->event_type, nc->event_subtype, ev_m);
110 return 0;
111}
@ NT_MAILBOX_ADD
Mailbox has been added.
Definition: mailbox.h:168
An Event that happened to a Mailbox.
Definition: mailbox.h:185
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:186
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_email_observer()

static int index_shared_email_observer ( struct NotifyCallback nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 116 of file shared_data.c.

117{
118 if (nc->event_type != NT_EMAIL)
119 return 0;
120 if (!nc->global_data || !nc->event_data)
121 return -1;
122 if (nc->event_subtype == NT_EMAIL_ADD)
123 return 0;
124
125 struct EventEmail *ev_e = nc->event_data;
126 struct IndexSharedData *shared = nc->global_data;
127 bool match = false;
128 for (int i = 0; i < ev_e->num_emails; i++)
129 {
130 if (ev_e->emails[i] == shared->email)
131 {
132 match = true;
133 break;
134 }
135 }
136
137 if (!match)
138 return 0;
139
141 {
142 shared->email = NULL;
143 mutt_debug(LL_NOTIFY, "NT_INDEX_EMAIL: %p\n", shared->email);
144 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, shared);
145 }
146
147 mutt_debug(LL_NOTIFY, "relay NT_EMAIL %p to shared data observers\n", shared->email);
148 notify_send(shared->notify, nc->event_type, nc->event_subtype, shared);
149 return 0;
150}
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:147
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:148
#define NT_INDEX_EMAIL
Email has changed.
Definition: lib.h:66
@ NT_INDEX
Index data has changed, NotifyIndex, IndexSharedData.
Definition: notify_type.h:48
An Event that happened to an Email.
Definition: email.h:160
int num_emails
Number of Emails the event applies to.
Definition: email.h:161
struct Email ** emails
Emails affected by the event.
Definition: email.h:162
struct Email * email
Currently selected Email.
Definition: shared_data.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_config_observer()

int main_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 883 of file keymap.c.

884{
885 if (nc->event_type != NT_CONFIG)
886 return 0;
887 if (!nc->event_data)
888 return -1;
889
890 struct EventConfig *ev_c = nc->event_data;
891
892 if (!mutt_str_equal(ev_c->name, "abort_key"))
893 return 0;
894
896 mutt_debug(LL_DEBUG5, "config done\n");
897 return 0;
898}
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: keymap.c:861
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_color_observer()

static int menu_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 40 of file observer.c.

41{
42 if (nc->event_type != NT_COLOR)
43 return 0;
44 if (!nc->global_data || !nc->event_data)
45 return -1;
46
47 struct EventColor *ev_c = nc->event_data;
48
49 // MT_COLOR_MAX is sent on `uncolor *`
50 if ((ev_c->cid != MT_COLOR_NORMAL) && (ev_c->cid != MT_COLOR_INDICATOR) &&
51 (ev_c->cid != MT_COLOR_MAX))
52 {
53 return 0;
54 }
55
56 struct Menu *menu = nc->global_data;
57 struct MuttWindow *win = menu->win;
58
60 win->actions |= WA_REPAINT;
61 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT, MENU_REDRAW_FULL\n");
62
63 return 0;
64}
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:52
+ Here is the caller graph for this function:

◆ menu_config_observer()

static int menu_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 69 of file observer.c.

70{
71 if (nc->event_type != NT_CONFIG)
72 return 0;
73 if (!nc->global_data || !nc->event_data)
74 return -1;
75
76 struct EventConfig *ev_c = nc->event_data;
77 if (!mutt_str_startswith(ev_c->name, "arrow_") && !mutt_str_startswith(ev_c->name, "menu_"))
78 return 0;
79
80 if (mutt_str_equal(ev_c->name, "menu_scroll"))
81 return 0; // This doesn't affect the display
82
83 struct Menu *menu = nc->global_data;
84 menu_adjust(menu);
85
86 menu->redraw |= MENU_REDRAW_FULL;
87 menu->win->actions |= WA_RECALC;
88
89 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
90 return 0;
91}
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition: move.c:319
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:227
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_window_observer()

static int menu_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 96 of file observer.c.

97{
98 if (nc->event_type != NT_WINDOW)
99 return 0;
100 if (!nc->global_data || !nc->event_data)
101 return -1;
102
103 struct Menu *menu = nc->global_data;
104 struct MuttWindow *win = menu->win;
105 struct EventWindow *ev_w = nc->event_data;
106 if (ev_w->win != win)
107 return 0;
108
110 {
111 menu->page_len = win->state.rows;
112 menu->redraw |= MENU_REDRAW_FULL;
113
115 mutt_debug(LL_DEBUG5, "window state done, request MENU_REDRAW_INDEX, WA_REPAINT\n");
116 }
117 else if (nc->event_subtype == NT_WINDOW_DELETE)
118 {
123 mutt_debug(LL_DEBUG5, "window delete done\n");
124 }
125
126 return 0;
127}
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: notify.c:68
static int menu_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: observer.c:96
static int menu_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: observer.c:69
static int menu_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: observer.c:40
void msgwin_clear_text(void)
Clear the text in the Message Window.
Definition: msgwin.c:249
int page_len
Number of entries per screen.
Definition: lib.h:75
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remailer_config_observer()

static int remailer_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 94 of file dlg_mixmaster.c.

95{
96 if (nc->event_type != NT_CONFIG)
97 return 0;
98 if (!nc->global_data || !nc->event_data)
99 return -1;
100
101 struct EventConfig *ev_c = nc->event_data;
102 if (!mutt_str_equal(ev_c->name, "status_on_top"))
103 return 0;
104
105 struct MuttWindow *dlg = nc->global_data;
107 mutt_debug(LL_DEBUG5, "config done\n");
108 return 0;
109}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remailer_window_observer()

static int remailer_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 114 of file dlg_mixmaster.c.

115{
116 if (nc->event_type != NT_WINDOW)
117 return 0;
118 if (!nc->global_data || !nc->event_data)
119 return -1;
121 return 0;
122
123 struct MuttWindow *dlg = nc->global_data;
124 struct EventWindow *ev_w = nc->event_data;
125 if (ev_w->win != dlg)
126 return 0;
127
130 mutt_debug(LL_DEBUG5, "window delete done\n");
131
132 return 0;
133}
static int remailer_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_mixmaster.c:94
static int remailer_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_hist_observer()

int main_hist_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 61 of file mutt_history.c.

62{
63 if (nc->event_type != NT_CONFIG)
64 return 0;
65 if (!nc->event_data)
66 return -1;
67
68 struct EventConfig *ev_c = nc->event_data;
69
70 if (!mutt_str_equal(ev_c->name, "history"))
71 return 0;
72
74 mutt_debug(LL_DEBUG5, "history done\n");
75 return 0;
76}
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition: history.c:465
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_log_observer()

int main_log_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 287 of file mutt_logging.c.

288{
289 if (nc->event_type != NT_CONFIG)
290 return 0;
291 if (!nc->event_data)
292 return -1;
293
294 struct EventConfig *ev_c = nc->event_data;
295
296 if (mutt_str_equal(ev_c->name, "debug_file"))
297 {
298 const char *const c_debug_file = cs_subset_path(NeoMutt->sub, "debug_file");
299 mutt_log_set_file(c_debug_file);
300 }
301 else if (mutt_str_equal(ev_c->name, "debug_level"))
302 {
303 const short c_debug_level = cs_subset_number(NeoMutt->sub, "debug_level");
304 mutt_log_set_level(c_debug_level, true);
305 }
306 else
307 {
308 return 0;
309 }
310
311 mutt_debug(LL_DEBUG5, "log done\n");
312 return 0;
313}
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:169
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
int mutt_log_set_level(enum LogLevel level, bool verbose)
Change the logging level.
Definition: mutt_logging.c:228
int mutt_log_set_file(const char *file)
Change the logging file.
Definition: mutt_logging.c:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mview_mailbox_observer()

int mview_mailbox_observer ( struct NotifyCallback nc)

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 313 of file mview.c.

314{
315 if (nc->event_type != NT_MAILBOX)
316 return 0;
317 if (!nc->global_data)
318 return -1;
319
320 struct MailboxView *mv = nc->global_data;
321
322 switch (nc->event_subtype)
323 {
326 ctx_cleanup(mv);
327 break;
329 mview_update(mv);
330 break;
332 update_tables(mv);
333 break;
335 mutt_sort_headers(mv->mailbox, mv->threads, true, &mv->vsize);
336 break;
337 default:
338 return 0;
339 }
340
341 mutt_debug(LL_DEBUG5, "mailbox done\n");
342 return 0;
343}
@ NT_MAILBOX_RESORT
Email list needs resorting.
Definition: mailbox.h:176
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:175
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:177
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:716
static void ctx_cleanup(struct MailboxView *mv)
Release memory and initialize a MailboxView.
Definition: mview.c:105
static void update_tables(struct MailboxView *mv)
Update a MailboxView's internal tables.
Definition: mview.c:221
void mview_update(struct MailboxView *mv)
Update the MailboxView's message counts.
Definition: mview.c:125
void mutt_sort_headers(struct Mailbox *m, struct ThreadsContext *threads, bool init, off_t *vsize)
Sort emails by their headers.
Definition: sort.c:356
The "current" mailbox.
Definition: mview.h:38
off_t vsize
Size (in bytes) of the messages shown.
Definition: mview.h:39
struct ThreadsContext * threads
Threads context.
Definition: mview.h:42
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_key_config_observer()

static int gpgme_key_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 615 of file dlg_gpgme.c.

616{
617 if (nc->event_type != NT_CONFIG)
618 return 0;
619 if (!nc->global_data || !nc->event_data)
620 return -1;
621
622 struct EventConfig *ev_c = nc->event_data;
623
624 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
625 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
626 {
627 return 0;
628 }
629
630 struct Menu *menu = nc->global_data;
632 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
633
634 return 0;
635}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_key_window_observer()

static int gpgme_key_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 644 of file dlg_gpgme.c.

645{
646 if (nc->event_type != NT_WINDOW)
647 return 0;
648 if (!nc->global_data || !nc->event_data)
649 return -1;
651 return 0;
652
653 struct MuttWindow *win_menu = nc->global_data;
654 struct EventWindow *ev_w = nc->event_data;
655 if (ev_w->win != win_menu)
656 return 0;
657
658 struct Menu *menu = win_menu->wdata;
659
662
663 mutt_debug(LL_DEBUG5, "window delete done\n");
664 return 0;
665}
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:615
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:644
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_key_config_observer()

static int pgp_key_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 529 of file dlg_pgp.c.

530{
531 if (nc->event_type != NT_CONFIG)
532 return 0;
533 if (!nc->global_data || !nc->event_data)
534 return -1;
535
536 struct EventConfig *ev_c = nc->event_data;
537
538 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
539 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
540 {
541 return 0;
542 }
543
544 struct Menu *menu = nc->global_data;
546 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
547
548 return 0;
549}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_key_window_observer()

static int pgp_key_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 558 of file dlg_pgp.c.

559{
560 if (nc->event_type != NT_WINDOW)
561 return 0;
562 if (!nc->global_data || !nc->event_data)
563 return -1;
565 return 0;
566
567 struct MuttWindow *win_menu = nc->global_data;
568 struct EventWindow *ev_w = nc->event_data;
569 if (ev_w->win != win_menu)
570 return 0;
571
572 struct Menu *menu = win_menu->wdata;
573
576
577 mutt_debug(LL_DEBUG5, "window delete done\n");
578 return 0;
579}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:558
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:529
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_config_observer()

static int dopager_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 75 of file do_pager.c.

76{
77 if (nc->event_type != NT_CONFIG)
78 return 0;
79 if (!nc->global_data || !nc->event_data)
80 return -1;
81
82 struct EventConfig *ev_c = nc->event_data;
83 if (!mutt_str_equal(ev_c->name, "status_on_top"))
84 return 0;
85
86 struct MuttWindow *dlg = nc->global_data;
88 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
89 return 0;
90}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_window_observer()

static int dopager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 95 of file do_pager.c.

96{
97 if (nc->event_type != NT_WINDOW)
98 return 0;
99 if (!nc->global_data || !nc->event_data)
100 return -1;
102 return 0;
103
104 struct MuttWindow *dlg = nc->global_data;
105 struct EventWindow *ev_w = nc->event_data;
106 if (ev_w->win != dlg)
107 return 0;
108
111 mutt_debug(LL_DEBUG5, "window delete done\n");
112
113 return 0;
114}
static int dopager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: do_pager.c:75
static int dopager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: do_pager.c:95
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_color_observer()

static int pager_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 241 of file pager.c.

242{
243 if (nc->event_type != NT_COLOR)
244 return 0;
245 if (!nc->global_data || !nc->event_data)
246 return -1;
247
248 struct EventColor *ev_c = nc->event_data;
249 struct MuttWindow *win_pager = nc->global_data;
250 struct PagerPrivateData *priv = win_pager->wdata;
251 if (!priv)
252 return 0;
253
254 // MT_COLOR_MAX is sent on `uncolor *`
255 if ((ev_c->cid == MT_COLOR_QUOTED) || (ev_c->cid == MT_COLOR_MAX))
256 {
257 // rework quoted colours
259 }
260
261 if (ev_c->cid == MT_COLOR_MAX)
262 {
263 for (size_t i = 0; i < priv->lines_max; i++)
264 {
265 FREE(&(priv->lines[i].syntax));
266 // if (priv->search_compiled && priv->lines[i].search)
267 // FREE(&(priv->lines[i].search));
268 // priv->lines[i].syntax_arr_size = 0;
269 }
270 priv->lines_used = 0;
271
272 // if (priv->search_compiled)
273 // {
274 // regfree(&priv->search_re);
275 // priv->search_compiled = false;
276 // }
277 }
278
279 mutt_debug(LL_DEBUG5, "color done\n");
280 return 0;
281}
@ MT_COLOR_QUOTED
Pager: quoted text.
Definition: color.h:61
#define FREE(x)
Definition: memory.h:43
void qstyle_recolour(struct QuoteStyle *quote_list)
Recolour quotes after colour changes.
Definition: quoted.c:608
struct TextSyntax * syntax
Array of coloured text in the line.
Definition: display.h:58
Private state data for the Pager.
Definition: private_data.h:41
int lines_used
Size of lines array (used entries)
Definition: private_data.h:49
int lines_max
Capacity of lines array (total entries)
Definition: private_data.h:50
struct Line * lines
Array of text lines in pager.
Definition: private_data.h:48
struct QuoteStyle * quote_list
Tree of quoting levels.
Definition: private_data.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_config_observer()

static int pager_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 286 of file pager.c.

287{
288 if (nc->event_type != NT_CONFIG)
289 return 0;
290 if (!nc->global_data || !nc->event_data)
291 return -1;
292
293 struct EventConfig *ev_c = nc->event_data;
294 struct MuttWindow *win_pager = nc->global_data;
295
296 if (mutt_str_equal(ev_c->name, "pager_index_lines"))
297 {
298 config_pager_index_lines(win_pager);
299 mutt_debug(LL_DEBUG5, "config done\n");
300 }
301
302 return 0;
303}
static int config_pager_index_lines(struct MuttWindow *win)
React to changes to $pager_index_lines.
Definition: pager.c:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_global_observer()

static int pager_global_observer ( struct NotifyCallback nc)
static

Notification that a Global Event occurred - Implements observer_t -.

Definition at line 308 of file pager.c.

309{
310 if (nc->event_type != NT_GLOBAL)
311 return 0;
312 if (!nc->global_data)
313 return -1;
315 return 0;
316
317 struct MuttWindow *win_pager = nc->global_data;
318
319 struct PagerPrivateData *priv = win_pager->wdata;
320 const struct PagerView *pview = priv ? priv->pview : NULL;
321 if (priv && pview && (priv->redraw & PAGER_REDRAW_FLOW) && (pview->flags & MUTT_PAGER_RETWINCH))
322 {
323 priv->rc = OP_REFORMAT_WINCH;
324 }
325
326 return 0;
327}
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:69
#define PAGER_REDRAW_FLOW
Reflow the pager.
Definition: lib.h:189
int rc
Return code from functions.
Definition: private_data.h:73
PagerRedrawFlags redraw
When to redraw the screen.
Definition: private_data.h:69
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:42
Paged view into some data.
Definition: lib.h:169
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:172
+ Here is the caller graph for this function:

◆ pager_index_observer()

static int pager_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 332 of file pager.c.

333{
334 if (nc->event_type != NT_INDEX)
335 return 0;
336 if (!nc->global_data)
337 return -1;
338
339 struct MuttWindow *win_pager = nc->global_data;
340
341 struct PagerPrivateData *priv = win_pager->wdata;
342 if (!priv)
343 return 0;
344
345 struct IndexSharedData *shared = nc->event_data;
346
348 {
349 win_pager->actions |= WA_RECALC;
350 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
351 priv->loop = PAGER_LOOP_QUIT;
352 }
353 else if (nc->event_subtype & NT_INDEX_EMAIL)
354 {
355 win_pager->actions |= WA_RECALC;
356 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
357 priv->pager_redraw = true;
358 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
359 {
360 priv->loop = PAGER_LOOP_RELOAD;
361 }
362 else
363 {
364 priv->loop = PAGER_LOOP_QUIT;
365 priv->rc = 0;
366 }
367 }
368
369 return 0;
370}
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition: lib.h:65
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition: lib.h:151
@ PAGER_LOOP_QUIT
Quit the Pager.
Definition: lib.h:150
bool pager_redraw
Force a complete redraw.
Definition: private_data.h:78
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
Definition: private_data.h:79
+ Here is the caller graph for this function:

◆ pager_pager_observer()

static int pager_pager_observer ( struct NotifyCallback nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 375 of file pager.c.

376{
377 if (nc->event_type != NT_PAGER)
378 return 0;
379 if (!nc->global_data || !nc->event_data)
380 return -1;
381
382 mutt_debug(LL_DEBUG5, "pager done\n");
383 return 0;
384}
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:52
+ Here is the caller graph for this function:

◆ pager_window_observer()

static int pager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 389 of file pager.c.

390{
391 if (nc->event_type != NT_WINDOW)
392 return 0;
393 if (!nc->global_data || !nc->event_data)
394 return -1;
396 return 0;
397
398 struct MuttWindow *win_pager = nc->global_data;
399 struct EventWindow *ev_w = nc->event_data;
400 if (ev_w->win != win_pager)
401 return 0;
402
403 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
404 if (!dlg)
405 dlg = window_find_parent(win_pager, WT_DLG_DO_PAGER);
406
407 struct IndexSharedData *shared = dlg->wdata;
408
415
416 mutt_debug(LL_DEBUG5, "window delete done\n");
417
418 return 0;
419}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:375
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pager.c:241
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pager.c:286
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pager.c:332
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:389
static int pager_global_observer(struct NotifyCallback *nc)
Notification that a Global Event occurred - Implements observer_t -.
Definition: pager.c:308
@ WT_DLG_DO_PAGER
Pager Dialog, mutt_do_pager()
Definition: mutt_window.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_color_observer()

static int pbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 173 of file pbar.c.

174{
175 if (nc->event_type != NT_COLOR)
176 return 0;
177 if (!nc->global_data || !nc->event_data)
178 return -1;
179
180 struct EventColor *ev_c = nc->event_data;
181 enum ColorId cid = ev_c->cid;
182
183 if ((cid != MT_COLOR_STATUS) && (cid != MT_COLOR_NORMAL) && (cid != MT_COLOR_MAX))
184 return 0;
185
186 struct MuttWindow *win_pbar = nc->global_data;
187 win_pbar->actions |= WA_REPAINT;
188 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
189
190 return 0;
191}
+ Here is the caller graph for this function:

◆ pbar_config_observer()

static int pbar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 196 of file pbar.c.

197{
198 if (nc->event_type != NT_CONFIG)
199 return 0;
200 if (!nc->global_data || !nc->event_data)
201 return -1;
202
203 struct EventConfig *ev_c = nc->event_data;
204 if (!mutt_str_equal(ev_c->name, "pager_format"))
205 return 0;
206
207 struct MuttWindow *win_pbar = nc->global_data;
208 win_pbar->actions |= WA_RECALC;
209 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
210
211 return 0;
212}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_index_observer()

static int pbar_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

This function receives two sorts of notification:

  • NT_INDEX: User has changed to a different Mailbox/Email
  • NT_CONTEXT/NT_ACCOUNT/NT_MAILBOX/NT_EMAIL: The state of an object has changed

Definition at line 223 of file pbar.c.

224{
225 if (!nc->global_data)
226 return -1;
227
228 struct MuttWindow *win_pbar = nc->global_data;
229 win_pbar->actions |= WA_RECALC;
230 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
231
232 return 0;
233}
+ Here is the caller graph for this function:

◆ pbar_pager_observer()

static int pbar_pager_observer ( struct NotifyCallback nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 238 of file pbar.c.

239{
240 if (nc->event_type != NT_PAGER)
241 return 0;
242 if (!nc->global_data)
243 return -1;
244
245 struct MuttWindow *win_pbar = nc->global_data;
246
248 {
249 win_pbar->actions |= WA_RECALC;
250 mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
251 }
252
253 return 0;
254}
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:184
+ Here is the caller graph for this function:

◆ pbar_window_observer()

static int pbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 259 of file pbar.c.

260{
261 if (nc->event_type != NT_WINDOW)
262 return 0;
263 if (!nc->global_data || !nc->event_data)
264 return -1;
265
266 struct MuttWindow *win_pbar = nc->global_data;
267 struct EventWindow *ev_w = nc->event_data;
268 if (ev_w->win != win_pbar)
269 return 0;
270
272 {
273 win_pbar->actions |= WA_RECALC | WA_REPAINT;
274 mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
275 }
276 else if (nc->event_subtype == NT_WINDOW_DELETE)
277 {
278 struct PBarPrivateData *pbar_data = win_pbar->wdata;
279 struct IndexSharedData *shared = pbar_data->shared;
280
286
287 mutt_debug(LL_DEBUG5, "window delete done\n");
288 }
289
290 return 0;
291}
static int pbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pbar.c:259
static int pbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pbar.c:173
static int pbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pbar.c:196
static int pbar_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pbar.c:238
static int pbar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pbar.c:223
Data to draw the Pager Bar.
Definition: pbar.c:84
struct PagerPrivateData * priv
Private Pager data.
Definition: pbar.c:86
struct IndexSharedData * shared
Shared Index data.
Definition: pbar.c:85
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
Definition: private_data.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 73 of file ppanel.c.

74{
75 if (nc->event_type != NT_CONFIG)
76 return 0;
77 if (!nc->global_data || !nc->event_data)
78 return -1;
79
80 struct EventConfig *ev_c = nc->event_data;
81 struct MuttWindow *panel_pager = nc->global_data;
82
83 if (mutt_str_equal(ev_c->name, "status_on_top"))
84 {
85 window_status_on_top(panel_pager, NeoMutt->sub);
86 mutt_debug(LL_DEBUG5, "config done\n");
87 }
88
89 return 0;
90}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 95 of file ppanel.c.

96{
97 if (nc->event_type != NT_WINDOW)
98 return 0;
99 if (!nc->global_data || !nc->event_data)
100 return -1;
102 return 0;
103
104 struct MuttWindow *panel_pager = nc->global_data;
105 struct EventWindow *ev_w = nc->event_data;
106 if (ev_w->win != panel_pager)
107 return 0;
108
110 notify_observer_remove(panel_pager->notify, ppanel_window_observer, panel_pager);
111 mutt_debug(LL_DEBUG5, "window delete done\n");
112
113 return 0;
114}
static int ppanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ppanel.c:73
static int ppanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ppanel.c:95
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_config_observer()

static int pattern_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_pattern.

Definition at line 280 of file dlg_pattern.c.

281{
282 if (nc->event_type != NT_CONFIG)
283 return 0;
284 if (!nc->global_data || !nc->event_data)
285 return -1;
286
287 struct EventConfig *ev_c = nc->event_data;
288
289 if (!mutt_str_equal(ev_c->name, "pattern_format"))
290 return 0;
291
292 struct Menu *menu = nc->global_data;
294 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
295
296 return 0;
297}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_window_observer()

static int pattern_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 306 of file dlg_pattern.c.

307{
308 if (nc->event_type != NT_WINDOW)
309 return 0;
310 if (!nc->global_data || !nc->event_data)
311 return -1;
313 return 0;
314
315 struct MuttWindow *win_menu = nc->global_data;
316 struct EventWindow *ev_w = nc->event_data;
317 if (ev_w->win != win_menu)
318 return 0;
319
320 struct Menu *menu = win_menu->wdata;
321
324
325 mutt_debug(LL_DEBUG5, "window delete done\n");
326 return 0;
327}
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pattern.c:306
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pattern.c:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_config_observer()

static int postponed_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_postponed.

Definition at line 116 of file dlg_postpone.c.

117{
118 if (nc->event_type != NT_CONFIG)
119 return 0;
120 if (!nc->global_data || !nc->event_data)
121 return -1;
122
123 struct EventConfig *ev_c = nc->event_data;
124
125 if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
126 return 0;
127
128 struct Menu *menu = nc->global_data;
130 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
131
132 return 0;
133}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_window_observer()

static int postponed_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 142 of file dlg_postpone.c.

143{
144 if (nc->event_type != NT_WINDOW)
145 return 0;
146 if (!nc->global_data || !nc->event_data)
147 return -1;
149 return 0;
150
151 struct MuttWindow *win_menu = nc->global_data;
152 struct EventWindow *ev_w = nc->event_data;
153 if (ev_w->win != win_menu)
154 return 0;
155
156 struct Menu *menu = win_menu->wdata;
157
160
161 mutt_debug(LL_DEBUG5, "window delete done\n");
162 return 0;
163}
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:142
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 171 of file observer.c.

172{
173 if (nc->event_type != NT_ACCOUNT)
174 return 0;
175 if (!nc->global_data || !nc->event_data)
176 return -1;
178 return 0;
179
180 struct MuttWindow *win = nc->global_data;
182 struct EventAccount *ev_a = nc->event_data;
183
184 struct MailboxNode *np = NULL;
185 STAILQ_FOREACH(np, &ev_a->account->mailboxes, entries)
186 {
187 sb_add_mailbox(wdata, np->mailbox);
188 }
189
190 win->actions |= WA_RECALC;
191 mutt_debug(LL_DEBUG5, "account done, request WA_RECALC\n");
192 return 0;
193}
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
void sb_add_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Add a Mailbox to the Sidebar.
Definition: sidebar.c:88
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:73
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
List of Mailboxes.
Definition: mailbox.h:152
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:153
Sidebar private Window data -.
Definition: private.h:64
struct MuttWindow * win
Sidebar Window.
Definition: private.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 198 of file observer.c.

199{
200 if (nc->event_type != NT_COLOR)
201 return 0;
202 if (!nc->global_data || !nc->event_data)
203 return -1;
204
205 struct EventColor *ev_c = nc->event_data;
206 struct MuttWindow *win = nc->global_data;
207
208 enum ColorId cid = ev_c->cid;
209
210 switch (cid)
211 {
213 case MT_COLOR_NORMAL:
223 case MT_COLOR_MAX: // Sent on `uncolor *`
224 win->actions |= WA_REPAINT;
225 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
226 break;
227
228 default:
229 break;
230 }
231 return 0;
232}
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:65
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:69
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:72
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:71
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:70
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
Definition: color.h:64
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:68
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:67
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:66
+ Here is the caller graph for this function:

◆ sb_command_observer()

static int sb_command_observer ( struct NotifyCallback nc)
static

Notification that a Command has occurred - Implements observer_t -.

Definition at line 237 of file observer.c.

238{
239 if (nc->event_type != NT_COMMAND)
240 return 0;
241 if (!nc->global_data || !nc->event_data)
242 return -1;
243
244 struct Command *cmd = nc->event_data;
245
246 if ((cmd->parse != sb_parse_sidebar_pin) && (cmd->parse != sb_parse_sidebar_unpin))
247 return 0;
248
249 struct MuttWindow *win = nc->global_data;
250 win->actions |= WA_RECALC;
251 mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
252 return 0;
253}
enum CommandResult sb_parse_sidebar_pin(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_pin' command - Implements Command::parse() -.
Definition: commands.c:40
enum CommandResult sb_parse_sidebar_unpin(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_unpin' command - Implements Command::parse() -.
Definition: commands.c:59
@ NT_COMMAND
A Command has been executed, Command.
Definition: notify_type.h:42
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Definition: command.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 258 of file observer.c.

259{
260 if (nc->event_type != NT_CONFIG)
261 return 0;
262 if (!nc->global_data || !nc->event_data)
263 return -1;
264
265 struct EventConfig *ev_c = nc->event_data;
266
267 if (!mutt_strn_equal(ev_c->name, "sidebar_", 8) &&
268 !mutt_str_equal(ev_c->name, "ascii_chars") &&
269 !mutt_str_equal(ev_c->name, "folder") && !mutt_str_equal(ev_c->name, "spool_file"))
270 {
271 return 0;
272 }
273
274 if (mutt_str_equal(ev_c->name, "sidebar_next_new_wrap"))
275 return 0; // Affects the behaviour, but not the display
276
277 mutt_debug(LL_DEBUG5, "config: %s\n", ev_c->name);
278
279 struct MuttWindow *win = nc->global_data;
280
281 if (mutt_str_equal(ev_c->name, "sidebar_visible"))
282 {
283 const bool c_sidebar_visible = cs_subset_bool(NeoMutt->sub, "sidebar_visible");
284 window_set_visible(win, c_sidebar_visible);
285 window_reflow(win->parent);
286 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
287 return 0;
288 }
289
290 if (mutt_str_equal(ev_c->name, "sidebar_width"))
291 {
292 const short c_sidebar_width = cs_subset_number(NeoMutt->sub, "sidebar_width");
293 win->req_cols = c_sidebar_width;
294 window_reflow(win->parent);
295 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
296 return 0;
297 }
298
299 if (mutt_str_equal(ev_c->name, "spool_file"))
300 {
301 win->actions |= WA_REPAINT;
302 mutt_debug(LL_DEBUG5, "config done, request WA_REPAINT\n");
303 return 0;
304 }
305
306 if (mutt_str_equal(ev_c->name, "sidebar_on_right"))
307 {
308 struct MuttWindow *parent = win->parent;
309 struct MuttWindow *first = TAILQ_FIRST(&parent->children);
310 const bool c_sidebar_on_right = cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
311
312 if ((c_sidebar_on_right && (first == win)) || (!c_sidebar_on_right && (first != win)))
313 {
314 // Swap the Sidebar and the Container of the Index/Pager
315 TAILQ_REMOVE(&parent->children, first, entries);
316 TAILQ_INSERT_TAIL(&parent->children, first, entries);
317 }
318
319 window_reflow(win->parent);
320 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
321 return 0;
322 }
323
324 if (mutt_str_equal(ev_c->name, "ascii_chars") ||
325 mutt_str_equal(ev_c->name, "sidebar_divider_char"))
326 {
330 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
331 return 0;
332 }
333
334 // All the remaining config changes...
336 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
337 return 0;
338}
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:496
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:163
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:809
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:220
static bool calc_divider(struct SidebarWindowData *wdata)
Decide what actions are required for the divider.
Definition: observer.c:49
short req_cols
Number of columns required.
Definition: mutt_window.h:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_index_observer()

static int sb_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 343 of file observer.c.

344{
345 if (nc->event_type != NT_INDEX)
346 return 0;
347 if (!nc->global_data || !nc->event_data)
348 return 0;
349 if (!(nc->event_subtype & NT_INDEX_MAILBOX))
350 return 0;
351
352 struct MuttWindow *win_sidebar = nc->global_data;
353 struct IndexSharedData *shared = nc->event_data;
354
355 struct SidebarWindowData *wdata = sb_wdata_get(win_sidebar);
357
358 win_sidebar->actions |= WA_RECALC;
359 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
360
361 return 0;
362}
void sb_set_current_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Set the current Mailbox.
Definition: sidebar.c:178
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 367 of file observer.c.

368{
369 if (nc->event_type != NT_MAILBOX)
370 return 0;
371 if (!nc->global_data || !nc->event_data)
372 return -1;
373
374 struct MuttWindow *win = nc->global_data;
375
377 struct EventMailbox *ev_m = nc->event_data;
378
379 if (nc->event_subtype == NT_MAILBOX_ADD)
380 {
381 sb_add_mailbox(wdata, ev_m->mailbox);
382 }
383 else if (nc->event_subtype == NT_MAILBOX_DELETE)
384 {
385 sb_remove_mailbox(wdata, ev_m->mailbox);
386 }
387
388 win->actions |= WA_RECALC;
389 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC\n");
390 return 0;
391}
void sb_remove_mailbox(struct SidebarWindowData *wdata, const struct Mailbox *m)
Remove a Mailbox from the Sidebar.
Definition: sidebar.c:125
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 396 of file observer.c.

397{
398 if (nc->event_type != NT_WINDOW)
399 return 0;
400 if (!nc->global_data || !nc->event_data)
401 return -1;
402
403 struct MuttWindow *win = nc->global_data;
404 struct EventWindow *ev_w = nc->event_data;
405 if (ev_w->win != win)
406 return 0;
407
409 {
411 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
412 }
413 else if (nc->event_subtype == NT_WINDOW_DELETE)
414 {
415 mutt_debug(LL_DEBUG5, "window delete done\n");
417 }
418 return 0;
419}
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition: observer.c:445
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_insertion_window_observer()

int sb_insertion_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 464 of file observer.c.

465{
466 if (nc->event_type != NT_WINDOW)
467 return 0;
468 if (!nc->event_data)
469 return -1;
471 return 0;
472
473 struct EventWindow *ev_w = nc->event_data;
474 if (ev_w->win->type != WT_DLG_INDEX)
475 return 0;
476
477 if (ev_w->flags & WN_VISIBLE)
478 {
479 mutt_debug(LL_DEBUG5, "insertion: visible\n");
480 struct MuttWindow *win_sidebar = sb_win_init(ev_w->win);
481 sb_init_data(win_sidebar);
482 }
483 else if (ev_w->flags & WN_HIDDEN)
484 {
485 mutt_debug(LL_DEBUG5, "insertion: hidden\n");
487 }
488
489 return 0;
490}
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
Definition: mutt_window.h:207
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:191
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:192
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition: observer.c:92
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition: observer.c:148
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:217
+ Here is the call graph for this function:
+ Here is the caller graph for this function: