This commit is contained in:
rhp%netscape.com 1999-08-11 00:29:59 +00:00
Родитель bfe0d8fed4
Коммит b345f302fd
27 изменённых файлов: 631 добавлений и 488 удалений

Просмотреть файл

@ -91,6 +91,7 @@ mailnews/mime/emitters/build/Makefile
mailnews/mime/emitters/src/Makefile
mailnews/mime/emitters/resources/Makefile
mailnews/mime/emitters/resources/skin/Makefile
mailnews/mime/emitters/resources/content/Makefile
mailnews/mime/tests/Makefile
mailnews/mime/tests/xpcomtest/Makefile
mailnews/mime/tests/mimetest/Makefile

Просмотреть файл

@ -28,11 +28,13 @@
#include "nsMimeHtmlEmitter.h"
#include "nsMimeRawEmitter.h"
#include "nsMimeXmlEmitter.h"
#include "nsMimeXULEmitter.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kHtmlMimeEmitterCID, NS_HTML_MIME_EMITTER_CID);
static NS_DEFINE_CID(kRawMimeEmitterCID, NS_RAW_MIME_EMITTER_CID);
static NS_DEFINE_CID(kXmlMimeEmitterCID, NS_XML_MIME_EMITTER_CID);
static NS_DEFINE_CID(kXULMimeEmitterCID, NS_XUL_MIME_EMITTER_CID);
////////////////////////////////////////////////////////////
//
@ -128,6 +130,8 @@ nsresult nsMimeEmitterFactory::CreateInstance(nsISupports *aOuter,
res = NS_NewMimeRawEmitter(aIID, aResult);
else if (mClassID.Equals(kXmlMimeEmitterCID))
res = NS_NewMimeXmlEmitter(aIID, aResult);
else if (mClassID.Equals(kXULMimeEmitterCID))
res = NS_NewMimeXULEmitter(aIID, aResult);
return res;
}
@ -195,6 +199,11 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) finalResult = rv;
rv = compMgr->RegisterComponent(kXULMimeEmitterCID,
"RFC822 Parser",
"component://netscape/messenger/mimeemitter;type=text/xul",
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) finalResult = rv;
return finalResult;
}
@ -217,6 +226,9 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* path)
rv = compMgr->UnregisterComponent(kXmlMimeEmitterCID, path);
if (NS_FAILED(rv)) finalResult = rv;
rv = compMgr->UnregisterComponent(kXULMimeEmitterCID, path);
if (NS_FAILED(rv)) finalResult = rv;
return finalResult;
}

Просмотреть файл

@ -38,4 +38,9 @@
{ 0xf0a8af16, 0xdcff, 0x11d2, \
{ 0xa4, 0x11, 0x0, 0x80, 0x5f, 0x61, 0x3c, 0x79 } }
// {FAA8AF16-DCFF-11d2-A411-00805F613C19}
#define NS_XUL_MIME_EMITTER_CID \
{ 0xfaa8af16, 0xdcff, 0x11d2, \
{ 0xa4, 0x11, 0x0, 0x80, 0x5f, 0x61, 0x3c, 0x19 } }
#endif // nsMimeEmitterCID_h__

Просмотреть файл

@ -19,3 +19,5 @@
mailheader-micro.css
mailheader-normal.css
mailheader-all.css
addcard.gif
attach.gif

Просмотреть файл

@ -15,7 +15,7 @@
#
DEPTH=..\..\..\..
DIRS= skin
DIRS= skin content
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -19,3 +19,5 @@
mailheader-micro.css
mailheader-normal.css
mailheader-all.css
addcard.gif
attach.gif

Просмотреть файл

@ -31,6 +31,8 @@ EXPORT_RESOURCES = \
$(srcdir)/mailheader-micro.css \
$(srcdir)/mailheader-normal.css \
$(srcdir)/mailheader-all.css \
$(srcdir)/addcard.gif \
$(srcdir)/attach.gif \
$(NULL)
EXPORT_RESOURCES_TO_REMOVE := $(addprefix $(MESSENGER_DIR)/, $(EXPORT_RESOURCES))

Просмотреть файл

@ -3,9 +3,14 @@
* attributes
*/
window { overflow: auto; }
mailheader { display: block; background-color: #E0E0E0; }
mailheader { display: block; }
mailattachcount { display: none; }
box[name=header-attachment] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part1] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part2] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
box[name=header-part3] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
/**************************************************
* These are all the headers that are displayed
* for the normal header display. This is accomplished
@ -18,29 +23,20 @@ mailattachcount { display: none; }
header { display: block; text-align: left; }
headerdisplayname { font-weight: bold; }
header[field=DATE]:before { font-weight: bold; }
header[field=DATE { display: block; text-align:left; }
header[field=DATE] { display: block; text-align:left; }
header[field=TO]:before { font-weight: bold; }
header[field=TO] { display: block; text-align: left; }
header[field=FROM]:before { font-weight: bold; }
header[field=FROM] { display: block; text-align:left; }
header[field=SUBJECT]:before { font-weight: bold; }
header[field=SUBJECT] { display: block; text-align: left;
background-color: lightyellow; border: 1px solid #CCCCCC; }
header[field=SUBJECT] { display: block; text-align: left; font-weight: bold; }
header[field=CC]:before { font-weight: bold; }
header[field=CC] { display: block; text-align:left; }
header[field=BCC]:before { font-weight: bold; }
header[field=BCC] { display: block; text-align:left; }
header[field=NEWSGROUPS]:before { font-weight: bold; }
header[field=NEWSGROUPS] { display: block; text-align:left; }
header[field=ORGANIZATION]:before { font-weight: bold; }
header[field=ORGANIZATION] { display: block; text-align:left; }
/**************************************************
@ -52,100 +48,68 @@ header[field=ORGANIZATION] { display: block; text-align:left; }
* "X-" are turned off!
*/
header[field=RETURN-PATH]:before { font-weight: bold; }
header[field=RETURN-PATH] { display: none; text-align:left; }
header[field=STATUS]:before { font-weight: bold; }
header[field=STATUS] { display: none; text-align:left; }
header[field=RECEIVED]:before { font-weight: bold; }
header[field=RECEIVED] { display: none; text-align:left; }
header[field=MIME-VERSION]:before { font-weight: bold; }
header[field=MIME-VERSION] { display: none; text-align:left; }
header[field=PRECEDENCE]:before { font-weight: bold; }
header[field=PRECEDENCE] { display: none; text-align: left; }
header[field=CONTENT-BASE]:before { font-weight: bold; }
header[field=CONTENT-BASE] { display: none; text-align:left; }
header[field=CONTENT-LOCATION]:before { font-weight: bold; }
header[field=CONTENT-LOCATION] { display: none; text-align:left; }
header[field=CONTENT-ID]:before { font-weight: bold; }
header[field=CONTENT-ID] { display: none; text-align:left; }
header[field=CONTENT-DESCRIPTION]:before { font-weight: bold; }
header[field=CONTENT-DESCRIPTION] { display: none; text-align:left; }
header[field=CONTENT-DISPOSITION]:before { font-weight: bold; }
header[field=CONTENT-DISPOSITION] { display: none; text-align:left; }
header[field=CONTENT-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-LENGTH]:before { font-weight: bold; }
header[field=CONTENT-LENGTH] { display: none; text-align:left; }
header[field=CONTENT-NAME]:before { font-weight: bold; }
header[field=CONTENT-NAME] { display: none; text-align:left; }
header[field=CONTENT-TRANSFER-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-TRANSFER-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-TYPE]:before { font-weight: bold; }
header[field=CONTENT-TYPE] { display: none; text-align:left; }
header[field=DISTRIBUTION]:before { font-weight: bold; }
header[field=DISTRIBUTION] { display: none; text-align:left; }
header[field=FCC]:before { font-weight: bold; }
header[field=FCC] { display: none; text-align:left; }
header[field=FOLLOWUP-TO]:before { font-weight: bold; }
header[field=FOLLOWUP-TO] { display: none; text-align:left; }
header[field=LINES]:before { font-weight: bold; }
header[field=LINES] { display: none; text-align:left; }
header[field=MESSAGE-ID]:before { font-weight: bold; }
header[field=MESSAGE-ID] { display: none; text-align:left; }
header[field=REFERENCES]:before { font-weight: bold; }
header[field=REFERENCES] { display: none; text-align:left; }
header[field=REPLY-TO]:before { font-weight: bold;}
header[field=REPLY-TO] { display: none; text-align:left; }
header[field=RESENT-COMMENTS]:before { font-weight: bold; }
header[field=RESENT-COMMENTS] { display: none; text-align:left; }
header[field=RESENT-DATE]:before { font-weight: bold; }
header[field=RESENT-DATE] { display: none; text-align:left; }
header[field=RESENT-FROM]:before { font-weight: bold; }
header[field=RESENT-FROM] { display: none; text-align:left; }
header[field=RESENT-MESSAGE-ID]:before { font-weight: bold; }
header[field=RESENT-MESSAGE-ID] { display: none; text-align:left; }
header[field=RESENT-SENDER]:before { font-weight: bold; }
header[field=RESENT-SENDER] { display: none; text-align:left; }
header[field=RESENT-TO]:before { font-weight: bold; }
header[field=RESENT-TO] { display: none; text-align:left; }
header[field=RESENT-CC]:before { font-weight: bold; }
header[field=RESENT-CC] { display: none; text-align:left; }
header[field=SENDER]:before { font-weight: bold; }
header[field=SENDER] { display: none; text-align:left; }
header[field=XREF]:before { font-weight: bold; }
header[field=XREF] { display: none; text-align:left; }
header[field=APPROVED-BY]:before { font-weight: bold; }
header[field=APPROVED-BY] { display: none; text-align:left; }
/**************************************************
@ -154,51 +118,35 @@ header[field=APPROVED-BY] { display: none; text-align:left; }
* all header display
**************************************************/
header[field=X-SUN-CHARSET]:before { font-weight: bold; }
header[field=X-SUN-CHARSET] { display: none; text-align:left; }
header[field=X-SUN-CONTENT-LENGTH]:before { font-weight: bold; }
header[field=X-SUN-CONTENT-LENGTH] { display: none; text-align:left; }
header[field=X-SUN-DATA-DESCRIPTION]:before { font-weight: bold; }
header[field=X-SUN-DATA-DESCRIPTION] { display: none; text-align:left; }
header[field=X-SUN-DATA-NAME]:before { font-weight: bold; }
header[field=X-SUN-DATA-NAME] { display: none; text-align:left; }
header[field=X-SUN-DATA-TYPE]:before { font-weight: bold; }
header[field=X-SUN-DATA-TYPE] { display: none; text-align:left; }
header[field=X-SUN-ENCODING-INFO]:before { font-weight: bold; }
header[field=X-SUN-ENCODING-INFO] { display: none; text-align:left; }
header[field=X-PRIORITY]:before { font-weight: bold; }
header[field=X-PRIORITY] { display: none; text-align:left; }
header[field=X-MOZILLA-PARTURL]:before { font-weight: bold; }
header[field=X-MOZILLA-PARTURL] { display: none; text-align:left; }
header[field=X-MOZILLA-DRAFT-INFO]:before { font-weight: bold; }
header[field=X-MOZILLA-DRAFT-INFO] { display: none; text-align:left; }
header[field=X-ACCEPT-LANGUAGE]:before { font-weight: bold; }
header[field=X-ACCEPT-LANGUAGE] { display: none; text-align:left; }
header[field=X-MAILING-LIST]:before { font-weight: bold; }
header[field=X-MAILING-LIST] { display: none; text-align:left; }
header[field=X-MAILING-LOOP]:before { font-weight: bold; }
header[field=X-MAILING-LOOP] { display: none; text-align:left; }
header[field=X-LOOP]:before { font-weight: bold; }
header[field=X-LOOP] { display: none; text-align: left; }
header[field=X-MAILER]:before { font-weight: bold; }
header[field=X-MAILER] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS2]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS2] { display: none; text-align: left; }

