]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-command - Add hook for the submission of individual replies.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 16 Mar 2019 14:03:39 +0000 (15:03 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 19 Mar 2019 12:31:20 +0000 (13:31 +0100)
src/lib-smtp/smtp-server-command.c
src/lib-smtp/smtp-server.h

index 2478c05a590ece14fc8b0505f18e7fef69712ccf..a1009e8a0a9c01d7ae2f3164fc4ea72e97230610 100644 (file)
@@ -471,13 +471,19 @@ smtp_server_command_replied(struct smtp_server_command **_cmd)
 {
        struct smtp_server_command *cmd = *_cmd;
 
-       if (cmd->replies_submitted < cmd->replies_expected)
-               return TRUE;
+       if (cmd->replies_submitted < cmd->replies_expected) {
+               e_debug(cmd->context.event, "Replied (one)");
+
+               return smtp_server_command_call_hooks(
+                       _cmd, SMTP_SERVER_COMMAND_HOOK_REPLIED_ONE, FALSE);
+       }
 
        e_debug(cmd->context.event, "Replied");
 
-       return smtp_server_command_call_hooks(
-               _cmd, SMTP_SERVER_COMMAND_HOOK_REPLIED, TRUE);
+       return (smtp_server_command_call_hooks(
+                       _cmd, SMTP_SERVER_COMMAND_HOOK_REPLIED_ONE, TRUE) &&
+               smtp_server_command_call_hooks(
+                       _cmd, SMTP_SERVER_COMMAND_HOOK_REPLIED, TRUE));
 }
 
 bool smtp_server_command_completed(struct smtp_server_command **_cmd)
index 432eabfa783a0585ac0bcb012bf4a56cfdb6e27f..0cbc5d4b535d7550e19a7b6f728d34883c2c6f60 100644 (file)
@@ -490,6 +490,8 @@ enum smtp_server_command_hook_type {
        /* next: command is next to reply but has not submittted all replies
           yet. */
        SMTP_SERVER_COMMAND_HOOK_NEXT,
+       /* replied_one: command has submitted one reply. */
+       SMTP_SERVER_COMMAND_HOOK_REPLIED_ONE,
        /* replied: command has submitted all replies. */
        SMTP_SERVER_COMMAND_HOOK_REPLIED,
        /* completed: server is about to send last replies for this command. */