NeoMutt  2022-04-29-247-gc6aae8
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...
 
int cbar_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -. More...
 
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

Contract

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 199 of file dlg_alias.c.

200{
201 if (nc->event_type != NT_ALIAS)
202 return 0;
203 if (!nc->global_data || !nc->event_data)
204 return -1;
205
206 struct EventAlias *ev_a = nc->event_data;
207 struct Menu *menu = nc->global_data;
208 struct AliasMenuData *mdata = menu->mdata;
209 struct Alias *alias = ev_a->alias;
210
211 if (nc->event_subtype == NT_ALIAS_ADD)
212 {
213 alias_array_alias_add(&mdata->ava, alias);
214
215 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
216 {
217 mutt_pattern_alias_func(NULL, mdata, menu);
218 }
219 }
220 else if (nc->event_subtype == NT_ALIAS_DELETE)
221 {
222 alias_array_alias_delete(&mdata->ava, alias);
223
224 int vcount = alias_array_count_visible(&mdata->ava);
225 int index = menu_get_index(menu);
226 if ((index > (vcount - 1)) && (index > 0))
227 menu_set_index(menu, index - 1);
228 }
229
230 alias_array_sort(&mdata->ava, mdata->sub);
231
232 menu->max = alias_array_count_visible(&mdata->ava);
234 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
235
236 return 0;
237}
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:59
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:243
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:69
void * mdata
Private data.
Definition: lib.h:137
int max
Number of entries in the menu.
Definition: lib.h:71
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 246 of file dlg_alias.c.

247{
248 if (nc->event_type != NT_WINDOW)
249 return 0;
250 if (!nc->global_data || !nc->event_data)
251 return -1;
253 return 0;
254
255 struct MuttWindow *win_menu = nc->global_data;
256 struct EventWindow *ev_w = nc->event_data;
257 if (ev_w->win != win_menu)
258 return 0;
259
260 struct Menu *menu = win_menu->wdata;
261
265
266 mutt_debug(LL_DEBUG5, "window delete done\n");
267 return 0;
268}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:246
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:199
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:206
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
An Event that happened to a Window.
Definition: mutt_window.h:216
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
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 318 of file dlg_query.c.

319{
320 if (nc->event_type != NT_WINDOW)
321 return 0;
322 if (!nc->global_data || !nc->event_data)
323 return -1;
325 return 0;
326
327 struct MuttWindow *win_menu = nc->global_data;
328 struct EventWindow *ev_w = nc->event_data;
329 if (ev_w->win != win_menu)
330 return 0;
331
332 struct Menu *menu = win_menu->wdata;
333
336
337 mutt_debug(LL_DEBUG5, "window delete done\n");
338 return 0;
339}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:318
+ 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 419 of file dlg_attach.c.

420{
421 if (nc->event_type != NT_WINDOW)
422 return 0;
423 if (!nc->global_data || !nc->event_data)
424 return -1;
426 return 0;
427
428 struct MuttWindow *win_menu = nc->global_data;
429 struct EventWindow *ev_w = nc->event_data;
430 if (ev_w->win != win_menu)
431 return 0;
432
433 struct Menu *menu = win_menu->wdata;
434
437
438 mutt_debug(LL_DEBUG5, "window delete done\n");
439 return 0;
440}
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:419
+ 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 1003 of file browser.c.

1004{
1005 if (nc->event_type != NT_CONFIG)
1006 return 0;
1007 if (!nc->global_data || !nc->event_data)
1008 return -1;
1009
1010 struct EventConfig *ev_c = nc->event_data;
1011
1012 if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1013 !mutt_str_equal(ev_c->name, "date_format") && !mutt_str_equal(ev_c->name, "folder") &&
1014 !mutt_str_equal(ev_c->name, "folder_format") &&
1015 !mutt_str_equal(ev_c->name, "group_index_format") &&
1016 !mutt_str_equal(ev_c->name, "sort_browser"))
1017 {
1018 return 0;
1019 }
1020
1021 struct Menu *menu = nc->global_data;
1023 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1024
1025 return 0;
1026}
+ 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 1035 of file browser.c.

