NeoMutt  2024-12-12-19-ge4b57e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Observer API

Prototype for a notification callback function. More...

Functions

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

Detailed Description

Prototype for a notification callback function.

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

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 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:56
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:57
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition: array.c:95
int alias_array_alias_delete(struct AliasViewArray *ava, const struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition: array.c:73
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition: array.c:47
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:87
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:37
@ PAA_VISIBLE
Set AliasView.is_visible and hide the rest.
Definition: lib.h:190
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:191
AliasView array wrapper with Pattern information -.
Definition: gui.h:54
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:55
struct Menu * menu
Menu.
Definition: gui.h:58
struct ConfigSubset * sub
Config items.
Definition: gui.h:57
A shortcut for an email address or addresses.
Definition: alias.h:35
An alias-change event.
Definition: alias.h:66
struct Alias * alias
Alias that changed.
Definition: alias.h:67
Definition: lib.h:79
void * mdata
Private data.
Definition: lib.h:147
int max
Number of entries in the menu.
Definition: lib.h:81
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:37
void * global_data
Data from notify_observer_add()
Definition: observer.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_window_observer()

static int alias_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 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.
Definition: mutt_window.h:229
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_window_observer()

static int query_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 273 of file dlg_query.c.

274{
275 if (nc->event_type != NT_WINDOW)
276 return 0;
277 if (!nc->global_data || !nc->event_data)
278 return -1;
280 return 0;
281
282 struct MuttWindow *win_menu = nc->global_data;
283 struct EventWindow *ev_w = nc->event_data;
284 if (ev_w->win != win_menu)
285 return 0;
286
287 struct Menu *menu = win_menu->wdata;
288
291
292 mutt_debug(LL_DEBUG5, "window delete done\n");
293 return 0;
294}
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_query.c:273
+ 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:660
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 108 of file dlg_attach.c.

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

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

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

◆ browser_mailbox_observer()

static int browser_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Find the matching Mailbox and update its details.

Definition at line 751 of file dlg_browser.c.

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

◆ browser_window_observer()

static int browser_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 796 of file dlg_browser.c.

797{
798 if (nc->event_type != NT_WINDOW)
799 return 0;
800 if (!nc->global_data || !nc->event_data)
801 return -1;
803 return 0;
804
805 struct BrowserPrivateData *priv = nc->global_data;
806 struct MuttWindow *win_menu = priv->menu->win;
807
808 struct EventWindow *ev_w = nc->event_data;
809 if (ev_w->win != win_menu)
810 return 0;
811
815
816 mutt_debug(LL_DEBUG5, "window delete done\n");
817 return 0;
818}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:711
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:751
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:796
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_email_observer()

static int attach_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 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.
Definition: mutt_window.h:110
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
+ Here is the caller graph for this function:

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback nc)

Notification that a Color has changed - Implements observer_t -.

Definition at line 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:90
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:71
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:55
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
An Event that happened to a Colour.
Definition: notify2.h:55
enum ColorId cid
Colour ID that has changed.
Definition: notify2.h:56
+ 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.
Definition: mutt_window.h:230
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.
Definition: mutt_window.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_config_observer()

static int compose_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 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 window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:784
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
Definition: mutt_window.c:820
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}
@ NT_ENVELOPE_FCC
"Fcc:" header has changed
Definition: envelope.h:139
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:699
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:48
@ NT_ENVELOPE
Envelope has changed, NotifyEnvelope.
Definition: notify_type.h:45
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h: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 -.
Definition: dlg_compose.c:202
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_compose.c:164
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_compose.c:221
+ 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 232 of file preview.c.

233{
234 if (nc->event_type != NT_COLOR)
235 return 0;
236 if (!nc->global_data || !nc->event_data)
237 return -1;
238
239 struct EventColor *ev_c = nc->event_data;
240 struct MuttWindow *win = nc->global_data;
241
242 enum ColorId cid = ev_c->cid;
243
244 switch (cid)
245 {
246 case MT_COLOR_BOLD:
247 case MT_COLOR_NORMAL:
248 case MT_COLOR_STATUS:
249 case MT_COLOR_MAX: // Sent on `uncolor *`
250 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
251 win->actions |= WA_REPAINT;
252 break;
253
254 default:
255 break;
256 }
257 return 0;
258}
ColorId
List of all coloured objects.
Definition: color.h:36
@ 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 263 of file preview.c.

264{
265 if (nc->event_type != NT_EMAIL)
266 return 0;
267 if (!nc->global_data)
268 return -1;
269
270 struct MuttWindow *win = nc->global_data;
271
272 win->actions |= WA_RECALC;
273 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
274 return 0;
275}
+ 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 280 of file preview.c.

