NeoMutt
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.
 
static int imap_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int ibar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int ibar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ibar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int ibar_menu_observer (struct NotifyCallback *nc)
 Notification that a Menu has changed - Implements observer_t -.
 
static int ibar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_altern_observer (struct NotifyCallback *nc)
 Notification that an 'alternates' command has occurred - Implements observer_t -.
 
static int index_attach_observer (struct NotifyCallback *nc)
 Notification that an 'attachments' command has occurred - Implements observer_t -.
 
static int index_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int index_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int index_global_observer (struct NotifyCallback *nc)
 Notification that a Global event occurred - Implements observer_t -.
 
static int index_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int index_menu_observer (struct NotifyCallback *nc)
 Notification that the Menu has changed - Implements observer_t -.
 
static int index_score_observer (struct NotifyCallback *nc)
 Notification that a 'score' command has occurred - Implements observer_t -.
 
static int index_subjrx_observer (struct NotifyCallback *nc)
 Notification that a 'subjectrx' command has occurred - Implements observer_t -.
 
static int index_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ipanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ipanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_shared_mview_observer (struct NotifyCallback *nc)
 Notification that the MailboxView has changed - Implements observer_t -.
 
static int index_shared_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int index_shared_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int index_shared_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -.
 
int main_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
int main_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int remailer_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int remailer_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
int mview_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int dopager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int dopager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pager_global_observer (struct NotifyCallback *nc)
 Notification that a Global Event occurred - Implements observer_t -.
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pbar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pbar_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ppanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ppanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pattern_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pattern_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int postponed_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int postponed_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sb_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int sb_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sb_command_observer (struct NotifyCallback *nc)
 Notification that a Command has occurred - Implements observer_t -.
 
static int sb_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int sb_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int sb_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int sb_insertion_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 

Detailed Description

Prototype for a notification callback function.

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

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 201 of file dlg_alias.c.

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

◆ alias_window_observer()

static int alias_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 248 of file dlg_alias.c.

249{
250 if (nc->event_type != NT_WINDOW)
251 return 0;
252 if (!nc->global_data || !nc->event_data)
253 return -1;
255 return 0;
256
257 struct MuttWindow *win_menu = nc->global_data;
258 struct EventWindow *ev_w = nc->event_data;
259 if (ev_w->win != win_menu)
260 return 0;
261
262 struct Menu *menu = win_menu->wdata;
263
267
268 mutt_debug(LL_DEBUG5, "window delete done\n");
269 return 0;
270}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:248
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:201
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: gui.c:43
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition: notify.c:230
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_window_observer()

static int query_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 327 of file dlg_query.c.

328{
329 if (nc->event_type != NT_WINDOW)
330 return 0;
331 if (!nc->global_data || !nc->event_data)
332 return -1;
334 return 0;
335
336 struct MuttWindow *win_menu = nc->global_data;
337 struct EventWindow *ev_w = nc->event_data;
338 if (ev_w->win != win_menu)
339 return 0;
340
341 struct Menu *menu = win_menu->wdata;
342
345
346 mutt_debug(LL_DEBUG5, "window delete done\n");
347 return 0;
348}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:327
+ 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:798
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 109 of file dlg_attach.c.

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

◆ attach_window_observer()

static int attach_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 436 of file dlg_attach.c.

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

254{
255 if (nc->event_type != NT_CONFIG)
256 return 0;
257 if (!nc->global_data || !nc->event_data)
258 return -1;
259
260 struct EventConfig *ev_c = nc->event_data;
261
262 if (!mutt_str_equal(ev_c->name, "autocrypt_acct_format"))
263 return 0;
264
265 struct Menu *menu = nc->global_data;
267 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
268
269 return 0;
270}
+ 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 279 of file dlg_autocrypt.c.

280{
281 if (nc->event_type != NT_WINDOW)
282 return 0;
283 if (!nc->global_data || !nc->event_data)
284 return -1;
286 return 0;
287
288 struct MuttWindow *win_menu = nc->global_data;
289 struct EventWindow *ev_w = nc->event_data;
290 if (ev_w->win != win_menu)
291 return 0;
292
293 struct Menu *menu = win_menu->wdata;
294
297
298 mutt_debug(LL_DEBUG5, "window delete done\n");
299 return 0;
300}
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 1106 of file dlg_browser.c.

