summaryrefslogtreecommitdiff
path: root/libmailutils/address/addrstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmailutils/address/addrstream.c')
-rw-r--r--libmailutils/address/addrstream.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/libmailutils/address/addrstream.c b/libmailutils/address/addrstream.c
index 4bcf181ed..41efc3fa2 100644
--- a/libmailutils/address/addrstream.c
+++ b/libmailutils/address/addrstream.c
@@ -1,5 +1,5 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2021 Free Software Foundation, Inc.
+ Copyright (C) 1999-2024 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,7 @@
# include <config.h>
#endif
#include <stdlib.h>
+#include <string.h>
#include <mailutils/address.h>
#include <mailutils/stream.h>
@@ -37,23 +38,34 @@ mu_stream_format_address (mu_stream_t str, mu_address_t addr)
if (comma)
mu_stream_write (str, ",", 1, NULL);
- if (addr->personal)
+ if (!addr->personal &&
+ !addr->comments &&
+ !addr->domain &&
+ !addr->route)
{
- mu_stream_printf (str, "\"%s\"", addr->personal);
- space++;
+ /* Local user name: print as is */
+ mu_stream_write (str, addr->email, strlen (addr->email), NULL);
}
-
- if (addr->comments)
+ else
{
+ if (addr->personal)
+ {
+ mu_stream_printf (str, "\"%s\"", addr->personal);
+ space++;
+ }
+
+ if (addr->comments)
+ {
+ if (space)
+ mu_stream_write (str, " ", 1, NULL);
+ mu_stream_printf (str, "(%s)", addr->comments);
+ space++;
+ }
+
if (space)
mu_stream_write (str, " ", 1, NULL);
- mu_stream_printf (str, "(%s)", addr->comments);
- space++;
+ mu_stream_printf (str, "<%s>", addr->email);
}
-
- if (space)
- mu_stream_write (str, " ", 1, NULL);
- mu_stream_printf (str, "<%s>", addr->email);
comma++;
}
}

Return to:

Send suggestions and report system problems to the System administrator.