зеркало из https://github.com/mozilla/gecko-dev.git
Bug #53082 --> set the answered or forwarded flag on a message when we reply to it.
r=putterman sr=bienvenu
This commit is contained in:
Родитель
5d2a97e0ba
Коммит
3ea56bbd85
|
@ -1048,6 +1048,11 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
|
|||
if (offset >= 0)
|
||||
firstURI.Truncate(offset);
|
||||
|
||||
// store the original message URI so we can extract it after we send the message to properly
|
||||
// mark any disposition flags like replied or forwarded on the message.
|
||||
|
||||
mOriginalMsgURI = firstURI;
|
||||
|
||||
nsCOMPtr<nsIMessage> message = getter_AddRefs(GetIMessageFromURI(firstURI.GetUnicode()));
|
||||
if ((NS_SUCCEEDED(rv)) && message)
|
||||
{
|
||||
|
@ -1630,6 +1635,45 @@ void nsMsgCompose::CleanUpRecipients(nsString& recipients)
|
|||
recipients = newRecipient;
|
||||
}
|
||||
|
||||
nsresult nsMsgCompose::ProcessReplyFlags()
|
||||
{
|
||||
// check to see if we were doing a reply or a forward, if we were, set the answered field flag on the message folder
|
||||
// for this URI.
|
||||
if (mType == nsIMsgCompType::Reply ||
|
||||
mType == nsIMsgCompType::ReplyAll ||
|
||||
mType == nsIMsgCompType::ReplyToGroup ||
|
||||
mType == nsIMsgCompType::ReplyToSenderAndGroup ||
|
||||
mType == nsIMsgCompType::ForwardAsAttachment ||
|
||||
mType == nsIMsgCompType::ForwardInline)
|
||||
{
|
||||
nsCOMPtr<nsIRDFService> rdfService (do_GetService(kRDFServiceCID));
|
||||
if (rdfService && !mOriginalMsgURI.IsEmpty())
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rdfService->GetResource(NS_ConvertUCS2toUTF8(mOriginalMsgURI), getter_AddRefs(resource));
|
||||
nsCOMPtr<nsIMessage> messageResource (do_QueryInterface(resource));
|
||||
if (messageResource)
|
||||
{
|
||||
// get the folder for the message resource
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder;
|
||||
messageResource->GetMsgFolder(getter_AddRefs(msgFolder));
|
||||
if (msgFolder)
|
||||
{
|
||||
nsMsgDispositionState dispositionSetting = nsIMsgFolder::nsMsgDispositionState_Replied;
|
||||
if (mType == nsIMsgCompType::ForwardAsAttachment ||
|
||||
mType == nsIMsgCompType::ForwardInline)
|
||||
dispositionSetting = nsIMsgFolder::nsMsgDispositionState_Forwarded;
|
||||
|
||||
msgFolder->AddMessageDispositionState(messageResource, dispositionSetting);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// This is the listener class for both the send operation and the copy operation.
|
||||
// We have to create this class to listen for message send completion and deal with
|
||||
|
@ -1720,6 +1764,9 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
nsIMsgCompFields *compFields = nsnull;
|
||||
mComposeObj->GetCompFields(&compFields); //GetCompFields will addref, you need to release when your are done with it
|
||||
|
||||
// only process the reply flags if we successfully sent the message
|
||||
mComposeObj->ProcessReplyFlags();
|
||||
|
||||
// Close the window ONLY if we are not going to do a save operation
|
||||
PRUnichar *fieldsFCC = nsnull;
|
||||
if (NS_SUCCEEDED(compFields->GetFcc(&fieldsFCC)))
|
||||
|
|
|
@ -67,6 +67,7 @@ class nsMsgCompose : public nsIMsgCompose
|
|||
nsresult BuildBodyMessageAndSignature();
|
||||
|
||||
nsString mQuoteURI;
|
||||
nsString mOriginalMsgURI; // used so we can mark message disposition flags after we send the message
|
||||
|
||||
PRInt32 mWhatHolder;
|
||||
|
||||
|
@ -88,6 +89,10 @@ class nsMsgCompose : public nsIMsgCompose
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// when we've successfully sent a message, the message send listener will call back into the compose
|
||||
// object telling it to set any reply flags on the original message's folder.
|
||||
nsresult ProcessReplyFlags();
|
||||
|
||||
private:
|
||||
nsresult _SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity);
|
||||
nsresult CreateMessage(const PRUnichar * originalMsgURI, MSG_ComposeType type, MSG_ComposeFormat format, nsIMsgCompFields* compFields);
|
||||
|
|
Загрузка…
Ссылка в новой задаче