1107{
1108 if (nc->event_type != NT_CONFIG)
1109 return 0;
1110 if (!nc->global_data || !nc->event_data)
1111 return -1;
1112
1113 struct EventConfig *ev_c = nc->event_data;
1114
1115 struct BrowserPrivateData *priv = nc->global_data;
1116 struct Menu *menu = priv->menu;
1117
1118 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
1119 {
1120 struct BrowserState *state = menu->mdata;
1121 browser_sort(state);
1122 browser_highlight_default(state, menu);
1123 }
1124 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1125 !mutt_str_equal(ev_c->name, "date_format") &&
1126 !mutt_str_equal(ev_c->name, "folder") &&
1127 !mutt_str_equal(ev_c->name, "folder_format") &&
1128 !mutt_str_equal(ev_c->name, "group_index_format") &&
1129 !mutt_str_equal(ev_c->name, "mailbox_folder_format") &&
1130 !mutt_str_equal(ev_c->name, "sort_browser"))
1131 {
1132 return 0;
1133 }
1134
1136 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1137
1138 return 0;
1139}
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:185
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: dlg_browser.c:951
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:118
+ 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 1146 of file dlg_browser.c.

1147{
1148 if (nc->event_type != NT_MAILBOX)
1149 return 0;
1151 return 0;
1152 if (!nc->global_data || !nc->event_data)
1153 return -1;
1154
1155 struct BrowserPrivateData *priv = nc->global_data;
1156
1157 struct BrowserState *state = &priv->state;
1158 if (state->is_mailbox_list)
1159 {
1160 struct EventMailbox *ev_m = nc->event_data;
1161 struct Mailbox *m = ev_m->mailbox;
1162 struct FolderFile *ff = NULL;
1163 ARRAY_FOREACH(ff, &state->entry)
1164 {
1165 if (ff->gen != m->gen)
1166 continue;
1167
1168 ff->has_new_mail = m->has_new;
1169 ff->msg_count = m->msg_count;
1170 ff->msg_unread = m->msg_unread;
1171 ff->notify_user = m->notify_user;
1173 mutt_str_replace(&ff->desc, m->name);
1174 break;
1175 }
1176 }
1177
1179 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
1180
1181 return 0;
1182}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:170
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:327
@ 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:124
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition: lib.h:119
An Event that happened to a Mailbox.
Definition: mailbox.h:186
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:187
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:103
bool notify_user
User will be notified of new mail.
Definition: lib.h:102
char * desc
Description of mailbox.
Definition: lib.h:87
int gen
Unique id, used for (un)sorting.
Definition: lib.h:109
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:114
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
bool notify_user
Notify the user of new mail.
Definition: mailbox.h:112
int msg_unread
Number of unread messages.
Definition: mailbox.h:89
int gen
Generation number, for sorting.
Definition: mailbox.h:146
+ 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 1191 of file dlg_browser.c.

1192{
1193 if (nc->event_type != NT_WINDOW)
1194 return 0;
1195 if (!nc->global_data || !nc->event_data)
1196 return -1;
1198 return 0;
1199
1200 struct BrowserPrivateData *priv = nc->global_data;
1201 struct MuttWindow *win_menu = priv->menu->win;
1202
1203 struct EventWindow *ev_w = nc->event_data;
1204 if (ev_w->win != win_menu)
1205 return 0;
1206
1210
1211 mutt_debug(LL_DEBUG5, "window delete done\n");
1212 return 0;
1213}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:1106
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1146
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1191
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_email_observer()

static int attach_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 127 of file attach.c.

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

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback nc)

Notification that a Color has changed - Implements observer_t -.

Definition at line 204 of file cbar.c.

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

◆ cbar_config_observer()

int cbar_config_observer ( struct NotifyCallback nc)

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

Definition at line 230 of file cbar.c.

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

◆ cbar_email_observer()

static int cbar_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 251 of file cbar.c.

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

◆ cbar_window_observer()

static int cbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 268 of file cbar.c.

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

◆ compose_config_observer()

static int compose_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 129 of file dlg_compose.c.

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

◆ compose_email_observer()

