NeoMutt  2024-02-01-23-g345d7b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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 -.
 
static int alias_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int query_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int attach_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int attach_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 -.
 
static int autocrypt_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int browser_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int browser_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int browser_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int attach_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
int cbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
int cbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int cbar_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int cbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int compose_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int compose_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -.
 
static int compose_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int cc_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int env_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int env_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int env_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int env_header_observer (struct NotifyCallback *nc)
 Notification that a User Header has changed - Implements observer_t -.
 
static int env_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int alldialogs_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int msgwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int rootwin_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int rootwin_resize_observer (struct NotifyCallback *nc)
 Notification that the terminal has been resized - Implements observer_t -.
 
static int rootwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int helpbar_binding_observer (struct NotifyCallback *nc)
 Notification that a Key Binding has changed - Implements observer_t -.
 
static int helpbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int helpbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int helpbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has change - Implements observer_t -.
 
static int imap_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int ibar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int ibar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ibar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int ibar_menu_observer (struct NotifyCallback *nc)
 Notification that a Menu has changed - Implements observer_t -.
 
static int ibar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_altern_observer (struct NotifyCallback *nc)
 Notification that an 'alternates' command has occurred - Implements observer_t -.
 
static int index_attach_observer (struct NotifyCallback *nc)
 Notification that an 'attachments' command has occurred - Implements observer_t -.
 
static int index_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int index_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int index_global_observer (struct NotifyCallback *nc)
 Notification that a Global event occurred - Implements observer_t -.
 
static int index_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int index_menu_observer (struct NotifyCallback *nc)
 Notification that the Menu has changed - Implements observer_t -.
 
static int index_score_observer (struct NotifyCallback *nc)
 Notification that a 'score' command has occurred - Implements observer_t -.
 
static int index_subjrx_observer (struct NotifyCallback *nc)
 Notification that a 'subjectrx' command has occurred - Implements observer_t -.
 
static int index_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ipanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ipanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_shared_mview_observer (struct NotifyCallback *nc)
 Notification that the MailboxView has changed - Implements observer_t -.
 
static int index_shared_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int index_shared_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int index_shared_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -.
 
int main_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
int main_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int remailer_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int remailer_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
int mview_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int dopager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int dopager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pager_global_observer (struct NotifyCallback *nc)
 Notification that a Global Event occurred - Implements observer_t -.
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pbar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pbar_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ppanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ppanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pattern_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pattern_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int postponed_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int postponed_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sb_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int sb_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sb_command_observer (struct NotifyCallback *nc)
 Notification that a Command has occurred - Implements observer_t -.
 
static int sb_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int sb_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int sb_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int sb_insertion_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 

Detailed Description

Prototype for a notification callback function.

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

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 212 of file dlg_alias.c.

213{
214 if (nc->event_type != NT_ALIAS)
215 return 0;
216 if (!nc->global_data || !nc->event_data)
217 return -1;
218
219 struct EventAlias *ev_a = nc->event_data;
220 struct Menu *menu = nc->global_data;
221 struct AliasMenuData *mdata = menu->mdata;
222 struct Alias *alias = ev_a->alias;
223
224 if (nc->event_subtype == NT_ALIAS_ADD)
225 {
226 alias_array_alias_add(&mdata->ava, alias);
227
228 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
229 {
230 mutt_pattern_alias_func(NULL, mdata, menu);
231 }
232 }
233 else if (nc->event_subtype == NT_ALIAS_DELETE)
234 {
235 alias_array_alias_delete(&mdata->ava, alias);
236
237 int vcount = alias_array_count_visible(&mdata->ava);
238 int index = menu_get_index(menu);
239 if ((index > (vcount - 1)) && (index > 0))
240 menu_set_index(menu, index - 1);
241 }
242
243 alias_array_sort(&mdata->ava, mdata->sub);
244
245 menu->max = alias_array_count_visible(&mdata->ava);
247 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
248
249 return 0;
250}
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:168
@ NT_ALIAS_ADD
Alias has been added.
Definition: alias.h:56
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:57
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:87
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
#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:183
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:159
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:173
@ 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:190
AliasView array wrapper with Pattern information -.
Definition: gui.h:54
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:55
struct Menu * menu
Menu.
Definition: gui.h:58
struct ConfigSubset * sub
Config items.
Definition: gui.h:57
A shortcut for an email address or addresses.
Definition: alias.h:35
An alias-change event.
Definition: alias.h:66
struct Alias * alias
Alias that changed.
Definition: alias.h:67
Definition: lib.h:69
void * mdata
Private data.
Definition: lib.h:135
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 259 of file dlg_alias.c.

260{
261 if (nc->event_type != NT_WINDOW)
262 return 0;
263 if (!nc->global_data || !nc->event_data)
264 return -1;
266 return 0;
267
268 struct MuttWindow *win_menu = nc->global_data;
269 struct EventWindow *ev_w = nc->event_data;
270 if (ev_w->win != win_menu)
271 return 0;
272
273 struct Menu *menu = win_menu->wdata;
274
278
279 mutt_debug(LL_DEBUG5, "window delete done\n");
280 return 0;
281}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:259
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:212
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:230
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
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:41
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ 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 336 of file dlg_query.c.

337{
338 if (nc->event_type != NT_WINDOW)
339 return 0;
340 if (!nc->global_data || !nc->event_data)
341 return -1;
343 return 0;
344
345 struct MuttWindow *win_menu = nc->global_data;
346 struct EventWindow *ev_w = nc->event_data;
347 if (ev_w->win != win_menu)
348 return 0;
349
350 struct Menu *menu = win_menu->wdata;
351
354
355 mutt_debug(LL_DEBUG5, "window delete done\n");
356 return 0;
357}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:336
+ 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:709
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
+ 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 109 of file dlg_attach.c.

110{
111 if (nc->event_type != NT_CONFIG)
112 return 0;
113 if (!nc->global_data || !nc->event_data)
114 return -1;
115
116 struct EventConfig *ev_c = nc->event_data;
117
118 if (!mutt_str_equal(ev_c->name, "attach_format") && !mutt_str_equal(ev_c->name, "message_format"))
119 return 0;
120
121 struct Menu *menu = nc->global_data;
123 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
124
125 return 0;
126}
+ 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 439 of file dlg_attach.c.

440{
441 if (nc->event_type != NT_WINDOW)
442 return 0;
443 if (!nc->global_data || !nc->event_data)
444 return -1;
446 return 0;
447
448 struct MuttWindow *win_menu = nc->global_data;
449 struct EventWindow *ev_w = nc->event_data;
450 if (ev_w->win != win_menu)
451 return 0;
452
453 struct Menu *menu = win_menu->wdata;
454
457
458 mutt_debug(LL_DEBUG5, "window delete done\n");
459 return 0;
460}
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_attach.c:109
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_attach.c:439
+ 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 1091 of file dlg_browser.c.

