2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
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.
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.
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.
17 @protocol AIListObjectObserver
, AIContainingObject
;
19 @
class AIAccount
, AIListObject
, AIListContact
, AIListGroup
, AIMetaContact
, AIMessageObject
, AIService
, AIContactInfoPane
,
22 #define ListObject_AttributesChanged @"ListObject_AttributesChanged"
23 #define ListObject_StatusChanged @"ListObject_StatusChanged"
24 #define Contact_OrderChanged @"Contact_OrderChanged"
25 #define Contact_ListChanged @"Contact_ListChanged"
26 #define Contact_SortSelectorListChanged @"Contact_SortSelectorListChanged"
28 #define Contact_ApplyDisplayName @"Contact_ApplyDisplayName"
29 #define Contact_AddNewContact @"Contact_AddNewContact"
31 //Whenever possible, accounts should keep their contact's status up to date. However, sometimes this ideal situation
32 //cannot be achieved, and the account needs to be told when 'more expensive' status keys are required so it can fetch
33 //them. This notification instructs the accounts to do just that. It is currently used for profiles, but may be
34 //used for more information in the future.
35 #define Contact_UpdateStatus @"Contact_UpdateStatus"
37 //A unique group name for our root group
38 #define ADIUM_ROOT_GROUP_NAME @"ROOTJKSHFOEIZNGIOEOP"
40 //Preference groups and keys used for contacts throughout Adium
41 #define PREF_GROUP_ALIASES @"Aliases" //Preference group in which to store aliases
42 #define PREF_GROUP_USERICONS @"User Icons"
43 #define KEY_USER_ICON @"User Icon"
44 #define PREF_GROUP_NOTES @"Notes" //Preference group to store notes in
45 #define PREF_GROUP_ADDRESSBOOK @"Address Book"
52 } CONTACT_INFO_CATEGORY
;
56 AISortGroupAndSubGroups
,
57 AISortGroupAndSuperGroups
60 //Observer which receives notifications of changes in list object status
61 @protocol AIListObjectObserver
62 - (NSSet
*)updateListObject
:(AIListObject
*)inObject keys
:(NSSet
*)inModifiedKeys silent
:(BOOL
)silent
;
65 @protocol AIListObjectView
66 - (void)drawInRect
:(NSRect
)inRect
;
67 - (float)widthForHeight
:(int)inHeight
;
70 //Empty protocol to allow easy checking for if a particular object is a contact list outline view
71 @protocol ContactListOutlineView
74 @interface AIContactController
: NSObject
{
75 IBOutlet AIAdium
*adium
;
77 //Contacts and metaContacts
78 NSMutableDictionary
*contactDict
;
79 NSMutableDictionary
*metaContactDict
;
80 NSMutableDictionary
*contactToMetaContactLookupDict
;
82 //Contact List and Groups
83 AIListGroup
*contactList
;
84 NSMutableDictionary
*groupDict
;
85 AIListGroup
*strangerGroup
;
86 BOOL useContactListGroups
;
87 NSMenuItem
*showGroupsMenuItem
;
89 //Status and Attribute updates
90 NSMutableSet
*contactObservers
;
91 NSTimer
*delayedUpdateTimer
;
92 int delayedStatusChanges
;
93 NSMutableSet
*delayedModifiedStatusKeys
;
94 int delayedAttributeChanges
;
95 NSMutableSet
*delayedModifiedAttributeKeys
;
96 int delayedContactChanges
;
97 int delayedUpdateRequests
;
98 BOOL updatesAreDelayed
;
101 NSMutableArray
*sortControllerArray
;
102 AISortController
*activeSortController
;
103 float nextOrderIndex
;
105 //Contact Info Menu Items
106 IBOutlet NSMenuItem
*menuItem_getInfo
;
107 IBOutlet NSMenuItem
*menuItem_getInfoAlternate
;
108 NSMenuItem
*menuItem_getInfoContextualContact
;
109 NSMenuItem
*menuItem_getInfoContextualGroup
;
112 NSMutableArray
*contactInfoPanes
;
115 //Contact list access
116 - (AIListGroup
*)contactList
;
117 - (AIListContact
*)contactWithService
:(AIService
*)inService account
:(AIAccount
*)inAccount UID
:(NSString
*)inUID
;
118 - (AIListContact
*)contactOnAccount
:(AIAccount
*)account fromListContact
:(AIListContact
*)inContact
;
119 - (AIListObject
*)existingListObjectWithUniqueID
:(NSString
*)uniqueID
;
120 - (AIListContact
*)existingContactWithService
:(AIService
*)inService account
:(AIAccount
*)inAccount UID
:(NSString
*)inUID
;
121 - (AIListGroup
*)groupWithUID
:(NSString
*)groupUID
;
122 - (AIListGroup
*)existingGroupWithUID
:(NSString
*)groupUID
;
123 - (NSMutableArray
*)allContactsInGroup
:(AIListGroup
*)inGroup subgroups
:(BOOL
)subGroups onAccount
:(AIAccount
*)inAccount
;
124 - (NSMenu
*)menuOfAllContactsInContainingObject
:(AIListObject
<AIContainingObject
> *)inGroup withTarget
:(id
)target
;
125 - (NSMenu
*)menuOfAllGroupsInGroup
:(AIListGroup
*)inGroup withTarget
:(id
)target
;
126 - (NSArray
*)allContactsWithService
:(AIService
*)service UID
:(NSString
*)inUID
;
128 - (AIMetaContact
*)groupUIDs
:(NSArray
*)UIDsArray forServices
:(NSArray
*)servicesArray
;
129 - (AIMetaContact
*)groupListContacts
:(NSArray
*)contactsToGroupArray
;
130 - (void)removeAllListObjectsMatching
:(AIListObject
*)listObject fromMetaContact
:(AIMetaContact
*)metaContact
;
131 - (AIListGroup
*)remoteGroupForContact
:(AIListContact
*)inContact
;
132 - (void)clearAllMetaContactData
;
133 //Return either the highest metaContact containing this list object, or the list object itself. Appropriate for when
134 //preferences should be read from/to the most generalized contact possible.
135 - (AIListObject
*)parentContactForListObject
:(AIListObject
*)listObject
;
139 - (NSMenu
*)menuOfContainedContacts
:(AIListObject
*)inContact forService
:(AIService
*)service withTarget
:(id
)target includeOffline
:(BOOL
)includeOffline
;
140 - (NSMenu
*)menuOfContainedContacts
:(AIListObject
*)inContact withTarget
:(id
)target
;
142 //Contact status & Attributes
143 - (void)registerListObjectObserver
:(id
<AIListObjectObserver
>)inObserver
;
144 - (void)unregisterListObjectObserver
:(id
)inObserver
;
145 - (void)updateAllListObjectsForObserver
:(id
<AIListObjectObserver
>)inObserver
;
148 - (void)delayListObjectNotifications
;
149 - (void)endListObjectNotificationsDelay
;
150 - (void)delayListObjectNotificationsUntilInactivity
;
151 - (void)listObjectRemoteGroupingChanged
:(AIListContact
*)inObject
;
152 - (void)listObjectStatusChanged
:(AIListObject
*)inObject modifiedStatusKeys
:(NSSet
*)inModifiedKeys silent
:(BOOL
)silent
;
153 - (void)listObjectAttributesChanged
:(AIListObject
*)inObject modifiedKeys
:(NSSet
*)inModifiedKeys
;
155 //Contact list sorting
156 - (NSArray
*)sortControllerArray
;
157 - (void)registerListSortController
:(AISortController
*)inController
;
158 - (void)setActiveSortController
:(AISortController
*)inController
;
159 - (AISortController
*)activeSortController
;
160 - (void)sortContactList
;
161 - (void)sortListObject
:(AIListObject
*)inObject
;
164 - (AIListContact
*)preferredContactForContentType
:(NSString
*)inType forListContact
:(AIListContact
*)inContact
;
165 - (AIListContact
*)preferredContactWithUID
:(NSString
*)UID andServiceID
:(NSString
*)serviceID forSendingContentType
:(NSString
*)inType
;
168 - (void)addContacts
:(NSArray
*)contactArray toGroup
:(AIListGroup
*)group
;
169 - (void)removeListObjects
:(NSArray
*)objectArray
;
170 - (void)requestAddContactWithUID
:(NSString
*)contactUID service
:(AIService
*)inService
;
171 - (void)moveListObjects
:(NSArray
*)objectArray toGroup
:(AIListObject
<AIContainingObject
> *)group index
:(int)index
;
172 - (void)moveContact
:(AIListContact
*)listContact toGroup
:(AIListObject
<AIContainingObject
> *)group
;
173 - (void)_moveContactLocally
:(AIListContact
*)listContact toGroup
:(AIListGroup
*)group
;
174 - (BOOL
)useContactListGroups
;
177 - (IBAction
)showContactInfo
:(id
)sender
;
178 - (void)addContactInfoPane
:(AIContactInfoPane
*)inPane
;
179 - (void)updateListContactStatus
:(AIListContact
*)inContact
;
180 - (NSArray
*)contactInfoPanes
;
182 //Interface selection
183 - (AIListObject
*)selectedListObject
;
184 - (AIListObject
*)selectedListObjectInContactList
;
185 - (NSArray
*)arrayOfSelectedListObjectsInContactList
;
188 - (void)initController
;
189 - (void)finishIniting
;
190 - (void)closeController
;
192 - (float)nextOrderIndex
;