summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 22:56:15 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 22:56:15 -0500
commit6d5922ba891f5f0e37f6c70f16aae558f1a4063d (patch)
tree17b5bf885f9592bdfe8bcbd3ec9a2e03a0e8cdd9
parentfa9ca98c398438edfd77b876f9e4b666cac4fdf9 (diff)
downloadUXP-6d5922ba891f5f0e37f6c70f16aae558f1a4063d.tar
UXP-6d5922ba891f5f0e37f6c70f16aae558f1a4063d.tar.gz
UXP-6d5922ba891f5f0e37f6c70f16aae558f1a4063d.tar.lz
UXP-6d5922ba891f5f0e37f6c70f16aae558f1a4063d.tar.xz
UXP-6d5922ba891f5f0e37f6c70f16aae558f1a4063d.zip
Bug 1271353 - check own email addresses case-insensitively in correspondents column and ignore plus addressing part.
Tag #1273
-rw-r--r--mailnews/base/src/nsMsgDBView.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp
index baad45ef5..76a843df7 100644
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -870,6 +870,24 @@ nsresult nsMsgDBView::FetchLabel(nsIMsgDBHdr *aHdr, nsAString &aLabelString)
return NS_OK;
}
+/**
+ * Lowercase the email and remove a possible plus addressing part.
+ * E.g. John+test@example.com -> john@example.com.
+ */
+static void
+ToLowerCaseDropPlusAddessing(nsCString& aEmail)
+{
+ ToLowerCase(aEmail);
+ int32_t indPlus;
+ if ((indPlus = aEmail.FindChar('+')) == kNotFound)
+ return;
+ int32_t indAt;
+ indAt = aEmail.FindChar('@', indPlus);
+ if (indAt == kNotFound)
+ return;
+ aEmail.ReplaceLiteral(indPlus, indAt - indPlus, "");
+}
+
bool nsMsgDBView::IsOutgoingMsg(nsIMsgDBHdr* aHdr)
{
nsString author;
@@ -878,7 +896,7 @@ bool nsMsgDBView::IsOutgoingMsg(nsIMsgDBHdr* aHdr)
nsCString emailAddress;
nsString name;
ExtractFirstAddress(DecodedHeader(author), name, emailAddress);
-
+ ToLowerCaseDropPlusAddessing(emailAddress);
return mEmails.Contains(emailAddress);
}
@@ -2340,12 +2358,16 @@ NS_IMETHODIMP nsMsgDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sor
nsCString email;
identity->GetEmail(email);
- if (!email.IsEmpty())
+ if (!email.IsEmpty()) {
+ ToLowerCaseDropPlusAddessing(email);
mEmails.PutEntry(email);
+ }
identity->GetReplyTo(email);
- if (!email.IsEmpty())
+ if (!email.IsEmpty()) {
+ ToLowerCaseDropPlusAddessing(email);
mEmails.PutEntry(email);
+ }
}
return NS_OK;
}