Bug 72432 - forwarding messages in imap folders with load on demand enabled makes them dissappear from the headers list temporarily
Summary: forwarding messages in imap folders with load on demand enabled makes them di...
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR critical
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-11 23:58 UTC by Till Adam
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Adam 2004-01-11 23:58:24 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:          Linux

When I forward a message with attachments from an imap folder that has load on demand enabled, the message parts are downloaded and the message correctly forwarded, but changing the current message and back to the forwarded one makes the entry in the headers list go to Subject Unknown, Size 0 etc. Scarer users shitless, Ingo thinks, thus why I'm filing this bug Carsten noticed as a potential showstopper.
Comment 1 Carsten Burghardt 2004-01-15 00:05:38 UTC
Subject: kdepim/kmail

CVS commit by burghard: 

Overriding the msgSize is no good for mbox. The msg was unGetted, the new msgbase inherits the msgsize and the next read
in getMsg broke things. As the msgLength is not saved in the index I have to take a different approach to override LOD for
small messages: after the header was downloaded we check the size again and then fall back to loading "TEXT".

CCMAIL: 72432-done@bugs.kde.org


  M +8 -0      imapaccountbase.cpp   1.37
  M +2 -1      imapjob.cpp   1.41
  M +1 -2      kmfolderimap.cpp   1.163


--- kdepim/kmail/imapaccountbase.cpp  #1.36:1.37
@@ -545,4 +545,12 @@ namespace KMail {
       return;
     }
+    // check the size, if the message is smaller than 5KB then load it in one go
+    if ( msg->msgLength() < 5000 )
+    {
+      FolderJob *job = msg->parent()->createJob(
+          msg, FolderJob::tGetMessage, 0, "TEXT" );
+      job->start();
+      return;
+    }
 
     // download parts according to attachmentstrategy

--- kdepim/kmail/imapjob.cpp  #1.40:1.41
@@ -302,5 +302,6 @@ void ImapJob::slotGetMessageResult( KIO:
         msg->fromByteArray( (*it).data );
         msg->setHeaderField("X-UID",uid);
-        msg->setMsgSize(size);
+        // set correct size
+        msg->setMsgLength(size);
         if ( mPartSpecifier.isEmpty() ) 
           msg->setComplete( true );

--- kdepim/kmail/kmfolderimap.cpp  #1.162:1.163
@@ -1029,5 +1029,5 @@ void KMFolderImap::slotGetMessagesData(K
       flagsToStatus((KMMsgBase*)msg, flags);
       // set the correct size
-      msg->setMsgSize( msg->headerField("X-Length").toUInt() );
+      msg->setMsgLength( msg->headerField("X-Length").toUInt() );
       close();
 
@@ -1051,5 +1051,4 @@ KMFolderImap::doCreateJob( KMMessage *ms
   if ( jt == FolderJob::tGetMessage && partSpecifier == "STRUCTURE" &&
        mAccount && mAccount->loadOnDemand() &&
-       ( msg->msgSize() > 5000 || msg->msgSize() < 600 ) && // the lower bound is for msgs with unknown total size
        ( msg->signatureState() == KMMsgNotSigned || 
          msg->signatureState() == KMMsgSignatureStateUnknown ) )