1
#ifndef __msn_message_h__
2
#define __msn_message_h__
8
* Created by Mark Rowe on Wed Mar 17 2004.
9
* Refactored by Tiago Salem Herrmann on 08/2007.
10
* Copyright (c) 2004 Mark Rowe. All rights reserved.
11
* Copyright (c) 2007 Tiago Salem Herrmann. All rights reserved
13
* This program is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program; if not, write to the Free Software
25
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33
#include "libmsn_export.h"
36
#pragma warning( disable : 4290 )
42
/** This class represents an MSN message
44
* It may or may not represent an @e instant @e message.
46
* @todo Complete read/write support for formatting messages.
48
class LIBMSN_EXPORT Message
56
STRIKETHROUGH_FONT = 8
62
DEFAULT_CHARSET = 0x01,
63
SYMBOL_CHARSET = 0x02,
65
SHIFTJIS_CHARSET = 0x80,
66
HANGEUL_CHARSET = 0x81,
68
GB2312_CHARSET = 0x86,
69
CHINESEBIG5_CHARSET = 0x88,
71
TURKISH_CHARSET = 0xa2,
72
VIETNAMESE_CHARSET = 0xa3,
73
HEBREW_CHARSET = 0xb1,
74
ARABIC_CHARSET = 0xb2,
75
BALTIC_CHARSET = 0xba,
76
RUSSIAN_CHARSET_DEFAULT = 0xcc,
78
EASTEUROPE_CHARSET = 0xee,
102
Headers(const std::string & rawContents_) : rawContents(rawContents_) {};
103
Headers() : rawContents("") {};
104
std::string asString() const;
105
std::string operator[](const std::string header) const;
106
void setHeader(const std::string header, const std::string value);
109
std::string rawContents;
114
Message::Headers header;
117
/** Create a message with the specified @a body and @a mimeHeader.
119
Message(std::string body, std::string mimeHeader="MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\n");
121
/** Convert the Message into a string.
123
* This returns a string containing the MIME headers separated from the
124
* message body by a blank line.
126
std::string asString() const;
128
/** Return the value of the MIME header named @a header.
130
* @return The value of the MIME header if present, or "" if not found.
132
std::string operator[](const std::string header) const;
133
void setHeader(const std::string name, const std::string value) { header.setHeader(name, value); };
135
/** Return the body portion of this Message.
137
std::string getBody() const { return body; };
139
/** Return the font name used in this Message.
141
* @return The font name used for this Message, or "" if none specified.
143
std::string getFontName() const;
145
/** Set font name for use in this Message.
147
void setFontName(const std::string & fontName);
149
/** Get the color used in this Message.
151
std::vector<int> getColor() const;
152
std::string getColorAsHTMLString() const;
154
/** Set the color used in this Message.
156
void setColor(std::vector<int> color);
157
void setColor(std::string color);
158
void setColor(int red, int green, int blue);
160
/** Return the font effects used in this Message.
162
* @return An integer that is a bitwise-or of Message::FontEffects members.
164
int getFontEffects() const;
166
/** Set the font effects for use in this Message.
168
* @param fontEffects Bitwise-or of Message::FontEffects members.
170
void setFontEffects(int fontEffects);
172
/** Return the character set that the font uses in this Message.
174
CharacterSet getFontCharacterSet() const;
176
/** Set the character set that the font should use for this Message.
178
void setFontCharacterSet(CharacterSet cs);
180
/** Return the font family used in this Message.
182
FontFamily getFontFamily() const;
184
/** Return the font pitch used in this Message.
186
FontPitch getFontPitch() const;
188
/** Set the font family and pitch to be used for this Message.
190
void setFontFamilyAndPitch(Message::FontFamily fontFamily, Message::FontPitch fontPitch);
192
/** Is the Message to be right-aligned?
194
bool isRightAligned() const;
197
std::map<std::string, std::string> getFormatInfo() const throw (std::runtime_error);
198
void setFormatInfo(std::map<std::string, std::string> & info);