1092{
1093 if (nc->event_type != NT_CONFIG)
1094 return 0;
1095 if (!nc->global_data || !nc->event_data)
1096 return -1;
1097
1098 struct EventConfig *ev_c = nc->event_data;
1099
1100 struct BrowserPrivateData *priv = nc->global_data;
1101 struct Menu *menu = priv->menu;
1102
1103 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
1104 {
1105 struct BrowserState *state = menu->mdata;
1106 browser_sort(state);
1107 browser_highlight_default(state, menu);
1108 }
1109 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1110 !mutt_str_equal(ev_c->name, "date_format") &&
1111 !mutt_str_equal(ev_c->name, "folder") &&
1112 !mutt_str_equal(ev_c->name, "folder_format") &&
1113 !mutt_str_equal(ev_c->name, "group_index_format") &&
1114 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1115 !mutt_str_equal(ev_c->name, "sort_browser"))
1116 {
1117 return 0;
1118 }
1119
1121 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1122
1123 return 0;
1124}
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:186
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: dlg_browser.c:940
Private state data for the Browser.
Definition: private_data.h:34
struct Menu * menu
Menu.
Definition: private_data.h:43
State of the file/mailbox browser.
Definition: lib.h:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_mailbox_observer()

static int browser_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Find the matching Mailbox and update its details.

Definition at line 1131 of file dlg_browser.c.

1132{
1133 if (nc->event_type != NT_MAILBOX)
1134 return 0;
1136 return 0;
1137 if (!nc->global_data || !nc->event_data)
1138 return -1;
1139
1140 struct BrowserPrivateData *priv = nc->global_data;
1141
1142 struct BrowserState *state = &priv->state;
1143 if (state->is_mailbox_list)
1144 {
1145 struct EventMailbox *ev_m = nc->event_data;
1146 struct Mailbox *m = ev_m->mailbox;
1147 struct FolderFile *ff = NULL;
1148 ARRAY_FOREACH(ff, &state->entry)
1149 {
1150 if (ff->gen != m->gen)
1151 continue;
1152
1153 ff->has_new_mail = m->has_new;
1154 ff->msg_count = m->msg_count;
1155 ff->msg_unread = m->msg_unread;
1156 ff->notify_user = m->notify_user;
1158 mutt_str_replace(&ff->desc, m->name);
1159 break;
1160 }
1161 }
1162
1164 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
1165
1166 return 0;
1167}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:171
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:329
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:49
struct BrowserState state
State containing list of files/dir/mailboxes.
Definition: private_data.h:42
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:118
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:115
An Event that happened to a Mailbox.
Definition: mailbox.h:187
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:188
Browser entry representing a folder/dir.
Definition: lib.h:78
bool has_new_mail
true if mailbox has "new mail"
Definition: lib.h:89
bool poll_new_mail
Check mailbox for new mail.
Definition: lib.h:101
bool notify_user
User will be notified of new mail.
Definition: lib.h:100
char * desc
Description of mailbox.
Definition: lib.h:87
int gen
Unique id, used for (un)sorting.
Definition: lib.h:105
int msg_count
total number of messages
Definition: lib.h:90
int msg_unread
number of unread messages
Definition: lib.h:91
A mailbox.
Definition: mailbox.h:79
bool has_new
Mailbox has new mail.
Definition: mailbox.h:85
int msg_count
Total number of messages.
Definition: mailbox.h:88
bool poll_new_mail
Check for new mail.
Definition: mailbox.h:115
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
bool notify_user
Notify the user of new mail.
Definition: mailbox.h:113
int msg_unread
Number of unread messages.
Definition: mailbox.h:89
int gen
Generation number, for sorting.
Definition: mailbox.h:147
+ 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 1176 of file dlg_browser.c.

1177{
1178 if (nc->event_type != NT_WINDOW)
1179 return 0;
1180 if (!nc->global_data || !nc->event_data)
1181 return -1;
1183 return 0;
1184
1185 struct BrowserPrivateData *priv = nc->global_data;
1186 struct MuttWindow *win_menu = priv->menu->win;
1187
1188 struct EventWindow *ev_w = nc->event_data;
1189 if (ev_w->win != win_menu)
1190 return 0;
1191
1195
1196 mutt_debug(LL_DEBUG5, "window delete done\n");
1197 return 0;
1198}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:1091
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1131
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1176
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
+ 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:156
#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 205 of file cbar.c.

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

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

◆ cbar_email_observer()

static int cbar_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 252 of file cbar.c.

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

◆ cbar_window_observer()

static int cbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 269 of file cbar.c.

270{
271 if (nc->event_type != NT_WINDOW)
272 return 0;
273 if (!nc->global_data || !nc->event_data)
274 return -1;
275
276 struct MuttWindow *win_cbar = nc->global_data;
277 struct EventWindow *ev_w = nc->event_data;
278 if (ev_w->win != win_cbar)
279 return 0;
280
282 {
283 win_cbar->actions |= WA_RECALC;
284 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
285 }
286 else if (nc->event_subtype == NT_WINDOW_DELETE)
287 {
288 struct MuttWindow *dlg = win_cbar->parent;
289 struct ComposeSharedData *shared = dlg->wdata;
290
295
296 mutt_debug(LL_DEBUG5, "window delete done\n");
297 }
298
299 return 0;
300}
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: notify.c:69
int cbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: cbar.c:205
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: cbar.c:231
static int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: cbar.c:269
static int cbar_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: cbar.c:252
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:230
Shared Compose Data.
Definition: shared_data.h:35
struct Email * email
Email being composed.
Definition: shared_data.h:38
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:73
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 125 of file dlg_compose.c.

126{
127 if (nc->event_type != NT_CONFIG)
128 return 0;
129 if (!nc->global_data || !nc->event_data)
130 return -1;
131
132 struct EventConfig *ev_c = nc->event_data;
133 struct MuttWindow *dlg = nc->global_data;
134
135 if (!mutt_str_equal(ev_c->name, "status_on_top"))
136 return 0;
137
139 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
140 return 0;
141}
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:784
+ 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 146 of file dlg_compose.c.

147{
148 if (nc->event_type != NT_ENVELOPE)
149 return 0;
150 if (!nc->global_data || !nc->event_data)
151 return -1;
152
153 struct ComposeSharedData *shared = nc->global_data;
154
156 shared->fcc_set = true;
157
159 return 0;
160}
@ NT_ENVELOPE_FCC
"Fcc:" header has changed
Definition: envelope.h:105
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:671
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:48
@ NT_ENVELOPE
Envelope has changed, NotifyEnvelope.
Definition: notify_type.h:45
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:37
bool fcc_set
User has edited the Fcc: field.
Definition: shared_data.h:44
+ 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 165 of file dlg_compose.c.

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

◆ cc_config_observer()

static int cc_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 50 of file config_cache.c.

