Thanks to visit codestin.com
Credit goes to code.neomutt.org

NeoMutt  2025-12-11-189-gceedb6
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 quoted_color_observer (struct NotifyCallback *nc)
 Notification that a Color 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 preview_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int preview_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int preview_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 -.
 
int mview_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int rootwin_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int rootwin_resize_observer (struct NotifyCallback *nc)
 Notification that the terminal has been resized - Implements observer_t -.
 
static int rootwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int helpbar_binding_observer (struct NotifyCallback *nc)
 Notification that a Key Binding has changed - Implements observer_t -.
 
static int helpbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int helpbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int helpbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has change - Implements observer_t -.
 
static int imap_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int ibar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int ibar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ibar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int ibar_menu_observer (struct NotifyCallback *nc)
 Notification that a Menu has changed - Implements observer_t -.
 
static int ibar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_altern_observer (struct NotifyCallback *nc)
 Notification that an 'alternates' command has occurred - Implements observer_t -.
 
static int index_attach_observer (struct NotifyCallback *nc)
 Notification that an 'attachments' command has occurred - Implements observer_t -.
 
static int index_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int index_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int index_global_observer (struct NotifyCallback *nc)
 Notification that a Global event occurred - Implements observer_t -.
 
static int index_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int index_menu_observer (struct NotifyCallback *nc)
 Notification that the Menu has changed - Implements observer_t -.
 
static int index_score_observer (struct NotifyCallback *nc)
 Notification that a 'score' command has occurred - Implements observer_t -.
 
static int index_subjrx_observer (struct NotifyCallback *nc)
 Notification that a 'subject-regex' 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 km_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int main_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
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_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 155 of file dlg_alias.c.

156{
157 if (nc->event_type != NT_ALIAS)
158 return 0;
159 if (!nc->global_data || !nc->event_data)
160 return -1;
161
162 struct EventAlias *ev_a = nc->event_data;
163 struct Menu *menu = nc->global_data;
164 struct AliasMenuData *mdata = menu->mdata;
165 struct Alias *alias = ev_a->alias;
166
167 if (nc->event_subtype == NT_ALIAS_ADD)
168 {
169 alias_array_alias_add(&mdata->ava, alias);
170
171 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
172 {
173 mutt_pattern_alias_func(NULL, mdata, PAA_VISIBLE, menu);
174 }
175 }
176 else if (nc->event_subtype == NT_ALIAS_DELETE)
177 {
178 alias_array_alias_delete(&mdata->ava, alias);
179
180 int vcount = alias_array_count_visible(&mdata->ava);
181 int index = menu_get_index(menu);
182 if ((index > (vcount - 1)) && (index > 0))
183 menu_set_index(menu, index - 1);
184 }
185
186 alias_array_sort(&mdata->ava, mdata->sub);
187
188 menu->max = alias_array_count_visible(&mdata->ava);
190 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
191
192 return 0;
193}
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition sort.c:235
@ NT_ALIAS_ADD
Alias has been added.
Definition alias.h:55
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition alias.h:56
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition array.c:95
int alias_array_alias_delete(struct AliasViewArray *ava, const struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition array.c:73
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition array.c:47
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
#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:186
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:162
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:176
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition notify_type.h:37
@ PAA_VISIBLE
Set AliasView.is_visible and hide the rest.
Definition lib.h:191
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, enum PatternAlias action, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition pattern.c:186
AliasView array wrapper with Pattern information -.
Definition gui.h:54
struct AliasViewArray ava
All Aliases/Queries.
Definition gui.h:55
struct Menu * menu
Menu.
Definition gui.h:58
struct ConfigSubset * sub
Config items.
Definition gui.h:57
A shortcut for an email address or addresses.
Definition alias.h:35
An alias-change event.
Definition alias.h:65
struct Alias * alias
Alias that changed.
Definition alias.h:66
Definition lib.h:80
void * mdata
Private data.
Definition lib.h:149
int max
Number of entries in the menu.
Definition lib.h:82
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 202 of file dlg_alias.c.

203{
204 if (nc->event_type != NT_WINDOW)
205 return 0;
206 if (!nc->global_data || !nc->event_data)
207 return -1;
209 return 0;
210
211 struct MuttWindow *win_menu = nc->global_data;
212 struct EventWindow *ev_w = nc->event_data;
213 if (ev_w->win != win_menu)
214 return 0;
215
216 struct Menu *menu = win_menu->wdata;
217
221
222 mutt_debug(LL_DEBUG5, "window delete done\n");
223 return 0;
224}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_alias.c:202
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition dlg_alias.c:155
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.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition subset.h:51
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Container for Accounts, Notifications.
Definition neomutt.h:128
struct Notify * notify
Notifications handler.
Definition neomutt.h:130
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:134
+ 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 277 of file dlg_query.c.

278{
279 if (nc->event_type != NT_WINDOW)
280 return 0;
281 if (!nc->global_data || !nc->event_data)
282 return -1;
284 return 0;
285
286 struct MuttWindow *win_menu = nc->global_data;
287 struct EventWindow *ev_w = nc->event_data;
288 if (ev_w->win != win_menu)
289 return 0;
290
291 struct Menu *menu = win_menu->wdata;
292
295
296 mutt_debug(LL_DEBUG5, "window delete done\n");
297 return 0;
298}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_query.c:277
+ 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 $alias_sort.

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, "alias_sort") && !mutt_str_equal(ev_c->name, "alias_format") &&
53 !mutt_str_equal(ev_c->name, "query_format"))
54 {
55 return 0;
56 }
57
58 struct Menu *menu = nc->global_data;
59
61 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
62
63 return 0;
64}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:662
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition notify_type.h:43
A config-change event.
Definition subset.h:70
const char * name
Name of config item that changed.
Definition subset.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback * nc)
static

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

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

Definition at line 107 of file dlg_attach.c.

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

173{
174 if (nc->event_type != NT_WINDOW)
175 return 0;
176 if (!nc->global_data || !nc->event_data)
177 return -1;
179 return 0;
180
181 struct MuttWindow *win_menu = nc->global_data;
182 struct EventWindow *ev_w = nc->event_data;
183 if (ev_w->win != win_menu)
184 return 0;
185
186 struct Menu *menu = win_menu->wdata;
187
190
191 mutt_debug(LL_DEBUG5, "window delete done\n");
192 return 0;
193}
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition dlg_attach.c:107
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_attach.c:172
+ 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 186 of file dlg_autocrypt.c.

187{
188 if (nc->event_type != NT_CONFIG)
189 return 0;
190 if (!nc->global_data || !nc->event_data)
191 return -1;
192
193 struct EventConfig *ev_c = nc->event_data;
194
195 if (!mutt_str_equal(ev_c->name, "autocrypt_acct_format"))
196 return 0;
197
198 struct Menu *menu = nc->global_data;
200 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
201
202 return 0;
203}
+ 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 212 of file dlg_autocrypt.c.

213{
214 if (nc->event_type != NT_WINDOW)
215 return 0;
216 if (!nc->global_data || !nc->event_data)
217 return -1;
219 return 0;
220
221 struct MuttWindow *win_menu = nc->global_data;
222 struct EventWindow *ev_w = nc->event_data;
223 if (ev_w->win != win_menu)
224 return 0;
225
226 struct Menu *menu = win_menu->wdata;
227
230
231 mutt_debug(LL_DEBUG5, "window delete done\n");
232 return 0;
233}
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 708 of file dlg_browser.c.

