NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Observer API

Prototype for a notification callback function. More...

Functions

static int alias_alias_observer (struct NotifyCallback *nc)
 Notification that an Alias has changed - Implements observer_t -.
 
static int alias_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int query_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int attach_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int attach_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int autocrypt_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int autocrypt_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int browser_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int browser_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int browser_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int quoted_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int attach_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
int cbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
int cbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int cbar_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int cbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int compose_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int compose_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -.
 
static int compose_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int preview_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int preview_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int preview_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int cc_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int env_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int env_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int env_email_observer (struct NotifyCallback *nc)
 Notification that the Email has changed - Implements observer_t -.
 
static int env_header_observer (struct NotifyCallback *nc)
 Notification that a User Header has changed - Implements observer_t -.
 
static int env_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int alldialogs_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int msgwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int mview_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int rootwin_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int rootwin_resize_observer (struct NotifyCallback *nc)
 Notification that the terminal has been resized - Implements observer_t -.
 
static int rootwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int helpbar_binding_observer (struct NotifyCallback *nc)
 Notification that a Key Binding has changed - Implements observer_t -.
 
static int helpbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int helpbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int helpbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has change - Implements observer_t -.
 
static int imap_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int imap_mailbox_delete_observer (struct NotifyCallback *nc)
 Notification that a Mailbox is about to be deleted - 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_subjectrx_observer (struct NotifyCallback *nc)
 Notification that a 'subject-regex' command has occurred - Implements observer_t -.
 
static int index_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ipanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ipanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int index_shared_mview_observer (struct NotifyCallback *nc)
 Notification that the MailboxView has changed - Implements observer_t -.
 
static int index_shared_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int index_shared_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int index_shared_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -.
 
int km_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int main_timeout_observer (struct NotifyCallback *nc)
 Notification that a timeout has occurred - Implements observer_t -.
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int dopager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int dopager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pbar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pbar_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int ppanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int ppanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int pattern_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pattern_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int postponed_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int postponed_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static int sb_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -.
 
static int sb_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sb_command_observer (struct NotifyCallback *nc)
 Notification that a Command has occurred - Implements observer_t -.
 
static int sb_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int sb_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
static int sb_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
int sb_insertion_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 

Detailed Description

Prototype for a notification callback function.

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

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback * nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 156 of file dlg_alias.c.

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

◆ alias_window_observer()

static int alias_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 203 of file dlg_alias.c.

204{
205 if (nc->event_type != NT_WINDOW)
206 return 0;
207 if (!nc->global_data || !nc->event_data)
208 return -1;
210 return 0;
211
212 struct MuttWindow *win_menu = nc->global_data;
213 struct EventWindow *ev_w = nc->event_data;
214 if (ev_w->win != win_menu)
215 return 0;
216
217 struct Menu *menu = win_menu->wdata;
218
222
223 mutt_debug(LL_DEBUG5, "window delete done\n");
224 return 0;
225}
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_alias.c:203
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition dlg_alias.c:156
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition gui.c:43
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition notify.c:230
@ NT_WINDOW_DELETE
Window is about to be deleted.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition subset.h:51
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
+ 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 278 of file dlg_query.c.

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

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback * nc)
static

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

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

Definition at line 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 187 of file dlg_autocrypt.c.

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

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

693{
694 if (nc->event_type != NT_CONFIG)
695 return 0;
696 if (!nc->global_data || !nc->event_data)
697 return -1;
698
699 struct EventConfig *ev_c = nc->event_data;
700
701 struct BrowserPrivateData *priv = nc->global_data;
702 struct Menu *menu = priv->menu;
703
704 if (mutt_str_equal(ev_c->name, "browser_sort_dirs_first"))
705 {
706 struct BrowserState *state = &priv->state;
707 browser_sort(state);
708 browser_highlight_default(state, menu);
709 }
710 else if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
711 !mutt_str_equal(ev_c->name, "browser_sort") &&
712 !mutt_str_equal(ev_c->name, "date_format") &&
713 !mutt_str_equal(ev_c->name, "folder") &&
714 !mutt_str_equal(ev_c->name, "folder_format") &&
715 !mutt_str_equal(ev_c->name, "group_index_format") &&
716 !mutt_str_equal(ev_c->name, "mailbox_folder_format"))
717 {
718 return 0;
719 }
720
722 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
723
724 return 0;
725}
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition sort.c:186
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Private state data for the Browser.
struct Menu * menu
Menu.
struct BrowserState state
State containing list of files/dir/mailboxes.
State of the file/mailbox browser.
Definition lib.h:142
+ 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 732 of file dlg_browser.c.

