kmail

kmmessage.h
1 // -*- mode: C++; c-file-style: "gnu" -*-
2 /* kmmessage.h: Mime Message Class
3  *
4  */
5 #ifndef kmmessage_h
6 #define kmmessage_h
7 
10 // for large file support
11 #include <config.h>
12 #include <sys/types.h>
13 
14 #include <mimelib/string.h>
15 #include "kmmsgbase.h"
16 #include "isubject.h"
17 
18 #include <kmime_mdn.h>
19 
20 #include<libemailfunctions/email.h>
21 
22 template <typename T>
23 class TQValueList;
24 
25 class TQStringList;
26 class TQString;
27 class TQTextCodec;
28 class TQStrList;
29 
30 class KMFolder;
31 class KMFolderIndex;
32 class DwMessage;
33 class KMMessagePart;
34 class KMMsgInfo;
35 class KMHeaders;
36 class KMForwardDigestCommand;
37 
38 namespace KMime {
39  class CharFreq;
40  namespace Types {
41  class AddrSpec;
42  class Address;
43  typedef TQValueList<Address> AddressList;
44  typedef TQValueList<AddrSpec> AddrSpecList;
45  }
46 }
47 
48 namespace KMail {
49  class HeaderStrategy;
50 }
51 
52 class DwEntity;
53 class DwBodyPart;
54 class DwMediaType;
55 class DwHeaders;
56 
57 class partNode;
58 
59 namespace KMail {
60  enum ReplyStrategy { ReplySmart = 0,
61  ReplyAuthor,
62  ReplyList,
63  ReplyAll,
64  ReplyNone };
65 }
66 
68 class KMMessage: public KMMsgBase, public KMail::ISubject
69 {
70  friend class ::KMForwardDigestCommand; // needed for MIME Digest forward
71 
72 public:
73  // promote some of KMMsgBase's methods to public:
74  using KMMsgBase::parent;
75  using KMMsgBase::setParent;
76  using KMMsgBase::enableUndo; // KMFolder
77  using KMMsgBase::setEnableUndo; // dto.
78  using KMMsgBase::isRead; // dto.
79  using KMMsgBase::isUnread; // dto.
80  using KMMsgBase::isNew; // dto.
81  using KMMsgBase::isOld;
82  using KMMsgBase::isWatched;
83  using KMMsgBase::isIgnored;
84  using KMMsgBase::setEncryptionStateChar; // KMAcct*
85  using KMMsgBase::setSignatureStateChar; // dto.
86 
88  KMMessage(KMFolder* parent=0);
89 
93  KMMessage(DwMessage*);
94 
96  KMMessage(KMMsgInfo& msgInfo);
97 
99  KMMessage( const KMMessage& other );
100 
101 #if 0 // currently unused
102 
103  const KMMessage& operator=( const KMMessage& other ) {
104  if( &other == this )
105  return *this;
106  assign( other );
107  return *this;
108  }
109 #endif
110 
112  virtual ~KMMessage();
113 
115  KMMsgBase & toMsgBase() { return *this; }
116  const KMMsgBase & toMsgBase() const { return *this; }
117 
119  bool isMessage() const;
120 
124  bool isUrgent() const;
125 
132  void setUnencryptedMsg( KMMessage* unencrypted );
133 
135  bool hasUnencryptedMsg() const { return 0 != mUnencryptedMsg; }
136 
138  KMMessage* unencryptedMsg() const { return mUnencryptedMsg; }
139 
146  {
147  KMMessage* ret = mUnencryptedMsg;
148  mUnencryptedMsg = 0;
149  return ret;
150  }
151 
153  void del() { setStatus(KMMsgStatusDeleted); }
154 
156  void undel() { setStatus(KMMsgStatusOld); }
157 
159  void touch() { setStatus(KMMsgStatusOld); }
160 
164  KMMessage* createReply( KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
165  TQString selection=TQString(), bool noQuote = false,
166  bool allowDecryption = true,
167  const TQString &tmpl = TQString(),
168  const TQString &originatingAccount = TQString() );
169 
177  KMMessage* createRedirect( const TQString &toStr );
178 
180  TQCString createForwardBody();
181 
185  KMMessage* createForward( const TQString &tmpl = TQString() );
186 
191 
205  KMMessage* createMDN( KMime::MDN::ActionMode a,
206  KMime::MDN::DispositionType d,
207  bool allowGUI=false,
208  TQValueList<KMime::MDN::DispositionModifier> m=TQValueList<KMime::MDN::DispositionModifier>() );
209 
211  void sanitizeHeaders( const TQStringList& whiteList = TQStringList() );
212 
214  void fromDwString(const DwString& str, bool setStatus=false);
215  void fromString(const TQCString& str, bool setStatus=false);
216  void fromByteArray(const TQByteArray & ba, bool setStatus=false);
217 
222  const DwString& asDwString() const;
223  const DwMessage *asDwMessage();
224 
232  TQCString asString() const;
233 
238  TQByteArray asSendableString() const;
239 
244  TQCString headerAsSendableString() const;
245 
250 
252  DwMediaType& dwContentType();
253 
255  TQString headerAsString() const;
256 
261  void parseTextStringFromDwPart( partNode * root,
262  TQCString& parsedString,
263  const TQTextCodec*& codec,
264  bool& isHTML ) const;
265 
269  void initHeader(uint identity=0);
270 
273  void initFromMessage(const KMMessage *msg, bool idHeaders = true);
274 
280  uint identityUoid() const;
281 
284  void applyIdentity( uint id );
285 
288  void cleanupHeader();
289 
295  void setAutomaticFields(bool isMultipart=false);
296 
298  TQString dateStr() const;
301  TQCString dateShortStr() const;
302  TQString dateIsoStr() const;
303  time_t date() const;
304  void setDate(const TQCString& str);
305  void setDate(time_t aUnixTime);
306 
308  void setDateToday();
309 
311  TQString to() const;
312  void setTo(const TQString& aStr);
313  TQString toStrip() const;
314 
316  TQString replyTo() const;
317  void setReplyTo( const TQString &aStr );
318  void setReplyTo(KMMessage*);
319 
321  TQString cc() const;
322  void setCc( const TQString &aStr );
323  TQString ccStrip() const;
324 
326  TQString bcc() const;
327  void setBcc( const TQString &aStr );
328 
330  TQString fcc() const;
331  void setFcc( const TQString &aStr );
332 
334  TQString drafts() const { return mDrafts; }
335  void setDrafts( const TQString &aStr );
336 
338  TQString templates() const { return mTemplates; }
339  void setTemplates( const TQString &aStr );
340 
342  TQString from() const;
343  void setFrom(const TQString& aStr);
344  TQString fromStrip() const;
345 
348  TQString sender() const;
349 
353  TQString who() const;
354 
356  TQString subject() const;
357  void setSubject(const TQString& aStr);
358 
361 
363  TQString xmark() const;
364  void setXMark(const TQString& aStr);
365 
367  TQString replyToId() const;
368  void setReplyToId(const TQString& aStr);
369  TQString replyToIdMD5() const;
370 
385  TQString replyToAuxIdMD5() const;
386 
391  TQString strippedSubjectMD5() const;
392 
403  static KPIM::EmailParseResult isValidEmailAddressList( const TQString& aStr,
404  TQString& brokenAddress );
405 
410  TQString subjectMD5() const;
411 
413  bool subjectIsPrefixed() const;
414 
416  TQString msgId() const;
417  void setMsgId(const TQString& aStr);
418  TQString msgIdMD5() const;
419 
421  TQString references() const;
422  void setReferences(const TQCString& aStr);
423 
425  TQCString id() const;
426 
431  void setMsgSerNum(unsigned long newMsgSerNum = 0);
432 
437  TQString headerField(const TQCString& name) const;
438 
439  enum HeaderFieldType { Unstructured, Structured, Address };
440 
445  void setHeaderField( const TQCString& name, const TQString& value,
446  HeaderFieldType type = Unstructured,
447  bool prepend = false );
448 
450  TQStringList headerFields( const TQCString& name ) const;
451 
456  TQCString rawHeaderField( const TQCString & name ) const;
457 
461  TQValueList<TQCString> rawHeaderFields( const TQCString & field ) const;
462 
464  static KMime::Types::AddressList splitAddrField( const TQCString & str );
465 
469  KMime::Types::AddressList headerAddrField(const TQCString& name) const;
470  KMime::Types::AddrSpecList extractAddrSpecs( const TQCString & headerNames ) const;
471 
473  void removeHeaderField(const TQCString& name);
474 
476  void removeHeaderFields(const TQCString& name);
477 
481  TQCString typeStr() const;
482  int type() const;
483  void setTypeStr(const TQCString& aStr);
484  void setType(int aType);
486  TQCString subtypeStr() const;
487  int subtype() const;
488  void setSubtypeStr(const TQCString& aStr);
489  void setSubtype(int aSubtype);
491  static void setDwMediaTypeParam( DwMediaType &mType,
492  const TQCString& attr,
493  const TQCString& val );
495  void setContentTypeParam(const TQCString& attr, const TQCString& val);
496 
500  DwHeaders& headers() const;
501 
506  void setNeedsAssembly();
507 
512  void assembleIfNeeded();
513 
522  TQCString contentTransferEncodingStr() const;
523  int contentTransferEncoding( DwEntity *entity = 0 ) const;
524  void setContentTransferEncodingStr( const TQCString& cteString, DwEntity *entity = 0 );
525  void setContentTransferEncoding( int cte, DwEntity *entity = 0 );
526 
531  TQCString cteStr() const { return contentTransferEncodingStr(); }
532  int cte( DwEntity *entity = 0 ) const { return contentTransferEncoding( entity ); }
533  void setCteStr( const TQCString& aStr, DwEntity *entity = 0 ) {
534  setContentTransferEncodingStr( aStr, entity );
535  }
536  void setCte( int aCte, DwEntity *entity = 0 ) {
537  setContentTransferEncoding( aCte, entity );
538  }
539 
547  void setBodyFromUnicode( const TQString & str, DwEntity *entity = 0 );
548 
551  TQString bodyToUnicode(const TQTextCodec* codec=0) const;
552 
554  TQCString body() const;
555 
557  void setBody(const TQCString& aStr);
558  void setBody(const DwString& aStr);
559  void setBody(const char* aStr); // avoid ambiguous calls
560 
562  void setMultiPartBody( const TQCString & aStr );
563 
573  void setBodyEncoded( const TQCString& aStr, DwEntity *entity = 0 );
574  void setBodyEncodedBinary( const TQByteArray& aStr, DwEntity *entity = 0 );
575 
579  static TQValueList<int> determineAllowedCtes( const KMime::CharFreq& cf,
580  bool allow8Bit,
581  bool willBeSigned );
582 
596  void setBodyAndGuessCte( const TQByteArray& aBuf, TQValueList<int>& allowedCte,
597  bool allow8Bit = false,
598  bool willBeSigned = false,
599  DwEntity *entity = 0 );
600 
601  void setBodyAndGuessCte( const TQCString& aBuf,
602  TQValueList<int>& allowedCte,
603  bool allow8Bit = false,
604  bool willBeSigned = false,
605  DwEntity *entity = 0 );
606 
610  TQCString bodyDecoded() const;
611  TQByteArray bodyDecodedBinary() const;
612 
615  int numBodyParts() const;
616 
619  DwBodyPart * findDwBodyPart( int type, int subtype ) const;
620 
623  DwBodyPart * findDwBodyPart( const TQCString& type, const TQCString& subtype ) const;
624 
627  DwBodyPart* findDwBodyPart( DwBodyPart* part, const TQString & partSpecifier );
628 
631  DwBodyPart * dwBodyPart( int aIdx ) const;
632 
635  int partNumber( DwBodyPart * aDwBodyPart ) const;
636 
639  DwBodyPart * getFirstDwBodyPart() const;
640  DwMessage * getTopLevelPart() const { return mMsg; }
641 
645  static void bodyPart(DwBodyPart* aDwBodyPart, KMMessagePart* aPart,
646  bool withBody = true );
647 
651  void bodyPart(int aIdx, KMMessagePart* aPart) const;
652 
654  DwBodyPart* createDWBodyPart(const KMMessagePart* aPart);
655 
657  void addDwBodyPart(DwBodyPart * aDwPart);
658 
660  void addBodyPart(const KMMessagePart* aPart);
661 
663  void deleteBodyParts();
664 
669  bool deleteBodyPart( int partIndex );
670 
673  void setStatusFields();
674 
679  static TQString generateMessageId( const TQString& addr );
680 
686  static TQCString html2source( const TQCString & src );
687 
690  static TQString encodeMailtoUrl( const TQString& str );
691 
694  static TQString decodeMailtoUrl( const TQString& url );
695 
702  static TQCString stripEmailAddr(const TQCString& emailAddr);
703 
706  static TQString stripEmailAddr(const TQString& emailAddr);
707 
713  static TQString quoteHtmlChars( const TQString& str,
714  bool removeLineBreaks = false );
715 
720  static TQString emailAddrAsAnchor(const TQString& emailAddr,
721  bool stripped=true, const TQString& cssStyle = TQString(), bool link = true);
722 
726  static TQStringList stripAddressFromAddressList( const TQString& address,
727  const TQStringList& addresses );
728 
732  static TQStringList stripMyAddressesFromAddressList( const TQStringList& list );
733 
736  static bool addressIsInAddressList( const TQString& address,
737  const TQStringList& addresses );
738 
742  static TQString expandAliases( const TQString& recipients );
743 
747  static TQString guessEmailAddressFromLoginName( const TQString& userName );
748 
755  static TQString smartQuote( const TQString &msg, int maxLineLength );
756 
758  static TQCString defaultCharset();
759 
761  static const TQStringList &preferredCharsets();
762 
764  TQString replaceHeadersInString( const TQString & s ) const;
765 
767  TQCString charset() const;
768 
777  void setCharset( const TQCString& charset, DwEntity *entity = 0 );
778 
780  const TQTextCodec * codec() const;
781 
783  void setOverrideCodec( const TQTextCodec* codec ) { mOverrideCodec = codec; }
784 
786  void setDecodeHTML(bool aDecodeHTML)
787  { mDecodeHTML = aDecodeHTML; }
788 
791  static void readConfig();
792 
796  TQCString getRefStr() const;
797 
799  off_t folderOffset() const { return mFolderOffset; }
800  void setFolderOffset(off_t offs) { if(mFolderOffset != offs) { mFolderOffset=offs; setDirty(true); } }
801 
803  TQString fileName() const { return mFileName; }
804  void setFileName(const TQString& file) { if(mFileName != file) { mFileName=file; setDirty(true); } }
805 
807  TQString originatingAccountName() const { return mOriginatingAccountName; }
808  void setOriginatingAccountName(const TQString& account) { if(mOriginatingAccountName != account) { mOriginatingAccountName=account; setDirty(true); } }
809 
813  size_t msgSize() const { return mMsgSize; }
814  void setMsgSize(size_t sz) { if(mMsgSize != sz) { mMsgSize = sz; setDirty(true); } }
815 
818  size_t msgLength() const
819  { return (mMsgLength) ? mMsgLength : mMsgSize; }
820  void setMsgLength(size_t sz) { mMsgLength = sz; }
821 
823  size_t msgSizeServer() const;
824  void setMsgSizeServer(size_t sz);
825 
827  ulong UID() const;
828  void setUID(ulong uid);
829 
831  KMMsgStatus status() const { return mStatus; }
833  void setStatus(const KMMsgStatus status, int idx = -1);
834  void setStatus(const char* s1, const char* s2=0) { KMMsgBase::setStatus(s1, s2); }
835 
837  void setEncryptionState(const KMMsgEncryptionState, int idx = -1);
838 
840  void setSignatureState(const KMMsgSignatureState, int idx = -1);
841 
842  void setMDNSentState( KMMsgMDNSentState status, int idx=-1 );
843 
845  KMMsgEncryptionState encryptionState() const { return mEncryptionState; }
846 
848  KMMsgSignatureState signatureState() const { return mSignatureState; }
849 
850  KMMsgMDNSentState mdnSentState() const { return mMDNSentState; }
851 
853  void link(const KMMessage *aMsg, KMMsgStatus aStatus);
856  void getLink(int n, ulong *retMsgSerNum, KMMsgStatus *reStatus) const;
857 
859  TQString formatString(const TQString&) const;
860 
862  void updateBodyPart(const TQString partSpecifier, const TQByteArray & data);
863 
865  DwBodyPart* lastUpdatedPart() { return mLastUpdated; }
866 
868  bool isComplete() const { return mComplete; }
870  void setComplete( bool v ) { mComplete = v; }
871 
873  bool readyToShow() const { return mReadyToShow; }
875  void setReadyToShow( bool v ) { mReadyToShow = v; }
876 
877  void updateAttachmentState( DwBodyPart *part = 0 );
878  void updateInvitationState();
879 
881  bool transferInProgress() const;
883  void setTransferInProgress(bool value, bool force = false);
884 
889  TQCString mboxMessageSeparator();
890 
906  TQString asQuotedString( const TQString & headerStr,
907  const TQString & indentStr,
908  const TQString & selection=TQString(),
909  bool aStripSignature=true,
910  bool allowDecryption=true) const;
911 
914  TQString asPlainText( bool stripSignature, bool allowDecryption ) const;
915 
922  TQString asPlainTextFromObjectTree( partNode *root, bool stripSignature,
923  bool allowDecryption ) const;
924 
926  int getCursorPos() { return mCursorPos; };
928  void setCursorPos(int pos) { mCursorPos = pos; };
929 
931  KMMsgInfo* msgInfo() { return mMsgInfo; }
933  void setMsgInfo( KMMsgInfo* msgInfo ) { mMsgInfo = msgInfo; }
934 
935  /* This is set in kmreaderwin if a message is being parsed to avoid
936  other parts of kmail (e.g. kmheaders) destroying the message.
937  Parsing can take longer and can be async (in case of gpg mails) */
938  bool isBeingParsed() const { return mIsParsed; }
939  void setIsBeingParsed( bool t ) { mIsParsed = t; }
940 
942  void deleteWhenUnused();
943 
944  DwBodyPart* findPart( int index );
945 
946 private:
947 
949  void init( DwMessage* aMsg = 0 );
951  void assign( const KMMessage& other );
952 
953  DwBodyPart* findPartInternal( DwEntity* root, int index, int &accu );
954 
955  TQString mDrafts;
956  TQString mTemplates;
957  mutable DwMessage* mMsg;
958  mutable bool mNeedsAssembly :1;
959  bool mDecodeHTML :1;
960  bool mReadyToShow :1;
961  bool mComplete :1;
962  bool mIsParsed : 1;
963  static const KMail::HeaderStrategy * sHeaderStrategy;
964  static TQString sForwardStr;
965  const TQTextCodec * mOverrideCodec;
966 
967  TQString mFileName;
968  TQString mOriginatingAccountName;
969  off_t mFolderOffset;
970  size_t mMsgSize, mMsgLength;
971  time_t mDate;
972  KMMsgEncryptionState mEncryptionState;
973  KMMsgSignatureState mSignatureState;
974  KMMsgMDNSentState mMDNSentState;
975  KMMessage* mUnencryptedMsg;
976  DwBodyPart* mLastUpdated;
977  int mCursorPos;
978  KMMsgInfo* mMsgInfo; // used to remember the KMMsgInfo object this KMMessage replaced in the KMMsgList
979  static TQValueList<KMMessage*> sPendingDeletes;
980 };
981 
982 
983 #endif /*kmmessage_h*/
static TQCString defaultCharset()
Get the default message charset.
Definition: kmmessage.cpp:4078
static TQStringList stripMyAddressesFromAddressList(const TQStringList &list)
Strips all the user's addresses from an address list.
Definition: kmmessage.cpp:3919
void addDwBodyPart(DwBodyPart *aDwPart)
Append a DwBodyPart to the message.
Definition: kmmessage.cpp:3351
void setSignatureState(const KMMsgSignatureState, int idx=-1)
Set signature status of the message.
Definition: kmmessage.cpp:4172
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:1398
TQCString typeStr() const
Get or set the 'Content-Type' header field The member functions that involve enumerated types (ints) ...
Definition: kmmessage.cpp:2394
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:2278
KMMessage * unencryptedMsg() const
Returns an unencrypted copy of this message or 0 if none exists.
Definition: kmmessage.h:138
TQString replyToAuxIdMD5() const
Get the second to last id from the References header field.
Definition: kmmessage.cpp:2149
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:838
static TQString smartQuote(const TQString &msg, int maxLineLength)
Given argument msg add quoting characters and relayout for max width maxLength.
Definition: kmmessage.cpp:649
TQString subject() const
Get or set the 'Subject' header field.
Definition: kmmessage.cpp:2052
virtual ~KMMessage()
Destructor.
Definition: kmmessage.cpp:193
TQString from() const
Get or set the 'From' header field.
Definition: kmmessage.cpp:2018
DwMediaType & dwContentType()
Return reference to Content-Type header for direct manipulation.
Definition: kmmessage.cpp:392
void cleanupHeader()
Removes empty fields from the header, e.g.
Definition: kmmessage.cpp:1757
void setStatus(const KMMsgStatus status, int idx=-1)
Set status and mark dirty.
Definition: kmmessage.cpp:4156
TQString replaceHeadersInString(const TQString &s) const
Replaces every occurrence of "${foo}" in s with headerField("foo")
Definition: kmmessage.cpp:1613
const TQTextCodec * codec() const
Get a TQTextCodec suitable for this message part.
Definition: kmmessage.cpp:4456
A FolderStorage with an index for faster access to often used message properties. ...
Definition: kmfolderindex.h:37
void applyIdentity(uint id)
Set the from, to, cc, bcc, encrytion etc headers as specified in the given identity.
Definition: kmmessage.cpp:1665
TQString msgId() const
Get or set the 'Message-Id' header field.
Definition: kmmessage.cpp:2185
TQCString id() const
Returns the message ID, useful for followups.
Definition: kmmessage.cpp:211
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:1745
void initHeader(uint identity=0)
Initialize header fields.
Definition: kmmessage.cpp:1718
TQString sender() const
Definition: kmmessage.cpp:2042
static KMime::Types::AddressList splitAddrField(const TQCString &str)
Splits the given address list into separate addresses.
Definition: kmmessage.cpp:2241
void setBodyFromUnicode(const TQString &str, DwEntity *entity=0)
Sets this body's content to str.
Definition: kmmessage.cpp:4443
TQCString bodyDecoded() const
Returns a decoded version of the body from the current content transfer encoding. ...
Definition: kmmessage.cpp:2611
TQCString cteStr() const
Cte is short for ContentTransferEncoding.
Definition: kmmessage.h:531
void getLink(int n, ulong *retMsgSerNum, KMMsgStatus *reStatus) const
Returns the information for the Nth link into retMsg and reStatus.
Definition: kmmessage.cpp:4219
bool subjectIsPrefixed() const
Is the subject prefixed by Re: or similar?
Definition: kmmessage.cpp:2172
void del()
Mark the message as deleted.
Definition: kmmessage.h:153
uint identityUoid() const
Definition: kmmessage.cpp:1730
bool readyToShow() const
Return if the message is ready to be shown.
Definition: kmmessage.h:873
KMMsgBase & toMsgBase()
Get KMMsgBase for this object.
Definition: kmmessage.h:115
TQString templates() const
Get or set the 'Templates' folder.
Definition: kmmessage.h:338
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:276
void setBody(const TQCString &aStr)
Set the message body.
Definition: kmmessage.cpp:2777
TQString fileName() const
Get/set filename in mail folder.
Definition: kmmessage.h:803
static void setDwMediaTypeParam(DwMediaType &mType, const TQCString &attr, const TQCString &val)
add or change a parameter of a DwMediaType field
Definition: kmmessage.cpp:2467
static TQString quoteHtmlChars(const TQString &str, bool removeLineBreaks=false)
Quotes the following characters which have a special meaning in HTML: '<' '>' '&' '"'...
Definition: kmmessage.cpp:3807
void setNeedsAssembly()
tell the message that internal data were changed (must be called after directly modifying message str...
Definition: kmmessage.cpp:2556
TQString drafts() const
Get or set the 'Drafts' folder.
Definition: kmmessage.h:334
KMime::Types::AddressList headerAddrField(const TQCString &name) const
Returns header address list as string list.
Definition: kmmessage.cpp:2254
void setBodyEncoded(const TQCString &aStr, DwEntity *entity=0)
Set the message body, encoding it according to the current content transfer encoding.
Definition: kmmessage.cpp:2722
void setCharset(const TQCString &charset, DwEntity *entity=0)
Sets the charset of the message or a subpart of the message.
Definition: kmmessage.cpp:4117
static void bodyPart(DwBodyPart *aDwBodyPart, KMMessagePart *aPart, bool withBody=true)
Fill the KMMessagePart structure for a given DwBodyPart.
Definition: kmmessage.cpp:3111
void setStatusFields()
Set "Status" and "X-Status" fields of the message from the internal message status.
Definition: kmmessage.cpp:354
static TQStringList stripAddressFromAddressList(const TQString &address, const TQStringList &addresses)
Strips an address from an address list.
Definition: kmmessage.cpp:3897
DwBodyPart * getFirstDwBodyPart() const
Get the 1st DwBodyPart.
Definition: kmmessage.cpp:2851
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:2342
KMMsgStatus status() const
Status of the message.
Definition: kmmessage.h:831
void removeHeaderFields(const TQCString &name)
Remove all header fields with given name.
Definition: kmmessage.cpp:2331
static TQString generateMessageId(const TQString &addr)
Generates the Message-Id.
Definition: kmmessage.cpp:3367
TQString headerField(const TQCString &name) const
Returns the value of a header field with the given name.
Definition: kmmessage.cpp:2292
DwBodyPart * createDWBodyPart(const KMMessagePart *aPart)
Compose a DwBodyPart (needed for adding a part to the message).
Definition: kmmessage.cpp:3221
static TQCString html2source(const TQCString &src)
Convert '<' into "<" resp.
Definition: kmmessage.cpp:3392
void setComplete(bool v)
Set if the message is a complete message.
Definition: kmmessage.h:870
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:866
The widget that shows the contents of folders.
Definition: kmheaders.h:48
TQCString dateShortStr() const
Returns the message date in asctime format or an empty string if the message lacks a Date header...
Definition: kmmessage.cpp:1818
KMMsgInfo * msgInfo()
Get the KMMsgInfo object that was set with setMsgInfo().
Definition: kmmessage.h:931
TQString references() const
Get or set the references for this message.
Definition: kmmessage.cpp:2128
void removePrivateHeaderFields()
Remove all private header fields: *Status: and X-KMail-*.
Definition: kmmessage.cpp:338
bool deleteBodyPart(int partIndex)
Delete a body part with the specified part index.
Definition: kmmessage.cpp:3184
DwHeaders & headers() const
get the DwHeaders (make sure to call setNeedsAssembly() function after directly modyfying internal da...
Definition: kmmessage.cpp:2549
TQString xmark() const
Get or set the 'X-Mark' header field.
Definition: kmmessage.cpp:2067
void setMsgSerNum(unsigned long newMsgSerNum=0)
Sets the message serial number.
Definition: kmmessage.cpp:226
TQStringList headerFields(const TQCString &name) const
Returns a list of the values of all header fields with the given name.
Definition: kmmessage.cpp:2305
int partNumber(DwBodyPart *aDwBodyPart) const
Get the number of the given DwBodyPart.
Definition: kmmessage.cpp:2858
TQCString rawHeaderField(const TQCString &name) const
Returns the raw value of a header field with the given name.
Definition: kmmessage.cpp:2267
bool transferInProgress() const
Return, if the message should not be deleted.
Definition: kmmessage.cpp:239
TQCString subtypeStr() const
Subtype.
Definition: kmmessage.cpp:2431
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:2688
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:825
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:3956
void setMsgInfo(KMMsgInfo *msgInfo)
Set the KMMsgInfo object corresponding to this message.
Definition: kmmessage.h:933
KMMessage * createDeliveryReceipt() const
Create a new message that is a delivery receipt of this message, filling required header fileds with ...
Definition: kmmessage.cpp:1638
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:2640
void setReadyToShow(bool v)
Set if the message is ready to be shown.
Definition: kmmessage.h:875
void touch()
Touch the message - mark it as read.
Definition: kmmessage.h:159
TQString headerAsString() const
Return header as string.
Definition: kmmessage.cpp:381
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:3940
Mail folder.
Definition: kmfolder.h:68
void setCursorPos(int pos)
Set cursor position as offset from message start.
Definition: kmmessage.h:928
void setMultiPartBody(const TQCString &aStr)
Hack to enable structured body parts to be set as flat text...
Definition: kmmessage.cpp:2794
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:743
TQCString body() const
Get the message body.
Definition: kmmessage.cpp:2573
void updateBodyPart(const TQString partSpecifier, const TQByteArray &data)
Sets the body of the specified part.
Definition: kmmessage.cpp:4273
void setDateToday()
Set the 'Date' header field to the current date.
Definition: kmmessage.cpp:1862
TQString cc() const
Get or set the 'Cc' header field.
Definition: kmmessage.cpp:1943
TQByteArray asSendableString() const
Return the message contents with the headers that should not be sent stripped off.
Definition: kmmessage.cpp:322
DwBodyPart * dwBodyPart(int aIdx) const
Get the DwBodyPart at position in aIdx.
Definition: kmmessage.cpp:2898
off_t folderOffset() const
Get/set offset in mail folder.
Definition: kmmessage.h:799
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:1134
TQString formatString(const TQString &) const
Convert wildcards into normal string.
Definition: kmmessage.cpp:429
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:4006
bool isUrgent() const
Definition: kmmessage.cpp:262
void setContentTypeParam(const TQCString &attr, const TQCString &val)
add or change a parameter of the Content-Type field
Definition: kmmessage.cpp:2492
void initStrippedSubjectMD5()
Calculate strippedSubject.
Definition: kmmessage.h:360
static TQString encodeMailtoUrl(const TQString &str)
Encodes an email address as mailto URL.
Definition: kmmessage.cpp:3465
bool isComplete() const
Return true if the complete message is available without referring to the backing store...
Definition: kmmessage.h:868
size_t msgSize() const
Get/set size of message in the folder including the whole header in bytes.
Definition: kmmessage.h:813
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:717
void fromDwString(const DwString &str, bool setStatus=false)
Parse the string and create this message from it.
Definition: kmmessage.cpp:405
void deleteBodyParts()
Delete all body parts.
Definition: kmmessage.cpp:3177
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:268
TQString fcc() const
Get or set the 'Fcc' header field.
Definition: kmmessage.cpp:1984
TQCString contentTransferEncodingStr() const
Get or set the 'Content-Transfer-Encoding' header field The member functions that involve enumerated ...
Definition: kmmessage.cpp:2502
KMMessage * takeUnencryptedMsg()
Returns an unencrypted copy of this message or 0 if none exists.
Definition: kmmessage.h:145
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:1232
TQCString headerAsSendableString() const
Return the message header with the headers that should not be sent stripped off.
Definition: kmmessage.cpp:330
TQString to() const
Get or set the 'To' header field.
Definition: kmmessage.cpp:1897
void assembleIfNeeded()
Assemble the internal message.
Definition: kmmessage.cpp:2562
TQString subjectMD5() const
Get a hash of the subject.
Definition: kmmessage.cpp:2167
TQCString asString() const
Return the entire message contents as a string.
Definition: kmmessage.cpp:317
void setDecodeHTML(bool aDecodeHTML)
Allow decoding of HTML for quoting.
Definition: kmmessage.h:786
TQString replyTo() const
Get or set the 'ReplyTo' header field.
Definition: kmmessage.cpp:1922
KMMsgEncryptionState encryptionState() const
Encryption status of the message.
Definition: kmmessage.h:845
KMMessage(KMFolder *parent=0)
Straight forward initialization.
Definition: kmmessage.cpp:100
static TQString decodeMailtoUrl(const TQString &url)
Decodes a mailto URL.
Definition: kmmessage.cpp:3476
void addBodyPart(const KMMessagePart *aPart)
Append a body part to the message.
Definition: kmmessage.cpp:3359
void sanitizeHeaders(const TQStringList &whiteList=TQStringList())
Remove all headers but the content description ones, and those in the white list. ...
Definition: kmmessage.cpp:1213
DwBodyPart * lastUpdatedPart()
Returns the last DwBodyPart that was updated.
Definition: kmmessage.h:865
void undel()
Undelete the message.
Definition: kmmessage.h:156
DwBodyPart * findDwBodyPart(int type, int subtype) const
Return the first DwBodyPart matching a given Content-Type or zero, if no found.
Definition: kmmessage.cpp:2938
TQString bcc() const
Get or set the 'Bcc' header field.
Definition: kmmessage.cpp:1971
static TQCString stripEmailAddr(const TQCString &emailAddr)
This function generates a displayable string from a list of email addresses.
Definition: kmmessage.cpp:3486
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:3843
folderdiaquotatab.h
Definition: aboutdata.cpp:40
static const TQStringList & preferredCharsets()
Get a list of preferred message charsets.
Definition: kmmessage.cpp:4095
KMMsgSignatureState signatureState() const
Signature status of the message.
Definition: kmmessage.h:848
TQCString charset() const
Get the message charset.
Definition: kmmessage.cpp:4101
This is a Mime Message.
Definition: kmmessage.h:68
TQString strippedSubjectMD5() const
Get a hash of the subject with all prefixes such as Re: removed.
Definition: kmmessage.cpp:2162
static void readConfig()
Reads config settings from group "KMMessage" and sets all internal variables (e.g.
Definition: kmmessage.cpp:4036
ulong UID() const
Get/set UID.
Definition: kmmessage.cpp:2228
TQCString mboxMessageSeparator()
Returns an mbox message separator line for this message, i.e.
Definition: kmmessage.cpp:4484
int getCursorPos()
Get stored cursor position.
Definition: kmmessage.h:926
void setTransferInProgress(bool value, bool force=false)
Set that the message shall not be deleted because it is still required.
Definition: kmmessage.cpp:246
size_t msgLength() const
Unlike the above function this works also, if the message is not in a folder.
Definition: kmmessage.h:818
void setOverrideCodec(const TQTextCodec *codec)
Set the charset the user selected for the message to display.
Definition: kmmessage.h:783
bool hasUnencryptedMsg() const
Returns TRUE if the message contains an unencrypted copy of itself.
Definition: kmmessage.h:135
void removeHeaderField(const TQCString &name)
Remove header field with given name.
Definition: kmmessage.cpp:2320
TQString bodyToUnicode(const TQTextCodec *codec=0) const
Returns the body part decoded to unicode.
Definition: kmmessage.cpp:4474
TQString dateStr() const
Get or set the 'Date' header field.
Definition: kmmessage.cpp:1800
TQString originatingAccountName() const
Get/set originating account name.
Definition: kmmessage.h:807
bool isMessage() const
Returns TRUE if object is a real message (not KMMsgInfo or KMMsgBase)
Definition: kmmessage.cpp:233
void link(const KMMessage *aMsg, KMMsgStatus aStatus)
Links this message to aMsg, setting link type to aStatus.
Definition: kmmessage.cpp:4193
int numBodyParts() const
Number of body parts the message has.
Definition: kmmessage.cpp:2809
void setEncryptionState(const KMMsgEncryptionState, int idx=-1)
Set encryption status of the message.
Definition: kmmessage.cpp:4163
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:1780
void deleteWhenUnused()
Delete this message as soon as it no longer in use.
Definition: kmmessage.cpp:4500
const DwString & asDwString() const
Return the entire message contents in the DwString.
Definition: kmmessage.cpp:295
TQCString createForwardBody()
Create the forwarded body for the message.
Definition: kmmessage.cpp:1185
size_t msgSizeServer() const
Get/set size on server.
Definition: kmmessage.cpp:2215
TQString replyToId() const
Get or set the 'In-Reply-To' header field.
Definition: kmmessage.cpp:2082
TQCString getRefStr() const
Creates reference string for reply to messages.
Definition: kmmessage.cpp:1106
TQString who() const
Get or set the 'Who' header field.
Definition: kmmessage.cpp:2009