From: Stephan Bosch Date: Wed, 13 Nov 2019 22:41:51 +0000 (+0100) Subject: lib-smtp: smtp-server-recipient - Add smtp_server_recipient_get_original(). X-Git-Tag: 2.3.9~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c1870b5efad63bebc15a8afd6571ac09dd0835e;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-server-recipient - Add smtp_server_recipient_get_original(). --- diff --git a/src/lib-smtp/smtp-server-recipient.c b/src/lib-smtp/smtp-server-recipient.c index 2d4543fb2b..0c1dc7b1b0 100644 --- a/src/lib-smtp/smtp-server-recipient.c +++ b/src/lib-smtp/smtp-server-recipient.c @@ -96,6 +96,14 @@ void smtp_server_recipient_destroy(struct smtp_server_recipient **_rcpt) smtp_server_recipient_unref(_rcpt); } +const struct smtp_address * +smtp_server_recipient_get_original(struct smtp_server_recipient *rcpt) +{ + if (rcpt->params.orcpt.addr == NULL) + return rcpt->path; + return rcpt->params.orcpt.addr; +} + bool smtp_server_recipient_approved(struct smtp_server_recipient **_rcpt) { struct smtp_server_recipient *rcpt = *_rcpt; diff --git a/src/lib-smtp/smtp-server.h b/src/lib-smtp/smtp-server.h index c25b97a090..d1dfc9c176 100644 --- a/src/lib-smtp/smtp-server.h +++ b/src/lib-smtp/smtp-server.h @@ -86,6 +86,11 @@ struct smtp_server_recipient { }; ARRAY_DEFINE_TYPE(smtp_server_recipient, struct smtp_server_recipient *); +/* Returns the original recipient path if available. Otherwise, it returns the + final path. */ +const struct smtp_address * +smtp_server_recipient_get_original(struct smtp_server_recipient *rcpt); + 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);