static int compose_email_observer ( struct NotifyCallback nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 150 of file dlg_compose.c.

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

◆ compose_window_observer()

static int compose_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 169 of file dlg_compose.c.

170{
171 if (nc->event_type != NT_WINDOW)
172 return 0;
173 if (!nc->global_data || !nc->event_data)
174 return -1;
176 return 0;
177
178 struct MuttWindow *dlg = nc->global_data;
179 struct EventWindow *ev_w = nc->event_data;
180 if (ev_w->win != dlg)
181 return 0;
182
185 mutt_debug(LL_DEBUG5, "window delete done\n");
186
187 return 0;
188}
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_compose.c:129
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_compose.c:169
+ 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 49 of file config_cache.c.

50{
51 if (nc->event_type != NT_CONFIG)
52 return 0; // LCOV_EXCL_LINE
53 if (!nc->event_data)
54 return -1; // LCOV_EXCL_LINE
55
56 struct EventConfig *ev_c = nc->event_data;
57 if (!ev_c->name || !ev_c->he)
58 return 0; // LCOV_EXCL_LINE
59
60 if (mutt_str_equal(ev_c->name, "assumed_charset"))
61 {
63 ev_c->he, NULL);
64 }
65 else if (mutt_str_equal(ev_c->name, "charset"))
66 {
67 CachedCharset = (const char *) cs_subset_he_native_get(ev_c->sub, ev_c->he, NULL);
68 }
69 else if (mutt_str_equal(ev_c->name, "maildir_field_delimiter"))
70 {
72 ev_c->he, NULL);
73 }
74
75 mutt_debug(LL_DEBUG5, "config done\n");
76 return 0;
77}
static const char * CachedMaildirFieldDelimiter
Cached value of $maildir_field_delimiter.
Definition: config_cache.c:44
static const struct Slist * CachedAssumedCharset
Cached value of $assumed_charset.
Definition: config_cache.c:40
static const char * CachedCharset
Cached value of $charset.
Definition: config_cache.c:42
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:47
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:249
+ 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 808 of file window.c.

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

◆ env_config_observer()

static int env_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 844 of file window.c.

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

898{
899 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
900 return 0;
901 if (!nc->global_data)
902 return -1;
903
904 struct MuttWindow *win_env = nc->global_data;
905
906 // pgp/smime/autocrypt menu, or external change
907 if (nc->event_type == NT_EMAIL)
908 {
909 struct EnvelopeWindowData *wdata = win_env->wdata;
910 update_crypt_info(wdata);
911 }
912
913 win_env->actions |= WA_RECALC;
914 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
915 return 0;
916}
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition: functions.c:147
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 921 of file window.c.

922{
923 if (nc->event_type != NT_HEADER)
924 return 0;
925 if (!nc->global_data || !nc->event_data)
926 return -1;
927
928 const struct EventHeader *ev_h = nc->event_data;
929 struct MuttWindow *win_env = nc->global_data;
930 struct EnvelopeWindowData *wdata = win_env->wdata;
931
932 struct Envelope *env = wdata->email->env;
933
935 {
936 header_set(&env->userhdrs, ev_h->header);
937 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
938 win_env->actions |= WA_RECALC;
939 return 0;
940 }
941
943 {
944 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
945 if (removed)
946 {
947 header_free(&env->userhdrs, removed);
948 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
949 win_env->actions |= WA_RECALC;
950 }
951 return 0;
952 }
953
954 return 0;
955}
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:206
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:194
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:141
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:174
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:172
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:173
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:47
struct Envelope * env
Envelope information.
Definition: email.h:66
struct Email * email
Email being composed.
Definition: wdata.h:40
The header of an Email.
Definition: envelope.h:57
struct ListHead userhdrs
user defined headers
Definition: envelope.h:87
An event that happened to a header.
Definition: email.h:181
char * header
The contents of the header.
Definition: email.h:182
A List node for strings.
Definition: list.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_window_observer()

static int env_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 960 of file window.c.

961{
962 if (nc->event_type != NT_WINDOW)
963 return 0;
964 if (!nc->global_data || !nc->event_data)
965 return -1;
966
967 struct MuttWindow *win_env = nc->global_data;
968 struct EventWindow *ev_w = nc->event_data;
969 if (ev_w->win != win_env)
970 return 0;
971
973 {
974 win_env->actions |= WA_RECALC;
975 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
976 }
977 else if (nc->event_subtype == NT_WINDOW_DELETE)
978 {
979 struct EnvelopeWindowData *wdata = win_env->wdata;
980
986 mutt_debug(LL_DEBUG5, "window delete done\n");
987 }
988
989 return 0;
990}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:897
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:808
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:960
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:844
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:921
+ 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 329 of file msgwin.c.