51{
52 if (nc->event_type != NT_CONFIG)
53 return 0; // LCOV_EXCL_LINE
54 if (!nc->event_data)
55 return -1; // LCOV_EXCL_LINE
56
57 struct EventConfig *ev_c = nc->event_data;
58 if (!ev_c->name || !ev_c->he)
59 return 0; // LCOV_EXCL_LINE
60
61 if (mutt_str_equal(ev_c->name, "assumed_charset"))
62 {
64 ev_c->he, NULL);
65 }
66 else if (mutt_str_equal(ev_c->name, "charset"))
67 {
68 CachedCharset = (const char *) cs_subset_he_native_get(ev_c->sub, ev_c->he, NULL);
69 }
70 else if (mutt_str_equal(ev_c->name, "maildir_field_delimiter"))
71 {
73 ev_c->he, NULL);
74 }
75
76 mutt_debug(LL_DEBUG5, "config done\n");
77 return 0;
78}
static const char * CachedMaildirFieldDelimiter
Cached value of $maildir_field_delimiter.
Definition: config_cache.c:45
static const struct Slist * CachedAssumedCharset
Cached value of $assumed_charset.
Definition: config_cache.c:41
static const char * CachedCharset
Cached value of $charset.
Definition: config_cache.c:43
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:72
struct HashElem * he
Config item that changed.
Definition: subset.h:74
String list.
Definition: slist.h:37
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: subset.c:258
+ 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 803 of file window.c.

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

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

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

◆ env_header_observer()

static int env_header_observer ( struct NotifyCallback nc)
static

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

Definition at line 916 of file window.c.

917{
918 if (nc->event_type != NT_HEADER)
919 return 0;
920 if (!nc->global_data || !nc->event_data)
921 return -1;
922
923 const struct EventHeader *ev_h = nc->event_data;
924 struct MuttWindow *win_env = nc->global_data;
925 struct EnvelopeWindowData *wdata = win_env->wdata;
926
927 struct Envelope *env = wdata->email->env;
928
930 {
931 header_set(&env->userhdrs, ev_h->header);
932 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
933 win_env->actions |= WA_RECALC;
934 return 0;
935 }
936
938 {
939 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
940 if (removed)
941 {
942 header_free(&env->userhdrs, removed);
943 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
944 win_env->actions |= WA_RECALC;
945 }
946 return 0;
947 }
948
949 return 0;
950}
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:208
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:196
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:143
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:178
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:176
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:177
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:47
struct Envelope * env
Envelope information.
Definition: email.h:68
struct Email * email
Email being composed.
Definition: wdata.h:40
The header of an Email.
Definition: envelope.h:57
struct ListHead userhdrs
user defined headers
Definition: envelope.h:85
An event that happened to a header.
Definition: email.h:185
char * header
The contents of the header.
Definition: email.h:186
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 955 of file window.c.

956{
957 if (nc->event_type != NT_WINDOW)
958 return 0;
959 if (!nc->global_data || !nc->event_data)
960 return -1;
961
962 struct MuttWindow *win_env = nc->global_data;
963 struct EventWindow *ev_w = nc->event_data;
964 if (ev_w->win != win_env)
965 return 0;
966
968 {
969 win_env->actions |= WA_RECALC;
970 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
971 }
972 else if (nc->event_subtype == NT_WINDOW_DELETE)
973 {
974 struct EnvelopeWindowData *wdata = win_env->wdata;
975
981 mutt_debug(LL_DEBUG5, "window delete done\n");
982 }
983
984 return 0;
985}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:892
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:803
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:955
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:839
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:916
+ 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 183 of file dialog.c.

184{
185 if (nc->event_type != NT_WINDOW)
186 return 0;
187 if (!nc->global_data || !nc->event_data)
188 return -1;
190 return 0;
191
192 struct MuttWindow *win_alldlgs = nc->global_data;
193 struct EventWindow *ev_w = nc->event_data;
194 if (ev_w->win != win_alldlgs)
195 return 0;
196
197 notify_observer_remove(win_alldlgs->notify, alldialogs_window_observer, win_alldlgs);
198
199 AllDialogsWindow = NULL;
200 mutt_debug(LL_DEBUG5, "window delete done\n");
201 return 0;
202}
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:80
static int alldialogs_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dialog.c:183
+ 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 327 of file msgwin.c.

328{
329 if (nc->event_type != NT_WINDOW)
330 return 0;
331 if (!nc->global_data || !nc->event_data)
332 return -1;
333
334 struct MuttWindow *win = nc->global_data;
335 struct EventWindow *ev_w = nc->event_data;
336 if (ev_w->win != win)
337 return 0;
338
340 {
341 if (ev_w->flags & WN_HIDDEN)
342 {
344 }
345
346 if (ev_w->flags & (WN_NARROWER | WN_WIDER))
347 {
348 struct MsgWinWindowData *wdata = win->wdata;
350 buf_string(wdata->text)));
351 win->actions |= WA_RECALC;
352 }
353 else
354 {
355 win->actions |= WA_REPAINT;
356 }
357 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
358 }
359 else if (nc->event_subtype == NT_WINDOW_DELETE)
360 {
362 mutt_debug(LL_DEBUG5, "window delete done\n");
363 }
364 return 0;
365}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:97
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: msgwin.c:327
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition: msgwin.c:516
int msgwin_calc_rows(struct MsgWinWindowData *wdata, int cols, const char *str)
How many rows will a string need?
Definition: msgwin.c:178
void msgwin_set_rows(struct MuttWindow *win, short rows)
Resize the Message Window.
Definition: msgwin.c:303
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:212
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:216
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:213
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:241
Message Window private Window data.
Definition: msgwin_wdata.h:66
struct Buffer * text
Cached display string.
Definition: msgwin_wdata.h:67
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
+ 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 113 of file rootwin.c.

114{
115 if (nc->event_type != NT_CONFIG)
116 return 0;
117 if (!nc->global_data || !nc->event_data)
118 return -1;
119
120 struct EventConfig *ev_c = nc->event_data;
121 struct MuttWindow *win_root = nc->global_data;
122
123 if (!mutt_str_equal(ev_c->name, "status_on_top"))
124 return 0;
125
126 struct MuttWindow *first = TAILQ_FIRST(&win_root->children);
127 if (!first)
128 return 0;
129
130 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
131 if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
132 (!c_status_on_top && (first->type != WT_HELP_BAR)))
133 {
134 // Swap the HelpBar and the AllDialogsWindow
135 struct MuttWindow *next = TAILQ_NEXT(first, entries);
136 if (!next)
137 return 0;
138 TAILQ_REMOVE(&win_root->children, next, entries);
139 TAILQ_INSERT_HEAD(&win_root->children, next, entries);
140
141 mutt_window_reflow(win_root);
142 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
143 }
144
145 return 0;
146}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:344
@ 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_resize_observer()

static int rootwin_resize_observer ( struct NotifyCallback nc)
static

Notification that the terminal has been resized - Implements observer_t -.

This function is triggered by SIGWINCH.

Definition at line 153 of file rootwin.c.

