]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Use message_detail_address_parse
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 3 Jul 2017 15:27:53 +0000 (18:27 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 7 Aug 2017 10:28:28 +0000 (13:28 +0300)
src/lmtp/commands.c

index 5638ea25be5b7dc631212fc11bb649540fa2949b..3fe90f8fe88567c5be3d0a99b63728c6f648e4a0 100644 (file)
@@ -30,6 +30,7 @@
 #include "mail-autoexpunge.h"
 #include "mail-namespace.h"
 #include "mail-deliver.h"
+#include "message-address.h"
 #include "main.h"
 #include "client.h"
 #include "commands.h"
@@ -462,31 +463,6 @@ static const char *lmtp_unescape_address(const char *name)
        return str_c(str);
 }
 
-static void rcpt_address_parse(struct client *client, const char *address,
-                              const char **username_r, const char **detail_r)
-{
-       const char *p, *domain;
-
-       *username_r = address;
-       *detail_r = "";
-
-       if (*client->unexpanded_lda_set->recipient_delimiter == '\0')
-               return;
-
-       domain = strchr(address, '@');
-       p = strstr(address, client->unexpanded_lda_set->recipient_delimiter);
-       if (p != NULL && (domain == NULL || p < domain)) {
-               /* user+detail@domain */
-               *username_r = t_strdup_until(*username_r, p);
-               if (domain == NULL)
-                       *detail_r = p+1;
-               else {
-                       *detail_r = t_strdup_until(p+1, domain);
-                       *username_r = t_strconcat(*username_r, domain, NULL);
-               }
-       }
-}
-
 static void lmtp_address_translate(struct client *client, const char **address)
 {
        const char *transpos = client->lmtp_set->lmtp_address_translate;
@@ -683,7 +659,8 @@ int cmd_rcpt(struct client *client, const char *args)
                        return 0;
                }
        }
-       rcpt_address_parse(client, address, &username, &detail);
+       message_detail_address_parse(client->unexpanded_lda_set->recipient_delimiter,
+                                    address, &username, &detail);
 
        client_state_set(client, "RCPT TO", address);