330{
331 if (nc->event_type != NT_WINDOW)
332 return 0;
333 if (!nc->global_data || !nc->event_data)
334 return -1;
335
336 struct MuttWindow *win = nc->global_data;
337 struct EventWindow *ev_w = nc->event_data;
338 if (ev_w->win != win)
339 return 0;
340
342 {
343 if (ev_w->flags & WN_HIDDEN)
344 {
346 }
347
348 if (ev_w->flags & (WN_NARROWER | WN_WIDER))
349 {
350 struct MsgWinWindowData *wdata = win->wdata;
352 buf_string(wdata->text)));
353 win->actions |= WA_RECALC;
354 }
355 else
356 {
357 win->actions |= WA_REPAINT;
358 }
359 mutt_debug(LL_DEBUG1, "window state done, request WA_RECALC\n");
360 }
361 else if (nc->event_subtype == NT_WINDOW_DELETE)
362 {
364 mutt_debug(LL_DEBUG5, "window delete done\n");
365 }
366 return 0;
367}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: msgwin.c:329
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition: msgwin.c:515
int msgwin_calc_rows(struct MsgWinWindowData *wdata, int cols, const char *str)
How many rows will a string need?
Definition: msgwin.c:180
void msgwin_set_rows(struct MuttWindow *win, short rows)
Resize the Message Window.
Definition: msgwin.c:305
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:212
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:216
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:213
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:241
Message Window private Window data.
Definition: msgwin_wdata.h:66
struct Buffer * text
Cached display string.
Definition: msgwin_wdata.h:67
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_config_observer()

static int rootwin_config_observer ( struct NotifyCallback nc)
static

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

The Root Window is affected by changes to $status_on_top.

Definition at line 113 of file rootwin.c.

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

◆ rootwin_resize_observer()

static int rootwin_resize_observer ( struct NotifyCallback nc)
static

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

This function is triggered by SIGWINCH.

Definition at line 153 of file rootwin.c.

154{
155 if (nc->event_type != NT_RESIZE)
156 return 0;
157 if (!nc->global_data)
158 return -1;
159
162
163 mutt_debug(LL_DEBUG5, "window resize done\n");
164 return 0;
165}
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
@ NT_RESIZE
Window has been resized.
Definition: notify_type.h:52
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 174 of file rootwin.c.

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

◆ sbar_color_observer()

static int sbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

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

Definition at line 116 of file sbar.c.

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

◆ sbar_window_observer()

static int sbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 148 of file sbar.c.

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

◆ simple_config_observer()

static int simple_config_observer ( struct NotifyCallback nc)
static

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

The Simple Dialog is affected by changes to $status_on_top.

Definition at line 80 of file simple.c.

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

◆ simple_window_observer()

static int simple_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 104 of file simple.c.

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

◆ helpbar_binding_observer()

static int helpbar_binding_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 200 of file helpbar.c.

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

◆ helpbar_color_observer()

static int helpbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

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

Definition at line 229 of file helpbar.c.

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

◆ helpbar_config_observer()

static int helpbar_config_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 258 of file helpbar.c.

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

◆ helpbar_window_observer()

static int helpbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 286 of file helpbar.c.

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

◆ main_hist_observer()

int main_hist_observer ( struct NotifyCallback nc)

Notification that a Config Variable has change.

Definition at line 700 of file history.c.

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

◆ imap_timeout_observer()

static int imap_timeout_observer ( struct NotifyCallback nc)
static

Notification that a timeout has occurred - Implements observer_t -.

This function is triggered by SIGWINCH.

Definition at line 43 of file adata.c.

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

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

◆ ibar_config_observer()

static int ibar_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 192 of file ibar.c.

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

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

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

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

◆ index_altern_observer()

static int index_altern_observer ( struct NotifyCallback nc)
static

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

Definition at line 231 of file index.c.

232{
233 if (nc->event_type != NT_ALTERN)
234 return 0;
235 if (!nc->global_data)
236 return -1;
237
238 struct MuttWindow *win = nc->global_data;
239 struct MuttWindow *dlg = dialog_find(win);
240 struct IndexSharedData *shared = dlg->wdata;
241
243 mutt_debug(LL_DEBUG5, "alternates done\n");
244 return 0;
245}
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 250 of file index.c.

251{
252 if (nc->event_type != NT_ATTACH)
253 return 0;
254 if (!nc->global_data)
255 return -1;
256
257 struct MuttWindow *win = nc->global_data;
258 struct MuttWindow *dlg = dialog_find(win);
259 struct IndexSharedData *shared = dlg->wdata;
260
262 mutt_debug(LL_DEBUG5, "attachments done\n");
263 return 0;
264}
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition: attachments.c:288
@ 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 269 of file index.c.

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

◆ index_config_observer()

static int index_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 323 of file index.c.

