Changeset 23973
- Timestamp:
- 06/14/2008 01:41:12 PM (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h
r23883 r23973 473 473 * Key Value 474 474 * @"ID" NSString of the containerID 475 * @"Frame" NSString of the window's [NSWindow frame]475 * @"Frame" NSString of the window's [NSWindow frame] 476 476 * @"Content" NSArray of the AIChat objects within that container 477 * @"ActiveChat" AIChat that is currently active 477 478 * @"Name" NSString of the container's name 478 479 */ trunk/Plugins/Dual Window Interface/AIDualWindowInterfacePlugin.m
r23556 r23973 170 170 * 171 171 * The returned array has zero or more NSDictionary objects with the following information for each container 172 * Key Value 173 * @"ID" NSString of the containerID 174 * @"Frame" NSString of the window's [NSWindow frame] 175 * @"Content" NSArray of the AIChat objects within that container 176 * @"Name" NSString of the container's name 172 * Key Value 173 * @"ID" NSString of the containerID 174 * @"Frame" NSString of the window's [NSWindow frame] 175 * @"Content" NSArray of the AIChat objects within that container 176 * @"ActiveChat" AIChat that is currently active 177 * @"Name" NSString of the container's name 177 178 */ 178 179 - (NSArray *)openContainersAndChats … … 187 188 NSStringFromRect([[container window] frame]), @"Frame", 188 189 [container containedChats], @"Content", 190 [container activeChat], @"ActiveChat", 189 191 [container name], @"Name", 190 192 nil]]; trunk/Source/AIInterfaceController.m
r23883 r23973 408 408 if (!savedData) 409 409 return; 410 410 411 411 NSEnumerator *enumerator = [[NSKeyedUnarchiver unarchiveObjectWithData:savedData] objectEnumerator]; 412 412 NSDictionary *dict; … … 421 421 NSEnumerator *chatEnumerator = [[dict objectForKey:@"Content"] objectEnumerator]; 422 422 NSDictionary *chatDict; 423 AIChat *containerActiveChat = nil; 423 424 424 425 while ((chatDict = [chatEnumerator nextObject])) { … … 426 427 AIService *service = [[adium accountController] firstServiceWithServiceID:[chatDict objectForKey:@"serviceID"]]; 427 428 AIAccount *account = [[adium accountController] accountWithInternalObjectID:[chatDict objectForKey:@"AccountID"]]; 428 429 429 430 if ([[chatDict objectForKey:@"IsGroupChat"] boolValue]) { 430 431 chat = [[adium chatController] chatWithName:[chatDict objectForKey:@"Name"] … … 434 435 } else { 435 436 AIListContact *contact = [[adium contactController] contactWithService:service 436 account:account437 UID:[chatDict objectForKey:@"UID"]];437 account:account 438 UID:[chatDict objectForKey:@"UID"]]; 438 439 439 440 chat = [[adium chatController] chatWithContact:contact]; … … 444 445 forProperty:@"Restored Chat" 445 446 notify:NotifyNow]; 447 448 if ([[chatDict objectForKey:@"ActiveChat"] boolValue]) { 449 containerActiveChat = chat; 450 } 446 451 447 452 // Open the chat into the container we've created above. 448 453 [self openChat:chat inContainerWithID:[dict objectForKey:@"ID"] atIndex:-1]; 449 454 } 455 456 if (containerActiveChat) 457 [self setActiveChat:containerActiveChat]; 450 458 } 451 459 } … … 470 478 return; 471 479 } 472 480 473 481 // Save active containers. 474 482 NSMutableArray *savedContainers = [NSMutableArray array]; … … 485 493 486 494 [newContainerDict setObject:[[chat account] internalObjectID] forKey:@"AccountID"]; 487 495 488 496 // Save chat-specific information. 489 497 if ([chat isGroupChat]) { … … 491 499 [newContainerDict addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: 492 500 [NSNumber numberWithBool:YES], @"IsGroupChat", 501 [NSNumber numberWithBool:([dict objectForKey:@"ActiveChat"] == chat)], @"ActiveChat", 493 502 [chat name], @"Name", 494 503 [chat chatCreationDictionary], @"ChatCreationInfo",nil]]; 495 504 } else { 496 505 [newContainerDict addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: 506 [NSNumber numberWithBool:([dict objectForKey:@"ActiveChat"] == chat)], @"ActiveChat", 497 507 [[chat listObject] UID], @"UID", 498 508 [[chat listObject] serviceID], @"serviceID", 499 509 [[chat account] internalObjectID], @"AccountID",nil]]; 500 510 } 501 511 502 512 [containerContents addObject:newContainerDict]; 503 513 } 504 514 505 515 // Replace the "Content" key in -openContainersAndChats with our version of the content. 516 // Remove the ActiveChat reference 506 517 // We use the same keys otherwise that -openContainersAndChats provides (Name, ID, Frame) 507 518 NSMutableDictionary *saveDict = [[dict mutableCopy] autorelease]; 519 520 [saveDict removeObjectForKey:@"ActiveChat"]; 508 521 509 522 [saveDict setObject:containerContents