Adium

Changeset 24069

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

Starting to impliment pushing accounts. Still much work to be done, however.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/adium_syncservices/SyncServices/resources/ClientDescription.plist

    r24068 r24069  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
    3  
    4 <!-- ClientDescription.plist --> 
    5 <!-- Adium --> 
    6 <!-- Created by Stephen Holt on 6/24/08. --> 
    7 <!-- Copyright 2008 __MyCompanyName__. All rights reserved. --> 
    8  
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
    93<plist version="1.0"> 
    104<dict> 
    115        <key>DisplayName</key> 
    12         <string>Adium</string> 
     6        <string>AdiumSyncHelper</string> 
    137        <key>Entities</key> 
    148        <dict> 
     
    1711                        <string>com.apple.syncservices.RecordEntityName</string> 
    1812                        <string>first name</string> 
    19                         <!-- <string>aRelationship</string> --> 
    2013                </array> 
    2114        </dict> 
  • branches/adium_syncservices/SyncServices/source/AdiumSyncHelper.h

    r24068 r24069  
    1212#import "ASHDummyAdium.h" 
    1313         
    14 #define ADIUM_SYNC_HELPER_IDENTIFIER @"com.adiumx.AdiumSyncHelper" 
    15 #define ADIUM_SYNC_SCHEMA_NAME @"AdiumSyncSchema" 
     14#define ADIUM_SYNC_HELPER_IDENTIFIER    @"com.adiumx.AdiumSyncHelper" 
     15#define ADIUM_SYNC_SCHEMA_NAME                  @"AdiumSyncSchema" 
     16 
     17#define LAST_SYNC_KEY   @"lastSync" 
     18 
     19#define ACCOUNT_ENTITY_NAME     @"com.adiumx.Account" 
    1620 
    1721@protocol AIAdium; 
  • branches/adium_syncservices/SyncServices/source/AdiumSyncHelper.m

    r24068 r24069  
    3838        } 
    3939         
    40 //    [self syncCleanup]; 
     40      [self syncCleanup]; 
    4141} 
    4242 
     
    6161} 
    6262 
    63 //- (void)negotiateSession:(ISyncSession *)syncSession  
    64 //{ 
    65 //} 
     63- (void)negotiateSession:(ISyncSession *)syncSession  
     64
     65        [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:LAST_SYNC_KEY]; 
     66
    6667 
    6768#pragma mark push/pull 
    6869- (void)pushDataForSession:(ISyncSession *)syncSession 
    6970{ 
     71        if([syncSession shouldPushAllRecordsForEntityName:ACCOUNT_ENTITY_NAME]) { 
     72                NSEnumerator    *enumerator = [[adium accountController] accounts]; 
     73                AIAccount               *account; 
     74                 
     75                while ((account = [enumerator nextObject])) { 
     76                        NSDictionary *syncRecord = [self convertAccountToSyncRecord:account]; 
     77                        [syncSession pushChangesFromRecord:syncRecord withIdentifier:[account UID]]; 
     78                } 
     79        } else if ([syncSession shouldPushChangesForEntityName:ACCOUNT_ENTITY_NAME]) { 
     80                NSDate  *lastSync = [[NSUserDefaults standardUserDefaults] objectForKey:LAST_SYNC_KEY]; 
     81        } 
    7082} 
    7183