1036{
1037 if (nc->event_type != NT_WINDOW)
1038 return 0;
1039 if (!nc->global_data || !nc->event_data)
1040 return -1;
1042 return 0;
1043
1044 struct MuttWindow *win_menu = nc->global_data;
1045 struct EventWindow *ev_w = nc->event_data;
1046 if (ev_w->win != win_menu)
1047 return 0;
1048
1049 struct Menu *menu = win_menu->wdata;
1050
1053
1054 mutt_debug(LL_DEBUG5, "window delete done\n");
1055 return 0;
1056}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: browser.c:1003
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: browser.c:1035
+ 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:153
#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 203 of file cbar.c.

204{
205 if (nc->event_type != NT_COLOR)
206 return 0;
207 if (!nc->global_data || !nc->event_data)
208 return -1;
209
210 struct EventColor *ev_c = nc->event_data;
211
212 // MT_COLOR_MAX is sent on `uncolor *`
213 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
214 (ev_c->cid != MT_COLOR_MAX))
215 {
216 return 0;
217 }
218
219 struct MuttWindow *win_cbar = nc->global_data;
220 win_cbar->actions |= WA_REPAINT;
221 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
222
223 return 0;
224}
@ MT_COLOR_MAX
Definition: color.h:88
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:71
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:54
#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 229 of file cbar.c.

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

◆ cbar_email_observer()

int cbar_email_observer ( struct NotifyCallback nc)

Notification that the Email has changed - Implements observer_t -.

Definition at line 250 of file cbar.c.

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

◆ cbar_window_observer()

int cbar_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 267 of file cbar.c.

268{
269 if (nc->event_type != NT_WINDOW)
270 return 0;
271 if (!nc->global_data || !nc->event_data)
272 return -1;
273
274 struct MuttWindow *win_cbar = nc->global_data;
275 struct EventWindow *ev_w = nc->event_data;
276 if (ev_w->win != win_cbar)
277 return 0;
278
280 {
281 win_cbar->actions |= WA_RECALC;
282 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
283 }
284 else if (nc->event_subtype == NT_WINDOW_DELETE)
285 {
286 struct MuttWindow *dlg = win_cbar->parent;
287 struct ComposeSharedData *shared = dlg->wdata;
288
293
294 mutt_debug(LL_DEBUG5, "window delete done\n");
295 }
296
297 return 0;
298}
int cbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: cbar.c:203
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: cbar.c:229
int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: cbar.c:267
int cbar_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: cbar.c:250
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:207
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:759
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:658
#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 784 of file window.c.

785{
786 if (nc->event_type != NT_COLOR)
787 return 0;
788 if (!nc->global_data || !nc->event_data)
789 return -1;
790
791 struct EventColor *ev_c = nc->event_data;
792 struct MuttWindow *win_env = nc->global_data;
793
794 enum ColorId cid = ev_c->cid;
795
796 switch (cid)
797 {
798 case MT_COLOR_BOLD:
804 case MT_COLOR_NORMAL:
805 case MT_COLOR_STATUS:
806 case MT_COLOR_MAX: // Sent on `uncolor *`
807 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
808 win_env->actions |= WA_REPAINT;
809 break;
810
811 default:
812 break;
813 }
814 return 0;
815}
ColorId
List of all colored objects.
Definition: color.h:35
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:43
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:44
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:40
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:42
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:45
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:41
+ 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 820 of file window.c.