709{
710 if (nc->event_type != NT_CONFIG)
711 return 0;
712 if (!nc->global_data || !nc->event_data)
713 return -1;
714
715 struct EventConfig *ev_c = nc->event_data;
716
717 struct BrowserPrivateData *priv = nc->global_data;
718 struct Menu *menu = priv->menu;
719
720 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
721 {
722 struct BrowserState *state = &priv->state;
723 browser_sort(state);
724 browser_highlight_default(state, menu);
725 }
726 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
727 !mutt_str_equal(ev_c->name, "browser_sort") &&
728 !mutt_str_equal(ev_c->name, "date_format") &&
729 !mutt_str_equal(ev_c->name, "folder") &&
730 !mutt_str_equal(ev_c->name, "folder_format") &&
731 !mutt_str_equal(ev_c->name, "group_index_format") &&
732 !mutt_str_equal(ev_c->name, "mailbox_folder_format"))
733 {
734 return 0;
735 }
736
738 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
739
740 return 0;
741}
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition sort.c:186
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Private state data for the Browser.
struct Menu * menu
Menu.
struct BrowserState state
State containing list of files/dir/mailboxes.
State of the file/mailbox browser.
Definition lib.h:146
+ 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 748 of file dlg_browser.c.

749{
750 if (nc->event_type != NT_MAILBOX)
751 return 0;
753 return 0;
754 if (!nc->global_data || !nc->event_data)
755 return -1;
756
757 struct BrowserPrivateData *priv = nc->global_data;
758
759 struct BrowserState *state = &priv->state;
760 if (state->is_mailbox_list)
761 {
762 struct EventMailbox *ev_m = nc->event_data;
763 struct Mailbox *m = ev_m->mailbox;
764 struct FolderFile *ff = NULL;
765 ARRAY_FOREACH(ff, &state->entry)
766 {
767 if (ff->gen != m->gen)
768 continue;
769
770 ff->has_new_mail = m->has_new;
771 ff->msg_count = m->msg_count;
772 ff->msg_unread = m->msg_unread;
773 ff->notify_user = m->notify_user;
775 mutt_str_replace(&ff->desc, m->name);
776 break;
777 }
778 }
779
781 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
782
783 return 0;
784}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition mailbox.h:174
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition notify_type.h:49
bool is_mailbox_list
Viewing mailboxes.
Definition lib.h:150
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition lib.h:147
An Event that happened to a Mailbox.
Definition mailbox.h:190
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition mailbox.h:191
Browser entry representing a folder/dir.
Definition lib.h:80
bool has_new_mail
true if mailbox has "new mail"
Definition lib.h:91
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:89
int gen
Unique id, used for (un)sorting.
Definition lib.h:107
int msg_count
total number of messages
Definition lib.h:92
int msg_unread
number of unread messages
Definition lib.h:93
A mailbox.
Definition mailbox.h:79
bool has_new
Mailbox has new mail.
Definition mailbox.h:85
int msg_count
Total number of messages.
Definition mailbox.h:88
bool poll_new_mail
Check for new mail.
Definition mailbox.h:115
char * name
A short name for the Mailbox.
Definition mailbox.h:82
bool notify_user
Notify the user of new mail.
Definition mailbox.h:113
int msg_unread
Number of unread messages.
Definition mailbox.h:89
int gen
Generation number, for sorting.
Definition mailbox.h:147
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_window_observer()

static int browser_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 793 of file dlg_browser.c.

794{
795 if (nc->event_type != NT_WINDOW)
796 return 0;
797 if (!nc->global_data || !nc->event_data)
798 return -1;
800 return 0;
801
802 struct BrowserPrivateData *priv = nc->global_data;
803 struct MuttWindow *win_menu = priv->menu->win;
804
805 struct EventWindow *ev_w = nc->event_data;
806 if (ev_w->win != win_menu)
807 return 0;
808
812
813 mutt_debug(LL_DEBUG5, "window delete done\n");
814 return 0;
815}
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 -.
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoted_color_observer()

static int quoted_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 42 of file quoted.c.

43{
44 if (nc->event_type != NT_COLOR)
45 return 0;
46 if (!nc->event_data)
47 return -1;
48
49 struct EventColor *ev_c = nc->event_data;
50 enum ColorId cid = ev_c->cid;
51
52 if (!COLOR_QUOTED(cid))
53 return 0;
54
55 // Find the highest-numbered quotedN in use
56 for (int i = MT_COLOR_QUOTED9; i >= MT_COLOR_QUOTED0; i--)
57 {
59 {
61 break;
62 }
63 }
64
65 return 0;
66}
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
Definition simple.c:116
ColorId
List of all coloured objects.
Definition color.h:36
@ MT_COLOR_QUOTED0
Pager: quoted text, level 0.
Definition color.h:58
@ MT_COLOR_QUOTED9
Pager: quoted text, level 9.
Definition color.h:67
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition notify_type.h:41
static int NumQuotedColors
Number of colours for quoted email text.
Definition quoted.c:37
#define COLOR_QUOTED(cid)
Definition quoted.h:28
An Event that happened to a Colour.
Definition notify2.h:55
enum ColorId cid
Colour ID that has changed.
Definition notify2.h:56
+ 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:188
#define WA_RECALC
Recalculate the contents of the Window.
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition notify_type.h:44
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
+ 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 125 of file cbar.c.

126{
127 if (nc->event_type != NT_COLOR)
128 return 0;
129 if (!nc->global_data || !nc->event_data)
130 return -1;
131
132 struct EventColor *ev_c = nc->event_data;
133
134 // MT_COLOR_MAX is sent on `uncolor *`
135 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
136 (ev_c->cid != MT_COLOR_MAX))
137 {
138 return 0;
139 }
140
141 struct MuttWindow *win_cbar = nc->global_data;
142 win_cbar->actions |= WA_REPAINT;
143 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
144
145 return 0;
146}
@ MT_COLOR_MAX
Definition color.h:98
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition color.h:79
@ MT_COLOR_NORMAL
Plain text.
Definition color.h:54
#define WA_REPAINT
Redraw the contents of the Window.
+ 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 151 of file cbar.c.

152{
153 if (nc->event_type != NT_CONFIG)
154 return 0;
155 if (!nc->global_data || !nc->event_data)
156 return -1;
157
158 struct EventConfig *ev_c = nc->event_data;
159 if (!mutt_str_equal(ev_c->name, "compose_format"))
160 return 0;
161
162 struct MuttWindow *win_cbar = nc->global_data;
163 win_cbar->actions |= WA_RECALC;
164 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
165
166 return 0;
167}
+ 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 172 of file cbar.c.

173{
174 if (nc->event_type != NT_EMAIL)
175 return 0;
176 if (!nc->global_data)
177 return -1;
178
179 struct MuttWindow *win_cbar = nc->global_data;
180 win_cbar->actions |= WA_RECALC;
181 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
182
183 return 0;
184}
+ 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 189 of file cbar.c.

190{
191 if (nc->event_type != NT_WINDOW)
192 return 0;
193 if (!nc->global_data || !nc->event_data)
194 return -1;
195
196 struct MuttWindow *win_cbar = nc->global_data;
197 struct EventWindow *ev_w = nc->event_data;
198 if (ev_w->win != win_cbar)
199 return 0;
200
202 {
203 win_cbar->actions |= WA_RECALC | WA_REPAINT;
204 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
205 }
206 else if (nc->event_subtype == NT_WINDOW_DELETE)
207 {
208 struct MuttWindow *dlg = win_cbar->parent;
209 struct ComposeSharedData *shared = dlg->wdata;
210
215
216 mutt_debug(LL_DEBUG5, "window delete done\n");
217 }
218
219 return 0;
220}
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition notify.c:71
int cbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition cbar.c:125
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition cbar.c:151
static int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition cbar.c:189
static int cbar_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition cbar.c:172
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Shared Compose Data.
Definition shared_data.h:36
struct Email * email
Email being composed.
Definition shared_data.h:39
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition email.h:73
struct MuttWindow * parent
Parent Window.
+ 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 164 of file dlg_compose.c.

