NeoMutt  2024-04-25-127-g771158
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 -.
 
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 258 of file dlg_alias.c.

259{
260 if (nc->event_type != NT_ALIAS)
261 return 0;
262 if (!nc->global_data || !nc->event_data)
263 return -1;
264
265 struct EventAlias *ev_a = nc->event_data;
266 struct Menu *menu = nc->global_data;
267 struct AliasMenuData *mdata = menu->mdata;
268 struct Alias *alias = ev_a->alias;
269
270 if (nc->event_subtype == NT_ALIAS_ADD)
271 {
272 alias_array_alias_add(&mdata->ava, alias);
273
274 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
275 {
276 mutt_pattern_alias_func(NULL, mdata, menu);
277 }
278 }
279 else if (nc->event_subtype == NT_ALIAS_DELETE)
280 {
281 alias_array_alias_delete(&mdata->ava, alias);
282
283 int vcount = alias_array_count_visible(&mdata->ava);
284 int index = menu_get_index(menu);
285 if ((index > (vcount - 1)) && (index > 0))
286 menu_set_index(menu, index - 1);
287 }
288
289 alias_array_sort(&mdata->ava, mdata->sub);
290
291 menu->max = alias_array_count_visible(&mdata->ava);
293 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
294
295 return 0;
296}
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:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
@ 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:79
void * mdata
Private data.
Definition: lib.h:147
int max
Number of entries in the menu.
Definition: lib.h:81
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 305 of file dlg_alias.c.

306{
307 if (nc->event_type != NT_WINDOW)
308 return 0;
309 if (!nc->global_data || !nc->event_data)
310 return -1;
312 return 0;
313
314 struct MuttWindow *win_menu = nc->global_data;
315 struct EventWindow *ev_w = nc->event_data;
316 if (ev_w->win != win_menu)
317 return 0;
318
319 struct Menu *menu = win_menu->wdata;
320
324
325 mutt_debug(LL_DEBUG5, "window delete done\n");
326 return 0;
327}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:305
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:258
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:228
@ 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:238
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:239
void * wdata
Private data.
Definition: mutt_window.h:144
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:137
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
+ 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 351 of file dlg_query.c.

352{
353 if (nc->event_type != NT_WINDOW)
354 return 0;
355 if (!nc->global_data || !nc->event_data)
356 return -1;
358 return 0;
359
360 struct MuttWindow *win_menu = nc->global_data;
361 struct EventWindow *ev_w = nc->event_data;
362 if (ev_w->win != win_menu)
363 return 0;
364
365 struct Menu *menu = win_menu->wdata;
366
369
370 mutt_debug(LL_DEBUG5, "window delete done\n");
371 return 0;
372}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:351
+ 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:660
@ 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 114 of file dlg_attach.c.

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

505{
506 if (nc->event_type != NT_WINDOW)
507 return 0;
508 if (!nc->global_data || !nc->event_data)
509 return -1;
511 return 0;
512
513 struct MuttWindow *win_menu = nc->global_data;
514 struct EventWindow *ev_w = nc->event_data;
515 if (ev_w->win != win_menu)
516 return 0;
517
518 struct Menu *menu = win_menu->wdata;
519
522
523 mutt_debug(LL_DEBUG5, "window delete done\n");
524 return 0;
525}
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_attach.c:114
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_attach.c:504
+ 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 274 of file dlg_autocrypt.c.

275{
276 if (nc->event_type != NT_CONFIG)
277 return 0;
278 if (!nc->global_data || !nc->event_data)
279 return -1;
280
281 struct EventConfig *ev_c = nc->event_data;
282
283 if (!mutt_str_equal(ev_c->name, "autocrypt_acct_format"))
284 return 0;
285
286 struct Menu *menu = nc->global_data;
288 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
289
290 return 0;
291}
+ 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 300 of file dlg_autocrypt.c.

