Changeset 25625
- Timestamp:
- 11/24/2008 10:22:05 PM (2 months ago)
- Files:
-
- trunk/Frameworks/Adium Framework/Source/AIContactHidingController.m (modified) (1 diff)
- trunk/Frameworks/Adium Framework/Source/AIContactObserverManager.m (modified) (1 diff)
- trunk/Frameworks/Adium Framework/Source/AIListContact.h (modified) (2 diffs)
- trunk/Frameworks/Adium Framework/Source/AIListContact.m (modified) (7 diffs)
- trunk/Frameworks/Adium Framework/Source/AIListGroup.m (modified) (1 diff)
- trunk/Frameworks/Adium Framework/Source/AIListObject.h (modified) (1 diff)
- trunk/Frameworks/Adium Framework/Source/AIListObject.m (modified) (2 diffs)
- trunk/Frameworks/Adium Framework/Source/AIMetaContact.m (modified) (4 diffs)
- trunk/Frameworks/Adium Framework/Source/AIUserIcons.m (modified) (3 diffs)
- trunk/Plugins/Dual Window Interface/AIAccountSelectionView.m (modified) (1 diff)
- trunk/Plugins/Dual Window Interface/AIMessageViewController.m (modified) (3 diffs)
- trunk/Source/AIChatController.m (modified) (1 diff)
- trunk/Source/AIContactController.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/Source/AIContactHidingController.m
r25457 r25625 139 139 140 140 //we can cast to AIListContact here since groups and metas were handled up above 141 if (!online && (!showOfflineContacts || !(((AIListContact *)listObject).parentContact.containingObject && ((AIListContact *)listObject).parentContact.containingObject == adium.contactController.offlineGroup))) 142 return NO; 141 AIListContact *contact = (AIListContact *)listObject; 142 143 if (!online) { 144 if (showOfflineContacts) { 145 if (useOfflineGroup && ![contact.parentContact.groups containsObject:adium.contactController.offlineGroup]) 146 return NO; 147 } else 148 return NO; 149 } 143 150 144 151 if (!showIdleContacts && [listObject valueForProperty:@"IdleSince"]) trunk/Frameworks/Adium Framework/Source/AIContactObserverManager.m
r25620 r25625 281 281 if (attributes) [self listObjectAttributesChanged:listObject modifiedKeys:attributes]; 282 282 283 //If this contact is within a meta contact, update the meta contact too 284 AIListObject<AIContainingObject> *containingObject = listObject.containingObject; 285 if (containingObject && [containingObject isKindOfClass:[AIMetaContact class]]) { 286 NSSet *attributes = [inObserver updateListObject:containingObject 287 keys:nil 288 silent:YES]; 289 if (attributes) [self listObjectAttributesChanged:containingObject 290 modifiedKeys:attributes]; 291 } 283 if ([listObject isKindOfClass:[AIListContact class]]) { 284 AIListContact *contact = listObject; 285 286 //If this contact is within a meta contact, update the meta contact too 287 if (contact.metaContact) { 288 NSSet *attributes = [inObserver updateListObject:contact.metaContact 289 keys:nil 290 silent:YES]; 291 if (attributes) [self listObjectAttributesChanged:contact.metaContact 292 modifiedKeys:attributes]; 293 } 294 } 295 292 296 [pool release]; 293 297 } trunk/Frameworks/Adium Framework/Source/AIListContact.h
r25587 r25625 20 20 #define KEY_AB_UNIQUE_ID @"AB Unique ID" 21 21 22 @class ABPerson, AIListGroup ;22 @class ABPerson, AIListGroup, AIMetaContact; 23 23 24 24 @interface AIListContact : AIListObject { 25 25 AIAccount *account; 26 AIMetaContact *metaContact; 26 27 NSString *remoteGroupName; 27 28 NSString *internalUniqueObjectID; … … 37 38 - (void)restoreGrouping; 38 39 39 @property (readonly, nonatomic) AIList Group *parentGroup;40 @property (readonly, nonatomic) AI ListContact *parentContact;40 @property (readonly, nonatomic) AIListContact *parentContact; //This needs renaming. It's the 'topmost' contact, either self or meta 41 @property (readonly, nonatomic) AIMetaContact *metaContact; 41 42 42 43 @property (readonly, nonatomic) NSString *ownDisplayName; trunk/Frameworks/Adium Framework/Source/AIListContact.m
r25622 r25625 127 127 [adium.contactController contactRemoteGroupingChanged:self]; 128 128 129 if (self. parentContact != self) {130 [ (AIMetaContact *)self.parentContact remoteGroupingOfContainedObject:self changedTo:remoteGroupName];129 if (self.metaContact) { 130 [self.metaContact remoteGroupingOfContainedObject:self changedTo:remoteGroupName]; 131 131 } 132 132 } … … 158 158 - (NSString *)displayName 159 159 { 160 AI ListContact *parentContact = self.parentContact;161 162 NSString *displayName = parentContact == self ? super.displayName : parentContact.displayName;160 AIMetaContact *meta = self.metaContact; 161 162 NSString *displayName = meta ? meta.displayName : super.displayName; 163 163 164 164 //If a display name was found, return it; otherwise, return the formattedUID … … 249 249 - (NSString *)phoneticName 250 250 { 251 AI ListContact *parentContact = self.parentContact;251 AIMetaContact *meta = self.metaContact; 252 252 NSString *phoneticName; 253 253 254 phoneticName = ((parentContact == self) ? 255 super.phoneticName : 256 parentContact.phoneticName); 254 phoneticName = meta ? meta.phoneticName : super.phoneticName;; 257 255 258 256 //If a display name was found, return it; otherwise, return the formattedUID 259 return phoneticName ? phoneticName : self.displayName;257 return phoneticName ? phoneticName : self.displayName; 260 258 } 261 259 … … 570 568 571 569 #pragma mark Parents 572 /*!573 * @brief This object's parent AIListGroup574 *575 * @result An AIListGroup which contains this object or the object containing this object, or nil if it is not in an AIListGroup.576 */577 - (AIListGroup *)parentGroup578 {579 AIListObject<AIContainingObject> *parentGroup = self.parentContact.containingObject;580 581 if (parentGroup && [parentGroup isKindOfClass:[AIListGroup class]]) {582 return (AIListGroup *)parentGroup;583 } else {584 return nil;585 }586 }587 570 588 571 /*! … … 594 577 * @result Either this contact or some more-encompassing contact which ultimately contains it. 595 578 */ 596 - (AIListContact *)parentContact 597 { 598 AIListContact *parentContact = self; 599 600 while ([parentContact.containingObject isKindOfClass:[AIListContact class]]) { 601 parentContact = (AIListContact *)parentContact.containingObject; 602 } 603 604 return parentContact; 605 } 579 - (AIListContact *)parentContact 580 { 581 if (self.metaContact) 582 return self.metaContact; 583 584 return self; 585 } 606 586 607 587 - (BOOL)containsObject:(AIListObject*)object … … 610 590 } 611 591 592 - (NSSet *)groups { 593 //if we're not in a meta, we should be in at least one group 594 if (!self.metaContact) 595 return containingObjects; 596 return [NSSet set]; 597 } 598 599 - (void)setContainingObject:(AIListObject <AIContainingObject> *)inGroup 600 { 601 if (!inGroup || [inGroup isKindOfClass:[AIMetaContact class]]) 602 metaContact = (AIMetaContact *)inGroup; 603 [super setContainingObject:inGroup]; 604 } 605 612 606 /*! 613 607 * @brief Can this object be part of a metacontact? … … 616 610 { 617 611 return YES; 612 } 613 614 - (AIMetaContact *)metaContact 615 { 616 if (metaContact) 617 return metaContact; 618 return nil; 618 619 } 619 620 trunk/Frameworks/Adium Framework/Source/AIListGroup.m
r25620 r25625 200 200 if ([self containsObject:inObject]) { 201 201 //Remove the object 202 if ( inObject.containingObject == self)203 [inObject setContainingObject:nil];202 if ([inObject.groups containsObject:self]) 203 inObject.containingObject = nil; 204 204 [_containedObjects removeObject:inObject]; 205 205 trunk/Frameworks/Adium Framework/Source/AIListObject.h
r25621 r25625 116 116 //Grouping 117 117 @property (readonly, nonatomic) AIListObject <AIContainingObject> *containingObject; 118 @property (readonly, nonatomic) NSSet *groups; 118 119 119 120 //Display trunk/Frameworks/Adium Framework/Source/AIListObject.m
r25624 r25625 202 202 //Grouping / Ownership ------------------------------------------------------------------------------------------------- 203 203 #pragma mark Grouping / Ownership 204 205 - (NSSet *)groups 206 { 207 return [NSSet set]; 208 } 209 204 210 /*! 205 211 * @brief Containing object of this object … … 220 226 NSParameterAssert(!inGroup || [inGroup canContainObject:self]); 221 227 if (![containingObjects containsObject:inGroup]) { 228 222 229 //XXX multiple containers 223 if (!inGroup) {230 if (!inGroup) 224 231 [containingObjects removeAllObjects]; 225 }else {232 else { 226 233 AIListObject<AIContainingObject> *container = self.containingObject; 227 234 if(container) trunk/Frameworks/Adium Framework/Source/AIMetaContact.m
r25587 r25625 138 138 139 139 [super setContainingObject:inGroup]; 140 } 141 142 - (AIListContact *)parentContact 143 { 144 return self; 145 } 146 147 - (AIMetaContact *)metaContact 148 { 149 return self; 140 150 } 141 151 … … 309 319 - (void)removeObject:(AIListObject *)inObject 310 320 { 321 AIListContact *contact = (AIListContact *)inObject; 311 322 if ([self.containedObjects containsObjectIdenticalTo:inObject]) { 312 323 BOOL noteRemoteGroupingChanged = NO; … … 318 329 [_containedObjects removeObject:inObject]; 319 330 320 if ( [(AIListContact *)inObject remoteGroupName]) {331 if (contact.remoteGroupName) { 321 332 //Reset it to its remote group 322 if ( inObject.containingObject == self)323 [inObject setContainingObject:nil];333 if (contact.metaContact) 334 contact.containingObject = nil; 324 335 noteRemoteGroupingChanged = YES; 325 336 } else { 326 [inObject setContainingObject:self.containingObject];337 contact.containingObject = self.containingObject; 327 338 } 328 339 … … 340 351 341 352 //If we remove our list object, don't continue to show up in the contact list 342 if ([self.containedObjects count] == 0) {353 /* if ([self.containedObjects count] == 0) { 343 354 [self setContainingObject:nil]; 344 } 355 }*/ 345 356 346 357 /* Now that we're done reconfigured ourselves and the recently removed object, trunk/Frameworks/Adium Framework/Source/AIUserIcons.m
r25620 r25625 17 17 #import <Adium/AIListContact.h> 18 18 #import <Adium/AIListObject.h> 19 #import <Adium/AIMetaContact.h> 19 20 #import <Adium/AIUserIcons.h> 20 21 #import <Adium/AIAdiumProtocol.h> … … 130 131 + (void)notifyOfChangedIconForObject:(AIListObject *)inObject 131 132 { 132 AIListObject *containingObject = inObject.containingObject;133 133 NSSet *modifiedKeys = [NSSet setWithObject:KEY_USER_ICON]; 134 134 … … 137 137 modifiedKeys:modifiedKeys]; 138 138 139 if ([ containingObject isKindOfClass:[AIListContact class]]) {139 if ([inObject isKindOfClass:[AIListContact class]] && ((AIListContact *)inObject).metaContact) { 140 140 //Notify 141 [[AIContactObserverManager sharedManager] listObjectAttributesChanged: containingObject141 [[AIContactObserverManager sharedManager] listObjectAttributesChanged:((AIListContact *)inObject).metaContact 142 142 modifiedKeys:modifiedKeys]; 143 143 } trunk/Plugins/Dual Window Interface/AIAccountSelectionView.m
r25443 r25625 385 385 * @brief Returns YES if a choice of destination contact is available 386 386 */ 387 - (BOOL)choicesAvailableForContact{ 388 AIListContact *parentContact = chat.listObject.parentContact; 389 if ([parentContact conformsToProtocol:@protocol(AIContainingObject)]) { 390 return [[(AIListContact <AIContainingObject> *)parentContact uniqueContainedObjects] count] > 1; 391 } else { 392 return NO; 393 } 387 - (BOOL)choicesAvailableForContact { 388 if (chat.listObject.metaContact) 389 return chat.listObject.metaContact.uniqueContainedObjects.count > 1; 390 391 return NO; 394 392 } 395 393 trunk/Plugins/Dual Window Interface/AIMessageViewController.m
r25586 r25625 39 39 #import <Adium/AIContentMessage.h> 40 40 #import <Adium/AIListContact.h> 41 #import <Adium/AIMetaContact.h> 41 42 #import <Adium/AIListObject.h> 42 43 #import <Adium/AIListOutlineView.h> … … 595 596 - (IBAction)sendMessageLater:(id)sender 596 597 { 597 AIListContact *listContact;598 599 598 //If the chat can _now_ send a message, send it immediately instead of waiting for "later". 600 599 if ([chat messageSendingAbility] == AIChatCanSendMessageNow) { … … 604 603 605 604 //Put the alert on the metaContact containing this listContact if applicable 606 listContact = chat.listObject.parentContact;605 AIMetaContact *listContact = chat.listObject.metaContact; 607 606 608 607 if (listContact) { trunk/Source/AIChatController.m
r25621 r25625 304 304 305 305 //If this object is within a meta contact, and a chat for an object in that meta contact already exists 306 if (targetContact. parentContact != targetContact && chat.listObject.parentContact == targetContact.parentContact) {306 if (targetContact.metaContact && chat.listObject.metaContact == targetContact.metaContact) { 307 307 308 308 //Switch the chat to be on this contact (and its account) now trunk/Source/AIContactController.m
r25559 r25625 279 279 [[inContact retain] autorelease]; 280 280 281 AIListObject<AIContainingObject> *containingObject = inContact.containingObject; 282 283 if ([containingObject isKindOfClass:[AIMetaContact class]]) { 281 if (inContact.metaContact) { 284 282 285 283 /* If inContact's containingObject is a metaContact, and that metaContact has no containingObject, 286 284 * use inContact's remote grouping as the metaContact's grouping. 287 285 */ 288 if (! containingObject.containingObject && [remoteGroupName length]) {286 if (!inContact.metaContact.containingObject && [remoteGroupName length]) { 289 287 //If no similar objects exist, we add this contact directly to the list 290 288 //Create a group for the contact even if contact list groups aren't on, … … 296 294 contactList); 297 295 298 [localGroup addObject: containingObject];299 300 [self _didChangeContainer:localGroup object: containingObject];296 [localGroup addObject:inContact.metaContact]; 297 298 [self _didChangeContainer:localGroup object:inContact.metaContact]; 301 299 [adium.notificationCenter postNotificationName:@"Contact_ListChanged" 302 300 object:localGroup.containingObject … … 319 317 toGroup:localGroup]; 320 318 321 } else if ( containingObject) {319 } else if (inContact.groups.count > 0) { 322 320 //If !remoteGroupName, remove the contact from any local groups 323 [(AIListGroup *)containingObject removeObject:inContact]; 324 325 [self _didChangeContainer:(AIListGroup *)containingObject object:inContact]; 321 for (AIListGroup *group in inContact.groups) { 322 [group removeObject:inContact]; 323 [self _didChangeContainer:group object:inContact]; 324 } 326 325 327 326 //NSLog(@"contactRemoteGroupingChanged: %@: -- !remoteGroupName so removed from %@",inContact,containingObject); … … 339 338 - (void)_moveContactLocally:(AIListContact *)listContact toGroup:(AIListGroup *)localGroup 340 339 { 341 AIListObject *containingObject;342 340 AIListObject *existingObject; 343 341 BOOL performedGrouping = NO; … … 350 348 351 349 //Remove this object from any local groups we have it in currently 352 if ((containingObject = listContact.containingObject) && 353 ([containingObject isKindOfClass:[AIListGroup class]])) { 354 //Remove the object 355 [(AIListGroup *)containingObject removeObject:listContact]; 356 [self _didChangeContainer:(AIListGroup *)containingObject object:listContact]; 357 } 358 359 if ([listContact canJoinMetaContacts]) { 350 for (AIListGroup *group in listContact.groups) { 351 [group removeObject:listContact]; 352 [self _didChangeContainer:group object:listContact]; 353 } 354 355 if (listContact.canJoinMetaContacts) { 360 356 if ((existingObject = [localGroup objectWithService:[listContact service] UID:[listContact UID]])) { 361 357 //If an object exists in this group with the same UID and serviceID, create a MetaContact … … 398 394 if ([inContact isKindOfClass:[AIMetaContact class]]) { 399 395 //For a metaContact, the closest we have to a remote group is the group it is within locally 400 group = [(AIMetaContact *)inContact parentGroup]; 396 //XXX multiple containers 397 group = [[inContact groups] anyObject]; 401 398 402 399 } else {