From a10961383d8755d23e67df7e5a43702dc916378f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 4 Sep 2019 13:51:26 +0300 Subject: [PATCH] push-notification: Add accessor functions to global variables These are enough for the current plugin. Maybe others will be needed in the future. --- .../push-notification-event-messagenew.c | 2 -- .../push-notification/push-notification-events.c | 4 ++++ .../push-notification/push-notification-events.h | 2 ++ .../push-notification/push-notification-plugin.c | 11 +++++++++++ .../push-notification/push-notification-plugin.h | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/push-notification/push-notification-event-messagenew.c b/src/plugins/push-notification/push-notification-event-messagenew.c index 3f1c4f3f6c..40ab8ee76b 100644 --- a/src/plugins/push-notification/push-notification-event-messagenew.c +++ b/src/plugins/push-notification/push-notification-event-messagenew.c @@ -145,8 +145,6 @@ push_notification_event_messagenew_event(struct push_notification_txn *ptxn, /* Event definition */ -extern struct push_notification_event push_notification_event_messagenew; - struct push_notification_event push_notification_event_messagenew = { .name = EVENT_NAME, .init = { diff --git a/src/plugins/push-notification/push-notification-events.c b/src/plugins/push-notification/push-notification-events.c index ea2e59babf..10c6ed9a23 100644 --- a/src/plugins/push-notification/push-notification-events.c +++ b/src/plugins/push-notification/push-notification-events.c @@ -9,6 +9,10 @@ ARRAY_TYPE(push_notification_event) push_notification_events; +ARRAY_TYPE(push_notification_event) *push_notification_get_events(void) +{ + return &push_notification_events; +} static bool push_notification_event_find(const char *name, unsigned int *idx_r) diff --git a/src/plugins/push-notification/push-notification-events.h b/src/plugins/push-notification/push-notification-events.h index 1552a80df2..7dfafb8e7d 100644 --- a/src/plugins/push-notification/push-notification-events.h +++ b/src/plugins/push-notification/push-notification-events.h @@ -110,6 +110,8 @@ ARRAY_DEFINE_TYPE(push_notification_event, const struct push_notification_event *); extern ARRAY_TYPE(push_notification_event) push_notification_events; +ARRAY_TYPE(push_notification_event) *push_notification_get_events(void); + void push_notification_event_init(struct push_notification_driver_txn *dtxn, diff --git a/src/plugins/push-notification/push-notification-plugin.c b/src/plugins/push-notification/push-notification-plugin.c index b907b1dbc0..ca0771dff3 100644 --- a/src/plugins/push-notification/push-notification-plugin.c +++ b/src/plugins/push-notification/push-notification-plugin.c @@ -32,6 +32,17 @@ struct event_category event_category_push_notification = { .name = "push_notification", }; +struct event_category *push_notification_get_event_category(void) +{ + return &event_category_push_notification; +} + +struct push_notification_event * +push_notification_get_event_messagenew(void) +{ + return &push_notification_event_messagenew; +} + static void push_notification_transaction_init(struct push_notification_txn *ptxn) { diff --git a/src/plugins/push-notification/push-notification-plugin.h b/src/plugins/push-notification/push-notification-plugin.h index 1d88ba71e4..7db53971bf 100644 --- a/src/plugins/push-notification/push-notification-plugin.h +++ b/src/plugins/push-notification/push-notification-plugin.h @@ -5,9 +5,13 @@ extern const char *push_notification_plugin_dependencies[]; extern struct event_category event_category_push_notification; +extern struct push_notification_event push_notification_event_messagenew; struct module; +struct event_category *push_notification_get_event_category(void); +struct push_notification_event *push_notification_get_event_messagenew(void); + void push_notification_plugin_init(struct module *module); void push_notification_plugin_deinit(void); -- 2.47.3