* 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:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Axel Dörfler, [email protected].
|
* Copyright 2009-2010, Axel Dörfler, [email protected].
|
||||||
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
@@ -78,7 +78,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void _UpdateAutoCheck(bigtime_t interval);
|
void _UpdateAutoCheck(bigtime_t interval);
|
||||||
|
bool _IsPending(BNode& entry) const;
|
||||||
|
|
||||||
|
private:
|
||||||
BMessageRunner* fAutoCheckRunner;
|
BMessageRunner* fAutoCheckRunner;
|
||||||
BMailSettings fSettingsFile;
|
BMailSettings fSettingsFile;
|
||||||
|
|
||||||
@@ -467,7 +469,7 @@ MailDaemonApp::GetNewMessages(BMessage* msg)
|
|||||||
BList list;
|
BList list;
|
||||||
GetInboundMailChains(&list);
|
GetInboundMailChains(&list);
|
||||||
|
|
||||||
RunChains(list,msg);
|
RunChains(list, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -513,8 +515,13 @@ MailDaemonApp::SendPendingMessages(BMessage* msg)
|
|||||||
off_t size;
|
off_t size;
|
||||||
|
|
||||||
while (query.GetNextEntry(&entry) == B_OK) {
|
while (query.GetNextEntry(&entry) == B_OK) {
|
||||||
while (node.SetTo(&entry) == B_BUSY) snooze(100);
|
while (node.SetTo(&entry) == B_BUSY)
|
||||||
if (node.ReadAttr("MAIL:chain",B_INT32_TYPE,0,&chain,4) < B_OK)
|
snooze(1000);
|
||||||
|
if (!_IsPending(node))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (node.ReadAttr("MAIL:chain", B_INT32_TYPE, 0, &chain, 4)
|
||||||
|
< B_OK)
|
||||||
chain = defaultChain;
|
chain = defaultChain;
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
node.GetSize(&size);
|
node.GetSize(&size);
|
||||||
@@ -554,6 +561,9 @@ MailDaemonApp::SendPendingMessages(BMessage* msg)
|
|||||||
|
|
||||||
while (query.GetNextEntry(&entry) == B_OK) {
|
while (query.GetNextEntry(&entry) == B_OK) {
|
||||||
node.SetTo(&entry);
|
node.SetTo(&entry);
|
||||||
|
if (!_IsPending(node))
|
||||||
|
continue;
|
||||||
|
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
node.GetSize(&size);
|
node.GetSize(&size);
|
||||||
ids += path.Path();
|
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 -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user