154{
155 if (nc->event_type != NT_RESIZE)
156 return 0;
157 if (!nc->global_data)
158 return -1;
159
162
163 mutt_debug(LL_DEBUG5, "window resize done\n");
164 return 0;
165}
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
@ NT_RESIZE
Window has been resized.
Definition: notify_type.h:52
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:75
+ 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 174 of file rootwin.c.

175{
176 if (nc->event_type != NT_WINDOW)
177 return 0;
178 if (!nc->global_data || !nc->event_data)
179 return -1;
181 return 0;
182
183 struct MuttWindow *win_root = nc->global_data;
184 struct EventWindow *ev_w = nc->event_data;
185 if (ev_w->win != win_root)
186 return 0;
187
189 if (NeoMutt)
190 {
193 }
194
195 mutt_debug(LL_DEBUG5, "window delete done\n");
196 return 0;
197}
static int rootwin_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: rootwin.c:113
static int rootwin_resize_observer(struct NotifyCallback *nc)
Notification that the terminal has been resized - Implements observer_t -.
Definition: rootwin.c:153
static int rootwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: rootwin.c:174
struct Notify * notify_resize
Window resize notifications handler.
Definition: neomutt.h:43
+ 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 116 of file sbar.c.

117{
118 if (nc->event_type != NT_COLOR)
119 return 0;
120 if (!nc->global_data)
121 return -1;
122
123 struct EventColor *ev_c = nc->event_data;
124
125 // MT_COLOR_MAX is sent on `uncolor *`
126 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
127 (ev_c->cid != MT_COLOR_MAX))
128 {
129 return 0;
130 }
131
132 struct MuttWindow *win_sbar = nc->global_data;
133
134 win_sbar->actions |= WA_REPAINT;
135 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
136
137 return 0;
138}
+ 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 148 of file sbar.c.

149{
150 if (nc->event_type != NT_WINDOW)
151 return 0;
152 if (!nc->global_data || !nc->event_data)
153 return -1;
154
155 struct MuttWindow *win_sbar = nc->global_data;
156 struct EventWindow *ev_w = nc->event_data;
157 if (ev_w->win != win_sbar)
158 return 0;
159
161 {
162 win_sbar->actions |= WA_REPAINT;
163 mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
164 }
165 else if (nc->event_subtype == NT_WINDOW_DELETE)
166 {
169 mutt_debug(LL_DEBUG5, "window delete done\n");
170 }
171
172 return 0;
173}
static int sbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: sbar.c:116
static int sbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: sbar.c:148
+ 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 80 of file simple.c.

81{
82 if (nc->event_type != NT_CONFIG)
83 return 0;
84 if (!nc->global_data || !nc->event_data)
85 return -1;
86
87 struct EventConfig *ev_c = nc->event_data;
88 if (!mutt_str_equal(ev_c->name, "status_on_top"))
89 return 0;
90
91 struct MuttWindow *dlg = nc->global_data;
93 mutt_debug(LL_DEBUG5, "config done\n");
94 return 0;
95}
+ 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 104 of file simple.c.

105{
106 if (nc->event_type != NT_WINDOW)
107 return 0;
108 if (!nc->global_data || !nc->event_data)
109 return -1;
111 return 0;
112
113 struct MuttWindow *dlg = nc->global_data;
114 struct EventWindow *ev_w = nc->event_data;
115 if (ev_w->win != dlg)
116 return 0;
117
120
121 mutt_debug(LL_DEBUG5, "window delete done\n");
122 return 0;
123}
static int simple_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: simple.c:80
static int simple_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: simple.c:104
+ 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:64
@ NT_MACRO_ADD
Key macro has been added.
Definition: lib.h:138
@ NT_BINDING
Key binding has changed, NotifyBinding, EventBinding.
Definition: notify_type.h:40
A key binding Event.
Definition: lib.h:119
enum MenuType menu
Menu, e.g. MENU_PAGER.
Definition: lib.h:120
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}
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:512
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:232
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:106
+ 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 change - Implements observer_t -.

Definition at line 701 of file history.c.

702{
703 if (nc->event_type != NT_CONFIG)
704 return 0;
705 if (!nc->event_data)
706 return -1;
707
708 struct EventConfig *ev_c = nc->event_data;
709
710 if (!mutt_str_equal(ev_c->name, "history"))
711 return 0;
712
714 mutt_debug(LL_DEBUG5, "history done\n");
715 return 0;
716}
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition: history.c:469
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imap_timeout_observer()

static int imap_timeout_observer ( struct NotifyCallback nc)
static

Notification that a timeout has occurred - Implements observer_t -.

This function is triggered by SIGWINCH.

Definition at line 43 of file adata.c.

44{
45 if (nc->event_type != NT_TIMEOUT)
46 return 0;
47 if (!nc->global_data)
48 return -1;
49
50 struct ImapAccountData *adata = nc->global_data;
51 mutt_debug(LL_DEBUG5, "imap timeout start\n");
52
53 time_t now = mutt_date_now();
54 const short c_imap_keep_alive = cs_subset_number(NeoMutt->sub, "imap_keep_alive");
55
56 if ((adata->state >= IMAP_AUTHENTICATED) && (now >= (adata->lastread + c_imap_keep_alive)))
57 {
58 mutt_debug(LL_DEBUG5, "imap_keep_alive\n");
59 imap_check_mailbox(adata->mailbox, true);
60 }
61
62 mutt_debug(LL_DEBUG5, "imap timeout done\n");
63 return 0;
64}
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:144
@ IMAP_AUTHENTICATED
Connection is authenticated.
Definition: private.h:107
enum MxStatus imap_check_mailbox(struct Mailbox *m, bool force)
Use the NOOP or IDLE command to poll for new mail.
Definition: imap.c:1031
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:455
@ NT_TIMEOUT
Timeout has occurred.
Definition: notify_type.h:56
void * adata
Private data (for Mailbox backends)
Definition: account.h:42
IMAP-specific Account data -.
Definition: adata.h:40
+ 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 586 of file dlg_index.c.

587{
588 if (nc->event_type != NT_MAILBOX)
589 return 0;
590 if (!nc->global_data)
591 return -1;
593 return 0;
594
595 struct Mailbox **ptr = nc->global_data;
596 if (!*ptr)
597 return 0;
598
599 *ptr = NULL;
600 mutt_debug(LL_DEBUG5, "mailbox done\n");
601 return 0;
602}
+ 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 164 of file ibar.c.

165{
166 if (nc->event_type != NT_COLOR)
167 return 0;
168 if (!nc->global_data || !nc->event_data)
169 return -1;
170
171 struct EventColor *ev_c = nc->event_data;
172
173 // MT_COLOR_MAX is sent on `uncolor *`
174 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
175 (ev_c->cid != MT_COLOR_MAX))
176 {
177 return 0;
178 }
179
180 struct MuttWindow *win_ibar = nc->global_data;
181 win_ibar->actions |= WA_REPAINT;
182 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
183
184 return 0;
185}
+ 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 190 of file ibar.c.

