1 | /* |
---|
2 | * Adium is the legal property of its developers, whose names are listed in the copyright file included |
---|
3 | * with this source distribution. |
---|
4 | * |
---|
5 | * This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
6 | * General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
7 | * or (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
10 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | * Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License along with this program; if not, |
---|
14 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | #import <Adium/AIListContact.h> |
---|
18 | |
---|
19 | #define KEY_PREFERRED_DESTINATION_CONTACT @"Preferred Destination Contact" |
---|
20 | |
---|
21 | @interface AIMetaContact : AIListContact <AIContainingObject> { |
---|
22 | NSNumber *objectID; |
---|
23 | |
---|
24 | AIListContact *_preferredContact; |
---|
25 | NSArray *_listContacts; |
---|
26 | NSArray *_listContactsIncludingOfflineAccounts; |
---|
27 | NSArray *_visibleListContacts; |
---|
28 | |
---|
29 | BOOL containsOnlyOneUniqueContact; |
---|
30 | BOOL containsOnlyOneService; |
---|
31 | |
---|
32 | NSMutableArray *containedObjects; //Manually ordered array of contents |
---|
33 | BOOL containedObjectsNeedsSort; |
---|
34 | BOOL delayContainedObjectSorting; |
---|
35 | BOOL saveGroupingChanges; |
---|
36 | |
---|
37 | BOOL expanded; //Exanded/Collapsed state of this object |
---|
38 | BOOL isExpandable; |
---|
39 | } |
---|
40 | |
---|
41 | //The objectID is unique to a meta contact and is used as the UID for purposes of AIListContact inheritance |
---|
42 | - (id)initWithObjectID:(NSNumber *)objectID; |
---|
43 | - (NSNumber *)objectID; |
---|
44 | + (NSString *)internalObjectIDFromObjectID:(NSNumber *)inObjectID; |
---|
45 | |
---|
46 | - (AIListContact *)preferredContact; |
---|
47 | - (AIListContact *)preferredContactWithCompatibleService:(AIService *)inService; |
---|
48 | |
---|
49 | - (void)remoteGroupingOfContainedObject:(AIListObject *)inListObject changedTo:(NSString *)inRemoteGroupName; |
---|
50 | |
---|
51 | /* |
---|
52 | * @brief Does this metacontact contains multiple contacts? |
---|
53 | * |
---|
54 | * For a metacontact, this is YES if the metaContact contains more than one contact. |
---|
55 | * |
---|
56 | * Note that a metacontact may contain multiple AIListContacts (as returned by its containedObjects), but |
---|
57 | * if this returns NO, all those AIListContacts represent the same UID/Service combination (but on different accounts). |
---|
58 | * In that case, listContacts will return a single contact. |
---|
59 | */ |
---|
60 | - (BOOL)containsMultipleContacts; |
---|
61 | |
---|
62 | //Similarly, YES if the metaContact has only one serviceID within it. |
---|
63 | - (BOOL)containsOnlyOneService; |
---|
64 | - (unsigned)uniqueContainedObjectsCount; |
---|
65 | - (AIListObject *)uniqueObjectAtIndex:(int)inIndex; |
---|
66 | |
---|
67 | - (NSDictionary *)dictionaryOfServiceClassesAndListContacts; |
---|
68 | - (NSArray *)servicesOfContainedObjects; |
---|
69 | |
---|
70 | // (PRIVATE: For contact controller ONLY) |
---|
71 | - (BOOL)addObject:(AIListObject *)inObject; |
---|
72 | - (void)removeObject:(AIListObject *)inObject; |
---|
73 | |
---|
74 | /* |
---|
75 | * @brief A flat array of AIListContacts each with a different internalObjectID |
---|
76 | * |
---|
77 | * If multiple AIListContacts with the same UID/Service are within this metacontact (i.e. from multiple accounts), |
---|
78 | * only one will be included in this array, and that one will be the most available of them. |
---|
79 | * Only contacts (regardless of status) for accounts which are currently connected are included. |
---|
80 | */ |
---|
81 | - (NSArray *)listContacts; |
---|
82 | |
---|
83 | /* |
---|
84 | * @brief A flat array of AIListContacts each with a different internalObjectID |
---|
85 | * |
---|
86 | * If multiple AIListContacts with the same UID/Service are within this metacontact (i.e. from multiple accounts), |
---|
87 | * only one will be included in this array, and that one will be the most available of them. |
---|
88 | * Contacts from all accounts, including offline ones, will be included. |
---|
89 | */ |
---|
90 | - (NSArray *)listContactsIncludingOfflineAccounts; |
---|
91 | |
---|
92 | /*! |
---|
93 | * @brief An array of all objects within this metacontact |
---|
94 | * |
---|
95 | * Implemented as required by the AIContainingObject protocol. |
---|
96 | * This returns an array of all AIListContact objects within the metacontact; the same UID/service may be represented |
---|
97 | * multiple times, an AIListContact for each account on that service. |
---|
98 | */ |
---|
99 | - (NSArray *)containedObjects; |
---|
100 | |
---|
101 | - (void)visibilityOfContainedObject:(AIListObject *)inObject changedTo:(BOOL)inVisible; |
---|
102 | |
---|
103 | //Delay sorting the contained object list; this should only be used by the contactController. Be sure to set it back to YES when operations are done |
---|
104 | - (void)setDelayContainedObjectSorting:(BOOL)flag; |
---|
105 | |
---|
106 | @end |
---|