• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

KMMessage Class Reference

This is a Mime Message. More...

#include <kmmessage.h>

Inheritance diagram for KMMessage:
Inheritance graph
[legend]

List of all members.

Classes

struct  MessageReply
 Small helper structure which encapsulates the KMMessage created when creating a reply, and the reply mode. More...

Public Types

enum  EncodingMode { NoEncoding, MessageCharsetEncoding }
enum  HeaderFieldType { Unstructured, Structured, Address }

Public Member Functions

 KMMessage (const KMMessage &other)
 KMMessage (KMMsgInfo &msgInfo)
 KMMessage (DwMessage *)
 KMMessage (KMFolder *parent=0)
virtual ~KMMessage ()
void addBodyPart (const KMMessagePart *aPart)
void addDwBodyPart (DwBodyPart *aDwPart)
void applyIdentity (uint id)
const DwMessage * asDwMessage ()
const DwString & asDwString () const
QString asPlainText (bool stripSignature, bool allowDecryption) const
QString asPlainTextFromObjectTree (partNode *root, bool stripSignature, bool allowDecryption) const
QString asQuotedString (const QString &indentStr, const QString &selection=QString(), bool aStripSignature=true, bool allowDecryption=true) const
void assembleIfNeeded ()
QByteArray asSendableString () const
QByteArray asString () const
QString bcc () const
QByteArray body () const
QByteArray bodyDecoded () const
QByteArray bodyDecodedBinary () const
void bodyPart (int aIdx, KMMessagePart *aPart) const
QString bodyToUnicode (const QTextCodec *codec=0) const
QString cc () const
QString ccStrip () const
QByteArray charset () const
void cleanupHeader ()
const QTextCodec * codec () const
int contentTransferEncoding (DwEntity *entity=0) const
QByteArray contentTransferEncodingStr () const
KMMessage * createDeliveryReceipt () const
DwBodyPart * createDWBodyPart (const KMMessagePart *aPart)
KMMessage * createForward (const QString &tmpl=QString())
KMMessage * createMDN (KMime::MDN::ActionMode a, KMime::MDN::DispositionType d, bool allowGUI=false, QList< KMime::MDN::DispositionModifier > m=QList< KMime::MDN::DispositionModifier >())
KMMessage * createRedirect (const QString &toStr)
MessageReply createReply (KMail::ReplyStrategy replyStrategy=KMail::ReplySmart, const QString &selection=QString(), bool noQuote=false, bool allowDecryption=true, bool selectionIsBody=false, const QString &tmpl=QString())
int cte (DwEntity *entity=0) const
QByteArray cteStr () const
time_t date () const
QString dateIsoStr () const
QByteArray dateShortStr () const
QString dateStr () const
void del ()
bool deleteBodyPart (int partIndex)
void deleteBodyParts ()
void deleteWhenUnused ()
QString drafts () const
void dump (DwEntity *entity=0, int level=0)
DwBodyPart * dwBodyPart (int aIdx) const
DwMediaType & dwContentType ()
KMMsgEncryptionState encryptionState () const
KMime::Types::AddrSpecList extractAddrSpecs (const QByteArray &headerNames) const
QString fcc () const
QString fileName () const
DwBodyPart * findDwBodyPart (DwBodyPart *part, const QString &partSpecifier)
DwBodyPart * findDwBodyPart (const QByteArray &type, const QByteArray &subtype) const
DwBodyPart * findDwBodyPart (int type, int subtype) const
DwBodyPart * findPart (int index)
off_t folderOffset () const
QString from () const
void fromDwString (const DwString &str, bool setStatus=false)
void fromString (const QByteArray &ba, bool setStatus=false)
QString fromStrip () const
int getCursorPos ()
DwBodyPart * getFirstDwBodyPart () const
void getLink (int n, ulong *retMsgSerNum, MessageStatus &retStatus) const
QByteArray getRefStr () const
DwMessage * getTopLevelPart () const
bool hasUnencryptedMsg () const
KMime::Types::AddressList headerAddrField (const QByteArray &name) const
QByteArray headerAsSendableString () const
QString headerAsString () const
QString headerField (const QByteArray &name, EncodingMode encodingMode=MessageCharsetEncoding) const
QStringList headerFields (const QByteArray &name) const
DwHeaders & headers () const
QByteArray id () const
uint identityUoid () const
void initFromMessage (const KMMessage *msg, bool idHeaders=true)
void initHeader (uint identity=0)
void initStrippedSubjectMD5 ()
bool isBeingParsed () const
bool isComplete () const
bool isMessage () const
bool isUrgent () const
DwBodyPart * lastUpdatedPart ()
void link (const KMMessage *aMsg, const MessageStatus &aStatus)
QByteArray mboxMessageSeparator ()
KMMsgMDNSentState mdnSentState () const
QString msgId () const
QString msgIdMD5 () const
size_t msgLength () const
size_t msgSize () const
size_t msgSizeServer () const
int numBodyParts () const
void parseTextStringFromDwPart (partNode *root, QByteArray &parsedString, const QTextCodec *&codec, bool &isHTML) const
int partNumber (DwBodyPart *aDwBodyPart) const
QByteArray rawHeaderField (const QByteArray &name) const
QList< QByteArray > rawHeaderFields (const QByteArray &field) const
bool readyToShow () const
QString references () const
void removeHeaderField (const QByteArray &name)
void removeHeaderFields (const QByteArray &name)
void removePrivateHeaderFields ()
QString replaceHeadersInString (const QString &s) const
QString replyTo () const
QString replyToAuxIdMD5 () const
QString replyToId () const
QString replyToIdMD5 () const
void sanitizeHeaders (const QStringList &whiteList=QStringList())
QString sender () const
void setAutomaticFields (bool isMultipart=false)
void setBcc (const QString &aStr)
void setBody (const QByteArray &aStr)
void setBodyAndGuessCte (const QByteArray &aBuf, QList< int > &allowedCte, bool allow8Bit=false, bool willBeSigned=false, DwEntity *entity=0)
void setBodyEncoded (const QByteArray &aStr)
void setBodyEncodedBinary (const QByteArray &bodyStr, DwEntity *entity=0)
void setBodyFromUnicode (const QString &str, DwEntity *entity=0)
void setCc (const QString &aStr)
void setCharset (const QByteArray &charset, DwEntity *entity=0)
void setComplete (bool v)
void setContentTransferEncoding (int cte, DwEntity *entity=0)
void setContentTransferEncodingStr (const QByteArray &cteString, DwEntity *entity=0)
void setContentTypeParam (const QByteArray &attr, const QByteArray &val)
void setCte (int aCte, DwEntity *entity=0)
void setCteStr (const QByteArray &aStr, DwEntity *entity=0)
void setCursorPos (int pos)
void setDate (time_t aUnixTime)
void setDate (const QByteArray &str)
void setDateToday ()
void setDecodeHTML (bool aDecodeHTML)
void setDrafts (const QString &aStr)
void setEncryptionState (const KMMsgEncryptionState, int idx=-1)
void setFcc (const QString &aStr)
void setFileName (const QString &file)
void setFolderOffset (off_t offs)
void setFrom (const QString &aStr)
void setHeaderField (const QByteArray &name, const QString &value, HeaderFieldType type=Unstructured, bool prepend=false, EncodingMode encodingMode=MessageCharsetEncoding)
void setIsBeingParsed (bool t)
void setMDNSentState (KMMsgMDNSentState status, int idx=-1)
void setMsgId (const QString &aStr)
void setMsgLength (size_t sz)
void setMsgSerNum (unsigned long newMsgSerNum=0)
void setMsgSize (size_t sz)
void setMsgSizeServer (size_t sz)
void setMultiPartBody (const QByteArray &aStr)
void setNeedsAssembly ()
void setOverrideCodec (const QTextCodec *codec)
void setReadyToShow (bool v)
void setReferences (const QByteArray &aStr)
void setReplyTo (KMMessage *)
void setReplyTo (const QString &aStr)
void setReplyToId (const QString &aStr)
void setSignatureState (const KMMsgSignatureState, int idx=-1)
void setStatus (const char *s1, const char *s2=0)
void setStatus (const MessageStatus &status, int idx=-1)
void setStatusFields ()
void setSubject (const QString &aStr)
void setSubtype (int aSubtype)
void setSubtypeStr (const QByteArray &aStr)
void setTemplates (const QString &aStr)
void setTo (const QString &aStr)
void setTransferInProgress (bool value, bool force=false)
void setType (int aType)
void setTypeStr (const QByteArray &aStr)
void setUID (ulong uid)
void setUnencryptedMsg (KMMessage *unencrypted)
void setXMark (const QString &aStr)
KMMsgSignatureState signatureState () const
MessageStatus & status () const
QString strippedSubjectMD5 () const
QString subject () const
bool subjectIsPrefixed () const
QString subjectMD5 () const
int subtype () const
QByteArray subtypeStr () const
virtual KMMessageTagList * tagList (void) const
virtual QString tagString (void) const
KMMessage * takeUnencryptedMsg ()
QString templates () const
QString to () const
const KMMsgBase & toMsgBase () const
KMMsgBase & toMsgBase ()
QString toStrip () const
void touch ()
bool transferInProgress () const
int type (DwEntity *entity=0) const
QByteArray typeStr () const
ulong UID () const
void undel ()
KMMessage * unencryptedMsg () const
void updateAttachmentState (DwBodyPart *part=0)
void updateBodyPart (const QString partSpecifier, const QByteArray &data)
QString who () const
QString xmark () const