191{
192 if (nc->event_type != NT_CONFIG)
193 return 0;
194 if (!nc->global_data || !nc->event_data)
195 return -1;
196
197 struct EventConfig *ev_c = nc->event_data;
198 if (!ev_c->name)
199 return 0;
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_ACCOUNT/NT_MVIEW/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:190
static int ibar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: ibar.c:164
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:558
@ WT_DLG_INDEX
Index Dialog, dlg_index()
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 222 of file index.c.

223{
224 if (nc->event_type != NT_ALTERN)
225 return 0;
226 if (!nc->global_data)
227 return -1;
228
229 struct MuttWindow *win = nc->global_data;
230 struct MuttWindow *dlg = dialog_find(win);
231 struct IndexSharedData *shared = dlg->wdata;
232
234 mutt_debug(LL_DEBUG5, "alternates done\n");
235 return 0;
236}
void mutt_alternates_reset(struct MailboxView *mv)
Clear the recipient valid flag of all emails.
Definition: alternates.c:73
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:89
@ NT_ALTERN
Alternates command changed, NotifyAlternates.
Definition: notify_type.h:38
struct MailboxView * mailbox_view
Current Mailbox view.
Definition: shared_data.h:40
+ 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 241 of file index.c.

242{
243 if (nc->event_type != NT_ATTACH)
244 return 0;
245 if (!nc->global_data)
246 return -1;
247
248 struct MuttWindow *win = nc->global_data;
249 struct MuttWindow *dlg = dialog_find(win);
250 struct IndexSharedData *shared = dlg->wdata;
251
253 mutt_debug(LL_DEBUG5, "attachments done\n");
254 return 0;
255}
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition: attachments.c:289
@ 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 260 of file index.c.

261{
262 if (nc->event_type != NT_COLOR)
263 return 0;
264 if (!nc->global_data || !nc->event_data)
265 return -1;
266
267 struct EventColor *ev_c = nc->event_data;
268
269 const int cid = ev_c->cid;
270
271 // MT_COLOR_MAX is sent on `uncolor *`
272 if (!((cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
278 (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_TREE)))
279 {
280 // The changes aren't relevant to the index menu
281 return 0;
282 }
283
284 struct MuttWindow *win = nc->global_data;
285 struct MuttWindow *dlg = dialog_find(win);
286 struct IndexSharedData *shared = dlg->wdata;
287
288 struct Mailbox *m = shared->mailbox;
289 if (!m)
290 return 0;
291
292 // Force re-caching of index colours
293 for (int i = 0; i < m->msg_count; i++)
294 {
295 struct Email *e = m->emails[i];
296 if (!e)
297 break;
298 e->attr_color = NULL;
299 }
300
301 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
302 struct IndexPrivateData *priv = panel_index->wdata;
303 struct Menu *menu = priv->menu;
304 menu->redraw = MENU_REDRAW_FULL;
306 mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
307
308 return 0;
309}
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:84
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:90
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:93
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:91
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:86
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:92
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:79
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:88
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:83
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:89
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:87
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:85
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
The envelope/body of an email.
Definition: email.h:39
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition: email.h:115
Private state data for the Index.
Definition: private_data.h:35
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:41
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
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 385 of file index.c.

386{
387 if (nc->event_type != NT_CONFIG)
388 return 0;
389 if (!nc->global_data || !nc->event_data)
390 return -1;
391
392 struct EventConfig *ev_c = nc->event_data;
393 if (!ev_c->name || !ev_c->he)
394 return 0;
395
396 struct MuttWindow *win = nc->global_data;
397
398 if (!config_check_sort(ev_c->name) && !config_check_index(ev_c->name))
399 return 0;
400
401 if (mutt_str_equal(ev_c->name, "reply_regex"))
402 {
403 struct MuttWindow *dlg = dialog_find(win);
404 struct IndexSharedData *shared = dlg->wdata;
406 mutt_debug(LL_DEBUG5, "config done\n");
407 }
408 else if (mutt_str_equal(ev_c->name, "sort"))
409 {
410 config_sort(ev_c->sub);
411 mutt_debug(LL_DEBUG5, "config done\n");
412 }
413 else if (mutt_str_equal(ev_c->name, "use_threads"))
414 {
415 config_use_threads(ev_c->sub);
416 mutt_debug(LL_DEBUG5, "config done\n");
417 }
418
420 return 0;
421}
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:112
static int config_reply_regex(struct MailboxView *mv)
React to changes to $reply_regex.
Definition: index.c:196
bool config_check_index(const char *option)
Does this config option affect the Index?
Definition: index.c:355
static bool config_check_sort(const char *option)
Does this config option affect the Index sorting?
Definition: index.c:316
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:160
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:56
+ 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 426 of file index.c.

427{
428 if (nc->event_type != NT_GLOBAL)
429 return 0;
430 if (!nc->global_data)
431 return -1;
433 return 0;
434
435 struct MuttWindow *win = nc->global_data;
436 struct MuttWindow *dlg = dialog_find(win);
437 if (!dlg)
438 return 0;
439
440 struct IndexSharedData *shared = dlg->wdata;
442
443 return 0;
444}
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:61
@ 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:67
+ 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 449 of file index.c.

450{
451 if (!nc->global_data)
452 return -1;
453
454 struct MuttWindow *win = nc->global_data;
455 win->actions |= WA_RECALC;
456
457 struct Menu *menu = win->wdata;
459 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
460
461 struct IndexPrivateData *priv = menu->mdata;
462 struct IndexSharedData *shared = priv->shared;
463 if (shared && shared->mailbox)
464 menu->max = shared->mailbox->vcount;
465 else
466 menu->max = 0;
467
468 return 0;
469}
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:40
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 474 of file index.c.

475{
476 if (nc->event_type != NT_MENU)
477 return 0;
478 if (!nc->global_data)
479 return -1;
480
481 struct MuttWindow *win = nc->global_data;
482 struct MuttWindow *dlg = dialog_find(win);
483 struct IndexSharedData *shared = dlg->wdata;
484 struct Menu *menu = win->wdata;
485
486 const int index = menu_get_index(menu);
487 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
489
490 return 0;
491}
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:235
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:418
int index
The absolute (unsorted) message number.
Definition: email.h:113
+ 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 496 of file index.c.

497{
498 if (nc->event_type != NT_SCORE)
499 return 0;
500 if (!nc->global_data)
501 return -1;
502
503 struct MuttWindow *win = nc->global_data;
504 struct MuttWindow *dlg = dialog_find(win);
505 struct IndexSharedData *shared = dlg->wdata;
506
507 struct Mailbox *m = shared->mailbox;
508 if (!m)
509 return 0;
510
511 for (int i = 0; i < m->msg_count; i++)
512 {
513 struct Email *e = m->emails[i];
514 if (!e)
515 break;
516
517 mutt_score_message(m, e, true);
518 e->attr_color = NULL; // Force recalc of colour
519 }
520
521 mutt_debug(LL_DEBUG5, "score done\n");
522 return 0;
523}
@ NT_SCORE
Email scoring has changed.
Definition: notify_type.h:54
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:164
+ 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 528 of file index.c.

529{
530 if (nc->event_type != NT_SUBJRX)
531 return 0;
532 if (!nc->global_data)
533 return -1;
534
535 struct MuttWindow *win = nc->global_data;
536 struct MuttWindow *dlg = dialog_find(win);
537 struct IndexSharedData *shared = dlg->wdata;
538
540 mutt_debug(LL_DEBUG5, "subjectrx done\n");
541 return 0;
542}
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:55
void subjrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition: subjectrx.c:148
+ 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 547 of file index.c.

548{
549 if (nc->event_type != NT_WINDOW)
550 return 0;
551 if (!nc->global_data || !nc->event_data)
552 return -1;
553
554 struct MuttWindow *win = nc->global_data;
555 struct Menu *menu = win->wdata;
557 {
560 return 0;
561 }
562
563 struct EventWindow *ev_w = nc->event_data;
564 if (ev_w->win != win)
565 return 0;
566
567 struct IndexPrivateData *priv = menu->mdata;
568
579
580 mutt_debug(LL_DEBUG5, "window delete done\n");
581 return 0;
582}
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:260
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:385
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: index.c:449
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:474
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:496
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:426
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:222
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:528
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:241
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:547
struct Notify * notify
Notifications.
Definition: lib.h:133
+ 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_mview_observer()

static int index_shared_mview_observer ( struct NotifyCallback nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 43 of file shared_data.c.

44{
45 if (nc->event_type != NT_MVIEW)
46 return 0;
47 if (!nc->global_data || !nc->event_data)
48 return -1;
49 if (nc->event_subtype == NT_MVIEW_ADD)
50 return 0;
51
52 struct EventMview *ev_m = nc->event_data;
53 struct IndexSharedData *shared = nc->global_data;
54 if (ev_m->mv != shared->mailbox_view)
55 return 0;
56
58 shared->mailbox_view = NULL;
59
60 mutt_debug(LL_NOTIFY, "relay NT_MVIEW to shared data observers\n");
62 return 0;
63}
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
@ NT_MVIEW_DELETE
The Mview is about to be destroyed.
Definition: mview.h:63
@ NT_MVIEW_ADD
The Mview has been opened.
Definition: mview.h:62
@ NT_MVIEW
MailboxView has changed, NotifyMview, EventMview.
Definition: notify_type.h:50
An Event that happened to an MailboxView.
Definition: mview.h:71
struct MailboxView * mv
The MailboxView this Event relates to.
Definition: mview.h:72
+ 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 68 of file shared_data.c.

69{
70 if (nc->event_type != NT_ACCOUNT)
71 return 0;
72 if (!nc->global_data || !nc->event_data)
73 return -1;
75 return 0;
76
77 struct EventAccount *ev_a = nc->event_data;
78 struct IndexSharedData *shared = nc->global_data;
79 if (ev_a->account != shared->account)
80 return 0;
81
83 shared->account = NULL;
84
85 mutt_debug(LL_NOTIFY, "relay NT_ACCOUNT to shared data observers\n");
87 return 0;
88}
@ 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:39
+ 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 93 of file shared_data.c.

94{
95 if (nc->event_type != NT_MAILBOX)
96 return 0;
97 if (!nc->global_data || !nc->event_data)
98 return -1;
100 return 0;
101
102 struct EventMailbox *ev_m = nc->event_data;
103 struct IndexSharedData *shared = nc->global_data;
104 if (ev_m->mailbox != shared->mailbox)
105 return 0;
106
108 shared->mailbox = NULL;
109
110 mutt_debug(LL_NOTIFY, "relay NT_MAILBOX to shared data observers\n");
111 notify_send(shared->notify, nc->event_type, nc->event_subtype, nc->event_data);
112 return 0;
113}
@ NT_MAILBOX_ADD
Mailbox has been added.
Definition: mailbox.h:170
+ 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 118 of file shared_data.c.

119{
120 if (nc->event_type != NT_EMAIL)
121 return 0;
122 if (!nc->global_data || !nc->event_data)
123 return -1;
124 if (nc->event_subtype == NT_EMAIL_ADD)
125 return 0;
126
127 struct EventEmail *ev_e = nc->event_data;
128 struct IndexSharedData *shared = nc->global_data;
129 bool match = false;
130 for (int i = 0; i < ev_e->num_emails; i++)
131 {
132 if (ev_e->emails[i] == shared->email)
133 {
134 match = true;
135 break;
136 }
137 }
138
139 if (!match)
140 return 0;
141
143 {
144 shared->email = NULL;
145 mutt_debug(LL_NOTIFY, "NT_INDEX_EMAIL: %p\n", (void *) shared->email);
146 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, shared);
147 }
148
149 mutt_debug(LL_NOTIFY, "relay NT_EMAIL %p to shared data observers\n",
150 (void *) shared->email);
151 notify_send(shared->notify, nc->event_type, nc->event_subtype, nc->event_data);
152 return 0;
153}
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:151
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:152
#define NT_INDEX_EMAIL
Email has changed.
Definition: lib.h:65
@ NT_INDEX
Index data has changed, NotifyIndex, IndexSharedData.
Definition: notify_type.h:48
An Event that happened to an Email.
Definition: email.h:164
int num_emails
Number of Emails the event applies to.
Definition: email.h:165
struct Email ** emails
Emails affected by the event.
Definition: email.h:166
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 265 of file init.c.

266{
267 if (nc->event_type != NT_CONFIG)
268 return 0;
269 if (!nc->event_data)
270 return -1;
271
272 struct EventConfig *ev_c = nc->event_data;
273
274 if (!mutt_str_equal(ev_c->name, "abort_key"))
275 return 0;
276
278 mutt_debug(LL_DEBUG5, "config done\n");
279 return 0;
280}
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: init.c:243
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_timeout_observer()

int main_timeout_observer ( struct NotifyCallback nc)

Notification that a timeout has occurred - Implements observer_t -.

Definition at line 473 of file main.c.

474{
475 static time_t last_run = 0;
476
477 if (nc->event_type != NT_TIMEOUT)
478 return 0;
479
480 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
481 if (c_timeout <= 0)
482 goto done;
483
484 time_t now = mutt_date_now();
485 if (now < (last_run + c_timeout))
486 goto done;
487
488 // Limit hook to running under the Index or Pager
490 struct MuttWindow *dlg = dialog_find(focus);
491 if (!dlg || (dlg->type != WT_DLG_INDEX))
492 goto done;
493
494 last_run = now;
496
497done:
498 mutt_debug(LL_DEBUG5, "timeout done\n");
499 return 0;
500}
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:902
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:668
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
+ 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 41 of file observer.c.

42{
43 if (nc->event_type != NT_COLOR)
44 return 0;
45 if (!nc->global_data || !nc->event_data)
46 return -1;
47
48 struct EventColor *ev_c = nc->event_data;
49
50 // MT_COLOR_MAX is sent on `uncolor *`
51 if ((ev_c->cid != MT_COLOR_NORMAL) && (ev_c->cid != MT_COLOR_INDICATOR) &&
52 (ev_c->cid != MT_COLOR_MAX))
53 {
54 return 0;
55 }
56
57 struct Menu *menu = nc->global_data;
58 struct MuttWindow *win = menu->win;
59
61 win->actions |= WA_REPAINT;
62 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT, MENU_REDRAW_FULL\n");
63
64 return 0;
65}
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:54
+ 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 70 of file observer.c.

71{
72 if (nc->event_type != NT_CONFIG)
73 return 0;
74 if (!nc->global_data || !nc->event_data)
75 return -1;
76
77 struct EventConfig *ev_c = nc->event_data;
78 if (!mutt_str_startswith(ev_c->name, "arrow_") && !mutt_str_startswith(ev_c->name, "menu_"))
79 return 0;
80
81 if (mutt_str_equal(ev_c->name, "menu_scroll"))
82 return 0; // This doesn't affect the display
83
84 struct Menu *menu = nc->global_data;
85 menu_adjust(menu);
86
87 menu->redraw |= MENU_REDRAW_FULL;
88 menu->win->actions |= WA_RECALC;
89
90 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
91 return 0;
92}
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:230
+ 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 97 of file observer.c.

98{
99 if (nc->event_type != NT_WINDOW)
100 return 0;
101 if (!nc->global_data || !nc->event_data)
102 return -1;
103
104 struct Menu *menu = nc->global_data;
105 struct MuttWindow *win = menu->win;
106 struct EventWindow *ev_w = nc->event_data;
107 if (ev_w->win != win)
108 return 0;
109
111 {
112 menu->page_len = win->state.rows;
113 menu->redraw |= MENU_REDRAW_FULL;
114
116 mutt_debug(LL_DEBUG5, "window state done, request MENU_REDRAW_INDEX, WA_REPAINT\n");
117 }
118 else if (nc->event_subtype == NT_WINDOW_DELETE)
119 {
123 msgwin_clear_text(NULL);
124 mutt_debug(LL_DEBUG5, "window delete done\n");
125 }
126
127 return 0;
128}
static int menu_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: observer.c:97
static int menu_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: observer.c:70
static int menu_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: observer.c:41
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 93 of file dlg_mixmaster.c.

94{
95 if (nc->event_type != NT_CONFIG)
96 return 0;
97 if (!nc->global_data || !nc->event_data)
98 return -1;
99
100 struct EventConfig *ev_c = nc->event_data;
101 if (!mutt_str_equal(ev_c->name, "status_on_top"))
102 return 0;
103
104 struct MuttWindow *dlg = nc->global_data;
106 mutt_debug(LL_DEBUG5, "config done\n");
107 return 0;
108}
+ 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 113 of file dlg_mixmaster.c.

114{
115 if (nc->event_type != NT_WINDOW)
116 return 0;
117 if (!nc->global_data || !nc->event_data)
118 return -1;
120 return 0;
121
122 struct MuttWindow *dlg = nc->global_data;
123 struct EventWindow *ev_w = nc->event_data;
124 if (ev_w->win != dlg)
125 return 0;
126
129 mutt_debug(LL_DEBUG5, "window delete done\n");
130
131 return 0;
132}
static int remailer_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_mixmaster.c:93
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_log_observer()

int main_log_observer ( struct NotifyCallback nc)

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

Definition at line 285 of file mutt_logging.c.

286{
287 if (nc->event_type != NT_CONFIG)
288 return 0;
289 if (!nc->event_data)
290 return -1;
291
292 struct EventConfig *ev_c = nc->event_data;
293
294 if (mutt_str_equal(ev_c->name, "debug_file"))
295 {
296 const char *const c_debug_file = cs_subset_path(NeoMutt->sub, "debug_file");
297 mutt_log_set_file(c_debug_file);
298 }
299 else if (mutt_str_equal(ev_c->name, "debug_level"))
300 {
301 const short c_debug_level = cs_subset_number(NeoMutt->sub, "debug_level");
302 mutt_log_set_level(c_debug_level, true);
303 }
304 else
305 {
306 return 0;
307 }
308
309 mutt_debug(LL_DEBUG5, "log done\n");
310 return 0;
311}
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:169
int mutt_log_set_level(enum LogLevel level, bool verbose)
Change the logging level.
Definition: mutt_logging.c:226
int mutt_log_set_file(const char *file)
Change the logging file.
Definition: mutt_logging.c:195
+ 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 325 of file mview.c.

326{
327 if (nc->event_type != NT_MAILBOX)
328 return 0;
329 if (!nc->global_data)
330 return -1;
331
332 struct MailboxView *mv = nc->global_data;
333
334 switch (nc->event_subtype)
335 {
338 mview_clean(mv);
339 break;
341 mview_update(mv);
342 break;
344 update_tables(mv);
345 break;
347 mutt_sort_headers(mv, true);
348 break;
349 default:
350 return 0;
351 }
352
353 mutt_debug(LL_DEBUG5, "mailbox done\n");
354 return 0;
355}
@ NT_MAILBOX_RESORT
Email list needs resorting.
Definition: mailbox.h:178
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:177
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:179
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:721
static void mview_clean(struct MailboxView *mv)
Release memory and initialize a MailboxView.
Definition: mview.c:119
static void update_tables(struct MailboxView *mv)
Update a MailboxView's internal tables.
Definition: mview.c:235
void mview_update(struct MailboxView *mv)
Update the MailboxView's message counts.
Definition: mview.c:139
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition: sort.c:350
View of a Mailbox.
Definition: mview.h:40
struct ThreadsContext * threads
Threads context.
Definition: mview.h:44
+ 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 562 of file dlg_gpgme.c.

563{
564 if (nc->event_type != NT_CONFIG)
565 return 0;
566 if (!nc->global_data || !nc->event_data)
567 return -1;
568
569 struct EventConfig *ev_c = nc->event_data;
570
571 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
572 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
573 {
574 return 0;
575 }
576
577 struct Menu *menu = nc->global_data;
579 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
580
581 return 0;
582}
+ 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 591 of file dlg_gpgme.c.

592{
593 if (nc->event_type != NT_WINDOW)
594 return 0;
595 if (!nc->global_data || !nc->event_data)
596 return -1;
598 return 0;
599
600 struct MuttWindow *win_menu = nc->global_data;
601 struct EventWindow *ev_w = nc->event_data;
602 if (ev_w->win != win_menu)
603 return 0;
604
605 struct Menu *menu = win_menu->wdata;
606
609
610 mutt_debug(LL_DEBUG5, "window delete done\n");
611 return 0;
612}
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:562
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:591
+ 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 471 of file dlg_pgp.c.

472{
473 if (nc->event_type != NT_CONFIG)
474 return 0;
475 if (!nc->global_data || !nc->event_data)
476 return -1;
477
478 struct EventConfig *ev_c = nc->event_data;
479
480 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
481 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
482 {
483 return 0;
484 }
485
486 struct Menu *menu = nc->global_data;
488 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
489
490 return 0;
491}
+ 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 500 of file dlg_pgp.c.

501{
502 if (nc->event_type != NT_WINDOW)
503 return 0;
504 if (!nc->global_data || !nc->event_data)
505 return -1;
507 return 0;
508
509 struct MuttWindow *win_menu = nc->global_data;
510 struct EventWindow *ev_w = nc->event_data;
511 if (ev_w->win != win_menu)
512 return 0;
513
514 struct Menu *menu = win_menu->wdata;
515
518
519 mutt_debug(LL_DEBUG5, "window delete done\n");
520 return 0;
521}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:500
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:471
+ 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 }
267 priv->lines_used = 0;
268 }
269
270 mutt_debug(LL_DEBUG5, "color done\n");
271 return 0;
272}
@ MT_COLOR_QUOTED
Pager: quoted text.
Definition: color.h:63
#define FREE(x)
Definition: memory.h:45
void qstyle_recolor(struct QuoteStyle *quote_list)
Recolour quotes after colour changes.
Definition: quoted.c:621
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 277 of file pager.c.

