Skip to content

Commit

Permalink
#89 - Ready for v5.1 beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed Aug 22, 2015
1 parent 5457bfc commit 6a2929a
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions ReplyWithHeader/MHHeadersEditor.m
Expand Up @@ -40,7 +40,7 @@ - (id)originalMessageHeaders;
- (id)addressListForKey:(NSString *)key;
- (void)setAddresses:(id)arg1;
- (id)mailAccount;
//- (id)firstEmailAddress;
- (id)firstEmailAddress;
- (id)emailAliases;
@end

Expand Down Expand Up @@ -118,39 +118,41 @@ - (void)bringOutlookReplyAllBehaviour
[newToAddressList addObjectsFromArray:toAddressList];
}

// NSString *firstEmailAddress = [account firstEmailAddress]; TODO cleanup release
// NSLog(@"Look for firstEmailAddress: %@", firstEmailAddress);

NSArray *emailAliases = [account emailAliases];
MHLog(@"Email Aliases: %@", emailAliases);

for(int i=0; i<[emailAliases count]; i++) {
NSString *emailId = [emailAliases[i] valueForKey:@"alias"];
MHLog(@"email %@", emailId);
if (emailAliases == nil) {
NSString *firstEmailAddress = [account firstEmailAddress];
MHLog(@"Look for firstEmailAddress: %@", firstEmailAddress);

for (int i=0; i<[newToAddressList count]; i++)
{
NSString *eid = [newToAddressList objectAtIndex:i];
if ([eid rangeOf:emailId].location != NSNotFound)
if ([eid rangeOf:firstEmailAddress].location != NSNotFound)
{
MHLog(@"Found emailAlias: %@, Index is %d", emailId, i);
MHLog(@"Found firstEmailAddress: %@, Index is %d", firstEmailAddress, i);
[newToAddressList removeObjectAtIndex:i];
break;
}
}
} else {
for(int i=0; i<[emailAliases count]; i++) {
NSString *emailId = [emailAliases[i] valueForKey:@"alias"];
MHLog(@"email %@", emailId);

for (int i=0; i<[newToAddressList count]; i++)
{
NSString *eid = [newToAddressList objectAtIndex:i];
if ([eid rangeOf:emailId].location != NSNotFound)
{
MHLog(@"Found emailAlias: %@, Index is %d", emailId, i);
[newToAddressList removeObjectAtIndex:i];
break;
}
}
}
}


// for (int i=0; i<[newToAddressList count]; i++) TODO cleanup for release
// {
// NSString *eid = [newToAddressList objectAtIndex:i];
// if ([eid rangeOf:firstEmailAddress].location != NSNotFound)
// {
// NSLog(@"Found firstEmailAddress: %@, Index is %d", firstEmailAddress, i);
// [newToAddressList removeObjectAtIndex:i];
// }
// }

MHLog(@"newToAddressList: %@", newToAddressList);
[[self valueForKey:@"_toField"] setAddresses:newToAddressList];
}
Expand Down

0 comments on commit 6a2929a

Please sign in to comment.