281{
282 if (nc->event_type != NT_WINDOW)
283 return 0;
284 if (!nc->global_data || !nc->event_data)
285 return -1;
286
287 struct MuttWindow *win = nc->global_data;
288 struct EventWindow *ev_w = nc->event_data;
289 if (ev_w->win != win)
290 return 0;
291
293 {
295 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
296 }
297 else if (nc->event_subtype == NT_WINDOW_DELETE)
298 {
299 struct PreviewWindowData *wdata = win->wdata;
300
304 mutt_debug(LL_DEBUG5, "window delete done\n");
305 }
306
307 return 0;
308}
static int preview_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: preview.c:263
static int preview_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: preview.c:280
static int preview_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: preview.c:232
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.
Definition: config_cache.c:45
static const struct Slist * CachedAssumedCharset
Cached value of $assumed_charset.
Definition: config_cache.c:41
static const char * CachedCharset
Cached value of $charset.
Definition: config_cache.c:43
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:72
struct HashElem * he
Config item that changed.
Definition: subset.h:74
String list.
Definition: slist.h:37
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: subset.c:258
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_color_observer()

static int env_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 753 of file window.c.

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

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

◆ env_email_observer()

static int env_email_observer ( struct NotifyCallback nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 842 of file window.c.

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

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

◆ env_window_observer()

static int env_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 905 of file window.c.

906{
907 if (nc->event_type != NT_WINDOW)
908 return 0;
909 if (!nc->global_data || !nc->event_data)
910 return -1;
911
912 struct MuttWindow *win_env = nc->global_data;
913 struct EventWindow *ev_w = nc->event_data;
914 if (ev_w->win != win_env)
915 return 0;
916
918 {
919 win_env->actions |= WA_RECALC;
920 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
921 }
922 else if (nc->event_subtype == NT_WINDOW_DELETE)
923 {
924 struct EnvelopeWindowData *wdata = win_env->wdata;
925
931 mutt_debug(LL_DEBUG5, "window delete done\n");
932 }
933
934 return 0;
935}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition: window.c:842
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: window.c:753
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: window.c:905
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: window.c:789
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: window.c:866
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alldialogs_window_observer()

static int alldialogs_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the All Dialogs window

Definition at line 183 of file dialog.c.

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

◆ msgwin_window_observer()

static int msgwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • State (this window): refresh the window
  • Delete (this window): clean up the resources held by the Message Window

Definition at line 327 of file msgwin.c.

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

◆ rootwin_config_observer()

static int rootwin_config_observer ( struct NotifyCallback nc)
static

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

The Root Window is affected by changes to $status_on_top.

Definition at line 113 of file rootwin.c.

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

◆ rootwin_resize_observer()

static int rootwin_resize_observer ( struct NotifyCallback nc)
static

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

This function is triggered by SIGWINCH.

Definition at line 153 of file rootwin.c.

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

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 174 of file rootwin.c.

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

◆ sbar_color_observer()

static int sbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

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

Definition at line 116 of file sbar.c.

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

◆ sbar_window_observer()

static int sbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 148 of file sbar.c.

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

◆ simple_config_observer()

static int simple_config_observer ( struct NotifyCallback nc)
static

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

The Simple Dialog is affected by changes to $status_on_top.

Definition at line 80 of file simple.c.

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

◆ simple_window_observer()

static int simple_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 104 of file simple.c.

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

◆ helpbar_binding_observer()

static int helpbar_binding_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 200 of file helpbar.c.

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

◆ helpbar_color_observer()

static int helpbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

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

Definition at line 229 of file helpbar.c.

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

◆ helpbar_config_observer()

static int helpbar_config_observer ( struct NotifyCallback nc)
static

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

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

Definition at line 258 of file helpbar.c.

259{
260 if (nc->event_type != NT_CONFIG)
261 return 0;
262 if (!nc->global_data || !nc->event_data)
263 return -1;
264
265 struct EventConfig *ev_c = nc->event_data;
266 if (!mutt_str_equal(ev_c->name, "help"))
267 return 0;
268
269 struct MuttWindow *win_helpbar = nc->global_data;
270 win_helpbar->state.visible = cs_subset_bool(NeoMutt->sub, "help");
271
272 mutt_window_reflow(win_helpbar->parent);
273 mutt_debug(LL_DEBUG5, "config done: '%s', request WA_REFLOW on parent\n", ev_c->name);
274 return 0;
275}
bool visible
Window is visible.
Definition: mutt_window.h: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 286 of file helpbar.c.

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

◆ main_hist_observer()

int main_hist_observer ( struct NotifyCallback nc)

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

Definition at line 713 of file history.c.

714{
715 if (nc->event_type != NT_CONFIG)
716 return 0;
717 if (!nc->event_data)
718 return -1;
719
720 struct EventConfig *ev_c = nc->event_data;
721
722 if (!mutt_str_equal(ev_c->name, "history"))
723 return 0;
724
726 mutt_debug(LL_DEBUG5, "history done\n");
727 return 0;
728}
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition: history.c:476
+ 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:1031
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:456
@ NT_TIMEOUT
Timeout has occurred.
Definition: notify_type.h:56
void * adata
Private data (for Mailbox backends)
Definition: account.h:42
IMAP-specific Account data -.
Definition: adata.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_mailbox_observer()

static int index_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

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

Definition at line 585 of file dlg_index.c.

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

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

◆ index_attach_observer()

static int index_attach_observer ( struct NotifyCallback nc)
static

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

Definition at line 241 of file index.c.

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

◆ index_color_observer()

static int index_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 260 of file index.c.

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

◆ index_config_observer()

static int index_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 385 of file index.c.

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

◆ index_global_observer()

static int index_global_observer ( struct NotifyCallback nc)
static

Notification that a Global event occurred - Implements observer_t -.

Definition at line 426 of file index.c.

427{
428 if (nc->event_type != NT_GLOBAL)
429 return 0;
430 if (!nc->global_data)
431 return -1;
433 return 0;
434
435 struct MuttWindow *win = nc->global_data;
436 struct MuttWindow *dlg = dialog_find(win);
437 if (!dlg)
438 return 0;
439
440 struct IndexSharedData *shared = dlg->wdata;
442
443 return 0;
444}
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:63
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition: notify_type.h:46
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition: score.c:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_index_observer()

static int index_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 449 of file index.c.

450{
451 if (!nc->global_data)
452 return -1;
453
454 struct MuttWindow *win = nc->global_data;
455 win->actions |= WA_RECALC;
456
457 struct Menu *menu = win->wdata;
459 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
460
461 struct IndexPrivateData *priv = menu->mdata;
462 struct IndexSharedData *shared = priv->shared;
463 if (shared && shared->mailbox)
464 menu->max = shared->mailbox->vcount;
465 else
466 menu->max = 0;
467
468 return 0;
469}
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:40
int vcount
The number of virtual messages.
Definition: mailbox.h:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_menu_observer()

static int index_menu_observer ( struct NotifyCallback nc)
static

Notification that the Menu has changed - Implements observer_t -.

Definition at line 474 of file index.c.

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

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback nc)
static

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