278{
279 if (nc->event_type != NT_CONFIG)
280 return 0;
281 if (!nc->global_data || !nc->event_data)
282 return -1;
283
284 struct EventConfig *ev_c = nc->event_data;
285 struct MuttWindow *win_pager = nc->global_data;
286
287 if (mutt_str_equal(ev_c->name, "pager_index_lines"))
288 {
289 config_pager_index_lines(win_pager);
290 mutt_debug(LL_DEBUG5, "config done\n");
291 }
292
293 return 0;
294}
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 299 of file pager.c.

300{
301 if (nc->event_type != NT_GLOBAL)
302 return 0;
303 if (!nc->global_data)
304 return -1;
306 return 0;
307
308 struct MuttWindow *win_pager = nc->global_data;
309
310 struct PagerPrivateData *priv = win_pager->wdata;
311 const struct PagerView *pview = priv ? priv->pview : NULL;
312 if (priv && pview && (priv->redraw & PAGER_REDRAW_FLOW) && (pview->flags & MUTT_PAGER_RETWINCH))
313 {
314 priv->rc = OP_REFORMAT_WINCH;
315 }
316
317 return 0;
318}
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:71
#define PAGER_REDRAW_FLOW
Reflow the pager.
Definition: lib.h:192
int rc
Return code from functions.
Definition: private_data.h:73
PagerRedrawFlags redraw
When to redraw the screen.
Definition: private_data.h:69
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:42
Paged view into some data.
Definition: lib.h:172
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:175
+ 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 323 of file pager.c.