324{
325 if (nc->event_type != NT_CONFIG)
326 return 0;
327 if (!nc->global_data || !nc->event_data)
328 return -1;
329
330 struct EventConfig *ev_c = nc->event_data;
331 if (!ev_c->name || !ev_c->he)
332 return 0;
333
334 struct MuttWindow *win = nc->global_data;
335
336 const struct ConfigDef *cdef = ev_c->he->data;
337 ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
338
339 if (flags & R_RESORT_SUB)
340 OptSortSubthreads = true;
341 if (flags & R_RESORT)
342 OptNeedResort = true;
343 if (flags & R_RESORT_INIT)
344 OptResortInit = true;
345 if (!(flags & R_INDEX))
346 return 0;
347
348 if (mutt_str_equal(ev_c->name, "reply_regex"))
349 {
350 struct MuttWindow *dlg = dialog_find(win);
351 struct IndexSharedData *shared = dlg->wdata;
353 mutt_debug(LL_DEBUG5, "config done\n");
354 }
355 else if (mutt_str_equal(ev_c->name, "sort"))
356 {
357 config_sort(ev_c->sub);
358 mutt_debug(LL_DEBUG5, "config done\n");
359 }
360 else if (mutt_str_equal(ev_c->name, "use_threads"))
361 {
362 config_use_threads(ev_c->sub);
363 mutt_debug(LL_DEBUG5, "config done\n");
364 }
365
367 return 0;
368}
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: globals.c:81
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: globals.c:82
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: globals.c:74
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:110
static int config_reply_regex(struct MailboxView *mv)
React to changes to $reply_regex.
Definition: index.c:194
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:158
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:57
Definition: set.h:64
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
void * data
User-supplied data.
Definition: hash.h:47
#define R_RESORT
Resort the mailbox.
Definition: types.h:69
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:70
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:66
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:73
#define R_INDEX
Redraw the index menu (MENU_INDEX)
Definition: types.h:68
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:71
+ 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 373 of file index.c.

374{
375 if (nc->event_type != NT_GLOBAL)
376 return 0;
377 if (!nc->global_data)
378 return -1;
380 return 0;
381
382 struct MuttWindow *win = nc->global_data;
383 struct MuttWindow *dlg = dialog_find(win);
384 if (!dlg)
385 return 0;
386
387 struct IndexSharedData *shared = dlg->wdata;
389
390 return 0;
391}
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:61
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition: notify_type.h:46
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition: score.c:64
+ 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 396 of file index.c.

397{
398 if (!nc->global_data)
399 return -1;
400
401 struct MuttWindow *win = nc->global_data;
402 win->actions |= WA_RECALC;
403
404 struct Menu *menu = win->wdata;
406 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
407
408 struct IndexPrivateData *priv = menu->mdata;
409 struct IndexSharedData *shared = priv->shared;
410 if (shared && shared->mailbox)
411 menu->max = shared->mailbox->vcount;
412 else
413 menu->max = 0;
414
415 return 0;
416}
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:41
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 421 of file index.c.

422{
423 if (nc->event_type != NT_MENU)
424 return 0;
425 if (!nc->global_data)
426 return -1;
427
428 struct MuttWindow *win = nc->global_data;
429 struct MuttWindow *dlg = dialog_find(win);
430 struct IndexSharedData *shared = dlg->wdata;
431 struct Menu *menu = win->wdata;
432
433 const int index = menu_get_index(menu);
434 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
436
437 return 0;
438}
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:234
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:419
int index
The absolute (unsorted) message number.
Definition: email.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback nc)
static

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

Definition at line 443 of file index.c.

444{
445 if (nc->event_type != NT_SCORE)
446 return 0;
447 if (!nc->global_data)
448 return -1;
449
450 struct MuttWindow *win = nc->global_data;
451 struct MuttWindow *dlg = dialog_find(win);
452 struct IndexSharedData *shared = dlg->wdata;
453
454 struct Mailbox *m = shared->mailbox;
455 if (!m)
456 return 0;
457
458 for (int i = 0; i < m->msg_count; i++)
459 {
460 struct Email *e = m->emails[i];
461 if (!e)
462 break;
463
464 mutt_score_message(m, e, true);
465 e->attr_color = NULL; // Force recalc of colour
466 }
467
468 mutt_debug(LL_DEBUG5, "score done\n");
469 return 0;
470}
@ 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:161
+ 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 475 of file index.c.

