root/Trunk/Adium.framework/Versions/A/Headers/AIAccountControllerProtocol.h @ 2

Revision 2, 6.4 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1/*
2 *  AIAccountControllerProtocol.h
3 *  Adium
4 *
5 *  Created by Evan Schoenberg on 7/30/06.
6 *
7 */
8
9#import <Adium/AIControllerProtocol.h>
10
11@class AIService, AIAccount, AIListContact, AIStatus;
12
13#define Account_ListChanged                                     @"Account_ListChanged"
14#define Adium_RequestSetManualIdleTime                  @"Adium_RequestSetManualIdleTime"
15
16@protocol AIAccountControllerRemoveConfirmationDialog <NSObject>
17- (void)runModal;
18- (void)beginSheetModalForWindow:(NSWindow*)window;
19@end
20
21@interface NSObject (AIEditAccountWindowControllerTarget)
22//Optional
23- (void)editAccountWindow:(NSWindow*)window didOpenForAccount:(AIAccount *)inAccount;
24
25//Required
26- (void)editAccountSheetDidEndForAccount:(AIAccount *)inAccount withSuccess:(BOOL)successful;
27@end
28
29typedef enum {
30        AIPromptAsNeeded = 0,
31        AIPromptAlways,
32        AIPromptNever
33} AIPromptOption;
34
35@protocol AIAccountController <AIController>
36
37#pragma mark Services
38/*!
39 * @brief Register an AIService instance
40 *
41 * All services should be registered before they are used. A service provides access to an instant messaging protocol.
42 */
43- (void)registerService:(AIService *)inService;
44
45/*!
46 * @brief Returns an array of all available services
47 *
48 * @return NSArray of AIService instances
49 */
50- (NSArray *)services;
51
52/*!
53 * @brief Returns an array of all active services
54 *
55 * "Active" services are those for which the user has an enabled account.
56 * @param includeCompatible Include services which are compatible with an enabled account but not specifically active.
57 *        For example, if an AIM account is enabled, the ICQ service will be included if this is YES.
58 * @return NSArray of AIService instances
59 */
60- (NSSet *)activeServicesIncludingCompatibleServices:(BOOL)includeCompatible;
61
62/*!
63 * @brief Retrieves a service by its unique ID
64 *
65 * @param uniqueID The serviceCodeUniqueID of the desired service
66 * @return AIService if found, nil if not found
67 */
68- (AIService *)serviceWithUniqueID:(NSString *)uniqueID;
69
70/*!
71 * @brief Retrieves a service by service ID.
72 *
73 * Service IDs may be shared by multiple services if the same service is provided by two different plugins.
74 * -[AIService serviceID] returns serviceIDs. An example is @"AIM".
75 * @return The first service with the matching service ID, or nil if none is found.
76 */
77- (AIService *)firstServiceWithServiceID:(NSString *)serviceID;
78
79#pragma mark Passwords
80/*!
81 * @brief Set the password of an account
82 *
83 * @param inPassword password to store
84 * @param inAccount account the password belongs to
85 */
86- (void)setPassword:(NSString *)inPassword forAccount:(AIAccount *)inAccount;
87
88/*!
89 * @brief Forget the password of an account
90 *
91 * @param inAccount account whose password should be forgotten. Any stored keychain item will be removed.
92 */
93- (void)forgetPasswordForAccount:(AIAccount *)inAccount;
94
95/*!
96 * @brief Retrieve the stored password of an account
97 *
98 * @param inAccount account whose password is desired
99 * @return account password, or nil if the password is not available without prompting
100 */
101- (NSString *)passwordForAccount:(AIAccount *)inAccount;
102
103/*!
104 * @brief Retrieve the password of an account, prompting the user if necessary
105 *
106 * @param inAccount account whose password is desired
107 * @param promptOption An AIPromptOption determining whether and how a prompt for the password should be displayed if it is needed. This allows forcing or suppressing of the prompt dialogue.
108 * @param inTarget target to notify when password is available
109 * @param inSelector selector to notify when password is available. Selector is of the form - (void)returnedPassword:(NSString *)p returnCode:(AIPasswordPromptReturn)returnCode context:(id)context
110 * @param inContext context passed to target
111 */
112- (void)passwordForAccount:(AIAccount *)inAccount promptOption:(AIPromptOption)promptOption notifyingTarget:(id)inTarget selector:(SEL)inSelector context:(id)inContext;
113
114/*!
115 * @brief Set the password for a proxy server
116 *
117 * @param inPassword password to store. Nil to forget the password for this server/username pair.
118 * @param server proxy server name
119 * @param userName proxy server user name
120 *
121 * XXX - This is inconsistent.  Above we have a separate forget method, here we forget when nil is passed...
122 */
123- (void)setPassword:(NSString *)inPassword forProxyServer:(NSString *)server userName:(NSString *)userName;
124
125/*!
126 * @brief Retrieve the stored password for a proxy server
127 *
128 * @param server proxy server name
129 * @param userName proxy server user name
130 * @return proxy server password, or nil if the password is not available without prompting
131 */
132- (NSString *)passwordForProxyServer:(NSString *)server userName:(NSString *)userName;
133
134/*!
135 * @brief Retrieve the password for a proxy server, prompting the user if necessary
136 *
137 * @param server proxy server name
138 * @param userName proxy server user name
139 * @param inTarget target to notify when password is available
140 * @param inSelector selector to notify when password is available. Selector is of the form - (void)returnedPassword:(NSString *)p returnCode:(AIPasswordPromptReturn)returnCode context:(id)context
141 * @param inContext context passed to target
142 */
143- (void)passwordForProxyServer:(NSString *)server userName:(NSString *)userName notifyingTarget:(id)inTarget selector:(SEL)inSelector context:(id)inContext;
144
145#pragma mark Accounts
146- (NSArray *)accounts;
147- (NSArray *)accountsCompatibleWithService:(AIService *)service;
148- (NSArray *)accountsWithCurrentStatus:(AIStatus *)status;
149- (AIAccount *)accountWithInternalObjectID:(NSString *)objectID;
150- (AIAccount *)createAccountWithService:(AIService *)service UID:(NSString *)inUID;
151- (void)addAccount:(AIAccount *)inAccount;
152- (void)deleteAccount:(AIAccount *)inAccount;
153- (int)moveAccount:(AIAccount *)account toIndex:(int)destIndex;
154- (void)accountDidChangeUID:(AIAccount *)inAccount;
155
156//Preferred Accounts
157- (AIAccount *)preferredAccountForSendingContentType:(NSString *)inType toContact:(AIListContact *)inContact;
158
159//Connection convenience methods
160- (void)disconnectAllAccounts;
161- (BOOL)oneOrMoreConnectedAccounts;
162- (BOOL)oneOrMoreConnectedOrConnectingAccounts;
163
164/*!
165 * @brief Display account configuration for an account
166 *
167 * @param account The account to edit. Must not be nil.
168 * @param window The window on which to attach the configuration as a sheet. If nil, the editor is shown as a free-standing window.
169 * @param target The target to notify when editing is complete. See the AIEditAccountWindowControllerTarget informal protocol.
170 */
171- (void)editAccount:(AIAccount *)account onWindow:(NSWindow *)window notifyingTarget:(id)target;
172
173@end
Note: See TracBrowser for help on using the browser.