From b494a4bf6372cc1f31f7fb5f5da1b61210f0df8e Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Thu, 14 Feb 2002 01:07:19 +0000 Subject: [PATCH] store labels on the imap server r=naving, sr=sspitzer 114379 --- mailnews/base/src/nsMsgDBView.cpp | 14 +++++++++++++- mailnews/local/src/nsParseMailbox.cpp | 7 +++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp index 0f1874f12d6..bb91c53f495 100644 --- a/mailnews/base/src/nsMsgDBView.cpp +++ b/mailnews/base/src/nsMsgDBView.cpp @@ -1951,6 +1951,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI nsCOMPtr imapFolder = do_QueryInterface(m_folder); PRBool thisIsImapFolder = (imapFolder != nsnull); + if (command == nsMsgViewCommandType::deleteMsg) rv = DeleteMessages(mMsgWindow, indices, numIndices, PR_FALSE); else if (command == nsMsgViewCommandType::deleteNoTrash) @@ -1999,6 +2000,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI if (thisIsImapFolder) { imapMessageFlagsType flags = kNoImapMsgFlag; + PRBool commandIsLabelSet = PR_FALSE; PRBool addFlags = PR_FALSE; PRBool isRead = PR_FALSE; @@ -2031,11 +2033,21 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI flags |= kImapMsgFlaggedFlag; addFlags = PR_FALSE; break; + case nsMsgViewCommandType::label0: + case nsMsgViewCommandType::label1: + case nsMsgViewCommandType::label2: + case nsMsgViewCommandType::label3: + case nsMsgViewCommandType::label4: + case nsMsgViewCommandType::label5: + flags |= ((command - nsMsgViewCommandType::label0) << 9); + addFlags = (command != nsMsgViewCommandType::label0); + commandIsLabelSet = PR_TRUE; + break; default: break; } - if (flags != kNoImapMsgFlag) // can't get here without thisIsImapThreadPane == TRUE + if (flags != kNoImapMsgFlag || commandIsLabelSet) // can't get here without thisIsImapThreadPane == TRUE imapFolder->StoreImapFlags(flags, addFlags, imapUids.GetArray(), imapUids.GetSize()); } diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index a59d98c58cf..1a485cc12e1 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -1212,8 +1212,11 @@ int nsParseMailMessageState::FinalizeHeaders() m_newMsgHdr->SetPriority(priorityFlags); // convert the flag values (0xE000000) to label values (0-5) - labelFlags = ((flags & MSG_FLAG_LABELS) >> 25); - m_newMsgHdr->SetLabel(labelFlags); + if (mozstatus2) // only do this if we have a mozstatus2 header + { + labelFlags = ((flags & MSG_FLAG_LABELS) >> 25); + m_newMsgHdr->SetLabel(labelFlags); + } if (delta < 0xffff) { /* Only use if fits in 16 bits. */ m_newMsgHdr->SetStatusOffset((PRUint16) delta);