From eade05821e7e39e93bfbea226fab127e907555d9 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 11 Mar 2016 17:57:41 +1300 Subject: [PATCH] lazy-expunge: Code cleanup - move destination mailbox name generation to its own function --- .../lazy-expunge/lazy-expunge-plugin.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index cbac31b22c..55a97c4be9 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -66,12 +66,9 @@ static MODULE_CONTEXT_DEFINE_INIT(lazy_expunge_mailbox_list_module, static MODULE_CONTEXT_DEFINE_INIT(lazy_expunge_mail_user_module, &mail_user_module_register); -static struct mailbox * -mailbox_open_or_create(struct mailbox_list *list, struct mailbox *src_box, - const char **error_r) +static const char * +get_dest_vname(struct mailbox_list *list, struct mailbox *src_box) { - struct mailbox *box; - enum mail_error error; const char *name; char src_sep, dest_sep; @@ -93,7 +90,18 @@ mailbox_open_or_create(struct mailbox_list *list, struct mailbox *src_box, name = str_c(str); } /* add expunge namespace prefix. the name is now a proper vname */ - name = t_strconcat(list->ns->prefix, name, NULL); + return t_strconcat(list->ns->prefix, name, NULL); +} + +static struct mailbox * +mailbox_open_or_create(struct mailbox_list *list, struct mailbox *src_box, + const char **error_r) +{ + struct mailbox *box; + enum mail_error error; + const char *name; + + name = get_dest_vname(list, src_box); box = mailbox_alloc(list, name, MAILBOX_FLAG_NO_INDEX_FILES); if (mailbox_open(box) == 0) {