NeoMutt  2020-11-20
Teaching an old dog new tricks
DOXYGEN
observer.h
Go to the documentation of this file.
1 
29 #ifndef MUTT_LIB_OBSERVER_H
30 #define MUTT_LIB_OBSERVER_H
31 
32 #include <stdbool.h>
33 #include "notify_type.h"
34 #include "queue.h"
35 
40 {
41  struct Notify *current;
44  void *event_data;
45  void *global_data;
46 };
47 
54 typedef int (*observer_t)(struct NotifyCallback *nc);
55 
59 struct Observer
60 {
61  enum NotifyType type;
63  void *global_data;
64 };
65 
70 {
71  struct Observer *observer;
72  STAILQ_ENTRY(ObserverNode) entries;
73 };
74 STAILQ_HEAD(ObserverList, ObserverNode);
75 
76 #endif /* MUTT_LIB_OBSERVER_H */
Data passed to a notification function.
Definition: observer.h:39
struct Observer * observer
An Observer.
Definition: observer.h:71
#define STAILQ_ENTRY(type)
Definition: queue.h:324
void * global_data
Private data to pass to callback.
Definition: observer.h:63
NotifyType
Notification Types.
Definition: notify_type.h:31
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
int(* observer_t)(struct NotifyCallback *nc)
Prototype for a notification callback function.
Definition: observer.h:54
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
An observer of notifications.
Definition: observer.h:59
Notification API.
Definition: notify.c:39
struct Notify * current
Notify object being observed.
Definition: observer.h:41
Notification Types.
List of Observers.
Definition: observer.h:69
void * event_data
Data from notify_send()
Definition: observer.h:44
observer_t callback
Callback function for events.
Definition: observer.h:62
STAILQ_HEAD(ObserverList, ObserverNode)