diff --git a/mozilla/mailnews/base/resources/content/msgHdrViewOverlay.js b/mozilla/mailnews/base/resources/content/msgHdrViewOverlay.js index fe0a2dd62db..8aee66073f9 100644 --- a/mozilla/mailnews/base/resources/content/msgHdrViewOverlay.js +++ b/mozilla/mailnews/base/resources/content/msgHdrViewOverlay.js @@ -164,11 +164,16 @@ var messageHeaderSink = { } }, - handleAttachment: function(url, displayName, uri) + handleAttachment: function(url, displayName, uri, notDownloaded) { // be sure to escape the display name before we insert it into the // method var commandString = "OpenAttachURL('" + url + "', '" + escape(displayName) + "', '" + uri + "')"; + if (notDownloaded) + { + displayName += " " + Bundle.GetStringFromName("notDownloaded"); + } + AddAttachmentToMenu(displayName, commandString); } }; diff --git a/mozilla/mailnews/base/resources/locale/en-US/messenger.properties b/mozilla/mailnews/base/resources/locale/en-US/messenger.properties index 916acc674b3..bc4a32008b9 100644 --- a/mozilla/mailnews/base/resources/locale/en-US/messenger.properties +++ b/mozilla/mailnews/base/resources/locale/en-US/messenger.properties @@ -51,3 +51,4 @@ PrintingMessage=Printing message... PrintingComplete=Printing complete. saveAttachmentFailed=Unable to save the attachment. Please check your file name and try again later. saveMessageFailed=Unable to save the message. Please check your file name and try again later. +notDownloaded=(Not Downloaded) diff --git a/mozilla/mailnews/compose/public/nsIMsgSend.idl b/mozilla/mailnews/compose/public/nsIMsgSend.idl index 777deadce37..5346c1e4894 100644 --- a/mozilla/mailnews/compose/public/nsIMsgSend.idl +++ b/mozilla/mailnews/compose/public/nsIMsgSend.idl @@ -77,7 +77,7 @@ typedef nsresult (*nsMsgSendUnsentMessagesCallback) (nsresult aExitCode, PRUint3 // Attachment file/URL structures struct nsMsgAttachmentData { - nsIURI *url; // The URL to attach. This should be 0 to signify "end of list". + nsIURI *url; // The URL to attach. This should be 0 to signify "end of list". char *desired_type; // The type to which this document should be // converted. Legal values are NULL, TEXT_PLAIN @@ -100,6 +100,7 @@ struct nsMsgAttachmentData char *x_mac_type, *x_mac_creator; // Mac-specific data that should show up as optional parameters // to the content-type header. + PRBool notDownloaded; // Flag for IMAP parts on demand status }; diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp index a8d66a46e8f..a39f406d53f 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp @@ -311,7 +311,8 @@ nsMimeBaseEmitter::SetOutputListener(nsIStreamListener *listener) // Attachment handling routines nsresult -nsMimeBaseEmitter::StartAttachment(const char *name, const char *contentType, const char *url) +nsMimeBaseEmitter::StartAttachment(const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded) { // Ok, now we will setup the attachment info mCurrentAttachment = (attachmentInfoType *) PR_NEWZAP(attachmentInfoType); @@ -322,6 +323,7 @@ nsMimeBaseEmitter::StartAttachment(const char *name, const char *contentType, co mCurrentAttachment->displayName = nsCRT::strdup(name); mCurrentAttachment->urlSpec = nsCRT::strdup(url); mCurrentAttachment->contentType = nsCRT::strdup(contentType); + mCurrentAttachment->notDownloaded = aNotDownloaded; } return NS_OK; diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h index 325c9420708..8237d6338c9 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h +++ b/mozilla/mailnews/mime/emitters/src/nsMimeBaseEmitter.h @@ -55,6 +55,7 @@ typedef struct { char *displayName; char *urlSpec; char *contentType; + PRBool notDownloaded; } attachmentInfoType; // diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp index 2566964dd11..a757a0ecd09 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp @@ -215,7 +215,8 @@ nsMimeHtmlDisplayEmitter::EndHeader() } nsresult -nsMimeHtmlDisplayEmitter::StartAttachment(const char *name, const char *contentType, const char *url) +nsMimeHtmlDisplayEmitter::StartAttachment(const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded) { nsresult rv = NS_OK; @@ -246,7 +247,7 @@ nsMimeHtmlDisplayEmitter::StartAttachment(const char *name, const char *contentT } if (NS_SUCCEEDED(rv)) - headerSink->HandleAttachment(escapedUrl, unicodeHeaderValue, uriString); + headerSink->HandleAttachment(escapedUrl, unicodeHeaderValue, uriString, aNotDownloaded); nsCRT::free(escapedUrl); mSkipAttachment = PR_TRUE; } diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.h b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.h index 011ced5a2ab..c5c732e5288 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.h +++ b/mozilla/mailnews/mime/emitters/src/nsMimeHtmlEmitter.h @@ -45,7 +45,8 @@ public: NS_IMETHOD EndHeader(); // Attachment handling routines - NS_IMETHOD StartAttachment(const char *name, const char *contentType, const char *url); + NS_IMETHOD StartAttachment(const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded); NS_IMETHOD AddAttachmentField(const char *field, const char *value); NS_IMETHOD EndAttachment(); diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp b/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp index 2af76fdde56..640b1c70908 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp +++ b/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp @@ -177,7 +177,8 @@ nsMimeXmlEmitter::EndHeader() // Attachment handling routines nsresult -nsMimeXmlEmitter::StartAttachment(const char *name, const char *contentType, const char *url) +nsMimeXmlEmitter::StartAttachment(const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded) { char buf[128]; diff --git a/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.h b/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.h index 3b3e314b9f4..77edfe23d70 100644 --- a/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.h +++ b/mozilla/mailnews/mime/emitters/src/nsMimeXmlEmitter.h @@ -45,7 +45,8 @@ public: NS_IMETHOD EndHeader(); // Attachment handling routines - NS_IMETHOD StartAttachment(const char *name, const char *contentType, const char *url); + NS_IMETHOD StartAttachment(const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded); NS_IMETHOD AddAttachmentField(const char *field, const char *value); NS_IMETHOD EndAttachment(); diff --git a/mozilla/mailnews/mime/public/nsIMimeEmitter.idl b/mozilla/mailnews/mime/public/nsIMimeEmitter.idl index 729118f02e3..9e7db8d4bd8 100644 --- a/mozilla/mailnews/mime/public/nsIMimeEmitter.idl +++ b/mozilla/mailnews/mime/public/nsIMimeEmitter.idl @@ -61,7 +61,7 @@ interface nsIMimeEmitter : nsISupports{ // Attachment handling routines void StartAttachment([const] in string name, [const] in string contentType, - [const] in string url); + [const] in string url, in PRBool aNotDownloaded); void AddAttachmentField([const] in string field, [const] in string value); void EndAttachment(); diff --git a/mozilla/mailnews/mime/public/nsIMimeMiscStatus.idl b/mozilla/mailnews/mime/public/nsIMimeMiscStatus.idl index 89f11a1fc06..2604ff230b1 100644 --- a/mozilla/mailnews/mime/public/nsIMimeMiscStatus.idl +++ b/mozilla/mailnews/mime/public/nsIMimeMiscStatus.idl @@ -51,5 +51,5 @@ interface nsIMsgHeaderSink : nsISupports{ // make a sandwhich around header processing..... void onStartHeaders(); void onEndHeaders(); - void handleAttachment(in string url, in wstring displayName, in string uri); + void handleAttachment(in string url, in wstring displayName, in string uri, in boolean aNotDownloaded); }; diff --git a/mozilla/mailnews/mime/src/mimemoz2.cpp b/mozilla/mailnews/mime/src/mimemoz2.cpp index f7a49c7412d..c404169b8e2 100644 --- a/mozilla/mailnews/mime/src/mimemoz2.cpp +++ b/mozilla/mailnews/mime/src/mimemoz2.cpp @@ -163,8 +163,12 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data) tmpURL = mime_set_url_imap_part(url, id_imap, id); rv = nsMimeNewURI(&(tmp->url), tmpURL, nsnull); + tmp->notDownloaded = PR_TRUE; + + // RICHIE RICHIE // If we get here, we should really add some type of string // onto the name to show its not downloaded + /******************** nsString tName(tmp->real_name); char *msgString = MimeGetStringByID(MIME_MSG_NOT_DOWNLOADED); @@ -172,6 +176,7 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data) tName.Append(msgString); PR_FREEIF(tmp->real_name); tmp->real_name = tName.ToNewCString(); + *********************/ } else { @@ -380,15 +385,22 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData, if (isIMAPPart) { + // If we get here, we should mark this attachment as not being + // downloaded. + tmp->notDownloaded = PR_TRUE; + + // RICHIE RICHIE RICHIE + // // If we get here, we should really add some type of string // onto the name to show its not downloaded + /** nsString tName(tmp->real_name); - char *msgString = MimeGetStringByID(MIME_MSG_NOT_DOWNLOADED); tName.Append(" "); tName.Append(msgString); PR_FREEIF(tmp->real_name); tmp->real_name = tName.ToNewCString(); + ***/ } } @@ -486,7 +498,7 @@ NotifyEmittersOfAttachmentList(MimeDisplayOptions *opt, if ( tmp->url ) tmp->url->GetSpec(&spec); - mimeEmitterStartAttachment(opt, tmp->real_name, tmp->real_type, spec); + mimeEmitterStartAttachment(opt, tmp->real_name, tmp->real_type, spec, tmp->notDownloaded); mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_URL, spec); if (spec) @@ -711,7 +723,6 @@ 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; @@ -720,7 +731,7 @@ mime_display_stream_write (nsMIMESession *stream, // Ok, now check to see if this is a display operation for a MIME Parts on Demand // enabled call. // - if (firstCheck) + if (msd->firstCheck) { if (msd->channel) { @@ -740,7 +751,7 @@ mime_display_stream_write (nsMIMESession *stream, } } - firstCheck = PR_FALSE; + msd->firstCheck = PR_FALSE; } return obj->clazz->parse_buffer((char *) buf, size, obj); @@ -1196,6 +1207,7 @@ mime_bridge_create_display_stream( // Assign the new mime emitter - will handle output operations msd->output_emitter = newEmitter; + msd->firstCheck = PR_TRUE; // Store the URL string for this decode operation char *urlString; @@ -1483,7 +1495,8 @@ mimeEmitterAddHeaderField(MimeDisplayOptions *opt, const char *field, const char } extern "C" nsresult -mimeEmitterStartAttachment(MimeDisplayOptions *opt, const char *name, const char *contentType, const char *url) +mimeEmitterStartAttachment(MimeDisplayOptions *opt, const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded) { // Check for draft processing... if (NoEmitterProcessing(opt->format_out)) @@ -1496,7 +1509,7 @@ mimeEmitterStartAttachment(MimeDisplayOptions *opt, const char *name, const char if (msd->output_emitter) { nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter; - return emitter->StartAttachment(name, contentType, url); + return emitter->StartAttachment(name, contentType, url, aNotDownloaded); } return NS_ERROR_FAILURE; diff --git a/mozilla/mailnews/mime/src/mimemoz2.h b/mozilla/mailnews/mime/src/mimemoz2.h index 7781704460d..1c0d61f4762 100644 --- a/mozilla/mailnews/mime/src/mimemoz2.h +++ b/mozilla/mailnews/mime/src/mimemoz2.h @@ -115,6 +115,7 @@ struct mime_stream_data { /* This struct is the state we pass around MimeHeaders *headers; /* Copy of outer most mime header */ nsIMimeEmitter *output_emitter; /* Output emitter engine for libmime */ + PRBool firstCheck; /* Is this the first look at the stream data */ }; //////////////////////////////////////////////////////////////// @@ -137,7 +138,8 @@ extern "C" nsIMimeEmitter *GetMimeEmitter(MimeDisplayOptions *opt); extern "C" nsresult mimeSetNewURL(nsMIMESession *stream, char *url); extern "C" nsresult mimeEmitterAddAttachmentField(MimeDisplayOptions *opt, const char *field, const char *value); extern "C" nsresult mimeEmitterAddHeaderField(MimeDisplayOptions *opt, const char *field, const char *value); -extern "C" nsresult mimeEmitterStartAttachment(MimeDisplayOptions *opt, const char *name, const char *contentType, const char *url); +extern "C" nsresult mimeEmitterStartAttachment(MimeDisplayOptions *opt, const char *name, const char *contentType, const char *url, + PRBool aNotDownloaded); extern "C" nsresult mimeEmitterEndAttachment(MimeDisplayOptions *opt); extern "C" nsresult mimeEmitterStartBody(MimeDisplayOptions *opt, PRBool bodyOnly, const char *msgID, const char *outCharset); extern "C" nsresult mimeEmitterEndBody(MimeDisplayOptions *opt); diff --git a/mozilla/mailnews/mime/src/mimetpla.cpp b/mozilla/mailnews/mime/src/mimetpla.cpp index 61c4cd3f9f9..f06a894bac2 100644 --- a/mozilla/mailnews/mime/src/mimetpla.cpp +++ b/mozilla/mailnews/mime/src/mimetpla.cpp @@ -149,7 +149,10 @@ MimeInlineTextPlain_parse_begin (MimeObject *obj) if ( (obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting) || (obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting) ) { - s = nsCRT::strdup(strs[0]); + if (obj->options->wrap_long_lines_p) + s = nsCRT::strdup(strs[2]); + else + s = nsCRT::strdup(strs[0]); } else {