733{
734 if (nc->event_type != NT_MAILBOX)
735 return 0;
737 return 0;
738 if (!nc->global_data || !nc->event_data)
739 return -1;
740
741 struct BrowserPrivateData *priv = nc->global_data;
742
743 struct BrowserState *state = &priv->state;
744 if (state->is_mailbox_list)
745 {
746 struct EventMailbox *ev_m = nc->event_data;
747 struct Mailbox *m = ev_m->mailbox;
748 struct FolderFile *ff = NULL;
749 ARRAY_FOREACH(ff, &state->entry)
750 {
751 if (ff->gen != m->gen)
752 continue;
753
754 ff->has_new_mail = m->has_new;
755 ff->msg_count = m->msg_count;
756 ff->msg_unread = m->msg_unread;
757 ff->notify_user = m->notify_user;
759 mutt_str_replace(&ff->desc, m->name);
760 break;
761 }
762 }
763
765 mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC, MENU_REDRAW_FULL\n");
766
767 return 0;
768}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition mailbox.h:173
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition notify_type.h:49
bool is_mailbox_list
Viewing mailboxes.
Definition lib.h:146
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
Definition lib.h:143
An Event that happened to a Mailbox.
Definition mailbox.h:189
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition mailbox.h:190
Browser entry representing a folder/dir.
Definition lib.h:76
bool has_new_mail
true if mailbox has "new mail"
Definition lib.h:87
bool poll_new_mail
Check mailbox for new mail.
Definition lib.h:99
bool notify_user
User will be notified of new mail.
Definition lib.h:98
char * desc
Description of mailbox.
Definition lib.h:85
int gen
Unique id, used for (un)sorting.
Definition lib.h:103
int msg_count
total number of messages
Definition lib.h:88
int msg_unread
number of unread messages
Definition lib.h:89
A mailbox.
Definition mailbox.h:78
bool has_new
Mailbox has new mail.
Definition mailbox.h:84
int msg_count
Total number of messages.
Definition mailbox.h:87
bool poll_new_mail
Check for new mail.
Definition mailbox.h:114
char * name
A short name for the Mailbox.
Definition mailbox.h:81
bool notify_user
Notify the user of new mail.
Definition mailbox.h:112
int msg_unread
Number of unread messages.
Definition mailbox.h:88
int gen
Generation number, for sorting.
Definition mailbox.h:146
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_window_observer()

static int browser_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 777 of file dlg_browser.c.

778{
779 if (nc->event_type != NT_WINDOW)
780 return 0;
781 if (!nc->global_data || !nc->event_data)
782 return -1;
784 return 0;
785
786 struct BrowserPrivateData *priv = nc->global_data;
787 struct MuttWindow *win_menu = priv->menu->win;
788
789 struct EventWindow *ev_w = nc->event_data;
790 if (ev_w->win != win_menu)
791 return 0;
792
796
797 mutt_debug(LL_DEBUG5, "window delete done\n");
798 return 0;
799}
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoted_color_observer()

static int quoted_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 42 of file quoted.c.

43{
44 if (nc->event_type != NT_COLOR)
45 return 0;
46 if (!nc->event_data)
47 return -1;
48
49 struct EventColor *ev_c = nc->event_data;
50 enum ColorId cid = ev_c->cid;
51
52 if (!COLOR_QUOTED(cid))
53 return 0;
54
56
57 // Find the highest-numbered quotedN in use
58 for (int i = MT_COLOR_QUOTED9; i >= MT_COLOR_QUOTED0; i--)
59 {
61 {
62 mod_data->num_quoted_colors = i - MT_COLOR_QUOTED0 + 1;
63 break;
64 }
65 }
66
67 return 0;
68}
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
Definition simple.c:119
ColorId
List of all coloured objects.
Definition color.h:35
@ MT_COLOR_QUOTED0
Pager: quoted text, level 0.
Definition color.h:57
@ MT_COLOR_QUOTED9
Pager: quoted text, level 9.
Definition color.h:66
@ MODULE_ID_COLOR
ModuleColor, Color
Definition module_api.h:53
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:665
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition notify_type.h:41
#define COLOR_QUOTED(cid)
Definition quoted.h:28
Color private Module data.
Definition module_data.h:35
int num_quoted_colors
Number of colours for quoted email text.
Definition module_data.h:41
An Event that happened to a Colour.
Definition notify2.h:52
enum ColorId cid
Colour ID that has changed.
Definition notify2.h:53
+ 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 128 of file attach.c.

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

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback * nc)

Notification that a Color has changed - Implements observer_t -.

Definition at line 125 of file cbar.c.

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

◆ cbar_config_observer()

int cbar_config_observer ( struct NotifyCallback * nc)

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

Definition at line 151 of file cbar.c.

152{
153 if (nc->event_type != NT_CONFIG)
154 return 0;
155 if (!nc->global_data || !nc->event_data)
156 return -1;
157
158 struct EventConfig *ev_c = nc->event_data;
159 if (!mutt_str_equal(ev_c->name, "compose_format"))
160 return 0;
161
162 struct MuttWindow *win_cbar = nc->global_data;
163 win_cbar->actions |= WA_RECALC;
164 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
165
166 return 0;
167}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cbar_email_observer()

static int cbar_email_observer ( struct NotifyCallback * nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 172 of file cbar.c.

173{
174 if (nc->event_type != NT_EMAIL)
175 return 0;
176 if (!nc->global_data)
177 return -1;
178
179 struct MuttWindow *win_cbar = nc->global_data;
180 win_cbar->actions |= WA_RECALC;
181 mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
182
183 return 0;
184}
+ Here is the caller graph for this function:

◆ cbar_window_observer()

static int cbar_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 189 of file cbar.c.

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

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

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

223{
224 if (nc->event_type != NT_WINDOW)
225 return 0;
226 if (!nc->global_data || !nc->event_data)
227 return -1;
228
229 struct MuttWindow *dlg = nc->global_data;
230 struct EventWindow *ev_w = nc->event_data;
231 if (ev_w->win != dlg)
232 return 0;
233
234 struct ComposeSharedData *shared = dlg->wdata;
235
237 {
238 dlg->actions |= WA_RECALC;
239 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
240 }
241 else if (nc->event_subtype == NT_WINDOW_DELETE)
242 {
246 mutt_debug(LL_DEBUG5, "window delete done\n");
247 }
248
249 return 0;
250}
static int compose_email_observer(struct NotifyCallback *nc)
Notification that an Email has changed - Implements observer_t -.
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preview_color_observer()

static int preview_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 238 of file preview.c.

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

◆ preview_email_observer()

static int preview_email_observer ( struct NotifyCallback * nc)
static

Notification that the Email has changed - Implements observer_t -.

Definition at line 269 of file preview.c.

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

◆ preview_window_observer()

static int preview_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 286 of file preview.c.

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

◆ cc_config_observer()

static int cc_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 50 of file config_cache.c.

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

◆ env_color_observer()

static int env_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 764 of file window.c.

765{
766 if (nc->event_type != NT_COLOR)
767 return 0;
768 if (!nc->global_data || !nc->event_data)
769 return -1;
770
771 struct EventColor *ev_c = nc->event_data;
772 struct MuttWindow *win_env = nc->global_data;
773
774 enum ColorId cid = ev_c->cid;
775
776 switch (cid)
777 {
778 case MT_COLOR_BOLD:
784 case MT_COLOR_NORMAL:
785 case MT_COLOR_STATUS:
786 case MT_COLOR_MAX: // Sent on `uncolor *`
787 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
788 win_env->actions |= WA_REPAINT;
789 break;
790
791 default:
792 break;
793 }
794 return 0;
795}
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition color.h:43
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition color.h:44
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition color.h:42
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition color.h:45
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition color.h:41
+ 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 800 of file window.c.

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

854{
855 if ((nc->event_type != NT_EMAIL) && (nc->event_type != NT_ENVELOPE))
856 return 0;
857 if (!nc->global_data)
858 return -1;
859
860 struct MuttWindow *win_env = nc->global_data;
861
862 // pgp/smime/autocrypt menu, or external change
863 if (nc->event_type == NT_EMAIL)
864 {
865 struct EnvelopeWindowData *wdata = win_env->wdata;
866 update_crypt_info(wdata);
867 }
868
869 win_env->actions |= WA_RECALC;
870 mutt_debug(LL_DEBUG5, "email done, request WA_RECALC\n");
871 return 0;
872}
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 877 of file window.c.

878{
879 if (nc->event_type != NT_HEADER)
880 return 0;
881 if (!nc->global_data || !nc->event_data)
882 return -1;
883
884 const struct EventHeader *ev_h = nc->event_data;
885 struct MuttWindow *win_env = nc->global_data;
886 struct EnvelopeWindowData *wdata = win_env->wdata;
887
888 struct Envelope *env = wdata->email->env;
889
891 {
892 header_set(&env->userhdrs, ev_h->header);
893 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
894 win_env->actions |= WA_RECALC;
895 return 0;
896 }
897
899 {
900 struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
901 if (removed)
902 {
903 header_free(&env->userhdrs, removed);
904 mutt_debug(LL_DEBUG5, "header done, request reflow\n");
905 win_env->actions |= WA_RECALC;
906 }
907 return 0;
908 }
909
910 return 0;
911}
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 916 of file window.c.

917{
918 if (nc->event_type != NT_WINDOW)
919 return 0;
920 if (!nc->global_data || !nc->event_data)
921 return -1;
922
923 struct MuttWindow *win_env = nc->global_data;
924 struct EventWindow *ev_w = nc->event_data;
925 if (ev_w->win != win_env)
926 return 0;
927
929 {
930 win_env->actions |= WA_RECALC;
931 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
932 }
933 else if (nc->event_subtype == NT_WINDOW_DELETE)
934 {
935 struct EnvelopeWindowData *wdata = win_env->wdata;
936
942 mutt_debug(LL_DEBUG5, "window delete done\n");
943 }
944
945 return 0;
946}
static int env_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
Definition window.c:853
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition window.c:764
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition window.c:916
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition window.c:800
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition window.c:877
+ 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 194 of file dialog.c.

195{
196 if (nc->event_type != NT_WINDOW)
197 return 0;
198 if (!nc->global_data || !nc->event_data)
199 return -1;
201 return 0;
202
203 struct MuttWindow *win_alldlgs = nc->global_data;
204 struct EventWindow *ev_w = nc->event_data;
205 if (ev_w->win != win_alldlgs)
206 return 0;
207
208 notify_observer_remove(win_alldlgs->notify, alldialogs_window_observer, win_alldlgs);
209
211 if (mod_data)
212 mod_data->all_dialogs_window = NULL;
213 mutt_debug(LL_DEBUG5, "window delete done\n");
214 return 0;
215}
static int alldialogs_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dialog.c:194
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
Gui private Module data.
Definition module_data.h:32
struct MuttWindow * all_dialogs_window
Parent of all Dialogs.
Definition module_data.h:38
+ 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 328 of file msgwin.c.

329{
330 if (nc->event_type != NT_WINDOW)
331 return 0;
332 if (!nc->global_data || !nc->event_data)
333 return -1;
334
335 struct MuttWindow *win = nc->global_data;
336 struct EventWindow *ev_w = nc->event_data;
337 if (ev_w->win != win)
338 return 0;
339
341 {
342 if (ev_w->flags & WN_HIDDEN)
343 {
345 }
346
347 if (ev_w->flags & (WN_NARROWER | WN_WIDER))
348 {
349 struct MsgWinWindowData *wdata = win->wdata;
351 buf_string(wdata->text)));
352 win->actions |= WA_RECALC;
353 }
354 else
355 {
356 win->actions |= WA_REPAINT;
357 }
358 mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
359 }
360 else if (nc->event_subtype == NT_WINDOW_DELETE)
361 {
363 mutt_debug(LL_DEBUG5, "window delete done\n");
364 }
365 return 0;
366}
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:328
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition msgwin.c:522
int msgwin_calc_rows(struct MsgWinWindowData *wdata, int cols, const char *str)
How many rows will a string need?
Definition msgwin.c:179
void msgwin_set_rows(struct MuttWindow *win, short rows)
Resize the Message Window.
Definition msgwin.c:304
#define WN_WIDER
Window became wider.
#define WN_HIDDEN
Window became hidden.
#define WN_NARROWER
Window became narrower.
WindowNotifyFlags flags
Attributes of Window that changed.
Message Window private Window data.
struct Buffer * text
Cached display string.
struct WindowState state
Current state of the Window.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mview_mailbox_observer()

int mview_mailbox_observer ( struct NotifyCallback * nc)

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 322 of file mview.c.

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

◆ rootwin_config_observer()

static int rootwin_config_observer ( struct NotifyCallback * nc)
static

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

The Root Window is affected by changes to $status_on_top.

Definition at line 112 of file rootwin.c.

113{
114 if (nc->event_type != NT_CONFIG)
115 return 0;
116 if (!nc->global_data || !nc->event_data)
117 return -1;
118
119 struct EventConfig *ev_c = nc->event_data;
120 struct MuttWindow *win_root = nc->global_data;
121
122 if (!mutt_str_equal(ev_c->name, "status_on_top"))
123 return 0;
124
125 struct MuttWindow **wp_first = ARRAY_FIRST(&win_root->children);
126 if (!wp_first)
127 return 0;
128
129 struct MuttWindow *first = *wp_first;
130
131 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
132 if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
133 (!c_status_on_top && (first->type != WT_HELP_BAR)))
134 {
135 // Swap the HelpBar and the AllDialogsWindow
136 if (ARRAY_SIZE(&win_root->children) < 2)
137 return 0;
138
139 struct MuttWindow **wp_next = ARRAY_GET(&win_root->children, 1);
140 if (!wp_next)
141 return 0;
142
143 struct MuttWindow *next = *wp_next;
144 ARRAY_REMOVE(&win_root->children, wp_next);
145 ARRAY_INSERT(&win_root->children, 0, next);
146
147 mutt_window_reflow(win_root);
148 mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
149 }
150
151 return 0;
152}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition array.h:136
#define ARRAY_INSERT(head, idx, elem)
Insert an element into the, shifting up the subsequent entries.
Definition array.h:338
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition mutt_window.h:95
struct MuttWindowArray children
Children Windows.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_resize_observer()

static int rootwin_resize_observer ( struct NotifyCallback * nc)
static

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

This function is triggered by SIGWINCH.

Definition at line 159 of file rootwin.c.

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

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 180 of file rootwin.c.

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

186{
187 if (nc->event_type != NT_BINDING)
188 return 0;
189 if (!nc->global_data || !nc->event_data)
190 return -1;
191 if (nc->event_subtype >= NT_MACRO_ADD)
192 return 0;
193
194 struct MuttWindow *win_helpbar = nc->global_data;
195 struct HelpbarWindowData *wdata = helpbar_wdata_get(win_helpbar);
196 if (!wdata)
197 return 0;
198
199 struct EventBinding *ev_b = nc->event_data;
200 if (wdata->help_md && (wdata->help_md != ev_b->menu))
201 return 0;
202
203 win_helpbar->actions |= WA_RECALC;
204 mutt_debug(LL_DEBUG5, "binding done, request WA_RECALC\n");
205 return 0;
206}
struct HelpbarWindowData * helpbar_wdata_get(struct MuttWindow *win)
Get the Helpbar data for this window.
Definition wdata.c:64
@ NT_MACRO_ADD
Key macro has been added.
Definition notify.h:47
@ NT_BINDING
Key binding has changed, NotifyBinding, EventBinding.
Definition notify_type.h:40
A key binding Event.
Definition notify.h:30
const struct MenuDefinition * menu
Menu Definition.
Definition notify.h:31
Help Bar Window data -.
Definition private.h:34
const struct MenuDefinition * help_md
Menu Definition for key bindings.
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 214 of file helpbar.c.

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

244{
245 if (nc->event_type != NT_CONFIG)
246 return 0;
247 if (!nc->global_data || !nc->event_data)
248 return -1;
249
250 struct EventConfig *ev_c = nc->event_data;
251 if (!mutt_str_equal(ev_c->name, "help"))
252 return 0;
253
254 struct MuttWindow *win_helpbar = nc->global_data;
255 win_helpbar->state.visible = cs_subset_bool(NeoMutt->sub, "help");
256
257 mutt_window_reflow(win_helpbar->parent);
258 mutt_debug(LL_DEBUG5, "config done: '%s', request WA_REFLOW on parent\n", ev_c->name);
259 return 0;
260}
bool visible
Window is visible.
Definition mutt_window.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_window_observer()

static int helpbar_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

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

Definition at line 271 of file helpbar.c.

