[haiku-commits] r40832 - in haiku/trunk/src: add-ons/mail_daemon/inbound_protocols/imap add-ons/mail_daemon/inbound_protocols/imap/imap_lib add-ons/mail_daemon/inbound_protocols/pop3 kits/mail

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 6 Mar 2011 08:49:00 +0100 (CET)

Author: czeidler
Date: 2011-03-06 08:49:00 +0100 (Sun, 06 Mar 2011)
New Revision: 40832
Changeset: http://dev.haiku-os.org/changeset/40832
Ticket: http://dev.haiku-os.org/ticket/7255

Modified:
   
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp
   
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h
   
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp
   
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h
   haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp
   haiku/trunk/src/kits/mail/MailProtocol.cpp
Log:
Set progress after the body has been fetched. This fixes #7255.



Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp
  2011-03-06 07:42:20 UTC (rev 40831)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.cpp
  2011-03-06 07:49:00 UTC (rev 40832)
@@ -28,7 +28,8 @@
 
 
 void
-DispatcherIMAPListener::HeaderFetched(int32 uid, BPositionIO* data)
+DispatcherIMAPListener::HeaderFetched(int32 uid, BPositionIO* data,
+       bool bodyIsComming)
 {
        BFile* file = dynamic_cast<BFile*>(data);
        if (file == NULL)
@@ -38,6 +39,9 @@
                return;
 
        fProtocol.NotifyHeaderFetched(ref, file);
+
+       if (!bodyIsComming)
+               fProtocol.ReportProgress(0, 1);
 }
 
 
@@ -51,6 +55,8 @@
        if (!fStorage.UIDToRef(uid, ref))
                return;
        fProtocol.NotifyBodyFetched(ref, file);
+
+       fProtocol.ReportProgress(0, 1);
 }
 
 
@@ -488,7 +494,6 @@
        status_t status = 
fIMAPMailbox.FetchBody(fIMAPMailbox.UIDToMessageNumber(
                uid));
 
-       ReportProgress(0, 1);
        ResetProgress();
 
        fIMAPMailboxThread->SyncAndStartWatchingMailbox();

Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h
    2011-03-06 07:42:20 UTC (rev 40831)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPInboundProtocol.h
    2011-03-06 07:49:00 UTC (rev 40832)
@@ -27,7 +27,8 @@
                        bool                            Lock();
                        void                            Unlock();
 
-                       void                            HeaderFetched(int32 
uid, BPositionIO* data);
+                       void                            HeaderFetched(int32 
uid, BPositionIO* data,
+                                                                       bool 
bodyIsComming);
                        void                            BodyFetched(int32 uid, 
BPositionIO* data);
 
                        void                            
NewMessagesToFetch(int32 nMessages);

Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp
 2011-03-06 07:42:20 UTC (rev 40831)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp
 2011-03-06 07:49:00 UTC (rev 40832)
@@ -306,7 +306,7 @@
        fOutData(data),
        fFetchBodyLimit(fetchBodyLimit)
 {
-       fIMAPMailbox.Listener().NewMessagesToFetch(fEndMessage - fMessage + 1);
+
 }
 
 
@@ -320,13 +320,13 @@
        fOutData(NULL),
        fFetchBodyLimit(fetchBodyLimit)
 {
-       fIMAPMailbox.Listener().NewMessagesToFetch(fEndMessage - fMessage + 1);
+
 }
 
 
 FetchMessageCommand::~FetchMessageCommand()
 {
-       fIMAPMailbox.Listener().FetchEnd();
+
 }
 
 
@@ -407,11 +407,15 @@
        BString lastLine;
        fConnectionReader.GetNextLine(lastLine);
 
+       bool bodyIsComming = true;
+       if (fFetchBodyLimit >= 0 && fFetchBodyLimit <= messageSize)
+               bodyIsComming = false;
+
        int32 uid = fIMAPMailbox.MessageNumberToUID(message);
        if (uid >= 0)
-               fIMAPMailbox.Listener().HeaderFetched(uid, data);
+               fIMAPMailbox.Listener().HeaderFetched(uid, data, bodyIsComming);
 
-       if (fFetchBodyLimit >= 0 && fFetchBodyLimit <= messageSize)
+       if (!bodyIsComming)
                return true;
 
        deleter.Detach();
@@ -623,6 +627,8 @@
                nMessages + 1, exists, &list, NULL);
        fIMAPMailbox.AddAfterQuakeCommand(command);
 
+       fIMAPMailbox.Listener().NewMessagesToFetch(exists - nMessages);
+
        command = new FetchMessageCommand(fIMAPMailbox, nMessages + 1, exists,
                fIMAPMailbox.FetchBodyLimit());
        fIMAPMailbox.AddAfterQuakeCommand(command);

Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h
   2011-03-06 07:42:20 UTC (rev 40831)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPMailbox.h
   2011-03-06 07:49:00 UTC (rev 40832)
@@ -18,7 +18,8 @@
 public:
        virtual                                         ~IMAPMailboxListener() 
{}
 
-       virtual void                            HeaderFetched(int32 uid, 
BPositionIO* data) {}
+       virtual void                            HeaderFetched(int32 uid, 
BPositionIO* data,
+                                                                       bool 
bodyIsComming) {}
        virtual void                            BodyFetched(int32 uid, 
BPositionIO* data) {}
 
        virtual void                            NewMessagesToFetch(int32 
nMessages) {}

Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp
===================================================================
--- haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp 
2011-03-06 07:42:20 UTC (rev 40831)
+++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp 
2011-03-06 07:49:00 UTC (rev 40832)
@@ -203,6 +203,7 @@
                                break;
                        NotifyHeaderFetched(ref, &file);
                }
+               ReportProgress(0, 1);
 
                if (file.WriteAttr("MAIL:unique_id", B_STRING_TYPE, 0, uid,
                        strlen(uid)) < 0) {

Modified: haiku/trunk/src/kits/mail/MailProtocol.cpp
===================================================================
--- haiku/trunk/src/kits/mail/MailProtocol.cpp  2011-03-06 07:42:20 UTC (rev 
40831)
+++ haiku/trunk/src/kits/mail/MailProtocol.cpp  2011-03-06 07:49:00 UTC (rev 
40832)
@@ -281,8 +281,6 @@
 {
        for (int i = 0; i < fFilterList.CountItems(); i++)
                fFilterList.ItemAt(i)->HeaderFetched(ref, data);
-
-       ReportProgress(0, 1);
 }
 
 


Other related posts: