mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 22:35:43 +00:00
add hooks between mime parser, content handlers, and message display, sr=mscott 351610
This commit is contained in:
parent
70e96c79ed
commit
e024302e83
@ -511,6 +511,14 @@ var messageHeaderSink = {
|
|||||||
if (!this.mDummyMsgHeader)
|
if (!this.mDummyMsgHeader)
|
||||||
this.mDummyMsgHeader = new nsDummyMsgHeader();
|
this.mDummyMsgHeader = new nsDummyMsgHeader();
|
||||||
return this.mDummyMsgHeader;
|
return this.mDummyMsgHeader;
|
||||||
|
},
|
||||||
|
mProperties: null,
|
||||||
|
getProperties: function()
|
||||||
|
{
|
||||||
|
if (!this.mProperties)
|
||||||
|
this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"].
|
||||||
|
createInstance(Components.interfaces.nsIWritablePropertyBag2);
|
||||||
|
return this.mProperties;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -513,7 +513,15 @@ var messageHeaderSink = {
|
|||||||
if (!this.mDummyMsgHeader)
|
if (!this.mDummyMsgHeader)
|
||||||
this.mDummyMsgHeader = new nsDummyMsgHeader();
|
this.mDummyMsgHeader = new nsDummyMsgHeader();
|
||||||
return this.mDummyMsgHeader;
|
return this.mDummyMsgHeader;
|
||||||
}
|
},
|
||||||
|
mProperties: null,
|
||||||
|
getProperties: function()
|
||||||
|
{
|
||||||
|
if (!this.mProperties)
|
||||||
|
this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"].
|
||||||
|
createInstance(Components.interfaces.nsIWritablePropertyBag2);
|
||||||
|
return this.mProperties;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function EnsureSubjectValue()
|
function EnsureSubjectValue()
|
||||||
|
@ -782,6 +782,11 @@ NS_IMETHODIMP TokenStreamListener::GetDummyMsgHeader(nsIMsgDBHdr **aMsgDBHdr)
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP TokenStreamListener::GetProperties(nsIWritablePropertyBag2 * *aProperties)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
|
/* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
|
||||||
NS_IMETHODIMP TokenStreamListener::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
NS_IMETHODIMP TokenStreamListener::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,7 @@ interface nsIChannel;
|
|||||||
interface nsIMsgMailNewsUrl;
|
interface nsIMsgMailNewsUrl;
|
||||||
interface nsIUTF8StringEnumerator;
|
interface nsIUTF8StringEnumerator;
|
||||||
interface nsIMsgDBHdr;
|
interface nsIMsgDBHdr;
|
||||||
|
interface nsIWritablePropertyBag2;
|
||||||
|
|
||||||
[scriptable, uuid(4644FB25-5255-11d3-82B8-444553540002)]
|
[scriptable, uuid(4644FB25-5255-11d3-82B8-444553540002)]
|
||||||
interface nsIMimeMiscStatus : nsISupports{
|
interface nsIMimeMiscStatus : nsISupports{
|
||||||
@ -60,7 +61,7 @@ interface nsIMimeMiscStatus : nsISupports{
|
|||||||
// this is a simple interface which allows someone to listen to all the headers
|
// this is a simple interface which allows someone to listen to all the headers
|
||||||
// that are discovered by mime. We can use this when displaying a message to update
|
// that are discovered by mime. We can use this when displaying a message to update
|
||||||
// the msg header in JS.
|
// the msg header in JS.
|
||||||
[scriptable, uuid(0d6ebe53-de30-4797-9a8e-5f9be68d472c)]
|
[scriptable, uuid(C3C4473C-FE01-4AFC-BF91-C811BAEBEF63)]
|
||||||
interface nsIMsgHeaderSink : nsISupports
|
interface nsIMsgHeaderSink : nsISupports
|
||||||
{
|
{
|
||||||
// You must finish consuming the iterators before returning from processHeaders. aHeaderNames and aHeaderValues will ALWAYS have the same
|
// You must finish consuming the iterators before returning from processHeaders. aHeaderNames and aHeaderValues will ALWAYS have the same
|
||||||
@ -83,4 +84,9 @@ interface nsIMsgHeaderSink : nsISupports
|
|||||||
|
|
||||||
void onMsgHasRemoteContent(in nsIMsgDBHdr aMsgHdr);
|
void onMsgHasRemoteContent(in nsIMsgDBHdr aMsgHdr);
|
||||||
nsIMsgDBHdr getDummyMsgHeader();
|
nsIMsgDBHdr getDummyMsgHeader();
|
||||||
|
|
||||||
|
// used as a hook for extension mime content handlers to store data that can later
|
||||||
|
// be accessed by other parts of the code, e.g., UI code.
|
||||||
|
// TODO - Should replace securityInfo
|
||||||
|
readonly attribute nsIWritablePropertyBag2 properties;
|
||||||
};
|
};
|
||||||
|
@ -36,10 +36,13 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
interface nsIURI;
|
||||||
|
|
||||||
[scriptable, uuid(641da207-c21b-45b0-9c0c-63866c4a66b2)]
|
[scriptable, uuid(FC6E8234-BBF3-44A1-9802-5F023A929173)]
|
||||||
interface nsISimpleMimeConverter : nsISupports
|
interface nsISimpleMimeConverter : nsISupports
|
||||||
{
|
{
|
||||||
|
// uri of message getting displayed
|
||||||
|
attribute nsIURI uri;
|
||||||
AUTF8String convertToHTML(in ACString contentType,
|
AUTF8String convertToHTML(in ACString contentType,
|
||||||
in AUTF8String data);
|
in AUTF8String data);
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "mimecth.h"
|
#include "mimecth.h"
|
||||||
#include "mimeobj.h"
|
#include "mimeobj.h"
|
||||||
#include "mimetext.h"
|
#include "mimetext.h"
|
||||||
|
#include "mimemoz2.h"
|
||||||
#include "mimecom.h"
|
#include "mimecom.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
@ -114,6 +115,14 @@ EndGather(MimeObject *obj, PRBool abort_p)
|
|||||||
if (ssobj->buffer->IsEmpty())
|
if (ssobj->buffer->IsEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
mime_stream_data *msd = (mime_stream_data *) (obj->options->stream_closure);
|
||||||
|
nsIChannel *channel = msd->channel; // note the lack of ref counting...
|
||||||
|
if (channel)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIURI> uri;
|
||||||
|
channel->GetURI(getter_AddRefs(uri));
|
||||||
|
ssobj->innerScriptable->SetUri(uri);
|
||||||
|
}
|
||||||
nsCString asHTML;
|
nsCString asHTML;
|
||||||
nsresult rv = ssobj->innerScriptable->ConvertToHTML(nsDependentCString(obj->content_type),
|
nsresult rv = ssobj->innerScriptable->ConvertToHTML(nsDependentCString(obj->content_type),
|
||||||
*ssobj->buffer,
|
*ssobj->buffer,
|
||||||
@ -148,7 +157,7 @@ static void
|
|||||||
Finalize(MimeObject *obj)
|
Finalize(MimeObject *obj)
|
||||||
{
|
{
|
||||||
MimeSimpleStub *ssobj = (MimeSimpleStub *)obj;
|
MimeSimpleStub *ssobj = (MimeSimpleStub *)obj;
|
||||||
ssobj->innerScriptable = 0;
|
ssobj->innerScriptable = nsnull;
|
||||||
delete ssobj->buffer;
|
delete ssobj->buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user