42 "NT_ALL",
"NT_ACCOUNT",
"NT_ALIAS",
"NT_ALTERN",
"NT_ATTACH",
43 "NT_BINDING",
"NT_COLOR",
"NT_COMMAND",
"NT_CONFIG",
"NT_CONTEXT",
44 "NT_EMAIL",
"NT_ENVELOPE",
"NT_GLOBAL",
"NT_HEADER",
"NT_INDEX",
45 "NT_MAILBOX",
"NT_MENU",
"NT_PAGER",
"NT_RESIZE",
"NT_SCORE",
46 "NT_SUBJRX",
"NT_TIMEOUT",
"NT_WINDOW",
80 struct Notify *notify = *ptr;
121 enum NotifyType event_type,
int event_subtype,
void *event_data)
123 if (!source || !current)
174 int event_subtype,
void *event_data)
177 return send(notify, notify, event_type, event_subtype, event_data);
194 if (!notify || !callback)
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
@ LL_NOTIFY
Log of notifications.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Memory management wrappers.
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
static bool send(struct Notify *source, struct Notify *current, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
struct Notify * notify_new(void)
Create a new notifications handler.
static const char * NotifyTypeNames[]
Lookup table for NotifyType Must be the same size and order as NotifyType.
void notify_observer_remove_all(struct Notify *notify)
Remove all the observers from an object.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
void notify_free(struct Notify **ptr)
Free a notification handler.
NotifyType
Notification Types.
@ NT_ALL
Register for all notifications.
Observer of notifications.
int(* observer_t)(struct NotifyCallback *nc)
#define STAILQ_REMOVE(head, elm, type, field)
#define STAILQ_INIT(head)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_INSERT_HEAD(head, elm, field)
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Data passed to a notification function.
void * event_data
Data from notify_send()
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
struct Notify * current
Notify object being observed.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
struct Notify * parent
Parent of the notification object.
struct ObserverList observers
List of observers of this object.
struct Observer * observer
An Observer.
An observer of notifications.
observer_t callback
Callback function for events.
void * global_data
Private data to pass to callback.
enum NotifyType type
Notification type to observe, e.g. NT_WINDOW.