Просмотреть файл

@ -3,9 +3,14 @@
* attributes
*/
window { overflow: auto; }
mailheader { display: block; background-color: #E0E0E0; }
mailheader { display: block; }
mailattachcount { display: none; }
box[name=header-attachment] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part1] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part2] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
box[name=header-part3] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
/**************************************************
* These are all the headers that are displayed
* for the normal header display. This is accomplished
@ -18,29 +23,20 @@ mailattachcount { display: none; }
header { display: none; text-align: left; }
headerdisplayname { font-weight: bold; }
header[field=DATE]:before { font-weight: bold; }
header[field=DATE { display: block; text-align:left; }
header[field=DATE] { display: block; text-align:left; }
header[field=TO]:before { font-weight: bold; }
header[field=TO] { display: block; text-align: left; }
header[field=FROM]:before { font-weight: bold; }
header[field=FROM] { display: block; text-align:left; }
header[field=SUBJECT]:before { font-weight: bold; }
header[field=SUBJECT] { display: block; text-align: left;
background-color: lightyellow; border: 1px solid #CCCCCC; }
header[field=SUBJECT] { display: block; text-align: left; font-weight: bold; }
header[field=CC]:before { font-weight: bold; }
header[field=CC] { display: block; text-align:left; }
header[field=BCC]:before { font-weight: bold; }
header[field=BCC] { display: block; text-align:left; }
header[field=NEWSGROUPS]:before { font-weight: bold; }
header[field=NEWSGROUPS] { display: block; text-align:left; }
header[field=ORGANIZATION]:before { font-weight: bold; }
header[field=ORGANIZATION] { display: block; text-align:left; }
/**************************************************
@ -52,100 +48,68 @@ header[field=ORGANIZATION] { display: block; text-align:left; }
* "X-" are turned off!
*/
header[field=RETURN-PATH]:before { font-weight: bold; }
header[field=RETURN-PATH] { display: none; text-align:left; }
header[field=STATUS]:before { font-weight: bold; }
header[field=STATUS] { display: none; text-align:left; }
header[field=RECEIVED]:before { font-weight: bold; }
header[field=RECEIVED] { display: none; text-align:left; }
header[field=MIME-VERSION]:before { font-weight: bold; }
header[field=MIME-VERSION] { display: none; text-align:left; }
header[field=PRECEDENCE]:before { font-weight: bold; }
header[field=PRECEDENCE] { display: none; text-align: left; }
header[field=CONTENT-BASE]:before { font-weight: bold; }
header[field=CONTENT-BASE] { display: none; text-align:left; }
header[field=CONTENT-LOCATION]:before { font-weight: bold; }
header[field=CONTENT-LOCATION] { display: none; text-align:left; }
header[field=CONTENT-ID]:before { font-weight: bold; }
header[field=CONTENT-ID] { display: none; text-align:left; }
header[field=CONTENT-DESCRIPTION]:before { font-weight: bold; }
header[field=CONTENT-DESCRIPTION] { display: none; text-align:left; }
header[field=CONTENT-DISPOSITION]:before { font-weight: bold; }
header[field=CONTENT-DISPOSITION] { display: none; text-align:left; }
header[field=CONTENT-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-LENGTH]:before { font-weight: bold; }
header[field=CONTENT-LENGTH] { display: none; text-align:left; }
header[field=CONTENT-NAME]:before { font-weight: bold; }
header[field=CONTENT-NAME] { display: none; text-align:left; }
header[field=CONTENT-TRANSFER-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-TRANSFER-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-TYPE]:before { font-weight: bold; }
header[field=CONTENT-TYPE] { display: none; text-align:left; }
header[field=DISTRIBUTION]:before { font-weight: bold; }
header[field=DISTRIBUTION] { display: none; text-align:left; }
header[field=FCC]:before { font-weight: bold; }
header[field=FCC] { display: none; text-align:left; }
header[field=FOLLOWUP-TO]:before { font-weight: bold; }
header[field=FOLLOWUP-TO] { display: none; text-align:left; }
header[field=LINES]:before { font-weight: bold; }
header[field=LINES] { display: none; text-align:left; }
header[field=MESSAGE-ID]:before { font-weight: bold; }
header[field=MESSAGE-ID] { display: none; text-align:left; }
header[field=REFERENCES]:before { font-weight: bold; }
header[field=REFERENCES] { display: none; text-align:left; }
header[field=REPLY-TO]:before { font-weight: bold;}
header[field=REPLY-TO] { display: none; text-align:left; }
header[field=RESENT-COMMENTS]:before { font-weight: bold; }
header[field=RESENT-COMMENTS] { display: none; text-align:left; }
header[field=RESENT-DATE]:before { font-weight: bold; }
header[field=RESENT-DATE] { display: none; text-align:left; }
header[field=RESENT-FROM]:before { font-weight: bold; }
header[field=RESENT-FROM] { display: none; text-align:left; }
header[field=RESENT-MESSAGE-ID]:before { font-weight: bold; }
header[field=RESENT-MESSAGE-ID] { display: none; text-align:left; }
header[field=RESENT-SENDER]:before { font-weight: bold; }
header[field=RESENT-SENDER] { display: none; text-align:left; }
header[field=RESENT-TO]:before { font-weight: bold; }
header[field=RESENT-TO] { display: none; text-align:left; }
header[field=RESENT-CC]:before { font-weight: bold; }
header[field=RESENT-CC] { display: none; text-align:left; }
header[field=SENDER]:before { font-weight: bold; }
header[field=SENDER] { display: none; text-align:left; }
header[field=XREF]:before { font-weight: bold; }
header[field=XREF] { display: none; text-align:left; }
header[field=APPROVED-BY]:before { font-weight: bold; }
header[field=APPROVED-BY] { display: none; text-align:left; }
/**************************************************
@ -154,51 +118,35 @@ header[field=APPROVED-BY] { display: none; text-align:left; }
* all header display
**************************************************/
header[field=X-SUN-CHARSET]:before { font-weight: bold; }
header[field=X-SUN-CHARSET] { display: none; text-align:left; }
header[field=X-SUN-CONTENT-LENGTH]:before { font-weight: bold; }
header[field=X-SUN-CONTENT-LENGTH] { display: none; text-align:left; }
header[field=X-SUN-DATA-DESCRIPTION]:before { font-weight: bold; }
header[field=X-SUN-DATA-DESCRIPTION] { display: none; text-align:left; }
header[field=X-SUN-DATA-NAME]:before { font-weight: bold; }
header[field=X-SUN-DATA-NAME] { display: none; text-align:left; }
header[field=X-SUN-DATA-TYPE]:before { font-weight: bold; }
header[field=X-SUN-DATA-TYPE] { display: none; text-align:left; }
header[field=X-SUN-ENCODING-INFO]:before { font-weight: bold; }
header[field=X-SUN-ENCODING-INFO] { display: none; text-align:left; }
header[field=X-PRIORITY]:before { font-weight: bold; }
header[field=X-PRIORITY] { display: none; text-align:left; }
header[field=X-MOZILLA-PARTURL]:before { font-weight: bold; }
header[field=X-MOZILLA-PARTURL] { display: none; text-align:left; }
header[field=X-MOZILLA-DRAFT-INFO]:before { font-weight: bold; }
header[field=X-MOZILLA-DRAFT-INFO] { display: none; text-align:left; }
header[field=X-ACCEPT-LANGUAGE]:before { font-weight: bold; }
header[field=X-ACCEPT-LANGUAGE] { display: none; text-align:left; }
header[field=X-MAILING-LIST]:before { font-weight: bold; }
header[field=X-MAILING-LIST] { display: none; text-align:left; }
header[field=X-MAILING-LOOP]:before { font-weight: bold; }
header[field=X-MAILING-LOOP] { display: none; text-align:left; }
header[field=X-LOOP]:before { font-weight: bold; }
header[field=X-LOOP] { display: none; text-align: left; }
header[field=X-MAILER]:before { font-weight: bold; }
header[field=X-MAILER] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS2]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS2] { display: none; text-align: left; }