Static Public Member Functions

static void bodyPart (DwBodyPart *aDwBodyPart, KMMessagePart *aPart, bool withBody=true)
static QByteArray defaultCharset ()
static const QStringList & preferredCharsets ()
static void readConfig ()
static void setDwMediaTypeParam (DwMediaType &mType, const QByteArray &attr, const QByteArray &val)

Detailed Description

This is a Mime Message.

Definition at line 71 of file kmmessage.h.


Member Enumeration Documentation

enum KMMessage::EncodingMode
Enumerator:
NoEncoding 
MessageCharsetEncoding 

Definition at line 426 of file kmmessage.h.

enum KMMessage::HeaderFieldType
Enumerator:
Unstructured 
Structured 
Address 

Definition at line 434 of file kmmessage.h.


Constructor & Destructor Documentation

KMMessage::KMMessage ( KMFolder *  parent = 0  ) 

Straight forward initialization.

Definition at line 114 of file kmmessage.cpp.

KMMessage::KMMessage ( DwMessage *  aMsg  ) 

Constructor from a DwMessage.

KMMessage takes possession of the DwMessage, so don't dare to delete it.

Definition at line 105 of file kmmessage.cpp.

KMMessage::KMMessage ( KMMsgInfo &  msgInfo  ) 

Copy constructor.

Does *not* automatically load the message.

Definition at line 121 of file kmmessage.cpp.

KMMessage::KMMessage ( const KMMessage &  other  ) 

Copy constructor.

Definition at line 146 of file kmmessage.cpp.

KMMessage::~KMMessage (  )  [virtual]

Destructor.

Definition at line 224 of file kmmessage.cpp.


Member Function Documentation

void KMMessage::addBodyPart ( const KMMessagePart *  aPart  ) 

Append a body part to the message.

Definition at line 2921 of file kmmessage.cpp.

void KMMessage::addDwBodyPart ( DwBodyPart *  aDwPart  ) 

Append a DwBodyPart to the message.

Definition at line 2913 of file kmmessage.cpp.

void KMMessage::applyIdentity ( uint  id  ) 

Set the from, to, cc, bcc, encrytion etc headers as specified in the given identity.

Definition at line 1304 of file kmmessage.cpp.

const DwMessage * KMMessage::asDwMessage (  ) 

Definition at line 317 of file kmmessage.cpp.

const DwString & KMMessage::asDwString (  )  const

Return the entire message contents in the DwString.

This function is *fast* even for large message since it does *not* involve a string copy.

Definition at line 306 of file kmmessage.cpp.

QString KMMessage::asPlainText ( bool  stripSignature,
bool  allowDecryption 
) const

Return the textual content of the message as plain text, converting HTML to plain text if necessary.

Definition at line 541 of file kmmessage.cpp.

QString KMMessage::asPlainTextFromObjectTree ( partNode *  root,
bool  stripSignature,
bool  allowDecryption 
) const