165{
166 if (nc->event_type != NT_CONFIG)
167 return 0;
168 if (!nc->global_data || !nc->event_data)
169 return -1;
170
171 struct EventConfig *ev_c = nc->event_data;
172 struct MuttWindow *dlg = nc->global_data;
173
174 if (mutt_str_equal(ev_c->name, "status_on_top"))
175 {
177 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
178 }
179 else if (mutt_str_equal(ev_c->name, "compose_show_preview") ||
180 mutt_str_equal(ev_c->name, "compose_preview_min_rows"))
181 {
182 dlg->actions |= WA_RECALC;
183 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
184 }
185 else if (mutt_str_equal(ev_c->name, "compose_preview_above_attachments"))
186 {
187 struct ComposeSharedData *shared = dlg->wdata;
188
189 mutt_window_swap(dlg, shared->win_preview_bar, shared->win_attach_bar);
190 mutt_window_swap(dlg, shared->win_preview, shared->adata->menu->win);
191
192 dlg->actions |= WA_REPAINT;
193 mutt_debug(LL_DEBUG5, "config done, request WA_REPAINT\n");
194 }
195
196 return 0;
197}
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
bool window_status_on_top(struct MuttWindow *panel, const struct ConfigSubset *sub)
Organise windows according to config variable.
struct Menu * menu
Menu displaying the attachments.
Definition attach_data.h:35
struct MuttWindow * win_preview
Message preview window.
Definition shared_data.h:42
struct MuttWindow * win_preview_bar
Status bar divider above preview.
Definition shared_data.h:43
struct ComposeAttachData * adata
Attachments.
Definition shared_data.h:40
struct MuttWindow * win_attach_bar
Status bar divider above attachments.
Definition shared_data.h:41
+ 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 202 of file dlg_compose.c.

203{
204 if (nc->event_type != NT_ENVELOPE)
205 return 0;
206 if (!nc->global_data || !nc->event_data)
207 return -1;
208
209 struct ComposeSharedData *shared = nc->global_data;
210
212 shared->fcc_set = true;
213
215 return 0;
216}
@ CMD_SEND2_HOOK
:send2-hook
Definition command.h:104
@ NT_ENVELOPE_FCC
"Fcc:" header has changed
Definition envelope.h:139
@ NT_ENVELOPE
Envelope has changed, NotifyEnvelope.
Definition notify_type.h:45
void mutt_message_hook(struct Mailbox *m, struct Email *e, enum CommandId id)
Perform a message hook.
Definition run.c:132
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:38
bool fcc_set
User has edited the Fcc: field.
Definition shared_data.h:47
+ 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 221 of file dlg_compose.c.

222{
223 if (nc->event_type != NT_WINDOW)
224 return 0;
225 if (!nc->global_data || !nc->event_data)
226 return -1;
227
228 struct MuttWindow *dlg = nc->global_data;
229 struct EventWindow *ev_w = nc->event_data;
230 if (ev_w->win != dlg)
231 return 0;
232
233 struct ComposeSharedData *shared = dlg->wdata;
234
236 {
237 dlg->actions |= WA_RECALC;
238 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
239 }
240 else if (nc->event_subtype == NT_WINDOW_DELETE)
241 {
245 mutt_debug(LL_DEBUG5, "window delete done\n");
246 }
247
248 return 0;
249}
static int compose_email_observer(struct NotifyCallback *nc)
Notification that an Email 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_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:

◆ preview_color_observer()

static int preview_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 238 of file preview.c.

239{
240 if (nc->event_type != NT_COLOR)
241 return 0;
242 if (!nc->global_data || !nc->event_data)
243 return -1;
244
245 struct EventColor *ev_c = nc->event_data;
246 struct MuttWindow *win = nc->global_data;
247
248 enum ColorId cid = ev_c->cid;
249
250 switch (cid)
251 {
252 case MT_COLOR_BOLD:
253 case MT_COLOR_NORMAL:
254 case MT_COLOR_STATUS:
255 case MT_COLOR_MAX: // Sent on `uncolor *`
256 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
257 win->actions |= WA_REPAINT;
258 break;
259
260 default:
261 break;
262 }
263 return 0;
264}
@ MT_COLOR_BOLD
Bold text.
Definition color.h:41
+ Here is the caller graph for this function:

◆ preview_email_observer()

static int preview_email_observer ( struct NotifyCallback * nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 269 of file preview.c.

270{
271 if (nc->event_type != NT_EMAIL)
272 return 0;
273 if (!nc->global_data)
274 return -1;
275
276 struct MuttWindow *win = nc->global_data;
277
278 win->actions |= WA_RECALC;
279 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
280 return 0;
281}
+ Here is the caller graph for this function:

◆ preview_window_observer()

static int preview_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 286 of file preview.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 = nc->global_data;
294 struct EventWindow *ev_w = nc->event_data;
295 if (ev_w->win != win)
296 return 0;
297
299 {
301 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
302 }
303 else if (nc->event_subtype == NT_WINDOW_DELETE)
304 {
305 struct PreviewWindowData *wdata = win->wdata;
306
310 mutt_debug(LL_DEBUG5, "window delete done\n");
311 }
312
313 return 0;
314}
static int preview_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition preview.c:269
static int preview_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition preview.c:286
static int preview_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition preview.c:238
Data to fill the Preview Window.
Definition preview.c:78
struct MuttWindow * win
Window holding the message preview.
Definition preview.c:81
struct Email * email
Email being composed.
Definition preview.c:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cc_config_observer()

static int cc_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 50 of file config_cache.c.

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

756{
757 if (nc->event_type != NT_COLOR)
758 return 0;
759 if (!nc->global_data || !nc->event_data)
760 return -1;
761
762 struct EventColor *ev_c = nc->event_data;
763 struct MuttWindow *win_env = nc->global_data;
764
765 enum ColorId cid = ev_c->cid;
766
767 switch (cid)
768 {
769 case MT_COLOR_BOLD:
775 case MT_COLOR_NORMAL:
776 case MT_COLOR_STATUS:
777 case MT_COLOR_MAX: // Sent on `uncolor *`
778 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
779 win_env->actions |= WA_REPAINT;
780 break;
781
782 default:
783 break;
784 }
785 return 0;
786}
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition color.h:44
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition color.h:45
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition color.h:43
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition color.h:46
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition color.h:42
+ 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 791 of file window.c.

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

845{
846 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
847 return 0;
848 if (!nc->global_data)
849 return -1;
850
851 struct MuttWindow *win_env = nc->global_data;
852
853 // pgp/smime/autocrypt menu, or external change
854 if (nc->event_type == NT_EMAIL)
855 {
856 struct EnvelopeWindowData *wdata = win_env->wdata;
857 update_crypt_info(wdata);
858 }
859
860 win_env->actions |= WA_RECALC;
861 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
862 return 0;
863}
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition functions.c:148
Data to fill the Envelope Window.
Definition wdata.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_header_observer()

static int env_header_observer ( struct NotifyCallback * nc)
static

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

Definition at line 868 of file window.c.

869{
870 if (nc->event_type != NT_HEADER)
871 return 0;
872 if (!nc->global_data || !nc->event_data)
873 return -1;
874
875 const struct EventHeader *ev_h = nc->event_data;
876 struct MuttWindow *win_env = nc->global_data;
877 struct EnvelopeWindowData *wdata = win_env->wdata;
878
879 struct Envelope *env = wdata->email->env;
880
882 {
883 header_set(&env->userhdrs, ev_h->header);
884 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
885 win_env->actions |= WA_RECALC;
886 return 0;
887 }
888
890 {
891 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
892 if (removed)
893 {
894 header_free(&env->userhdrs, removed);
895 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
896 win_env->actions |= WA_RECALC;
897 }
898 return 0;
899 }
900
901 return 0;
902}
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition email.c:202
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition email.c:190
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition email.c:137
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition email.h:210
@ NT_HEADER_ADD
Header has been added.
Definition email.h:208
@ NT_HEADER_DELETE
Header has been removed.
Definition email.h:209
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition notify_type.h:47
struct Envelope * env
Envelope information.
Definition email.h:68
struct Email * email
Email being composed.
Definition wdata.h:40
The header of an Email.
Definition envelope.h:57
struct ListHead userhdrs
user defined headers
Definition envelope.h:85
An event that happened to a header.
Definition email.h:217
char * header
The contents of the header.
Definition email.h:218
A List node for strings.
Definition list.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_window_observer()

static int env_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 907 of file window.c.

