]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
plugins/push-notification: push_notification_driver_ox_init_global() - Allow nested...
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Thu, 14 Sep 2023 09:09:54 +0000 (11:09 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
src/plugins/push-notification/push-notification-driver-ox.c

index e60fcc57131dd3167007cbe482dcbb1a5ae8563d..87e303cb1958fe81d07311c0a9a1294ad7dcadc8 100644 (file)
@@ -56,16 +56,27 @@ struct push_notification_driver_ox_txn {
 };
 
 static bool
-push_notification_driver_ox_init_global(struct mail_user *user) {
+push_notification_driver_ox_init_global(struct mail_user *user, const char *name)
+{
        if (ox_global->http_client == NULL) {
                const char *error;
-               if (http_client_init_auto(user->event, &ox_global->http_client,
+
+               struct event *event = event_create(user->event);
+               char *filter_name = p_strdup_printf(
+                               event_get_pool(event), "%s/%s",
+                               PUSH_NOTIFICATION_SETTINGS_FILTER_NAME,
+                               settings_section_escape(name));
+               event_set_ptr(event, SETTINGS_EVENT_FILTER_NAME, filter_name);
+
+               if (http_client_init_auto(event, &ox_global->http_client,
                                          &error) < 0) {
                        e_error(user->event,
                                "Unable to initialize the HTTP client: %s",
                                error);
+                       event_unref(&event);
                        return FALSE;
                }
+               event_unref(&event);
        }
 
        return TRUE;