Same as asPlainText(), only that this method expects an already parsed object tree as paramter.

By passing an already parsed objecttree, this allows to share the objecttree and therefore reduce the amount of parsing (which can include decrypting, which can include a passphrase dialog)

Definition at line 461 of file kmmessage.cpp.

QString KMMessage::asQuotedString ( const QString &  indentStr,
const QString &  selection = QString(),
bool  aStripSignature = true,
bool  allowDecryption = true 
) const

Returns message body indented by the given indentation string.

This is suitable for including the message in another message of for replies, forwards.

No attachments are handled if includeAttach is false. The signature is stripped if aStripSignature is true and smart quoting is turned on. Signed or encrypted texts get converted to plain text when allowDecryption is true.

Definition at line 556 of file kmmessage.cpp.

void KMMessage::assembleIfNeeded (  ) 

Assemble the internal message.

This is done automatically in most cases, but sometimes still necessary to call this manually.

Definition at line 2228 of file kmmessage.cpp.

QByteArray KMMessage::asSendableString (  )  const

Return the message contents with the headers that should not be sent stripped off.

Definition at line 333 of file kmmessage.cpp.

QByteArray KMMessage::asString (  )  const

Return the entire message contents as a string.

This function is slow for large message since it involves a string copy. If you need the string representation only for a short time (i.e. without the chance of calling any function in the underlying mimelib, then you should use the asDwString function.

See also:
asDwString

Definition at line 328 of file kmmessage.cpp.

QString KMMessage::bcc (  )  const

Get or set the 'Bcc' header field.

Definition at line 1620 of file kmmessage.cpp.

QByteArray KMMessage::body (  )  const

Get the message body.

Does not decode the body.

Definition at line 2239 of file kmmessage.cpp.

QByteArray KMMessage::bodyDecoded (  )  const

Returns a decoded version of the body from the current content transfer encoding.

The first method returns a null terminated string, the second method is meant for binary data, not null is appended

Definition at line 2277 of file kmmessage.cpp.

QByteArray KMMessage::bodyDecodedBinary (  )  const

Definition at line 2251 of file kmmessage.cpp.

void KMMessage::bodyPart ( int  aIdx,
KMMessagePart *  aPart 
) const

Get the body part at position in aIdx.

Indexing starts at 0. If there is no body part at that index, aPart will have its attributes set to empty values.

Definition at line 2715 of file kmmessage.cpp.

void KMMessage::bodyPart ( DwBodyPart *  aDwBodyPart,
KMMessagePart *  aPart,
bool  withBody = true 
) [static]

Fill the KMMessagePart structure for a given DwBodyPart.

If withBody is false the body of the KMMessagePart will be left empty and only the headers of the part will be filled in

Definition at line 2664 of file kmmessage.cpp.

QString KMMessage::bodyToUnicode ( const QTextCodec *  codec = 0  )  const

Returns the body part decoded to unicode.

Definition at line 3314 of file kmmessage.cpp.

QString KMMessage::cc (  )  const

Get or set the 'Cc' header field.

Definition at line 1592 of file kmmessage.cpp.

QString KMMessage::ccStrip (  )  const

Definition at line 1613 of file kmmessage.cpp.

QByteArray KMMessage::charset (  )  const

Get the message charset.

Definition at line 2955 of file kmmessage.cpp.

void KMMessage::cleanupHeader (  ) 

Removes empty fields from the header, e.g.

an empty Cc: or Bcc: field.

Definition at line 1405 of file kmmessage.cpp.

const QTextCodec * KMMessage::codec (  )  const

Get a QTextCodec suitable for this message part.

Definition at line 3293 of file kmmessage.cpp.

int KMMessage::contentTransferEncoding ( DwEntity *  entity = 0  )  const

Definition at line 2178 of file kmmessage.cpp.

QByteArray KMMessage::contentTransferEncodingStr (  )  const

Get or set the 'Content-Transfer-Encoding' header field The member functions that involve enumerated types (ints) will work only for well-known encodings.

Some functions take a DwEntity as second parameter, which specifies the body part or message of which the CTE will be changed or returned. If this is zero, the toplevel message will be taken.

Definition at line 2168 of file kmmessage.cpp.

KMMessage * KMMessage::createDeliveryReceipt (  )  const

Create a new message that is a delivery receipt of this message, filling required header fileds with the proper values.

The returned message is not stored in any folder.

Definition at line 1277 of file kmmessage.cpp.

DwBodyPart * KMMessage::createDWBodyPart ( const KMMessagePart *  aPart  ) 

Compose a DwBodyPart (needed for adding a part to the message).

Definition at line 2774 of file kmmessage.cpp.

KMMessage * KMMessage::createForward ( const QString &  tmpl = QString()  ) 

Create a new message that is a forward of this message, filling all required header fields with the proper values.

The returned message is not stored in any folder. Marks this message as forwarded.

Definition at line 900 of file kmmessage.cpp.

KMMessage* KMMessage::createMDN ( KMime::MDN::ActionMode  a,
KMime::MDN::DispositionType  d,
bool  allowGUI = false,
QList< KMime::MDN::DispositionModifier >  m = QList< KMime::MDN::DispositionModifier >() 
)

Create a new message that is a MDN for this message, filling all required fields with proper values.

The returned message is not stored in any folder.

Parameters:
a Use AutomaticAction for filtering and ManualAction for user-induced events.
d See docs for KMime::MDN::DispositionType
m See docs for KMime::MDN::DispositionModifier
allowGUI Set to true if this method is allowed to ask the user questions
Returns:
The notification message or 0, if none should be sent.
KMMessage * KMMessage::createRedirect ( const QString &  toStr  ) 

Create a new message that is a redirect to this message, filling all required header fields with the proper values.

The returned message is not stored in any folder. Marks this message as replied. Redirects differ from forwards so they are forwarded to some other user, mail is not changed and the reply-to field is set to the email address of the original sender

Definition at line 832 of file kmmessage.cpp.

KMMessage::MessageReply KMMessage::createReply ( KMail::ReplyStrategy  replyStrategy = KMail::ReplySmart,
const QString &  selection = QString(),
bool  noQuote = false,
bool  allowDecryption = true,
bool  selectionIsBody = false,
const QString &  tmpl = QString() 
)

Create a new message that is a reply to this message, filling all required header fields with the proper values.

The returned message is not stored in any folder. Marks this message as replied.

Returns:
the reply created, including the reply mode

Definition at line 583 of file kmmessage.cpp.

int KMMessage::cte ( DwEntity *  entity = 0  )  const [inline]

Definition at line 524 of file kmmessage.h.

QByteArray KMMessage::cteStr (  )  const [inline]

Cte is short for ContentTransferEncoding.

These functions are an alternative to the ones with longer names.

Definition at line 523 of file kmmessage.h.

time_t KMMessage::date ( void   )  const [virtual]

Implements KMMsgBase.

Definition at line 1500 of file kmmessage.cpp.

QString KMMessage::dateIsoStr (  )  const

Definition at line 1485 of file kmmessage.cpp.

QByteArray KMMessage::dateShortStr (  )  const

Returns the message date in asctime format or an empty string if the message lacks a Date header.

Definition at line 1467 of file kmmessage.cpp.

QString KMMessage::dateStr ( void   )  const [virtual]

Get or set the 'Date' header field.

Reimplemented from KMMsgBase.

Definition at line 1448 of file kmmessage.cpp.

QByteArray KMMessage::defaultCharset (  )  [static]

Get the default message charset.

Definition at line 3347 of file kmmessage.cpp.

void KMMessage::del (  )  [inline]

Mark the message as deleted.

Definition at line 150 of file kmmessage.h.

bool KMMessage::deleteBodyPart ( int  partIndex  ) 

Delete a body part with the specified part index.

A dummy body part with the text "the attachment foo was deleted" will replace the old part.

Definition at line 2737 of file kmmessage.cpp.

void KMMessage::deleteBodyParts (  ) 

Delete all body parts.

Definition at line 2730 of file kmmessage.cpp.

void KMMessage::deleteWhenUnused (  ) 

Delete this message as soon as it no longer in use.

Definition at line 3342 of file kmmessage.cpp.

QString KMMessage::drafts (  )  const [inline]

Get or set the 'Drafts' folder.

Definition at line 340 of file kmmessage.h.

void KMMessage::dump ( DwEntity *  entity = 0,
int  level = 0 
)

Dump the internal mimelib message structure to kDebug().

This is useful if there are inconsistencies because of a missing Parse() or Assemble().

This function is recursive, pass 0 as level when calling this with the root entity.

If entity is 0, the root will be dumped.

Definition at line 3370 of file kmmessage.cpp.

DwBodyPart * KMMessage::dwBodyPart ( int  aIdx  )  const

Get the DwBodyPart at position in aIdx.

Indexing starts at 0. If there is no body part at that index, return value will be zero.

Definition at line 2463 of file kmmessage.cpp.

DwMediaType & KMMessage::dwContentType (  ) 

Return reference to Content-Type header for direct manipulation.

Definition at line 403 of file kmmessage.cpp.

KMMsgEncryptionState KMMessage::encryptionState (  )  const [inline, virtual]

Encryption status of the message.

Implements KMMsgBase.

Definition at line 733 of file kmmessage.h.

AddrSpecList KMMessage::extractAddrSpecs ( const QByteArray &  headerNames  )  const

Definition at line 1905 of file kmmessage.cpp.

QString KMMessage::fcc (  )  const

Get or set the 'Fcc' header field.

Definition at line 1633 of file kmmessage.cpp.

QString KMMessage::fileName ( void   )  const [inline, virtual]

Get/set filename in mail folder.

Implements KMMsgBase.

Definition at line 692 of file kmmessage.h.

DwBodyPart * KMMessage::findDwBodyPart ( DwBodyPart *  part,
const QString &  partSpecifier 
)

Return the first DwBodyPart matching a given partSpecifier or zero, if no found.

Definition at line 3092 of file kmmessage.cpp.

DwBodyPart * KMMessage::findDwBodyPart ( const QByteArray &  type,
const QByteArray &  subtype 
) const

Return the first DwBodyPart matching a given Content-Type or zero, if no found.

Definition at line 2552 of file kmmessage.cpp.

DwBodyPart * KMMessage::findDwBodyPart ( int  type,
int  subtype 
) const

Return the first DwBodyPart matching a given Content-Type or zero, if no found.

Definition at line 2503 of file kmmessage.cpp.

DwBodyPart * KMMessage::findPart ( int  index  ) 

Definition at line 3394 of file kmmessage.cpp.

off_t KMMessage::folderOffset ( void   )  const [inline, virtual]

Get/set offset in mail folder.

Implements KMMsgBase.

Definition at line 688 of file kmmessage.h.

QString KMMessage::from (  )  const

Get or set the 'From' header field.

Definition at line 1667 of file kmmessage.cpp.

void KMMessage::fromDwString ( const DwString &  str,
bool  setStatus = false 
)

Parse the string and create this message from it.

Definition at line 412 of file kmmessage.cpp.

void KMMessage::fromString ( const QByteArray &  ba,
bool  setStatus = false 
)

Definition at line 408 of file kmmessage.cpp.

QString KMMessage::fromStrip ( void   )  const [virtual]

Implements KMMsgBase.

Definition at line 1685 of file kmmessage.cpp.

int KMMessage::getCursorPos (  )  [inline]

Get stored cursor position.

Definition at line 803 of file kmmessage.h.

DwBodyPart * KMMessage::getFirstDwBodyPart (  )  const

Get the 1st DwBodyPart.

If there is no body part, return value will be zero.

Definition at line 2416 of file kmmessage.cpp.

void KMMessage::getLink ( int  n,
ulong *  retMsgSerNum,
MessageStatus &  retStatus 
) const

Returns the information for the Nth link into retMsg and retStatus.

QByteArray KMMessage::getRefStr (  )  const

Creates reference string for reply to messages.

reference = original first reference + original last reference + original msg-id

Definition at line 804 of file kmmessage.cpp.

DwMessage* KMMessage::getTopLevelPart (  )  const [inline]

Definition at line 617 of file kmmessage.h.

bool KMMessage::hasUnencryptedMsg (  )  const [inline]

Returns true if the message contains an unencrypted copy of itself.

Definition at line 132 of file kmmessage.h.

AddressList KMMessage::headerAddrField ( const QByteArray &  name  )  const

Returns header address list as string list.

Valid for the following fields: To, Bcc, Cc, ReplyTo, ResentBcc, ResentCc, ResentReplyTo, ResentTo

Definition at line 1901 of file kmmessage.cpp.

QByteArray KMMessage::headerAsSendableString (  )  const

Return the message header with the headers that should not be sent stripped off.

Definition at line 341 of file kmmessage.cpp.

QString KMMessage::headerAsString (  )  const

Return header as string.

Definition at line 392 of file kmmessage.cpp.

QString KMMessage::headerField ( const QByteArray &  name,
EncodingMode  encodingMode = MessageCharsetEncoding 
) const

Returns the value of a header field with the given name.

If multiple header fields with the given name might exist then you should use headerFields() instead.

Definition at line 1943 of file kmmessage.cpp.

QStringList KMMessage::headerFields ( const QByteArray &  name  )  const

Returns a list of the values of all header fields with the given name.

Definition at line 1962 of file kmmessage.cpp.

DwHeaders & KMMessage::headers (  )  const

get the DwHeaders (make sure to call setNeedsAssembly() function after directly modyfying internal data like the headers)

Definition at line 2215 of file kmmessage.cpp.

QByteArray KMMessage::id (  )  const

Returns the message ID, useful for followups.

Definition at line 241 of file kmmessage.cpp.

uint KMMessage::identityUoid (  )  const
Returns:
the UOID of the identity for this message. Searches the "x-kmail-identity" header and if that fails, searches with KPIMIdentities::IdentityManager::identityForAddress() and if that fails queries the KMMsgBase::parent() folder for a default.

Definition at line 1378 of file kmmessage.cpp.

void KMMessage::initFromMessage ( const KMMessage *  msg,
bool  idHeaders = true 
)

Initialize headers fields according to the identity and the transport header of the given original message.

Definition at line 1393 of file kmmessage.cpp.

void KMMessage::initHeader ( uint  identity = 0  ) 

Initialize header fields.

Should be called on new messages if they are not set manually. E.g. before composing. Calling of setAutomaticFields(), see below, is still required.

Definition at line 1356 of file kmmessage.cpp.

void KMMessage::initStrippedSubjectMD5 (  )  [inline, virtual]

Calculate strippedSubject.

Implements KMMsgBase.

Definition at line 366 of file kmmessage.h.

bool KMMessage::isBeingParsed (  )  const [inline]

Definition at line 810 of file kmmessage.h.

bool KMMessage::isComplete (  )  const [inline]

Return true if the complete message is available without referring to the backing store.

Definition at line 753 of file kmmessage.h.

bool KMMessage::isMessage ( void   )  const [virtual]

Returns true if object is a real message (not KMMsgInfo or KMMsgBase).

Reimplemented from KMMsgBase.

Definition at line 263 of file kmmessage.cpp.

bool KMMessage::isUrgent (  )  const
Returns:
whether the priority: or x-priority headers indicate that this message should be considered urgent

Definition at line 292 of file kmmessage.cpp.

DwBodyPart* KMMessage::lastUpdatedPart (  )  [inline]

Returns the last DwBodyPart that was updated.

Definition at line 750 of file kmmessage.h.

void KMMessage::link ( const KMMessage *  aMsg,
const MessageStatus &  aStatus 
)

Links this message to aMsg, setting link type to aStatus.

QByteArray KMMessage::mboxMessageSeparator (  ) 

Returns an mbox message separator line for this message, i.e.

a string of the form "From local@domain.invalid Sat Jun 12 14:00:00 2004\n".

Definition at line 3326 of file kmmessage.cpp.

KMMsgMDNSentState KMMessage::mdnSentState (  )  const [inline, virtual]

"MDN send" status of the message.

Implements KMMsgBase.

Definition at line 738 of file kmmessage.h.

QString KMMessage::msgId (  )  const

Get or set the 'Message-Id' header field.

Definition at line 1845 of file kmmessage.cpp.

QString KMMessage::msgIdMD5 ( void   )  const [virtual]

Implements KMMsgBase.

Definition at line 1862 of file kmmessage.cpp.

size_t KMMessage::msgLength (  )  const [inline]

Unlike the above function this works also, if the message is not in a folder.

Definition at line 703 of file kmmessage.h.

size_t KMMessage::msgSize ( void   )  const [inline, virtual]

Get/set size of message in the folder including the whole header in bytes.

Can be 0, if the message is not in a folder. The setting of mMsgSize = mMsgLength = sz is needed for popFilter

Implements KMMsgBase.

Definition at line 698 of file kmmessage.h.

size_t KMMessage::msgSizeServer ( void   )  const [virtual]

Get/set size on server.

Implements KMMsgBase.

Definition at line 1875 of file kmmessage.cpp.

int KMMessage::numBodyParts (  )  const

Number of body parts the message has.

This is one for plain messages without any attachment.

Definition at line 2374 of file kmmessage.cpp.

void KMMessage::parseTextStringFromDwPart ( partNode *  root,
QByteArray &  parsedString,
const QTextCodec *&  codec,
bool &  isHTML 
) const

Returns a decoded body part string to be further processed by function asQuotedString().

THIS FUNCTION WILL BE REPLACED ONCE KMime IS FULLY INTEGRATED (khz, June 05 2002)

Definition at line 436 of file kmmessage.cpp.

int KMMessage::partNumber ( DwBodyPart *  aDwBodyPart  )  const

Get the number of the given DwBodyPart.

If no body part is given, return value will be -1.

Definition at line 2423 of file kmmessage.cpp.

const QStringList & KMMessage::preferredCharsets (  )  [static]

Get a list of preferred message charsets.

Definition at line 3364 of file kmmessage.cpp.

QByteArray KMMessage::rawHeaderField ( const QByteArray &  name  )  const

Returns the raw value of a header field with the given name.

If multiple header fields with the given name might exist then you should use rawHeaderFields() instead.

Definition at line 1914 of file kmmessage.cpp.

QList< QByteArray > KMMessage::rawHeaderFields ( const QByteArray &  field  )  const

Returns a list of the raw values of all header fields with the given name.

Definition at line 1929 of file kmmessage.cpp.

void KMMessage::readConfig ( void   )  [static]

Reads config settings from group "KMMessage" and sets all internal variables (e.g.

indent-prefix, etc.)

Reimplemented from KMMsgBase.

Definition at line 2928 of file kmmessage.cpp.

bool KMMessage::readyToShow (  )  const [inline]

Return if the message is ready to be shown.

Definition at line 758 of file kmmessage.h.

QString KMMessage::references (  )  const

Get or set the references for this message.

Definition at line 1788 of file kmmessage.cpp.

void KMMessage::removeHeaderField ( const QByteArray &  name  ) 

Remove header field with given name.

Definition at line 1977 of file kmmessage.cpp.

void KMMessage::removeHeaderFields ( const QByteArray &  name  ) 

Remove all header fields with given name.

Definition at line 1988 of file kmmessage.cpp.

void KMMessage::removePrivateHeaderFields (  ) 

Remove all private header fields: *Status: and X-KMail-*.

Definition at line 349 of file kmmessage.cpp.

QString KMMessage::replaceHeadersInString ( const QString &  s  )  const

Replaces every occurrence of "${foo}" in s with headerField("foo").

Definition at line 1251 of file kmmessage.cpp.

QString KMMessage::replyTo (  )  const

Get or set the 'ReplyTo' header field.

Definition at line 1571 of file kmmessage.cpp.

QString KMMessage::replyToAuxIdMD5 (  )  const [virtual]

Get the second to last id from the References header field.

If outgoing messages are not kept in the same folder as incoming ones, this will be a good place to thread the message beneath. bob <- second to last reference points to this |_kmailuser <- not in our folder, but Outbox |_bob <- In-Reply-To points to our mail above

Thread like this: bob |_bob

using replyToAuxIdMD5

Implements KMMsgBase.

Definition at line 1809 of file kmmessage.cpp.

QString KMMessage::replyToId (  )  const

Get or set the 'In-Reply-To' header field.

Definition at line 1742 of file kmmessage.cpp.

QString KMMessage::replyToIdMD5 ( void   )  const [virtual]

Implements KMMsgBase.

Definition at line 1783 of file kmmessage.cpp.

void KMMessage::sanitizeHeaders ( const QStringList &  whiteList = QStringList()  ) 

Remove all headers but the content description ones, and those in the white list.

Definition at line 881 of file kmmessage.cpp.

QString KMMessage::sender (  )  const
Returns:
The addr-spec of either the Sender: (if one is given) or the first addr-spec in From:

Definition at line 1691 of file kmmessage.cpp.

void KMMessage::setAutomaticFields ( bool  isMultipart = false  ) 

Set fields that are either automatically set (Message-id) or that do not change from one message to another (MIME-Version).

Call this method before sending *after* all changes to the message are done because this method does things different if there are attachments / multiple body parts.

Definition at line 1428 of file kmmessage.cpp.

void KMMessage::setBcc ( const QString &  aStr  ) 

Definition at line 1627 of file kmmessage.cpp.

void KMMessage::setBody ( const QByteArray &  aStr  ) 

Set the message body.

Does not encode the body.

Definition at line 2352 of file kmmessage.cpp.

void KMMessage::setBodyAndGuessCte ( const QByteArray &  aBuf,
QList< int > &  allowedCte,
bool  allow8Bit = false,
bool  willBeSigned = false,
DwEntity *  entity = 0 
)

Sets body, encoded in the best fitting content-transfer-encoding, which is determined by character frequency count.

Parameters:
aBuf input buffer
allowedCte return: list of allowed cte's
allow8Bit whether "8bit" is allowed as cte.
willBeSigned whether "7bit"/"8bit" is allowed as cte according to RFC 3156
entity The body of this message or body part will get changed. If this is 0, the body of the toplevel message will be set.

Definition at line 2300 of file kmmessage.cpp.

void KMMessage::setBodyEncoded ( const QByteArray &  aStr  ) 

Set the message body, encoding it according to the current content transfer encoding.

The first method for null terminated strings, the second for binary data.

Parameters:
entity Specifies the body part or message of which the body will be set. If this is 0, the body of the toplevel message will be set.

Definition at line 2316 of file kmmessage.cpp.

void KMMessage::setBodyEncodedBinary ( const QByteArray &  bodyStr,
DwEntity *  entity = 0 
)

Definition at line 2323 of file kmmessage.cpp.

void KMMessage::setBodyFromUnicode ( const QString &  str,
DwEntity *  entity = 0 
)

Sets this body's content to str.

str is subject to automatic charset and CTE detection.

Parameters:
entity The body of this entity will be changed. If entity is 0, the body of the whole message will be changed.

Definition at line 3277 of file kmmessage.cpp.

void KMMessage::setCc ( const QString &  aStr  ) 

Definition at line 1606 of file kmmessage.cpp.

void KMMessage::setCharset ( const QByteArray &  charset,
DwEntity *  entity = 0 
)

Sets the charset of the message or a subpart of the message.

Only call this when the message or the subpart has a textual mimetype.

Parameters:
aStr the MIME-compliant charset name, like 'ISO-88519-15'.
entity the body part or message of which the charset should be changed. If this is 0, the charset of the toplevel message will be changed.

Definition at line 2971 of file kmmessage.cpp.

void KMMessage::setComplete ( bool  v  )  [inline]

Set if the message is a complete message.

Definition at line 755 of file kmmessage.h.

void KMMessage::setContentTransferEncoding ( int  cte,
DwEntity *  entity = 0 
)

Definition at line 2204 of file kmmessage.cpp.

void KMMessage::setContentTransferEncodingStr ( const QByteArray &  cteString,
DwEntity *  entity = 0 
)

Definition at line 2191 of file kmmessage.cpp.

void KMMessage::setContentTypeParam ( const QByteArray &  attr,
const QByteArray &  val 
)

add or change a parameter of the Content-Type field

Definition at line 2158 of file kmmessage.cpp.

void KMMessage::setCte ( int  aCte,
DwEntity *  entity = 0 
) [inline]

Definition at line 528 of file kmmessage.h.

void KMMessage::setCteStr ( const QByteArray &  aStr,
DwEntity *  entity = 0 
) [inline]

Definition at line 525 of file kmmessage.h.

void KMMessage::setCursorPos ( int  pos  )  [inline]

Set cursor position as offset from message start.

Definition at line 805 of file kmmessage.h.

void KMMessage::setDate ( time_t  aUnixTime  )  [virtual]

Implements KMMsgBase.

Definition at line 1520 of file kmmessage.cpp.

void KMMessage::setDate ( const QByteArray &  aStrDate  )  [virtual]

Set date.

Reimplemented from KMMsgBase.

Definition at line 1531 of file kmmessage.cpp.

void KMMessage::setDateToday (  ) 

Set the 'Date' header field to the current date.

Definition at line 1511 of file kmmessage.cpp.

void KMMessage::setDecodeHTML ( bool  aDecodeHTML  )  [inline]

Allow decoding of HTML for quoting.

Definition at line 675 of file kmmessage.h.

void KMMessage::setDrafts ( const QString &  aStr  ) 

Definition at line 1646 of file kmmessage.cpp.

void KMMessage::setDwMediaTypeParam ( DwMediaType &  mType,
const QByteArray &  attr,
const QByteArray &  val 
) [static]

add or change a parameter of a DwMediaType field

Definition at line 2133 of file kmmessage.cpp.

void KMMessage::setEncryptionState ( const KMMsgEncryptionState  s,
int  idx = -1 
) [virtual]

Set encryption status of the message.

Reimplemented from KMMsgBase.

Definition at line 3017 of file kmmessage.cpp.

void KMMessage::setFcc ( const QString &  aStr  ) 

Definition at line 1640 of file kmmessage.cpp.

void KMMessage::setFileName ( const QString &  file  )  [inline, virtual]

Implements KMMsgBase.

Definition at line 693 of file kmmessage.h.

void KMMessage::setFolderOffset ( off_t  offs  )  [inline, virtual]

Implements KMMsgBase.

Definition at line 689 of file kmmessage.h.

void KMMessage::setFrom ( const QString &  aStr  ) 

Definition at line 1674 of file kmmessage.cpp.

void KMMessage::setHeaderField ( const QByteArray &  name,
const QString &  value,
HeaderFieldType  type = Unstructured,
bool  prepend = false,
EncodingMode  encodingMode = MessageCharsetEncoding 
)

Set the header field with the given name to the given value.

If prepend is set to true, the header is inserted at the beginning and does not overwrite an existing header field with the same name.

Definition at line 1999 of file kmmessage.cpp.

void KMMessage::setIsBeingParsed ( bool  t  )  [inline]

Definition at line 811 of file kmmessage.h.

void KMMessage::setMDNSentState ( KMMsgMDNSentState  status,
int  idx = -1 
) [virtual]

Set "MDN sent" status of the message.

Reimplemented from KMMsgBase.

Definition at line 3035 of file kmmessage.cpp.

void KMMessage::setMsgId ( const QString &  aStr  ) 

Definition at line 1868 of file kmmessage.cpp.

void KMMessage::setMsgLength ( size_t  sz  )  [inline]

Definition at line 705 of file kmmessage.h.

void KMMessage::setMsgSerNum ( unsigned long  newMsgSerNum = 0  ) 

Sets the message serial number.

If defaulted to zero, the serial number will be assigned using the dictionary. Note that unless it is explicitly set the serial number will remain 0 as long as the mail is not in a folder.

Definition at line 256 of file kmmessage.cpp.

void KMMessage::setMsgSize ( size_t  sz  )  [inline, virtual]

Implements KMMsgBase.

Definition at line 699 of file kmmessage.h.

void KMMessage::setMsgSizeServer ( size_t  sz  )  [virtual]

Implements KMMsgBase.

Definition at line 1881 of file kmmessage.cpp.

void KMMessage::setMultiPartBody ( const QByteArray &  aStr  ) 

Hack to enable structured body parts to be set as flat text.

..

Definition at line 2359 of file kmmessage.cpp.

void KMMessage::setNeedsAssembly (  ) 

tell the message that internal data were changed (must be called after directly modifying message structures e.g.

when like changing header information by accessing the header via headers() function)

Definition at line 2222 of file kmmessage.cpp.

void KMMessage::setOverrideCodec ( const QTextCodec *  codec  )  [inline]

Set the charset the user selected for the message to display.

Definition at line 672 of file kmmessage.h.

void KMMessage::setReadyToShow ( bool  v  )  [inline]

Set if the message is ready to be shown.

Definition at line 760 of file kmmessage.h.

void KMMessage::setReferences ( const QByteArray &  aStr  ) 

Definition at line 232 of file kmmessage.cpp.

void KMMessage::setReplyTo ( KMMessage *  aMsg  ) 

Definition at line 1585 of file kmmessage.cpp.

void KMMessage::setReplyTo ( const QString &  aStr  ) 

Definition at line 1578 of file kmmessage.cpp.

void KMMessage::setReplyToId ( const QString &  aStr  ) 

Definition at line 1837 of file kmmessage.cpp.

void KMMessage::setSignatureState ( const  KMMsgSignatureState,
int  idx = -1 
) [virtual]

Set signature status of the message.

Reimplemented from KMMsgBase.

Definition at line 3026 of file kmmessage.cpp.

void KMMessage::setStatus ( const char *  s1,
const char *  s2 = 0 
) [inline, virtual]

Reimplemented from KMMsgBase.

Definition at line 719 of file kmmessage.h.

void KMMessage::setStatus ( const MessageStatus &  status,
int  idx = -1 
) [virtual]

Set status and mark dirty.

Reimplemented from KMMsgBase.

void KMMessage::setStatusFields (  ) 

Set "Status" and "X-Status" fields of the message from the internal message status.

Definition at line 365 of file kmmessage.cpp.

void KMMessage::setSubject ( const QString &   )  [virtual]

Set subject/from/date and xmark.

Implements KMMsgBase.

Definition at line 1708 of file kmmessage.cpp.

void KMMessage::setSubtype ( int  aSubtype  ) 

Definition at line 2124 of file kmmessage.cpp.

void KMMessage::setSubtypeStr ( const QByteArray &  aStr  ) 

Definition at line 2115 of file kmmessage.cpp.

void KMMessage::setTemplates ( const QString &  aStr  ) 

Definition at line 1652 of file kmmessage.cpp.

void KMMessage::setTo ( const QString &  aStr  ) 

Definition at line 1559 of file kmmessage.cpp.

void KMMessage::setTransferInProgress ( bool  value,
bool  force = false 
)

Set that the message shall not be deleted because it is still required.

Definition at line 276 of file kmmessage.cpp.

void KMMessage::setType ( int  aType  ) 

Definition at line 2087 of file kmmessage.cpp.

void KMMessage::setTypeStr ( const QByteArray &  aStr  ) 

Definition at line 2078 of file kmmessage.cpp.

void KMMessage::setUID ( ulong  uid  )  [virtual]

Implements KMMsgBase.

Definition at line 1894 of file kmmessage.cpp.

void KMMessage::setUnencryptedMsg ( KMMessage *  unencrypted  ) 

Specifies an unencrypted copy of this message to be stored in a separate member variable to allow saving messages in unencrypted form that were sent in encrypted form.

NOTE: Ownership of unencrypted transfers to this KMMessage, and it will be deleted in the d'tor.

Definition at line 299 of file kmmessage.cpp.

void KMMessage::setXMark ( const QString &  aStr  )  [virtual]

Implements KMMsgBase.

Definition at line 1734 of file kmmessage.cpp.

KMMsgSignatureState KMMessage::signatureState (  )  const [inline, virtual]

Signature status of the message.

Implements KMMsgBase.

Definition at line 736 of file kmmessage.h.

MessageStatus& KMMessage::status (  )  const [inline, virtual]

Status of the message.

Reimplemented from KMMsgBase.

Definition at line 716 of file kmmessage.h.

QString KMMessage::strippedSubjectMD5 (  )  const [virtual]

Get a hash of the subject with all prefixes such as Re: removed.

Used for threading.

Implements KMMsgBase.

Definition at line 1822 of file kmmessage.cpp.

QString KMMessage::subject ( void   )  const [virtual]

Get or set the 'Subject' header field.

Implements KMMsgBase.

Definition at line 1701 of file kmmessage.cpp.

bool KMMessage::subjectIsPrefixed (  )  const [virtual]

Is the subject prefixed by Re: or similar?

Implements KMMsgBase.

Definition at line 1832 of file kmmessage.cpp.

QString KMMessage::subjectMD5 (  )  const

Get a hash of the subject.

Used for threading.

Definition at line 1827 of file kmmessage.cpp.

int KMMessage::subtype (  )  const

Definition at line 2106 of file kmmessage.cpp.

QByteArray KMMessage::subtypeStr (  )  const

Subtype.

Definition at line 2097 of file kmmessage.cpp.

KMMessageTagList * KMMessage::tagList ( void   )  const [virtual]

Get a pointer to the tag label list.

Implements KMMsgBase.

Definition at line 1724 of file kmmessage.cpp.

QString KMMessage::tagString ( void   )  const [virtual]

Get a comma separated list of tag labels.

Implements KMMsgBase.

Definition at line 1717 of file kmmessage.cpp.

KMMessage* KMMessage::takeUnencryptedMsg (  )  [inline]

Returns an unencrypted copy of this message or 0 if none exists.

Note:
This function removes the internal unencrypted message pointer from the message: the process calling takeUnencryptedMsg() must delete the returned pointer when no longer needed.

Definition at line 142 of file kmmessage.h.

QString KMMessage::templates (  )  const [inline]

Get or set the 'Templates' folder.

Definition at line 344 of file kmmessage.h.

QString KMMessage::to (  )  const

Get or set the 'To' header field.

Definition at line 1546 of file kmmessage.cpp.

const KMMsgBase& KMMessage::toMsgBase (  )  const [inline]

Definition at line 113 of file kmmessage.h.

KMMsgBase& KMMessage::toMsgBase (  )  [inline]

Get KMMsgBase for this object.

Definition at line 112 of file kmmessage.h.

QString KMMessage::toStrip ( void   )  const [virtual]

Implements KMMsgBase.

Definition at line 1565 of file kmmessage.cpp.

void KMMessage::touch (  )  [inline]

Touch the message - mark it as read.

Definition at line 156 of file kmmessage.h.

bool KMMessage::transferInProgress (  )  const

Return, if the message should not be deleted.

Definition at line 269 of file kmmessage.cpp.

int KMMessage::type ( DwEntity *  entity = 0  )  const

Definition at line 2066 of file kmmessage.cpp.

QByteArray KMMessage::typeStr (  )  const

Get or set the 'Content-Type' header field The member functions that involve enumerated types (ints) will work only for well-known types or subtypes.

Definition at line 2057 of file kmmessage.cpp.

ulong KMMessage::UID ( void   )  const [virtual]

Get/set UID.

Implements KMMsgBase.

Definition at line 1888 of file kmmessage.cpp.

void KMMessage::undel (  )  [inline]

Undelete the message.

Same as touch

Definition at line 153 of file kmmessage.h.

KMMessage* KMMessage::unencryptedMsg (  )  const [inline]

Returns an unencrypted copy of this message or 0 if none exists.

Definition at line 135 of file kmmessage.h.

void KMMessage::updateAttachmentState ( DwBodyPart *  part = 0  ) 

Definition at line 3198 of file kmmessage.cpp.

void KMMessage::updateBodyPart ( const QString  partSpecifier,
const QByteArray &  data 
)

Sets the body of the specified part.

Definition at line 3124 of file kmmessage.cpp.

QString KMMessage::who (  )  const

Get or set the 'Who' header field.

The actual field that is returned depends on the contents of the owning folders whoField(). Usually this is 'From', but it can also contain 'To'.

Definition at line 1658 of file kmmessage.cpp.

QString KMMessage::xmark ( void   )  const [virtual]

Get or set the 'X-Mark' header field.

Implements KMMsgBase.

Definition at line 1727 of file kmmessage.cpp.


The documentation for this class was generated from the following files:
  • kmmessage.h
  • kmmessage.cpp

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   akonadi_next
  •   clients
  •   kcal
  •   kcm
  •       libmaildir
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
Generated for kdepim by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal