Changeset 24099
- Timestamp:
- 06/29/2008 05:04:01 PM (5 months ago)
- Files:
-
- trunk/Frameworks/Adium Framework/Source/AIContactControllerProtocol.h (modified) (1 diff)
- trunk/Source/AIContactController.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/Source/AIContactControllerProtocol.h
r23607 r24099 88 88 - (AIListBookmark *)bookmarkForChat:(AIChat *)inChat; 89 89 90 - (AIMetaContact *)groupUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray; 90 - (AIMetaContact *)knownMetaContactForGroupingUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray; 91 - (AIMetaContact *)groupUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray usingMetaContactHint:(AIMetaContact *)metaContactHint; 92 - (AIMetaContact *)metaContactWithObjectID:(NSNumber *)inObjectID; 93 91 94 - (AIMetaContact *)groupListContacts:(NSArray *)contactsToGroupArray; 92 95 - (void)removeAllListObjectsMatching:(AIListObject *)listObject fromMetaContact:(AIMetaContact *)metaContact; trunk/Source/AIContactController.m
r24074 r24099 101 101 102 102 //MetaContacts 103 - (AIMetaContact *)metaContactWithObjectID:(NSNumber *)inObjectID;104 103 - (BOOL)_restoreContactsToMetaContact:(AIMetaContact *)metaContact; 105 104 - (void)_restoreContactsToMetaContact:(AIMetaContact *)metaContact fromContainedContactsArray:(NSArray *)containedContactsArray; … … 680 679 * existed before this call to metaContactWithObjectID: 681 680 */ 682 if (shouldRestoreContacts) { 683 if (![self _restoreContactsToMetaContact:metaContact]) { 684 //If restoring the metacontact did not actually add any contacts, delete it since it is invalid 685 [self breakdownAndRemoveMetaContact:metaContact]; 686 metaContact = nil; 687 } 688 } 681 if (shouldRestoreContacts) 682 [self _restoreContactsToMetaContact:metaContact]; 689 683 690 684 /* As with contactWithService:account:UID, update all attributes so observers are initially informed of … … 696 690 } 697 691 698 return (metaContact);692 return metaContact; 699 693 } 700 694 … … 951 945 } 952 946 947 /*! 948 * @brief Determine the existing metacontact into which a grouping of UIDs and services would be placed 949 * 950 * @param UIDsArray NSArray of UIDs 951 * @param servicesArray NSArray of serviceIDs corresponding to entries in UIDsArray 952 * 953 * @result Either the existing AIMetaContact -[self groupUIDs:forServices:usingMetaContactHint:] would return if passed a nil metaContactHint, 954 * or nil (if no existing metacontact would be used). 955 */ 956 - (AIMetaContact *)knownMetaContactForGroupingUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray 957 { 958 AIMetaContact *metaContact = nil; 959 int count = [UIDsArray count]; 960 int i; 961 962 //Build an array of all contacts matching this description (multiple accounts on the same service listing 963 //the same UID mean that we can have multiple AIListContact objects with a UID/service combination) 964 for (i = 0; i < count; i++) { 965 if ((metaContact = [contactToMetaContactLookupDict objectForKey:[AIListObject internalObjectIDForServiceID:[servicesArray objectAtIndex:i] 966 UID:[UIDsArray objectAtIndex:i]]])) { 967 break; 968 } 969 } 970 971 return metaContact; 972 } 953 973 954 974 /*! … … 963 983 * @param UIDsArray NSArray of UIDs 964 984 * @param servicesArray NSArray of serviceIDs corresponding to entries in UIDsArray 985 * @param metaContactHint If passed, an AIMetaContact to use for the grouping if an existing one isn't found. If nil, a new metacontact will be craeted in that case. 965 986 */ 966 - (AIMetaContact *)groupUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray 987 - (AIMetaContact *)groupUIDs:(NSArray *)UIDsArray forServices:(NSArray *)servicesArray usingMetaContactHint:(AIMetaContact *)metaContactHint 967 988 { 968 989 NSMutableSet *internalObjectIDs = [[NSMutableSet alloc] init]; … … 989 1010 990 1011 if ([internalObjectIDs count] > 1) { 991 //Create a new metaContact is we didn't find one .992 if (!metaContact ) {1012 //Create a new metaContact is we didn't find one and weren't supplied a hint 1013 if (!metaContact && !(metaContact = metaContactHint)) { 993 1014 AILogWithSignature(@"New metacontact to group %@ on %@", UIDsArray, servicesArray); 994 1015 metaContact = [self metaContactWithObjectID:nil];