272{
273 if (nc->event_type != NT_WINDOW)
274 return 0;
275 if (!nc->global_data || !nc->event_data)
276 return -1;
277
278 struct MuttWindow *win_helpbar = nc->global_data;
279
281 {
282 if (!mutt_window_is_visible(win_helpbar))
283 return 0;
284
285 win_helpbar->actions |= WA_RECALC;
286 mutt_debug(LL_DEBUG5, "window focus: request WA_RECALC\n");
287 return 0;
288 }
289
290 // The next two notifications must be specifically for us
291 struct EventWindow *ew = nc->event_data;
292 if (ew->win != win_helpbar)
293 return 0;
294
296 {
297 win_helpbar->actions |= WA_RECALC;
298 mutt_debug(LL_DEBUG5, "window state: request WA_RECALC\n");
299 }
300 else if (nc->event_subtype == NT_WINDOW_DELETE)
301 {
306 if (gui_data && gui_data->root_window)
308 helpbar_window_observer, win_helpbar);
309 mutt_debug(LL_DEBUG5, "window delete done\n");
310 }
311
312 return 0;
313}
static int helpbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition helpbar.c:214
static int helpbar_binding_observer(struct NotifyCallback *nc)
Notification that a Key Binding has changed - Implements observer_t -.
Definition helpbar.c:185
static int helpbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition helpbar.c:271
static int helpbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition helpbar.c:243
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
@ NT_WINDOW_FOCUS
Window focus has changed.
struct MuttWindow * root_window
Parent of all Windows.
Definition module_data.h:40
+ 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 688 of file history.c.

689{
690 if (nc->event_type != NT_CONFIG)
691 return 0;
692 if (!nc->event_data)
693 return -1;
694
695 struct EventConfig *ev_c = nc->event_data;
696
697 if (!mutt_str_equal(ev_c->name, "history"))
698 return 0;
699
701 mutt_debug(LL_DEBUG5, "history done\n");
702 return 0;
703}
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition history.c:450
+ 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:1220
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Definition date.c:457
@ NT_TIMEOUT
Timeout has occurred.
Definition notify_type.h:56
void * adata
Private data (for Mailbox backends)
Definition account.h:42
IMAP-specific Account data -.
Definition adata.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imap_mailbox_delete_observer()

static int imap_mailbox_delete_observer ( struct NotifyCallback * nc)
static

Notification that a Mailbox is about to be deleted - Implements observer_t -.

Clear adata->mailbox and adata->prev_mailbox if they point to a Mailbox that is being freed, preventing dangling pointer dereferences.

Definition at line 72 of file adata.c.

73{
74 if (nc->event_type != NT_MAILBOX)
75 return 0;
77 return 0;
78 if (!nc->global_data || !nc->event_data)
79 return -1;
80
81 struct ImapAccountData *adata = nc->global_data;
82 const struct EventMailbox *ev_m = nc->event_data;
83
84 if (adata->mailbox == ev_m->mailbox)
85 {
86 mutt_debug(LL_DEBUG3, "stranding adata->mailbox %p\n", (void *) adata->mailbox);
87 adata->mailbox = NULL;
88 }
89 if (adata->prev_mailbox == ev_m->mailbox)
90 {
91 mutt_debug(LL_DEBUG3, "stranding adata->prev_mailbox %p\n", (void *) adata->prev_mailbox);
92 adata->prev_mailbox = NULL;
93 }
94
95 return 0;
96}
@ LL_DEBUG3
Log at debug level 3.
Definition logging2.h:47
struct Mailbox * prev_mailbox
Previously selected mailbox.
Definition adata.h:80
struct Mailbox * mailbox
Current selected mailbox.
Definition adata.h:79
+ 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 605 of file dlg_index.c.

606{
607 if (nc->event_type != NT_MAILBOX)
608 return 0;
609 if (!nc->global_data)
610 return -1;
612 return 0;
613
614 struct Mailbox **ptr = nc->global_data;
615 if (!*ptr)
616 return 0;
617
618 *ptr = NULL;
619 mutt_debug(LL_DEBUG5, "mailbox done\n");
620 return 0;
621}
+ 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 171 of file ibar.c.

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

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

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

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

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

◆ index_altern_observer()

static int index_altern_observer ( struct NotifyCallback * nc)
static

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

Definition at line 223 of file index.c.

224{
225 if (nc->event_type != NT_ALTERN)
226 return 0;
227 if (!nc->global_data)
228 return -1;
229
230 struct MuttWindow *win = nc->global_data;
231 struct MuttWindow *dlg = dialog_find(win);
232 struct IndexSharedData *shared = dlg->wdata;
233
235 mutt_debug(LL_DEBUG5, "alternates done\n");
236 return 0;
237}
void mutt_alternates_reset(struct MailboxView *mv)
Clear the recipient valid flag of all emails.
Definition alternates.c:46
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 242 of file index.c.

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

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

◆ index_config_observer()

static int index_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 386 of file index.c.

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

◆ index_global_observer()

static int index_global_observer ( struct NotifyCallback * nc)
static

Notification that a Global event occurred - Implements observer_t -.

Definition at line 433 of file index.c.

434{
435 if (nc->event_type != NT_GLOBAL)
436 return 0;
437 if (!nc->global_data)
438 return -1;
440 return 0;
441
442 struct MuttWindow *win = nc->global_data;
443 struct MuttWindow *dlg = dialog_find(win);
444 if (!dlg)
445 return 0;
446
447 struct IndexSharedData *shared = dlg->wdata;
449
450 return 0;
451}
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition neomutt.h:71
@ 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:216
+ 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 456 of file index.c.