Definition at line 496 of file index.c.

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

◆ index_subjrx_observer()

static int index_subjrx_observer ( struct NotifyCallback nc)
static

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

Definition at line 528 of file index.c.

529{
530 if (nc->event_type != NT_SUBJRX)
531 return 0;
532 if (!nc->global_data)
533 return -1;
534
535 struct MuttWindow *win = nc->global_data;
536 struct MuttWindow *dlg = dialog_find(win);
537 struct IndexSharedData *shared = dlg->wdata;
538
540 mutt_debug(LL_DEBUG5, "subjectrx done\n");
541 return 0;
542}
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:55
void subjrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition: subjectrx.c:152
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_observer()

static int index_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 547 of file index.c.

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

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 72 of file ipanel.c.

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

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ipanel.c.

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

◆ index_shared_mview_observer()

static int index_shared_mview_observer ( struct NotifyCallback nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 43 of file shared_data.c.

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

◆ index_shared_account_observer()

static int index_shared_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 68 of file shared_data.c.

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

◆ index_shared_mailbox_observer()

static int index_shared_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 93 of file shared_data.c.

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

◆ index_shared_email_observer()

static int index_shared_email_observer ( struct NotifyCallback nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 118 of file shared_data.c.

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

◆ main_config_observer()

int main_config_observer ( struct NotifyCallback nc)

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

Definition at line 259 of file init.c.

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

◆ main_timeout_observer()

int main_timeout_observer ( struct NotifyCallback nc)

Notification that a timeout has occurred - Implements observer_t -.

Definition at line 508 of file main.c.

509{
510 static time_t last_run = 0;
511
512 if (nc->event_type != NT_TIMEOUT)
513 return 0;
514
515 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
516 if (c_timeout <= 0)
517 goto done;
518
519 time_t now = mutt_date_now();
520 if (now < (last_run + c_timeout))
521 goto done;
522
523 // Limit hook to running under the Index or Pager
525 struct MuttWindow *dlg = dialog_find(focus);
526 if (!dlg || (dlg->type != WT_DLG_INDEX))
527 goto done;
528
529 last_run = now;
531
532done:
533 mutt_debug(LL_DEBUG5, "timeout done\n");
534 return 0;
535}
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:931
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:668
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_color_observer()

static int menu_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 41 of file observer.c.

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

◆ menu_window_observer()

static int menu_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 97 of file observer.c.

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

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

◆ mview_mailbox_observer()

int mview_mailbox_observer ( struct NotifyCallback nc)

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 324 of file mview.c.

325{
326 if (nc->event_type != NT_MAILBOX)
327 return 0;
328 if (!nc->global_data)
329 return -1;
330
331 struct MailboxView *mv = nc->global_data;
332
333 switch (nc->event_subtype)
334 {
337 mview_clean(mv);
338 break;
340 mview_update(mv);
341 break;
343 update_tables(mv);
344 break;
346 mutt_sort_headers(mv, true);
347 break;
348 default:
349 return 0;
350 }
351
352 mutt_debug(LL_DEBUG5, "mailbox done\n");
353 return 0;
354}
@ NT_MAILBOX_RESORT
Email list needs resorting.
Definition: mailbox.h:190
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:189
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:191
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition: sort.c:355
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:719
static void mview_clean(struct MailboxView *mv)
Release memory and initialize a MailboxView.
Definition: mview.c:118
static void update_tables(struct MailboxView *mv)
Update a MailboxView's internal tables.
Definition: mview.c:234
void mview_update(struct MailboxView *mv)
Update the MailboxView's message counts.
Definition: mview.c:138
View of a Mailbox.
Definition: mview.h:40
struct ThreadsContext * threads
Threads context.
Definition: mview.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_key_config_observer()

static int gpgme_key_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 132 of file dlg_gpgme.c.

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

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

◆ 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 160 of file dlg_pgp.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 pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:160
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:131
+ 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
270 mutt_debug(LL_DEBUG5, "color done\n");
271 return 0;
272}
#define FREE(x)
Definition: memory.h:55
void qstyle_recolor(struct QuoteStyle *quote_list)
Recolour quotes after colour changes.
Definition: qstyle.c:464
#define COLOR_QUOTED(cid)
Definition: quoted.h:39
struct TextSyntax * syntax
Array of coloured text in the line.
Definition: display.h:57
Private state data for the Pager.
Definition: private_data.h:41
int lines_used
Size of lines array (used entries)
Definition: private_data.h:49
int lines_max
Capacity of lines array (total entries)
Definition: private_data.h:50
struct Line * lines
Array of text lines in pager.
Definition: private_data.h:48
struct QuoteStyle * quote_list
Tree of quoting levels.
Definition: private_data.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_config_observer()

static int pager_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 277 of file pager.c.

278{
279 if (nc->event_type != NT_CONFIG)
280 return 0;
281 if (!nc->global_data || !nc->event_data)
282 return -1;
283
284 struct EventConfig *ev_c = nc->event_data;
285 struct MuttWindow *win_pager = nc->global_data;
286
287 if (mutt_str_equal(ev_c->name, "pager_index_lines"))
288 {
289 config_pager_index_lines(win_pager);
290 mutt_debug(LL_DEBUG5, "config done\n");
291 }
292
293 return 0;
294}
static int config_pager_index_lines(struct MuttWindow *win)
React to changes to $pager_index_lines.
Definition: pager.c:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_global_observer()

static int pager_global_observer ( struct NotifyCallback nc)
static

Notification that a Global Event occurred - Implements observer_t -.

Definition at line 299 of file pager.c.

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

◆ pager_index_observer()

static int pager_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 323 of file pager.c.

324{
325 if (nc->event_type != NT_INDEX)
326 return 0;
327 if (!nc->global_data)
328 return -1;
329
330 struct MuttWindow *win_pager = nc->global_data;
331
332 struct PagerPrivateData *priv = win_pager->wdata;
333 if (!priv)
334 return 0;
335
336 struct IndexSharedData *shared = nc->event_data;
337
339 {
340 win_pager->actions |= WA_RECALC;
341 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
342 priv->loop = PAGER_LOOP_QUIT;
343 }
344 else if (nc->event_subtype & NT_INDEX_EMAIL)
345 {
346 win_pager->actions |= WA_RECALC;
347 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
348 priv->pager_redraw = true;
349 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
350 {
351 priv->loop = PAGER_LOOP_RELOAD;
352 }
353 else
354 {
355 priv->loop = PAGER_LOOP_QUIT;
356 priv->rc = 0;
357 }
358 }
359
360 return 0;
361}
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition: lib.h:70
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition: lib.h:154
@ PAGER_LOOP_QUIT
Quit the Pager.
Definition: lib.h:153
bool pager_redraw
Force a complete redraw.
Definition: private_data.h:78
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
Definition: private_data.h:79
+ Here is the caller graph for this function:

◆ pager_pager_observer()

static int pager_pager_observer ( struct NotifyCallback nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 366 of file pager.c.

367{
368 if (nc->event_type != NT_PAGER)
369 return 0;
370 if (!nc->global_data || !nc->event_data)
371 return -1;
372
373 mutt_debug(LL_DEBUG5, "pager done\n");
374 return 0;
375}
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:53
+ Here is the caller graph for this function:

◆ pager_window_observer()

static int pager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 380 of file pager.c.

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

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

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

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

238{
239 if (nc->event_type != NT_PAGER)
240 return 0;
241 if (!nc->global_data)
242 return -1;
243
244 struct MuttWindow *win_pbar = nc->global_data;
245
247 {
248 win_pbar->actions |= WA_RECALC;
249 mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
250 }
251
252 return 0;
253}
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:187
+ Here is the caller graph for this function:

◆ pbar_window_observer()

static int pbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 258 of file pbar.c.

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

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 72 of file ppanel.c.

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

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ppanel.c.

95{
96 if (nc->event_type != NT_WINDOW)
97 return 0;
98 if (!nc->global_data || !nc->event_data)
99 return -1;
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}
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition: dlg_pager.c:127
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
#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:

◆ 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 -.
Definition: dlg_pattern.c:251
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pattern.c:225
+ 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 126 of file dlg_postpone.c.

127{
128 if (nc->event_type != NT_CONFIG)
129 return 0;
130 if (!nc->global_data || !nc->event_data)
131 return -1;
132
133 struct EventConfig *ev_c = nc->event_data;
134
135 if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
136 return 0;
137
138 struct Menu *menu = nc->global_data;
140 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
141
142 return 0;
143}
+ 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 152 of file dlg_postpone.c.

153{
154 if (nc->event_type != NT_WINDOW)
155 return 0;
156 if (!nc->global_data || !nc->event_data)
157 return -1;
159 return 0;
160
161 struct MuttWindow *win_menu = nc->global_data;
162 struct EventWindow *ev_w = nc->event_data;
163 if (ev_w->win != win_menu)
164 return 0;
165
166 struct Menu *menu = win_menu->wdata;
167
170
171 mutt_debug(LL_DEBUG5, "window delete done\n");
172 return 0;
173}
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:152
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:126
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 173 of file observer.c.

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

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 200 of file observer.c.

201{
202 if (nc->event_type != NT_COLOR)
203 return 0;
204 if (!nc->global_data || !nc->event_data)
205 return -1;
206
207 struct EventColor *ev_c = nc->event_data;
208 struct MuttWindow *win = nc->global_data;
209
210 enum ColorId cid = ev_c->cid;
211
212 if (cid == MT_COLOR_MAX) // Sent on `uncolor *`
213 {
214 // Set a default style
216 ac->attrs = A_UNDERLINE;
217 }
218
219 switch (cid)
220 {
222 case MT_COLOR_NORMAL:
232 case MT_COLOR_MAX: // Sent on `uncolor *`
233 win->actions |= WA_REPAINT;
234 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
235 break;
236
237 default:
238 break;
239 }
240 return 0;
241}
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:62
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:66
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:69
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:68
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:67
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
Definition: color.h:61
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:65
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:64
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:63
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 246 of file observer.c.

247{
248 if (nc->event_type != NT_COMMAND)
249 return 0;
250 if (!nc->global_data || !nc->event_data)
251 return -1;
252
253 struct Command *cmd = nc->event_data;
254
255 if ((cmd->parse != sb_parse_sidebar_pin) && (cmd->parse != sb_parse_sidebar_unpin))
256 return 0;
257
258 struct MuttWindow *win = nc->global_data;
259 win->actions |= WA_RECALC;
260 mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
261 return 0;
262}
enum CommandResult sb_parse_sidebar_pin(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_pin' command - Implements Command::parse() -.
Definition: commands.c:41
enum CommandResult sb_parse_sidebar_unpin(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_unpin' command - Implements Command::parse() -.
Definition: commands.c:60
@ NT_COMMAND
A Command has been executed, Command.
Definition: notify_type.h:42
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Definition: command.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback nc)
static

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

Definition at line 267 of file observer.c.

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

◆ sb_index_observer()

static int sb_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 352 of file observer.c.

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

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 376 of file observer.c.

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

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 405 of file observer.c.

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

◆ sb_insertion_window_observer()

int sb_insertion_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 473 of file observer.c.

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