821{
822 if (nc->event_type != NT_CONFIG)
823 return 0;
824 if (!nc->global_data || !nc->event_data)
825 return -1;
826
827 struct EventConfig *ev_c = nc->event_data;
828 struct MuttWindow *win_env = nc->global_data;
829
830 switch (ev_c->name[0])
831 {
832 case 'a':
833 if (mutt_str_equal(ev_c->name, "autocrypt"))
834 break;
835 return 0;
836 case 'c':
837 if (mutt_str_equal(ev_c->name, "compose_show_user_headers") ||
838 mutt_str_equal(ev_c->name, "crypt_opportunistic_encrypt"))
839 {
840 break;
841 }
842 return 0;
843 case 'p':
844 if (mutt_str_equal(ev_c->name, "pgp_sign_as"))
845 break;
846 return 0;
847 case 's':
848 if (mutt_str_equal(ev_c->name, "smime_encrypt_with"))
849 break;
850 return 0;
851 case 'x':
852 if (mutt_str_equal(ev_c->name, "x_comment_to"))
853 break;
854 return 0;
855 default:
856 return 0;
857 }
858
859 win_env->actions |= WA_RECALC;
860 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
861 return 0;
862}
+ 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 867 of file window.c.

868{
869 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
870 return 0;
871 if (!nc->global_data)
872 return -1;
873
874 struct MuttWindow *win_env = nc->global_data;
875
876 // pgp/smime/autocrypt menu, or external change
877 if (nc->event_type == NT_EMAIL)
878 {
879 struct EnvelopeWindowData *wdata = win_env->wdata;
880 update_crypt_info(wdata);
881 }
882
883 win_env->actions |= WA_RECALC;
884 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
885 return 0;
886}
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition: functions.c:146
Data to fill the Envelope Window.
Definition: wdata.h:39
+ 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 891 of file window.c.

892{
893 if (nc->event_type != NT_HEADER)
894 return 0;
895 if (!nc->global_data || !nc->event_data)
896 return -1;
897
898 const struct EventHeader *ev_h = nc->event_data;
899 struct MuttWindow *win_env = nc->global_data;
900 struct EnvelopeWindowData *wdata = win_env->wdata;
901
902 struct Envelope *env = wdata->email->env;
903
905 {
906 header_set(&env->userhdrs, ev_h->header);
907 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
908 win_env->actions |= WA_RECALC;
909 return 0;
910 }
911
913 {
914 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
915 if (removed)
916 {
917 header_free(&env->userhdrs, removed);
918 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
919 win_env->actions |= WA_RECALC;
920 }
921 return 0;
922 }
923
924 return 0;
925}
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:175
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:173
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:174
@ 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:41
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:182
char * header
The contents of the header.
Definition: email.h:183
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 930 of file window.c.

931{
932 if (nc->event_type != NT_WINDOW)
933 return 0;
934 if (!nc->global_data || !nc->event_data)
935 return -1;
936
937 struct MuttWindow *win_env = nc->global_data;
938 struct EventWindow *ev_w = nc->event_data;
939 if (ev_w->win != win_env)
940 return 0;
941
943 {
944 win_env->actions |= WA_RECALC;
945 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
946 }
947 else if (nc->event_subtype == NT_WINDOW_DELETE)
948 {
949 struct EnvelopeWindowData *wdata = win_env->wdata;
950
956 mutt_debug(LL_DEBUG5, "window delete done\n");
957 }
958
959 return 0;
960}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:867
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:784
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:930
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:820
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:891
+ 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:340
@ 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:501
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:209
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 593 of file dlg_index.c.

594{
595 if (nc->event_type != NT_MAILBOX)
596 return 0;
597 if (!nc->global_data)
598 return -1;
600 return 0;
601
602 struct Mailbox **ptr = nc->global_data;
603 if (!ptr || !*ptr)
604 return 0;
605
606 *ptr = NULL;
607 mutt_debug(LL_DEBUG5, "mailbox done\n");
608 return 0;
609}
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:170
@ 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:547
@ 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:72
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:285
@ 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:78
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:84
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:87
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:85
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:80
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:86
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:73
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:82
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:77
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:83
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:81
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:79
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
@ 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:112
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:76
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:72
+ 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}
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:56
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:56
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:59
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:48
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:63
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:74
#define R_INDEX
Redraw the index menu (MENU_INDEX)
Definition: types.h:65
#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:110
+ 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:146
+ 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:135
+ 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:69
@ NT_ACCOUNT_DELETE
Account is about to be deleted.
Definition: account.h:70
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:36
An Event that happened to an Account.
Definition: account.h:79
struct Account * account
The Account this Event relates to.
Definition: account.h:80
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:169
An Event that happened to a Mailbox.
Definition: mailbox.h:186
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:187
+ 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:148
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:149
#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:161
int num_emails
Number of Emails the event applies to.
Definition: email.h:162
struct Email ** emails
Emails affected by the event.
Definition: email.h:163
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 879 of file keymap.c.