476{
477 if (nc->event_type != NT_SUBJRX)
478 return 0;
479 if (!nc->global_data)
480 return -1;
481
482 struct MuttWindow *win = nc->global_data;
483 struct MuttWindow *dlg = dialog_find(win);
484 struct IndexSharedData *shared = dlg->wdata;
485
487 mutt_debug(LL_DEBUG5, "subjectrx done\n");
488 return 0;
489}
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:55
void subjrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition: subjectrx.c:148
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_observer()

static int index_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 494 of file index.c.

495{
496 if (nc->event_type != NT_WINDOW)
497 return 0;
498 if (!nc->global_data || !nc->event_data)
499 return -1;
500
501 struct MuttWindow *win = nc->global_data;
502 struct Menu *menu = win->wdata;
504 {
507 return 0;
508 }
509
510 struct EventWindow *ev_w = nc->event_data;
511 if (ev_w->win != win)
512 return 0;
513
514 struct IndexPrivateData *priv = menu->mdata;
515
526
527 mutt_debug(LL_DEBUG5, "window delete done\n");
528 return 0;
529}
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:269
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:323
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: index.c:396
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:421
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:443
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:373
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:231
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:475
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:250
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:494
struct Notify * notify
Notifications.
Definition: lib.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 72 of file ipanel.c.

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

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ipanel.c.

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

◆ index_shared_mview_observer()

