[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: [PATCH] remove deleted imap-messages
From:       Carsten Burghardt <cb () magic-shop ! de>
Date:       2002-07-10 19:41:54
[Download RAW message or body]

On Wednesday 10 July 2002 19:10, Michael Häckel wrote:
> On Tuesday 09 July 2002 07:41, Carsten Burghardt wrote:
> > That produces more traffic but perhaps you're right and the chance that
> > more messages are out of sync is high. I'll change that.
>
> We produce this traffic every time a folder is visited the first time after
> restarting KMail and it is not that high.

OK, the attached patch forces an update.

> If obviously something is wrong this update is required. Also when messages
> simply disappear when clicking on them that is a bit surprising.

;-)

-- 
Regards,

Carsten Burghardt


[" " (text/x-diff)]

Index: kdenetwork/kmail/kmfolderimap.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderimap.h,v
retrieving revision 1.28
diff -u -3 -p -r1.28 kmfolderimap.h
--- kdenetwork/kmail/kmfolderimap.h	2002/06/06 19:46:41	1.28
+++ kdenetwork/kmail/kmfolderimap.h	2002/07/10 19:35:54
@@ -133,7 +133,7 @@ public:
   /**
    * Retrieve all mails in a folder
    */
-  void getFolder();
+  void getFolder(bool force = FALSE);
 
   /**
    * Get the whole message
Index: kdenetwork/kmail/kmfolderimap.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderimap.cpp,v
retrieving revision 1.61
diff -u -3 -p -r1.61 kmfolderimap.cpp
--- kdenetwork/kmail/kmfolderimap.cpp	2002/06/06 19:46:41	1.61
+++ kdenetwork/kmail/kmfolderimap.cpp	2002/07/10 19:35:55
@@ -604,7 +604,7 @@ kdDebug(5006) << "KMFolderImap::slotChec
 
 
 //-----------------------------------------------------------------------------
-void KMFolderImap::getFolder()
+void KMFolderImap::getFolder(bool force)
 {
   mGuessedUnreadMsgs = -1;
   if (mNoContent)
@@ -614,6 +614,10 @@ void KMFolderImap::getFolder()
     return;
   }
   mContentState = imapInProgress;
+  if (force) {
+    // force an update
+    mCheckFlags = TRUE;
+  }
   checkValidity();
 }
 
@@ -1124,13 +1128,18 @@ void KMImapJob::slotGetMessageResult(KIO
     job->showErrorDialog();
     if (job->error() == KIO::ERR_SLAVE_DIED) account->slaveDied();
   } else {
-    QString uid = mMsg->headerField("X-UID");
-    (*it).data.resize((*it).data.size() + 1);
-    (*it).data[(*it).data.size() - 1] = '\0';
-    mMsg->fromString(QCString((*it).data));
-    mMsg->setHeaderField("X-UID",uid);
-    mMsg->setComplete( TRUE );
-    emit messageRetrieved(mMsg);
+    if ((*it).data.size() > 0)
+    {
+      QString uid = mMsg->headerField("X-UID");
+      (*it).data.resize((*it).data.size() + 1);
+      (*it).data[(*it).data.size() - 1] = '\0';
+      mMsg->fromString(QCString((*it).data));
+      mMsg->setHeaderField("X-UID",uid);
+      mMsg->setComplete( TRUE );
+      emit messageRetrieved(mMsg);
+    } else {
+      emit messageRetrieved(NULL);
+    }
     mMsg = NULL;
   }
   if (account->slave()) account->mapJobData.remove(it);
Index: kdenetwork/kmail/kmmainwin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.cpp,v
retrieving revision 1.492
diff -u -3 -p -r1.492 kmmainwin.cpp
--- kdenetwork/kmail/kmmainwin.cpp	2002/07/09 05:32:57	1.492
+++ kdenetwork/kmail/kmmainwin.cpp	2002/07/10 19:35:56
@@ -1875,7 +1875,10 @@ void KMMainWin::slotReplaceMsgByUnencryp
 //-----------------------------------------------------------------------------
 void KMMainWin::slotUpdateImapMessage(KMMessage *msg)
 {
-  if (((KMMsgBase*)msg)->isMessage()) mMsgView->setMsg(msg, TRUE);
+  if (msg && ((KMMsgBase*)msg)->isMessage()) 
+    mMsgView->setMsg(msg, TRUE);
+  else // force an update of the folder
+    static_cast<KMFolderImap*>(mFolder)->getFolder(true);
 }
 
 //-----------------------------------------------------------------------------

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic