kmail
KMMessage Class Reference
#include <kmmessage.h>
Inheritance diagram for KMMessage:

Detailed Description
This is a Mime Message.
Definition at line 67 of file kmmessage.h.
Public Types | |
| Unstructured | |
| Structured | |
| Address | |
| enum | HeaderFieldType { Unstructured, Structured, Address } |
Public Member Functions | |
| KMMessage (KMFolder *parent=0) | |
| KMMessage (DwMessage *) | |
| KMMessage (KMMsgInfo &msgInfo) | |
| KMMessage (const KMMessage &other) | |
| virtual | ~KMMessage () |
| KMMsgBase & | toMsgBase () |
| const KMMsgBase & | toMsgBase () const |
| bool | isMessage () const |
| bool | isUrgent () const |
| void | setUnencryptedMsg (KMMessage *unencrypted) |
| bool | hasUnencryptedMsg () const |
| KMMessage * | unencryptedMsg () const |
| KMMessage * | takeUnencryptedMsg () |
| void | del () |
| void | undel () |
| void | touch () |
| KMMessage * | createReply (KMail::ReplyStrategy replyStrategy=KMail::ReplySmart, QString selection=QString::null, bool noQuote=FALSE, bool allowDecryption=TRUE, bool selectionIsBody=FALSE) |
| KMMessage * | createRedirect (const QString &toStr) |
| QCString | createForwardBody () |
| KMMessage * | createForward () |
| KMMessage * | createDeliveryReceipt () const |
| KMMessage * | createMDN (KMime::MDN::ActionMode a, KMime::MDN::DispositionType d, bool allowGUI=false, QValueList< KMime::MDN::DispositionModifier > m=QValueList< KMime::MDN::DispositionModifier >()) |
| void | fromDwString (const DwString &str, bool setStatus=FALSE) |
| void | fromString (const QCString &str, bool setStatus=FALSE) |
| void | fromByteArray (const QByteArray &ba, bool setStatus=false) |
| const DwString & | asDwString () const |
| const DwMessage * | asDwMessage () |
| QCString | asString () const |
| QCString | asSendableString () const |
| QCString | headerAsSendableString () const |
| void | removePrivateHeaderFields () |
| DwMediaType & | dwContentType () |
| QString | headerAsString () const |
| void | parseTextStringFromDwPart (partNode *root, QCString &parsedString, const QTextCodec *&codec, bool &isHTML) const |
| void | initHeader (uint identity=0) |
| void | initFromMessage (const KMMessage *msg, bool idHeaders=TRUE) |
| uint | identityUoid () const |
| void | applyIdentity (uint id) |
| void | cleanupHeader () |
| void | setAutomaticFields (bool isMultipart=FALSE) |
| QString | dateStr () const |
| QCString | dateShortStr () const |
| QString | dateIsoStr () const |
| time_t | date () const |
| void | setDate (const QCString &str) |
| void | setDate (time_t aUnixTime) |
| void | setDateToday () |
| QString | to () const |
| void | setTo (const QString &aStr) |
| QString | toStrip () const |
| QString | replyTo () const |
| void | setReplyTo (const QString &aStr) |
| void | setReplyTo (KMMessage *) |
| QString | cc () const |
| void | setCc (const QString &aStr) |
| QString | ccStrip () const |
| QString | bcc () const |
| void | setBcc (const QString &aStr) |
| QString | fcc () const |
| void | setFcc (const QString &aStr) |
| QString | drafts () const |
| void | setDrafts (const QString &aStr) |
| QString | from () const |
| void | setFrom (const QString &aStr) |
| QString | fromStrip () const |
| QString | sender () const |
| QString | who () const |
| QString | subject () const |
| void | setSubject (const QString &aStr) |
| void | initStrippedSubjectMD5 () |
| QString | xmark () const |
| void | setXMark (const QString &aStr) |
| QString | replyToId () const |
| void | setReplyToId (const QString &aStr) |
| QString | replyToIdMD5 () const |
| QString | replyToAuxIdMD5 () const |
| QString | strippedSubjectMD5 () const |
| QString | subjectMD5 () const |
| bool | subjectIsPrefixed () const |
| QString | msgId () const |
| void | setMsgId (const QString &aStr) |
| QString | msgIdMD5 () const |
| QString | references () const |
| void | setReferences (const QCString &aStr) |
| QCString | id () const |
| void | setMsgSerNum (unsigned long newMsgSerNum=0) |
| QString | headerField (const QCString &name) const |
| void | setHeaderField (const QCString &name, const QString &value, HeaderFieldType type=Unstructured, bool prepend=false) |
| QStringList | headerFields (const QCString &name) const |
| QCString | rawHeaderField (const QCString &name) const |
| QValueList< QCString > | rawHeaderFields (const QCString &field) const |
| KMime::Types::AddressList | headerAddrField (const QCString &name) const |
| KMime::Types::AddrSpecList | extractAddrSpecs (const QCString &headerNames) const |
| void | removeHeaderField (const QCString &name) |
| QCString | typeStr () const |
| int | type () const |
| void | setTypeStr (const QCString &aStr) |
| void | setType (int aType) |
| QCString | subtypeStr () const |
| int | subtype () const |
| void | setSubtypeStr (const QCString &aStr) |
| void | setSubtype (int aSubtype) |
| void | setContentTypeParam (const QCString &attr, const QCString &val) |
| DwHeaders & | headers () const |
| void | setNeedsAssembly () |
| QCString | contentTransferEncodingStr () const |
| int | contentTransferEncoding () const |
| void | setContentTransferEncodingStr (const QCString &aStr) |
| void | setContentTransferEncoding (int aCte) |
| QCString | cteStr () const |
| int | cte () const |
| void | setCteStr (const QCString &aStr) |
| void | setCte (int aCte) |
| void | setBodyFromUnicode (const QString &str) |
| QString | bodyToUnicode (const QTextCodec *codec=0) const |
| QCString | body () const |
| void | setBody (const QCString &aStr) |
| void | setMultiPartBody (const QCString &aStr) |
| void | setBodyEncoded (const QCString &aStr) |
| void | setBodyEncodedBinary (const QByteArray &aStr) |
| void | setBodyAndGuessCte (const QByteArray &aBuf, QValueList< int > &allowedCte, bool allow8Bit=false, bool willBeSigned=false) |
| void | setBodyAndGuessCte (const QCString &aBuf, QValueList< int > &allowedCte, bool allow8Bit=false, bool willBeSigned=false) |
| QCString | bodyDecoded () const |
| QByteArray | bodyDecodedBinary () const |
| int | numBodyParts () const |
| DwBodyPart * | findDwBodyPart (int type, int subtype) const |
| DwBodyPart * | findDwBodyPart (DwBodyPart *part, const QString &partSpecifier) |
| DwBodyPart * | dwBodyPart (int aIdx) const |
| int | partNumber (DwBodyPart *aDwBodyPart) const |
| DwBodyPart * | getFirstDwBodyPart () const |
| DwMessage * | getTopLevelPart () const |
| void | bodyPart (int aIdx, KMMessagePart *aPart) const |
| DwBodyPart * | createDWBodyPart (const KMMessagePart *aPart) |
| void | addDwBodyPart (DwBodyPart *aDwPart) |
| void | addBodyPart (const KMMessagePart *aPart) |
| void | deleteBodyParts () |
| void | setStatusFields () |
| QString | replaceHeadersInString (const QString &s) const |
| QCString | charset () const |
| void | setCharset (const QCString &aStr) |
| const QTextCodec * | codec () const |
| void | setOverrideCodec (const QTextCodec *codec) |
| void | setDecodeHTML (bool aDecodeHTML) |
| QCString | getRefStr () const |
| off_t | folderOffset () const |
| void | setFolderOffset (off_t offs) |
| QString | fileName () const |
| void | setFileName (const QString &file) |
| size_t | msgSize () const |
| void | setMsgSize (size_t sz) |
| size_t | msgLength () const |
| void | setMsgLength (size_t sz) |
| size_t | msgSizeServer () const |
| void | setMsgSizeServer (size_t sz) |
| ulong | UID () const |
| void | setUID (ulong uid) |
| KMMsgStatus | status () const |
| void | setStatus (const KMMsgStatus status, int idx=-1) |
| void | setStatus (const char *s1, const char *s2=0) |
| void | setEncryptionState (const KMMsgEncryptionState, int idx=-1) |
| void | setSignatureState (const KMMsgSignatureState, int idx=-1) |
| void | setMDNSentState (KMMsgMDNSentState status, int idx=-1) |
| KMMsgEncryptionState | encryptionState () const |
| KMMsgSignatureState | signatureState () const |
| KMMsgMDNSentState | mdnSentState () const |
| void | link (const KMMessage *aMsg, KMMsgStatus aStatus) |
| void | getLink (int n, ulong *retMsgSerNum, KMMsgStatus *retStatus) const |
| QString | formatString (const QString &) const |
| void | updateBodyPart (const QString partSpecifier, const QByteArray &data) |
| DwBodyPart * | lastUpdatedPart () |
| bool | isComplete () const |
| void | setComplete (bool v) |
| bool | readyToShow () const |
| void | setReadyToShow (bool v) |
| void | updateAttachmentState (DwBodyPart *part=0) |
| bool | transferInProgress () const |
| void | setTransferInProgress (bool value, bool force=false) |
| QCString | mboxMessageSeparator () |
| QString | asQuotedString (const QString &headerStr, const QString &indentStr, const QString &selection=QString::null, bool aStripSignature=true, bool allowDecryption=true) const |
| QString | asPlainText (bool stripSignature, bool allowDecryption) const |
Static Public Member Functions | |
| static KPIM::EmailParseResult | isValidEmailAddressList (const QString &aStr, QString &brokenAddress) |
| static KMime::Types::AddressList | splitAddrField (const QCString &str) |
| static void | setDwMediaTypeParam (DwMediaType &mType, const QCString &attr, const QCString &val) |
| static QValueList< int > | determineAllowedCtes (const KMime::CharFreq &cf, bool allow8Bit, bool willBeSigned) |
| static void | bodyPart (DwBodyPart *aDwBodyPart, KMMessagePart *aPart, bool withBody=true) |
| static QString | generateMessageId (const QString &addr) |
| static QCString | html2source (const QCString &src) |
| static QString | encodeMailtoUrl (const QString &str) |
| static QString | decodeMailtoUrl (const QString &url) |
| static QCString | stripEmailAddr (const QCString &emailAddr) |
| static QString | stripEmailAddr (const QString &emailAddr) |
| static QString | quoteHtmlChars (const QString &str, bool removeLineBreaks=false) |
| static QString | emailAddrAsAnchor (const QString &emailAddr, bool stripped=TRUE) |
| static QStringList | stripAddressFromAddressList (const QString &address, const QStringList &addresses) |
| static QStringList | stripMyAddressesFromAddressList (const QStringList &list) |
| static bool | addressIsInAddressList (const QString &address, const QStringList &addresses) |
| static QString | expandAliases (const QString &recipients) |
| static QString | guessEmailAddressFromLoginName (const QString &userName) |
| static QString | smartQuote (const QString &msg, int maxLineLength) |
| static QCString | defaultCharset () |
| static const QStringList & | preferredCharsets () |
| static void | readConfig () |
Friends | |
| class | ::KMForwardDigestCommand |
Constructor & Destructor Documentation
| KMMessage::KMMessage | ( | KMFolder * | parent = 0 |
) |
| KMMessage::KMMessage | ( | DwMessage * | ) |
Constructor from a DwMessage.
KMMessage takes possession of the DwMessage, so don't dare to delete it.
Definition at line 88 of file kmmessage.cpp.
| KMMessage::KMMessage | ( | KMMsgInfo & | msgInfo | ) |
Copy constructor.
Does *not* automatically load the message.
Definition at line 114 of file kmmessage.cpp.
| KMMessage::KMMessage | ( | const KMMessage & | other | ) |
| KMMessage::~KMMessage | ( | ) | [virtual] |
Member Function Documentation
| void KMMessage::addBodyPart | ( | const KMMessagePart * | aPart | ) |
| void KMMessage::addDwBodyPart | ( | DwBodyPart * | aDwPart | ) |
| bool KMMessage::addressIsInAddressList | ( | const QString & | address, | |
| const QStringList & | addresses | |||
| ) | [static] |
Returns true if the given address is contained in the given address list.
Definition at line 3663 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 1565 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 283 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 736 of file kmmessage.cpp.
| QString KMMessage::asQuotedString | ( | const QString & | headerStr, | |
| const QString & | indentStr, | |||
| const QString & | selection = QString::null, |
|||
| bool | aStripSignature = true, |
|||
| bool | allowDecryption = true | |||
| ) | const |
Returns message body with quoting header and indented by the given indentation string.
This is suitable for including the message in another message of for replies, forwards. The header string is a template where the following fields are replaced with the corresponding values:
D: date of this message
S: subject of this message
F: sender (from) of this message
%%: a single percent sign
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 813 of file kmmessage.cpp.
| QCString KMMessage::asSendableString | ( | ) | const |
Return the message contents with the headers that should not be sent stripped off.
Definition at line 310 of file kmmessage.cpp.
| QCString 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 305 of file kmmessage.cpp.
| QString KMMessage::bcc | ( | ) | const |
| QCString KMMessage::body | ( | ) | const |
| QCString 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 2455 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 2937 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 2886 of file kmmessage.cpp.
| QString KMMessage::bodyToUnicode | ( | const QTextCodec * | codec = 0 |
) | const |
| QString KMMessage::cc | ( | ) | const |
| QCString KMMessage::charset | ( | ) | const |
| void KMMessage::cleanupHeader | ( | ) |
Removes empty fields from the header, e.g.
an empty Cc: or Bcc: field.
Definition at line 1651 of file kmmessage.cpp.
| const QTextCodec * KMMessage::codec | ( | ) | const |
| QCString 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.
Definition at line 2367 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 1538 of file kmmessage.cpp.
| DwBodyPart * KMMessage::createDWBodyPart | ( | const KMMessagePart * | aPart | ) |
Compose a DwBodyPart (needed for adding a part to the message).
Definition at line 2959 of file kmmessage.cpp.
| KMMessage * KMMessage::createForward | ( | ) |
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 1173 of file kmmessage.cpp.
| QCString KMMessage::createForwardBody | ( | ) |
| KMMessage* KMMessage::createMDN | ( | KMime::MDN::ActionMode | a, | |
| KMime::MDN::DispositionType | d, | |||
| bool | allowGUI = false, |
|||
| QValueList< KMime::MDN::DispositionModifier > | m = QValueList< 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.
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 1091 of file kmmessage.cpp.
| KMMessage * KMMessage::createReply | ( | KMail::ReplyStrategy | replyStrategy = KMail::ReplySmart, |
|
| QString | selection = QString::null, |
|||
| bool | noQuote = FALSE, |
|||
| bool | allowDecryption = TRUE, |
|||
| bool | selectionIsBody = FALSE | |||
| ) |
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.
Definition at line 841 of file kmmessage.cpp.
| QCString KMMessage::cteStr | ( | ) | const [inline] |
Cte is short for ContentTransferEncoding.
These functions are an alternative to the ones with longer names.
Definition at line 505 of file kmmessage.h.
| QCString KMMessage::dateShortStr | ( | ) | const |
Returns the message date in asctime format or an empty string if the message lacks a Date header.
Definition at line 1712 of file kmmessage.cpp.
| QString KMMessage::dateStr | ( | ) | const [virtual] |
Get or set the 'Date' header field.
Reimplemented from KMMsgBase.
Definition at line 1694 of file kmmessage.cpp.
| QCString KMMessage::defaultCharset | ( | ) | [static] |
| void KMMessage::del | ( | ) | [inline] |
| void KMMessage::deleteBodyParts | ( | ) |
| static QValueList<int> KMMessage::determineAllowedCtes | ( | const KMime::CharFreq & | cf, | |
| bool | allow8Bit, | |||
| bool | willBeSigned | |||
| ) | [static] |
Returns a list of content-transfer-encodings that can be used with the given result of the character frequency analysis of a message or message part under the given restrictions.
| QString KMMessage::drafts | ( | ) | const [inline] |
| 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 2735 of file