324{
325 if (nc->event_type != NT_INDEX)
326 return 0;
327 if (!nc->global_data)
328 return -1;
329
330 struct MuttWindow *win_pager = nc->global_data;
331
332 struct PagerPrivateData *priv = win_pager->wdata;
333 if (!priv)
334 return 0;
335
336 struct IndexSharedData *shared = nc->event_data;
337
339 {
340 win_pager->actions |= WA_RECALC;
341 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
342 priv->loop = PAGER_LOOP_QUIT;
343 }
344 else if (nc->event_subtype & NT_INDEX_EMAIL)
345 {
346 win_pager->actions |= WA_RECALC;
347 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
348 priv->pager_redraw = true;
349 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
350 {
351 priv->loop = PAGER_LOOP_RELOAD;
352 }
353 else
354 {
355 priv->loop = PAGER_LOOP_QUIT;
356 priv->rc = 0;
357 }
358 }
359
360 return 0;
361}
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition: lib.h:64
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition: lib.h:154
@ PAGER_LOOP_QUIT
Quit the Pager.
Definition: lib.h:153
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 366 of file pager.c.

367{
368 if (nc->event_type != NT_PAGER)
369 return 0;
370 if (!nc->global_data || !nc->event_data)
371 return -1;
372
373 mutt_debug(LL_DEBUG5, "pager done\n");
374 return 0;
375}
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:53
+ 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 380 of file pager.c.