301{
302 if (nc->event_type != NT_WINDOW)
303 return 0;
304 if (!nc->global_data || !nc->event_data)
305 return -1;
307 return 0;
308
309 struct MuttWindow *win_menu = nc->global_data;
310 struct EventWindow *ev_w = nc->event_data;
311 if (ev_w->win != win_menu)
312 return 0;
313
314 struct Menu *menu = win_menu->wdata;
315
318
319 mutt_debug(LL_DEBUG5, "window delete done\n");
320 return 0;
321}
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 1153 of file dlg_browser.c.

1154{
1155 if (nc->event_type != NT_CONFIG)
1156 return 0;
1157 if (!nc->global_data || !nc->event_data)
1158 return -1;
1159
1160 struct EventConfig *ev_c = nc->event_data;
1161
1162 struct BrowserPrivateData *priv = nc->global_data;
1163 struct Menu *menu = priv->menu;
1164
1165 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
1166 {
1167 struct BrowserState *state = menu->mdata;
1168 browser_sort(state);
1169 browser_highlight_default(state, menu);
1170 }
1171 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1172 !mutt_str_equal(ev_c->name, "date_format") &&
1173 !mutt_str_equal(ev_c->name, "folder") &&
1174 !mutt_str_equal(ev_c->name, "folder_format") &&
1175 !mutt_str_equal(ev_c->name, "group_index_format") &&
1176 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1177 !mutt_str_equal(ev_c->name, "sort_browser"))
1178 {
1179 return 0;
1180 }
1181
1183 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1184
1185 return 0;
1186}
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:1002
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:144
+ 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 1193 of file dlg_browser.c.

1194{
1195 if (nc->event_type != NT_MAILBOX)
1196 return 0;
1198 return 0;
1199 if (!nc->global_data || !nc->event_data)
1200 return -1;
1201
1202 struct BrowserPrivateData *priv = nc->global_data;
1203
1204 struct BrowserState *state = &priv->state;
1205 if (state->is_mailbox_list)
1206 {
1207 struct EventMailbox *ev_m = nc->event_data;
1208 struct Mailbox *m = ev_m->mailbox;
1209 struct FolderFile *ff = NULL;
1210 ARRAY_FOREACH(ff, &state->entry)
1211 {
1212 if (ff->gen != m->gen)
1213 continue;
1214
1215 ff->has_new_mail = m->has_new;
1216 ff->msg_count = m->msg_count;
1217 ff->msg_unread = m->msg_unread;
1218 ff->notify_user = m->notify_user;
1220 mutt_str_replace(&ff->desc, m->name);
1221 break;
1222 }
1223 }
1224
1226 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
1227
1228 return 0;
1229}
#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:183
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:280
@ 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:148
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:145
An Event that happened to a Mailbox.
Definition: mailbox.h:199
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:200
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 1238 of file dlg_browser.c.

1239{
1240 if (nc->event_type != NT_WINDOW)
1241 return 0;
1242 if (!nc->global_data || !nc->event_data)
1243 return -1;
1245 return 0;
1246
1247 struct BrowserPrivateData *priv = nc->global_data;
1248 struct MuttWindow *win_menu = priv->menu->win;
1249
1250 struct EventWindow *ev_w = nc->event_data;
1251 if (ev_w->win != win_menu)
1252 return 0;
1253
1257
1258 mutt_debug(LL_DEBUG5, "window delete done\n");
1259 return 0;
1260}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:1153
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1193
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1238
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
+ 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 126 of file attach.c.

127{
128 if (nc->event_type != NT_EMAIL)
129 return 0;
130 if (!nc->global_data)
131 return -1;
133 return 0;
134
135 struct MuttWindow *win_attach = nc->global_data;
136
137 win_attach->actions |= WA_RECALC;
138 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
139
140 return 0;
141}
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:188
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:109
@ 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:131
+ 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 197 of file cbar.c.

198{
199 if (nc->event_type != NT_COLOR)
200 return 0;
201 if (!nc->global_data || !nc->event_data)
202 return -1;
203
204 struct EventColor *ev_c = nc->event_data;
205
206 // MT_COLOR_MAX is sent on `uncolor *`
207 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
208 (ev_c->cid != MT_COLOR_MAX))
209 {
210 return 0;
211 }
212
213 struct MuttWindow *win_cbar = nc->global_data;
214 win_cbar->actions |= WA_REPAINT;
215 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
216
217 return 0;
218}
@ 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:110
@ 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 223 of file cbar.c.

