diff --git a/NEWS b/NEWS index 0ce339e67..e1779ab06 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ Bug fixes - Fixed decoding of the charset parameter when using single quotes (#2306) + - Fixed potential crash when sending MDN from Sent folder (#2209) 2.0.5a (2013-04-17) ------------------ diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index d621aa353..e714bf6ab 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -1,14 +1,15 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2005-2013 Inverse inc. - This file is part of OpenGroupware.org. + This file is part of SOGo. - OGo is free software; you can redistribute it and/or modify it under + SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. @@ -30,6 +31,8 @@ #import #import +#import +#import #import #import @@ -216,7 +219,7 @@ static NSString *mailETag = nil; { identityEmail = [[identities objectAtIndex: count] objectForKey: @"email"]; - rc = [identityEmail isEqualToString: email]; + rc = ([identityEmail caseInsensitiveCompare: email] == NSOrderedSame); } return rc; @@ -489,6 +492,7 @@ static NSString *mailETag = nil; - (NSString *) shouldAskReceipt { + NGMailAddress *mailAddress; NSDictionary *mailHeaders; NSString *email, *action; @@ -504,6 +508,15 @@ static NSString *mailETag = nil; email = [mailHeaders objectForKey: @"return-receipt-to"]; } + // email here can be "foo@bar.com" or "Foo Bar " + // we must extract the actual email address + mailAddress = [[NGMailAddressParser mailAddressParserWithString: email] parse]; + + if ([mailAddress isKindOfClass: [NGMailAddress class]]) + email = [mailAddress address]; + else + email = nil; + if (email) { if (![self _userHasEMail: email]