Set progress after the body has been fetched. This fixes #7255.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40832 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8c018efae7
commit
f5a2f7b79d
@ -28,7 +28,8 @@ DispatcherIMAPListener::DispatcherIMAPListener(MailProtocol& protocol,
|
||||
|
||||
|
||||
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 @@ DispatcherIMAPListener::HeaderFetched(int32 uid, BPositionIO* data)
|
||||
return;
|
||||
|
||||
fProtocol.NotifyHeaderFetched(ref, file);
|
||||
|
||||
if (!bodyIsComming)
|
||||
fProtocol.ReportProgress(0, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +55,8 @@ DispatcherIMAPListener::BodyFetched(int32 uid, BPositionIO* data)
|
||||
if (!fStorage.UIDToRef(uid, ref))
|
||||
return;
|
||||
fProtocol.NotifyBodyFetched(ref, file);
|
||||
|
||||
fProtocol.ReportProgress(0, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -488,7 +494,6 @@ IMAPInboundProtocol::FetchBody(const entry_ref& ref)
|
||||
status_t status = fIMAPMailbox.FetchBody(fIMAPMailbox.UIDToMessageNumber(
|
||||
uid));
|
||||
|
||||
ReportProgress(0, 1);
|
||||
ResetProgress();
|
||||
|
||||
fIMAPMailboxThread->SyncAndStartWatchingMailbox();
|
||||
|
@ -27,7 +27,8 @@ public:
|
||||
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);
|
||||
|
@ -306,7 +306,7 @@ FetchMessageCommand::FetchMessageCommand(IMAPMailbox& mailbox, int32 message,
|
||||
fOutData(data),
|
||||
fFetchBodyLimit(fetchBodyLimit)
|
||||
{
|
||||
fIMAPMailbox.Listener().NewMessagesToFetch(fEndMessage - fMessage + 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -320,13 +320,13 @@ FetchMessageCommand::FetchMessageCommand(IMAPMailbox& mailbox,
|
||||
fOutData(NULL),
|
||||
fFetchBodyLimit(fetchBodyLimit)
|
||||
{
|
||||
fIMAPMailbox.Listener().NewMessagesToFetch(fEndMessage - fMessage + 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
FetchMessageCommand::~FetchMessageCommand()
|
||||
{
|
||||
fIMAPMailbox.Listener().FetchEnd();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -407,11 +407,15 @@ FetchMessageCommand::Handle(const BString& response)
|
||||
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 @@ ExistsHandler::Handle(const BString& response)
|
||||
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);
|
||||
|
@ -18,7 +18,8 @@ class IMAPMailboxListener {
|
||||
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) {}
|
||||
|
@ -203,6 +203,7 @@ POP3Protocol::SyncMessages()
|
||||
break;
|
||||
NotifyHeaderFetched(ref, &file);
|
||||
}
|
||||
ReportProgress(0, 1);
|
||||
|
||||
if (file.WriteAttr("MAIL:unique_id", B_STRING_TYPE, 0, uid,
|
||||
strlen(uid)) < 0) {
|
||||
|
@ -281,8 +281,6 @@ MailProtocol::NotifyHeaderFetched(const entry_ref& ref, BFile* data)
|
||||
{
|
||||
for (int i = 0; i < fFilterList.CountItems(); i++)
|
||||
fFilterList.ItemAt(i)->HeaderFetched(ref, data);
|
||||
|
||||
ReportProgress(0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user