880{
881 if (nc->event_type != NT_CONFIG)
882 return 0;
883 if (!nc->event_data)
884 return -1;
885
886 struct EventConfig *ev_c = nc->event_data;
887
888 if (!mutt_str_equal(ev_c->name, "abort_key"))
889 return 0;
890
892 mutt_debug(LL_DEBUG5, "config done\n");
893 return 0;
894}
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: keymap.c:857
+ 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:49
+ 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:74
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 288 of file mutt_logging.c.

289{
290 if (nc->event_type != NT_CONFIG)
291 return 0;
292 if (!nc->event_data)
293 return -1;
294
295 struct EventConfig *ev_c = nc->event_data;
296
297 if (mutt_str_equal(ev_c->name, "debug_file"))
298 {
299 const char *const c_debug_file = cs_subset_path(NeoMutt->sub, "debug_file");
300 mutt_log_set_file(c_debug_file);
301 }
302 else if (mutt_str_equal(ev_c->name, "debug_level"))
303 {
304 const short c_debug_level = cs_subset_number(NeoMutt->sub, "debug_level");
305 mutt_log_set_level(c_debug_level, true);
306 }
307 else
308 {
309 return 0;
310 }
311
312 mutt_debug(LL_DEBUG5, "log done\n");
313 return 0;
314}
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:229
int mutt_log_set_file(const char *file)
Change the logging file.
Definition: mutt_logging.c:198
+ 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:177
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:176
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:178
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:708
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 602 of file dlg_gpgme.c.

603{
604 if (nc->event_type != NT_CONFIG)
605 return 0;
606 if (!nc->global_data || !nc->event_data)
607 return -1;
608
609 struct EventConfig *ev_c = nc->event_data;
610
611 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
612 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
613 {
614 return 0;
615 }
616
617 struct Menu *menu = nc->global_data;
619 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
620
621 return 0;
622}
+ 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 631 of file dlg_gpgme.c.

632{
633 if (nc->event_type != NT_WINDOW)
634 return 0;
635 if (!nc->global_data || !nc->event_data)
636 return -1;
638 return 0;
639
640 struct MuttWindow *win_menu = nc->global_data;
641 struct EventWindow *ev_w = nc->event_data;
642 if (ev_w->win != win_menu)
643 return 0;
644
645 struct Menu *menu = win_menu->wdata;
646
649
650 mutt_debug(LL_DEBUG5, "window delete done\n");
651 return 0;
652}
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:602
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:631
+ 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 527 of file dlg_pgp.c.

528{
529 if (nc->event_type != NT_CONFIG)
530 return 0;
531 if (!nc->global_data || !nc->event_data)
532 return -1;
533
534 struct EventConfig *ev_c = nc->event_data;
535
536 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
537 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
538 {
539 return 0;
540 }
541
542 struct Menu *menu = nc->global_data;
544 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
545
546 return 0;
547}
+ 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 556 of file dlg_pgp.c.

