Adium

Changeset 23535

Show
Ignore:
Timestamp:
05/21/2008 07:11:19 AM (6 months ago)
Author:
evands
Message:

If only one account is online of a given service type, it should be checked when the Add Contact window opens regardless of whether it was checked previously. Fixes #9871

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/AINewContactWindowController.m

    r22676 r23535  
    508508        checkedAccounts = [[NSMutableSet alloc] init]; 
    509509 
    510         //Select accounts by default 
    511510        if (initialAccount && [accounts containsObject:initialAccount]) { 
     511                //Select accounts by default 
    512512                [checkedAccounts addObject:initialAccount]; 
    513513 
     514        } else if ([[accounts valueForKeyPath:@"@sum.online"] intValue] == 1) { 
     515                //Only one online account; it should be checked 
     516                NSEnumerator    *enumerator; 
     517                AIAccount               *anAccount; 
     518                 
     519                enumerator = [accounts objectEnumerator]; 
     520                while ((anAccount = [enumerator nextObject])) { 
     521                        if ([anAccount online]) { 
     522                                [checkedAccounts addObject:anAccount]; 
     523                                break; 
     524                        } 
     525                } 
     526                 
    514527        } else { 
     528                //More than one online account; follow our 'add contact to' preferences 
    515529                NSEnumerator    *enumerator; 
    516530                AIAccount               *anAccount;