Revision 02b6ea19 pithos-macos/PithosAccount.m

b/pithos-macos/PithosAccount.m
47 47

  
48 48
@implementation PithosAccount
49 49
@synthesize uniqueName, active, name;
50
@synthesize syncActive, syncDirectoryPath, syncContainerName, syncLastCompleted, syncDaemon;
50
@synthesize syncActive, syncDirectoryPath, syncContainersDictionary, syncLastCompleted, syncDaemon;
51 51
@synthesize serverURL, versionResource, loginResource, publicResource;
52 52
@synthesize authUser, authToken, storageURLPrefix, authURL, loginURLPrefix, publicURLPrefix;
53 53
@synthesize pithos, accountNode;
......
78 78
    [serverURL release];
79 79
    [syncDaemon release];
80 80
    [syncLastCompleted release];
81
    [syncContainerName release];
81
    [syncContainersDictionary release];
82 82
    [syncDirectoryPath release];
83 83
    [name release];
84 84
    [uniqueName release];
......
86 86
}
87 87

  
88 88
- (NSString *)description {
89
    return [NSString stringWithFormat:@"uniqueName: %@, active: %d, name: %@, syncActive: %d, syncDirectoryPath: %@, syncContainerName: %@, syncLastCompleted: %@, serverURL: %@, versionResource: %@, loginResource: %@, publicResource: %@, authUser: %@, authToken: %@, storageURLPrefix: %@, authURL: %@, loginURLPrefix: %@, publicURLPrefix: %@", 
90
            uniqueName, active, name, syncActive, syncDirectoryPath, syncContainerName, syncLastCompleted, serverURL, versionResource, loginResource, publicResource, authUser, authToken, storageURLPrefix, authURL, loginURLPrefix, publicURLPrefix];
89
    return [NSString stringWithFormat:@"uniqueName: %@, active: %d, name: %@, syncActive: %d, syncDirectoryPath: %@, syncContainersDictionary: %@, syncLastCompleted: %@, serverURL: %@, versionResource: %@, loginResource: %@, publicResource: %@, authUser: %@, authToken: %@, storageURLPrefix: %@, authURL: %@, loginURLPrefix: %@, publicURLPrefix: %@", 
90
            uniqueName, active, name, syncActive, syncDirectoryPath, syncContainersDictionary, syncLastCompleted, serverURL, versionResource, loginResource, publicResource, authUser, authToken, storageURLPrefix, authURL, loginURLPrefix, publicURLPrefix];
91 91
}
92 92

  
93 93
#pragma mark -
......
173 173
    }
174 174
}
175 175

  
176
- (NSString *)syncContainerName {
177
    if (![syncContainerName length]) {
178
        [syncContainerName release];
179
        syncContainerName = [[NSString stringWithString:@"pithos"] retain];
176
- (NSMutableDictionary *)syncContainersDictionary {
177
    if (!syncContainersDictionary) {
178
        syncContainersDictionary = [[NSMutableDictionary dictionaryWithObject:[NSMutableArray array] 
179
                                                                       forKey:@"pithos"] retain];
180 180
    }        
181
    return syncContainerName;
181
    return syncContainersDictionary;
182 182
}
183 183

  
184
- (void)setSyncContainerName:(NSString *)aSyncContainerName {
185
    if (![self.syncContainerName isEqualToString:aSyncContainerName] && [aSyncContainerName length]) {
186
        [syncContainerName release];
187
        syncContainerName = [aSyncContainerName retain];
184
- (void)setSyncContainersDictionary:(NSMutableDictionary *)aSyncContainersDictionary {
185
    if (![self.syncContainersDictionary isEqualTo:syncContainersDictionary]) {
186
        [syncContainersDictionary release];
187
        syncContainersDictionary = [aSyncContainersDictionary retain];
188
        // XXX check for proper dictionary here
188 189
        
189 190
        @synchronized(self) {
190 191
            resetSyncDaemonLocalState = YES;
......
206 207
    @synchronized(self) {
207 208
        if (self.syncActive && !syncDaemon)
208 209
            syncDaemon = [[PithosSyncDaemon alloc] initWithDirectoryPath:self.syncDirectoryPath 
209
                                                           pithosAccount:self 
210
                                                           containerName:self.syncContainerName 
210
                                                           pithosAccount:self
211
                                                    containersDictionary:self.syncContainersDictionary
211 212
                                                         resetLocalState:resetSyncDaemonLocalState];
212 213
        resetSyncDaemonLocalState = NO;
213 214
    }
......
217 218
- (NSString *)serverURL {
218 219
    if (![self urlIsValid:serverURL]) {
219 220
        [serverURL release];
220
        serverURL = [[NSString stringWithString:@"https://plus.pithos.grnet.gr"] retain];
221
        serverURL = [[NSString stringWithString:@"https://pithos.okeanos.grnet.gr"] retain];
221 222
    }
222 223
    return serverURL;
223 224
}
......
424 425

  
425 426
        self.syncActive = [decoder decodeBoolForKey:@"syncActive"];
426 427
        self.syncDirectoryPath = [decoder decodeObjectForKey:@"syncDirectoryPath"];
427
        self.syncContainerName = [decoder decodeObjectForKey:@"syncContainerName"];
428
        self.syncContainersDictionary = [decoder decodeObjectForKey:@"syncContainersDictionary"];
428 429
        self.syncLastCompleted = [decoder decodeObjectForKey:@"syncLastCompleted"];
429 430
        
430 431
        self.serverURL = [decoder decodeObjectForKey:@"serverURL"];
......
454 455
    
455 456
    [encoder encodeBool:syncActive forKey:@"syncActive"];
456 457
    [encoder encodeObject:syncDirectoryPath forKey:@"syncDirectoryPath"];
457
    [encoder encodeObject:syncContainerName forKey:@"syncContainerName"];
458
    [encoder encodeObject:syncContainersDictionary forKey:@"syncContainersDictionary"];
458 459
    [encoder encodeObject:self.syncLastCompleted forKey:@"syncLastCompleted"];
459 460

  
460 461
    [encoder encodeObject:serverURL forKey:@"serverURL"];

Also available in: Unified diff