Add debug output to debug #7267.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-03-11 20:17:10 +00:00
parent 37f85698cf
commit f5753b4af0
@@ -161,14 +161,17 @@ POP3Protocol::SyncMessages()
ResetProgress(); ResetProgress();
SetTotalItems(toDownload.CountItems()); 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++) { for (int32 i = 0; i < toDownload.CountItems(); i++) {
const char* uid = toDownload.ItemAt(i); const char* uid = toDownload.ItemAt(i);
int32 toRetrieve = fUniqueIDs.IndexOf(uid); int32 toRetrieve = fUniqueIDs.IndexOf(uid);
if (toRetrieve < 0) { if (toRetrieve < 0) {
// should not happen!
error = B_NAME_NOT_FOUND; error = B_NAME_NOT_FOUND;
break; printf("POP3: uid %s index %i not found in fUniqueIDs!\n", uid,
(int)toRetrieve);
continue;
} }
BPath path(fDestinationDir); BPath path(fDestinationDir);
@@ -178,8 +181,10 @@ POP3Protocol::SyncMessages()
BEntry entry(path.Path()); BEntry entry(path.Path());
BFile file(&entry, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); BFile file(&entry, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
error = file.InitCheck(); error = file.InitCheck();
if (error != B_OK) if (error != B_OK) {
break;; printf("POP3: Can't create file %s\n ", path.Path());
break;
}
BMailMessageIO mailIO(this, &file, toRetrieve); BMailMessageIO mailIO(this, &file, toRetrieve);
entry_ref ref; entry_ref ref;
@@ -192,15 +197,19 @@ POP3Protocol::SyncMessages()
int32 size = MessageSize(toRetrieve); int32 size = MessageSize(toRetrieve);
if (fFetchBodyLimit < 0 || size <= fFetchBodyLimit) { if (fFetchBodyLimit < 0 || size <= fFetchBodyLimit) {
error = mailIO.Seek(0, SEEK_END); error = mailIO.Seek(0, SEEK_END);
if (error < 0) if (error < 0) {
printf("POP3: Failed to download body %s\n ", uid);
break; break;
}
NotifyHeaderFetched(ref, &file); NotifyHeaderFetched(ref, &file);
NotifyBodyFetched(ref, &file); NotifyBodyFetched(ref, &file);
} else { } else {
int32 dummy; int32 dummy;
error = mailIO.ReadAt(0, &dummy, 1); error = mailIO.ReadAt(0, &dummy, 1);
if (error < 0) if (error < 0) {
printf("POP3: Failed to download header %s\n ", uid);
break; break;
}
NotifyHeaderFetched(ref, &file); NotifyHeaderFetched(ref, &file);
} }
ReportProgress(0, 1); ReportProgress(0, 1);