17 #include "kmime_message.h"
19 using namespace KMime;
25 s_ubject.setParent( this);
26 d_ate.setParent( this);
29 Message::~Message() {}
36 if( !(raw=rawHeader(s_ubject.type())).isEmpty() )
37 s_ubject.from7BitString(raw);
39 if( !(raw=rawHeader(d_ate.type())).isEmpty() )
40 d_ate.from7BitString(raw);
44 void Message::assemble()
50 if( (h=messageID( false))!=0 )
62 if( (h=to( false))!=0 )
66 if( (h=cc( false))!=0 )
70 if( (h=replyTo( false))!=0 )
78 if( (h=references( false))!=0 )
82 if( (h=organization( false))!=0 )
86 if( (h=userAgent( false))!=0 )
90 newHead+= "MIME-Version: 1.0\n";
93 newHead+=contentType()->as7BitString()+ "\n";
96 newHead+=contentTransferEncoding()->as7BitString()+ "\n";
99 int pos=h_ead.find( "\nX-");
101 newHead+=h_ead.mid(pos+1, h_ead.length()-pos-1);
102 else if(h_eaders && !h_eaders->isEmpty()) {
103 for(h=h_eaders->first(); h; h=h_eaders->next()) {
104 if( h-> isXHeader() && (strncasecmp(h-> type(), "X-KNode", 7)!=0) )
113 void Message::clear()
124 if(strcasecmp( "Subject", type)==0) {
125 if(s_ubject.isEmpty()) return 0;
126 else return &s_ubject;
128 else if(strcasecmp( "Date", type)==0){
129 if(d_ate.isEmpty()) return 0;
133 return Content::getHeaderByType(type);
142 else if(h-> is( "Date"))
143 d_ate.setUnixTime( ( static_cast<Headers::Date* >(h))->unixTime() );
146 Content::setHeader(h);
153 bool Message::removeHeader( const char *type)
155 if(strcasecmp( "Subject", type)==0)
157 else if(strcasecmp( "Date", type)==0)
160 return Content::removeHeader(type);
|