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

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

Initial commit of skeletal project.

Line 
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/AIListObject.h>
18
19@class AIListContact, AIChat, AIContentObject, ESFileTransfer, AIStatus, AIContentMessage, AIContentTyping;
20@class AIWiredString;
21
22#define GROUP_ACCOUNT_STATUS   @"Account Status"
23
24//All keys below are for NSString objects
25#define KEY_CONNECT_HOST                        @"Connect Host"
26#define KEY_DEFAULT_USER_ICON           @"Default User Icon"
27#define KEY_USE_USER_ICON                       @"Use User Icon"
28
29//NSNumber objects
30#define KEY_CONNECT_PORT                        @"Connect Port"
31#define KEY_ACCOUNT_CHECK_MAIL          @"Check Mail"
32#define KEY_ENABLED                                     @"Enabled"
33#define KEY_AUTOCONNECT                         @"AutoConnect"
34
35//NSData archive of an NSAttributedString
36#define KEY_ACCOUNT_DISPLAY_NAME        @"FullNameAttr"
37
38#define Adium_RequestImmediateDynamicContentUpdate                      @"Adium_RequestImmediateDynamicContentUpdate"
39#define AIAccountUsernameAndPasswordRegisteredNotification      @"AIAccountUsernameAndPasswordRegisteredNotification"
40
41//Proxy
42#define KEY_ACCOUNT_PROXY_ENABLED               @"Proxy Enabled"
43#define KEY_ACCOUNT_PROXY_TYPE                  @"Proxy Type"
44#define KEY_ACCOUNT_PROXY_HOST                  @"Proxy Host"
45#define KEY_ACCOUNT_PROXY_PORT                  @"Proxy Port"
46#define KEY_ACCOUNT_PROXY_USERNAME              @"Proxy Username"
47#define KEY_ACCOUNT_PROXY_PASSWORD              @"Proxy Password"
48
49//Proxy types
50typedef enum
51{
52        Adium_Proxy_HTTP = 0,
53        Adium_Proxy_SOCKS4,
54        Adium_Proxy_SOCKS5,
55        Adium_Proxy_Default_HTTP,
56        Adium_Proxy_Default_SOCKS4,
57        Adium_Proxy_Default_SOCKS5,
58        Adium_Proxy_None
59} AdiumProxyType;
60
61//Privacy
62typedef enum {
63    AIPrivacyTypePermit = 0,
64    AIPrivacyTypeDeny
65}  AIPrivacyType;
66
67typedef enum {
68    AIPrivacyOptionAllowAll = 1,                //Anyone can conctact you
69        AIPrivacyOptionDenyAll,                         //Nobody can contact you
70        AIPrivacyOptionAllowUsers,                      //Only those on your allow list can contact you
71        AIPrivacyOptionDenyUsers,                       //Those on your deny list can't contact you
72        AIPrivacyOptionAllowContactList,        //Only those on your contact list can contact you
73        AIPrivacyOptionUnknown,                 //used by the privacy settings window, but could probably also be used by accounts
74        AIPrivacyOptionCustom                           //used by the privacy settings window
75} AIPrivacyOption;
76
77typedef enum {
78        AIAuthorizationNoResponse = 0,
79        AIAuthorizationDenied,
80        AIAuthorizationAllowed
81} AIAuthorizationResponse;
82
83//Support for file transfer
84@protocol AIAccount_Files
85        //can the account send entire folders on its own?
86        - (BOOL)canSendFolders;
87
88    //Instructs the account to accept a file transfer request
89    - (void)acceptFileTransferRequest:(ESFileTransfer *)fileTransfer;
90
91    //Instructs the account to reject a file receive request
92    - (void)rejectFileReceiveRequest:(ESFileTransfer *)fileTransfer;
93
94    //Instructs the account to initiate sending of a file
95        - (void)beginSendOfFileTransfer:(ESFileTransfer *)fileTransfer;
96
97        //Instructs the account to cancel a filet ransfer in progress
98        - (void)cancelFileTransfer:(ESFileTransfer *)fileTransfer;
99@end
100
101/*!
102 * @protocol AIAccount_Privacy
103 * @brief Support for privacy settings
104 *
105 * An AIAccount subclass may implement this protocol to support privacy settings
106 */
107@protocol AIAccount_Privacy
108    /*!
109         * @brief Add a list object to a privacy list
110         *
111         * @param inObject The object
112         * @param type Either AIPrivacyTypePermit or AIPrivacyTypeDeny
113         *
114         * @result Boolean success
115         */
116    -(BOOL)addListObject:(AIListObject *)inObject toPrivacyList:(AIPrivacyType)type;
117
118        /*!
119         * @brief Remove a list object from a privacy list
120         *
121         * @param inObject The object
122         * @param type Either AIPrivacyTypePermit or AIPrivacyTypeDeny
123         *
124         * @result Boolean success
125         */
126        -(BOOL)removeListObject:(AIListObject *)inObject fromPrivacyList:(AIPrivacyType)type;
127
128        /*!
129         * @brief Get the contacts on the specified privacy list
130         *
131         * @result An NSArray of AIListContacts, or an empty array if no contacts are on the requested list
132         */
133        -(NSArray *)listObjectsOnPrivacyList:(AIPrivacyType)type;
134   
135        /*!
136         * @brief Set the privacy options
137         *
138         * @param option An AIPrivacyOption value
139         */
140    -(void)setPrivacyOptions:(AIPrivacyOption)option;
141
142        /*!
143         * @brief Get the privacy options
144         *
145         * @result An AIPrivacyOption value
146         */
147        -(AIPrivacyOption)privacyOptions;
148@end
149
150@class AdiumAccounts;
151@protocol AIAccountControllerRemoveConfirmationDialog;
152
153/*!
154 * @class AIAccount
155 * @brief An account of ours (one we connect to and use to talk to handles)
156 *
157 * AIAccount is effectively an abstract superclass, as it can do nothing useful on its own.
158 * Subclasses of AIAccount, however, inherit much power. With great power comes great responsibility.
159 */
160@interface AIAccount : AIListObject {
161    AIWiredString              *password;
162    BOOL                        silentAndDelayed;                               //We are waiting for and processing our sign on updates
163    BOOL                                                disconnectedByFastUserSwitch;   //We are offline because of a fast user switch
164        BOOL                                            namesAreCaseSensitive;
165        BOOL                                            isTemporary;
166
167        BOOL                                            enabled;
168       
169        int                                                     reconnectAttemptsPerformed;
170        NSString                                        *lastDisconnectionError;
171
172        //Attributed string refreshing
173    NSTimer                     *attributedRefreshTimer;
174    NSMutableSet                                *autoRefreshingKeys;
175        NSMutableSet                            *dynamicKeys;
176       
177        //Contact update guarding
178        NSTimer                                         *delayedUpdateStatusTimer;
179        NSMutableArray                          *delayedUpdateStatusTargets;
180        NSTimer                                         *silenceAllContactUpdatesTimer;
181}
182
183- (void)initAccount;
184- (void)connect;
185- (void)disconnect;
186- (void)disconnectFromDroppedNetworkConnection;
187- (void)performRegisterWithPassword:(NSString *)inPassword;
188- (NSString *)accountWillSetUID:(NSString *)proposedUID;
189- (void)didChangeUID;
190- (void)willBeDeleted;
191- (id<AIAccountControllerRemoveConfirmationDialog>)confirmationDialogForAccountDeletion;
192- (NSAlert*)alertForAccountDeletion;
193- (void)alertForAccountDeletion:(id<AIAccountControllerRemoveConfirmationDialog>)dialog didReturn:(int)returnCode;
194- (NSString *)explicitFormattedUID;
195- (NSString *)formattedUIDForListDisplay;
196
197//Properties
198- (BOOL)supportsAutoReplies;
199- (BOOL)disconnectOnFastUserSwitch;
200- (BOOL)connectivityBasedOnNetworkReachability;
201- (BOOL)suppressTypingNotificationChangesAfterSend;
202- (BOOL)canSendOfflineMessageToContact:(AIListContact *)inContact;
203- (BOOL)maySendMessageToInvisibleContact:(AIListContact *)inContact;
204- (BOOL)sendOfflineMessagesWithoutPrompting;
205- (BOOL)accountDisplaysFileTransferMessages;
206- (BOOL)managesOwnContactIconCache;
207
208//Status
209- (NSSet *)supportedPropertyKeys;
210- (id)statusForKey:(NSString *)key;
211- (void)updateStatusForKey:(NSString *)key;
212- (void)delayedUpdateContactStatus:(AIListContact *)inContact;
213- (float)delayedUpdateStatusInterval;
214- (void)setStatusState:(AIStatus *)statusState usingStatusMessage:(NSAttributedString *)statusMessage;
215- (void)setSocialNetworkingStatusMessage:(NSAttributedString *)statusMessage;
216- (BOOL)shouldUpdateAutorefreshingAttributedStringForKey:(NSString *)inKey;
217
218//Messaging, Chatting, Strings
219- (BOOL)availableForSendingContentType:(NSString *)inType toContact:(AIListContact *)inContact;
220- (BOOL)openChat:(AIChat *)chat;
221- (BOOL)closeChat:(AIChat *)chat;
222- (BOOL)inviteContact:(AIListObject *)contact toChat:(AIChat *)chat withMessage:(NSString *)inviteMessage;
223- (void)sendTypingObject:(AIContentTyping *)inTypingObject;
224- (BOOL)sendMessageObject:(AIContentMessage *)inMessageObject;
225- (NSString *)encodedAttributedString:(NSAttributedString *)inAttributedString forListObject:(AIListObject *)inListObject;
226- (NSString *)encodedAttributedStringForSendingContentMessage:(AIContentMessage *)inContentMessage;
227-(BOOL)rejoinChat:(AIChat*)chat;
228
229//Presence Tracking
230- (BOOL)contactListEditable;
231- (void)addContacts:(NSArray *)objects toGroup:(AIListGroup *)group;
232- (void)removeContacts:(NSArray *)objects;
233- (void)deleteGroup:(AIListGroup *)group;
234- (void)moveListObjects:(NSArray *)objects toGroup:(AIListGroup *)group;
235- (void)renameGroup:(AIListGroup *)group to:(NSString *)newName;
236- (BOOL)isContactIntentionallyListed:(AIListContact *)contact;
237
238- (NSData *)serversideIconDataForContact:(AIListContact *)contact;
239
240//Contact-specific menu items
241- (NSArray *)menuItemsForContact:(AIListContact *)inContact;
242
243//Account-specific menu items
244- (NSArray *)accountActionMenuItems;
245- (void)accountMenuDidUpdate:(NSMenuItem*)menuItem;
246
247//Secure messaging
248- (BOOL)allowSecureMessagingTogglingForChat:(AIChat *)inChat;
249- (NSString *)aboutEncryption;
250- (void)requestSecureMessaging:(BOOL)inSecureMessaging
251                                                inChat:(AIChat *)inChat;
252- (void)promptToVerifyEncryptionIdentityInChat:(AIChat *)inChat;
253
254/*!
255 * @brief Can the account send images inline within a chat?
256 */
257- (BOOL)canSendImagesForChat:(AIChat *)inChat;
258
259/*!
260 * @brief An authorization prompt closed, granting or denying a contact's request for authorization
261 *
262 * @param inWindowController The window controller which closed; an account may have kept track of what windows were showing its authorization prompts
263 * @param infoDict A dictionary of authorization information created by the account originally and possibly modified
264 * @param authorizationResponse An AIAuthorizationResponse indicating if authorization was granted or denied or if there was no response
265 */
266- (void)authorizationWindowController:(NSWindowController *)inWindowController authorizationWithDict:(NSDictionary *)infoDict response:(AIAuthorizationResponse)authorizationResponse;
267
268-(NSMenu*)actionsForChat:(AIChat*)chat;
269
270//chat actions
271-(void)verifyCommand:(NSString*)commandName forChat:(AIChat*)chat;
272
273@end
274
275@interface AIAccount (Private_ForSubclasses)
276- (void)gotFilteredDisplayName:(NSAttributedString *)attributedDisplayName;
277- (void)performDelete;
278@end
279
280#import <Adium/AIAbstractAccount.h>
Note: See TracBrowser for help on using the browser.