[haiku-commits] r40920 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 11 Mar 2011 21:17:10 +0100 (CET)

Author: czeidler
Date: 2011-03-11 21:17:10 +0100 (Fri, 11 Mar 2011)
New Revision: 40920
Changeset: http://dev.haiku-os.org/changeset/40920
Ticket: http://dev.haiku-os.org/ticket/7267

Modified:
   haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp
Log:
Add debug output to debug #7267.



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-11 20:13:54 UTC (rev 40919)
+++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp 
2011-03-11 20:17:10 UTC (rev 40920)
@@ -161,14 +161,17 @@
        ResetProgress();
        SetTotalItems(toDownload.CountItems());
 
-       printf("POP3 to download: %i\n", (int)toDownload.CountItems());
+       printf("POP3: Messages to download: %i\n", 
(int)toDownload.CountItems());
        for (int32 i = 0; i < toDownload.CountItems(); i++) {
                const char* uid = toDownload.ItemAt(i);
                int32 toRetrieve = fUniqueIDs.IndexOf(uid);
 
                if (toRetrieve < 0) {
+                       // should not happen!
                        error = B_NAME_NOT_FOUND;
-                       break;
+                       printf("POP3: uid %s index %i not found in 
fUniqueIDs!\n", uid,
+                               (int)toRetrieve);
+                       continue;
                }
 
                BPath path(fDestinationDir);
@@ -178,8 +181,10 @@
                BEntry entry(path.Path());
                BFile file(&entry, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
                error = file.InitCheck();
-               if (error != B_OK)
-                       break;;
+               if (error != B_OK) {
+                       printf("POP3: Can't create file %s\n ", path.Path());
+                       break;
+               }
                BMailMessageIO mailIO(this, &file, toRetrieve);
 
                entry_ref ref;
@@ -192,15 +197,19 @@
                int32 size = MessageSize(toRetrieve);
                if (fFetchBodyLimit < 0 || size <= fFetchBodyLimit) {
                        error = mailIO.Seek(0, SEEK_END);
-                       if (error < 0)
+                       if (error < 0) {
+                               printf("POP3: Failed to download body %s\n ", 
uid);
                                break;
+                       }
                        NotifyHeaderFetched(ref, &file);
                        NotifyBodyFetched(ref, &file);
                } else {
                        int32 dummy;
                        error = mailIO.ReadAt(0, &dummy, 1);
-                       if (error < 0)
+                       if (error < 0) {
+                               printf("POP3: Failed to download header %s\n ", 
uid);
                                break;
+                       }
                        NotifyHeaderFetched(ref, &file);
                }
                ReportProgress(0, 1);


Other related posts:

  • » [haiku-commits] r40920 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3 - clemens . zeidler