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.
23 #define Account_ListChanged @"Account_ListChanged"
24 #define Adium_RequestSetManualIdleTime @"Adium_RequestSetManualIdleTime"
26 #define ACCOUNTS_TITLE AILocalizedString(@"Accounts",nil)
28 //Connecting is faded by 40%
29 #define CONNECTING_MENU_IMAGE_FRACTION 0.60
31 //Offline is faded by 70%
32 #define OFFLINE_MENU_IMAGE_FRACTION 0.30
35 #define KEY_ACCOUNT_PROXY_ENABLED @"Proxy Enabled"
36 #define KEY_ACCOUNT_PROXY_TYPE @"Proxy Type"
37 #define KEY_ACCOUNT_PROXY_HOST @"Proxy Host"
38 #define KEY_ACCOUNT_PROXY_PORT @"Proxy Port"
39 #define KEY_ACCOUNT_PROXY_USERNAME @"Proxy Username"
40 #define KEY_ACCOUNT_PROXY_PASSWORD @"Proxy Password"
48 Adium_Proxy_Default_HTTP
,
49 Adium_Proxy_Default_SOCKS4
,
50 Adium_Proxy_Default_SOCKS5
53 @protocol AIListObjectObserver
, AIServiceController
, StateMenuPlugin
;
55 @
class AIAdium
, AIAccount
, AIListObject
, AIAccountViewController
, AIService
, AIListContact
;
57 @protocol AccountMenuPlugin
<NSObject
>
58 - (void)addAccountMenuItems
:(NSArray
*)menuItemArray
;
59 - (void)removeAccountMenuItems
:(NSArray
*)menuItemArray
;
60 - (BOOL
)showStatusSubmenu
;
63 @interface AIAccountController
: NSObject
<AIListObjectObserver
, StateMenuPlugin
>{
64 IBOutlet AIAdium
*adium
;
66 NSMutableArray
*accountArray
; //Array of active accounts
67 NSMutableDictionary
*availableServiceDict
; //Dictionary of available services
68 NSMutableDictionary
*availableServiceTypeDict
; //Dictionary of one of each available service types by serviceID
69 NSMutableDictionary
*lastAccountIDToSendContent
;//Last account to send content
70 NSMutableDictionary
*accountStatusDict
; //Account status
72 NSMutableArray
*unloadableAccounts
;
74 NSMutableDictionary
*accountMenuPluginsDict
;
75 NSMutableDictionary
*accountMenuItemArraysDict
;
77 NSArray
*_cachedActiveServices
;
81 - (NSArray
*)availableServices
;
82 - (AIService
*)serviceWithUniqueID
:(NSString
*)identifier
;
83 - (AIService
*)firstServiceWithServiceID
:(NSString
*)serviceID
;
84 - (NSArray
*)servicesWithServiceClass
:(NSString
*)serviceClass
;
85 - (BOOL
)serviceWithUniqueIDIsOnline
:(NSString
*)identifier
;
86 - (void)registerService
:(AIService
*)inService
;
87 - (NSMenu
*)menuOfServicesWithTarget
:(id
)target
88 activeServicesOnly
:(BOOL
)activeServicesOnly
89 longDescription
:(BOOL
)longDescription
90 format
:(NSString
*)format
;
93 - (NSArray
*)accountArray
;
95 - (NSArray
*)activeServicesIncludingCompatibleServices
:(BOOL
)includeCompatible
;
96 - (AIAccount
*)accountWithInternalObjectID
:(NSString
*)objectID
;
97 - (NSArray
*)accountsWithService
:(AIService
*)service
;
98 - (NSArray
*)accountsWithServiceClass
:(NSString
*)serviceClass
;
99 - (AIAccount
*)firstAccountWithService
:(AIService
*)service
;
100 - (AIAccount
*)defaultAccount
;
101 - (AIAccount
*)createAccountWithService
:(AIService
*)service UID
:(NSString
*)inUID internalObjectID
:(NSString
*)internalObjectID
;
102 - (NSArray
*)accountsWithServiceClassOfService
:(AIService
*)service
;
103 - (NSMenu
*)menuOfAccountsForSendingContentType
:(NSString
*)inType
104 toListObject
:(AIListObject
*)inObject
105 withTarget
:(id
)target
106 includeOffline
:(BOOL
)includeOffline
;
107 - (BOOL
)anOnlineAccountCanCreateGroupChats
;
110 - (AIAccount
*)newAccountAtIndex
:(int)index
;
111 - (AIAccount
*)newAccountAtIndex
:(int)index forService
:(AIService
*)service
;
112 - (void)insertAccount
:(AIAccount
*)inAccount atIndex
:(int)index save
:(BOOL
)shouldSave
;
113 - (void)deleteAccount
:(AIAccount
*)inAccount save
:(BOOL
)shouldSave
;
114 - (int)moveAccount
:(AIAccount
*)account toIndex
:(int)destIndex
;
117 - (void)registerAccountMenuPlugin
:(id
<AccountMenuPlugin
>)accountMenuPlugin
;
118 - (void)unregisterAccountMenuPlugin
:(id
<AccountMenuPlugin
>)accountMenuPlugin
;
120 //Preferred Source Accounts
121 - (AIAccount
*)preferredAccountForSendingContentType
:(NSString
*)inType toContact
:(AIListContact
*)inContact
;
122 - (AIAccount
*)preferredAccountForSendingContentType
:(NSString
*)inType toContact
:(AIListContact
*)inContact includeOffline
:(BOOL
)includeOffline
;
123 - (AIAccount
*)firstAccountAvailableForSendingContentType
:(NSString
*)inType toContact
:(AIListContact
*)inContact includeOffline
:(BOOL
)includeOffline
;
124 - (NSMenu
*)menuOfAccountsWithTarget
:(id
)target includeOffline
:(BOOL
)includeOffline
;
125 - (NSMenu
*)menuOfAccountsWithTarget
:(id
)target includeOffline
:(BOOL
)includeOffline onlyIfCreatingGroupChatIsSupported
:(BOOL
)groupChatCreator
;
126 - (NSArray
*)menuItemsForAccountsWithTarget
:(id
)target includeOffline
:(BOOL
)includeOffline
;
127 - (NSMenu
*)menuOfAccountsForSendingContentType
:(NSString
*)inType toListObject
:(AIListObject
*)inObject withTarget
:(id
)target includeOffline
:(BOOL
)includeOffline
;
129 //Connection convenience methods
130 - (void)connectAllAccounts
;
131 - (void)disconnectAllAccounts
;
132 - (BOOL
)oneOrMoreConnectedAccounts
;
133 - (BOOL
)oneOrMoreConnectedOrConnectingAccounts
;
136 - (void)setPassword
:(NSString
*)inPassword forAccount
:(AIAccount
*)inAccount
;
137 - (NSString
*)passwordForAccount
:(AIAccount
*)inAccount
;
138 - (void)passwordForAccount
:(AIAccount
*)inAccount notifyingTarget
:(id
)inTarget selector
:(SEL
)inSelector context
:(id
)inContext
;
139 - (void)forgetPasswordForAccount
:(AIAccount
*)inAccount
;
141 - (void)setPassword
:(NSString
*)inPassword forProxyServer
:(NSString
*)server userName
:(NSString
*)userName
;
142 - (NSString
*)passwordForProxyServer
:(NSString
*)server userName
:(NSString
*)userName
;
143 - (void)passwordForProxyServer
:(NSString
*)server userName
:(NSString
*)userName notifyingTarget
:(id
)inTarget selector
:(SEL
)inSelector context
:(id
)inContext
;
146 - (void)initController
;
147 - (void)closeController
;
148 - (void)finishIniting
;