зеркало из https://github.com/mozilla/gecko-dev.git
remove unused view attachments as links option, work on in-reply-to header, r=sspitzer
This commit is contained in:
Родитель
6d0c68ee48
Коммит
2c7746fcdc
|
@ -80,6 +80,7 @@ interface nsIMsgHdr : nsISupports
|
|||
attribute string subject;
|
||||
attribute string recipients;
|
||||
attribute boolean recipientsIsNewsgroup;
|
||||
attribute string inReplyTo;
|
||||
|
||||
/* anything below here still has to be fixed */
|
||||
void setReferences(in string references);
|
||||
|
|
|
@ -145,6 +145,15 @@ NS_IMETHODIMP nsMessage::SetMessageId(const char *messageId)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::SetInReplyTo(const char *inReplyTo)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->SetInReplyTo(inReplyTo);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMessage::SetReferences(const char *references)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
|
@ -266,6 +275,14 @@ NS_IMETHODIMP nsMessage::GetMessageId(char **resultMessageId)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetInReplyTo(char **resultInReplyTo)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->GetInReplyTo(resultInReplyTo);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetMime2DecodedAuthor(PRUnichar **resultAuthor)
|
||||
{
|
||||
|
|
|
@ -356,6 +356,13 @@ NS_IMETHODIMP nsMsgHdr::SetMessageId(const char *messageId)
|
|||
return SetStringColumn(messageId, m_mdb->m_messageIdColumnToken);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetInReplyTo(const char *inReplyTo)
|
||||
{
|
||||
// not sure how to implement this - it doesn't need to be persistent,
|
||||
// but we don't need to take up extra space for this header either.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetSubject(const char *subject)
|
||||
{
|
||||
return SetStringColumn(subject, m_mdb->m_subjectColumnToken);
|
||||
|
@ -584,6 +591,14 @@ NS_IMETHODIMP nsMsgHdr::GetMessageId(char * *resultMessageId)
|
|||
return m_mdb->RowCellColumnToCharPtr(GetMDBRow(), m_mdb->m_messageIdColumnToken, resultMessageId);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetInReplyTo(char * *resultInReplyTo)
|
||||
{
|
||||
// not sure how to implement this yet.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
// return m_mdb->RowCellColumnToCharPtr(GetMDBRow(), m_mdb->m_messageIdColumnToken, resultMessageId);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetMime2DecodedAuthor(PRUnichar* *resultAuthor)
|
||||
{
|
||||
return m_mdb->RowCellColumnToMime2DecodedString(GetMDBRow(), m_mdb->m_senderColumnToken, resultAuthor);
|
||||
|
|
|
@ -54,8 +54,6 @@ public:
|
|||
GenericInfo* aInfo) = 0;
|
||||
NS_IMETHOD GetShouldDownloadArbitraryHeaders(nsIImapProtocol* aProtocol,
|
||||
GenericInfo* aInfo) = 0;
|
||||
NS_IMETHOD GetShowAttachmentsInline(nsIImapProtocol* aProtocol,
|
||||
PRBool* aBool) = 0;
|
||||
NS_IMETHOD HeaderFetchCompleted(nsIImapProtocol* aProtocol) = 0;
|
||||
NS_IMETHOD UpdateSecurityStatus(nsIImapProtocol* aProtocol) = 0;
|
||||
// ****
|
||||
|
|
|
@ -77,7 +77,6 @@ nsIMAPBodyShell::nsIMAPBodyShell(nsImapProtocol *protocolConnection, const char
|
|||
m_cached = PR_FALSE;
|
||||
m_gotAttachmentPref = PR_FALSE;
|
||||
m_generatingWholeMessage = PR_FALSE;
|
||||
m_showAttachmentsInline = PR_TRUE;
|
||||
m_generatingPart = NULL;
|
||||
m_protocolConnection = protocolConnection;
|
||||
NS_ASSERTION(m_protocolConnection, "non null connection");
|
||||
|
@ -99,10 +98,7 @@ nsIMAPBodyShell::nsIMAPBodyShell(nsImapProtocol *protocolConnection, const char
|
|||
m_folderName = nsCRT::strdup(folderName);
|
||||
if (!m_folderName)
|
||||
return;
|
||||
if (GetShowAttachmentsInline())
|
||||
SetContentModified(IMAP_CONTENT_MODIFIED_VIEW_INLINE);
|
||||
else
|
||||
SetContentModified(IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS);
|
||||
// Turn the BODYSTRUCTURE response into a form that the nsIMAPBodypartMessage can be constructed from.
|
||||
char *doctoredBuf = PR_smprintf("(\"message\" \"rfc822\" NIL NIL NIL NIL 0 () %s 0)", buf);
|
||||
if (!doctoredBuf)
|
||||
|
@ -129,18 +125,6 @@ void nsIMAPBodyShell::SetIsValid(PRBool valid)
|
|||
}
|
||||
|
||||
|
||||
PRBool nsIMAPBodyShell::GetShowAttachmentsInline()
|
||||
{
|
||||
if (!m_gotAttachmentPref)
|
||||
{
|
||||
m_showAttachmentsInline = m_protocolConnection->GetShowAttachmentsInline();
|
||||
m_gotAttachmentPref = PR_TRUE;
|
||||
}
|
||||
|
||||
return m_showAttachmentsInline;
|
||||
}
|
||||
|
||||
|
||||
// Fills in buffer (and adopts storage) for header object
|
||||
void nsIMAPBodyShell::AdoptMessageHeaders(char *headers, const char *partNum)
|
||||
{
|
||||
|
@ -1138,9 +1122,6 @@ PRBool nsIMAPBodypartMessage::ShouldFetchInline()
|
|||
return PR_FALSE;
|
||||
|
||||
|
||||
if (!m_shell->GetShowAttachmentsInline())
|
||||
return PR_FALSE;
|
||||
|
||||
// Message types are inline, by default.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -255,8 +255,6 @@ public:
|
|||
// If partNum is not NULL, then this works to generates a MIME part that hasn't been downloaded yet
|
||||
// and leaves out all other parts. By default, to generate a normal message, partNum should be NULL.
|
||||
|
||||
PRBool GetShowAttachmentsInline(); // Returns PR_TRUE if the user has the pref "Show Attachments Inline" set.
|
||||
// Returns PR_FALSE if the setting is "Show Attachments as Links"
|
||||
PRBool PreflightCheckAllInline(); // Returns PR_TRUE if all parts are inline, PR_FALSE otherwise. Does not generate anything.
|
||||
|
||||
// Helpers
|
||||
|
@ -286,7 +284,6 @@ protected:
|
|||
char *m_folderName; // folder that contains this message
|
||||
char *m_generatingPart; // If a specific part is being generated, this is it. Otherwise, NULL.
|
||||
PRBool m_isBeingGenerated; // PR_TRUE if this body shell is in the process of being generated
|
||||
PRBool m_showAttachmentsInline;
|
||||
PRBool m_gotAttachmentPref;
|
||||
PRBool m_cached; // Whether or not this shell is cached
|
||||
PRBool m_generatingWholeMessage; // whether or not we are generating the whole (non-MPOD) message
|
||||
|
|
|
@ -3343,19 +3343,6 @@ nsImapMailFolder::GetShouldDownloadArbitraryHeaders(nsIImapProtocol* aProtocol,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::GetShowAttachmentsInline(nsIImapProtocol* aProtocol,
|
||||
PRBool* aBool)
|
||||
{
|
||||
if (!aBool)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs)
|
||||
prefs->GetBoolPref("mail.inline_attachments", aBool);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::HeaderFetchCompleted(nsIImapProtocol* aProtocol)
|
||||
{
|
||||
|
|
|
@ -218,8 +218,6 @@ public:
|
|||
GenericInfo* aInfo);
|
||||
NS_IMETHOD GetShouldDownloadArbitraryHeaders(nsIImapProtocol* aProtocol,
|
||||
GenericInfo* aInfo);
|
||||
NS_IMETHOD GetShowAttachmentsInline(nsIImapProtocol* aProtocol,
|
||||
PRBool* aBool);
|
||||
NS_IMETHOD HeaderFetchCompleted(nsIImapProtocol* aProtocol);
|
||||
NS_IMETHOD UpdateSecurityStatus(nsIImapProtocol* aProtocol);
|
||||
// ****
|
||||
|
|
|
@ -1677,9 +1677,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
|||
// We actually want a specific MIME part of the message.
|
||||
// The Body Shell will generate it, even though we haven't downloaded it yet.
|
||||
|
||||
IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
|
||||
IMAP_CONTENT_MODIFIED_VIEW_INLINE :
|
||||
IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS;
|
||||
IMAP_ContentModifiedType modType = IMAP_CONTENT_MODIFIED_VIEW_INLINE ;
|
||||
|
||||
nsIMAPBodyShell *foundShell = nsnull;
|
||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
||||
|
@ -1738,9 +1736,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
|||
// Before fetching the bodystructure, let's check our body shell cache to see if
|
||||
// we already have it around.
|
||||
nsIMAPBodyShell *foundShell = NULL;
|
||||
IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
|
||||
IMAP_CONTENT_MODIFIED_VIEW_INLINE :
|
||||
IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS;
|
||||
IMAP_ContentModifiedType modType = IMAP_CONTENT_MODIFIED_VIEW_INLINE;
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailurl = do_QueryInterface(m_runningUrl);
|
||||
if (mailurl)
|
||||
|
@ -3336,20 +3332,6 @@ PRUint32 nsImapProtocol::GetMessageSize(const char * messageId,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsImapProtocol::GetShowAttachmentsInline()
|
||||
{
|
||||
PRBool *rv = (PRBool*) new PRBool(PR_FALSE);
|
||||
|
||||
if (m_imapMiscellaneousSink && rv)
|
||||
{
|
||||
m_imapMiscellaneousSink->GetShowAttachmentsInline(this, rv);
|
||||
WaitForFEEventCompletion();
|
||||
return *rv;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// message id string utility functions
|
||||
/* static */PRBool nsImapProtocol::HandlingMultipleMessages(const char *messageIdString)
|
||||
{
|
||||
|
|
|
@ -182,7 +182,6 @@ public:
|
|||
|
||||
// Comment from 4.5: We really need to break out the thread synchronizer from the
|
||||
// connection class...Not sure what this means
|
||||
PRBool GetShowAttachmentsInline();
|
||||
PRBool GetPseudoInterrupted();
|
||||
void PseudoInterrupt(PRBool the_interrupt);
|
||||
|
||||
|
|
|
@ -440,38 +440,6 @@ nsImapMiscellaneousSinkProxy::GetShouldDownloadArbitraryHeaders(
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::GetShowAttachmentsInline(
|
||||
nsIImapProtocol* aProtocol, PRBool* aBool)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aBool, "Oops... null aBool");
|
||||
if(!aBool)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
GetShowAttachmentsInlineProxyEvent *ev =
|
||||
new GetShowAttachmentsInlineProxyEvent(this, aBool);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
{
|
||||
ev->SetNotifyCompletion(PR_TRUE);
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res =
|
||||
m_realImapMiscellaneousSink->GetShowAttachmentsInline(aProtocol,
|
||||
aBool);
|
||||
aProtocol->NotifyFEEventCompletion();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::HeaderFetchCompleted(nsIImapProtocol* aProtocol)
|
||||
{
|
||||
|
@ -1110,27 +1078,6 @@ GetShouldDownloadArbitraryHeadersProxyEvent::HandleEvent()
|
|||
return res;
|
||||
}
|
||||
|
||||
GetShowAttachmentsInlineProxyEvent::GetShowAttachmentsInlineProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, PRBool* aBool) :
|
||||
nsImapMiscellaneousSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aBool, "Oops... a null bool pointer");
|
||||
m_bool = aBool;
|
||||
}
|
||||
|
||||
GetShowAttachmentsInlineProxyEvent::~GetShowAttachmentsInlineProxyEvent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GetShowAttachmentsInlineProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapMiscellaneousSink->GetShowAttachmentsInline(
|
||||
m_proxy->m_protocol, m_bool);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
HeaderFetchCompletedProxyEvent::HeaderFetchCompletedProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy) :
|
||||
|
|
|
@ -103,8 +103,6 @@ public:
|
|||
GenericInfo* aInfo);
|
||||
NS_IMETHOD GetShouldDownloadArbitraryHeaders(nsIImapProtocol* aProtocol,
|
||||
GenericInfo* aInfo);
|
||||
NS_IMETHOD GetShowAttachmentsInline(nsIImapProtocol* aProtocol,
|
||||
PRBool* aBool);
|
||||
NS_IMETHOD HeaderFetchCompleted(nsIImapProtocol* aProtocol);
|
||||
NS_IMETHOD UpdateSecurityStatus(nsIImapProtocol* aProtocol);
|
||||
// ****
|
||||
|
@ -260,16 +258,6 @@ struct GetShouldDownloadArbitraryHeadersProxyEvent :
|
|||
GenericInfo *m_info; // pass in handle we don't own it
|
||||
};
|
||||
|
||||
struct GetShowAttachmentsInlineProxyEvent :
|
||||
public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
GetShowAttachmentsInlineProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, PRBool* aBool);
|
||||
virtual ~GetShowAttachmentsInlineProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
PRBool *m_bool; // pass in handle we don't own it
|
||||
};
|
||||
|
||||
struct HeaderFetchCompletedProxyEvent : public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
HeaderFetchCompletedProxyEvent(nsImapMiscellaneousSinkProxy* aProxy);
|
||||
|
|
|
@ -472,6 +472,7 @@ NS_IMETHODIMP nsParseMailMessageState::Clear()
|
|||
m_priority.length = 0;
|
||||
m_mdn_dnt.length = 0;
|
||||
m_return_path.length = 0;
|
||||
m_in_reply_to.length = 0;
|
||||
m_mdn_original_recipient.length = 0;
|
||||
m_body_lines = 0;
|
||||
m_newMsgHdr = null_nsCOMPtr();
|
||||
|
@ -797,6 +798,10 @@ int nsParseMailMessageState::ParseHeaders ()
|
|||
if (!nsCRT::strncasecmp ("From", buf, end - buf))
|
||||
header = &m_from;
|
||||
break;
|
||||
case 'I' : case 'i':
|
||||
if (!nsCRT::strncasecmp ("In-Reply-To", buf, end - buf))
|
||||
header = &m_in_reply_to;
|
||||
break;
|
||||
case 'M': case 'm':
|
||||
if (!nsCRT::strncasecmp ("Message-ID", buf, end - buf))
|
||||
header = &m_message_id;
|
||||
|
@ -1073,6 +1078,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
struct message_header *recipient;
|
||||
struct message_header *subject;
|
||||
struct message_header *id;
|
||||
struct message_header *inReplyTo;
|
||||
struct message_header *references;
|
||||
struct message_header *date;
|
||||
struct message_header *statush;
|
||||
|
@ -1118,6 +1124,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
0);
|
||||
priority = (m_priority.length ? &m_priority : 0);
|
||||
mdn_dnt = (m_mdn_dnt.length ? &m_mdn_dnt : 0);
|
||||
inReplyTo = (m_in_reply_to.length ? &m_in_reply_to : 0);
|
||||
|
||||
if (mozstatus)
|
||||
{
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
struct message_header m_status;
|
||||
struct message_header m_mozstatus;
|
||||
struct message_header m_mozstatus2;
|
||||
struct message_header m_in_reply_to;
|
||||
|
||||
// Support for having multiple To or CC header lines in a message
|
||||
nsVoidArray m_toList;
|
||||
|
|
Загрузка…
Ссылка в новой задаче