Adium

Changeset 24067

Show
Ignore:
Timestamp:
06/24/2008 07:56:34 PM (5 months ago)
Author:
evands
Message:

KEY_USER_ICON is a display attribute; it is no longer coincidentally posted as a status update, so we automatic syncing to address book was broken. Now it's used properly. Fixes #10105

Files:

Legend:

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

    r24027 r24067  
    354354                        } 
    355355                } 
    356                  
    357     } else if (automaticSync && [inModifiedKeys containsObject:KEY_USER_ICON]) { 
    358          
     356    } 
     357     
     358    return modifiedAttributes; 
     359
     360 
     361- (void)listObjectAttributesChanged:(NSNotification *)notification 
     362
     363        AIListObject    *inObject = [notification object]; 
     364        NSSet                   *keys = [[notification userInfo] objectForKey:@"Keys"]; 
     365         
     366        if ([keys containsObject:KEY_USER_ICON] && 
     367                [inObject isKindOfClass:[AIListContact class]]) { 
     368                AIListContact *listContact = (AIListContact *)inObject; 
     369 
    359370                //Only update when the serverside icon changes if there is no Adium preference overriding it 
    360371                if (![AIUserIcons manuallySetUserIconDataForObject:listContact]) { 
    361372                        //Find the person 
    362373                        ABPerson *person = [listContact addressBookPerson]; 
    363  
     374                         
    364375                        if (person && (person != [sharedAddressBook me])) { 
    365376                                if (person) { 
     
    368379                                        NSImage *objectUserIcon = [listContact userIcon]; 
    369380                                        NSData  *objectUserIconData = nil; 
    370  
     381                                         
    371382                                        if (!existingABImage || 
    372383                                                (objectUserIcon && [(objectUserIconData = [objectUserIcon PNGRepresentation]) isEqualToData:[existingABImage PNGRepresentation]])) { 
     
    383394                                } 
    384395                        } 
    385                 } 
    386     } 
    387      
    388     return modifiedAttributes; 
     396                }                
     397        } 
    389398} 
    390399 
     
    533542                        //Update all contacts, which will update objects and then our "me" card information 
    534543                        [self updateAllContacts]; 
     544                } 
     545                 
     546                if (automaticSync) { 
     547                        [[adium notificationCenter] addObserver:self 
     548                                                                                   selector:@selector(listObjectAttributesChanged:) 
     549                                                                                           name:ListObject_AttributesChanged 
     550                                                                                         object:nil]; 
     551                } else { 
     552                        [[adium notificationCenter] removeObserver:self name:ListObject_AttributesChanged object:nil]; 
    535553                } 
    536554