* Possible work-around for #5899: if the index does not contain the correct

information, the mail is no longer sent.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36820 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-05-15 13:26:13 +00:00
parent 0cf1ecfb29
commit b78034782a

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2009-2010, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*
* Distributed under the terms of the MIT License.
@ -78,7 +78,9 @@ public:
private:
void _UpdateAutoCheck(bigtime_t interval);
bool _IsPending(BNode& entry) const;
private:
BMessageRunner* fAutoCheckRunner;
BMailSettings fSettingsFile;
@ -467,7 +469,7 @@ MailDaemonApp::GetNewMessages(BMessage* msg)
BList list;
GetInboundMailChains(&list);
RunChains(list,msg);
RunChains(list, msg);
}
@ -513,8 +515,13 @@ MailDaemonApp::SendPendingMessages(BMessage* msg)
off_t size;
while (query.GetNextEntry(&entry) == B_OK) {
while (node.SetTo(&entry) == B_BUSY) snooze(100);
if (node.ReadAttr("MAIL:chain",B_INT32_TYPE,0,&chain,4) < B_OK)
while (node.SetTo(&entry) == B_BUSY)
snooze(1000);
if (!_IsPending(node))
continue;
if (node.ReadAttr("MAIL:chain", B_INT32_TYPE, 0, &chain, 4)
< B_OK)
chain = defaultChain;
entry.GetPath(&path);
node.GetSize(&size);
@ -554,6 +561,9 @@ MailDaemonApp::SendPendingMessages(BMessage* msg)
while (query.GetNextEntry(&entry) == B_OK) {
node.SetTo(&entry);
if (!_IsPending(node))
continue;
entry.GetPath(&path);
node.GetSize(&size);
ids += path.Path();
@ -594,6 +604,20 @@ MailDaemonApp::Pulse()
}
/*! Work-around for a broken index that contains out-of-date information.
*/
bool
MailDaemonApp::_IsPending(BNode& node) const
{
int32 flags;
if (node.ReadAttr(B_MAIL_ATTR_FLAGS, B_INT32_TYPE, 0, &flags, sizeof(int32))
!= (ssize_t)sizeof(int32))
return false;
return (flags & B_MAIL_PENDING) != 0;
}
// #pragma mark -