Only delete fully downloaded messages on the server! Clean up a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41092 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -133,6 +133,10 @@ POP3Protocol::Disconnect()
|
|||||||
status_t
|
status_t
|
||||||
POP3Protocol::SyncMessages()
|
POP3Protocol::SyncMessages()
|
||||||
{
|
{
|
||||||
|
bool leaveOnServer;
|
||||||
|
if (fSettings.FindBool("leave_mail_on_server", &leaveOnServer) != B_OK)
|
||||||
|
leaveOnServer = true;
|
||||||
|
|
||||||
// create directory if not exist
|
// create directory if not exist
|
||||||
create_directory(fDestinationDir, 0777);
|
create_directory(fDestinationDir, 0777);
|
||||||
|
|
||||||
@@ -211,6 +215,9 @@ POP3Protocol::SyncMessages()
|
|||||||
}
|
}
|
||||||
NotifyHeaderFetched(ref, &file);
|
NotifyHeaderFetched(ref, &file);
|
||||||
NotifyBodyFetched(ref, &file);
|
NotifyBodyFetched(ref, &file);
|
||||||
|
|
||||||
|
if (!leaveOnServer)
|
||||||
|
Delete(toRetrieve);
|
||||||
} else {
|
} else {
|
||||||
int32 dummy;
|
int32 dummy;
|
||||||
error = mailIO.ReadAt(0, &dummy, 1);
|
error = mailIO.ReadAt(0, &dummy, 1);
|
||||||
@@ -232,12 +239,6 @@ POP3Protocol::SyncMessages()
|
|||||||
// save manifest in case we get disturbed
|
// save manifest in case we get disturbed
|
||||||
fManifest += uid;
|
fManifest += uid;
|
||||||
_WriteManifest();
|
_WriteManifest();
|
||||||
|
|
||||||
bool leaveOnServer;
|
|
||||||
if (fSettings.FindBool("leave_mail_on_server", &leaveOnServer) == B_OK
|
|
||||||
&& !leaveOnServer) {
|
|
||||||
Delete(toRetrieve);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetProgress();
|
ResetProgress();
|
||||||
@@ -262,7 +263,6 @@ POP3Protocol::FetchBody(const entry_ref& ref)
|
|||||||
if (error < B_OK)
|
if (error < B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
||||||
BFile file(&ref, B_READ_WRITE);
|
BFile file(&ref, B_READ_WRITE);
|
||||||
status_t status = file.InitCheck();
|
status_t status = file.InitCheck();
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
@@ -277,14 +277,12 @@ POP3Protocol::FetchBody(const entry_ref& ref)
|
|||||||
if (toRetrieve < 0)
|
if (toRetrieve < 0)
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
|
|
||||||
// TODO: get rid of this BMailMessageIO!
|
bool leaveOnServer;
|
||||||
// read header
|
if (fSettings.FindBool("leave_mail_on_server", &leaveOnServer) != B_OK)
|
||||||
BMailMessageIO io(this, &file, toRetrieve);
|
leaveOnServer = true;
|
||||||
int32 dummy;
|
|
||||||
status = io.ReadAt(0, &dummy, 1);
|
|
||||||
if (status < 0)
|
|
||||||
return status;
|
|
||||||
|
|
||||||
|
// TODO: get rid of this BMailMessageIO!
|
||||||
|
BMailMessageIO io(this, &file, toRetrieve);
|
||||||
// read body
|
// read body
|
||||||
status = io.Seek(0, SEEK_END);
|
status = io.Seek(0, SEEK_END);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@@ -292,6 +290,9 @@ POP3Protocol::FetchBody(const entry_ref& ref)
|
|||||||
|
|
||||||
NotifyBodyFetched(ref, &file);
|
NotifyBodyFetched(ref, &file);
|
||||||
|
|
||||||
|
if (!leaveOnServer)
|
||||||
|
Delete(toRetrieve);
|
||||||
|
|
||||||
ReportProgress(0, 1);
|
ReportProgress(0, 1);
|
||||||
ResetProgress();
|
ResetProgress();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user