From: Timo Sirainen Date: Thu, 1 Jun 2023 20:10:49 +0000 (+0300) Subject: lib-storage: Add "namespace" field to mailbox event X-Git-Tag: 2.4.0~2057 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb3e69589fed68685a558023da079cac088632fb;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Add "namespace" field to mailbox event --- diff --git a/src/lib-storage/fail-mailbox.c b/src/lib-storage/fail-mailbox.c index 0c97f15907..20fe2ed30d 100644 --- a/src/lib-storage/fail-mailbox.c +++ b/src/lib-storage/fail-mailbox.c @@ -331,8 +331,8 @@ fail_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list, box->pool = pool; box->flags = flags; - box->event = mail_storage_mailbox_create_event(box->storage->event, - box->vname); + box->event = mail_storage_mailbox_create_event(storage->event, + list, box->vname); p_array_init(&box->search_results, pool, 16); p_array_init(&box->module_contexts, pool, 5); return box; diff --git a/src/lib-storage/index/index-storage.c b/src/lib-storage/index/index-storage.c index bfb497e768..b587b76f0c 100644 --- a/src/lib-storage/index/index-storage.c +++ b/src/lib-storage/index/index-storage.c @@ -408,7 +408,7 @@ void index_storage_mailbox_alloc(struct mailbox *box, const char *vname, box->flags = flags; box->index_prefix = p_strdup(box->pool, index_prefix); box->event = mail_storage_mailbox_create_event(box->storage->event, - box->vname); + box->list, box->vname); p_array_init(&box->search_results, box->pool, 16); array_create(&box->module_contexts, diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 96d73e5487..f1b3f97fb3 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -928,7 +928,8 @@ static inline const char *mailbox_name_sanitize(const char *name) } struct event * -mail_storage_mailbox_create_event(struct event *parent, const char *vname); +mail_storage_mailbox_create_event(struct event *parent, + struct mailbox_list *list, const char *vname); /* for unit testing */ int mailbox_verify_name(struct mailbox *box); diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index c84e7dce8c..d9fc0f7032 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -3371,13 +3371,14 @@ mail_storage_settings_to_index_flags(const struct mail_storage_settings *set) return index_flags; } - struct event * -mail_storage_mailbox_create_event(struct event *parent, const char* vname) +mail_storage_mailbox_create_event(struct event *parent, + struct mailbox_list *list, const char *vname) { struct event *event = event_create(parent); event_add_category(event, &event_category_mailbox); - event_add_str(event, "mailbox", vname); + event_add_str(event, "namespace", list->ns->set->name); + event_drop_parent_log_prefixes(event, 1); event_set_append_log_prefix(event, t_strdup_printf( "Mailbox %s: ", mailbox_name_sanitize(vname)));