1 ///###////////////////////////////////////////////////////////////////////////
2 //
3 // Burton Computer Corporation
4 // http://www.burton-computer.com
5 // http://www.cooldevtools.com
6 // $Id: MailMessage.h 272 2007-01-06 19:37:27Z brian $
7 //
8 // Copyright (C) 2007 Burton Computer Corporation
9 // ALL RIGHTS RESERVED
10 //
11 // This program is open source software; you can redistribute it
12 // and/or modify it under the terms of the Q Public License (QPL)
13 // version 1.0. Use of this software in whole or in part, including
14 // linking it (modified or unmodified) into other programs is
15 // subject to the terms of the QPL.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 // Q Public License for more details.
21 //
22 // You should have received a copy of the Q Public License
23 // along with this program; see the file LICENSE.txt.  If not, visit
24 // the Burton Computer Corporation or CoolDevTools web site
25 // QPL pages at:
26 //
27 //    http://www.burton-computer.com/qpl.html
28 //    http://www.cooldevtools.com/qpl.html
29 //
30 
31 #ifndef _MailMessage_h
32 #define _MailMessage_h
33 
34 #include "util.h"
35 #include "Buffer.h"
36 
37 class AbstractMultiLineString;
38 class MessageHeaderList;
39 class MailMessageList;
40 
41 class MailMessage
42 {
43 public:
44   MailMessage(const CRef<AbstractMultiLineString> &full_text);
45   MailMessage(const CRef<AbstractMultiLineString> &head_text,
46               const CRef<AbstractMultiLineString> &body_text,
47               const CRef<AbstractMultiLineString> &full_text);
48   ~MailMessage();
49 
headText()50   CRef<AbstractMultiLineString> &headText()
51   {
52     return m_headText;
53   }
54 
bodyText()55   CRef<AbstractMultiLineString> &bodyText()
56   {
57     return m_bodyText;
58   }
59 
fullText()60   CRef<AbstractMultiLineString> &fullText()
61   {
62     return m_fullText;
63   }
64 
65   const MessageHeaderList *head();
66   const MailMessageList *body();
67 
68   bool isMultiPart();
69   bool hasParts();
70 
71   const AbstractMultiLineString *asText(bool &is_html);
72   bool asData(Buffer<unsigned char> &buffer);
73 
74 private:
75   bool isMultiPartType();
76   bool isHtml(const AbstractMultiLineString *text);
77 
78 private:
79   CRef<AbstractMultiLineString> m_headText;
80   CRef<AbstractMultiLineString> m_bodyText;
81   CRef<AbstractMultiLineString> m_fullText;
82   Ref<MessageHeaderList> m_head;
83   Ref<MailMessageList> m_body;
84 
85   CRef<AbstractMultiLineString> m_decodedText;
86   bool m_isHtml;
87 };
88 
89 #endif
90