381{
382 if (nc->event_type != NT_WINDOW)
383 return 0;
384 if (!nc->global_data || !nc->event_data)
385 return -1;
387 return 0;
388
389 struct MuttWindow *win_pager = nc->global_data;
390 struct EventWindow *ev_w = nc->event_data;
391 if (ev_w->win != win_pager)
392 return 0;
393
394 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
395 if (!dlg)
396 dlg = window_find_parent(win_pager, WT_DLG_PAGER);
397
398 struct IndexSharedData *shared = dlg->wdata;
399
406
407 mutt_debug(LL_DEBUG5, "window delete done\n");
408
409 return 0;
410}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:366
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:277
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pager.c:323
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:380
static int pager_global_observer(struct NotifyCallback *nc)
Notification that a Global Event occurred - Implements observer_t -.
Definition: pager.c:299
@ WT_DLG_PAGER
Pager Dialog, dlg_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:187
+ 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:83
struct PagerPrivateData * priv
Private Pager data.
Definition: pbar.c:85
struct IndexSharedData * shared
Shared Index data.
Definition: pbar.c:84
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 72 of file ppanel.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_pager = nc->global_data;
81
82 if (mutt_str_equal(ev_c->name, "status_on_top"))
83 {
84 window_status_on_top(panel_pager, 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:

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ppanel.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_pager = nc->global_data;
104 struct EventWindow *ev_w = nc->event_data;
105 if (ev_w->win != panel_pager)
106 return 0;
107
109 notify_observer_remove(panel_pager->notify, ppanel_window_observer, panel_pager);
110 mutt_debug(LL_DEBUG5, "window delete done\n");
111
112 return 0;
113}
static int ppanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ppanel.c:72
static int ppanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ppanel.c:94
+ 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 118 of file dlg_postpone.c.

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

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

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

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 200 of file observer.c.

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

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

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 260 of file observer.c.

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

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

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 369 of file observer.c.

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

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 398 of file observer.c.

399{
400 if (nc->event_type != NT_WINDOW)
401 return 0;
402 if (!nc->global_data || !nc->event_data)
403 return -1;
404
405 struct MuttWindow *win = nc->global_data;
406 struct EventWindow *ev_w = nc->event_data;
407 if (ev_w->win != win)
408 return 0;
409
411 {
413 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
414 }
415 else if (nc->event_subtype == NT_WINDOW_DELETE)
416 {
417 mutt_debug(LL_DEBUG5, "window delete done\n");
419 }
420 return 0;
421}
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition: observer.c:447
+ 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 466 of file observer.c.

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