Просмотреть файл

@ -3,9 +3,14 @@
* attributes
*/
window { overflow: auto; }
mailheader { display: block; background-color: #E0E0E0; }
mailheader { display: block; }
mailattachcount { display: none; }
box[name=header-attachment] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part1] { background-color: #EFEFEF; border: 2px solid #EFEFEF }
box[name=header-part2] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
box[name=header-part3] { background-color: #DEDEDE; border: 2px solid #DEDEDE }
/**************************************************
* These are all the headers that are displayed
* for the normal header display. This is accomplished
@ -15,32 +20,23 @@ mailattachcount { display: none; }
* from being displayed.
**************************************************/
headerdisplayname { font-weight: bold; }
headerdisplayname { font-weight: bold; white-space: pre; }
header { display: none; text-align: left; }
header[field=DATE]:before {font-weight: bold; }
header[field=DATE { display: block; text-align:left; }
header[field=DATE] { display: block; text-align:left; }
header[field=TO]:before { font-weight: bold; }
header[field=TO] { display: block; text-align: left; }
header[field=FROM]:before { font-weight: bold; }
header[field=FROM] { display: block; text-align:left; }
header[field=SUBJECT]:before { font-weight: bold; }
header[field=SUBJECT] { display: block; text-align: left;
background-color: lightyellow; border: 1px solid #CCCCCC; }
header[field=SUBJECT] { display: block; text-align: left; font-weight: bold; }
header[field=CC]:before { font-weight: bold; }
header[field=CC] { display: block; text-align:left; }
header[field=BCC]:before { font-weight: bold; }
header[field=BCC] { display: block; text-align:left; }
header[field=NEWSGROUPS]:before { font-weight: bold; }
header[field=NEWSGROUPS] { display: block; text-align:left; }
header[field=ORGANIZATION]:before { font-weight: bold; }
header[field=ORGANIZATION] { display: block; text-align:left; }
/**************************************************
@ -52,100 +48,68 @@ header[field=ORGANIZATION] { display: block; text-align:left; }
* "X-" are turned off!
*/
header[field=RETURN-PATH]:before { font-weight: bold; }
header[field=RETURN-PATH] { display: none; text-align:left; }
header[field=STATUS]:before { font-weight: bold; }
header[field=STATUS] { display: none; text-align:left; }
header[field=RECEIVED]:before { font-weight: bold; }
header[field=RECEIVED] { display: none; text-align:left; }
header[field=MIME-VERSION]:before { font-weight: bold; }
header[field=MIME-VERSION] { display: none; text-align:left; }
header[field=PRECEDENCE]:before { font-weight: bold; }
header[field=PRECEDENCE] { display: none; text-align: left; }
header[field=CONTENT-BASE]:before { font-weight: bold; }
header[field=CONTENT-BASE] { display: none; text-align:left; }
header[field=CONTENT-LOCATION]:before { font-weight: bold; }
header[field=CONTENT-LOCATION] { display: none; text-align:left; }
header[field=CONTENT-ID]:before { font-weight: bold; }
header[field=CONTENT-ID] { display: none; text-align:left; }
header[field=CONTENT-DESCRIPTION]:before { font-weight: bold; }
header[field=CONTENT-DESCRIPTION] { display: none; text-align:left; }
header[field=CONTENT-DISPOSITION]:before { font-weight: bold; }
header[field=CONTENT-DISPOSITION] { display: none; text-align:left; }
header[field=CONTENT-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-LENGTH]:before { font-weight: bold; }
header[field=CONTENT-LENGTH] { display: none; text-align:left; }
header[field=CONTENT-NAME]:before { font-weight: bold; }
header[field=CONTENT-NAME] { display: none; text-align:left; }
header[field=CONTENT-TRANSFER-ENCODING]:before { font-weight: bold; }
header[field=CONTENT-TRANSFER-ENCODING] { display: none; text-align:left; }
header[field=CONTENT-TYPE]:before { font-weight: bold; }
header[field=CONTENT-TYPE] { display: none; text-align:left; }
header[field=DISTRIBUTION]:before { font-weight: bold; }
header[field=DISTRIBUTION] { display: none; text-align:left; }
header[field=FCC]:before { font-weight: bold; }
header[field=FCC] { display: none; text-align:left; }
header[field=FOLLOWUP-TO]:before { font-weight: bold; }
header[field=FOLLOWUP-TO] { display: none; text-align:left; }
header[field=LINES]:before { font-weight: bold; }
header[field=LINES] { display: none; text-align:left; }
header[field=MESSAGE-ID]:before { font-weight: bold; }
header[field=MESSAGE-ID] { display: none; text-align:left; }
header[field=REFERENCES]:before { font-weight: bold; }
header[field=REFERENCES] { display: none; text-align:left; }
header[field=REPLY-TO]:before { font-weight: bold;}
header[field=REPLY-TO] { display: none; text-align:left; }
header[field=RESENT-COMMENTS]:before { font-weight: bold; }
header[field=RESENT-COMMENTS] { display: none; text-align:left; }
header[field=RESENT-DATE]:before { font-weight: bold; }
header[field=RESENT-DATE] { display: none; text-align:left; }
header[field=RESENT-FROM]:before { font-weight: bold; }
header[field=RESENT-FROM] { display: none; text-align:left; }
header[field=RESENT-MESSAGE-ID]:before { font-weight: bold; }
header[field=RESENT-MESSAGE-ID] { display: none; text-align:left; }
header[field=RESENT-SENDER]:before { font-weight: bold; }
header[field=RESENT-SENDER] { display: none; text-align:left; }
header[field=RESENT-TO]:before { font-weight: bold; }
header[field=RESENT-TO] { display: none; text-align:left; }
header[field=RESENT-CC]:before { font-weight: bold; }
header[field=RESENT-CC] { display: none; text-align:left; }
header[field=SENDER]:before { font-weight: bold; }
header[field=SENDER] { display: none; text-align:left; }
header[field=XREF]:before { font-weight: bold; }
header[field=XREF] { display: none; text-align:left; }
header[field=APPROVED-BY]:before { font-weight: bold; }
header[field=APPROVED-BY] { display: none; text-align:left; }
/**************************************************
@ -154,51 +118,35 @@ header[field=APPROVED-BY] { display: none; text-align:left; }
* all header display
**************************************************/
header[field=X-SUN-CHARSET]:before { font-weight: bold; }
header[field=X-SUN-CHARSET] { display: none; text-align:left; }
header[field=X-SUN-CONTENT-LENGTH]:before { font-weight: bold; }
header[field=X-SUN-CONTENT-LENGTH] { display: none; text-align:left; }
header[field=X-SUN-DATA-DESCRIPTION]:before { font-weight: bold; }
header[field=X-SUN-DATA-DESCRIPTION] { display: none; text-align:left; }
header[field=X-SUN-DATA-NAME]:before { font-weight: bold; }
header[field=X-SUN-DATA-NAME] { display: none; text-align:left; }
header[field=X-SUN-DATA-TYPE]:before { font-weight: bold; }
header[field=X-SUN-DATA-TYPE] { display: none; text-align:left; }
header[field=X-SUN-ENCODING-INFO]:before { font-weight: bold; }
header[field=X-SUN-ENCODING-INFO] { display: none; text-align:left; }
header[field=X-PRIORITY]:before { font-weight: bold; }
header[field=X-PRIORITY] { display: none; text-align:left; }
header[field=X-MOZILLA-PARTURL]:before { font-weight: bold; }
header[field=X-MOZILLA-PARTURL] { display: none; text-align:left; }
header[field=X-MOZILLA-DRAFT-INFO]:before { font-weight: bold; }
header[field=X-MOZILLA-DRAFT-INFO] { display: none; text-align:left; }
header[field=X-ACCEPT-LANGUAGE]:before { font-weight: bold; }
header[field=X-ACCEPT-LANGUAGE] { display: none; text-align:left; }
header[field=X-MAILING-LIST]:before { font-weight: bold; }
header[field=X-MAILING-LIST] { display: none; text-align:left; }
header[field=X-MAILING-LOOP]:before { font-weight: bold; }
header[field=X-MAILING-LOOP] { display: none; text-align:left; }
header[field=X-LOOP]:before { font-weight: bold; }
header[field=X-LOOP] { display: none; text-align: left; }
header[field=X-MAILER]:before { font-weight: bold; }
header[field=X-MAILER] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS] { display: none; text-align:left; }
header[field=X-MOZILLA-STATUS2]:before { font-weight: bold; }
header[field=X-MOZILLA-STATUS2] { display: none; text-align: left; }

Просмотреть файл

@ -24,8 +24,12 @@ install::
$(MAKE_INSTALL) mailheader-micro.css $(DIST)\bin\chrome\messenger\skin\default
$(MAKE_INSTALL) mailheader-normal.css $(DIST)\bin\chrome\messenger\skin\default
$(MAKE_INSTALL) mailheader-all.css $(DIST)\bin\chrome\messenger\skin\default
$(MAKE_INSTALL) addcard.gif $(DIST)\bin\chrome\messenger\skin\default
$(MAKE_INSTALL) attach.gif $(DIST)\bin\chrome\messenger\skin\default
clobber::
rm -f $(DIST)\bin\chrome\messenger\skin\default\mailheader-micro.css
rm -f $(DIST)\bin\chrome\messenger\skin\default\mailheader-normal.css
rm -f $(DIST)\bin\chrome\messenger\skin\default\mailheader-all.css
rm -f $(DIST)\bin\chrome\messenger\skin\default\addcard.gif
rm -f $(DIST)\bin\chrome\messenger\skin\default\attach.gif

Просмотреть файл

@ -31,6 +31,7 @@ EXPORTS = \
nsMimeHtmlEmitter.h \
nsMimeXmlEmitter.h \
nsMimeRawEmitter.h \
nsMimeXULEmitter.h \
$(NULL)
CPPSRCS = \
@ -39,6 +40,7 @@ CPPSRCS = \
nsMimeRawEmitter.cpp \
nsMimeXmlEmitter.cpp \
nsMimeHtmlEmitter.cpp \
nsMimeXULEmitter.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \

Просмотреть файл

@ -28,6 +28,7 @@ EXPORTS= nsEmitterUtils.h \
nsMimeHtmlEmitter.h \
nsMimeRawEmitter.h \
nsMimeXmlEmitter.h \
nsMimeXULEmitter.h \
$(NULL)
################################################################################
@ -41,6 +42,7 @@ CPP_OBJS= .\$(OBJDIR)\nsEmitterUtils.obj \
.\$(OBJDIR)\nsMimeHtmlEmitter.obj \
.\$(OBJDIR)\nsMimeRawEmitter.obj \
.\$(OBJDIR)\nsMimeXmlEmitter.obj \
.\$(OBJDIR)\nsMimeXULEmitter.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -179,3 +179,126 @@ MimeGetStringByName(const char *aHeaderName)
return nsnull;
}
//
// Hopefully, someone will write and XP call like this eventually!
//
#define TPATH_LEN 1024
#ifdef WIN32
#include "windows.h"
#endif
static char *
GetTheTempDirectoryOnTheSystem(void)
{
char *retPath = (char *)PR_Malloc(TPATH_LEN);
if (!retPath)
return nsnull;
retPath[0] = '\0';
#ifdef WIN32
if (getenv("TEMP"))
PL_strncpy(retPath, getenv("TEMP"), TPATH_LEN); // environment variable
else if (getenv("TMP"))
PL_strncpy(retPath, getenv("TMP"), TPATH_LEN); // How about this environment variable?
else
GetWindowsDirectory(retPath, TPATH_LEN);
#endif
// RICHIE - should do something better here!
#if defined(XP_UNIX) || defined(XP_BEOS)
char *tPath = getenv("TMPDIR");
if (!tPath)
PL_strncpy(retPath, "/tmp/", TPATH_LEN);
else
PL_strncpy(retPath, tPath, TPATH_LEN);
#endif
#ifdef XP_MAC
PL_strncpy(retPath, "", TPATH_LEN);
#endif
return retPath;
}
//
// Create a file spec for the a unique temp file
// on the local machine. Caller must free memory
//
nsFileSpec *
nsMsgCreateTempFileSpec(char *tFileName)
{
if ((!tFileName) || (!*tFileName))
tFileName = "nsmail.tmp";
// Age old question, where to store temp files....ugh!
char *tDir = GetTheTempDirectoryOnTheSystem();
if (!tDir)
return (new nsFileSpec("mozmail.tmp")); // No need to I18N
nsFileSpec *tmpSpec = new nsFileSpec(tDir);
if (!tmpSpec)
{
PR_FREEIF(tDir);
return (new nsFileSpec("mozmail.tmp")); // No need to I18N
}
*tmpSpec += tFileName;
tmpSpec->MakeUnique();
PR_FREEIF(tDir);
return tmpSpec;
}
//
// Create a file spec for the a unique temp file
// on the local machine. Caller must free memory
// returned
//
char *
nsMsgCreateTempFileName(char *tFileName)
{
if ((!tFileName) || (!*tFileName))
tFileName = "nsmail.tmp";
// Age old question, where to store temp files....ugh!
char *tDir = GetTheTempDirectoryOnTheSystem();
if (!tDir)
return "mozmail.tmp"; // No need to I18N
nsFileSpec tmpSpec(tDir);
tmpSpec += tFileName;
tmpSpec.MakeUnique();
PR_FREEIF(tDir);
char *tString = (char *)PL_strdup(tmpSpec.GetNativePathCString());
if (!tString)
return PL_strdup("mozmail.tmp"); // No need to I18N
else
return tString;
}
char *
nsMimePlatformFileToURL (const char *name)
{
char *prefix = "file:///";
char *retVal = (char *)PR_Malloc(PL_strlen(name) + PL_strlen(prefix) + 1);
if (retVal)
{
PL_strcpy(retVal, prefix);
PL_strcat(retVal, name);
}
char *ptr = retVal;
while (*ptr)
{
if (*ptr == '\\') *ptr = '/';
if ( (*ptr == ':') && (ptr > (retVal+4)) )
*ptr = '|';
++ptr;
}
return retVal;
}

Просмотреть файл

@ -24,5 +24,14 @@
extern "C" PRBool EmitThisHeaderForPrefSetting(PRInt32 dispType, const char *header);
extern "C" char *LocalizeHeaderName(const char *aHeaderName, const char *aDefaultName);
//
// Create a file spec or file name using the name passed
// in as a template
//
nsFileSpec *nsMsgCreateTempFileSpec(char *tFileName);
char *nsMsgCreateTempFileName(char *tFileName);
char *nsMimePlatformFileToURL (const char *name);
#endif // _nsEmitterUtils_h_

Просмотреть файл

@ -478,6 +478,9 @@ nsMimeXULEmitter::WriteXULHeader(const char *msgID)
UtilityWriteCRLF("xmlns=\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\" ");
UtilityWriteCRLF("align=\"vertical\"> ");
// Now, the JavaScript...
UtilityWriteCRLF("<html:script language=\"javascript\" src=\"chrome://messenger/content/attach.js\"/>");
return NS_OK;
}
@ -656,28 +659,20 @@ nsMimeXULEmitter::Complete()
nsresult
nsMimeXULEmitter::DumpAttachmentMenu()
{
/*
<popup id="toolbarContextMenu">
<menu>
<menuitem name="Delete" onclick="mailNewsCore.deleteButton(document.popupElement)">
</menu>
</popup>
*/
if ( (!mAttachArray) || (mAttachArray->Count() <= 0) )
return NS_OK;
char *buttonXUL = PR_smprintf(
"<titledbutton src=\"chrome://messenger/skin/attach.gif\" value=\"%d Attachments\" align=\"right\"/>",
"<titledbutton src=\"chrome://messenger/skin/attach.gif\" value=\"%d Attachments\" align=\"right\" class=\"popup\" popup=\"attachmentPopup\"/>",
mAttachArray->Count());
if ( (!buttonXUL) || (!*buttonXUL) )
return NS_OK;
UtilityWriteCRLF("<box align=\"horizontal\">");
UtilityWriteCRLF(buttonXUL);
PR_FREEIF(buttonXUL);
UtilityWriteCRLF("<popup id=\"attachmentPopup\">");
UtilityWriteCRLF("<menu>");
// Now we can finally write out the attachment information...
if (mAttachArray->Count() > 0)
@ -690,12 +685,20 @@ nsMimeXULEmitter::DumpAttachmentMenu()
if (!attachInfo)
continue;
UtilityWrite("<menuitem value=\"");
UtilityWrite(attachInfo->displayName);
UtilityWriteCRLF(" ");
UtilityWrite("\" onaction=\"OpenAttachURL('");
UtilityWrite(attachInfo->urlSpec);
UtilityWriteCRLF("' );\" />");
}
}
UtilityWriteCRLF("</menu>");
UtilityWriteCRLF("</popup>");
UtilityWriteCRLF(buttonXUL);
UtilityWriteCRLF("</box>");
PR_FREEIF(buttonXUL);
return NS_OK;
}
@ -734,7 +737,8 @@ nsMimeXULEmitter::OutputGenericHeader(const char *aHeaderVal)
if (val)
{
UtilityWriteCRLF("<box align=\"horizontal\" style=\"padding: 2px;\">");
//UtilityWriteCRLF("<box align=\"vertical\" style=\"padding: 2px;\">");
UtilityWriteCRLF("<box style=\"padding: 2px;\">");
rv = WriteXULTag(aHeaderVal, val);
UtilityWriteCRLF("</box>");
return rv;
@ -760,7 +764,6 @@ nsMimeXULEmitter::DumpSubjectFromDate()
UtilityWriteCRLF("<spring flex=\"2\"/>");
UtilityWriteCRLF("</box>");
UtilityWriteCRLF("<box name=\"header-attachment\" align=\"horizontal\" flex=\"100%\">");
UtilityWriteCRLF("<spring flex=\"1\"/>");
@ -781,19 +784,25 @@ nsresult
nsMimeXULEmitter::DumpToCC()
{
UtilityWriteCRLF("<toolbar>");
UtilityWriteCRLF("<box name=\"header-splitter2\" align=\"horizontal\" flex=\"100%\" >");
UtilityWriteCRLF("<box name=\"header-part2\" align=\"vertical\" flex=\"100%\" style=\"width: 100%; \" >");
UtilityWriteCRLF("<spring flex=\"1\"/>");
UtilityWriteCRLF("<box name=\"header-part2\" align=\"vertical\" flex=\"100%\" style=\"background-color: #FF0000; \" >");
UtilityWriteCRLF("<spring flex=\"1\"/>");
OutputGenericHeader(HEADER_TO);
UtilityWriteCRLF("</box>");
OutputGenericHeader(HEADER_TO);
UtilityWriteCRLF("<box name=\"header-part3\" align=\"vertical\">");
UtilityWriteCRLF("<spring flex=\"1\"/>");
OutputGenericHeader(HEADER_CC);
UtilityWriteCRLF("<spring flex=\"1\"/>");
UtilityWriteCRLF("</box>");
UtilityWriteCRLF("<box name=\"header-part3\" align=\"vertical\" style=\"background-color: #00FF00; \">");
UtilityWriteCRLF("<spring flex=\"1\"/>");
OutputGenericHeader(HEADER_CC);
UtilityWriteCRLF("<spring flex=\"1\"/>");
UtilityWriteCRLF("</box>");
UtilityWriteCRLF("</box>");
UtilityWriteCRLF("</toolbar>");
return NS_OK;
}

Просмотреть файл

@ -32,14 +32,15 @@ typedef long nsMimeOutputType;
[scriptable, uuid(E4ED8894-3F9E-11d3-9896-001083010E9B)]
interface nsMimeOutput
{
const long nsMimeMessageSplitDisplay = 0;
const long nsMimeMessageHeaderDisplay = 1;
const long nsMimeMessageBodyDisplay = 2;
const long nsMimeMessageSplitDisplay = 0;
const long nsMimeMessageHeaderDisplay = 1;
const long nsMimeMessageBodyDisplay = 2;
const long nsMimeMessageQuoting = 3;
const long nsMimeMessageRaw = 4;
const long nsMimeMessageDraftOrTemplate = 5;
const long nsMimeMessageEditorTemplate = 6;
const long nsMimeUnknown = 7;
const long nsMimeMessageXULDisplay = 7;
const long nsMimeUnknown = 8;
};
[scriptable, uuid(E4ED8892-3F9E-11d3-9896-001083010E9B)]

Просмотреть файл

@ -74,6 +74,7 @@ CPPSRCS = \
EXPORTS = \
nsMimeTypes.h \
nsMimeObjectClassAccess.h \
nsMimeStringResources.h \
nsMimeConverter.h \
mimetext.h \
mimeleaf.h \

Просмотреть файл

@ -24,6 +24,7 @@ include <$(DEPTH)\config\config.mak>
EXPORTS = \
nsMimeTypes.h \
nsMimeStringResources.h \
nsMimeObjectClassAccess.h \
nsMimeConverter.h \
mimetext.h \

Просмотреть файл

@ -75,7 +75,7 @@ static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
// Utility to create a nsIURI object...
nsresult
extern "C" nsresult
nsMimeNewURI(nsIURI** aInstancePtrResult, const char *aSpec)
{
nsresult res;
@ -204,7 +204,7 @@ typedef enum {
// DON'T remove.
} nsMsgBoolHeaderSet;
static void
extern "C" void
mime_dump_attachments ( nsMsgAttachmentData *attachData )
{
PRInt32 i = 0;

Просмотреть файл

@ -77,136 +77,135 @@ static int
MimeExternalObject_parse_begin (MimeObject *obj)
{
int status;
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
if (status < 0) return status;
#ifdef XP_MAC
if (obj->parent && mime_typep(obj->parent,
(MimeObjectClass *) &mimeMultipartAppleDoubleClass))
goto done;
(MimeObjectClass *) &mimeMultipartAppleDoubleClass))
goto done;
#endif /* XP_MAC */
/* If we're writing this object, and we're doing it in raw form, then
now is the time to inform the backend what the type of this data is.
*/
/* If we're writing this object, and we're doing it in raw form, then
now is the time to inform the backend what the type of this data is.
*/
if (obj->output_p &&
obj->options &&
!obj->options->write_html_p &&
!obj->options->state->first_data_written_p)
{
status = MimeObject_output_init(obj, 0);
if (status < 0) return status;
PR_ASSERT(obj->options->state->first_data_written_p);
}
obj->options &&
!obj->options->write_html_p &&
!obj->options->state->first_data_written_p)
{
status = MimeObject_output_init(obj, 0);
if (status < 0) return status;
PR_ASSERT(obj->options->state->first_data_written_p);
}
/* If we're writing this object as HTML, do all the work now -- just write
out a table with a link in it. (Later calls to the `parse_buffer' method
will simply discard the data of the object itself.)
*/
out a table with a link in it. (Later calls to the `parse_buffer' method
will simply discard the data of the object itself.)
*/
if (obj->options &&
obj->output_p &&
obj->options->write_html_p &&
obj->options->output_fn)
{
MimeDisplayOptions newopt = *obj->options; /* copy it */
char *id = 0;
char *id_url = 0;
char *id_name = 0;
char *id_imap = 0;
PRBool all_headers_p = obj->options->headers == MimeHeadersAll;
id = mime_part_address (obj);
if (obj->options->missing_parts)
id_imap = mime_imap_part_address (obj);
if (! id) return MIME_OUT_OF_MEMORY;
if (obj->options && obj->options->url)
{
const char *url = obj->options->url;
if (id_imap && id)
{
/* if this is an IMAP part. */
id_url = mime_set_url_imap_part(url, id_imap, id);
}
else
{
/* This is just a normal MIME part as usual. */
id_url = mime_set_url_part(url, id, PR_TRUE);
}
if (!id_url)
{
PR_Free(id);
return MIME_OUT_OF_MEMORY;
}
}
if (!PL_strcmp (id, "0"))
{
PR_Free(id);
id = MimeGetStringByID(MIME_MSG_ATTACHMENT);
}
else
{
const char *p = "Part "; /* #### i18n */
char *s = (char *)PR_MALLOC(PL_strlen(p) + PL_strlen(id) + 1);
if (!s)
{
PR_Free(id);
PR_Free(id_url);
return MIME_OUT_OF_MEMORY;
}
/* we have a valid id */
if (id)
id_name = mime_find_suggested_name_of_part(id, obj);
PL_strcpy(s, p);
PL_strcat(s, id);
PR_Free(id);
id = s;
}
if (all_headers_p &&
/* Don't bother showing all headers on this part if it's the only
part in the message: in that case, we've already shown these
headers. */
obj->options->state &&
obj->options->state->root == obj->parent)
all_headers_p = PR_FALSE;
newopt.fancy_headers_p = PR_TRUE;
newopt.headers = (all_headers_p ? MimeHeadersAll : MimeHeadersSome);
{
char p[] = "<P>";
status = MimeObject_write(obj, p, 3, PR_FALSE);
if (status < 0) goto FAIL;
}
status = MimeHeaders_write_attachment_box (obj->headers, &newopt,
obj->content_type,
obj->encoding,
id_name? id_name : id, id_url, 0);
PR_FREEIF(id_name);
if (status < 0) goto FAIL;
{
char p[] = "<P>";
status = MimeObject_write(obj, p, 3, PR_FALSE);
if (status < 0) goto FAIL;
}
FAIL:
PR_FREEIF(id);
PR_FREEIF(id_url);
PR_FREEIF(id_name);
if (status < 0) return status;
}
obj->output_p &&
obj->options->write_html_p &&
obj->options->output_fn)
{
MimeDisplayOptions newopt = *obj->options; /* copy it */
char *id = 0;
char *id_url = 0;
char *id_name = 0;
char *id_imap = 0;
PRBool all_headers_p = obj->options->headers == MimeHeadersAll;
id = mime_part_address (obj);
if (obj->options->missing_parts)
id_imap = mime_imap_part_address (obj);
if (! id) return MIME_OUT_OF_MEMORY;
if (obj->options && obj->options->url)
{
const char *url = obj->options->url;
if (id_imap && id)
{
/* if this is an IMAP part. */
id_url = mime_set_url_imap_part(url, id_imap, id);
}
else
{
/* This is just a normal MIME part as usual. */
id_url = mime_set_url_part(url, id, PR_TRUE);
}
if (!id_url)
{
PR_Free(id);
return MIME_OUT_OF_MEMORY;
}
}
if (!PL_strcmp (id, "0"))
{
PR_Free(id);
id = MimeGetStringByID(MIME_MSG_ATTACHMENT);
}
else
{
const char *p = "Part "; /* #### i18n */
char *s = (char *)PR_MALLOC(PL_strlen(p) + PL_strlen(id) + 1);
if (!s)
{
PR_Free(id);
PR_Free(id_url);
return MIME_OUT_OF_MEMORY;
}
/* we have a valid id */
if (id)
id_name = mime_find_suggested_name_of_part(id, obj);
PL_strcpy(s, p);
PL_strcat(s, id);
PR_Free(id);
id = s;
}
if (all_headers_p &&
/* Don't bother showing all headers on this part if it's the only
part in the message: in that case, we've already shown these
headers. */
obj->options->state &&
obj->options->state->root == obj->parent)
all_headers_p = PR_FALSE;
newopt.fancy_headers_p = PR_TRUE;
newopt.headers = (all_headers_p ? MimeHeadersAll : MimeHeadersSome);
{
char p[] = "<P>";
status = MimeObject_write(obj, p, 3, PR_FALSE);
if (status < 0) goto FAIL;
}
status = MimeHeaders_write_attachment_box (obj->headers, &newopt,
obj->content_type,
obj->encoding,
id_name? id_name : id, id_url, 0);
PR_FREEIF(id_name);
if (status < 0) goto FAIL;
{
char p[] = "<P>";
status = MimeObject_write(obj, p, 3, PR_FALSE);
if (status < 0) goto FAIL;
}
FAIL:
PR_FREEIF(id);
PR_FREEIF(id_url);
PR_FREEIF(id_name);
if (status < 0) return status;
}
#ifdef XP_MAC
done:
#endif /* XP_MAC */
return 0;
}

Просмотреть файл

@ -2492,12 +2492,13 @@ MimeHeaders_write_attachment_box(MimeHeaders *hdrs,
{
int status = 0;
mimeEmitterStartAttachment(opt, lname, content_type, lname_url);
status = MimeHeaders_write_all_headers (hdrs, opt, TRUE);
mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_URL, lname_url);
mimeEmitterEndAttachment(opt);
// RICHIE SHERRY
// Writing a header "box" is not needed anymore since we are doing
// attachments a whole new way... I need to clean this up and this
// routine will probably go away for good...but until then, just return
// success
//
// status = MimeHeaders_write_all_headers (hdrs, opt, TRUE);
if (status < 0)
return status;

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsIEventQueueService.h"
#include "nsMimeStringResources.h"
#include "nsStreamConverter.h"
#include "nsIMsgSend.h"
#include "nsIIOService.h"
#include "nsIURI.h"
@ -85,6 +86,204 @@ static PRBool MIME_NoInlineAttachments;
static PRBool MIME_WrapLongLines;
static PRBool MIME_VariableWidthPlaintext;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Attachment handling routines
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
MimeObject *mime_get_main_object(MimeObject* obj);
extern "C" nsresult
MimeGetAttachmentList(MimeObject *tobj, const char *aMessageURL, nsMsgAttachmentData **data)
{
extern nsresult nsMimeNewURI(nsIURI** aInstancePtrResult, const char *aSpec);
MimeContainer *cobj;
nsMsgAttachmentData *tmp;
PRInt32 n;
PRInt32 i;
char *disp;
PRBool isMsgBody = PR_FALSE, isAlternativeOrRelated = PR_FALSE;
MimeObject *obj;
if (!data)
return 0;
*data = NULL;
obj = mime_get_main_object(tobj);
if ( (obj) && (!mime_subclass_p(obj->clazz, (MimeObjectClass*) &mimeContainerClass)) )
return 0;
isMsgBody = MimeObjectChildIsMessageBody(obj, &isAlternativeOrRelated);
if (isAlternativeOrRelated)
return 0;
cobj = (MimeContainer*) obj;
n = cobj->nchildren; /* This is often too big, but that's OK. */
if (n <= 0)
return n;
*data = (nsMsgAttachmentData *)PR_Malloc( (n + 1) * sizeof(MSG_AttachmentData));
if (!*data)
return MIME_OUT_OF_MEMORY;
nsCRT::memset(*data, 0, (n + 1) * sizeof(MSG_AttachmentData));
tmp = *data;
// let's figure out where to start..
if (isMsgBody)
i = 1;
else
i = 0;
for (; i<cobj->nchildren ; i++, tmp++)
{
MimeObject *child = cobj->children[i];
char *part = mime_part_address(child);
char *imappart = NULL;
if (!part)
return MIME_OUT_OF_MEMORY;
if (obj->options->missing_parts)
imappart = mime_imap_part_address(child);
char *urlSpec = nsnull;
if (imappart)
{
urlSpec = mime_set_url_imap_part(aMessageURL, imappart, part);
}
else
{
urlSpec = mime_set_url_part(aMessageURL, part, PR_TRUE);
}
if (!urlSpec)
return MIME_OUT_OF_MEMORY;
nsresult rv = nsMimeNewURI(&(tmp->url), urlSpec);
if ( (NS_FAILED(rv)) || (!tmp->url) )
return MIME_OUT_OF_MEMORY;
tmp->real_type = child->content_type ? PL_strdup(child->content_type) : NULL;
tmp->real_encoding = child->encoding ? PL_strdup(child->encoding) : NULL;
disp = MimeHeaders_get(child->headers, HEADER_CONTENT_DISPOSITION, PR_FALSE, PR_FALSE);
if (disp)
{
tmp->real_name = MimeHeaders_get_parameter(disp, "filename", NULL, NULL);
if (tmp->real_name)
{
char *fname = NULL;
fname = mime_decode_filename(tmp->real_name);
if (fname && fname != tmp->real_name)
{
PR_FREEIF(tmp->real_name);
tmp->real_name = fname;
}
}
PR_FREEIF(disp);
}
disp = MimeHeaders_get(child->headers, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE);
if (disp)
{
tmp->x_mac_type = MimeHeaders_get_parameter(disp, PARAM_X_MAC_TYPE, NULL, NULL);
tmp->x_mac_creator= MimeHeaders_get_parameter(disp, PARAM_X_MAC_CREATOR, NULL, NULL);
if (!tmp->real_name || *tmp->real_name == 0)
{
PR_FREEIF(tmp->real_name);
tmp->real_name = MimeHeaders_get_parameter(disp, "name", NULL, NULL);
if (tmp->real_name)
{
char *fname = NULL;
fname = mime_decode_filename(tmp->real_name);
if (fname && fname != tmp->real_name)
{
PR_Free(tmp->real_name);
tmp->real_name = fname;
}
}
}
PR_FREEIF(disp);
}
tmp->description = MimeHeaders_get(child->headers, HEADER_CONTENT_DESCRIPTION, PR_FALSE, PR_FALSE);
if (tmp->real_type && !PL_strcasecmp(tmp->real_type, MESSAGE_RFC822) &&
(!tmp->real_name || *tmp->real_name == 0))
{
mime_SACopy(&(tmp->real_name), "forward.msg");
}
}
return NS_OK;
}
extern "C" void
MimeFreeAttachmentList(nsMsgAttachmentData *data)
{
if (data)
{
nsMsgAttachmentData *tmp;
for (tmp = data ; tmp->url ; tmp++)
{
/* Can't do PR_FREEIF on `const' values... */
if (tmp->url) delete (tmp->url);
if (tmp->real_type) PR_Free((char *) tmp->real_type);
if (tmp->real_encoding) PR_Free((char *) tmp->real_encoding);
if (tmp->real_name) PR_Free((char *) tmp->real_name);
if (tmp->x_mac_type) PR_Free((char *) tmp->x_mac_type);
if (tmp->x_mac_creator) PR_Free((char *) tmp->x_mac_creator);
if (tmp->description) PR_Free((char *) tmp->description);
tmp->url = 0;
tmp->real_type = 0;
tmp->real_name = 0;
tmp->description = 0;
}
PR_Free(data);
}
}
extern "C" void
NotifyEmittersOfAttachmentList(MimeDisplayOptions *opt,
nsMsgAttachmentData *data)
{
PRInt32 i = 0;
struct nsMsgAttachmentData *tmp = data;
if ( (!tmp) || (!tmp->real_name) )
return;
while ( (tmp) && (tmp->real_name) )
{
char *spec;
spec = nsnull;
if ( tmp->url )
tmp->url->GetSpec(&spec);
mimeEmitterStartAttachment(opt, tmp->real_name, tmp->real_type, spec);
mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_URL, spec);
/* RICHIE SHERRY - for now, just leave these here, but they are really
not necessary
printf("URL for Part : %s\n", spec);
printf("Real Name : %s\n", tmp->real_name);
printf("Desired Type : %s\n", tmp->desired_type);
printf("Real Type : %s\n", tmp->real_type);
printf("Real Encoding : %s\n", tmp->real_encoding);
printf("Description : %s\n", tmp->description);
printf("Mac Type : %s\n", tmp->x_mac_type);
printf("Mac Creator : %s\n", tmp->x_mac_creator);
*/
mimeEmitterEndAttachment(opt);
++i;
++tmp;
}
}
extern "C" char *
GetOSTempFile(const char *name)
{
@ -300,7 +499,6 @@ mime_display_stream_write (nsMIMESession *stream,
}
extern "C" void
//mime_display_stream_complete (nsMIMESession *stream, PRBool aProcessLeftoverData)
mime_display_stream_complete (nsMIMESession *stream)
{
struct mime_stream_data *msd = (struct mime_stream_data *) ((nsMIMESession *)stream)->data_object;
@ -315,7 +513,24 @@ mime_display_stream_complete (nsMIMESession *stream)
status = obj->clazz->parse_eof(obj, abortNow);
obj->clazz->parse_end(obj, (status < 0 ? PR_TRUE : PR_FALSE));
//
// Ok, now we are going to process the attachment data by getting all
// of the attachment info and then driving the emitter with this data.
//
if (!msd->options->part_to_load)
{
extern void mime_dump_attachments ( nsMsgAttachmentData *attachData );
nsMsgAttachmentData *attachments;
nsresult rv = MimeGetAttachmentList(obj, msd->url_name, &attachments);
if (NS_SUCCEEDED(rv))
{
NotifyEmittersOfAttachmentList(msd->options, attachments);
MimeFreeAttachmentList(attachments);
}
}
#ifdef HAVE_MIME_DATA_SLOT
if (msd &&
msd->context &&
@ -756,7 +971,7 @@ mime_find_text_html_part_1(MimeObject* obj)
/* Finds the main object of the message -- generally a multipart/mixed,
text/plain, or text/html. */
static MimeObject*
MimeObject*
mime_get_main_object(MimeObject* obj)
{
MimeContainer* cobj;
@ -819,139 +1034,6 @@ MimeGetAttachmentCount(MWContext* context)
HG56025
#endif
/* Guessing the filename to use in "Save As", given a URL which may point
to a MIME part that we've recently displayed. (Kloooooge!)
*/
#ifdef HAVE_MIME_DATA_SLOT
//
// Leaving this here for now for possible code reuse!
//
int
MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data)
{
MimeObject* obj;
MimeContainer* cobj;
MSG_AttachmentData* tmp;
PRInt32 n;
PRInt32 i;
char* disp;
char c;
PRBool isMsgBody = PR_FALSE, isAlternativeOrRelated = PR_FALSE;
if (!data) return 0;
*data = NULL;
PR_ASSERT(context);
if (!context ||
!context->mime_data ||
!context->mime_data->last_parsed_object) {
return 0;
}
obj = mime_get_main_object(context->mime_data->last_parsed_object);
if (!mime_subclass_p(obj->clazz, (MimeObjectClass*) &mimeContainerClass)) {
return 0;
}
isMsgBody = MimeObjectChildIsMessageBody(obj,
&isAlternativeOrRelated);
if (isAlternativeOrRelated)
return 0;
cobj = (MimeContainer*) obj;
n = cobj->nchildren; /* This is often too big, but that's OK. */
if (n <= 0) return n;
*data = (MSG_AttachmentData *) PR_Calloc(n + 1, sizeof(MSG_AttachmentData));
if (!*data) return MIME_OUT_OF_MEMORY;
tmp = *data;
c = '?';
if (PL_strchr(context->mime_data->last_parsed_url, '?')) {
c = '&';
}
/* let's figure out where to start */
if (isMsgBody)
i = 1;
else
i = 0;
for ( ; i<cobj->nchildren ; i++, tmp++) {
MimeObject* child = cobj->children[i];
char* part = mime_part_address(child);
char* imappart = NULL;
if (!part) return MIME_OUT_OF_MEMORY;
if (obj->options->missing_parts)
imappart = mime_imap_part_address (child);
if (imappart)
{
tmp->url = mime_set_url_imap_part(context->mime_data->last_parsed_url, imappart, part);
}
else
{
tmp->url = mime_set_url_part(context->mime_data->last_parsed_url, part, PR_TRUE);
}
/*
tmp->url = PR_smprintf("%s%cpart=%s", context->mime_data->last_parsed_url,
c, part);
*/
if (!tmp->url) return MIME_OUT_OF_MEMORY;
tmp->real_type = child->content_type ?
PL_strdup(child->content_type) : NULL;
tmp->real_encoding = child->encoding ? PL_strdup(child->encoding) : NULL;
disp = MimeHeaders_get(child->headers, HEADER_CONTENT_DISPOSITION,
PR_FALSE, PR_FALSE);
if (disp) {
tmp->real_name = MimeHeaders_get_parameter(disp, "filename", NULL, NULL);
if (tmp->real_name)
{
char *fname = NULL;
fname = mime_decode_filename(tmp->real_name);
if (fname && fname != tmp->real_name)
{
PR_Free(tmp->real_name);
tmp->real_name = fname;
}
}
PR_Free(disp);
}
disp = MimeHeaders_get(child->headers, HEADER_CONTENT_TYPE,
PR_FALSE, PR_FALSE);
if (disp)
{
tmp->x_mac_type = MimeHeaders_get_parameter(disp, PARAM_X_MAC_TYPE, NULL, NULL);
tmp->x_mac_creator= MimeHeaders_get_parameter(disp, PARAM_X_MAC_CREATOR, NULL, NULL);
if (!tmp->real_name || *tmp->real_name == 0)
{
PR_FREEIF(tmp->real_name);
tmp->real_name = MimeHeaders_get_parameter(disp, "name", NULL, NULL);
if (tmp->real_name)
{
char *fname = NULL;
fname = mime_decode_filename(tmp->real_name);
if (fname && fname != tmp->real_name)
{
PR_Free(tmp->real_name);
tmp->real_name = fname;
}
}
}
PR_Free(disp);
}
tmp->description = MimeHeaders_get(child->headers,
HEADER_CONTENT_DESCRIPTION,
PR_FALSE, PR_FALSE);
if (tmp->real_type && !PL_strcasecmp(tmp->real_type, MESSAGE_RFC822) &&
(!tmp->real_name || *tmp->real_name == 0))
{
char *tString = MimeGetStringByID(MIME_FORWARDED_MESSAGE_ATTACHMENT);
mime_SACopy(&(tmp->real_name), tString);
PR_FREEIF(tString);
}
}
return 0;
}
#endif /* !HAVE_MIME_DATA_SLOT */
PRBool MimeObjectChildIsMessageBody(MimeObject *obj,
PRBool *isAlternativeOrRelated)
{
@ -1162,7 +1244,8 @@ mime_bridge_create_display_stream(
case nsMimeOutput::nsMimeMessageSplitDisplay: // the wrapper HTML output to produce the split header/body display
case nsMimeOutput::nsMimeMessageHeaderDisplay: // the split header/body display
case nsMimeOutput::nsMimeMessageBodyDisplay: // the split header/body display
msd->options->fancy_headers_p = PR_TRUE;
case nsMimeOutput::nsMimeMessageXULDisplay:
msd->options->fancy_headers_p = PR_TRUE;
msd->options->output_vcard_buttons_p = PR_TRUE;
msd->options->fancy_links_p = PR_TRUE;
break;
@ -1688,3 +1771,8 @@ mimeSetNewURL(nsMIMESession *stream, char *url)
msd->url_name = PL_strdup(tmpPtr);
return NS_OK;
}

Просмотреть файл

@ -48,8 +48,6 @@ extern "C" {
#include "nsIPref.h"
#define MIME_PREFS_FILE "prefs50.js"
typedef struct _nsMIMESession nsMIMESession;
/* stream functions */
@ -151,6 +149,7 @@ extern "C" char *GetOSTempFile(const char *name);
/* This is the next generation string retrieval call */
extern "C" char *MimeGetStringByID(PRInt32 stringID);
#ifdef __cplusplus
}
#endif /* __cplusplus */

Просмотреть файл

@ -120,7 +120,7 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
PR_ASSERT(length > 0);
if (length <= 0) return 0;
status = MimeObject_grow_obuffer (obj, length * 2 + 40);
status = MimeObject_grow_obuffer (obj, (length * 2) + 40);
if (status < 0) return status;
/* Copy `line' to `out', quoting HTML along the way.

Просмотреть файл

@ -37,6 +37,9 @@
#include "nsIAllocator.h"
#include "nsIBuffer.h"
#include "nsMimeStringResources.h"
#include "nsIPref.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
////////////////////////////////////////////////////////////////
// Bridge routines for new stream converter XP-COM interface
@ -212,9 +215,29 @@ nsStreamConverter::DetermineOutputFormat(const char *url, nsMimeOutputType *aNe
}
else
{
mWrapperOutput = PR_TRUE;
PR_FREEIF(mOutputFormat);
mOutputFormat = PL_strdup("text/html");
// Ok, we are adding a pref to turn on the new XUL header output. If this
// pref is true, then we will use the new quoting, otherwise, we default to
// the old split display quoting.
//
nsresult rv;
PRBool mimeXULOutput = PR_FALSE;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs)
rv = prefs->GetBoolPref("mail.mime_xul_output", &mimeXULOutput);
if (mimeXULOutput)
{
PR_FREEIF(mOutputFormat);
mOutputFormat = PL_strdup("text/xul");
*aNewType = nsMimeOutput::nsMimeMessageXULDisplay;
}
else
{
mWrapperOutput = PR_TRUE;
PR_FREEIF(mOutputFormat);
mOutputFormat = PL_strdup("text/html");
}
}
}
else // this is a part that should just come out raw!
@ -346,6 +369,11 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
switch (newType)
{
case nsMimeOutput::nsMimeMessageXULDisplay:
PR_FREEIF(mOutputFormat);
mOutputFormat = PL_strdup("text/xul");
break;
case nsMimeOutput::nsMimeMessageSplitDisplay: // the wrapper HTML output to produce the split header/body display
mWrapperOutput = PR_TRUE;
PR_FREEIF(mOutputFormat);
@ -536,6 +564,7 @@ char *output = "\
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
mTotalRead += aLength;
readLen = aLength;
aIStream->Read(buf, aLength, &readLen);
if (mBridgeStream)
@ -581,14 +610,6 @@ nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsres
printf("nsStreamConverter::OnStopRequest()\n");
#endif
//
// Now complete the emitter and do necessary cleanup!
//
if (mEmitter)
{
mEmitter->Complete();
}
//
// Now complete the stream!
//
@ -598,6 +619,14 @@ nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsres
tSession->complete((nsMIMESession *)mBridgeStream);
}
//
// Now complete the emitter and do necessary cleanup!
//
if (mEmitter)
{
mEmitter->Complete();
}
// First close the output stream...
if (mOutputStream)
mOutputStream->Close();

Просмотреть файл

@ -164,6 +164,7 @@ public:
ConsoleOutputStreamListener(void)
{
NS_INIT_REFCNT();
mComplete = PR_FALSE;
mIndentCount = 0;
mInClosingTag = PR_FALSE;
mOutFormat = nsMimeOutput::nsMimeMessageRaw;
@ -191,6 +192,7 @@ public:
PR_Write(PR_GetSpecialFD(PR_StandardOutput), note, PL_strlen(note));
}
mComplete = PR_TRUE;
return NS_OK;
}
@ -203,8 +205,13 @@ public:
nsresult DoIndent();
NS_IMETHOD SetFormat(nsMimeOutputType aFormat);
PRBool CompleteYet()
{
return mComplete;
}
private:
PRBool mComplete;
PRInt32 mIndentCount;
PRBool mInClosingTag;
nsMimeOutputType mOutFormat;
@ -417,7 +424,7 @@ main(int argc, char** argv)
// Do some sanity checking...
if (argc < 2)
{
fprintf(stderr, "usage: %s <rfc822_disk_file> <any_arg_for_Draft_processing>\n", argv[0]);
fprintf(stderr, "usage: %s <rfc822_disk_file> <any_arg_for_XUL_output>\n", argv[0]);
return 1;
}
@ -452,7 +459,7 @@ DoRFC822toHTMLConversion(char *filename, int numArgs)
char *contentType = nsnull;
if (numArgs >= 3)
outFormat = nsMimeOutput::nsMimeMessageDraftOrTemplate;
outFormat = nsMimeOutput::nsMimeMessageXULDisplay;
else
outFormat = nsMimeOutput::nsMimeMessageQuoting;