1 #ifndef __msn_message_h__
2 #define __msn_message_h__
8 * Created by Mark Rowe on Wed Mar 17 2004.
9 * Copyright (c) 2004 Mark Rowe. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <msn/sstream_fix.h>
35 /** This class represents an MSN message
37 * It may or may not represent an @e instant @e message.
39 * @todo Complete read/write support for formatting messages.
49 STRIKETHROUGH_FONT
= 8
55 DEFAULT_CHARSET
= 0x01,
56 SYMBOL_CHARSET
= 0x02,
58 SHIFTJIS_CHARSET
= 0x80,
59 HANGEUL_CHARSET
= 0x81,
61 GB2312_CHARSET
= 0x86,
62 CHINESEBIG5_CHARSET
= 0x88,
64 TURKISH_CHARSET
= 0xa2,
65 VIETNAMESE_CHARSET
= 0xa3,
66 HEBREW_CHARSET
= 0xb1,
67 ARABIC_CHARSET
= 0xb2,
68 BALTIC_CHARSET
= 0xba,
69 RUSSIAN_CHARSET_DEFAULT
= 0xcc,
71 EASTEUROPE_CHARSET
= 0xee,
95 Headers(const std::string
& rawContents_
) : rawContents(rawContents_
) {};
96 Headers() : rawContents("") {};
97 std::string
asString() const;
98 std::string
operator[](const std::string header
) const;
99 void setHeader(const std::string header
, const std::string value
);
102 std::string rawContents
;
107 Message::Headers header
;
110 /** Create a message with the specified @a body and @a mimeHeader.
112 Message(std::string body
, std::string mimeHeader
="MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\n");
114 /** Convert the Message into a string.
116 * This returns a string containing the MIME headers separated from the
117 * message body by a blank line.
119 std::string
asString() const;
121 /** Return the value of the MIME header named @a header.
123 * @return The value of the MIME header if present, or "" if not found.
125 std::string
operator[](const std::string header
) const;
126 void setHeader(const std::string name
, const std::string value
) { header
.setHeader(name
, value
); };
128 /** Return the body portion of this Message.
130 const std::string
& getBody() const { return body
; };
132 /** Return the font name used in this Message.
134 * @return The font name used for this Message, or "" if none specified.
136 const std::string
getFontName() const;
138 /** Set font name for use in this Message.
140 void setFontName(const std::string
& fontName
);
142 /** Get the color used in this Message.
144 const std::vector
<int> getColor() const;
145 const std::string
getColorAsHTMLString() const;
147 /** Set the color used in this Message.
149 void setColor(std::vector
<int> color
);
150 void setColor(std::string color
);
151 void setColor(int red
, int green
, int blue
);
153 /** Return the font effects used in this Message.
155 * @return An integer that is a bitwise-or of Message::FontEffects members.
157 const int getFontEffects() const;
159 /** Set the font effects for use in this Message.
161 * @param fontEffects Bitwise-or of Message::FontEffects members.
163 void setFontEffects(int fontEffects
);
165 /** Return the character set that the font uses in this Message.
167 const CharacterSet
getFontCharacterSet() const;
169 /** Set the character set that the font should use for this Message.
171 void setFontCharacterSet(CharacterSet cs
);
173 /** Return the font family used in this Message.
175 const FontFamily
getFontFamily() const;
177 /** Return the font pitch used in this Message.
179 const FontPitch
getFontPitch() const;
181 /** Set the font family and pitch to be used for this Message.
183 void setFontFamilyAndPitch(Message::FontFamily fontFamily
, Message::FontPitch fontPitch
);
185 /** Is the Message to be right-aligned?
187 const bool isRightAligned() const;
190 std::map
<std::string
, std::string
> getFormatInfo() const throw (std::runtime_error
);
191 void setFormatInfo(std::map
<std::string
, std::string
> & info
);