557{
558 if (nc->event_type != NT_WINDOW)
559 return 0;
560 if (!nc->global_data || !nc->event_data)
561 return -1;
563 return 0;
564
565 struct MuttWindow *win_menu = nc->global_data;
566 struct EventWindow *ev_w = nc->event_data;
567 if (ev_w->win != win_menu)
568 return 0;
569
570 struct Menu *menu = win_menu->wdata;
571
574
575 mutt_debug(LL_DEBUG5, "window delete done\n");
576 return 0;
577}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:556
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:527
+ 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:58
#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 if (!priv)
321 return 0;
322
323 if ((priv->redraw & PAGER_REDRAW_FLOW) && (priv->pview->flags & MUTT_PAGER_RETWINCH))
324 {
325 priv->rc = OP_REFORMAT_WINCH;
326 }
327
328 return 0;
329}
#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
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 334 of file pager.c.

335{
336 if (nc->event_type != NT_INDEX)
337 return 0;
338 if (!nc->global_data)
339 return -1;
340
341 struct MuttWindow *win_pager = nc->global_data;
342
343 struct PagerPrivateData *priv = win_pager->wdata;
344 if (!priv)
345 return 0;
346
347 struct IndexSharedData *shared = nc->event_data;
348
350 {
351 win_pager->actions |= WA_RECALC;
352 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
353 priv->loop = PAGER_LOOP_QUIT;
354 }
355 else if (nc->event_subtype & NT_INDEX_EMAIL)
356 {
357 win_pager->actions |= WA_RECALC;
358 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
359 priv->pager_redraw = true;
360 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
361 {
362 priv->loop = PAGER_LOOP_RELOAD;
363 }
364 else
365 {
366 priv->loop = PAGER_LOOP_QUIT;
367 priv->rc = 0;
368 }
369 }
370
371 return 0;
372}
#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 377 of file pager.c.

378{
379 if (nc->event_type != NT_PAGER)
380 return 0;
381 if (!nc->global_data || !nc->event_data)
382 return -1;
383
384 mutt_debug(LL_DEBUG5, "pager done\n");
385 return 0;
386}
@ 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 391 of file pager.c.

392{
393 if (nc->event_type != NT_WINDOW)
394 return 0;
395 if (!nc->global_data || !nc->event_data)
396 return -1;
398 return 0;
399
400 struct MuttWindow *win_pager = nc->global_data;
401 struct EventWindow *ev_w = nc->event_data;
402 if (ev_w->win != win_pager)
403 return 0;
404
405 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
406 if (!dlg)
407 dlg = window_find_parent(win_pager, WT_DLG_DO_PAGER);
408
409 struct IndexSharedData *shared = dlg->wdata;
410
417
418 mutt_debug(LL_DEBUG5, "window delete done\n");
419
420 return 0;
421}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:377
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:334
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:391
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 115 of file dlg_postpone.c.

116{
117 if (nc->event_type != NT_CONFIG)
118 return 0;
119 if (!nc->global_data || !nc->event_data)
120 return -1;
121
122 struct EventConfig *ev_c = nc->event_data;
123
124 if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
125 return 0;
126
127 struct Menu *menu = nc->global_data;
129 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
130
131 return 0;
132}
+ 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 141 of file dlg_postpone.c.

142{
143 if (nc->event_type != NT_WINDOW)
144 return 0;
145 if (!nc->global_data || !nc->event_data)
146 return -1;
148 return 0;
149
150 struct MuttWindow *win_menu = nc->global_data;
151 struct EventWindow *ev_w = nc->event_data;
152 if (ev_w->win != win_menu)
153 return 0;
154
155 struct Menu *menu = win_menu->wdata;
156
159
160 mutt_debug(LL_DEBUG5, "window delete done\n");
161 return 0;
162}
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:141
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:115
+ 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 179 of file observer.c.

180{
181 if (nc->event_type != NT_ACCOUNT)
182 return 0;
183 if (!nc->global_data || !nc->event_data)
184 return -1;
186 return 0;
187
188 struct MuttWindow *win = nc->global_data;
190 struct EventAccount *ev_a = nc->event_data;
191
192 struct MailboxNode *np = NULL;
193 STAILQ_FOREACH(np, &ev_a->account->mailboxes, entries)
194 {
195 sb_add_mailbox(wdata, np->mailbox);
196 }
197
198 win->actions |= WA_RECALC;
199 mutt_debug(LL_DEBUG5, "account done, request WA_RECALC\n");
200 return 0;
201}
#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:83
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:153
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
Sidebar private Window data -.
Definition: private.h:65
struct MuttWindow * win
Sidebar Window.
Definition: private.h:66
+ 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 206 of file observer.c.

