00001
00002
00003 #ifdef HAVE_CONFIG_H
00004 #include <config.h>
00005 #endif
00006
00007 #include "kmmsginfo.h"
00008 #include "kmmessage.h"
00009
00010
00011 #include <stdlib.h>
00012 #include <string.h>
00013 #include <stdio.h>
00014 #include <assert.h>
00015 #include <mimelib/datetime.h>
00016
00017 class KMMsgInfo::KMMsgInfoPrivate
00018 {
00019 public:
00020 enum {
00021 SUBJECT_SET = 0x01, TO_SET = 0x02, REPLYTO_SET = 0x04, MSGID_SET=0x08,
00022 DATE_SET = 0x10, OFFSET_SET = 0x20, SIZE_SET = 0x40, SIZESERVER_SET = 0x80,
00023 XMARK_SET=0x100, FROM_SET=0x200, FILE_SET=0x400, ENCRYPTION_SET=0x800,
00024 SIGNATURE_SET=0x1000, MDN_SET=0x2000, REPLYTOAUX_SET = 0x4000,
00025 STRIPPEDSUBJECT_SET = 0x8000, UID_SET = 0x10000,
00026
00027 ALL_SET = 0xFFFFFF, NONE_SET = 0x000000
00028 };
00029 uint modifiers;
00030 QString subject, from, to, replyToIdMD5, replyToAuxIdMD5,
00031 strippedSubjectMD5, msgIdMD5, xmark, file;
00032 off_t folderOffset;
00033 size_t msgSize, msgSizeServer;
00034 time_t date;
00035 KMMsgEncryptionState encryptionState;
00036 KMMsgSignatureState signatureState;
00037 KMMsgMDNSentState mdnSentState;
00038 ulong UID;
00039
00040 KMMsgInfoPrivate() : modifiers(NONE_SET) { }
00041 KMMsgInfoPrivate& operator=(const KMMsgInfoPrivate& other) {
00042 modifiers = NONE_SET;
00043 if (other.modifiers & SUBJECT_SET) {
00044 modifiers |= SUBJECT_SET;
00045 subject = other.subject;
00046 }
00047 if (other.modifiers & STRIPPEDSUBJECT_SET) {
00048 modifiers |= STRIPPEDSUBJECT_SET;
00049 strippedSubjectMD5 = other.strippedSubjectMD5;
00050 }
00051 if (other.modifiers & FROM_SET) {
00052 modifiers |= FROM_SET;
00053 from = other.from;
00054 }
00055 if (other.modifiers & FILE_SET) {
00056 modifiers |= FILE_SET;
00057 file = other.from;
00058 }
00059 if (other.modifiers & TO_SET) {
00060 modifiers |= TO_SET;
00061 to = other.to;
00062 }
00063 if (other.modifiers & REPLYTO_SET) {
00064 modifiers |= REPLYTO_SET;
00065 replyToIdMD5 = other.replyToIdMD5;
00066 }
00067 if (other.modifiers & REPLYTOAUX_SET) {
00068 modifiers |= REPLYTOAUX_SET;
00069 replyToAuxIdMD5 = other.replyToAuxIdMD5;
00070 }
00071
00072 if(other.modifiers & MSGID_SET) {
00073 modifiers |= MSGID_SET;
00074 msgIdMD5 = other.msgIdMD5;
00075 }
00076 if(other.modifiers & XMARK_SET) {
00077 modifiers |= XMARK_SET;
00078 xmark = other.xmark;
00079 }
00080 if(other.modifiers & OFFSET_SET) {
00081 modifiers |= OFFSET_SET;
00082 folderOffset = other.folderOffset;
00083 }
00084 if(other.modifiers & SIZE_SET) {
00085 modifiers |= SIZE_SET;
00086 msgSize = other.msgSize;
00087 }
00088 if(other.modifiers & DATE_SET) {
00089 modifiers |= DATE_SET;
00090 date = other.date;
00091 }
00092 if(other.modifiers & ENCRYPTION_SET) {
00093 modifiers |= ENCRYPTION_SET;
00094 encryptionState = other.encryptionState;
00095 }
00096 if(other.modifiers & SIGNATURE_SET) {
00097 modifiers |= SIGNATURE_SET;
00098 signatureState = other.signatureState;
00099 }
00100 if(other.modifiers & MDN_SET) {
00101 modifiers |= MDN_SET;
00102 mdnSentState = other.mdnSentState;
00103 }
00104 if(other.modifiers & SIZESERVER_SET) {
00105 modifiers |= SIZESERVER_SET;
00106 msgSizeServer = other.msgSizeServer;
00107 }
00108 if(other.modifiers & UID_SET) {
00109 modifiers |= UID_SET;
00110 UID = other.UID;
00111 }
00112 return *this;
00113 }
00114 };
00115
00116
00117 KMMsgInfo::KMMsgInfo(KMFolder* p, off_t off, short len) :
00118 KMMsgBase(p),
00119 kd(0)
00120 {
00121 setIndexOffset(off);
00122 setIndexLength(len);
00123 setEnableUndo(true);
00124 }
00125
00126
00127
00128 KMMsgInfo::~KMMsgInfo()
00129 {
00130 delete kd;
00131 }
00132
00133
00134 #if 0 // currently unused
00135
00136 KMMsgInfo& KMMsgInfo::operator=(const KMMsgInfo& other)
00137 {
00138 KMMsgBase::assign(&other);
00139 if(other.kd) {
00140 if(!kd)
00141 kd = new KMMsgInfoPrivate;
00142 *kd = *other.kd;
00143 } else {
00144 delete kd;
00145 kd = 0;
00146 }
00147 mStatus = other.status();
00148 return *this;
00149 }
00150 #endif
00151
00152
00153 KMMsgInfo& KMMsgInfo::operator=(const KMMessage& msg)
00154 {
00155 KMMsgBase::assign(&msg.toMsgBase());
00156 if(!kd)
00157 kd = new KMMsgInfoPrivate;
00158 kd->modifiers = KMMsgInfoPrivate::ALL_SET;
00159 kd->subject = msg.subject();
00160 kd->from = msg.fromStrip();
00161 kd->to = msg.toStrip();
00162 kd->replyToIdMD5 = msg.replyToIdMD5();
00163 kd->replyToAuxIdMD5 = msg.replyToAuxIdMD5();
00164 kd->strippedSubjectMD5 = msg.strippedSubjectMD5();
00165 kd->msgIdMD5 = msg.msgIdMD5();
00166 kd->xmark = msg.xmark();
00167 mStatus = msg.status();
00168 kd->folderOffset = msg.folderOffset();
00169 kd->msgSize = msg.msgSize();
00170 kd->date = msg.date();
00171 kd->file = msg.fileName();
00172 kd->encryptionState = msg.encryptionState();
00173 kd->signatureState = msg.signatureState();
00174 kd->mdnSentState = msg.mdnSentState();
00175 kd->msgSizeServer = msg.msgSizeServer();
00176 kd->UID = msg.UID();
00177 return *this;
00178 }
00179
00180
00181 void KMMsgInfo::init(const QCString& aSubject, const QCString& aFrom,
00182 const QCString& aTo, time_t aDate,
00183 KMMsgStatus aStatus, const QCString& aXMark,
00184 const QCString& replyToId, const QCString& replyToAuxId,
00185 const QCString& msgId,
00186 KMMsgEncryptionState encryptionState,
00187 KMMsgSignatureState signatureState,
00188 KMMsgMDNSentState mdnSentState,
00189 off_t aFolderOffset, size_t aMsgSize,
00190 size_t aMsgSizeServer, ulong aUID)
00191 {
00192 mIndexOffset = 0;
00193 mIndexLength = 0;
00194 if(!kd)
00195 kd = new KMMsgInfoPrivate;
00196 kd->modifiers = KMMsgInfoPrivate::ALL_SET;
00197 kd->subject = decodeRFC2047String(aSubject);
00198 kd->from = decodeRFC2047String( KMMessage::stripEmailAddr( aFrom ) );
00199 kd->to = decodeRFC2047String( KMMessage::stripEmailAddr( aTo ) );
00200 kd->replyToIdMD5 = base64EncodedMD5( replyToId );
00201 kd->replyToAuxIdMD5 = base64EncodedMD5( replyToAuxId );
00202 kd->strippedSubjectMD5 = base64EncodedMD5( KMMessage::stripOffPrefixes( kd->subject ), true );
00203 kd->msgIdMD5 = base64EncodedMD5( msgId );
00204 kd->xmark = aXMark;
00205 kd->folderOffset = aFolderOffset;
00206 mStatus = aStatus;
00207 kd->msgSize = aMsgSize;
00208 kd->date = aDate;
00209 kd->file = "";
00210 kd->encryptionState = encryptionState;
00211 kd->signatureState = signatureState;
00212 kd->mdnSentState = mdnSentState;
00213 kd->msgSizeServer = aMsgSizeServer;
00214 kd->UID = aUID;
00215 mDirty = false;
00216 }
00217
00218 void KMMsgInfo::init(const QCString& aSubject, const QCString& aFrom,
00219 const QCString& aTo, time_t aDate,
00220 KMMsgStatus aStatus, const QCString& aXMark,
00221 const QCString& replyToId, const QCString& replyToAuxId,
00222 const QCString& msgId,
00223 const QCString& aFileName,
00224 KMMsgEncryptionState encryptionState,
00225 KMMsgSignatureState signatureState,
00226 KMMsgMDNSentState mdnSentState,
00227 size_t aMsgSize,
00228 size_t aMsgSizeServer, ulong aUID)
00229 {
00230
00231 init( aSubject, aFrom, aTo, aDate, aStatus, aXMark, replyToId, replyToAuxId,
00232 msgId, encryptionState, signatureState, mdnSentState,
00233 (unsigned long)0, aMsgSize, aMsgSizeServer, aUID );
00234 kd->file = aFileName;
00235 }
00236
00237
00238
00239 QString KMMsgInfo::subject(void) const
00240 {
00241 if (kd && kd->modifiers & KMMsgInfoPrivate::SUBJECT_SET)
00242 return kd->subject;
00243 return getStringPart(MsgSubjectPart);
00244 }
00245
00246
00247
00248 QString KMMsgInfo::fromStrip(void) const
00249 {
00250 if (kd && kd->modifiers & KMMsgInfoPrivate::FROM_SET)
00251 return kd->from;
00252 return getStringPart(MsgFromPart);
00253 }
00254
00255
00256 QString KMMsgInfo::fileName(void) const
00257 {
00258 if (kd && kd->modifiers & KMMsgInfoPrivate::FILE_SET)
00259 return kd->file;
00260 return getStringPart(MsgFilePart);
00261 }
00262
00263
00264
00265 QString KMMsgInfo::toStrip(void) const
00266 {
00267 if (kd && kd->modifiers & KMMsgInfoPrivate::TO_SET)
00268 return kd->to;
00269 return getStringPart(MsgToPart);
00270 }
00271
00272
00273 QString KMMsgInfo::xmark(void) const
00274 {
00275 if (kd && kd->modifiers & KMMsgInfoPrivate::XMARK_SET)
00276 return kd->xmark;
00277 return getStringPart(MsgXMarkPart);
00278 }
00279
00280
00281
00282 QString KMMsgInfo::replyToIdMD5(void) const
00283 {
00284 if (kd && kd->modifiers & KMMsgInfoPrivate::REPLYTO_SET)
00285 return kd->replyToIdMD5;
00286 return getStringPart(MsgReplyToIdMD5Part);
00287 }
00288
00289
00290 QString KMMsgInfo::replyToAuxIdMD5() const
00291 {
00292 if( kd && kd->modifiers & KMMsgInfoPrivate::REPLYTOAUX_SET )
00293 return kd->replyToAuxIdMD5;
00294 return getStringPart( MsgReplyToAuxIdMD5Part );
00295 }
00296
00297
00298 QString KMMsgInfo::strippedSubjectMD5() const
00299 {
00300 if( kd && kd->modifiers & KMMsgInfoPrivate::STRIPPEDSUBJECT_SET )
00301 return kd->strippedSubjectMD5;
00302 return getStringPart( MsgStrippedSubjectMD5Part );
00303 }
00304
00305
00306
00307 bool KMMsgInfo::subjectIsPrefixed() const
00308 {
00309 return strippedSubjectMD5() != base64EncodedMD5( subject().stripWhiteSpace(), true );
00310 }
00311
00312
00313 QString KMMsgInfo::msgIdMD5(void) const
00314 {
00315 if (kd && kd->modifiers & KMMsgInfoPrivate::MSGID_SET)
00316 return kd->msgIdMD5;
00317 return getStringPart(MsgIdMD5Part);
00318 }
00319
00320
00321
00322 void KMMsgInfo::setSubject(const QString& aSubject)
00323 {
00324 if(aSubject == subject())
00325 return;
00326
00327 if (!kd)
00328 kd = new KMMsgInfoPrivate;
00329 kd->modifiers |= KMMsgInfoPrivate::SUBJECT_SET;
00330 kd->subject = aSubject;
00331 mDirty = true;
00332 }
00333
00334
00335
00336 void KMMsgInfo::setXMark(const QString& aXMark)
00337 {
00338 if (aXMark == xmark())
00339 return;
00340
00341 if (!kd)
00342 kd = new KMMsgInfoPrivate;
00343 kd->modifiers |= KMMsgInfoPrivate::XMARK_SET;
00344 kd->xmark = aXMark;
00345 mDirty = true;
00346 }
00347
00348
00349
00350 void KMMsgInfo::setReplyToIdMD5(const QString& aReplyToIdMD5)
00351 {
00352 if (aReplyToIdMD5 == replyToIdMD5())
00353 return;
00354
00355 if (!kd)
00356 kd = new KMMsgInfoPrivate;
00357 kd->modifiers |= KMMsgInfoPrivate::REPLYTO_SET;
00358 kd->replyToIdMD5 = aReplyToIdMD5;
00359 mDirty = true;
00360 }
00361
00362
00363
00364 void KMMsgInfo::setReplyToAuxIdMD5( const QString& aReplyToAuxIdMD5 )
00365 {
00366 if( aReplyToAuxIdMD5 == replyToAuxIdMD5() )
00367 return;
00368
00369 if( !kd )
00370 kd = new KMMsgInfoPrivate;
00371 kd->modifiers |= KMMsgInfoPrivate::REPLYTOAUX_SET;
00372 kd->replyToAuxIdMD5 = aReplyToAuxIdMD5;
00373 mDirty = true;
00374 }
00375
00376
00377
00378 void KMMsgInfo::initStrippedSubjectMD5()
00379 {
00380 if( kd && kd->modifiers & KMMsgInfoPrivate::STRIPPEDSUBJECT_SET )
00381 return;
00382 QString rawSubject = KMMessage::stripOffPrefixes( subject() );
00383 QString subjectMD5 = base64EncodedMD5( rawSubject, true );
00384 if( !kd )
00385 kd = new KMMsgInfoPrivate;
00386 kd->modifiers |= KMMsgInfoPrivate::STRIPPEDSUBJECT_SET;
00387 kd->strippedSubjectMD5 = subjectMD5;
00388 mDirty = true;
00389 }
00390
00391
00392
00393 void KMMsgInfo::setMsgIdMD5(const QString& aMsgIdMD5)
00394 {
00395 if (aMsgIdMD5 == msgIdMD5())
00396 return;
00397
00398 if (!kd)
00399 kd = new KMMsgInfoPrivate;
00400 kd->modifiers |= KMMsgInfoPrivate::MSGID_SET;
00401 kd->msgIdMD5 = aMsgIdMD5;
00402 mDirty = true;
00403 }
00404
00405
00406 void KMMsgInfo::setEncryptionState( const KMMsgEncryptionState s, int idx )
00407 {
00408 if (s == encryptionState())
00409 return;
00410
00411 if (!kd)
00412 kd = new KMMsgInfoPrivate;
00413 kd->modifiers |= KMMsgInfoPrivate::ENCRYPTION_SET;
00414 kd->encryptionState = s;
00415 KMMsgBase::setEncryptionState(s, idx);
00416 mDirty = true;
00417 }
00418
00419
00420 void KMMsgInfo::setSignatureState( const KMMsgSignatureState s, int idx )
00421 {
00422 if (s == signatureState())
00423 return;
00424
00425 if (!kd)
00426 kd = new KMMsgInfoPrivate;
00427 kd->modifiers |= KMMsgInfoPrivate::SIGNATURE_SET;
00428 kd->signatureState = s;
00429 KMMsgBase::setSignatureState(s, idx);
00430 mDirty = true;
00431 }
00432
00433
00434 void KMMsgInfo::setMDNSentState( const KMMsgMDNSentState s, int idx )
00435 {
00436 if (s == mdnSentState())
00437 return;
00438
00439 if (!kd)
00440 kd = new KMMsgInfoPrivate;
00441 kd->modifiers |= KMMsgInfoPrivate::MDN_SET;
00442 kd->mdnSentState = s;
00443 KMMsgBase::setMDNSentState(s, idx);
00444 mDirty = true;
00445 }
00446
00447
00448 KMMsgStatus KMMsgInfo::status(void) const
00449 {
00450 if (mStatus == KMMsgStatusUnknown) {
00451 KMMsgStatus st = (KMMsgStatus)getLongPart(MsgStatusPart);
00452 if (!st) {
00453
00454
00455 mLegacyStatus = (KMLegacyMsgStatus)getLongPart(MsgLegacyStatusPart);
00456 st = KMMsgStatusRead;
00457 switch (mLegacyStatus) {
00458 case KMLegacyMsgStatusUnknown:
00459 st = KMMsgStatusUnknown;
00460 break;
00461 case KMLegacyMsgStatusNew:
00462 st = KMMsgStatusNew;
00463 break;
00464 case KMLegacyMsgStatusUnread:
00465 st = KMMsgStatusUnread;
00466 break;
00467 case KMLegacyMsgStatusRead:
00468 st = KMMsgStatusRead;
00469 break;
00470 case KMLegacyMsgStatusOld:
00471 st = KMMsgStatusOld;
00472 break;
00473 case KMLegacyMsgStatusDeleted:
00474 st |= KMMsgStatusDeleted;
00475 break;
00476 case KMLegacyMsgStatusReplied:
00477 st |= KMMsgStatusReplied;
00478 break;
00479 case KMLegacyMsgStatusForwarded:
00480 st |= KMMsgStatusForwarded;
00481 break;
00482 case KMLegacyMsgStatusQueued:
00483 st |= KMMsgStatusQueued;
00484 break;
00485 case KMLegacyMsgStatusSent:
00486 st |= KMMsgStatusSent;
00487 break;
00488 case KMLegacyMsgStatusFlag:
00489 st |= KMMsgStatusFlag;
00490 break;
00491 default:
00492 break;
00493 }
00494
00495 }
00496 mStatus = st;
00497 }
00498 return mStatus;
00499 }
00500
00501
00502
00503 KMMsgEncryptionState KMMsgInfo::encryptionState() const
00504 {
00505 if (kd && kd->modifiers & KMMsgInfoPrivate::ENCRYPTION_SET)
00506 return kd->encryptionState;
00507 unsigned long encState = getLongPart(MsgCryptoStatePart) & 0x0000FFFF;
00508 return encState ? (KMMsgEncryptionState)encState : KMMsgEncryptionStateUnknown;
00509 }
00510
00511
00512 KMMsgSignatureState KMMsgInfo::signatureState() const
00513 {
00514 if (kd && kd->modifiers & KMMsgInfoPrivate::SIGNATURE_SET)
00515 return kd->signatureState;
00516 unsigned long sigState = getLongPart(MsgCryptoStatePart) >> 16;
00517 return sigState ? (KMMsgSignatureState)sigState : KMMsgSignatureStateUnknown;
00518 }
00519
00520 KMMsgMDNSentState KMMsgInfo::mdnSentState() const {
00521 if (kd && kd->modifiers & KMMsgInfoPrivate::MDN_SET)
00522 return kd->mdnSentState;
00523 unsigned long mdnState = getLongPart(MsgMDNSentPart);
00524 return mdnState ? (KMMsgMDNSentState)mdnState : KMMsgMDNStateUnknown;
00525 }
00526
00527
00528
00529 off_t KMMsgInfo::folderOffset(void) const
00530 {
00531 if (kd && kd->modifiers & KMMsgInfoPrivate::OFFSET_SET)
00532 return kd->folderOffset;
00533 return getLongPart(MsgOffsetPart);
00534 }
00535
00536
00537 size_t KMMsgInfo::msgSize(void) const
00538 {
00539 if (kd && kd->modifiers & KMMsgInfoPrivate::SIZE_SET)
00540 return kd->msgSize;
00541 return getLongPart(MsgSizePart);
00542 }
00543
00544
00545 time_t KMMsgInfo::date(void) const
00546 {
00547 time_t res;
00548 if (kd && kd->modifiers & KMMsgInfoPrivate::DATE_SET)
00549 res = kd->date;
00550 else
00551 res = getLongPart(MsgDatePart);
00552 return res;
00553 }
00554
00555
00556 size_t KMMsgInfo::msgSizeServer(void) const
00557 {
00558 if (kd && kd->modifiers & KMMsgInfoPrivate::SIZESERVER_SET)
00559 return kd->msgSizeServer;
00560 return getLongPart(MsgSizeServerPart);
00561 }
00562
00563
00564 ulong KMMsgInfo::UID(void) const
00565 {
00566 if (kd && kd->modifiers & KMMsgInfoPrivate::UID_SET)
00567 return kd->UID;
00568 return getLongPart(MsgUIDPart);
00569 }
00570
00571
00572 void KMMsgInfo::setMsgSize(size_t sz)
00573 {
00574 if (sz == msgSize())
00575 return;
00576
00577 if(!kd)
00578 kd = new KMMsgInfoPrivate;
00579 kd->modifiers |= KMMsgInfoPrivate::SIZE_SET;
00580 kd->msgSize = sz;
00581 mDirty = true;
00582 }
00583
00584
00585 void KMMsgInfo::setMsgSizeServer(size_t sz)
00586 {
00587 if (sz == msgSizeServer())
00588 return;
00589
00590 if(!kd)
00591 kd = new KMMsgInfoPrivate;
00592 kd->modifiers |= KMMsgInfoPrivate::SIZESERVER_SET;
00593 kd->msgSizeServer = sz;
00594 mDirty = true;
00595 }
00596
00597
00598 void KMMsgInfo::setUID(ulong uid)
00599 {
00600 if (uid == UID())
00601 return;
00602
00603 if(!kd)
00604 kd = new KMMsgInfoPrivate;
00605 kd->modifiers |= KMMsgInfoPrivate::UID_SET;
00606 kd->UID = uid;
00607 mDirty = true;
00608 }
00609
00610
00611 void KMMsgInfo::setFolderOffset(off_t offs)
00612 {
00613 if (folderOffset() == offs)
00614 return;
00615
00616 if (!kd)
00617 kd = new KMMsgInfoPrivate;
00618 kd->modifiers |= KMMsgInfoPrivate::OFFSET_SET;
00619 kd->folderOffset = offs;
00620 mDirty = true;
00621 }
00622
00623
00624 void KMMsgInfo::setFileName(const QString& file)
00625 {
00626 if (fileName() == file)
00627 return;
00628
00629 if (!kd)
00630 kd = new KMMsgInfoPrivate;
00631 kd->modifiers |= KMMsgInfoPrivate::FILE_SET;
00632 kd->file = file;
00633 mDirty = true;
00634 }
00635
00636
00637 void KMMsgInfo::setStatus(const KMMsgStatus aStatus, int idx)
00638 {
00639 if(aStatus == status())
00640 return;
00641 KMMsgBase::setStatus(aStatus, idx);
00642 }
00643
00644
00645 void KMMsgInfo::setDate(time_t aUnixTime)
00646 {
00647 if(aUnixTime == date())
00648 return;
00649
00650 if(!kd)
00651 kd = new KMMsgInfoPrivate;
00652 kd->modifiers |= KMMsgInfoPrivate::DATE_SET;
00653 kd->date = aUnixTime;
00654 mDirty = true;
00655 }
00656
00657
00658 void KMMsgInfo::compat_fromOldIndexString(const QCString& str, bool toUtf8)
00659 {
00660 char *start, *offset;
00661
00662 if(!kd)
00663 kd = new KMMsgInfoPrivate;
00664 kd->modifiers = KMMsgInfoPrivate::ALL_SET;
00665 kd->xmark = str.mid(33, 3).stripWhiteSpace();
00666 kd->folderOffset = str.mid(2,9).toULong();
00667 kd->msgSize = str.mid(12,9).toULong();
00668 kd->date = (time_t)str.mid(22,10).toULong();
00669 mStatus = (KMMsgStatus)str.at(0);
00670 if (toUtf8) {
00671 kd->subject = str.mid(37, 100).stripWhiteSpace();
00672 kd->from = str.mid(138, 50).stripWhiteSpace();
00673 kd->to = str.mid(189, 50).stripWhiteSpace();
00674 } else {
00675 start = offset = str.data() + 37;
00676 while (*start == ' ' && start - offset < 100) start++;
00677 kd->subject = QString::fromUtf8(str.mid(start - str.data(),
00678 100 - (start - offset)), 100 - (start - offset));
00679 start = offset = str.data() + 138;
00680 while (*start == ' ' && start - offset < 50) start++;
00681 kd->from = QString::fromUtf8(str.mid(start - str.data(),
00682 50 - (start - offset)), 50 - (start - offset));
00683 start = offset = str.data() + 189;
00684 while (*start == ' ' && start - offset < 50) start++;
00685 kd->to = QString::fromUtf8(str.mid(start - str.data(),
00686 50 - (start - offset)), 50 - (start - offset));
00687 }
00688 kd->replyToIdMD5 = str.mid(240, 22).stripWhiteSpace();
00689 kd->msgIdMD5 = str.mid(263, 22).stripWhiteSpace();
00690 mDirty = false;
00691 }
00692
00693 bool KMMsgInfo::dirty(void) const
00694 {
00695 if( KMMsgBase::dirty() )
00696 return true;
00697 return kd && kd->modifiers != KMMsgInfoPrivate::NONE_SET;
00698 }