Adium

Changeset 24070

Show
Ignore:
Timestamp:
06/25/2008 11:07:15 AM (5 months ago)
Author:
sholt
Message:

Track when we modify accounts. This is necessary for fast syncing support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/adium_syncservices/Frameworks/Adium Framework/Source/AIAccount.h

    r23837 r24070  
    144144        NSMutableArray                          *delayedUpdateStatusTargets; 
    145145        NSTimer                                         *silenceAllContactUpdatesTimer; 
     146         
     147        //Sync Tracking 
     148        NSDate                                          *m_modificationDate; 
    146149} 
    147150 
     
    235238-(void)verifyCommand:(NSString*)commandName forChat:(AIChat*)chat; 
    236239 
     240//synching 
     241- (void)accountModified; 
     242- (void)setModificationDate:(NSDate *)date; 
     243- (NSDate *)modificationDate; 
    237244@end 
    238245 
  • branches/adium_syncservices/Frameworks/Adium Framework/Source/AIAccount.m

    r23862 r24070  
    860860{ 
    861861        //add stuff 
     862} 
     863 
     864#pragma mark Syncing 
     865- (void)accountModified 
     866{ 
     867        if(m_modificationDate) 
     868                [m_modificationDate release]; 
     869        m_modificationDate = [[NSDate date] autorelease]; 
     870} 
     871 
     872- (void)setModificationDate:(NSDate *)date 
     873{ 
     874        if(m_modificationDate) 
     875                [m_modificationDate release]; 
     876        m_modificationDate = [date retain]; 
     877} 
     878 
     879- (NSDate *)modificationDate 
     880{ 
     881        return m_modificationDate; 
    862882} 
    863883 
  • branches/adium_syncservices/Source/AdiumAccounts.m

    r20853 r24070  
    3030#define ACCOUNT_UID                                             @"UID"                          //Account UID 
    3131#define ACCOUNT_OBJECT_ID                               @"ObjectID"             //Account object ID 
     32#define ACCOUNT_MOD_DATE                                @"ModificationDate"     //Account last updated 
    3233 
    3334@interface AdiumAccounts (PRIVATE) 
     
    150151{ 
    151152        [accounts addObject:inAccount]; 
     153        [inAccount accountModified]; 
    152154        [self _saveAccounts]; 
    153155} 
     
    181183    [accounts moveObject:account toIndex:destIndex]; 
    182184    [self _saveAccounts]; 
     185        [account accountModified]; 
    183186        return [accounts indexOfObject:account]; 
    184187} 
     
    191194- (void)accountDidChangeUID:(AIAccount *)account 
    192195{ 
     196        [account accountModified]; 
    193197        [self _saveAccounts]; 
    194198} 
     
    235239                NSString        *accountUID = [accountDict objectForKey:ACCOUNT_UID]; 
    236240                NSString        *internalObjectID = [accountDict objectForKey:ACCOUNT_OBJECT_ID]; 
     241                NSDate          *accountUpdated = [accountDict objectForKey:ACCOUNT_MOD_DATE]; 
    237242 
    238243        //Create the account and add it to our array 
    239244        if (service && accountUID && [accountUID length]) { 
    240245                        if ((newAccount = [service accountWithUID:accountUID internalObjectID:internalObjectID])) { 
    241                 [accounts addObject:newAccount]; 
     246                                [accounts addObject:newAccount]; 
     247                                if (accountUpdated) [newAccount setModificationDate:accountUpdated]; 
    242248            } else { 
    243249                                NSLog(@"Could not load account %@",accountDict); 
     
    342348                        [flatAccount setObject:[account UID] forKey:ACCOUNT_UID];                                                       //Account UID 
    343349                        [flatAccount setObject:[account internalObjectID] forKey:ACCOUNT_OBJECT_ID];                    //Account Object ID 
     350                        [flatAccount setObject:[account modificationDate] forKey:ACCOUNT_MOD_DATE];     //Account last updated date 
    344351                         
    345352                        [flatAccounts addObject:flatAccount];