зеркало из https://github.com/mozilla/pjs.git
Adding mime support for MIME Parts On Demand - Bug #: 17794
This commit is contained in:
Родитель
2301ca749a
Коммит
1ad9cc0ee5
|
@ -94,5 +94,6 @@
|
|||
#define HEADER_PARM_TYPE "TYPE"
|
||||
|
||||
#define HEADER_X_MOZILLA_PART_URL "X-Mozilla-PartURL"
|
||||
#define HEADER_X_MOZILLA_IDENTITY_KEY "X-Identity-Key"
|
||||
|
||||
#endif /* nsMailHeaders_h_ */
|
||||
|
|
|
@ -217,4 +217,7 @@
|
|||
## @loc
|
||||
1035=Toggle Attachment Pane
|
||||
|
||||
|
||||
# Part not downloaded
|
||||
## @name MIME_MSG_NOT_DOWNLOADED
|
||||
## @loc
|
||||
1036=(Not Downloaded)
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "mozITXTToHTMLConv.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsIImapUrl.h"
|
||||
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -141,7 +142,6 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data)
|
|||
char *tmpURL = nsnull;
|
||||
char *id = nsnull;
|
||||
char *id_imap = nsnull;
|
||||
//PRBool all_headers_p = obj->options->headers == MimeHeadersAll;
|
||||
|
||||
id = mime_part_address (obj);
|
||||
if (obj->options->missing_parts)
|
||||
|
@ -162,6 +162,16 @@ ProcessBodyAsAttachment(MimeObject *obj, nsMsgAttachmentData **data)
|
|||
// if this is an IMAP part.
|
||||
tmpURL = mime_set_url_imap_part(url, id_imap, id);
|
||||
rv = nsMimeNewURI(&(tmp->url), tmpURL, nsnull);
|
||||
|
||||
// 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();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -265,6 +275,7 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData,
|
|||
MimeContainer *cobj = (MimeContainer *) aChild;
|
||||
nsMsgAttachmentData *tmp = nsnull;
|
||||
PRBool isAlternativeOrRelated;
|
||||
PRBool isIMAPPart = PR_FALSE;
|
||||
|
||||
if ( (!aChild) || (!cobj->children) )
|
||||
return NS_OK;
|
||||
|
@ -296,7 +307,10 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData,
|
|||
|
||||
char *urlSpec = nsnull;
|
||||
if (imappart)
|
||||
{
|
||||
isIMAPPart = PR_TRUE;
|
||||
urlSpec = mime_set_url_imap_part(aMessageURL, imappart, part);
|
||||
}
|
||||
else
|
||||
urlSpec = mime_set_url_part(aMessageURL, part, PR_TRUE);
|
||||
|
||||
|
@ -363,6 +377,19 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData,
|
|||
|
||||
// Now, do the right thing with the name!
|
||||
ValidateRealName(tmp, child->headers);
|
||||
|
||||
if (isIMAPPart)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1194,6 +1221,28 @@ 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<nsIURI> aUri;
|
||||
if (NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(aUri))))
|
||||
{
|
||||
nsCOMPtr<nsIImapUrl> 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.
|
||||
//
|
||||
|
|
|
@ -61,5 +61,6 @@
|
|||
#define MIME_MSG_USER_WROTE 1033
|
||||
#define MIME_MSG_NO_HEADERS 1034
|
||||
#define MIME_MSG_SHOW_ATTACHMENT_PANE 1035
|
||||
#define MIME_MSG_NOT_DOWNLOADED 1036
|
||||
|
||||
#endif /* _NAME_OF_THIS_HEADER_FILE__ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче