libkmime

kmime_message.h
1 /*
2  kmime_message.h
3 
4  KMime, the KDE internet mail/usenet news message library.
5  Copyright (c) 2001 the KMime authors.
6  See file AUTHORS for details
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 */
16 #ifndef __KMIME_MESSAGE_H__
17 #define __KMIME_MESSAGE_H__
18 
19 #include "kmime_content.h"
20 #include "kmime_headers.h"
21 #include "boolflags.h"
22 
23 namespace KMime {
24 
25 class TDE_EXPORT Message : public Content {
26 
27 public:
28  typedef TQPtrList<Message> List;
29 
31  Message();
32  ~Message();
33 
34  //content handling
35  virtual void parse();
36  virtual void assemble();
37  virtual void clear();
38 
39  //header access
40  virtual KMime::Headers::Base* getHeaderByType(const char *type);
41  virtual void setHeader(KMime::Headers::Base *h);
42  virtual bool removeHeader(const char *type);
43 
44  virtual KMime::Headers::MessageID* messageID(bool create=true) { KMime::Headers::MessageID *p=0; return getHeaderInstance(p, create); }
45  virtual KMime::Headers::Subject* subject(bool create=true) { if(!create && s_ubject.isEmpty()) return 0; return &s_ubject; }
46  virtual KMime::Headers::Date* date(bool create=true) { if(!create && d_ate.isEmpty()) return 0;return &d_ate; }
47  virtual KMime::Headers::From* from(bool create=true) { KMime::Headers::From *p=0; return getHeaderInstance(p, create); }
48  virtual KMime::Headers::Organization* organization(bool create=true) { KMime::Headers::Organization *p=0; return getHeaderInstance(p, create); }
49  virtual KMime::Headers::ReplyTo* replyTo(bool create=true) { KMime::Headers::ReplyTo *p=0; return getHeaderInstance(p, create); }
50  virtual KMime::Headers::To* to(bool create=true) { KMime::Headers::To *p=0; return getHeaderInstance(p, create); }
51  virtual KMime::Headers::CC* cc(bool create=true) { KMime::Headers::CC *p=0; return getHeaderInstance(p, create); }
52  virtual KMime::Headers::BCC* bcc(bool create=true) { KMime::Headers::BCC *p=0; return getHeaderInstance(p, create); }
53  virtual KMime::Headers::References* references(bool create=true) { KMime::Headers::References *p=0; return getHeaderInstance(p, create); }
54  virtual KMime::Headers::UserAgent* userAgent(bool create=true) { KMime::Headers::UserAgent *p=0; return getHeaderInstance(p, create); }
55 
56 protected:
57  //hardcoded headers
58  KMime::Headers::Subject s_ubject;
60  BoolFlags f_lags; // some status info
61 
62 
63 }; // class Message
64 
65 } // namespace KMime
66 
67 #endif // __KMIME_MESSAGE_H__
This class stores boolean values in single bytes.
Definition: boolflags.h:28
Baseclass of all header-classes.
Represents a "Date" header.
Represents a "Organization" header.
Represents a "Subject" header.
Represents a "User-Agent" header.