224{
225 if (nc->event_type != NT_CONFIG)
226 return 0;
227 if (!nc->global_data || !nc->event_data)
228 return -1;
229
230 struct EventConfig *ev_c = nc->event_data;
231 if (!mutt_str_equal(ev_c->name, "compose_format"))
232 return 0;
233
234 struct MuttWindow *win_cbar = nc->global_data;
235 win_cbar->actions |= WA_RECALC;
236 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
237
238 return 0;
239}
+ 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 244 of file cbar.c.

245{
246 if (nc->event_type != NT_EMAIL)
247 return 0;
248 if (!nc->global_data || !nc->event_data)
249 return -1;
250
251 struct MuttWindow *win_cbar = nc->global_data;
252 win_cbar->actions |= WA_RECALC;
253 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
254
255 return 0;
256}
+ 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 261 of file cbar.c.

262{
263 if (nc->event_type != NT_WINDOW)
264 return 0;
265 if (!nc->global_data || !nc->event_data)
266 return -1;
267
268 struct MuttWindow *win_cbar = nc->global_data;
269 struct EventWindow *ev_w = nc->event_data;
270 if (ev_w->win != win_cbar)
271 return 0;
272
274 {
275 win_cbar->actions |= WA_RECALC;
276 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
277 }
278 else if (nc->event_subtype == NT_WINDOW_DELETE)
279 {
280 struct MuttWindow *dlg = win_cbar->parent;
281 struct ComposeSharedData *shared = dlg->wdata;
282
287
288 mutt_debug(LL_DEBUG5, "window delete done\n");
289 }
290
291 return 0;
292}
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:197
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: cbar.c:223
static int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: cbar.c:261
static int cbar_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: cbar.c:244
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:229
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:134
+ 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:783
+ 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:139
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:692
#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 753 of file window.c.

754{
755 if (nc->event_type != NT_COLOR)
756 return 0;
757 if (!nc->global_data || !nc->event_data)
758 return -1;
759
760 struct EventColor *ev_c = nc->event_data;
761 struct MuttWindow *win_env = nc->global_data;
762
763 enum ColorId cid = ev_c->cid;
764
765 switch (cid)
766 {
767 case MT_COLOR_BOLD:
773 case MT_COLOR_NORMAL:
774 case MT_COLOR_STATUS:
775 case MT_COLOR_MAX: // Sent on `uncolor *`
776 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
777 win_env->actions |= WA_REPAINT;
778 break;
779
780 default:
781 break;
782 }
783 return 0;
784}
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 789 of file window.c.

790{
791 if (nc->event_type != NT_CONFIG)
792 return 0;
793 if (!nc->global_data || !nc->event_data)
794 return -1;
795
796 struct EventConfig *ev_c = nc->event_data;
797 if (!ev_c->name)
798 return 0;
799
800 struct MuttWindow *win_env = nc->global_data;
801
802 switch (ev_c->name[0])
803 {
804 case 'a':
805 if (mutt_str_equal(ev_c->name, "autocrypt"))
806 break;
807 return 0;
808 case 'c':
809 if (mutt_str_equal(ev_c->name, "compose_show_user_headers") ||
810 mutt_str_equal(ev_c->name, "crypt_opportunistic_encrypt"))
811 {
812 break;
813 }
814 return 0;
815 case 'p':
816 if (mutt_str_equal(ev_c->name, "pgp_sign_as"))
817 break;
818 return 0;
819 case 's':
820 if (mutt_str_equal(ev_c->name, "smime_encrypt_with") ||
821 mutt_str_equal(ev_c->name, "smime_sign_as"))
822 {
823 break;
824 }
825 return 0;
826 case 'x':
827 if (mutt_str_equal(ev_c->name, "x_comment_to"))
828 break;
829 return 0;
830 default:
831 return 0;
832 }
833
834 win_env->actions |= WA_RECALC;
835 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
836 return 0;
837}
+ 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 842 of file window.c.

