tdeioslave/imap4

mailheader.h
1 /***************************************************************************
2  mailheader.h - description
3  -------------------
4  begin : Tue Oct 24 2000
5  copyright : (C) 2000 by Sven Carstens
6  email : s.carstens@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
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. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef MAILHEADER_H
19 #define MAILHEADER_H
20 
21 #include "mimeheader.h"
22 #include "mailaddress.h"
23 #include "mimeio.h"
24 #include "rfcdecoder.h"
25 
30 class mailHeader:public mimeHeader
31 {
32 public:
33  mailHeader ();
34  ~mailHeader ();
35 
36  virtual void addHdrLine (mimeHdrLine *);
37  virtual void outputHeader (mimeIO &);
38 
39  void addTo (const mailAddress & _adr)
40  {
41  toAdr.append (new mailAddress (_adr));
42  }
43  void addCC (const mailAddress & _adr)
44  {
45  ccAdr.append (new mailAddress (_adr));
46  }
47  void addBCC (const mailAddress & _adr)
48  {
49  bccAdr.append (new mailAddress (_adr));
50  }
51 
52  void setFrom (const mailAddress & _adr)
53  {
54  fromAdr = _adr;
55  }
56  void setSender (const mailAddress & _adr)
57  {
58  senderAdr = _adr;
59  }
60  void setReturnPath (const mailAddress & _adr)
61  {
62  returnpathAdr = _adr;
63  }
64  void setReplyTo (const mailAddress & _adr)
65  {
66  replytoAdr = _adr;
67  }
68 
69  const TQCString& getMessageId ()
70  {
71  return messageID;
72  }
73  void setMessageId (const TQCString & _str)
74  {
75  messageID = _str;
76  }
77 
78  const TQCString& getInReplyTo ()
79  {
80  return inReplyTo;
81  }
82  void setInReplyTo (const TQCString & _str)
83  {
84  inReplyTo = _str;
85  }
86 
87  const TQCString& getReferences ()
88  {
89  return references;
90  }
91  void setReferences (const TQCString & _str)
92  {
93  references = _str;
94  }
95 
99  void setSubject (const TQString & _str)
100  {
101  _subject = rfcDecoder::encodeRFC2047String(_str).latin1();
102  }
106  void setSubjectEncoded (const TQCString & _str)
107  {
108  _subject = _str.simplifyWhiteSpace();
109  }
110 
114  const TQString getSubject ()
115  {
116  return rfcDecoder::decodeRFC2047String(_subject);
117  }
121  const TQCString& getSubjectEncoded ()
122  {
123  return _subject;
124  }
125 
129  void setDate (const TQCString & _str)
130  {
131  mDate = _str;
132  }
133 
137  const TQCString& date ()
138  {
139  return mDate;
140  }
141 
142  static int parseAddressList (const char *, TQPtrList < mailAddress > *);
143  static TQCString getAddressStr (TQPtrList < mailAddress > *);
144  TQPtrList < mailAddress > &to ()
145  {
146  return toAdr;
147  }
148  TQPtrList < mailAddress > &cc ()
149  {
150  return ccAdr;
151  }
152  TQPtrList < mailAddress > &bcc ()
153  {
154  return bccAdr;
155  }
156 #ifdef KMAIL_COMPATIBLE
157  TQString subject ()
158  {
159  return getSubject ();
160  }
161  const mailAddress & from ()
162  {
163  return fromAdr;
164  }
165  const mailAddress & replyTo ()
166  {
167  return replytoAdr;
168  }
169  void readConfig (void)
170  {;
171  }
172 #endif
173 
174 private:
175  TQPtrList < mailAddress > toAdr;
176  TQPtrList < mailAddress > ccAdr;
177  TQPtrList < mailAddress > bccAdr;
178  mailAddress fromAdr;
179  mailAddress senderAdr;
180  mailAddress returnpathAdr;
181  mailAddress replytoAdr;
182  TQCString _subject;
183  TQCString mDate;
184  int gmt_offset;
185  TQCString messageID;
186  TQCString inReplyTo;
187  TQCString references;
188 };
189 
190 #endif
void setDate(const TQCString &_str)
set the date
Definition: mailheader.h:129
const TQCString & date()
get the date
Definition: mailheader.h:137
const TQCString & getSubjectEncoded()
get the encoded subject
Definition: mailheader.h:121
const TQString getSubject()
get the unicode subject
Definition: mailheader.h:114
void setSubject(const TQString &_str)
set a unicode subject
Definition: mailheader.h:99
void setSubjectEncoded(const TQCString &_str)
set a encoded subject
Definition: mailheader.h:106
Definition: mimeio.h:29
static const TQString decodeRFC2047String(const TQString &_str, TQString &charset, TQString &language)
decode a RFC2047 String
Definition: rfcdecoder.cpp:337
static const TQString encodeRFC2047String(const TQString &_str, TQString &charset, TQString &language)
encode a RFC2047 String