static int index_shared_mview_observer ( struct NotifyCallback nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 42 of file shared_data.c.

43{
44 if (nc->event_type != NT_MVIEW)
45 return 0;
46 if (!nc->global_data || !nc->event_data)
47 return -1;
48 if (nc->event_subtype == NT_MVIEW_ADD)
49 return 0;
50
51 struct EventMview *ev_m = nc->event_data;
52 struct IndexSharedData *shared = nc->global_data;
53 if (ev_m->mv != shared->mailbox_view)
54 return 0;
55
57 shared->mailbox_view = NULL;
58
59 mutt_debug(LL_NOTIFY, "relay NT_MVIEW to shared data observers\n");
61 return 0;
62}
@ 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:62
@ NT_MVIEW_ADD
The Mview has been opened.
Definition: mview.h:61
@ NT_MVIEW
MailboxView has changed, NotifyMview, EventMview.
Definition: notify_type.h:50
An Event that happened to an MailboxView.
Definition: mview.h:70
struct MailboxView * mv
The MailboxView this Event relates to.
Definition: mview.h:71
+ 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 67 of file shared_data.c.

68{
69 if (nc->event_type != NT_ACCOUNT)
70 return 0;
71 if (!nc->global_data || !nc->event_data)
72 return -1;
74 return 0;
75
76 struct EventAccount *ev_a = nc->event_data;
77 struct IndexSharedData *shared = nc->global_data;
78 if (ev_a->account != shared->account)
79 return 0;
80
82 shared->account = NULL;
83
84 mutt_debug(LL_NOTIFY, "relay NT_ACCOUNT to shared data observers\n");
86 return 0;
87}
@ NT_ACCOUNT_ADD
Account has been added.
Definition: account.h:68
@ NT_ACCOUNT_DELETE
Account is about to be deleted.
Definition: account.h:69
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:36
An Event that happened to an Account.
Definition: account.h:78
struct Account * account
The Account this Event relates to.
Definition: account.h:79
struct Account * account
Current Account.
Definition: shared_data.h: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 92 of file shared_data.c.

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

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

◆ main_config_observer()

int main_config_observer ( struct NotifyCallback nc)

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

Definition at line 265 of file init.c.

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

◆ main_timeout_observer()

int main_timeout_observer ( struct NotifyCallback nc)

Notification that a timeout has occurred - Implements observer_t -.

Definition at line 454 of file main.c.

455{
456 static time_t last_run = 0;
457
458 if (nc->event_type != NT_TIMEOUT)
459 return 0;
460
461 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
462 if (c_timeout <= 0)
463 goto done;
464
465 time_t now = mutt_date_now();
466 if (now < (last_run + c_timeout))
467 goto done;
468
469 // Limit hook to running under the Index or Pager
471 struct MuttWindow *dlg = dialog_find(focus);
472 if (!dlg || (dlg->type != WT_DLG_INDEX))
473 goto done;
474
475 last_run = now;
477
478done:
479 mutt_debug(LL_DEBUG5, "timeout done\n");
480 return 0;
481}
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:891
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:668
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_color_observer()

static int menu_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 41 of file observer.c.

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

◆ menu_config_observer()

static int menu_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 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:228
+ 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:75
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remailer_config_observer()

static int remailer_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 93 of file dlg_mixmaster.c.

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

◆ remailer_window_observer()

static int remailer_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 113 of file dlg_mixmaster.c.

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

◆ main_log_observer()

int main_log_observer ( struct NotifyCallback nc)

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

Definition at line 284 of file mutt_logging.c.

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

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

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

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

480{
481 if (nc->event_type != NT_CONFIG)
482 return 0;
483 if (!nc->global_data || !nc->event_data)
484 return -1;
485
486 struct EventConfig *ev_c = nc->event_data;
487
488 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
489 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
490 {
491 return 0;
492 }
493
494 struct Menu *menu = nc->global_data;
496 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
497
498 return 0;
499}
+ 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 508 of file dlg_pgp.c.

509{
510 if (nc->event_type != NT_WINDOW)
511 return 0;
512 if (!nc->global_data || !nc->event_data)
513 return -1;
515 return 0;
516
517 struct MuttWindow *win_menu = nc->global_data;
518 struct EventWindow *ev_w = nc->event_data;
519 if (ev_w->win != win_menu)
520 return 0;
521
522 struct Menu *menu = win_menu->wdata;
523
526
527 mutt_debug(LL_DEBUG5, "window delete done\n");
528 return 0;
529}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:508
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:479
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_config_observer()

static int dopager_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 75 of file do_pager.c.

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

◆ dopager_window_observer()

static int dopager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 95 of file do_pager.c.

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

◆ pager_color_observer()

static int pager_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 242 of file pager.c.

243{
244 if (nc->event_type != NT_COLOR)
245 return 0;
246 if (!nc->global_data || !nc->event_data)
247 return -1;
248
249 struct EventColor *ev_c = nc->event_data;
250 struct MuttWindow *win_pager = nc->global_data;
251 struct PagerPrivateData *priv = win_pager->wdata;
252 if (!priv)
253 return 0;
254
255 // MT_COLOR_MAX is sent on `uncolor *`
256 if ((ev_c->cid == MT_COLOR_QUOTED) || (ev_c->cid == MT_COLOR_MAX))
257 {
258 // rework quoted colours
260 }
261
262 if (ev_c->cid == MT_COLOR_MAX)
263 {
264 for (size_t i = 0; i < priv->lines_max; i++)
265 {
266 FREE(&(priv->lines[i].syntax));
267 }
268 priv->lines_used = 0;
269 }
270
271 mutt_debug(LL_DEBUG5, "color done\n");
272 return 0;
273}
@ MT_COLOR_QUOTED
Pager: quoted text.
Definition: color.h:61
#define FREE(x)
Definition: memory.h:45
void qstyle_recolour(struct QuoteStyle *quote_list)
Recolour quotes after colour changes.
Definition: quoted.c:619
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 278 of file pager.c.

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

301{
302 if (nc->event_type != NT_GLOBAL)
303 return 0;
304 if (!nc->global_data)
305 return -1;
307 return 0;
308
309 struct MuttWindow *win_pager = nc->global_data;
310
311 struct PagerPrivateData *priv = win_pager->wdata;
312 const struct PagerView *pview = priv ? priv->pview : NULL;
313 if (priv && pview && (priv->redraw & PAGER_REDRAW_FLOW) && (pview->flags & MUTT_PAGER_RETWINCH))
314 {
315 priv->rc = OP_REFORMAT_WINCH;
316 }
317
318 return 0;
319}
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:70
#define PAGER_REDRAW_FLOW
Reflow the pager.
Definition: lib.h:191
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:171
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:174
+ 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 324 of file pager.c.

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

368{
369 if (nc->event_type != NT_PAGER)
370 return 0;
371 if (!nc->global_data || !nc->event_data)
372 return -1;
373
374 mutt_debug(LL_DEBUG5, "pager done\n");
375 return 0;
376}
@ 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 381 of file pager.c.

382{
383 if (nc->event_type != NT_WINDOW)
384 return 0;
385 if (!nc->global_data || !nc->event_data)
386 return -1;
388 return 0;
389
390 struct MuttWindow *win_pager = nc->global_data;
391 struct EventWindow *ev_w = nc->event_data;
392 if (ev_w->win != win_pager)
393 return 0;
394
395 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
396 if (!dlg)
397 dlg = window_find_parent(win_pager, WT_DLG_PAGER);
398
399 struct IndexSharedData *shared = dlg->wdata;
400
407
408 mutt_debug(LL_DEBUG5, "window delete done\n");
409
410 return 0;
411}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:367
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pager.c:242
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pager.c:278
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pager.c:324
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:381
static int pager_global_observer(struct NotifyCallback *nc)
Notification that a Global Event occurred - Implements observer_t -.
Definition: pager.c:300
@ 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 175 of file pbar.c.

176{
177 if (nc->event_type != NT_COLOR)
178 return 0;
179 if (!nc->global_data || !nc->event_data)
180 return -1;
181
182 struct EventColor *ev_c = nc->event_data;
183 enum ColorId cid = ev_c->cid;
184
185 if ((cid != MT_COLOR_STATUS) && (cid != MT_COLOR_NORMAL) && (cid != MT_COLOR_MAX))
186 return 0;
187
188 struct MuttWindow *win_pbar = nc->global_data;
189 win_pbar->actions |= WA_REPAINT;
190 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
191
192 return 0;
193}
+ 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 198 of file pbar.c.

199{
200 if (nc->event_type != NT_CONFIG)
201 return 0;
202 if (!nc->global_data || !nc->event_data)
203 return -1;
204
205 struct EventConfig *ev_c = nc->event_data;
206 if (!mutt_str_equal(ev_c->name, "pager_format"))
207 return 0;
208
209 struct MuttWindow *win_pbar = nc->global_data;
210 win_pbar->actions |= WA_RECALC;
211 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
212
213 return 0;
214}
+ 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 225 of file pbar.c.

226{
227 if (!nc->global_data)
228 return -1;
229
230 struct MuttWindow *win_pbar = nc->global_data;
231 win_pbar->actions |= WA_RECALC;
232 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
233
234 return 0;
235}
+ 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 240 of file pbar.c.

241{
242 if (nc->event_type != NT_PAGER)
243 return 0;
244 if (!nc->global_data)
245 return -1;
246
247 struct MuttWindow *win_pbar = nc->global_data;
248
250 {
251 win_pbar->actions |= WA_RECALC;
252 mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
253 }
254
255 return 0;
256}
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:186
+ 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 261 of file pbar.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_pbar = nc->global_data;
269 struct EventWindow *ev_w = nc->event_data;
270 if (ev_w->win != win_pbar)
271 return 0;
272
274 {
275 win_pbar->actions |= WA_RECALC | WA_REPAINT;
276 mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
277 }
278 else if (nc->event_subtype == NT_WINDOW_DELETE)
279 {
280 struct PBarPrivateData *pbar_data = win_pbar->wdata;
281 struct IndexSharedData *shared = pbar_data->shared;
282
288
289 mutt_debug(LL_DEBUG5, "window delete done\n");
290 }
291
292 return 0;
293}
static int pbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pbar.c:261
static int pbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pbar.c:175
static int pbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pbar.c:198
static int pbar_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pbar.c:240
static int pbar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pbar.c:225
Data to draw the Pager Bar.
Definition: pbar.c:84
struct PagerPrivateData * priv
Private Pager data.
Definition: pbar.c:86
struct IndexSharedData * shared
Shared Index data.
Definition: pbar.c:85
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
Definition: private_data.h:71
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 73 of file ppanel.c.

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

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 95 of file ppanel.c.

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

