]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-recipient - Add smtp_server_recipient_get_reply() and use it.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 16 Mar 2019 15:24:59 +0000 (16:24 +0100)
committerMartti Rannanjärvi <martti.rannanjarvi@open-xchange.com>
Wed, 25 Sep 2019 08:25:20 +0000 (11:25 +0300)
src/lib-smtp/smtp-server-recipient.c
src/lib-smtp/smtp-server.h

index b4b59c84ecc52790c119dd50403b392d1aa05dc1..c57adb4aeea2e564e310a1d6ba169dc608e9f4c6 100644 (file)
@@ -134,14 +134,9 @@ void smtp_server_recipient_last_data(struct smtp_server_recipient *rcpt,
 
 void smtp_server_recipient_data_replied(struct smtp_server_recipient *rcpt)
 {
-       unsigned int reply_index = 0;
-
        if (rcpt->replied)
                return;
-       if (HAS_ALL_BITS(rcpt->trans->flags,
-                        SMTP_SERVER_TRANSACTION_FLAG_REPLY_PER_RCPT))
-               reply_index = rcpt->index;
-       if (smtp_server_command_get_reply(rcpt->cmd->cmd, reply_index) == NULL)
+       if (smtp_server_recipient_get_reply(rcpt) == NULL)
                return;
        rcpt->replied = TRUE;
        if (!smtp_server_recipient_call_hooks(
@@ -150,6 +145,15 @@ void smtp_server_recipient_data_replied(struct smtp_server_recipient *rcpt)
        }
 }
 
+struct smtp_server_reply *
+smtp_server_recipient_get_reply(struct smtp_server_recipient *rcpt)
+{
+       if (!HAS_ALL_BITS(rcpt->trans->flags,
+                        SMTP_SERVER_TRANSACTION_FLAG_REPLY_PER_RCPT))
+               return smtp_server_command_get_reply(rcpt->cmd->cmd, 0);
+       return smtp_server_command_get_reply(rcpt->cmd->cmd, rcpt->index);
+}
+
 bool smtp_server_recipient_is_replied(struct smtp_server_recipient *rcpt)
 {
        i_assert(rcpt->cmd != NULL);
index 0509bbcc9837f3881951bcdd47a44caa13c76dbb..e026c0a3140259fe3f202f0e623ae729c3a6c76e 100644 (file)
@@ -86,6 +86,8 @@ struct smtp_server_recipient {
 };
 ARRAY_DEFINE_TYPE(smtp_server_recipient, struct smtp_server_recipient *);
 
+struct smtp_server_reply *
+smtp_server_recipient_get_reply(struct smtp_server_recipient *rcpt);
 bool smtp_server_recipient_is_replied(struct smtp_server_recipient *rcpt);
 void smtp_server_recipient_replyv(struct smtp_server_recipient *rcpt,
                                  unsigned int status, const char *enh_code,