From 59a473ce83fdebe4f573f1ab8b335a0e79e00520 Mon Sep 17 00:00:00 2001 From: halex Date: Wed, 4 Jul 2007 04:56:48 +0000 Subject: [PATCH] * Small woopsies when checking if it was the contact was ourselves. * Does not fail with contacts without any email addresses. * Equality checks are performed after converting strings to lower cases. --- src/www/js/MailConversationView.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/www/js/MailConversationView.js b/src/www/js/MailConversationView.js index 69a765a..1dcce5e 100644 --- a/src/www/js/MailConversationView.js +++ b/src/www/js/MailConversationView.js @@ -338,9 +338,9 @@ Dragonfly.Mail.ConversationView.handleClick = function (evt) { // We have an email from the page - use it! for (var x = 0; x < tempcontact.email.length; x++) { - if (tempcontact.email[x].toLowerCase() == email) + if (tempcontact.email[x] && tempcontact.email[x].toLowerCase() == email) { - //logDebug('YES!'); + logDebug('Result found by checking contact email against mail.'); contact = tempcontact; continue; } @@ -348,12 +348,12 @@ Dragonfly.Mail.ConversationView.handleClick = function (evt) } else { - // First, check if the name == our email. + // First, check if it's just sent to us (which means display our own card) if (tempcontact.email) { for (var x = 0; x < tempcontact.email.length; x++) { - if (tempcontact.email[x].toLowerCase() == myemail) { - //logDebug('YES!'); + if (tempcontact.email[x] && tempcontact.email[x].toLowerCase() == myemail && contactname == myemail) { + logDebug('Result found via checking if contact was us.'); contact = tempcontact; continue; } @@ -362,8 +362,9 @@ Dragonfly.Mail.ConversationView.handleClick = function (evt) // Search based on name, not email. - if (tempcontact.fn == contactname) + if (tempcontact.fn.toLowerCase() == contactname.toLowerCase()) { + logDebug('Result found via name search.'); contact = tempcontact; continue; }