diff --git a/.gitignore b/.gitignore index 1bfe614..1bc7782 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ packages .packages *.iml .dart_tool -/test/smtpserver.json \ No newline at end of file +/test/smtpserver.json +.DS_Store \ No newline at end of file diff --git a/lib/src/entities/address.dart b/lib/src/entities/address.dart index d716697..11b67a1 100644 --- a/lib/src/entities/address.dart +++ b/lib/src/entities/address.dart @@ -3,4 +3,11 @@ class Address { String mailAddress; Address([this.mailAddress, this.name]); + + @override + String toString() { + var fromName = name ?? ''; + // ToDo base64 fromName (add _IRMetaInformation as argument) + return '$fromName <$mailAddress>'; + } } diff --git a/lib/src/entities/message.dart b/lib/src/entities/message.dart index 3fc399d..6314792 100644 --- a/lib/src/entities/message.dart +++ b/lib/src/entities/message.dart @@ -71,6 +71,6 @@ class Message { String html; List attachments = []; - Iterable
_asAddresses(Iterable as) => - (as ?? []).map((a) => a is String ? Address(a) : a as Address); + static Iterable
_asAddresses(Iterable adrs) => + adrs == null ? []: adrs.map((a) => a is String ? Address(a) : a as Address); } diff --git a/lib/src/smtp/internal_representation/ir_header.dart b/lib/src/smtp/internal_representation/ir_header.dart index aaa700a..ecd7a46 100644 --- a/lib/src/smtp/internal_representation/ir_header.dart +++ b/lib/src/smtp/internal_representation/ir_header.dart @@ -62,14 +62,8 @@ class _IRHeaderText extends _IRHeader { } } -Iterable _addressToString(Iterable
addresses) { - if (addresses == null) return []; - return addresses.map((a) { - var fromName = a.name ?? ''; - // ToDo base64 fromName (add _IRMetaInformation as argument) - return '$fromName <${a.mailAddress}>'; - }); -} +Iterable _addressToString(Iterable
addresses) +=> assress == null ? []: addresses.map((a) => a.toString()); class _IRHeaderAddress extends _IRHeader { Address _address;