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/ESObjectWithProperties.h> |
---|
18 | #import <Adium/AIContentTyping.h> |
---|
19 | #import <Adium/AIListObject.h> |
---|
20 | #import <Adium/AIInterfaceControllerProtocol.h> |
---|
21 | |
---|
22 | @class AIAccount, AIListObject, AIListContact, AIContentObject, AIEmoticon; |
---|
23 | |
---|
24 | #define Chat_OrderDidChange @"Chat_OrderDidChange" |
---|
25 | #define Chat_WillClose @"Chat_WillClose" |
---|
26 | #define Chat_DidOpen @"Chat_DidOpen" |
---|
27 | #define Chat_BecameActive @"Chat_BecameActive" |
---|
28 | #define Chat_AttributesChanged @"Chat_AttributesChanged" |
---|
29 | #define Chat_StatusChanged @"Chat_StatusChagned" |
---|
30 | #define Chat_ParticipatingListObjectsChanged @"Chat_ParticipatingListObjectsChanged" |
---|
31 | #define Chat_SourceChanged @"Chat_SourceChanged" |
---|
32 | #define Chat_DestinationChanged @"Chat_DestinationChanged" |
---|
33 | |
---|
34 | #define KEY_UNVIEWED_CONTENT @"UnviewedContent" |
---|
35 | #define KEY_TYPING @"Typing" |
---|
36 | |
---|
37 | #define KEY_CHAT_TIMED_OUT @"Timed Out" |
---|
38 | #define KEY_CHAT_CLOSED_WINDOW @"Closed Window" |
---|
39 | |
---|
40 | typedef enum { |
---|
41 | AIChatTimedOut = 0, |
---|
42 | AIChatClosedWindow |
---|
43 | } AIChatUpdateType; |
---|
44 | |
---|
45 | typedef enum { |
---|
46 | AIChatCanNotSendMessage = 0, |
---|
47 | AIChatMayNotBeAbleToSendMessage, |
---|
48 | AIChatCanSendMessageNow, |
---|
49 | AIChatCanSendViaServersideOfflineMessage |
---|
50 | } AIChatSendingAbilityType; |
---|
51 | |
---|
52 | #define KEY_ENCRYPTED_CHAT_PREFERENCE @"Encrypted Chat Preference" |
---|
53 | #define GROUP_ENCRYPTION @"Encryption" |
---|
54 | |
---|
55 | typedef enum { |
---|
56 | EncryptedChat_Default = -2, /* For use by a menu which wants to provide a 'no preference' option */ |
---|
57 | EncryptedChat_Never = -1, |
---|
58 | EncryptedChat_Manually = 0, /* Manually is the default */ |
---|
59 | EncryptedChat_Automatically = 1, |
---|
60 | EncryptedChat_RejectUnencryptedMessages = 2 |
---|
61 | } AIEncryptedChatPreference; |
---|
62 | |
---|
63 | typedef enum { |
---|
64 | EncryptionStatus_None = 0, |
---|
65 | EncryptionStatus_Unverified, |
---|
66 | EncryptionStatus_Verified, |
---|
67 | EncryptionStatus_Finished |
---|
68 | } AIEncryptionStatus; |
---|
69 | |
---|
70 | //Chat errors should be indicated by setting a property on this key |
---|
71 | //with an NSNumber of the appropriate error type as its object |
---|
72 | #define KEY_CHAT_ERROR @"Chat Error" |
---|
73 | |
---|
74 | //This key may be set before sending KEY_CHAT_ERROR to provide any data the |
---|
75 | //the error message should make use of. It may be of any type. |
---|
76 | #define KEY_CHAT_ERROR_DETAILS @"Chat Error Details" |
---|
77 | |
---|
78 | typedef enum { |
---|
79 | AIChatUnknownError = 0, |
---|
80 | AIChatMessageSendingUserIsBlocked, |
---|
81 | AIChatMessageSendingNotAllowedWhileInvisible, |
---|
82 | AIChatMessageSendingUserNotAvailable, |
---|
83 | AIChatMessageSendingTooLarge, |
---|
84 | AIChatMessageSendingTimeOutOccurred, |
---|
85 | AIChatMessageSendingConnectionError, |
---|
86 | AIChatMessageSendingMissedRateLimitExceeded, |
---|
87 | AIChatMessageReceivingMissedTooLarge, |
---|
88 | AIChatMessageReceivingMissedInvalid, |
---|
89 | AIChatMessageReceivingMissedRateLimitExceeded, |
---|
90 | AIChatMessageReceivingMissedRemoteIsTooEvil, |
---|
91 | AIChatMessageReceivingMissedLocalIsTooEvil, |
---|
92 | AIChatCommandFailed, |
---|
93 | AIChatInvalidNumberOfArguments |
---|
94 | } AIChatErrorType; |
---|
95 | |
---|
96 | @interface AIChat : ESObjectWithProperties <AIContainingObject> { |
---|
97 | AIAccount *account; |
---|
98 | NSDate *dateOpened; |
---|
99 | BOOL isOpen; |
---|
100 | BOOL isGroupChat; |
---|
101 | BOOL hasSentOrReceivedContent; |
---|
102 | |
---|
103 | NSMutableArray *pendingOutgoingContentObjects; |
---|
104 | |
---|
105 | NSMutableArray *participatingListObjects; |
---|
106 | AIListContact *preferredListObject; |
---|
107 | NSString *name; |
---|
108 | NSString *uniqueChatID; |
---|
109 | id identifier; |
---|
110 | |
---|
111 | NSMutableSet *ignoredListContacts; |
---|
112 | |
---|
113 | BOOL expanded; //Exanded/Collapsed state of this object |
---|
114 | |
---|
115 | BOOL enableTypingNotifications; |
---|
116 | |
---|
117 | NSMutableSet *customEmoticons; |
---|
118 | |
---|
119 | |
---|
120 | } |
---|
121 | |
---|
122 | + (id)chatForAccount:(AIAccount *)inAccount; |
---|
123 | |
---|
124 | - (AIAccount *)account; |
---|
125 | - (void)setAccount:(AIAccount *)inAccount; |
---|
126 | - (void)accountDidJoinChat; |
---|
127 | |
---|
128 | - (NSDate *)dateOpened; |
---|
129 | - (NSDictionary *)chatCreationDictionary; |
---|
130 | - (void)setChatCreationDictionary:(NSDictionary *)inDict; |
---|
131 | |
---|
132 | - (BOOL)isOpen; |
---|
133 | - (void)setIsOpen:(BOOL)flag; |
---|
134 | |
---|
135 | - (BOOL)hasSentOrReceivedContent; |
---|
136 | - (void)setHasSentOrReceivedContent:(BOOL)flag; |
---|
137 | |
---|
138 | - (int)unviewedContentCount; |
---|
139 | - (void)incrementUnviewedContentCount; |
---|
140 | - (void)clearUnviewedContentCount; |
---|
141 | |
---|
142 | - (void)setDisplayName:(NSString *)inDisplayName; |
---|
143 | |
---|
144 | - (void)addParticipatingListObject:(AIListContact *)inObject notify:(BOOL)notify; |
---|
145 | - (void)removeAllParticipatingContactsSilently; |
---|
146 | - (AIListContact *)listObject; |
---|
147 | - (void)setListObject:(AIListContact *)inObject; |
---|
148 | - (AIListContact *)preferredListObject; |
---|
149 | - (void)setPreferredListObject:(AIListContact *)inObject; |
---|
150 | - (BOOL)inviteListContact:(AIListContact *)inObject withMessage:(NSString *)inviteMessage; |
---|
151 | |
---|
152 | - (BOOL)shouldBeginSendingContentObject:(AIContentObject *)inObject; |
---|
153 | - (void)finishedSendingContentObject:(AIContentObject *)inObject; |
---|
154 | |
---|
155 | - (NSString *)name; |
---|
156 | - (void)setName:(NSString *)inName; |
---|
157 | |
---|
158 | - (id)identifier; |
---|
159 | - (void)setIdentifier:(id)inIdentifier; |
---|
160 | |
---|
161 | - (NSString *)uniqueChatID; |
---|
162 | |
---|
163 | - (NSImage *)chatImage; |
---|
164 | - (NSImage *)chatMenuImage; |
---|
165 | |
---|
166 | - (void)setSecurityDetails:(NSDictionary *)securityDetails; |
---|
167 | - (NSDictionary *)securityDetails; |
---|
168 | - (BOOL)isSecure; |
---|
169 | - (AIEncryptionStatus)encryptionStatus; |
---|
170 | - (BOOL)supportsSecureMessagingToggling; |
---|
171 | |
---|
172 | - (AIChatSendingAbilityType)messageSendingAbility; |
---|
173 | - (BOOL)canSendImages; |
---|
174 | |
---|
175 | - (BOOL)isListContactIgnored:(AIListObject *)inContact; |
---|
176 | - (void)setListContact:(AIListContact *)inContact isIgnored:(BOOL)isIgnored; |
---|
177 | |
---|
178 | - (BOOL)isGroupChat; |
---|
179 | - (void)setIsGroupChat:(BOOL)flag; |
---|
180 | |
---|
181 | - (void)addCustomEmoticon:(AIEmoticon *)inEmoticon; |
---|
182 | - (NSSet *)customEmoticons; |
---|
183 | |
---|
184 | - (void)receivedError:(NSNumber *)type; |
---|
185 | |
---|
186 | - (id <AIChatContainer>)chatContainer; |
---|
187 | |
---|
188 | - (NSMenu *)actionMenu; |
---|
189 | |
---|
190 | @end |
---|