207{
208 if (nc->event_type != NT_COLOR)
209 return 0;
210 if (!nc->global_data || !nc->event_data)
211 return -1;
212
213 struct EventColor *ev_c = nc->event_data;
214 struct MuttWindow *win = nc->global_data;
215
216 enum ColorId cid = ev_c->cid;
217
218 switch (cid)
219 {
221 case MT_COLOR_NORMAL:
230 case MT_COLOR_MAX: // Sent on `uncolor *`
231 win->actions |= WA_REPAINT;
232 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
233 break;
234
235 default:
236 break;
237 }
238 return 0;
239}
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:61
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:65
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:68
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:67
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:66
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:64
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:63
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:62
+ 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 244 of file observer.c.

245{
246 if (nc->event_type != NT_COMMAND)
247 return 0;
248 if (!nc->global_data || !nc->event_data)
249 return -1;
250
251 struct Command *cmd = nc->event_data;
252
253 if ((cmd->parse != sb_parse_whitelist) && (cmd->parse != sb_parse_unwhitelist))
254 return 0;
255
256 struct MuttWindow *win = nc->global_data;
257 win->actions |= WA_RECALC;
258 mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
259 return 0;
260}
enum CommandResult sb_parse_whitelist(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_whitelist' command - Implements Command::parse() -.
Definition: commands.c:41
enum CommandResult sb_parse_unwhitelist(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsidebar_whitelist' command - Implements Command::parse() -.
Definition: commands.c:60
@ 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:63
+ 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 265 of file observer.c.

266{
267 if (nc->event_type != NT_CONFIG)
268 return 0;
269 if (!nc->global_data || !nc->event_data)
270 return -1;
271
272 struct EventConfig *ev_c = nc->event_data;
273
274 if (!mutt_strn_equal(ev_c->name, "sidebar_", 8) &&
275 !mutt_str_equal(ev_c->name, "ascii_chars") &&
276 !mutt_str_equal(ev_c->name, "folder") && !mutt_str_equal(ev_c->name, "spool_file"))
277 {
278 return 0;
279 }
280
281 if (mutt_str_equal(ev_c->name, "sidebar_next_new_wrap"))
282 return 0; // Affects the behaviour, but not the display
283
284 mutt_debug(LL_DEBUG5, "config: %s\n", ev_c->name);
285
286 struct MuttWindow *win = nc->global_data;
287
288 if (mutt_str_equal(ev_c->name, "sidebar_visible"))
289 {
290 const bool c_sidebar_visible = cs_subset_bool(NeoMutt->sub, "sidebar_visible");
291 window_set_visible(win, c_sidebar_visible);
292 window_reflow(win->parent);
293 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
294 return 0;
295 }
296
297 if (mutt_str_equal(ev_c->name, "sidebar_width"))
298 {
299 const short c_sidebar_width = cs_subset_number(NeoMutt->sub, "sidebar_width");
300 win->req_cols = c_sidebar_width;
301 window_reflow(win->parent);
302 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
303 return 0;
304 }
305
306 if (mutt_str_equal(ev_c->name, "spool_file"))
307 {
308 win->actions |= WA_REPAINT;
309 mutt_debug(LL_DEBUG5, "config done, request WA_REPAINT\n");
310 return 0;
311 }
312
313 if (mutt_str_equal(ev_c->name, "sidebar_on_right"))
314 {
315 struct MuttWindow *parent = win->parent;
316 struct MuttWindow *first = TAILQ_FIRST(&parent->children);
317 const bool c_sidebar_on_right = cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
318
319 if ((c_sidebar_on_right && (first == win)) || (!c_sidebar_on_right && (first != win)))
320 {
321 // Swap the Sidebar and the Container of the Index/Pager
322 TAILQ_REMOVE(&parent->children, first, entries);
323 TAILQ_INSERT_TAIL(&parent->children, first, entries);
324 }
325
326 window_reflow(win->parent);
327 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
328 return 0;
329 }
330
331 if (mutt_str_equal(ev_c->name, "ascii_chars") ||
332 mutt_str_equal(ev_c->name, "sidebar_divider_char"))
333 {
335 if (calc_divider(wdata))
336 {
338 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
339 }
340 return 0;
341 }
342
343 // All the remaining config changes...
345 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
346 return 0;
347}
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:164
#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 352 of file observer.c.

353{
354 if (nc->event_type != NT_INDEX)
355 return 0;
356 if (!nc->global_data || !nc->event_data)
357 return 0;
358 if (!(nc->event_subtype & NT_INDEX_MAILBOX))
359 return 0;
360
361 struct MuttWindow *win_sidebar = nc->global_data;
362 struct IndexSharedData *shared = nc->event_data;
363
364 struct SidebarWindowData *wdata = sb_wdata_get(win_sidebar);
366
367 win_sidebar->actions |= WA_RECALC;
368 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
369
370 return 0;
371}
void sb_set_current_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Set the current Mailbox.
Definition: sidebar.c:173
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:67
+ 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 376 of file observer.c.

377{
378 if (nc->event_type != NT_MAILBOX)
379 return 0;
380 if (!nc->global_data || !nc->event_data)
381 return -1;
382
383 struct MuttWindow *win = nc->global_data;
384
386 struct EventMailbox *ev_m = nc->event_data;
387
388 if (nc->event_subtype == NT_MAILBOX_ADD)
389 {
390 sb_add_mailbox(wdata, ev_m->mailbox);
391 }
392 else if (nc->event_subtype == NT_MAILBOX_DELETE)
393 {
394 sb_remove_mailbox(wdata, ev_m->mailbox);
395 }
396
397 win->actions |= WA_RECALC;
398 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC\n");
399 return 0;
400}
void sb_remove_mailbox(struct SidebarWindowData *wdata, const struct Mailbox *m)
Remove a Mailbox from the Sidebar.
Definition: sidebar.c:120
+ 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 405 of file observer.c.

406{
407 if (nc->event_type != NT_WINDOW)
408 return 0;
409 if (!nc->global_data || !nc->event_data)
410 return -1;
411
412 struct MuttWindow *win = nc->global_data;
413 struct EventWindow *ev_w = nc->event_data;
414 if (ev_w->win != win)
415 return 0;
416
418 {
420 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
421 }
422 else if (nc->event_subtype == NT_WINDOW_DELETE)
423 {
424 mutt_debug(LL_DEBUG5, "window delete done\n");
426 }
427 return 0;
428}
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition: observer.c:454
+ 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 473 of file observer.c.

474{
475 if (nc->event_type != NT_WINDOW)
476 return 0;
477 if (!nc->event_data)
478 return -1;
480 return 0;
481
482 struct EventWindow *ev_w = nc->event_data;
483 if (ev_w->win->type != WT_DLG_INDEX)
484 return 0;
485
486 if (ev_w->flags & WN_VISIBLE)
487 {
488 mutt_debug(LL_DEBUG5, "insertion: visible\n");
489 struct MuttWindow *win_sidebar = sb_win_init(ev_w->win);
490 sb_init_data(win_sidebar);
491 }
492 else if (ev_w->flags & WN_HIDDEN)
493 {
494 mutt_debug(LL_DEBUG5, "insertion: hidden\n");
496 }
497
498 return 0;
499}
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
Definition: mutt_window.h:208
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:192
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:193
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition: observer.c:100
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition: observer.c:156
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:218
+ Here is the call graph for this function:
+ Here is the caller graph for this function: