Skip to content
Snippets Groups Projects
Commit 081eac2b authored by Stephan Bosch's avatar Stephan Bosch
Browse files

lib-sieve: vacation extension: Move construction of default subject to separate function.

parent 98e9ee54
No related branches found
No related tags found
No related merge requests found
......@@ -947,6 +947,26 @@ static int _get_full_reply_recipient
return SIEVE_EXEC_OK;
}
static int
act_vacation_get_default_subject(const struct sieve_action_exec_env *aenv,
const char **subject_r)
{
const struct sieve_message_data *msgdata = aenv->msgdata;
const char *header;
int ret;
*subject_r = "Automated reply";
if ((ret=mail_get_first_header_utf8(msgdata->mail, "subject",
&header)) < 0 ) {
return sieve_result_mail_error(
aenv, msgdata->mail, "vacation action: "
"failed to read header field `subject'");
}
if (ret >= 0)
*subject_r = t_strconcat("Auto: ", header, NULL);
return SIEVE_EXEC_OK;
}
static int act_vacation_send
(const struct sieve_action_exec_env *aenv,
const struct ext_vacation_config *config,
......@@ -975,17 +995,8 @@ static int act_vacation_send
/* Make sure we have a subject for our reply */
if ( ctx->subject == NULL || *(ctx->subject) == '\0' ) {
if ( (ret=mail_get_first_header_utf8
(msgdata->mail, "subject", &header)) < 0 ) {
return sieve_result_mail_error(aenv, msgdata->mail,
"vacation action: "
"failed to read header field `subject'");
}
if ( ret > 0 && header != NULL ) {
subject = t_strconcat("Auto: ", header, NULL);
} else {
subject = "Automated reply";
}
if ((ret=act_vacation_get_default_subject(aenv, &subject)) <= 0)
return ret;
} else {
subject = ctx->subject;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.