Returns the bottom-most (oldest pushed) event on the global event
stack, or the current global event if the stack is empty. Lets
plugins annotate the outermost active caller's event from within a
nested global event context.
return current_global_event;
}
+struct event *event_get_global_root(void)
+{
+ if (array_is_created(&global_event_stack) &&
+ array_count(&global_event_stack) > 0) {
+ struct event *const *events =
+ array_front(&global_event_stack);
+ return events[0];
+ }
+ return current_global_event;
+}
+
#undef event_reason_begin
struct event_reason *
event_reason_begin(const char *reason_code, const char *source_filename,
struct event *event_pop_global(struct event *event);
/* Returns the current global event. */
struct event *event_get_global(void);
+/* Returns the bottom-most (oldest pushed) global event, or NULL if the
+ global event stack is empty. Useful for plugins that need to annotate
+ the outermost active caller's event (e.g. an IMAP command's global
+ event) from within a nested global event context. */
+struct event *event_get_global_root(void);
/* Shortcut to create and push a global event and set its reason_code field. */
struct event_reason *