◆ pattern_config_observer()

static int pattern_config_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 279 of file dlg_pattern.c.

280{
281 if (nc->event_type != NT_CONFIG)
282 return 0;
283 if (!nc->global_data || !nc->event_data)
284 return -1;
285
286 struct EventConfig *ev_c = nc->event_data;
287
288 if (!mutt_str_equal(ev_c->name, "pattern_format"))
289 return 0;
290
291 struct Menu *menu = nc->global_data;
293 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
294
295 return 0;
296}
+ 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 305 of file dlg_pattern.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
323
324 mutt_debug(LL_DEBUG5, "window delete done\n");
325 return 0;
326}
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pattern.c:305
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pattern.c:279
+ 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 117 of file dlg_postpone.c.

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

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

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 171 of file observer.c.

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

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 198 of file observer.c.

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

◆ sb_command_observer()

static int sb_command_observer ( struct NotifyCallback nc)
static

Notification that a Command has occurred - Implements observer_t -.

Definition at line 237 of file observer.c.

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

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 258 of file observer.c.

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

◆ sb_index_observer()

static int sb_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 343 of file observer.c.

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

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 367 of file observer.c.

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

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 396 of file observer.c.

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

◆ sb_insertion_window_observer()

int sb_insertion_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 464 of file observer.c.

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