908{
909 if (nc->event_type != NT_WINDOW)
910 return 0;
911 if (!nc->global_data || !nc->event_data)
912 return -1;
913
914 struct MuttWindow *win_env = nc->global_data;
915 struct EventWindow *ev_w = nc->event_data;
916 if (ev_w->win != win_env)
917 return 0;
918
920 {
921 win_env->actions |= WA_RECALC;
922 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
923 }
924 else if (nc->event_subtype == NT_WINDOW_DELETE)
925 {
926 struct EnvelopeWindowData *wdata = win_env->wdata;
927
933 mutt_debug(LL_DEBUG5, "window delete done\n");
934 }
935
936 return 0;
937}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition window.c:844
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition window.c:755
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition window.c:907
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition window.c:791
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition window.c:868
+ 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 185 of file dialog.c.

186{
187 if (nc->event_type != NT_WINDOW)
188 return 0;
189 if (!nc->global_data || !nc->event_data)
190 return -1;
192 return 0;
193
194 struct MuttWindow *win_alldlgs = nc->global_data;
195 struct EventWindow *ev_w = nc->event_data;
196 if (ev_w->win != win_alldlgs)
197 return 0;
198
199 notify_observer_remove(win_alldlgs->notify, alldialogs_window_observer, win_alldlgs);
200
201 AllDialogsWindow = NULL;
202 mutt_debug(LL_DEBUG5, "window delete done\n");
203 return 0;
204}
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:185
+ 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 326 of file msgwin.c.

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

◆ mview_mailbox_observer()

int mview_mailbox_observer ( struct NotifyCallback * nc)

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 322 of file mview.c.

323{
324 if (nc->event_type != NT_MAILBOX)
325 return 0;
326 if (!nc->global_data)
327 return -1;
328
329 struct MailboxView *mv = nc->global_data;
330
331 switch (nc->event_subtype)
332 {
335 mview_clean(mv);
336 break;
338 mview_update(mv);
339 break;
341 update_tables(mv);
342 break;
344 mutt_sort_headers(mv, true);
345 break;
346 default:
347 return 0;
348 }
349
350 mutt_debug(LL_DEBUG5, "mailbox done\n");
351 return 0;
352}
@ NT_MAILBOX_RESORT
Email list needs resorting.
Definition mailbox.h:181
@ NT_MAILBOX_INVALID
Email list was changed.
Definition mailbox.h:180
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition mailbox.h:182
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition sort.c:354
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition thread.c:716
static void mview_clean(struct MailboxView *mv)
Release memory and initialize a MailboxView.
Definition mview.c:116
static void update_tables(struct MailboxView *mv)
Update a MailboxView's internal tables.
Definition mview.c:232
void mview_update(struct MailboxView *mv)
Update the MailboxView's message counts.
Definition mview.c:136
View of a Mailbox.
Definition mview.h:40
struct ThreadsContext * threads
Threads context.
Definition mview.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 **wp_first = ARRAY_FIRST(&win_root->children);
127 if (!wp_first)
128 return 0;
129
130 struct MuttWindow *first = *wp_first;
131
132 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
133 if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
134 (!c_status_on_top && (first->type != WT_HELP_BAR)))
135 {
136 // Swap the HelpBar and the AllDialogsWindow
137 if (ARRAY_SIZE(&win_root->children) < 2)
138 return 0;
139
140 struct MuttWindow **wp_next = ARRAY_GET(&win_root->children, 1);
141 if (!wp_next)
142 return 0;
143
144 struct MuttWindow *next = *wp_next;
145 ARRAY_REMOVE(&win_root->children, wp_next);
146 ARRAY_INSERT(&win_root->children, 0, next);
147
148 mutt_window_reflow(win_root);
149 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
150 }
151
152 return 0;
153}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition array.h:136
#define ARRAY_INSERT(head, idx, elem)
Insert an element into the, shifting up the subsequent entries.
Definition array.h:338
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition mutt_window.h:96
struct MuttWindowArray children
Children Windows.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
+ 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 160 of file rootwin.c.

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

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 181 of file rootwin.c.

182{
183 if (nc->event_type != NT_WINDOW)
184 return 0;
185 if (!nc->global_data || !nc->event_data)
186 return -1;
188 return 0;
189
190 struct MuttWindow *win_root = nc->global_data;
191 struct EventWindow *ev_w = nc->event_data;
192 if (ev_w->win != win_root)
193 return 0;
194
196 if (NeoMutt)
197 {
200 }
201
202 mutt_debug(LL_DEBUG5, "window delete done\n");
203 return 0;
204}
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:160
static int rootwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition rootwin.c:181
struct Notify * notify_resize
Window resize notifications handler.
Definition neomutt.h:131
+ 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 183 of file helpbar.c.

184{
185 if (nc->event_type != NT_BINDING)
186 return 0;
187 if (!nc->global_data || !nc->event_data)
188 return -1;
189 if (nc->event_subtype >= NT_MACRO_ADD)
190 return 0;
191
192 struct MuttWindow *win_helpbar = nc->global_data;
193 struct HelpbarWindowData *wdata = helpbar_wdata_get(win_helpbar);
194 if (!wdata)
195 return 0;
196
197 struct EventBinding *ev_b = nc->event_data;
198 if (wdata->help_menu != ev_b->menu)
199 return 0;
200
201 win_helpbar->actions |= WA_RECALC;
202 mutt_debug(LL_DEBUG5, "binding done, request WA_RECALC\n");
203 return 0;
204}
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 notify.h:49
@ NT_BINDING
Key binding has changed, NotifyBinding, EventBinding.
Definition notify_type.h:40
A key binding Event.
Definition notify.h:32
enum MenuType menu
Menu, e.g. MENU_PAGER.
Definition notify.h:33
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 212 of file helpbar.c.

213{
214 if (nc->event_type != NT_COLOR)
215 return 0;
216 if (!nc->global_data || !nc->event_data)
217 return -1;
218
219 struct EventColor *ev_c = nc->event_data;
220
221 // MT_COLOR_MAX is sent on `uncolor *`
222 if ((ev_c->cid != MT_COLOR_STATUS) && (ev_c->cid != MT_COLOR_NORMAL) &&
223 (ev_c->cid != MT_COLOR_MAX))
224 {
225 return 0;
226 }
227
228 struct MuttWindow *win_helpbar = nc->global_data;
229
230 win_helpbar->actions |= WA_REPAINT;
231 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
232 return 0;
233}
+ 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 241 of file helpbar.c.

242{
243 if (nc->event_type != NT_CONFIG)
244 return 0;
245 if (!nc->global_data || !nc->event_data)
246 return -1;
247
248 struct EventConfig *ev_c = nc->event_data;
249 if (!mutt_str_equal(ev_c->name, "help"))
250 return 0;
251
252 struct MuttWindow *win_helpbar = nc->global_data;
253 win_helpbar->state.visible = cs_subset_bool(NeoMutt->sub, "help");
254
255 mutt_window_reflow(win_helpbar->parent);
256 mutt_debug(LL_DEBUG5, "config done: '%s', request WA_REFLOW on parent\n", ev_c->name);
257 return 0;
258}
bool visible
Window is visible.
Definition mutt_window.h:60
+ 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 269 of file helpbar.c.

270{
271 if (nc->event_type != NT_WINDOW)
272 return 0;
273 if (!nc->global_data || !nc->event_data)
274 return -1;
275
276 struct MuttWindow *win_helpbar = nc->global_data;
277
279 {
280 if (!mutt_window_is_visible(win_helpbar))
281 return 0;
282
283 win_helpbar->actions |= WA_RECALC;
284 mutt_debug(LL_DEBUG5, "window focus: request WA_RECALC\n");
285 return 0;
286 }
287
288 // The next two notifications must be specifically for us
289 struct EventWindow *ew = nc->event_data;
290 if (ew->win != win_helpbar)
291 return 0;
292
294 {
295 win_helpbar->actions |= WA_RECALC;
296 mutt_debug(LL_DEBUG5, "window state: request WA_RECALC\n");
297 }
298 else if (nc->event_subtype == NT_WINDOW_DELETE)
299 {
304 mutt_debug(LL_DEBUG5, "window delete done\n");
305 }
306
307 return 0;
308}
static int helpbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition helpbar.c:212
static int helpbar_binding_observer(struct NotifyCallback *nc)
Notification that a Key Binding has changed - Implements observer_t -.
Definition helpbar.c:183
static int helpbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition helpbar.c:269
static int helpbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition helpbar.c:241
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
@ NT_WINDOW_FOCUS
Window focus has changed.
struct MuttWindow * RootWindow
Parent of all Windows.
Definition rootwin.c:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_hist_observer()

