kmail

kmmessage.h
1 /* kmmessage.h: Mime Message Class
2  *
3  */
4 #ifndef kmmessage_h
5 #define kmmessage_h
6 
9 // for large file support
10 #include <config.h>
11 #include <sys/types.h>
12 
13 #include <mimelib/string.h>
14 #include "kmmsgbase.h"
15 #include "isubject.h"
16 
17 #include <kmime_mdn.h>
18 
19 #include<libemailfunctions/email.h>
20 
21 template <typename T>
22 class TQValueList;
23 
24 class TQStringList;
25 class TQString;
26 class TQTextCodec;
27 class TQStrList;
28 
29 class KMFolder;
30 class KMFolderIndex;
31 class DwMessage;
32 class KMMessagePart;
33 class KMMsgInfo;
34 class KMHeaders;
35 class KMForwardDigestCommand;
36 
37 namespace KMime {
38  class CharFreq;
39  namespace Types {
40  class AddrSpec;
41  class Address;
42  typedef TQValueList<Address> AddressList;
43  typedef TQValueList<AddrSpec> AddrSpecList;
44  }
45 }
46 
47 namespace KMail {
48  class HeaderStrategy;
49 }
50 
51 class DwEntity;
52 class DwBodyPart;
53 class DwMediaType;
54 class DwHeaders;
55 
56 class partNode;
57 
58 namespace KMail {
59  enum ReplyStrategy { ReplySmart = 0,
60  ReplyAuthor,
61  ReplyList,
62  ReplyAll,
63  ReplyNone };
64 }
65 
67 class KMMessage: public KMMsgBase, public KMail::ISubject
68 {
69  friend class ::KMForwardDigestCommand; // needed for MIME Digest forward
70 
71 public:
72  // promote some of KMMsgBase's methods to public:
73  using KMMsgBase::parent;
74  using KMMsgBase::setParent;
75  using KMMsgBase::enableUndo; // KMFolder
76  using KMMsgBase::setEnableUndo; // dto.
77  using KMMsgBase::isRead; // dto.
78  using KMMsgBase::isUnread; // dto.
79  using KMMsgBase::isNew; // dto.
80  using KMMsgBase::isOld;
81  using KMMsgBase::isWatched;
82  using KMMsgBase::isIgnored;
83  using KMMsgBase::setEncryptionStateChar; // KMAcct*
84  using KMMsgBase::setSignatureStateChar; // dto.
85 
87  KMMessage(KMFolder* parent=0);
88 
92  KMMessage(DwMessage*);
93 
95  KMMessage(KMMsgInfo& msgInfo);
96 
98  KMMessage( const KMMessage& other );
99 
100 #if 0 // currently unused
101 
102  const KMMessage& operator=( const KMMessage& other ) {
103  if( &other == this )
104  return *this;
105  assign( other );
106  return *this;
107  }
108 #endif
109 
111  virtual ~KMMessage();
112 
114  KMMsgBase & toMsgBase() { return *this; }
115  const KMMsgBase & toMsgBase() const { return *this; }
116 
118  bool isMessage() const;
119 
123  bool isUrgent() const;
124 
131  void setUnencryptedMsg( KMMessage* unencrypted );
132 
134  bool hasUnencryptedMsg() const { return 0 != mUnencryptedMsg; }
135 
137  KMMessage* unencryptedMsg() const { return mUnencryptedMsg; }
138 
145  {
146  KMMessage* ret = mUnencryptedMsg;
147  mUnencryptedMsg = 0;
148  return ret;
149  }
150 
152  void del() { setStatus(KMMsgStatusDeleted); }
153 
155  void undel() { setStatus(KMMsgStatusOld); }
156 
158  void touch() { setStatus(KMMsgStatusOld); }
159 
163  KMMessage* createReply( KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
164  TQString selection=TQString(), bool noQuote = false,
165  bool allowDecryption = true,
166  const TQString &tmpl = TQString(),
167  const TQString &originatingAccount = TQString() );
168 
176  KMMessage* createRedirect( const TQString &toStr );
177 
179  TQCString createForwardBody();
180 
184  KMMessage* createForward( const TQString &tmpl = TQString() );
185 
190 
204  KMMessage* createMDN( KMime::MDN::ActionMode a,
205  KMime::MDN::DispositionType d,
206  bool allowGUI=false,
207  TQValueList<KMime::MDN::DispositionModifier> m=TQValueList<KMime::MDN::DispositionModifier>() );
208 
210  void sanitizeHeaders( const TQStringList& whiteList = TQStringList() );
211 
213  void fromDwString(const DwString& str, bool setStatus=false);
214  void fromString(const TQCString& str, bool setStatus=false);
215  void fromByteArray(const TQByteArray & ba, bool setStatus=false);
216 
221  const DwString& asDwString() const;
222  const DwMessage *asDwMessage();
223 
231  TQCString asString() const;
232 
237  TQByteArray asSendableString() const;
238 
243  TQCString headerAsSendableString() const;
244 
249 
251  DwMediaType& dwContentType();
252 
254  TQString headerAsString() const;
255 
260  void parseTextStringFromDwPart( partNode * root,
261  TQCString& parsedString,
262  const TQTextCodec*& codec,
263  bool& isHTML ) const;
264 
268  void initHeader(uint identity=0);
269 
272  void initFromMessage(const KMMessage *msg, bool idHeaders = true);
273 
279  uint identityUoid() const;
280 
283  void applyIdentity( uint id );
284 
287  void cleanupHeader();
288 
294  void setAutomaticFields(bool isMultipart=false);
295 
297  TQString dateStr() const;
300  TQCString dateShortStr() const;
301  TQString dateIsoStr() const;
302  time_t date() const;
303  void setDate(const TQCString& str);
304  void setDate(time_t aUnixTime);
305 
307  void setDateToday();
308 
310  TQString to() const;
311  void setTo(const TQString& aStr);
312  TQString toStrip() const;
313 
315  TQString replyTo() const;
316  void setReplyTo( const TQString &aStr );
317  void setReplyTo(KMMessage*);
318 
320  TQString cc() const;
321  void setCc( const TQString &aStr );
322  TQString ccStrip() const;
323 
325  TQString bcc() const;
326  void setBcc( const TQString &aStr );
327 
329  TQString fcc() const;
330  void setFcc( const TQString &aStr );
331 
333  TQString drafts() const { return mDrafts; }
334  void setDrafts( const TQString &aStr );
335 
337  TQString templates() const { return mTemplates; }
338  void setTemplates( const TQString &aStr );
339 
341  TQString from() const;
342  void setFrom(const TQString& aStr);
343  TQString fromStrip() const;
344 
347  TQString sender() const;
348 
352  TQString who() const;
353 
355  TQString subject() const;
356  void setSubject(const TQString& aStr);
357 
360 
362  TQString xmark() const;
363  void setXMark(const TQString& aStr);
364 
366  TQString replyToId() const;
367  void setReplyToId(const TQString& aStr);
368  TQString replyToIdMD5() const;
369 
384  TQString replyToAuxIdMD5() const;
385 
390  TQString strippedSubjectMD5() const;
391 
402  static KPIM::EmailParseResult isValidEmailAddressList( const TQString& aStr,
403  TQString& brokenAddress );
404 
409  TQString subjectMD5() const;
410 
412  bool subjectIsPrefixed() const;
413 
415  TQString msgId() const;
416  void setMsgId(const TQString& aStr);
417  TQString msgIdMD5() const;
418 
420  TQString references() const;
421  void setReferences(const TQCString& aStr);
422 
424  TQCString id() const;
425 
430  void setMsgSerNum(unsigned long newMsgSerNum = 0);
431 
436  TQString headerField(const TQCString& name) const;
437 
438  enum HeaderFieldType { Unstructured, Structured, Address };
439 
444  void setHeaderField( const TQCString& name, const TQString& value,
445  HeaderFieldType type = Unstructured,
446  bool prepend = false );
447 
449  TQStringList headerFields( const TQCString& name ) const;
450 
455  TQCString rawHeaderField( const TQCString & name ) const;
456 
460  TQValueList<TQCString> rawHeaderFields( const TQCString & field ) const;
461 
463  static KMime::Types::AddressList splitAddrField( const TQCString & str );
464 
468  KMime::Types::AddressList headerAddrField(const TQCString& name) const;
469  KMime::Types::AddrSpecList extractAddrSpecs( const TQCString & headerNames ) const;
470 
472  void removeHeaderField(const TQCString& name);
473 
475  void removeHeaderFields(const TQCString& name);
476 
480  TQCString typeStr() const;
481  int type() const;
482  void setTypeStr(const TQCString& aStr);
483  void setType(int aType);
485  TQCString subtypeStr() const;
486  int subtype() const;
487  void setSubtypeStr(const TQCString& aStr);
488  void setSubtype(int aSubtype);
490  static void setDwMediaTypeParam( DwMediaType &mType,
491  const TQCString& attr,
492  const TQCString& val );
494  void setContentTypeParam(const TQCString& attr, const TQCString& val);
495 
499  DwHeaders& headers() const;
500 
505  void setNeedsAssembly();
506 
511  void assembleIfNeeded();
512 
521  TQCString contentTransferEncodingStr() const;
522  int contentTransferEncoding( DwEntity *entity = 0 ) const;
523  void setContentTransferEncodingStr( const TQCString& cteString, DwEntity *entity = 0 );
524  void setContentTransferEncoding( int cte, DwEntity *entity = 0 );
525 
530  TQCString cteStr() const { return contentTransferEncodingStr(); }
531  int cte( DwEntity *entity = 0 ) const { return contentTransferEncoding( entity ); }
532  void setCteStr( const TQCString& aStr, DwEntity *entity = 0 ) {
533  setContentTransferEncodingStr( aStr, entity );
534  }
535  void setCte( int aCte, DwEntity *entity = 0 ) {
536  setContentTransferEncoding( aCte, entity );
537  }
538 
546  void setBodyFromUnicode( const TQString & str, DwEntity *entity = 0 );
547 
550  TQString bodyToUnicode(const TQTextCodec* codec=0) const;
551 
553  TQCString body() const;
554 
556  void setBody(const TQCString& aStr);
557  void setBody(const DwString& aStr);
558  void setBody(const char* aStr); // avoid ambiguous calls
559 
561  void setMultiPartBody( const TQCString & aStr );
562 
572  void setBodyEncoded( const TQCString& aStr, DwEntity *entity = 0 );
573  void setBodyEncodedBinary( const TQByteArray& aStr, DwEntity *entity = 0 );
574 
578  static TQValueList<int> determineAllowedCtes( const KMime::CharFreq& cf,
579  bool allow8Bit,
580  bool willBeSigned );
581 
595  void setBodyAndGuessCte( const TQByteArray& aBuf, TQValueList<int>& allowedCte,
596  bool allow8Bit = false,
597  bool willBeSigned = false,
598  DwEntity *entity = 0 );
599 
600  void setBodyAndGuessCte( const TQCString& aBuf,
601  TQValueList<int>& allowedCte,
602  bool allow8Bit = false,
603  bool willBeSigned = false,
604  DwEntity *entity = 0 );
605 
609  TQCString bodyDecoded() const;
610  TQByteArray bodyDecodedBinary() const;
611 
614  int numBodyParts() const;
615 
618  DwBodyPart * findDwBodyPart( int type, int subtype ) const;
619 
622  DwBodyPart * findDwBodyPart( const TQCString& type, const TQCString& subtype ) const;
623 
626  DwBodyPart* findDwBodyPart( DwBodyPart* part, const TQString & partSpecifier );
627 
630  DwBodyPart * dwBodyPart( int aIdx ) const;
631 
634  int partNumber( DwBodyPart * aDwBodyPart ) const;
635 
638  DwBodyPart * getFirstDwBodyPart() const;
639  DwMessage * getTopLevelPart() const { return mMsg; }
640 
644  static void bodyPart(DwBodyPart* aDwBodyPart, KMMessagePart* aPart,
645  bool withBody = true );
646 
650  void bodyPart(int aIdx, KMMessagePart* aPart) const;
651 
653  DwBodyPart* createDWBodyPart(const KMMessagePart* aPart);
654 
656  void addDwBodyPart(DwBodyPart * aDwPart);
657 
659  void addBodyPart(const KMMessagePart* aPart);
660 
662  void deleteBodyParts();
663 
668  bool deleteBodyPart( int partIndex );
669 
672  void setStatusFields();
673 
678  static TQString generateMessageId( const TQString& addr );
679 
685  static TQCString html2source( const TQCString & src );
686 
689  static TQString encodeMailtoUrl( const TQString& str );
690 
693  static TQString decodeMailtoUrl( const TQString& url );
694 
701  static TQCString stripEmailAddr(const TQCString& emailAddr);
702 
705  static TQString stripEmailAddr(const TQString& emailAddr);
706 
712  static TQString quoteHtmlChars( const TQString& str,
713  bool removeLineBreaks = false );
714 
719  static TQString emailAddrAsAnchor(const TQString& emailAddr,
720  bool stripped=true, const TQString& cssStyle = TQString(), bool link = true);
721 
725  static TQStringList stripAddressFromAddressList( const TQString& address,
726  const TQStringList& addresses );
727 
731  static TQStringList stripMyAddressesFromAddressList( const TQStringList& list );
732 
735  static bool addressIsInAddressList( const TQString& address,
736  const TQStringList& addresses );
737 
741  static TQString expandAliases( const TQString& recipients );
742 
746  static TQString guessEmailAddressFromLoginName( const TQString& userName );
747 
754  static TQString smartQuote( const TQString &msg, int maxLineLength );
755 
757  static TQCString defaultCharset();
758 
760  static const TQStringList &preferredCharsets();
761 
763  TQString replaceHeadersInString( const TQString & s ) const;
764 
766  TQCString charset() const;
767 
776  void setCharset( const TQCString& charset, DwEntity *entity = 0 );
777 
779  const TQTextCodec * codec() const;
780 
782  void setOverrideCodec( const TQTextCodec* codec ) { mOverrideCodec = codec; }
783 
785  void setDecodeHTML(bool aDecodeHTML)
786  { mDecodeHTML = aDecodeHTML; }
787 
790  static void readConfig();
791 
795  TQCString getRefStr() const;
796 
798  off_t folderOffset() const { return mFolderOffset; }
799  void setFolderOffset(off_t offs) { if(mFolderOffset != offs) { mFolderOffset=offs; setDirty(true); } }
800 
802  TQString fileName() const { return mFileName; }
803  void setFileName(const TQString& file) { if(mFileName != file) { mFileName=file; setDirty(true); } }
804 
806  TQString originatingAccountName() const { return mOriginatingAccountName; }
807  void setOriginatingAccountName(const TQString& account) { if(mOriginatingAccountName != account) { mOriginatingAccountName=account; setDirty(true); } }
808 
812  size_t msgSize() const { return mMsgSize; }
813  void setMsgSize(size_t sz) { if(mMsgSize != sz) { mMsgSize = sz; setDirty(true); } }
814 
817  size_t msgLength() const
818  { return (mMsgLength) ? mMsgLength : mMsgSize; }
819  void setMsgLength(size_t sz) { mMsgLength = sz; }
820 
822  size_t msgSizeServer() const;
823  void setMsgSizeServer(size_t sz);
824 
826  ulong UID() const;
827  void setUID(ulong uid);
828 
830  KMMsgStatus status() const { return mStatus; }
832  void setStatus(const KMMsgStatus status, int idx = -1);
833  void setStatus(const char* s1, const char* s2=0) { KMMsgBase::setStatus(s1, s2); }
834 
836  void setEncryptionState(const KMMsgEncryptionState, int idx = -1);
837 
839  void setSignatureState(const KMMsgSignatureState, int idx = -1);
840 
841  void setMDNSentState( KMMsgMDNSentState status, int idx=-1 );
842 
844  KMMsgEncryptionState encryptionState() const { return mEncryptionState; }
845 
847  KMMsgSignatureState signatureState() const { return mSignatureState; }
848 
849  KMMsgMDNSentState mdnSentState() const { return mMDNSentState; }
850 
852  void link(const KMMessage *aMsg, KMMsgStatus aStatus);
855  void getLink(int n, ulong *retMsgSerNum, KMMsgStatus *reStatus) const;
856 
858  TQString formatString(const TQString&) const;
859 
861  void updateBodyPart(const TQString partSpecifier, const TQByteArray & data);
862 
864  DwBodyPart* lastUpdatedPart() { return mLastUpdated; }
865 
867  bool isComplete() const { return mComplete; }
869  void setComplete( bool v ) { mComplete = v; }
870 
872  bool readyToShow() const { return mReadyToShow; }
874  void setReadyToShow( bool v ) { mReadyToShow = v; }
875 
876  void updateAttachmentState( DwBodyPart *part = 0 );
877  void updateInvitationState();
878 
880  bool transferInProgress() const;
882  void setTransferInProgress(bool value, bool force = false);
883 
888  TQCString mboxMessageSeparator();
889 
905  TQString asQuotedString( const TQString & headerStr,
906  const TQString & indentStr,
907  const TQString & selection=TQString(),
908  bool aStripSignature=true,
909  bool allowDecryption=true) const;
910 
913  TQString asPlainText( bool stripSignature, bool allowDecryption ) const;
914 
921  TQString asPlainTextFromObjectTree( partNode *root, bool stripSignature,
922  bool allowDecryption ) const;
923 
925  int getCursorPos() { return mCursorPos; };
927  void setCursorPos(int pos) { mCursorPos = pos; };
928 
930  KMMsgInfo* msgInfo() { return mMsgInfo; }
932  void setMsgInfo( KMMsgInfo* msgInfo ) { mMsgInfo = msgInfo; }
933 
934  /* This is set in kmreaderwin if a message is being parsed to avoid
935  other parts of kmail (e.g. kmheaders) destroying the message.
936  Parsing can take longer and can be async (in case of gpg mails) */
937  bool isBeingParsed() const { return mIsParsed; }
938  void setIsBeingParsed( bool t ) { mIsParsed = t; }
939 
941  void deleteWhenUnused();
942 
943  DwBodyPart* findPart( int index );
944 
945 private:
946 
948  void init( DwMessage* aMsg = 0 );
950  void assign( const KMMessage& other );
951 
952  DwBodyPart* findPartInternal( DwEntity* root, int index, int &accu );
953 
954  TQString mDrafts;
955  TQString mTemplates;
956  mutable DwMessage* mMsg;
957  mutable bool mNeedsAssembly :1;
958  bool mDecodeHTML :1;
959  bool mReadyToShow :1;
960  bool mComplete :1;
961  bool mIsParsed : 1;
962  static const KMail::HeaderStrategy * sHeaderStrategy;
963  static TQString sForwardStr;
964  const TQTextCodec * mOverrideCodec;
965 
966  TQString mFileName;
967  TQString mOriginatingAccountName;
968  off_t mFolderOffset;
969  size_t mMsgSize, mMsgLength;
970  time_t mDate;
971  KMMsgEncryptionState mEncryptionState;
972  KMMsgSignatureState mSignatureState;
973  KMMsgMDNSentState mMDNSentState;
974  KMMessage* mUnencryptedMsg;
975  DwBodyPart* mLastUpdated;
976  int mCursorPos;
977  KMMsgInfo* mMsgInfo; // used to remember the KMMsgInfo object this KMMessage replaced in the KMMsgList
978  static TQValueList<KMMessage*> sPendingDeletes;
979 };
980 
981 
982 #endif /*kmmessage_h*/
void removeHeaderField(const TQCString &name)
Remove header field with given name.
Definition: kmmessage.cpp:2317
TQCString getRefStr() const
Creates reference string for reply to messages.
Definition: kmmessage.cpp:1103
void initHeader(uint identity=0)
Initialize header fields.
Definition: kmmessage.cpp:1715
void addBodyPart(const KMMessagePart *aPart)
Append a body part to the message.
Definition: kmmessage.cpp:3356
TQString to() const
Get or set the 'To' header field.
Definition: kmmessage.cpp:1894
TQString originatingAccountName() const
Get/set originating account name.
Definition: kmmessage.h:806
A FolderStorage with an index for faster access to often used message properties.
Definition: kmfolderindex.h:37
TQCString cteStr() const
Cte is short for ContentTransferEncoding.
Definition: kmmessage.h:530
void setBodyFromUnicode(const TQString &str, DwEntity *entity=0)
Sets this body's content to str.
Definition: kmmessage.cpp:4440
void setContentTypeParam(const TQCString &attr, const TQCString &val)
add or change a parameter of the Content-Type field
Definition: kmmessage.cpp:2489
TQCString dateShortStr() const
Returns the message date in asctime format or an empty string if the message lacks a Date header.
Definition: kmmessage.cpp:1815
TQString bodyToUnicode(const TQTextCodec *codec=0) const
Returns the body part decoded to unicode.
Definition: kmmessage.cpp:4471
TQCString headerAsSendableString() const
Return the message header with the headers that should not be sent stripped off.
Definition: kmmessage.cpp:327
bool subjectIsPrefixed() const
Is the subject prefixed by Re: or similar?
Definition: kmmessage.cpp:2169
TQString replaceHeadersInString(const TQString &s) const
Replaces every occurrence of "${foo}" in s with headerField("foo")
Definition: kmmessage.cpp:1610
TQCString id() const
Returns the message ID, useful for followups.
Definition: kmmessage.cpp:208
void setBodyAndGuessCte(const TQByteArray &aBuf, TQValueList< 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 fr...
Definition: kmmessage.cpp:2685
TQCString subtypeStr() const
Subtype.
Definition: kmmessage.cpp:2428
KMMessage * takeUnencryptedMsg()
Returns an unencrypted copy of this message or 0 if none exists.
Definition: kmmessage.h:144
static TQStringList stripMyAddressesFromAddressList(const TQStringList &list)
Strips all the user's addresses from an address list.
Definition: kmmessage.cpp:3916
KMMessage * createForward(const TQString &tmpl=TQString())
Create a new message that is a forward of this message, filling all required header fields with the p...
Definition: kmmessage.cpp:1229
static TQString smartQuote(const TQString &msg, int maxLineLength)
Given argument msg add quoting characters and relayout for max width maxLength.
Definition: kmmessage.cpp:646
void setCharset(const TQCString &charset, DwEntity *entity=0)
Sets the charset of the message or a subpart of the message.
Definition: kmmessage.cpp:4114
DwMediaType & dwContentType()
Return reference to Content-Type header for direct manipulation.
Definition: kmmessage.cpp:389
void setTransferInProgress(bool value, bool force=false)
Set that the message shall not be deleted because it is still required.
Definition: kmmessage.cpp:243
void setCursorPos(int pos)
Set cursor position as offset from message start.
Definition: kmmessage.h:927
void setHeaderField(const TQCString &name, const TQString &value, HeaderFieldType type=Unstructured, bool prepend=false)
Set the header field with the given name to the given value.
Definition: kmmessage.cpp:2339
TQCString rawHeaderField(const TQCString &name) const
Returns the raw value of a header field with the given name.
Definition: kmmessage.cpp:2264
void parseTextStringFromDwPart(partNode *root, TQCString &parsedString, const TQTextCodec *&codec, bool &isHTML) const
Returns a decoded body part string to be further processed by function asQuotedString().
Definition: kmmessage.cpp:714
void applyIdentity(uint id)
Set the from, to, cc, bcc, encrytion etc headers as specified in the given identity.
Definition: kmmessage.cpp:1662
The widget that shows the contents of folders.
Definition: kmheaders.h:46
static TQString decodeMailtoUrl(const TQString &url)
Decodes a mailto URL.
Definition: kmmessage.cpp:3473
void updateBodyPart(const TQString partSpecifier, const TQByteArray &data)
Sets the body of the specified part.
Definition: kmmessage.cpp:4270
KMMessage(KMFolder *parent=0)
Straight forward initialization.
Definition: kmmessage.cpp:97
const TQTextCodec * codec() const
Get a TQTextCodec suitable for this message part.
Definition: kmmessage.cpp:4453
TQString asPlainText(bool stripSignature, bool allowDecryption) const
Return the textual content of the message as plain text, converting HTML to plain text if necessary.
Definition: kmmessage.cpp:822
DwBodyPart * lastUpdatedPart()
Returns the last DwBodyPart that was updated.
Definition: kmmessage.h:864
static TQCString stripEmailAddr(const TQCString &emailAddr)
This function generates a displayable string from a list of email addresses.
Definition: kmmessage.cpp:3483
KMMsgStatus status() const
Status of the message.
Definition: kmmessage.h:830
size_t msgSize() const
Get/set size of message in the folder including the whole header in bytes.
Definition: kmmessage.h:812
TQString sender() const
Definition: kmmessage.cpp:2039
static TQString encodeMailtoUrl(const TQString &str)
Encodes an email address as mailto URL.
Definition: kmmessage.cpp:3462
off_t folderOffset() const
Get/set offset in mail folder.
Definition: kmmessage.h:798
KMime::Types::AddressList headerAddrField(const TQCString &name) const
Returns header address list as string list.
Definition: kmmessage.cpp:2251
TQCString asString() const
Return the entire message contents as a string.
Definition: kmmessage.cpp:314
bool isUrgent() const
Definition: kmmessage.cpp:259
KMMessage * createReply(KMail::ReplyStrategy replyStrategy=KMail::ReplySmart, TQString selection=TQString(), bool noQuote=false, bool allowDecryption=true, const TQString &tmpl=TQString(), const TQString &originatingAccount=TQString())
Create a new message that is a reply to this message, filling all required header fields with the pro...
Definition: kmmessage.cpp:863
const DwString & asDwString() const
Return the entire message contents in the DwString.
Definition: kmmessage.cpp:292
void del()
Mark the message as deleted.
Definition: kmmessage.h:152
bool deleteBodyPart(int partIndex)
Delete a body part with the specified part index.
Definition: kmmessage.cpp:3181
static KPIM::EmailParseResult isValidEmailAddressList(const TQString &aStr, TQString &brokenAddress)
Validate a list of email addresses, and also allow aliases and distribution lists to be expanded befo...
Definition: kmmessage.cpp:273
static void readConfig()
Reads config settings from group "KMMessage" and sets all internal variables (e.g.
Definition: kmmessage.cpp:4033
void setBody(const TQCString &aStr)
Set the message body.
Definition: kmmessage.cpp:2774
TQString xmark() const
Get or set the 'X-Mark' header field.
Definition: kmmessage.cpp:2064
TQString asPlainTextFromObjectTree(partNode *root, bool stripSignature, bool allowDecryption) const
Same as asPlainText(), only that this method expects an already parsed object tree as paramter.
Definition: kmmessage.cpp:740
static TQValueList< int > determineAllowedCtes(const KMime::CharFreq &cf, bool allow8Bit, bool willBeSigned)
Returns a list of content-transfer-encodings that can be used with the given result of the character ...
Definition: kmmessage.cpp:2637
TQString replyToAuxIdMD5() const
Get the second to last id from the References header field.
Definition: kmmessage.cpp:2146
ulong UID() const
Get/set UID.
Definition: kmmessage.cpp:2225
DwBodyPart * getFirstDwBodyPart() const
Get the 1st DwBodyPart.
Definition: kmmessage.cpp:2848
void setStatusFields()
Set "Status" and "X-Status" fields of the message from the internal message status.
Definition: kmmessage.cpp:351
static bool addressIsInAddressList(const TQString &address, const TQStringList &addresses)
Returns true if the given address is contained in the given address list.
Definition: kmmessage.cpp:3937
void setDecodeHTML(bool aDecodeHTML)
Allow decoding of HTML for quoting.
Definition: kmmessage.h:785
TQString subjectMD5() const
Get a hash of the subject.
Definition: kmmessage.cpp:2164
TQString from() const
Get or set the 'From' header field.
Definition: kmmessage.cpp:2015
TQString asQuotedString(const TQString &headerStr, const TQString &indentStr, const TQString &selection=TQString(), bool aStripSignature=true, bool allowDecryption=true) const
Returns message body with quoting header and indented by the given indentation string.
Definition: kmmessage.cpp:835
int partNumber(DwBodyPart *aDwBodyPart) const
Get the number of the given DwBodyPart.
Definition: kmmessage.cpp:2855
TQCString typeStr() const
Get or set the 'Content-Type' header field The member functions that involve enumerated types (ints) ...
Definition: kmmessage.cpp:2391
static TQCString html2source(const TQCString &src)
Convert '<' into "<" resp.
Definition: kmmessage.cpp:3389
static TQStringList stripAddressFromAddressList(const TQString &address, const TQStringList &addresses)
Strips an address from an address list.
Definition: kmmessage.cpp:3894
DwHeaders & headers() const
get the DwHeaders (make sure to call setNeedsAssembly() function after directly modyfying internal da...
Definition: kmmessage.cpp:2546
void undel()
Undelete the message.
Definition: kmmessage.h:155
TQString replyToId() const
Get or set the 'In-Reply-To' header field.
Definition: kmmessage.cpp:2079
void setMultiPartBody(const TQCString &aStr)
Hack to enable structured body parts to be set as flat text...
Definition: kmmessage.cpp:2791
void removeHeaderFields(const TQCString &name)
Remove all header fields with given name.
Definition: kmmessage.cpp:2328
TQCString bodyDecoded() const
Returns a decoded version of the body from the current content transfer encoding.
Definition: kmmessage.cpp:2608
bool readyToShow() const
Return if the message is ready to be shown.
Definition: kmmessage.h:872
void initFromMessage(const KMMessage *msg, bool idHeaders=true)
Initialize headers fields according to the identity and the transport header of the given original me...
Definition: kmmessage.cpp:1742
static TQString generateMessageId(const TQString &addr)
Generates the Message-Id.
Definition: kmmessage.cpp:3364
static const TQStringList & preferredCharsets()
Get a list of preferred message charsets.
Definition: kmmessage.cpp:4092
TQString replyTo() const
Get or set the 'ReplyTo' header field.
Definition: kmmessage.cpp:1919
TQString headerField(const TQCString &name) const
Returns the value of a header field with the given name.
Definition: kmmessage.cpp:2289
DwBodyPart * findDwBodyPart(int type, int subtype) const
Return the first DwBodyPart matching a given Content-Type or zero, if no found.
Definition: kmmessage.cpp:2935
TQCString createForwardBody()
Create the forwarded body for the message.
Definition: kmmessage.cpp:1182
void initStrippedSubjectMD5()
Calculate strippedSubject.
Definition: kmmessage.h:359
void setMsgSerNum(unsigned long newMsgSerNum=0)
Sets the message serial number.
Definition: kmmessage.cpp:223
bool isComplete() const
Return true if the complete message is available without referring to the backing store.
Definition: kmmessage.h:867
bool transferInProgress() const
Return, if the message should not be deleted.
Definition: kmmessage.cpp:236
static TQString expandAliases(const TQString &recipients)
Expands aliases (distribution lists and nick names) and appends a domain part to all email addresses ...
Definition: kmmessage.cpp:3953
static TQCString defaultCharset()
Get the default message charset.
Definition: kmmessage.cpp:4075
void fromDwString(const DwString &str, bool setStatus=false)
Parse the string and create this message from it.
Definition: kmmessage.cpp:402
void getLink(int n, ulong *retMsgSerNum, KMMsgStatus *reStatus) const
Returns the information for the Nth link into retMsg and reStatus.
Definition: kmmessage.cpp:4216
void deleteBodyParts()
Delete all body parts.
Definition: kmmessage.cpp:3174
TQString dateStr() const
Get or set the 'Date' header field.
Definition: kmmessage.cpp:1797
TQCString charset() const
Get the message charset.
Definition: kmmessage.cpp:4098
void setSignatureState(const KMMsgSignatureState, int idx=-1)
Set signature status of the message.
Definition: kmmessage.cpp:4169
void setUnencryptedMsg(KMMessage *unencrypted)
Specifies an unencrypted copy of this message to be stored in a separate member variable to allow sav...
Definition: kmmessage.cpp:265
TQString headerAsString() const
Return header as string.
Definition: kmmessage.cpp:378
TQString drafts() const
Get or set the 'Drafts' folder.
Definition: kmmessage.h:333
static TQString quoteHtmlChars(const TQString &str, bool removeLineBreaks=false)
Quotes the following characters which have a special meaning in HTML: '<' '>' '&' '"'....
Definition: kmmessage.cpp:3804
void setMsgInfo(KMMsgInfo *msgInfo)
Set the KMMsgInfo object corresponding to this message.
Definition: kmmessage.h:932
uint identityUoid() const
Definition: kmmessage.cpp:1727
void setOverrideCodec(const TQTextCodec *codec)
Set the charset the user selected for the message to display.
Definition: kmmessage.h:782
DwBodyPart * dwBodyPart(int aIdx) const
Get the DwBodyPart at position in aIdx.
Definition: kmmessage.cpp:2895
void setReadyToShow(bool v)
Set if the message is ready to be shown.
Definition: kmmessage.h:874
TQString templates() const
Get or set the 'Templates' folder.
Definition: kmmessage.h:337
virtual ~KMMessage()
Destructor.
Definition: kmmessage.cpp:190
TQCString contentTransferEncodingStr() const
Get or set the 'Content-Transfer-Encoding' header field The member functions that involve enumerated ...
Definition: kmmessage.cpp:2499
bool hasUnencryptedMsg() const
Returns TRUE if the message contains an unencrypted copy of itself.
Definition: kmmessage.h:134
void setStatus(const KMMsgStatus status, int idx=-1)
Set status and mark dirty.
Definition: kmmessage.cpp:4153
TQStringList headerFields(const TQCString &name) const
Returns a list of the values of all header fields with the given name.
Definition: kmmessage.cpp:2302
void setDateToday()
Set the 'Date' header field to the current date.
Definition: kmmessage.cpp:1859
TQString fcc() const
Get or set the 'Fcc' header field.
Definition: kmmessage.cpp:1981
KMMessage * createRedirect(const TQString &toStr)
Create a new message that is a redirect to this message, filling all required header fields with the ...
Definition: kmmessage.cpp:1131
void setEncryptionState(const KMMsgEncryptionState, int idx=-1)
Set encryption status of the message.
Definition: kmmessage.cpp:4160
void setAutomaticFields(bool isMultipart=false)
Set fields that are either automatically set (Message-id) or that do not change from one message to a...
Definition: kmmessage.cpp:1777
static KMime::Types::AddressList splitAddrField(const TQCString &str)
Splits the given address list into separate addresses.
Definition: kmmessage.cpp:2238
void deleteWhenUnused()
Delete this message as soon as it no longer in use.
Definition: kmmessage.cpp:4497
TQString cc() const
Get or set the 'Cc' header field.
Definition: kmmessage.cpp:1940
TQCString mboxMessageSeparator()
Returns an mbox message separator line for this message, i.e.
Definition: kmmessage.cpp:4481
size_t msgLength() const
Unlike the above function this works also, if the message is not in a folder.
Definition: kmmessage.h:817
KMMsgBase & toMsgBase()
Get KMMsgBase for this object.
Definition: kmmessage.h:114
int getCursorPos()
Get stored cursor position.
Definition: kmmessage.h:925
TQString formatString(const TQString &) const
Convert wildcards into normal string.
Definition: kmmessage.cpp:426
static void setDwMediaTypeParam(DwMediaType &mType, const TQCString &attr, const TQCString &val)
add or change a parameter of a DwMediaType field
Definition: kmmessage.cpp:2464
This is a Mime Message.
Definition: kmmessage.h:67
void setNeedsAssembly()
tell the message that internal data were changed (must be called after directly modifying message str...
Definition: kmmessage.cpp:2553
TQCString body() const
Get the message body.
Definition: kmmessage.cpp:2570
static void bodyPart(DwBodyPart *aDwBodyPart, KMMessagePart *aPart, bool withBody=true)
Fill the KMMessagePart structure for a given DwBodyPart.
Definition: kmmessage.cpp:3108
void touch()
Touch the message - mark it as read.
Definition: kmmessage.h:158
void cleanupHeader()
Removes empty fields from the header, e.g.
Definition: kmmessage.cpp:1754
void sanitizeHeaders(const TQStringList &whiteList=TQStringList())
Remove all headers but the content description ones, and those in the white list.
Definition: kmmessage.cpp:1210
KMMsgEncryptionState encryptionState() const
Encryption status of the message.
Definition: kmmessage.h:844
static TQString emailAddrAsAnchor(const TQString &emailAddr, bool stripped=true, const TQString &cssStyle=TQString(), bool link=true)
Converts the email address(es) to (a) nice HTML mailto: anchor(s).
Definition: kmmessage.cpp:3840
folderdiaquotatab.h
Definition: aboutdata.cpp:40
DwBodyPart * createDWBodyPart(const KMMessagePart *aPart)
Compose a DwBodyPart (needed for adding a part to the message).
Definition: kmmessage.cpp:3218
TQString msgId() const
Get or set the 'Message-Id' header field.
Definition: kmmessage.cpp:2182
void setComplete(bool v)
Set if the message is a complete message.
Definition: kmmessage.h:869
KMMsgInfo * msgInfo()
Get the KMMsgInfo object that was set with setMsgInfo().
Definition: kmmessage.h:930
static TQString guessEmailAddressFromLoginName(const TQString &userName)
Uses the hostname as domain part and tries to determine the real name from the entries in the passwor...
Definition: kmmessage.cpp:4003
void removePrivateHeaderFields()
Remove all private header fields: Status: and X-KMail-
Definition: kmmessage.cpp:335
void link(const KMMessage *aMsg, KMMsgStatus aStatus)
Links this message to aMsg, setting link type to aStatus.
Definition: kmmessage.cpp:4190
size_t msgSizeServer() const
Get/set size on server.
Definition: kmmessage.cpp:2212
TQString subject() const
Get or set the 'Subject' header field.
Definition: kmmessage.cpp:2049
TQValueList< TQCString > rawHeaderFields(const TQCString &field) const
Returns a list of the raw values of all header fields with the given name.
Definition: kmmessage.cpp:2275
TQString who() const
Get or set the 'Who' header field.
Definition: kmmessage.cpp:2006
TQString references() const
Get or set the references for this message.
Definition: kmmessage.cpp:2125
KMMessage * createDeliveryReceipt() const
Create a new message that is a delivery receipt of this message, filling required header fileds with ...
Definition: kmmessage.cpp:1635
Mail folder.
Definition: kmfolder.h:68
TQByteArray asSendableString() const
Return the message contents with the headers that should not be sent stripped off.
Definition: kmmessage.cpp:319
bool isMessage() const
Returns TRUE if object is a real message (not KMMsgInfo or KMMsgBase)
Definition: kmmessage.cpp:230
TQString strippedSubjectMD5() const
Get a hash of the subject with all prefixes such as Re: removed.
Definition: kmmessage.cpp:2159
KMMessage * unencryptedMsg() const
Returns an unencrypted copy of this message or 0 if none exists.
Definition: kmmessage.h:137
void addDwBodyPart(DwBodyPart *aDwPart)
Append a DwBodyPart to the message.
Definition: kmmessage.cpp:3348
void setBodyEncoded(const TQCString &aStr, DwEntity *entity=0)
Set the message body, encoding it according to the current content transfer encoding.
Definition: kmmessage.cpp:2719
void assembleIfNeeded()
Assemble the internal message.
Definition: kmmessage.cpp:2559
KMMessage * createMDN(KMime::MDN::ActionMode a, KMime::MDN::DispositionType d, bool allowGUI=false, TQValueList< KMime::MDN::DispositionModifier > m=TQValueList< KMime::MDN::DispositionModifier >())
Create a new message that is a MDN for this message, filling all required fields with proper values.
Definition: kmmessage.cpp:1395
TQString bcc() const
Get or set the 'Bcc' header field.
Definition: kmmessage.cpp:1968
TQString fileName() const
Get/set filename in mail folder.
Definition: kmmessage.h:802
KMMsgSignatureState signatureState() const
Signature status of the message.
Definition: kmmessage.h:847
int numBodyParts() const
Number of body parts the message has.
Definition: kmmessage.cpp:2806