From 8a8f9c1e75f865f9eaa95501c6246c5ac39e6ddc Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@dovecot.fi> Date: Tue, 11 Dec 2018 17:24:38 +0100 Subject: [PATCH] lib-sieve: redirect action: Update coding style of act_redirect_commit(). --- src/lib-sieve/cmd-redirect.c | 49 ++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/lib-sieve/cmd-redirect.c b/src/lib-sieve/cmd-redirect.c index 3140171ef..ebda234aa 100644 --- a/src/lib-sieve/cmd-redirect.c +++ b/src/lib-sieve/cmd-redirect.c @@ -406,17 +406,17 @@ act_redirect_send(const struct sieve_action_exec_env *aenv, struct mail *mail, return SIEVE_EXEC_OK; } -static int act_redirect_commit -(const struct sieve_action *action, - const struct sieve_action_exec_env *aenv, void *tr_context ATTR_UNUSED, - bool *keep) +static int +act_redirect_commit(const struct sieve_action *action, + const struct sieve_action_exec_env *aenv, + void *tr_context ATTR_UNUSED, bool *keep) { struct sieve_instance *svinst = aenv->svinst; struct act_redirect_context *ctx = (struct act_redirect_context *) action->context; struct sieve_message_context *msgctx = aenv->msgctx; - struct mail *mail = ( action->mail != NULL ? - action->mail : sieve_message_get_mail(msgctx) ); + struct mail *mail = (action->mail != NULL ? + action->mail : sieve_message_get_mail(msgctx)); const struct sieve_message_data *msgdata = aenv->msgdata; const struct sieve_script_env *senv = aenv->scriptenv; const struct smtp_address *recipient; @@ -430,31 +430,27 @@ static int act_redirect_commit */ /* Read identifying headers */ - if ( mail_get_first_header - (msgdata->mail, "resent-message-id", &resent_id) < 0 ) { + if (mail_get_first_header(msgdata->mail, "resent-message-id", + &resent_id) < 0) { return sieve_result_mail_error(aenv, mail, "failed to read header field `resent-message-id'"); } - if ( resent_id == NULL ) { - if ( mail_get_first_header - (msgdata->mail, "resent-from", &resent_id) < 0 ) { - return sieve_result_mail_error(aenv, mail, - "failed to read header field `resent-from'"); - } + if (resent_id == NULL && + mail_get_first_header(msgdata->mail, "resent-from", + &resent_id) < 0) { + return sieve_result_mail_error(aenv, mail, + "failed to read header field `resent-from'"); } - if ( mail_get_first_header - (msgdata->mail, "list-id", &list_id) < 0 ) { + if (mail_get_first_header(msgdata->mail, "list-id", &list_id) < 0) { return sieve_result_mail_error(aenv, mail, "failed to read header field `list-id'"); } /* Create Message-ID for the message if it has none */ - if ( msg_id == NULL ) { - msg_id = new_msg_id = - sieve_message_get_new_id(aenv->svinst); - } + if (msg_id == NULL) + msg_id = new_msg_id = sieve_message_get_new_id(aenv->svinst); - if ( (aenv->flags & SIEVE_EXECUTE_FLAG_NO_ENVELOPE) == 0 ) + if ((aenv->flags & SIEVE_EXECUTE_FLAG_NO_ENVELOPE) == 0) recipient = sieve_message_get_orig_recipient(msgctx); else recipient = sieve_get_user_email(aenv->svinst); @@ -474,8 +470,7 @@ static int act_redirect_commit (list_id != NULL ? list_id : "")); /* Check whether we've seen this message before */ - if (sieve_action_duplicate_check - (senv, dupeid, strlen(dupeid))) { + if (sieve_action_duplicate_check(senv, dupeid, strlen(dupeid))) { sieve_result_global_log(aenv, "discarded duplicate forward to <%s>", smtp_address_encode(ctx->to_address)); @@ -487,10 +482,10 @@ static int act_redirect_commit * Try to forward the message */ - if ( (ret=act_redirect_send - (aenv, mail, ctx, new_msg_id)) == SIEVE_EXEC_OK) { - - /* Mark this message id as forwarded to the specified destination */ + ret = act_redirect_send(aenv, mail, ctx, new_msg_id); + if (ret == SIEVE_EXEC_OK) { + /* Mark this message id as forwarded to the specified + destination */ sieve_action_duplicate_mark(senv, dupeid, strlen(dupeid), ioloop_time + svinst->redirect_duplicate_period); -- GitLab