fix 244299 handle js exceptions when trying to find identity for reply, sr=mscott, handles case where original account has been deleted/corrupted
git-svn-id: svn://10.0.0.236/trunk@156718 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -70,6 +70,8 @@ function getBestIdentity(identities, optionalHint)
|
||||
{
|
||||
var identity = null;
|
||||
|
||||
try
|
||||
{
|
||||
// if we have more than one identity and a hint to help us pick one
|
||||
if (identities.Count() > 1 && optionalHint) {
|
||||
// normalize case on the optional hint to improve our chances of finding a match
|
||||
@@ -106,6 +108,8 @@ function getBestIdentity(identities, optionalHint)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex) {dump (ex + "\n");}
|
||||
|
||||
// still no matches? Give up and pick the first one like we used to.
|
||||
if (!identity)
|
||||
|
||||
@@ -89,40 +89,44 @@ function getBestIdentity(identities, optionalHint)
|
||||
{
|
||||
var identity = null;
|
||||
|
||||
// if we have more than one identity and a hint to help us pick one
|
||||
if (identities.Count() > 1 && optionalHint) {
|
||||
// iterate over all of the identities
|
||||
var tempID;
|
||||
for (id = 0; id < identities.Count(); id++) {
|
||||
tempID = identities.GetElementAt(id).QueryInterface(Components.interfaces.nsIMsgIdentity);
|
||||
if (optionalHint.search(tempID.email) >= 0) {
|
||||
identity = tempID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we could not find an exact email address match within the hint fields then maybe the message
|
||||
// was to a mailing list. In this scenario, we won't have a match based on email address.
|
||||
// Before we just give up, try and search for just a shared domain between the the hint and
|
||||
// the email addresses for our identities. Hey, it is better than nothing and in the case
|
||||
// of multiple matches here, we'll end up picking the first one anyway which is what we would have done
|
||||
// if we didn't do this second search. This helps the case for corporate users where mailing lists will have the same domain
|
||||
// as one of your multiple identities.
|
||||
|
||||
if (!identity) {
|
||||
try
|
||||
{
|
||||
// if we have more than one identity and a hint to help us pick one
|
||||
if (identities.Count() > 1 && optionalHint) {
|
||||
// iterate over all of the identities
|
||||
var tempID;
|
||||
for (id = 0; id < identities.Count(); id++) {
|
||||
tempID = identities.GetElementAt(id).QueryInterface(Components.interfaces.nsIMsgIdentity);
|
||||
|
||||
// extract out the partial domain
|
||||
var start = tempID.email.lastIndexOf("@"); // be sure to include the @ sign in our search to reduce the risk of false positives
|
||||
|
||||
if (optionalHint.search(tempID.email.slice(start, tempID.email.length)) >= 0) {
|
||||
if (optionalHint.search(tempID.email) >= 0) {
|
||||
identity = tempID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we could not find an exact email address match within the hint fields then maybe the message
|
||||
// was to a mailing list. In this scenario, we won't have a match based on email address.
|
||||
// Before we just give up, try and search for just a shared domain between the the hint and
|
||||
// the email addresses for our identities. Hey, it is better than nothing and in the case
|
||||
// of multiple matches here, we'll end up picking the first one anyway which is what we would have done
|
||||
// if we didn't do this second search. This helps the case for corporate users where mailing lists will have the same domain
|
||||
// as one of your multiple identities.
|
||||
|
||||
if (!identity) {
|
||||
for (id = 0; id < identities.Count(); id++) {
|
||||
tempID = identities.GetElementAt(id).QueryInterface(Components.interfaces.nsIMsgIdentity);
|
||||
|
||||
// extract out the partial domain
|
||||
var start = tempID.email.lastIndexOf("@"); // be sure to include the @ sign in our search to reduce the risk of false positives
|
||||
|
||||
if (optionalHint.search(tempID.email.slice(start, tempID.email.length)) >= 0) {
|
||||
identity = tempID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex) {dump (ex + "\n");}
|
||||
|
||||
// still no matches? Give up and pick the first one like we used to.
|
||||
if (!identity)
|
||||
|
||||
Reference in New Issue
Block a user