457{
458 if (!nc->global_data)
459 return -1;
460
461 struct MuttWindow *win = nc->global_data;
462 win->actions |= WA_RECALC;
463
464 struct Menu *menu = win->wdata;
466 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
467
468 struct IndexPrivateData *priv = menu->mdata;
469 struct IndexSharedData *shared = priv->shared;
470 if (shared && shared->mailbox)
471 menu->max = shared->mailbox->vcount;
472 else
473 menu->max = 0;
474
475 return 0;
476}
struct IndexSharedData * shared
Shared Index data.
int vcount
The number of virtual messages.
Definition mailbox.h:98
+ 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 481 of file index.c.

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

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback * nc)
static

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

Definition at line 503 of file index.c.

504{
505 if (nc->event_type != NT_SCORE)
506 return 0;
507 if (!nc->global_data)
508 return -1;
509
510 struct MuttWindow *win = nc->global_data;
511 struct MuttWindow *dlg = dialog_find(win);
512 struct IndexSharedData *shared = dlg->wdata;
513
514 struct Mailbox *m = shared->mailbox;
515 if (!m)
516 return 0;
517
518 for (int i = 0; i < m->msg_count; i++)
519 {
520 struct Email *e = m->emails[i];
521 if (!e)
522 break;
523
524 mutt_score_message(m, e, true);
525 e->attr_color = NULL; // Force recalc of colour
526 }
527
528 mutt_debug(LL_DEBUG5, "score done\n");
529 return 0;
530}
@ 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:243
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_subjectrx_observer()

static int index_subjectrx_observer ( struct NotifyCallback * nc)
static

Notification that a 'subject-regex' command has occurred - Implements observer_t -.

Definition at line 535 of file index.c.

536{
537 if (nc->event_type != NT_SUBJECTRX)
538 return 0;
539 if (!nc->global_data)
540 return -1;
541
542 struct MuttWindow *win = nc->global_data;
543 struct MuttWindow *dlg = dialog_find(win);
544 struct IndexSharedData *shared = dlg->wdata;
545
547 mutt_debug(LL_DEBUG5, "subject-regex done\n");
548 return 0;
549}
@ NT_SUBJECTRX
Subject Regex has changed, NotifySubjectRx.
Definition notify_type.h:55
void subjectrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition subjectrx.c:170
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_observer()

static int index_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 554 of file index.c.

555{
556 if (nc->event_type != NT_WINDOW)
557 return 0;
558 if (!nc->global_data || !nc->event_data)
559 return -1;
560
561 struct MuttWindow *win = nc->global_data;
562 struct Menu *menu = win->wdata;
564 {
567 return 0;
568 }
569
570 struct EventWindow *ev_w = nc->event_data;
571 if (ev_w->win != win)
572 return 0;
573
574 struct IndexPrivateData *priv = menu->mdata;
575
586
587 mutt_debug(LL_DEBUG5, "window delete done\n");
588 return 0;
589}
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition index.c:261
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition index.c:386
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition index.c:456
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition index.c:481
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition index.c:503
static int index_subjectrx_observer(struct NotifyCallback *nc)
Notification that a 'subject-regex' command has occurred - Implements observer_t -.
Definition index.c:535
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition index.c:433
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition index.c:223
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition index.c:242
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition index.c:554
struct Notify * notify
Notifications.
Definition lib.h:147
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 72 of file ipanel.c.

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

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ipanel.c.

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

◆ index_shared_mview_observer()

static int index_shared_mview_observer ( struct NotifyCallback * nc)
static

Notification that the MailboxView has changed - Implements observer_t -.

Definition at line 43 of file shared_data.c.

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

◆ index_shared_account_observer()

