From 716179cf828341f79e8eacdee701df1f6faad9ba Mon Sep 17 00:00:00 2001 From: "rhp%netscape.com" Date: Wed, 22 Mar 2000 22:52:42 +0000 Subject: [PATCH] Adding mime support for MIME Parts On Demand - Bug #: 17794 --- mailnews/mime/src/mimemoz2.cpp | 50 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp index 6ef18c7266d..f7a49c7412d 100644 --- a/mailnews/mime/src/mimemoz2.cpp +++ b/mailnews/mime/src/mimemoz2.cpp @@ -711,10 +711,38 @@ mime_display_stream_write (nsMIMESession *stream, PRInt32 size) { struct mime_stream_data *msd = (struct mime_stream_data *) ((nsMIMESession *)stream)->data_object; + static PRBool firstCheck = PR_TRUE; MimeObject *obj = (msd ? msd->obj : 0); if (!obj) return -1; + // + // Ok, now check to see if this is a display operation for a MIME Parts on Demand + // enabled call. + // + if (firstCheck) + { + if (msd->channel) + { + nsCOMPtr aUri; + if (NS_SUCCEEDED(msd->channel->GetURI(getter_AddRefs(aUri)))) + { + nsCOMPtr imapURL = do_QueryInterface(aUri); + if (imapURL) + { + nsImapContentModifiedType cModified; + if (NS_SUCCEEDED(imapURL->GetContentModified(&cModified))) + { + if ( cModified != nsImapContentModifiedTypes::IMAP_CONTENT_NOT_MODIFIED ) + msd->options->missing_parts = PR_TRUE; + } + } + } + } + + firstCheck = PR_FALSE; + } + return obj->clazz->parse_buffer((char *) buf, size, obj); } @@ -1221,28 +1249,6 @@ mime_bridge_create_display_stream( return nsnull; } - // - // Ok, now check to see if this is a display operation for a MIME Parts on Demand - // enabled call. - // - if (aChannel) - { - nsCOMPtr aUri; - if (NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(aUri)))) - { - nsCOMPtr imapURL = do_QueryInterface(aUri); - if (imapURL) - { - nsImapContentModifiedType cModified; - if (NS_SUCCEEDED(imapURL->GetContentModified(&cModified))) - { - if ( cModified != nsImapContentModifiedTypes::IMAP_CONTENT_NOT_MODIFIED ) - msd->options->missing_parts = PR_TRUE; - } - } - } - } - // // Set the defaults, based on the context, and the output-type. //