add support for limiting offline download size to base server class 15865 r=naving, sr=mscott (also make sure replied flag is set appropriately during reparse)

This commit is contained in:
bienvenu%netscape.com 2001-02-03 17:44:20 +00:00
parent 1434f87889
commit 28ee16bcc9
4 changed files with 26 additions and 27 deletions

View File

@ -29,8 +29,6 @@ interface nsIPop3IncomingServer : nsISupports {
attribute boolean deleteMailLeftOnServer;
attribute boolean authLogin;
attribute boolean dotFix;
attribute boolean limitMessageSize;
attribute long maxMessageSize;
attribute unsigned long pop3CapabilityFlags;
};

View File

@ -985,13 +985,19 @@ int nsParseMailMessageState::InternSubject (struct message_header *header)
L = header->length;
PRUint32 flags;
(void)m_newMsgHdr->GetFlags(&flags);
/* strip "Re: " */
/* We trust the X-Mozilla-Status line to be the smartest in almost
all things. One exception, however, is the HAS_RE flag. Since
we just parsed the subject header anyway, we expect that parsing
to be smartest. (After all, what if someone just went in and
edited the subject line by hand?) */
if (msg_StripRE((const char **) &key, &L))
{
PRUint32 flags;
(void)m_newMsgHdr->GetFlags(&flags);
m_newMsgHdr->SetFlags(flags | MSG_FLAG_HAS_RE);
}
flags |= MSG_FLAG_HAS_RE;
else
flags &= ~MSG_FLAG_HAS_RE;
m_newMsgHdr->SetFlags(flags); // this *does not* update the mozilla-status header in the local folder
// if (!*key) return 0; /* To catch a subject of "Re:" */
@ -1105,11 +1111,6 @@ int nsParseMailMessageState::FinalizeHeaders()
flags &= ~MSG_FLAG_RUNTIME_ONLY;
priorityFlags = (nsMsgPriorityValue) ((flags & MSG_FLAG_PRIORITIES) >> 13);
flags &= ~MSG_FLAG_PRIORITIES;
/* We trust the X-Mozilla-Status line to be the smartest in almost
all things. One exception, however, is the HAS_RE flag. Since
we just parsed the subject header anyway, we expect that parsing
to be smartest. (After all, what if someone just went in and
edited the subject line by hand?) */
}
delta = (m_headerstartpos +
(mozstatus->value - m_headers.GetBuffer()) -
@ -1837,7 +1838,10 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
// NS_RELEASE(myThis);
// Make sure no one else is writing into this folder
if (destIFolder && (err = destIFolder->AcquireSemaphore (myISupports)) != 0)
{
NS_ASSERTION(PR_FALSE, "why is this folder busy?");
return err;
}
NS_ASSERTION(m_inboxFileStream != 0, "no input file stream");
if (m_inboxFileStream == 0)

View File

@ -138,13 +138,6 @@ NS_IMPL_SERVERPREF_BOOL(nsPop3IncomingServer,
DotFix,
"dot_fix")
NS_IMPL_SERVERPREF_BOOL(nsPop3IncomingServer,
LimitMessageSize,
"limit_message_size")
NS_IMPL_SERVERPREF_INT(nsPop3IncomingServer,
MaxMessageSize,
"max_size")
nsresult
nsPop3IncomingServer::GetPop3CapabilityFlags(PRUint32 *flags)
{

View File

@ -637,15 +637,19 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
m_pop3Server->GetLeaveMessagesOnServer(&m_pop3ConData->leave_on_server);
PRBool limitMessageSize = PR_FALSE;
m_pop3Server->GetLimitMessageSize(&limitMessageSize);
if (limitMessageSize)
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
if (server)
{
PRInt32 max_size = 0;
m_pop3Server->GetMaxMessageSize(&max_size);
if (max_size == 0) // default value
m_pop3ConData->size_limit = 50 * 1024;
else
m_pop3ConData->size_limit = max_size * 1024;
server->GetLimitMessageSize(&limitMessageSize);
if (limitMessageSize)
{
PRInt32 max_size = 0;
server->GetMaxMessageSize(&max_size);
if (max_size == 0) // default value
m_pop3ConData->size_limit = 50 * 1024;
else
m_pop3ConData->size_limit = max_size * 1024;
}
}
}