/usr/include/kmime/kmime_message.h is in kdepimlibs5-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | /*
kmime_message.h
KMime, the KDE Internet mail/usenet news message library.
Copyright (c) 2001 the KMime authors.
See file AUTHORS for details
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KMIME_MESSAGE_H__
#define __KMIME_MESSAGE_H__
#include "kmime_export.h"
#include "kmime_content.h"
#include "kmime_headers.h"
#include "boolflags.h"
#include <QtCore/QMetaType>
namespace boost {
template <typename T> class shared_ptr;
}
namespace KMime {
class MessagePrivate;
/**
* Represents a (email) message.
*
* Sample how to create a multipart message:
* \code
* // Set the multipart message.
* Message *m = new Message;
* Headers::ContentType *ct = m->contentType();
* ct->setMimeType( "multipart/mixed" );
* ct->setBoundary( multiPartBoundary() );
* ct->setCategory( Headers::CCcontainer );
* m->contentTransferEncoding()->clear();
*
* // Set the headers.
* m->from()->fromUnicodeString( "some@mailaddy.com", "utf-8" );
* m->to()->fromUnicodeString( "someother@mailaddy.com", "utf-8" );
* m->cc()->fromUnicodeString( "some@mailaddy.com", "utf-8" );
* m->date()->setDateTime( KDateTime::currentLocalDateTime() );
* m->subject()->fromUnicodeString( "My Subject", "utf-8" );
*
* // Set the first multipart, the body message.
* KMime::Content *b = new KMime::Content;
* b->contentType()->setMimeType( "text/plain" );
* b->setBody( "Some text..." );
*
* // Set the second multipart, the attachment.
* KMime::Content *a = new KMime::Content;
* KMime::Headers::ContentDisposition *d = new KMime::Headers::ContentDisposition( attachMessage );
* d->setFilename( "cal.ics" );
* d->setDisposition( KMime::Headers::CDattachment );
* a->contentType()->setMimeType( "text/plain" );
* a->setHeader( d );
* a->setBody( "Some text in the attachment..." );
*
* // Attach the both multiparts and assemble the message.
* m->addContent( b );
* m->addContent( a );
* m->assemble();
* \endcode
*/
class KMIME_EXPORT Message : public Content
{
public:
/**
A list of messages.
*/
typedef QList<KMime::Message*> List;
/**
A shared pointer to a message object.
*/
typedef boost::shared_ptr<Message> Ptr;
/**
Creates an empty Message.
*/
Message();
/**
Destroys this Message.
*/
~Message();
/* reimpl */
virtual void parse();
/* reimpl */
virtual void clear();
/* reimpl */
virtual KMIME_DEPRECATED KMime::Headers::Base *getHeaderByType( const char *type );
/* reimpl */
virtual KMime::Headers::Base *headerByType( const char *type );
/* reimpl */
virtual void setHeader( KMime::Headers::Base *h );
/* reimpl */
virtual bool removeHeader( const char *type );
// KDE5: Why are these virtual?
/**
Returns the Message-ID header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::MessageID *messageID( bool create = true );
/**
Returns the Subject header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Subject *subject( bool create = true );
/**
Returns the Date header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Date *date( bool create = true );
/**
Returns the From header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::From *from( bool create = true );
/**
Returns the Organization header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Organization *organization( bool create = true );
/**
Returns the Reply-To header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::ReplyTo *replyTo( bool create = true );
/**
Returns the To header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::To *to( bool create = true );
/**
Returns the Cc header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Cc *cc( bool create = true );
/**
Returns the Bcc header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Bcc *bcc( bool create = true );
/**
Returns the References header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::References *references( bool create = true );
/**
Returns the User-Agent header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::UserAgent *userAgent( bool create = true );
/**
Returns the In-Reply-To header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::InReplyTo *inReplyTo( bool create = true );
/**
Returns the Sender header.
@param create If true, create the header if it doesn't exist yet.
*/
virtual KMime::Headers::Sender *sender( bool create = true );
/* reimpl */
virtual bool isTopLevel() const;
/**
Returns the first main body part of a given type, taking multipart/mixed
and multipart/alternative nodes into consideration.
Eg. \c bodyPart("text/html") will return a html content object if that is
provided in a multipart/alternative node, but not if it's the non-first
child node of a multipart/mixed node (ie. an attachment).
@param type The mimetype of the body part, if not given, the first
body part will be returned, regardless of it's type.
*/
Content* mainBodyPart( const QByteArray &type = QByteArray() );
/**
Returns the MIME type used for Messages
*/
static QString mimeType();
protected:
/* reimpl */
virtual QByteArray assembleHeaders();
// @cond PRIVATE
explicit Message( MessagePrivate *d );
// @endcond
private:
Q_DECLARE_PRIVATE( Message )
}; // class Message
} // namespace KMime
#define KMIME_MESSAGE_METATYPE_DEFINED 1
Q_DECLARE_METATYPE( KMime::Message* )
#endif // __KMIME_MESSAGE_H__
|