int main_hist_observer ( struct NotifyCallback * nc)

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

Definition at line 701 of file history.c.

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

◆ imap_timeout_observer()

static int imap_timeout_observer ( struct NotifyCallback * nc)
static

Notification that a timeout has occurred - Implements observer_t -.

This function is triggered by SIGWINCH.

Definition at line 43 of file adata.c.

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

◆ index_mailbox_observer()

static int index_mailbox_observer ( struct NotifyCallback * nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

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

Definition at line 582 of file dlg_index.c.

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

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

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

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

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

264{
265 if (nc->event_type != NT_WINDOW)
266 return 0;
267 if (!nc->global_data)
268 return -1;
269
270 struct MuttWindow *win_ibar = nc->global_data;
271 struct EventWindow *ev_w = nc->event_data;
272 if (ev_w->win != win_ibar)
273 return 0;
274
276 {
277 win_ibar->actions |= WA_REPAINT;
278 mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
279 }
280 else if (nc->event_subtype == NT_WINDOW_DELETE)
281 {
282 struct MuttWindow *dlg = window_find_parent(win_ibar, WT_DLG_INDEX);
283 struct IndexSharedData *shared = dlg->wdata;
284
290
291 mutt_debug(LL_DEBUG5, "window delete done\n");
292 }
293
294 return 0;
295}
static int ibar_menu_observer(struct NotifyCallback *nc)
Notification that a Menu has changed - Implements observer_t -.
Definition ibar.c:246
static int ibar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition ibar.c:263
static int ibar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition ibar.c:194
static int ibar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition ibar.c:168
static int ibar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition ibar.c:231
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition mutt_window.h:87
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 219 of file index.c.

220{
221 if (nc->event_type != NT_ALTERN)
222 return 0;
223 if (!nc->global_data)
224 return -1;
225
226 struct MuttWindow *win = nc->global_data;
227 struct MuttWindow *dlg = dialog_find(win);
228 struct IndexSharedData *shared = dlg->wdata;
229
231 mutt_debug(LL_DEBUG5, "alternates done\n");
232 return 0;
233}
void mutt_alternates_reset(struct MailboxView *mv)
Clear the recipient valid flag of all emails.
Definition alternates.c:72
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c: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 238 of file index.c.

239{
240 if (nc->event_type != NT_ATTACH)
241 return 0;
242 if (!nc->global_data)
243 return -1;
244
245 struct MuttWindow *win = nc->global_data;
246 struct MuttWindow *dlg = dialog_find(win);
247 struct IndexSharedData *shared = dlg->wdata;
248
250 mutt_debug(LL_DEBUG5, "attachments done\n");
251 return 0;
252}
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition commands.c:286
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition notify_type.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_color_observer()

static int index_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 257 of file index.c.

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

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

430{
431 if (nc->event_type != NT_GLOBAL)
432 return 0;
433 if (!nc->global_data)
434 return -1;
436 return 0;
437
438 struct MuttWindow *win = nc->global_data;
439 struct MuttWindow *dlg = dialog_find(win);
440 if (!dlg)
441 return 0;
442
443 struct IndexSharedData *shared = dlg->wdata;
445
446 return 0;
447}
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition score.c:53
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition neomutt.h:157
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition notify_type.h:46
+ 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 452 of file index.c.

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

478{
479 if (nc->event_type != NT_MENU)
480 return 0;
481 if (!nc->global_data)
482 return -1;
483
484 struct MuttWindow *win = nc->global_data;
485 struct MuttWindow *dlg = dialog_find(win);
486 struct IndexSharedData *shared = dlg->wdata;
487 struct Menu *menu = win->wdata;
488
489 const int index = menu_get_index(menu);
490 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
492
493 return 0;
494}
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:415
int index
The absolute (unsorted) message number.
Definition email.h:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback * nc)
static

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

Definition at line 499 of file index.c.

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

Definition at line 531 of file index.c.

532{
533 if (nc->event_type != NT_SUBJRX)
534 return 0;
535 if (!nc->global_data)
536 return -1;
537
538 struct MuttWindow *win = nc->global_data;
539 struct MuttWindow *dlg = dialog_find(win);
540 struct IndexSharedData *shared = dlg->wdata;
541
543 mutt_debug(LL_DEBUG5, "subject-regex done\n");
544 return 0;
545}
@ 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:170
+ 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 550 of file index.c.

551{
552 if (nc->event_type != NT_WINDOW)
553 return 0;
554 if (!nc->global_data || !nc->event_data)
555 return -1;
556
557 struct MuttWindow *win = nc->global_data;
558 struct Menu *menu = win->wdata;
560 {
563 return 0;
564 }
565
566 struct EventWindow *ev_w = nc->event_data;
567 if (ev_w->win != win)
568 return 0;
569
570 struct IndexPrivateData *priv = menu->mdata;
571
582
583 mutt_debug(LL_DEBUG5, "window delete done\n");
584 return 0;
585}
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition index.c:257
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition index.c:382
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition index.c:452
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition index.c:477
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition index.c:499
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition index.c:429
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition index.c:219
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subject-regex' command has occurred - Implements observer_t -.
Definition index.c:531
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition index.c:238
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition index.c:550
struct Notify * notify
Notifications.
Definition lib.h:147
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 72 of file ipanel.c.

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

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ipanel.c.

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

◆ index_shared_mview_observer()