843{
844 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
845 return 0;
846 if (!nc->global_data)
847 return -1;
848
849 struct MuttWindow *win_env = nc->global_data;
850
851 // pgp/smime/autocrypt menu, or external change
852 if (nc->event_type == NT_EMAIL)
853 {
854 struct EnvelopeWindowData *wdata = win_env->wdata;
855 update_crypt_info(wdata);
856 }
857
858 win_env->actions |= WA_RECALC;
859 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
860 return 0;
861}
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition: functions.c:145
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 866 of file window.c.

867{
868 if (nc->event_type != NT_HEADER)
869 return 0;
870 if (!nc->global_data || !nc->event_data)
871 return -1;
872
873 const struct EventHeader *ev_h = nc->event_data;
874 struct MuttWindow *win_env = nc->global_data;
875 struct EnvelopeWindowData *wdata = win_env->wdata;
876
877 struct Envelope *env = wdata->email->env;
878
880 {
881 header_set(&env->userhdrs, ev_h->header);
882 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
883 win_env->actions |= WA_RECALC;
884 return 0;
885 }
886
888 {
889 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
890 if (removed)
891 {
892 header_free(&env->userhdrs, removed);
893 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
894 win_env->actions |= WA_RECALC;
895 }
896 return 0;
897 }
898
899 return 0;
900}
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:202
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:190
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:137
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:210
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:208
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:209
@ 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:217
char * header
The contents of the header.
Definition: email.h:218
A List node for strings.
Definition: list.h:37
+ 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 905 of file window.c.

906{
907 if (nc->event_type != NT_WINDOW)
908 return 0;
909 if (!nc->global_data || !nc->event_data)
910 return -1;
911
912 struct MuttWindow *win_env = nc->global_data;
913 struct EventWindow *ev_w = nc->event_data;
914 if (ev_w->win != win_env)
915 return 0;
916
918 {
919 win_env->actions |= WA_RECALC;
920 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
921 }
922 else if (nc->event_subtype == NT_WINDOW_DELETE)
923 {
924 struct EnvelopeWindowData *wdata = win_env->wdata;
925
931 mutt_debug(LL_DEBUG5, "window delete done\n");
932 }
933
934 return 0;
935}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:842
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:753
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:905
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:789
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:866
+ 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:96
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:519
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:211
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:215
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:212
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:240
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:126
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:47
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:343
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:95
#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:135
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:143
+ 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:766
@ 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:76
+ 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:44
+ 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:511
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:231
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 704 of file history.c.

705{
706 if (nc->event_type != NT_CONFIG)
707 return 0;
708 if (!nc->event_data)
709 return -1;
710
711 struct EventConfig *ev_c = nc->event_data;
712
713 if (!mutt_str_equal(ev_c->name, "history"))
714 return 0;
715
717 mutt_debug(LL_DEBUG5, "history done\n");
718 return 0;
719}
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition: history.c:472
+ 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:143
@ 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:1032
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:456
@ 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 167 of file ibar.c.

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

194{
195 if (nc->event_type != NT_CONFIG)
196 return 0;
197 if (!nc->global_data || !nc->event_data)
198 return -1;
199
200 struct EventConfig *ev_c = nc->event_data;
201 if (!ev_c->name)
202 return 0;
203 if ((ev_c->name[0] != 's') && (ev_c->name[0] != 't'))
204 return 0;
205
206 if (!mutt_str_equal(ev_c->name, "status_format") &&
207 !mutt_str_equal(ev_c->name, "ts_enabled") &&
208 !mutt_str_equal(ev_c->name, "ts_icon_format") &&
209 !mutt_str_equal(ev_c->name, "ts_status_format"))
210 {
211 return 0;
212 }
213
214 struct MuttWindow *win_ibar = nc->global_data;
215 win_ibar->actions |= WA_RECALC;
216 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
217
218 return 0;
219}
+ 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 230 of file ibar.c.

231{
232 if (!nc->global_data)
233 return -1;
234
235 struct MuttWindow *win_ibar = nc->global_data;
236 win_ibar->actions |= WA_RECALC;
237 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
238
239 return 0;
240}
+ 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 245 of file ibar.c.

246{
247 if (nc->event_type != NT_MENU)
248 return 0;
249 if (!nc->global_data)
250 return -1;
251
252 struct MuttWindow *win_ibar = nc->global_data;
253 win_ibar->actions |= WA_RECALC;
254 mutt_debug(LL_DEBUG5, "menu done, request WA_RECALC\n");
255
256 return 0;
257}
@ 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 262 of file ibar.c.

263{
264 if (nc->event_type != NT_WINDOW)
265 return 0;
266 if (!nc->global_data)
267 return -1;
268
269 struct MuttWindow *win_ibar = nc->global_data;
270 struct EventWindow *ev_w = nc->event_data;
271 if (ev_w->win != win_ibar)
272 return 0;
273
275 {
276 win_ibar->actions |= WA_REPAINT;
277 mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
278 }
279 else if (nc->event_subtype == NT_WINDOW_DELETE)
280 {
281 struct MuttWindow *dlg = window_find_parent(win_ibar, WT_DLG_INDEX);
282 struct IndexSharedData *shared = dlg->wdata;
283
289
290 mutt_debug(LL_DEBUG5, "window delete done\n");
291 }
292
293 return 0;
294}
static int ibar_menu_observer(struct NotifyCallback *nc)
Notification that a Menu has changed - Implements observer_t -.
Definition: ibar.c:245
static int ibar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ibar.c:262
static int ibar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ibar.c:193
static int ibar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: ibar.c:167
static int ibar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: ibar.c:230
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:557
@ 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:532
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:96
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:112
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:82
+ 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:63
@ 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:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback nc)
static

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

Definition at line 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:152
+ 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:145
+ 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:182
+ 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:183
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:184
#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:196
int num_emails
Number of Emails the event applies to.
Definition: email.h:197
struct Email ** emails
Emails affected by the event.
Definition: email.h:198
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 259 of file init.c.

260{
261 if (nc->event_type != NT_CONFIG)
262 return 0;
263 if (!nc->event_data)
264 return -1;
265
266 struct EventConfig *ev_c = nc->event_data;
267
268 if (!mutt_str_equal(ev_c->name, "abort_key"))
269 return 0;
270
272 mutt_debug(LL_DEBUG5, "config done\n");
273 return 0;
274}
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: init.c:237
+ 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 511 of file main.c.

512{
513 static time_t last_run = 0;
514
515 if (nc->event_type != NT_TIMEOUT)
516 return 0;
517
518 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
519 if (c_timeout <= 0)
520 goto done;
521
522 time_t now = mutt_date_now();
523 if (now < (last_run + c_timeout))
524 goto done;
525
526 // Limit hook to running under the Index or Pager
528 struct MuttWindow *dlg = dialog_find(focus);
529 if (!dlg || (dlg->type != WT_DLG_INDEX))
530 goto done;
531
532 last_run = now;
534
535done:
536 mutt_debug(LL_DEBUG5, "timeout done\n");
537 return 0;
538}
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:924
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:667
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:139
+ 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:84
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:

◆ 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:168
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:190
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:189
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:191
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:720
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 573 of file dlg_gpgme.c.

574{
575 if (nc->event_type != NT_CONFIG)
576 return 0;
577 if (!nc->global_data || !nc->event_data)
578 return -1;
579
580 struct EventConfig *ev_c = nc->event_data;
581
582 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
583 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
584 {
585 return 0;
586 }
587
588 struct Menu *menu = nc->global_data;
590 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
591
592 return 0;
593}
+ 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 602 of file dlg_gpgme.c.

603{
604 if (nc->event_type != NT_WINDOW)
605 return 0;
606 if (!nc->global_data || !nc->event_data)
607 return -1;
609 return 0;
610
611 struct MuttWindow *win_menu = nc->global_data;
612 struct EventWindow *ev_w = nc->event_data;
613 if (ev_w->win != win_menu)
614 return 0;
615
616 struct Menu *menu = win_menu->wdata;
617
620
621 mutt_debug(LL_DEBUG5, "window delete done\n");
622 return 0;
623}
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:573
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:602
+ 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 567 of file dlg_pgp.c.

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

597{
598 if (nc->event_type != NT_WINDOW)
599 return 0;
600 if (!nc->global_data || !nc->event_data)
601 return -1;
603 return 0;
604
605 struct MuttWindow *win_menu = nc->global_data;
606 struct EventWindow *ev_w = nc->event_data;
607 if (ev_w->win != win_menu)
608 return 0;
609
610 struct Menu *menu = win_menu->wdata;
611
614
615 mutt_debug(LL_DEBUG5, "window delete done\n");
616 return 0;
617}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:596
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:567
+ 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 74 of file do_pager.c.

75{
76 if (nc->event_type != NT_CONFIG)
77 return 0;
78 if (!nc->global_data || !nc->event_data)
79 return -1;
80
81 struct EventConfig *ev_c = nc->event_data;
82 if (!mutt_str_equal(ev_c->name, "status_on_top"))
83 return 0;
84
85 struct MuttWindow *dlg = nc->global_data;
87 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
88 return 0;
89}
+ 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 94 of file do_pager.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 *dlg = nc->global_data;
104 struct EventWindow *ev_w = nc->event_data;
105 if (ev_w->win != dlg)
106 return 0;
107
110 mutt_debug(LL_DEBUG5, "window delete done\n");
111
112 return 0;
113}
static int dopager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: do_pager.c:74
static int dopager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: do_pager.c:94
+ 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 284 of file dlg_pattern.c.

285{
286 if (nc->event_type != NT_CONFIG)
287 return 0;
288 if (!nc->global_data || !nc->event_data)
289 return -1;
290
291 struct EventConfig *ev_c = nc->event_data;
292
293 if (!mutt_str_equal(ev_c->name, "pattern_format"))
294 return 0;
295
296 struct Menu *menu = nc->global_data;
298 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
299
300 return 0;
301}
+ 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 310 of file dlg_pattern.c.

311{
312 if (nc->event_type != NT_WINDOW)
313 return 0;
314 if (!nc->global_data || !nc->event_data)
315 return -1;
317 return 0;
318
319 struct MuttWindow *win_menu = nc->global_data;
320 struct EventWindow *ev_w = nc->event_data;
321 if (ev_w->win != win_menu)
322 return 0;
323
324 struct Menu *menu = win_menu->wdata;
325
328
329 mutt_debug(LL_DEBUG5, "window delete done\n");
330 return 0;
331}
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pattern.c:310
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pattern.c:284
+ 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 125 of file dlg_postpone.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
134 if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
135 return 0;
136
137 struct Menu *menu = nc->global_data;
139 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
140
141 return 0;
142}
+ 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 151 of file dlg_postpone.c.

152{
153 if (nc->event_type != NT_WINDOW)
154 return 0;
155 if (!nc->global_data || !nc->event_data)
156 return -1;
158 return 0;
159
160 struct MuttWindow *win_menu = nc->global_data;
161 struct EventWindow *ev_w = nc->event_data;
162 if (ev_w->win != win_menu)
163 return 0;
164
165 struct Menu *menu = win_menu->wdata;
166
169
170 mutt_debug(LL_DEBUG5, "window delete done\n");
171 return 0;
172}
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:151
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:125
+ 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:166
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:167
Sidebar private Window data -.
Definition: private.h:88
struct MuttWindow * win
Sidebar Window.
Definition: private.h:89
+ 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:425
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:164
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:809
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:220
static bool calc_divider(struct SidebarWindowData *wdata)
Decide what actions are required for the divider.
Definition: observer.c:51
short req_cols
Number of columns required.
Definition: mutt_window.h:123
+ 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:90
+ 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:230
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:214
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: