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/AIContentObject.h> |
---|
18 | |
---|
19 | #define CONTENT_MESSAGE_TYPE @"Message" //Type ID for this content |
---|
20 | |
---|
21 | @class AIChat; |
---|
22 | |
---|
23 | /*! @class AIContentMessage |
---|
24 | * @brief A message in a chat. Subclass of AIContentObject. |
---|
25 | * |
---|
26 | * @par A content message is a type of content object that represents a message sent by one user to another user (except in the case of an autoreply, which is sent by the user's client). |
---|
27 | * |
---|
28 | * @par The content of the message is handled as an attributed string. This allows AIContentMessages to be used with all services, regardless of the format they use for text (HTML, XHTML, Markdown, etc.). |
---|
29 | * |
---|
30 | * @par A content message can be an autoreply. This happens when the message was sent automatically (or will be) in response to the sender receiving a previous message while away. Not all services support autoreplies; on those that don't, the AIContentMessage for an incoming autoreply will not have its \c autoreply flag set. |
---|
31 | * |
---|
32 | * @par AIContentMessage is a concrete subclass of AIContentObject. All methods and properties of AIContentObject also work with AIContentMessage. |
---|
33 | */ |
---|
34 | |
---|
35 | @interface AIContentMessage : AIContentObject { |
---|
36 | BOOL isAutoreply; |
---|
37 | NSString *encodedMessage; |
---|
38 | id encodedMessageAccountData; |
---|
39 | } |
---|
40 | |
---|
41 | /*! @brief Create and autorelease an AIContentMessage. |
---|
42 | * @return An autoreleased AIContentMessage. |
---|
43 | */ |
---|
44 | + (id)messageInChat:(AIChat *)inChat |
---|
45 | withSource:(id)inSource |
---|
46 | destination:(id)inDest |
---|
47 | date:(NSDate *)inDate |
---|
48 | message:(NSAttributedString *)inMessage |
---|
49 | autoreply:(BOOL)inAutoreply; |
---|
50 | |
---|
51 | /*! @brief Create an AIContentMessage. |
---|
52 | * |
---|
53 | * @par See <code>AIContentObject</code>'s <code>initWithChat:source:destination:date:message:</code> method for more information. |
---|
54 | * |
---|
55 | * @return An AIContentMessage. |
---|
56 | */ |
---|
57 | - (id)initWithChat:(AIChat *)inChat |
---|
58 | source:(id)inSource |
---|
59 | destination:(id)inDest |
---|
60 | date:(NSDate *)inDate |
---|
61 | message:(NSAttributedString *)inMessage |
---|
62 | autoreply:(BOOL)inAutoreply; |
---|
63 | |
---|
64 | /*! @brief Change whether this message is an autoreply. |
---|
65 | * @param inAutoreply The new autoreply flag of the message. |
---|
66 | */ |
---|
67 | - (void)setIsAutoreply:(BOOL)inAutoreply; |
---|
68 | /*! @brief Returns whether this message is an autoreply. |
---|
69 | * @return The autoreply flag of the message. |
---|
70 | */ |
---|
71 | - (BOOL)isAutoreply; |
---|
72 | |
---|
73 | /*! @brief Returns the encoded string for the contents of this content message. |
---|
74 | * |
---|
75 | * @par This is the string containing the same message that the content message was initialized with (which is unchangeable), in a format suitable for use by the service (e.g., to be transmitted over the wire or having been received over the wire). |
---|
76 | * |
---|
77 | * @return A string containing the message encoded to some sort of marked-up (or plain) source code, such as HTML source code. |
---|
78 | */ |
---|
79 | - (NSString *)encodedMessage; |
---|
80 | /*! @brief Changes the encoded string for the contents of this content message. |
---|
81 | * |
---|
82 | * @par Usually, the encoded string is obtained from the account by the content controller. In addition, it may be passed through one or more secondary encoders, such as an encrypter. Traditionally, the new string is set as the content message's encoded message using this method after every step. |
---|
83 | * |
---|
84 | * @param inEncodedMessage The new encoded data. |
---|
85 | */ |
---|
86 | - (void)setEncodedMessage:(NSString *)inEncodedMessage; |
---|
87 | |
---|
88 | /*! @brief Returns the object associated with this method for an account's benefit. |
---|
89 | * |
---|
90 | * @par This property is intended for use by accounts that need to associate some private data with a message. It is not used by anything else. |
---|
91 | * |
---|
92 | * @return The object associated with this message. |
---|
93 | */ |
---|
94 | - (id)encodedMessageAccountData; |
---|
95 | /*! @brief Replaces the object associated with this method for an account's benefit. |
---|
96 | * |
---|
97 | * @par The object will be retained by the content message. |
---|
98 | * |
---|
99 | * @param inEncodedMessageAccountData The new object associated with this message. |
---|
100 | */ |
---|
101 | - (void)setEncodedMessageAccountData:(id)inEncodedMessageAccountData; |
---|
102 | |
---|
103 | @end |
---|