static int index_shared_account_observer ( struct NotifyCallback * nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 68 of file shared_data.c.

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

◆ index_shared_mailbox_observer()

static int index_shared_mailbox_observer ( struct NotifyCallback * nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 93 of file shared_data.c.

94{
95 if (nc->event_type != NT_MAILBOX)
96 return 0;
97 if (!nc->global_data || !nc->event_data)
98 return -1;
100 return 0;
101
102 struct EventMailbox *ev_m = nc->event_data;
103 struct IndexSharedData *shared = nc->global_data;
104 if (ev_m->mailbox != shared->mailbox)
105 return 0;
106
108 shared->mailbox = NULL;
109
110 mutt_debug(LL_NOTIFY, "relay NT_MAILBOX to shared data observers\n");
111 notify_send(shared->notify, nc->event_type, nc->event_subtype, nc->event_data);
112 return 0;
113}
@ NT_MAILBOX_ADD
Mailbox has been added.
Definition mailbox.h:172
+ 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:76
@ NT_INDEX
Index data has changed, NotifyIndex, IndexSharedData.
Definition notify_type.h:48
An Event that happened to an Email.
Definition email.h:196
int num_emails
Number of Emails the event applies to.
Definition email.h:197
struct Email ** emails
Emails affected by the event.
Definition email.h:198
struct Email * email
Currently selected Email.
Definition shared_data.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_config_observer()

int km_config_observer ( struct NotifyCallback * nc)

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

Definition at line 148 of file init.c.

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

◆ main_timeout_observer()

static int main_timeout_observer ( struct NotifyCallback * nc)
static

Notification that a timeout has occurred - Implements observer_t -.

Definition at line 831 of file main.c.

832{
833 static time_t last_run = 0;
834
835 if (nc->event_type != NT_TIMEOUT)
836 return 0;
837
838 const short c_timeout = cs_subset_number(NeoMutt->sub, "timeout");
839 if (c_timeout <= 0)
840 goto done;
841
842 time_t now = mutt_date_now();
843 if (now < (last_run + c_timeout))
844 goto done;
845
846 // Limit hook to running under the Index or Pager
848 struct MuttWindow *dlg = dialog_find(focus);
849 if (!dlg || (dlg->type != WT_DLG_INDEX))
850 goto done;
851
852 last_run = now;
854
855done:
856 mutt_debug(LL_DEBUG5, "timeout done\n");
857 return 0;
858}
void exec_timeout_hook(void)
Execute any timeout hooks.
Definition exec.c:378
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
struct MuttWindow * focus
Focused Window.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_color_observer()

static int menu_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 41 of file observer.c.

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

◆ menu_window_observer()

static int menu_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 97 of file observer.c.

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

◆ main_log_observer()

int main_log_observer ( struct NotifyCallback * nc)

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

Definition at line 284 of file mutt_logging.c.

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

◆ gpgme_key_config_observer()

static int gpgme_key_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 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 249 of file pager.c.

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

◆ pager_config_observer()

static int pager_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 297 of file pager.c.

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

◆ pager_index_observer()

static int pager_index_observer ( struct NotifyCallback * nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 333 of file pager.c.

334{
335 if (nc->event_type != NT_INDEX)
336 return 0;
337 if (!nc->global_data)
338 return -1;
339
340 struct MuttWindow *win_pager = nc->global_data;
341
342 struct PagerPrivateData *priv = win_pager->wdata;
343 if (!priv)
344 return 0;
345
346 struct IndexSharedData *shared = nc->event_data;
347
349 {
350 win_pager->actions |= WA_RECALC;
351 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
352 priv->loop = PAGER_LOOP_QUIT;
353 }
354 else if (nc->event_subtype & NT_INDEX_EMAIL)
355 {
356 win_pager->actions |= WA_RECALC;
357 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
358 priv->pager_redraw = true;
359 if (shared && shared->email && (priv->loop != PAGER_LOOP_QUIT))
360 {
361 priv->loop = PAGER_LOOP_RELOAD;
362 }
363 else
364 {
365 priv->loop = PAGER_LOOP_QUIT;
366 priv->rc = 0;
367 }
368 }
369
370 return 0;
371}
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition lib.h:75
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition lib.h:155
@ PAGER_LOOP_QUIT
Quit the Pager.
Definition lib.h:154
int rc
Return code from functions.
bool pager_redraw
Force a complete redraw.
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
+ Here is the caller graph for this function:

◆ pager_pager_observer()

static int pager_pager_observer ( struct NotifyCallback * nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 376 of file pager.c.

377{
378 if (nc->event_type != NT_PAGER)
379 return 0;
380 if (!nc->global_data || !nc->event_data)
381 return -1;
382
383 struct MuttWindow *win_pager = nc->global_data;
384
385 struct PagerPrivateData *priv = win_pager->wdata;
386 if (!priv)
387 return 0;
388
390 mutt_debug(LL_DEBUG5, "pager done\n");
391 return 0;
392}
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition dlg_pager.c:121
#define PAGER_REDRAW_PAGER
Redraw the pager.
Definition lib.h:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_window_observer()

static int pager_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 397 of file pager.c.

398{
399 if (nc->event_type != NT_WINDOW)
400 return 0;
401 if (!nc->global_data || !nc->event_data)
402 return -1;
404 return 0;
405
406 struct MuttWindow *win_pager = nc->global_data;
407 struct EventWindow *ev_w = nc->event_data;
408 if (ev_w->win != win_pager)
409 return 0;
410
411 struct PagerPrivateData *priv = win_pager->wdata;
412 if (!priv)
413 return 0;
414
415 struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
416 if (!dlg)
417 dlg = window_find_parent(win_pager, WT_DLG_PAGER);
418
419 struct IndexSharedData *shared = dlg->wdata;
420
426
427 mutt_debug(LL_DEBUG5, "window delete done\n");
428
429 return 0;
430}
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition pager.c:376
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition pager.c:249
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition pager.c:297
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition pager.c:333
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition pager.c:397
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
Definition mutt_window.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_color_observer()

static int pbar_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 171 of file pbar.c.

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

◆ pbar_config_observer()

static int pbar_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 194 of file pbar.c.

195{
196 if (nc->event_type != NT_CONFIG)
197 return 0;
198 if (!nc->global_data || !nc->event_data)
199 return -1;
200
201 struct EventConfig *ev_c = nc->event_data;
202 if (!mutt_str_equal(ev_c->name, "pager_format"))
203 return 0;
204
205 struct MuttWindow *win_pbar = nc->global_data;
206 win_pbar->actions |= WA_RECALC;
207 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
208
209 return 0;
210}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_index_observer()

static int pbar_index_observer ( struct NotifyCallback * nc)
static

Notification that the Index has changed - Implements observer_t -.

This function receives two sorts of notification:

  • NT_INDEX: User has changed to a different Mailbox/Email
  • NT_CONTEXT/NT_ACCOUNT/NT_MAILBOX/NT_EMAIL: The state of an object has changed

Definition at line 221 of file pbar.c.

222{
223 if (!nc->global_data)
224 return -1;
225
226 struct MuttWindow *win_pbar = nc->global_data;
227 win_pbar->actions |= WA_RECALC;
228 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
229
230 return 0;
231}
+ Here is the caller graph for this function:

◆ pbar_pager_observer()

static int pbar_pager_observer ( struct NotifyCallback * nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 236 of file pbar.c.

237{
238 if (nc->event_type != NT_PAGER)
239 return 0;
240 if (!nc->global_data)
241 return -1;
242
243 struct MuttWindow *win_pbar = nc->global_data;
244
246 {
247 win_pbar->actions |= WA_RECALC;
248 mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
249 }
250
251 return 0;
252}
+ Here is the caller graph for this function:

◆ pbar_window_observer()

static int pbar_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 257 of file pbar.c.

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

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 72 of file ppanel.c.

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

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 94 of file ppanel.c.

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

◆ pattern_config_observer()

static int pattern_config_observer ( struct NotifyCallback * nc)
static

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

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

Definition at line 245 of file dlg_pattern.c.

246{
247 if (nc->event_type != NT_CONFIG)
248 return 0;
249 if (!nc->global_data || !nc->event_data)
250 return -1;
251
252 struct EventConfig *ev_c = nc->event_data;
253
254 if (!mutt_str_equal(ev_c->name, "pattern_format"))
255 return 0;
256
257 struct Menu *menu = nc->global_data;
259 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
260
261 return 0;
262}
+ 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 271 of file dlg_pattern.c.

272{
273 if (nc->event_type != NT_WINDOW)
274 return 0;
275 if (!nc->global_data || !nc->event_data)
276 return -1;
278 return 0;
279
280 struct MuttWindow *win_menu = nc->global_data;
281 struct EventWindow *ev_w = nc->event_data;
282 if (ev_w->win != win_menu)
283 return 0;
284
285 struct Menu *menu = win_menu->wdata;
286
289
290 mutt_debug(LL_DEBUG5, "window delete done\n");
291 return 0;
292}
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_config_observer()

static int postponed_config_observer ( struct NotifyCallback * nc)
static

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

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

Definition at line 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 -.
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback * nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 177 of file observer.c.

178{
179 if (nc->event_type != NT_ACCOUNT)
180 return 0;
181 if (!nc->global_data || !nc->event_data)
182 return -1;
184 return 0;
185
186 struct MuttWindow *win = nc->global_data;
188 struct EventAccount *ev_a = nc->event_data;
189
190 struct Mailbox **mp = NULL;
191 ARRAY_FOREACH(mp, &ev_a->account->mailboxes)
192 {
193 sb_add_mailbox(wdata, *mp);
194 }
195
196 win->actions |= WA_RECALC;
197 mutt_debug(LL_DEBUG5, "account done, request WA_RECALC\n");
198 return 0;
199}
void sb_add_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Add a Mailbox to the Sidebar.
Definition sidebar.c:99
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition wdata.c:77
struct MailboxArray mailboxes
All Mailboxes.
Definition account.h:40
Sidebar private Window data -.
Definition private.h:89
struct MuttWindow * win
Sidebar Window.
Definition private.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback * nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 204 of file observer.c.

205{
206 if (nc->event_type != NT_COLOR)
207 return 0;
208 if (!nc->global_data || !nc->event_data)
209 return -1;
210
211 struct EventColor *ev_c = nc->event_data;
212 struct MuttWindow *win = nc->global_data;
213
214 enum ColorId cid = ev_c->cid;
215
216 if (cid == MT_COLOR_MAX) // Sent on `uncolor *`
217 {
218 // Set a default style
220 ac->attrs = A_UNDERLINE;
221 }
222
223 switch (cid)
224 {
226 case MT_COLOR_NORMAL:
236 case MT_COLOR_MAX: // Sent on `uncolor *`
237 win->actions |= WA_REPAINT;
238 mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
239 break;
240
241 default:
242 break;
243 }
244 return 0;
245}
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition simple.c:97
@ MT_COLOR_SIDEBAR_SPOOL_FILE
$spool_file (Spool mailbox)
Definition color.h:75
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition color.h:69
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition color.h:73
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition color.h:76
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition color.h:74
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
Definition color.h:68
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition color.h:72
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition color.h:71
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition color.h:70
A curses colour and its attributes.
Definition attr.h:65
int attrs
Text attributes, e.g. A_BOLD.
Definition attr.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_command_observer()

static int sb_command_observer ( struct NotifyCallback * nc)
static

Notification that a Command has occurred - Implements observer_t -.

Definition at line 250 of file observer.c.

251{
252 if (nc->event_type != NT_COMMAND)
253 return 0;
254 if (!nc->global_data || !nc->event_data)
255 return -1;
256
257 struct Command *cmd = nc->event_data;
258
259 if ((cmd->parse != parse_sidebar_pin) && (cmd->parse != parse_sidebar_unpin))
260 return 0;
261
262 struct MuttWindow *win = nc->global_data;
263 win->actions |= WA_RECALC;
264 mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
265 return 0;
266}
enum CommandResult parse_sidebar_pin(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'sidebar-pin' command - Implements Command::parse() -.
Definition commands.c:45
enum CommandResult parse_sidebar_unpin(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'sidebar-unpin' command - Implements Command::parse() -.
Definition commands.c:76
@ NT_COMMAND
A Command has been executed, Command.
Definition notify_type.h:42
enum CommandResult(* parse)(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Definition command.h:178
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback * nc)
static

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

Definition at line 271 of file observer.c.

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

◆ sb_index_observer()

static int sb_index_observer ( struct NotifyCallback * nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 360 of file observer.c.

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

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback * nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 384 of file observer.c.

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

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback * nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 413 of file observer.c.

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

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