summaryrefslogtreecommitdiffstats
path: root/mailnews/mime/src/MimeHeaderParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/mime/src/MimeHeaderParser.cpp')
-rw-r--r--mailnews/mime/src/MimeHeaderParser.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/mailnews/mime/src/MimeHeaderParser.cpp b/mailnews/mime/src/MimeHeaderParser.cpp
index 4fd7bc982..15341de46 100644
--- a/mailnews/mime/src/MimeHeaderParser.cpp
+++ b/mailnews/mime/src/MimeHeaderParser.cpp
@@ -107,6 +107,24 @@ nsCOMArray<msgIAddressObject> EncodedHeader(const nsACString &aHeader,
return retval;
}
+nsCOMArray<msgIAddressObject> EncodedHeaderW(const nsAString &aHeader)
+{
+ nsCOMArray<msgIAddressObject> retval;
+ if (aHeader.IsEmpty()) {
+ return retval;
+ }
+ nsCOMPtr<nsIMsgHeaderParser> headerParser(services::GetHeaderParser());
+ NS_ENSURE_TRUE(headerParser, retval);
+ msgIAddressObject **addresses = nullptr;
+ uint32_t length;
+ nsresult rv = headerParser->ParseEncodedHeaderW(aHeader, &length, &addresses);
+ MOZ_ASSERT(NS_SUCCEEDED(rv), "This should never fail!");
+ if (NS_SUCCEEDED(rv) && length > 0 && addresses) {
+ retval.Adopt(addresses, length);
+ }
+ return retval;
+}
+
void ExtractAllAddresses(const nsCOMArray<msgIAddressObject> &aHeader,
nsTArray<nsString> &names, nsTArray<nsString> &emails)
{