fix move/copying local msgs with labels set to imap server, 127141, r/sr=mscott, and fix handling of very long lines from imap server by creating infinfite pipe, 229033

This commit is contained in:
bienvenu%nventure.com 2004-01-09 00:36:00 +00:00
Родитель 06686f1f02
Коммит 758a5cd803
2 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -1149,7 +1149,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateStatus(nsIUrlListener *aListener, nsIMsgWi
nsCOMPtr<nsIImapService> imapService = do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
return imapService->UpdateFolderStatus(m_eventQueue, this, aListener, nsnull);
nsCOMPtr <nsIURI> uri;
rv = imapService->UpdateFolderStatus(m_eventQueue, this, aListener, getter_AddRefs(uri));
if (uri)
{
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(uri);
// if no msg window, we won't put up error messages (this is almost certainly a biff-inspired status)
if (!aMsgWindow)
mailNewsUrl->SetSuppressErrorMsgs(PR_TRUE);
}
return rv;
}
NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
@ -4232,7 +4242,13 @@ NS_IMETHODIMP nsImapMailFolder::GetCurMoveCopyMessageFlags(nsIImapUrl *runningUr
{
nsCOMPtr<nsImapMailCopyState> mailCopyState = do_QueryInterface(copyState);
if (mailCopyState && mailCopyState->m_message)
{
nsMsgLabelValue label;
mailCopyState->m_message->GetFlags(aResult);
mailCopyState->m_message->GetLabel(&label);
if (label != 0)
*aResult |= label << 25;
}
}
return NS_OK;
}
@ -4477,6 +4493,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
{
ChangeNumPendingTotalMessages(-mNumPendingTotalMessages);
ChangeNumPendingUnread(-mNumPendingUnreadMessages);
m_numStatusUnseenMessages = 0;
}
}

Просмотреть файл

@ -74,6 +74,7 @@
#include "nsReadableUtils.h"
#include "nsIPipe.h"
#include "nsIMsgFolder.h"
#include "nsMsgMessageFlags.h"
#include "nsImapStringBundle.h"
#include "nsICopyMsgStreamListener.h"
#include "nsTextFormatter.h"
@ -1597,7 +1598,7 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
if (isBusy)
{
nsImapState curUrlImapState;
NS_ASSERTION(m_runningUrl,"isBusy, but no running url.");
// NS_ASSERTION(m_runningUrl,"isBusy, but no running url.");
if (m_runningUrl)
{
m_runningUrl->GetRequiredImapState(&curUrlImapState);
@ -2401,7 +2402,9 @@ nsresult nsImapProtocol::BeginMessageDownLoad(
{
// create a pipe to pump the message into...the output will go to whoever
// is consuming the message display
rv = NS_NewPipe(getter_AddRefs(m_channelInputStream), getter_AddRefs(m_channelOutputStream));
// we create an "infinite" pipe in case we get extremely long lines from the imap server,
// and the consumer is waiting for a whole line
rv = NS_NewPipe(getter_AddRefs(m_channelInputStream), getter_AddRefs(m_channelOutputStream), 4096, PR_UINT32_MAX);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewPipe failed!");
}
// else, if we are saving the message to disk!
@ -4898,6 +4901,9 @@ void nsImapProtocol::OnAppendMsgFromFile()
flagsToSet &= ~kImapMsgSeenFlag;
if (msgFlags & MSG_FLAG_MDN_REPORT_SENT)
flagsToSet |= kImapMsgMDNSentFlag;
// convert msg flag label (0xE000000) to imap flag label (0x0E00)
if (msgFlags & MSG_FLAG_LABELS)
flagsToSet |= (msgFlags & MSG_FLAG_LABELS) >> 16;
UploadMessageFromFile(fileSpec, mailboxName, flagsToSet);
PR_Free( mailboxName );
}