static int index_shared_mview_observer ( struct NotifyCallback * nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 43 of file shared_data.c.

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

◆ index_shared_account_observer()

static int index_shared_account_observer ( struct NotifyCallback * nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 68 of file shared_data.c.

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

◆ index_shared_mailbox_observer()

static int index_shared_mailbox_observer ( struct NotifyCallback * nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 93 of file shared_data.c.

94{
95 if (nc->event_type != NT_MAILBOX)
96 return 0;
97 if (!nc->global_data || !nc->event_data)
98 return -1;
100 return 0;
101
102 struct EventMailbox *ev_m = nc->event_data;
103 struct IndexSharedData *shared = nc->global_data;
104 if (ev_m->mailbox != shared->mailbox)
105 return 0;
106
108 shared->mailbox = NULL;
109
110 mutt_debug(LL_NOTIFY, "relay NT_MAILBOX to shared data observers\n");
111 notify_send(shared->notify, nc->event_type, nc->event_subtype, nc->event_data);
112 return 0;
113}
@ NT_MAILBOX_ADD
Mailbox has been added.
Definition mailbox.h:173
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_email_observer()

static int index_shared_email_observer ( struct NotifyCallback * nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 118 of file shared_data.c.

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

◆ km_config_observer()

int km_config_observer ( struct NotifyCallback * nc)

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

Definition at line 150 of file init.c.

151{
152 if (nc->event_type != NT_CONFIG)
153 return 0;
154 if (!nc->event_data)
155 return -1;
156
157 struct EventConfig *ev_c = nc->event_data;
158
159 if (!mutt_str_equal(ev_c->name, "abort_key"))
160 return 0;
161
163 mutt_debug(LL_DEBUG5, "config done\n");
164 return 0;
165}
void km_set_abort_key(void)
Parse the abort_key config string.
Definition init.c:210
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_timeout_observer()

static int main_timeout_observer ( struct NotifyCallback * nc)
static

Notification that a timeout has occurred - Implements observer_t -.

Definition at line 875 of file main.c.

876{
877 static time_t last_run = 0;
878
879 if (nc->event_type != NT_TIMEOUT)
880 return 0;
881
882 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
883 if (c_timeout <= 0)
884 goto done;
885
886 time_t now = mutt_date_now();
887 if (now < (last_run + c_timeout))
888 goto done;
889
890 // Limit hook to running under the Index or Pager
892 struct MuttWindow *dlg = dialog_find(focus);
893 if (!dlg || (dlg->type != WT_DLG_INDEX))
894 goto done;
895
896 last_run = now;
898
899done:
900 mutt_debug(LL_DEBUG5, "timeout done\n");
901 return 0;
902}
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition run.c:365
struct MuttWindow * focus
Focused Window.
+ 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:50
+ 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:234
+ 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:85
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:62
+ 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:168
int mutt_log_set_level(enum LogLevel level, bool verbose)
Change the logging level.
int mutt_log_set_file(const char *file)
Change the logging file.
+ 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 131 of file dlg_gpgme.c.

132{
133 if (nc->event_type != NT_CONFIG)
134 return 0;
135 if (!nc->global_data || !nc->event_data)
136 return -1;
137
138 struct EventConfig *ev_c = nc->event_data;
139
140 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
141 !mutt_str_equal(ev_c->name, "pgp_key_sort"))
142 {
143 return 0;
144 }
145
146 struct Menu *menu = nc->global_data;
148 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
149
150 return 0;
151}
+ 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 160 of file dlg_gpgme.c.

161{
162 if (nc->event_type != NT_WINDOW)
163 return 0;
164 if (!nc->global_data || !nc->event_data)
165 return -1;
167 return 0;
168
169 struct MuttWindow *win_menu = nc->global_data;
170 struct EventWindow *ev_w = nc->event_data;
171 if (ev_w->win != win_menu)
172 return 0;
173
174 struct Menu *menu = win_menu->wdata;
175
178
179 mutt_debug(LL_DEBUG5, "window delete done\n");
180 return 0;
181}
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition dlg_gpgme.c:131
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_gpgme.c:160
+ 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 130 of file dlg_pgp.c.

131{
132 if (nc->event_type != NT_CONFIG)
133 return 0;
134 if (!nc->global_data || !nc->event_data)
135 return -1;
136
137 struct EventConfig *ev_c = nc->event_data;
138
139 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
140 !mutt_str_equal(ev_c->name, "pgp_key_sort"))
141 {
142 return 0;
143 }
144
145 struct Menu *menu = nc->global_data;
147 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
148
149 return 0;
150}
+ 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 159 of file dlg_pgp.c.

160{
161 if (nc->event_type != NT_WINDOW)
162 return 0;
163 if (!nc->global_data || !nc->event_data)
164 return -1;
166 return 0;
167
168 struct MuttWindow *win_menu = nc->global_data;
169 struct EventWindow *ev_w = nc->event_data;
170 if (ev_w->win != win_menu)
171 return 0;
172
173 struct Menu *menu = win_menu->wdata;
174
177
178 mutt_debug(LL_DEBUG5, "window delete done\n");
179 return 0;
180}
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_pgp.c:159
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition dlg_pgp.c:130
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_config_observer()

static int dopager_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 74 of file do_pager.c.

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

◆ dopager_window_observer()

static int dopager_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file do_pager.c.

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

◆ pager_color_observer()

static int pager_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 241 of file pager.c.

242{
243 if (nc->event_type != NT_COLOR)
244 return 0;
245 if (!nc->global_data || !nc->event_data)
246 return -1;
247
248 struct EventColor *ev_c = nc->event_data;
249 struct MuttWindow *win_pager = nc->global_data;
250 struct PagerPrivateData *priv = win_pager->wdata;
251 if (!priv)
252 return 0;
253
254 // MT_COLOR_MAX is sent on `uncolor *`
255 if (COLOR_QUOTED(ev_c->cid) || (ev_c->cid == MT_COLOR_MAX))
256 {
257 // rework quoted colours
259 }
260
261 if (ev_c->cid == MT_COLOR_MAX)
262 {
263 for (size_t i = 0; i < priv->lines_max; i++)
264 {
265 FREE(&(priv->lines[i].syntax));
266 }
267 priv->lines_used = 0;
268 }
269 else if ((ev_c->cid == MT_COLOR_ATTACHMENT) || (ev_c->cid == MT_COLOR_ATTACH_HEADERS) ||
270 (ev_c->cid == MT_COLOR_BODY) || (ev_c->cid == MT_COLOR_BOLD) ||
271 (ev_c->cid == MT_COLOR_ERROR) || (ev_c->cid == MT_COLOR_HDRDEFAULT) ||
272 (ev_c->cid == MT_COLOR_HEADER) || (ev_c->cid == MT_COLOR_ITALIC) ||
273 (ev_c->cid == MT_COLOR_MARKERS) || (ev_c->cid == MT_COLOR_MESSAGE) ||
274 (ev_c->cid == MT_COLOR_NORMAL) || (ev_c->cid == MT_COLOR_SEARCH) ||
275 (ev_c->cid == MT_COLOR_SIGNATURE) || (ev_c->cid == MT_COLOR_STRIPE_EVEN) ||
276 (ev_c->cid == MT_COLOR_STRIPE_ODD) || (ev_c->cid == MT_COLOR_TILDE) ||
277 (ev_c->cid == MT_COLOR_UNDERLINE) || (ev_c->cid == MT_COLOR_WARNING))
278 {
280 }
281
282 mutt_debug(LL_DEBUG5, "color done\n");
283 return 0;
284}
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
Definition color.h:52
@ MT_COLOR_MESSAGE
Informational message.
Definition color.h:53
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition color.h:49
@ MT_COLOR_STRIPE_EVEN
Stripes: even lines of the Help Page.
Definition color.h:80
@ MT_COLOR_ERROR
Error message.
Definition color.h:47
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition color.h:40
@ MT_COLOR_HDRDEFAULT
Header default colour.
Definition color.h:48
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition color.h:39
@ MT_COLOR_SEARCH
Pager: search matches.
Definition color.h:68
@ MT_COLOR_ITALIC
Italic text.
Definition color.h:51
@ MT_COLOR_STRIPE_ODD
Stripes: odd lines of the Help Page.
Definition color.h:81
@ MT_COLOR_ATTACHMENT
MIME attachments text (entire line)
Definition color.h:38
@ MT_COLOR_WARNING
Warning messages.
Definition color.h:85
@ MT_COLOR_UNDERLINE
Underlined text.
Definition color.h:84
@ MT_COLOR_SIGNATURE
Pager: signature lines.
Definition color.h:78
@ MT_COLOR_TILDE
Pager: empty lines after message.
Definition color.h:82
#define FREE(x)
Definition memory.h:63
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition notify_type.h:53
#define NT_PAGER_VIEW
Pager View has changed.
Definition lib.h:187
void qstyle_recolor(struct QuoteStyle *quote_list)
Recolour quotes after colour changes.
Definition qstyle.c:464
struct TextSyntax * syntax
Array of coloured text in the line.
Definition display.h:57
Private state data for the Pager.
int lines_used
Size of lines array (used entries)
int lines_max
Capacity of lines array (total entries)
struct Line * lines
Array of text lines in pager.
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
struct QuoteStyle * quote_list
Tree of quoting levels.
+ 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 289 of file pager.c.

290{
291 if (nc->event_type != NT_CONFIG)
292 return 0;
293 if (!nc->global_data || !nc->event_data)
294 return -1;
295
296 struct EventConfig *ev_c = nc->event_data;
297 struct MuttWindow *win_pager = nc->global_data;
298
299 if (mutt_str_equal(ev_c->name, "pager_index_lines"))
300 {
301 config_pager_index_lines(win_pager);
302 mutt_debug(LL_DEBUG5, "config done\n");
303 }
304 else if ((mutt_str_equal(ev_c->name, "allow_ansi")) ||
305 (mutt_str_equal(ev_c->name, "markers")) ||
306 (mutt_str_equal(ev_c->name, "smart_wrap")) ||
307 (mutt_str_equal(ev_c->name, "smileys")) ||
308 (mutt_str_equal(ev_c->name, "tilde")) ||
309 (mutt_str_equal(ev_c->name, "toggle_quoted_show_levels")) ||
310 (mutt_str_equal(ev_c->name, "wrap")))
311 {
312 struct PagerPrivateData *priv = win_pager->parent->wdata;
313 if (!priv)
314 return -1;
315
317 }
318
319 return 0;
320}
static int config_pager_index_lines(struct MuttWindow *win)
React to changes to $pager_index_lines.
Definition pager.c:85
+ Here is the call graph for this function:
+ 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 325 of file pager.c.

326{
327 if (nc->event_type != NT_INDEX)
328 return 0;
329 if (!nc->global_data)
330 return -1;
331
332 struct MuttWindow *win_pager = nc->global_data;
333
334 struct PagerPrivateData *priv = win_pager->wdata;
335 if (!priv)
336 return 0;
337
338 struct IndexSharedData *shared = nc->event_data;
339
341 {
342 win_pager->actions |= WA_RECALC;
343 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
344 priv->loop = PAGER_LOOP_QUIT;
345 }
346 else if (nc->event_subtype & NT_INDEX_EMAIL)
347 {
348 win_pager->actions |= WA_RECALC;
349 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
350 priv->pager_redraw = true;
351 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
352 {
353 priv->loop = PAGER_LOOP_RELOAD;
354 }
355 else
356 {
357 priv->loop = PAGER_LOOP_QUIT;
358 priv->rc = 0;
359 }
360 }
361
362 return 0;
363}
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition lib.h:72
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition lib.h:154
@ PAGER_LOOP_QUIT
Quit the Pager.
Definition lib.h:153
int rc
Return code from functions.
bool pager_redraw
Force a complete redraw.
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
+ 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 368 of file pager.c.

369{
370 if (nc->event_type != NT_PAGER)
371 return 0;
372 if (!nc->global_data || !nc->event_data)
373 return -1;
374
375 struct MuttWindow *win_pager = nc->global_data;
376
377 struct PagerPrivateData *priv = win_pager->wdata;
378 if (!priv)
379 return 0;
380
382 mutt_debug(LL_DEBUG5, "pager done\n");
383 return 0;
384}
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition dlg_pager.c:126
#define PAGER_REDRAW_PAGER
Redraw the pager.
Definition lib.h:191
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_window_observer()

static int pager_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 389 of file pager.c.

390{
391 if (nc->event_type != NT_WINDOW)
392 return 0;
393 if (!nc->global_data || !nc->event_data)
394 return -1;
396 return 0;
397
398 struct MuttWindow *win_pager = nc->global_data;
399 struct EventWindow *ev_w = nc->event_data;
400 if (ev_w->win != win_pager)
401 return 0;
402
403 struct PagerPrivateData *priv = win_pager->wdata;
404 if (!priv)
405 return 0;
406
407 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
408 if (!dlg)
409 dlg = window_find_parent(win_pager, WT_DLG_PAGER);
410
411 struct IndexSharedData *shared = dlg->wdata;
412
418
419 mutt_debug(LL_DEBUG5, "window delete done\n");
420
421 return 0;
422}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition pager.c:368
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition pager.c:241
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition pager.c:289
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition pager.c:325
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition pager.c:389
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
Definition mutt_window.h:85
+ 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 171 of file pbar.c.

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

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

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

237{
238 if (nc->event_type != NT_PAGER)
239 return 0;
240 if (!nc->global_data)
241 return -1;
242
243 struct MuttWindow *win_pbar = nc->global_data;
244
246 {
247 win_pbar->actions |= WA_RECALC;
248 mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
249 }
250
251 return 0;
252}
+ 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 257 of file pbar.c.

258{
259 if (nc->event_type != NT_WINDOW)
260 return 0;
261 if (!nc->global_data || !nc->event_data)
262 return -1;
263
264 struct MuttWindow *win_pbar = nc->global_data;
265 struct EventWindow *ev_w = nc->event_data;
266 if (ev_w->win != win_pbar)
267 return 0;
268
270 {
271 win_pbar->actions |= WA_RECALC | WA_REPAINT;
272 mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
273 }
274 else if (nc->event_subtype == NT_WINDOW_DELETE)
275 {
276 struct PBarPrivateData *pbar_data = win_pbar->wdata;
277 struct IndexSharedData *shared = pbar_data->shared;
278
284
285 mutt_debug(LL_DEBUG5, "window delete done\n");
286 }
287
288 return 0;
289}
static int pbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition pbar.c:257
static int pbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition pbar.c:171
static int pbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition pbar.c:194
static int pbar_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition pbar.c:236
static int pbar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition pbar.c:221
Data to draw the Pager Bar.
Definition pbar.c:81
struct PagerPrivateData * priv
Private Pager data.
Definition pbar.c:83
struct IndexSharedData * shared
Shared Index data.
Definition pbar.c:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 72 of file ppanel.c.

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

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ppanel.c.

95{
96 if (nc->event_type != NT_WINDOW)
97 return 0;
98 if (!nc->global_data || !nc->event_data)
99 return -1;
100
101 struct MuttWindow *panel_pager = nc->global_data;
103 {
104 panel_pager->actions |= WA_RECALC | WA_REPAINT;
105
106 struct PagerPrivateData *priv = panel_pager->wdata;
107 if (priv->pview)
109
110 mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
111 }
112
114 return 0;
115
116 struct EventWindow *ev_w = nc->event_data;
117 if (ev_w->win != panel_pager)
118 return 0;
119
121 notify_observer_remove(panel_pager->notify, ppanel_window_observer, panel_pager);
122 mutt_debug(LL_DEBUG5, "window delete done\n");
123
124 return 0;
125}
static int ppanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition ppanel.c:72
static int ppanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition ppanel.c:94
struct PagerView * pview
Object to view in the pager.
+ 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 225 of file dlg_pattern.c.

226{
227 if (nc->event_type != NT_CONFIG)
228 return 0;
229 if (!nc->global_data || !nc->event_data)
230 return -1;
231
232 struct EventConfig *ev_c = nc->event_data;
233
234 if (!mutt_str_equal(ev_c->name, "pattern_format"))
235 return 0;
236
237 struct Menu *menu = nc->global_data;
239 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
240
241 return 0;
242}
+ 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 251 of file dlg_pattern.c.

252{
253 if (nc->event_type != NT_WINDOW)
254 return 0;
255 if (!nc->global_data || !nc->event_data)
256 return -1;
258 return 0;
259
260 struct MuttWindow *win_menu = nc->global_data;
261 struct EventWindow *ev_w = nc->event_data;
262 if (ev_w->win != win_menu)
263 return 0;
264
265 struct Menu *menu = win_menu->wdata;
266
269
270 mutt_debug(LL_DEBUG5, "window delete done\n");
271 return 0;
272}
static int pattern_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 -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_config_observer()

static int postponed_config_observer ( struct NotifyCallback * nc)
static

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

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

Definition at line 125 of file dlg_postpone.c.

126{
127 if (nc->event_type != NT_CONFIG)
128 return 0;
129 if (!nc->global_data || !nc->event_data)
130 return -1;
131
132 struct EventConfig *ev_c = nc->event_data;
133
134 if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
135 return 0;
136
137 struct Menu *menu = nc->global_data;
139 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
140
141 return 0;
142}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_window_observer()

static int postponed_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 151 of file dlg_postpone.c.

152{
153 if (nc->event_type != NT_WINDOW)
154 return 0;
155 if (!nc->global_data || !nc->event_data)
156 return -1;
158 return 0;
159
160 struct MuttWindow *win_menu = nc->global_data;
161 struct EventWindow *ev_w = nc->event_data;
162 if (ev_w->win != win_menu)
163 return 0;
164
165 struct Menu *menu = win_menu->wdata;
166
169
170 mutt_debug(LL_DEBUG5, "window delete done\n");
171 return 0;
172}
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int postponed_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:

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback * nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 177 of file observer.c.

178{
179 if (nc->event_type != NT_ACCOUNT)
180 return 0;
181 if (!nc->global_data || !nc->event_data)
182 return -1;
184 return 0;
185
186 struct MuttWindow *win = nc->global_data;
188 struct EventAccount *ev_a = nc->event_data;
189
190 struct Mailbox **mp = NULL;
191 ARRAY_FOREACH(mp, &ev_a->account->mailboxes)
192 {
193 sb_add_mailbox(wdata, *mp);
194 }
195
196 win->actions |= WA_RECALC;
197 mutt_debug(LL_DEBUG5, "account done, request WA_RECALC\n");
198 return 0;
199}
void sb_add_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Add a Mailbox to the Sidebar.
Definition sidebar.c:100
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition wdata.c:77
struct MailboxArray mailboxes
All Mailboxes.
Definition account.h:40
Sidebar private Window data -.
Definition private.h:87
struct MuttWindow * win
Sidebar Window.
Definition private.h:88
+ 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 204 of file observer.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 struct MuttWindow *win = nc->global_data;
213
214 enum ColorId cid = ev_c->cid;
215
216 if (cid == MT_COLOR_MAX) // Sent on `uncolor *`
217 {
218 // Set a default style
220 ac->attrs = A_UNDERLINE;
221 }
222
223 switch (cid)
224 {
226 case MT_COLOR_NORMAL:
236 case MT_COLOR_MAX: // Sent on `uncolor *`
237 win->actions |= WA_REPAINT;
238 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
239 break;
240
241 default:
242 break;
243 }
244 return 0;
245}
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition simple.c:95
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition color.h:70
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition color.h:74
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition color.h:77
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition color.h:76
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition color.h:75
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
Definition color.h:69
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition color.h:73
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition color.h:72
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition color.h:71
A curses colour and its attributes.
Definition attr.h:66
int attrs
Text attributes, e.g. A_BOLD.
Definition attr.h:69
+ Here is the call graph for this function:
+ 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 250 of file observer.c.

251{
252 if (nc->event_type != NT_COMMAND)
253 return 0;
254 if (!nc->global_data || !nc->event_data)
255 return -1;
256
257 struct Command *cmd = nc->event_data;
258
259 if ((cmd->parse != parse_sidebar_pin) && (cmd->parse != parse_sidebar_unpin))
260 return 0;
261
262 struct MuttWindow *win = nc->global_data;
263 win->actions |= WA_RECALC;
264 mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
265 return 0;
266}
enum CommandResult parse_sidebar_unpin(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
Parse the 'sidebar-unpin' command - Implements Command::parse() -.
Definition commands.c:72
enum CommandResult parse_sidebar_pin(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
Parse the 'sidebar-pin' command - Implements Command::parse() -.
Definition commands.c:44
@ NT_COMMAND
A Command has been executed, Command.
Definition notify_type.h:42
enum CommandResult(* parse)(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
Definition command.h:176
+ 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 271 of file observer.c.

272{
273 if (nc->event_type != NT_CONFIG)
274 return 0;
275 if (!nc->global_data || !nc->event_data)
276 return -1;
277
278 struct EventConfig *ev_c = nc->event_data;
279
280 if (!mutt_strn_equal(ev_c->name, "sidebar_", 8) &&
281 !mutt_str_equal(ev_c->name, "ascii_chars") &&
282 !mutt_str_equal(ev_c->name, "folder") && !mutt_str_equal(ev_c->name, "spool_file"))
283 {
284 return 0;
285 }
286
287 if (mutt_str_equal(ev_c->name, "sidebar_next_new_wrap"))
288 return 0; // Affects the behaviour, but not the display
289
290 mutt_debug(LL_DEBUG5, "config: %s\n", ev_c->name);
291
292 struct MuttWindow *win = nc->global_data;
293
294 if (mutt_str_equal(ev_c->name, "sidebar_visible"))
295 {
296 const bool c_sidebar_visible = cs_subset_bool(NeoMutt->sub, "sidebar_visible");
297 window_set_visible(win, c_sidebar_visible);
298 window_reflow(win->parent);
299 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
300 return 0;
301 }
302
303 if (mutt_str_equal(ev_c->name, "sidebar_width"))
304 {
305 const short c_sidebar_width = cs_subset_number(NeoMutt->sub, "sidebar_width");
306 win->req_cols = c_sidebar_width;
307 window_reflow(win->parent);
308 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
309 return 0;
310 }
311
312 if (mutt_str_equal(ev_c->name, "spool_file"))
313 {
314 win->actions |= WA_REPAINT;
315 mutt_debug(LL_DEBUG5, "config done, request WA_REPAINT\n");
316 return 0;
317 }
318
319 if (mutt_str_equal(ev_c->name, "sidebar_on_right"))
320 {
321 struct MuttWindow *parent = win->parent;
322 struct MuttWindow **wp_first = ARRAY_FIRST(&parent->children);
323 if (!wp_first)
324 return 0;
325
326 struct MuttWindow *first = *wp_first;
327 const bool c_sidebar_on_right = cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
328
329 if ((c_sidebar_on_right && (first == win)) || (!c_sidebar_on_right && (first != win)))
330 {
331 // Swap the Sidebar and the Container of the Index/Pager - move first to end
332 ARRAY_REMOVE(&parent->children, wp_first);
333 ARRAY_ADD(&parent->children, first);
334 }
335
336 window_reflow(win->parent);
337 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
338 return 0;
339 }
340
341 if (mutt_str_equal(ev_c->name, "ascii_chars") ||
342 mutt_str_equal(ev_c->name, "sidebar_divider_char"))
343 {
347 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
348 return 0;
349 }
350
351 // All the remaining config changes...
353 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
354 return 0;
355}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
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:429
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
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:52
short req_cols
Number of columns required.
+ 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 360 of file observer.c.

361{
362 if (nc->event_type != NT_INDEX)
363 return 0;
364 if (!nc->global_data || !nc->event_data)
365 return 0;
366 if (!(nc->event_subtype & NT_INDEX_MAILBOX))
367 return 0;
368
369 struct MuttWindow *win_sidebar = nc->global_data;
370 struct IndexSharedData *shared = nc->event_data;
371
372 struct SidebarWindowData *wdata = sb_wdata_get(win_sidebar);
374
375 win_sidebar->actions |= WA_RECALC;
376 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
377
378 return 0;
379}
void sb_set_current_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Set the current Mailbox.
Definition sidebar.c:190
struct IndexSharedData * shared
Shared Index Data.
Definition private.h:89
+ 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 384 of file observer.c.

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

414{
415 if (nc->event_type != NT_WINDOW)
416 return 0;
417 if (!nc->global_data || !nc->event_data)
418 return -1;
419
420 struct MuttWindow *win = nc->global_data;
421 struct EventWindow *ev_w = nc->event_data;
422 if (ev_w->win != win)
423 return 0;
424
426 {
428 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
429 }
430 else if (nc->event_subtype == NT_WINDOW_DELETE)
431 {
432 mutt_debug(LL_DEBUG5, "window delete done\n");
434 }
435 return 0;
436}
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition observer.c:462
+ 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 481 of file observer.c.

482{
483 if (nc->event_type != NT_WINDOW)
484 return 0;
485 if (!nc->event_data)
486 return -1;
488 return 0;
489
490 struct EventWindow *ev_w = nc->event_data;
491 if (ev_w->win->type != WT_DLG_INDEX)
492 return 0;
493
494 if (ev_w->flags & WN_VISIBLE)
495 {
496 mutt_debug(LL_DEBUG5, "insertion: visible\n");
497 struct MuttWindow *win_sidebar = sb_win_init(ev_w->win);
498 sb_init_data(win_sidebar);
499 }
500 else if (ev_w->flags & WN_HIDDEN)
501 {
502 mutt_debug(LL_DEBUG5, "insertion: hidden\n");
504 }
505
506 return 0;
507}
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
#define WN_VISIBLE
Window became visible.
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition observer.c:95
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition observer.c:153
+ Here is the call graph for this function:
+ Here is the caller graph for this function: