Fixed a bug that would cause queued messages stored in IMAP directories not to be sent if IMAP mail was checked before queued mail was sent. This the last known bug in MDR.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn 2004-10-30 19:34:01 +00:00
parent 83cb1d3403
commit c3a2f3930f
3 changed files with 33 additions and 4 deletions

View File

@ -193,6 +193,10 @@ BMailProtocol::BMailProtocol(BMessage *settings, BMailChainRunner *run)
fido.PushAttr("MAIL:chain");
fido.PushInt32(settings->FindInt32("chain"));
fido.PushOp(B_EQ);
fido.PushAttr("MAIL:pending_chain");
fido.PushInt32(settings->FindInt32("chain"));
fido.PushOp(B_EQ);
fido.PushOp(B_OR);
if (!settings->FindBool("delete_remote_when_local")) {
fido.PushAttr("BEOS:type");
fido.PushString("text/x-partial-email");
@ -307,6 +311,10 @@ void BMailProtocol::CheckForDeletedMessages() {
fido.PushAttr("MAIL:chain");
fido.PushInt32(settings->FindInt32("chain"));
fido.PushOp(B_EQ);
fido.PushAttr("MAIL:pending_chain");
fido.PushInt32(settings->FindInt32("chain"));
fido.PushOp(B_EQ);
fido.PushOp(B_OR);
fido.Fetch();
BString uid;

View File

@ -12,6 +12,7 @@ class _EXPORT BRemoteMailStorageProtocol;
#include <RemoteStorageProtocol.h>
#include <ChainRunner.h>
#include <E-mail.h>
namespace {
@ -325,8 +326,21 @@ void BRemoteMailStorageProtocol::SyncMailbox(const char *mailbox) {
if (snoodle.ReadAttr("MAIL:chain",B_INT32_TYPE,0,&chain,sizeof(chain)) < B_OK)
append = true;
if (chain != runner->Chain()->ID())
append = true;
if (chain != runner->Chain()->ID()) {
int32 pending_chain(-1), flags(0);
snoodle.ReadAttr("MAIL:pending_chain",B_INT32_TYPE,0,&chain,sizeof(chain));
snoodle.ReadAttr("MAIL:flags",B_INT32_TYPE,0,&flags,sizeof(flags));
if ((pending_chain == runner->Chain()->ID()) && (BMailChain(chain).ChainDirection() == outbound) && (flags & B_MAIL_PENDING))
continue; //--- Ignore this message, recode the chain attribute at the next SyncMailbox()
if (pending_chain == runner->Chain()->ID()) {
chain = runner->Chain()->ID();
snoodle.WriteAttr("MAIL:chain",B_INT32_TYPE,0,&chain,sizeof(chain));
append = false;
} else
append = true;
}
if (snoodle.ReadAttrString("MAIL:unique_id",&string) < B_OK)
append = true;
@ -351,7 +365,14 @@ void BRemoteMailStorageProtocol::SyncMailbox(const char *mailbox) {
/*snoodle.RemoveAttr("MAIL:unique_id");
snoodle.RemoveAttr("MAIL:chain");*/
chain = runner->Chain()->ID();
snoodle.WriteAttr("MAIL:chain",B_INT32_TYPE,0,&chain,sizeof(chain));
int32 flags = 0;
snoodle.ReadAttr("MAIL:flags",B_INT32_TYPE,0,&flags,sizeof(flags));
if (flags & B_MAIL_PENDING)
snoodle.WriteAttr("MAIL:pending_chain",B_INT32_TYPE,0,&chain,sizeof(chain));
else
snoodle.WriteAttr("MAIL:chain",B_INT32_TYPE,0,&chain,sizeof(chain));
snoodle.WriteAttrString("MAIL:unique_id",&string);
(*manifest) += string.String();
(*unique_ids) += string.String();

View File

@ -618,7 +618,7 @@ makeIndices()
fs_create_index(device,B_MAIL_ATTR_WHEN,B_INT32_TYPE,0);
fs_create_index(device,B_MAIL_ATTR_FLAGS,B_INT32_TYPE,0);
fs_create_index(device,"MAIL:chain",B_INT32_TYPE,0);
//fs_create_index(device,"MAIL:fullsize",B_UINT32_TYPE,0);
fs_create_index(device,"MAIL:pending_chain",B_INT32_TYPE,0);
}
}