From 6417ada2191f2db87cc87d6f8edfc257a29cb101 Mon Sep 17 00:00:00 2001 From: "ducarroz%netscape.com" Date: Sat, 13 Mar 1999 07:51:54 +0000 Subject: [PATCH] Part of implementation of Reply and Forward git-svn-id: svn://10.0.0.236/trunk@24063 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/compose/build/makefile.win | 1 + .../compose/public/nsIDOMComposeAppCore.h | 15 +- .../compose/public/nsIDOMComposeAppCore.idl | 9 +- .../mailnews/compose/src/nsComposeAppCore.cpp | 201 ++++++++++++++++-- .../compose/src/nsJSComposeAppCore.cpp | 101 +++++++-- .../ui/messenger/resources/commandglue.js | 8 +- .../ui/messenger/resources/widgetglue.js | 12 +- 7 files changed, 295 insertions(+), 52 deletions(-) diff --git a/mozilla/mailnews/compose/build/makefile.win b/mozilla/mailnews/compose/build/makefile.win index c8fd5baa0e5..c784e0ffcf8 100644 --- a/mozilla/mailnews/compose/build/makefile.win +++ b/mozilla/mailnews/compose/build/makefile.win @@ -101,6 +101,7 @@ LINCS=$(LINCS) -I, \ -I$(PUBLIC)\mailnews \ -I$(PUBLIC)\pref \ -I$(PUBLIC)\raptor \ + -I$(PUBLIC)\rdf \ -I$(PUBLIC)\dom \ -I$(PUBLIC)\appcores \ $(NULL) diff --git a/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.h b/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.h index af1ec837a9f..e97a98b2c41 100644 --- a/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.h +++ b/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.h @@ -9,6 +9,8 @@ #include "nsIDOMWindow.h" /* interface nsIDOMWindow */ #include "nsID.h" /* interface nsID */ #include "nsIDOMBaseAppCore.h" /* interface nsIDOMBaseAppCore */ +#include "nsIDOMEditorAppCore.h" /* interface nsIDOMEditorAppCore */ +#include "nsIDOMMsgAppCore.h" /* interface nsIDOMEditorAppCore */ #ifdef XPIDL_JS_STUBS #include "jsapi.h" @@ -32,17 +34,22 @@ class nsIDOMComposeAppCore : public nsIDOMBaseAppCore { /* void SetWindow (in nsIDOMWindow ptr); */ NS_IMETHOD SetWindow(nsIDOMWindow *ptr) = 0; + /* void SetEditor (in nsIDOMWindow ptr); */ + NS_IMETHOD SetEditor(nsIDOMEditorAppCore *ptr) = 0; + /* void CompleteCallback (in nsAutoString script); */ NS_IMETHOD CompleteCallback(nsAutoString& script) = 0; /* void NewMessage (in nsAutoString url); */ NS_IMETHOD NewMessage(nsAutoString& url) = 0; - /* void ReplyMessage (in nsString url, in nsISupports originalMessage, in long type); */ - NS_IMETHOD ReplyMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type) = 0; + /* void ReplyMessage (...); */ + NS_IMETHOD ReplyMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 replyType) = 0; - /* void ForwardMessage (in nsString url, in nsISupports originalMessage, in long type); */ - NS_IMETHOD ForwardMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type) = 0; + /* void ForwardMessage (...); */ + NS_IMETHOD ForwardMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 forwardType) = 0; /* void SendMessage (in nsAutoString addrTo, in nsAutoString addrCc, in nsAutoString addrBcc, in nsAutoString subject, in nsAutoString msg); */ NS_IMETHOD SendMessage(nsAutoString& addrTo, nsAutoString& addrCc, nsAutoString& addrBcc, nsAutoString& subject, nsAutoString& msg) = 0; diff --git a/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.idl b/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.idl index 2ebcf1838f9..7e18511fa0b 100644 --- a/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.idl +++ b/mozilla/mailnews/compose/public/nsIDOMComposeAppCore.idl @@ -22,6 +22,8 @@ #include "nsIDOMBaseAppCore.idl" #include "nsIDOMWindow.idl" +#include "nsIDOMEditorAppCore.idl" +#include "nsIDOMMsgAppCore.idl" native nsString(nsString*); @@ -29,10 +31,13 @@ native nsString(nsString*); interface nsIDOMComposeAppCore : nsIDOMBaseAppCore { void SetWindow(in nsIDOMWindow ptr); + void SetEditor(in nsIDOMEditorAppCore ptr); void CompleteCallback(in nsString script); void NewMessage(in nsString url); - void ReplyMessage(in nsString url, in nsISupports originalMessage, in long type); - void ForwardMessage(in nsString url, in nsISupports originalMessage, in long type); + void ReplyMessage(in nsString url, in nsIDOMXULTreeElement tree, in nsIDOMNodeList node, + in nsIDOMMsgAppCore msgAppCore, in long replyType); + void ForwardMessage(in nsString url, in nsIDOMXULTreeElement tree, in nsIDOMNodeList node, + in nsIDOMMsgAppCore msgAppCore, in long forwardType); void SendMessage(in nsString addrTo, in nsString addrCc, in nsString addrBcc, in nsString subject, in nsString msg); diff --git a/mozilla/mailnews/compose/src/nsComposeAppCore.cpp b/mozilla/mailnews/compose/src/nsComposeAppCore.cpp index ffef3054b9e..9df370aab1f 100644 --- a/mozilla/mailnews/compose/src/nsComposeAppCore.cpp +++ b/mozilla/mailnews/compose/src/nsComposeAppCore.cpp @@ -22,6 +22,7 @@ #include "nsIDOMBaseAppCore.h" #include "nsJSComposeAppCore.h" #include "nsIDOMDocument.h" +#include "nsIDOMNodeList.h" #include "nsIScriptContextOwner.h" /* rhp - for access to webshell */ @@ -30,8 +31,11 @@ #include "nsCOMPtr.h" #include "nsIDocument.h" #include "nsIDOMWindow.h" +#include "nsIDOMNamedNodeMap.h" +#include "nsIDOMHTMLInputElement.h" #include "nsIWebShell.h" #include "nsIWebShellWindow.h" +#include "nsIDOMElement.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptContext.h" #include "nsAppShellCIDs.h" @@ -39,6 +43,8 @@ #include "nsIServiceManager.h" #include "nsIURL.h" #include "nsMsgCompPrefs.h" +#include "nsIDOMMsgAppCore.h" +#include "nsIMessage.h" #include "nsMsgCompCID.h" #include "nsIMsgCompose.h" @@ -88,9 +94,12 @@ public: // nsIComposeAppCore NS_IMETHOD CompleteCallback(nsAutoString& aScript); NS_IMETHOD SetWindow(nsIDOMWindow* aWin); + NS_IMETHOD SetEditor(nsIDOMEditorAppCore *editor); NS_IMETHOD NewMessage(nsAutoString& aUrl); - NS_IMETHOD ReplyMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type); - NS_IMETHOD ForwardMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type); + NS_IMETHOD ReplyMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 replyType); + NS_IMETHOD ForwardMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 forwardType); NS_IMETHOD SendMessage(nsAutoString& aAddrTo, nsAutoString& aAddrCc, nsAutoString& aAddrBcc, nsAutoString& aSubject, nsAutoString& aMsg); NS_IMETHOD SendMessage2(PRInt32 * _retval); @@ -98,15 +107,18 @@ public: protected: nsIScriptContext * GetScriptContext(nsIDOMWindow * aWin); + void SetWindowFields(nsString& to, nsString& cc, nsString& bcc, + nsString& subject, nsString& body); nsString mId; nsString mScript; void *mScriptObject; - nsIScriptContext *mScriptContext; + nsIScriptContext *mScriptContext; /* rhp - need this to drive message display */ - nsIDOMWindow *mWindow; - nsIWebShell *mWebShell; + nsIDOMWindow *mWindow; + nsIWebShell *mWebShell; + nsIDOMEditorAppCore *mEditor; }; // @@ -114,19 +126,21 @@ protected: // nsComposeAppCore::nsComposeAppCore() { - mScriptObject = nsnull; - mWebShell = nsnull; - mScriptObject = nsnull; - mScriptContext = nsnull; - mWindow = nsnull; + mScriptObject = nsnull; + mWebShell = nsnull; + mScriptContext = nsnull; + mWindow = nsnull; + mEditor = nsnull; - NS_INIT_REFCNT(); + NS_INIT_REFCNT(); } nsComposeAppCore::~nsComposeAppCore() { + NS_IF_RELEASE(mWebShell); NS_IF_RELEASE(mScriptContext); NS_IF_RELEASE(mWindow); + NS_IF_RELEASE(mEditor); } nsresult nsComposeAppCore::SetDocumentCharset(class nsString const & aCharset) @@ -182,6 +196,57 @@ nsComposeAppCore::GetScriptContext(nsIDOMWindow * aWin) } +void nsComposeAppCore::SetWindowFields(nsString& msgTo, nsString& msgCc, nsString& msgBcc, + nsString& msgSubject, nsString& msgBody) +{ + nsresult res = NS_OK; + + nsCOMPtr domDoc; + nsCOMPtr node; + nsCOMPtr nodeList; + nsCOMPtr inputElement; + + if (nsnull != mWindow) + { + res = mWindow->GetDocument(getter_AddRefs(domDoc)); + if (NS_SUCCEEDED(res) && domDoc) + { + res = domDoc->GetElementsByTagName("input", getter_AddRefs(nodeList)); + if ((NS_SUCCEEDED(res)) && nodeList) + { + PRUint32 count; + PRUint32 i; + nodeList->GetLength(&count); + for (i = 0; i < count; i ++) + { + res = nodeList->Item(i, getter_AddRefs(node)); + if ((NS_SUCCEEDED(res)) && node) + { + nsString value; + res = node->QueryInterface(nsIDOMHTMLInputElement::GetIID(), getter_AddRefs(inputElement)); + if ((NS_SUCCEEDED(res)) && inputElement) + { + nsString id; + inputElement->GetId(id); + if (id == "msgTo") inputElement->SetValue(msgTo); + if (id == "msgCc") inputElement->SetValue(msgCc); + if (id == "msgBcc") inputElement->SetValue(msgBcc); + if (id == "msgSubject") inputElement->SetValue(msgSubject); + } + + } + } + + if (mEditor) + { + mEditor->InsertText(msgBody); + } + } + } + } +} + + // // nsISupports // @@ -282,6 +347,15 @@ nsComposeAppCore::SetWindow(nsIDOMWindow* aWin) } +NS_IMETHODIMP +nsComposeAppCore::SetEditor(nsIDOMEditorAppCore* editor) +{ + mEditor = editor; + NS_ADDREF(mEditor); + return NS_OK; +} + + NS_IMETHODIMP nsComposeAppCore::CompleteCallback(nsAutoString& aScript) { @@ -326,20 +400,55 @@ done: return NS_OK; } -NS_IMETHODIMP nsComposeAppCore::ReplyMessage(nsAutoString& url, nsISupports * originalMessage, - const PRInt32 type) +NS_IMETHODIMP nsComposeAppCore::ReplyMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 replyType) { - NewMessage(url); + nsresult res; + + if (url && tree && nodeList && msgAppCore) { + nsCOMPtr object; + res = msgAppCore->GetMessageHeader(tree, nodeList, getter_AddRefs(object)); + if ((NS_SUCCEEDED(res)) && object) { + nsCOMPtr message; + res = object->QueryInterface(nsIMessage::GetIID(), getter_AddRefs(message)); + if ((NS_SUCCEEDED(res)) && message) { + nsString subject; + message->GetSubject(subject); +// subject = "Re: " + subject; + //We need to extract the others elements from the message + NewMessage(url); + SetWindowFields(nsString("to"), nsString("cc"), nsString("bcc"), subject, nsString("body")); + } + } + } return NS_OK; } -NS_IMETHODIMP nsComposeAppCore::ForwardMessage(nsAutoString& url, nsISupports * originalMessage, - const PRInt32 type) +NS_IMETHODIMP nsComposeAppCore::ForwardMessage(nsAutoString& url, nsIDOMXULTreeElement *tree, + nsIDOMNodeList *nodeList, nsIDOMMsgAppCore * msgAppCore, const PRInt32 forwardType) { - NewMessage(url); + nsresult res; + + if (url && tree && nodeList && msgAppCore) { + nsCOMPtr object; + res = msgAppCore->GetMessageHeader(tree, nodeList, getter_AddRefs(object)); + if ((NS_SUCCEEDED(res)) && object) { + nsCOMPtr message; + res = object->QueryInterface(nsIMessage::GetIID(), getter_AddRefs(message)); + if ((NS_SUCCEEDED(res)) && message) { + nsString subject; + message->GetSubject(subject); +// subject = "[Fwd: " + subject + "]"; + //We need to extract the others elements from the message + NewMessage(url); + SetWindowFields(nsString("to"), nsString("cc"), nsString("bcc"), subject, nsString("body")); + } + } + } return NS_OK; } + NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo, nsAutoString& aAddrCc, nsAutoString& aAddrBcc, nsAutoString& aSubject, nsAutoString& aMsg) { @@ -377,6 +486,7 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo, nsAutoString& (void **) &pMsgCompFields); if (NS_SUCCEEDED(NS_OK) && pMsgCompFields) { pMsgCompFields->SetFrom((char *)pCompPrefs.GetUserEmail(), NULL); + pMsgCompFields->SetReplyTo((char *)pCompPrefs.GetReplyTo(), NULL); pMsgCompFields->SetOrganization((char *)pCompPrefs.GetOrganization(), NULL); pMsgCompFields->SetTo(aAddrTo.ToNewCString(), NULL); pMsgCompFields->SetCc(aAddrCc.ToNewCString(), NULL); @@ -411,9 +521,60 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo, nsAutoString& NS_IMETHODIMP nsComposeAppCore::SendMessage2(PRInt32 * _retval) { -// Need to retreive the fields here and then call the SendMessage() -// nsComposeAppCore::SendMessage(...) - return NS_OK; + nsresult res = NS_OK; + + nsCOMPtr domDoc; + nsCOMPtr node; + nsCOMPtr nodeList; + nsCOMPtr inputElement; + + nsAutoString msgTo; + nsAutoString msgCc; + nsAutoString msgBcc; + nsAutoString msgSubject; + nsAutoString msgBody; + + if (nsnull != mWindow) + { + res = mWindow->GetDocument(getter_AddRefs(domDoc)); + if (NS_SUCCEEDED(res) && domDoc) + { + res = domDoc->GetElementsByTagName("input", getter_AddRefs(nodeList)); + if ((NS_SUCCEEDED(res)) && nodeList) + { + PRUint32 count; + PRUint32 i; + nodeList->GetLength(&count); + for (i = 0; i < count; i ++) + { + res = nodeList->Item(i, getter_AddRefs(node)); + if ((NS_SUCCEEDED(res)) && node) + { + nsString value; + res = node->QueryInterface(nsIDOMHTMLInputElement::GetIID(), getter_AddRefs(inputElement)); + if ((NS_SUCCEEDED(res)) && inputElement) + { + nsString id; + inputElement->GetId(id); + if (id == "msgTo") inputElement->GetValue(msgTo); + if (id == "msgCc") inputElement->GetValue(msgCc); + if (id == "msgBcc") inputElement->GetValue(msgBcc); + if (id == "msgSubject") inputElement->GetValue(msgSubject); + } + + } + } + + if (mEditor) + { + mEditor->GetContentsAsText(msgBody); + SendMessage(msgTo, msgCc, msgBcc, msgSubject, msgBody); + } + } + } + } + + return res; } extern "C" diff --git a/mozilla/mailnews/compose/src/nsJSComposeAppCore.cpp b/mozilla/mailnews/compose/src/nsJSComposeAppCore.cpp index a4db1f584b5..a5954c73ceb 100644 --- a/mozilla/mailnews/compose/src/nsJSComposeAppCore.cpp +++ b/mozilla/mailnews/compose/src/nsJSComposeAppCore.cpp @@ -26,6 +26,8 @@ #include "nsIScriptGlobalObject.h" #include "nsIPtr.h" #include "nsString.h" +#include "nsIDOMEditorAppCore.h" +#include "nsIDOMMsgAppCore.h" #include "nsIDOMComposeAppCore.h" #include "nsIDOMWindow.h" #include "nsIScriptNameSpaceManager.h" @@ -172,6 +174,48 @@ ComposeAppCoreSetWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j } +// +// Native method SetEditor +// +PR_STATIC_CALLBACK(JSBool) +ComposeAppCoreSetEditor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj); + JSBool rBool = JS_FALSE; + nsIDOMEditorAppCore * b0; + + *rval = JSVAL_NULL; + + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + if (argc >= 1) { + + if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0, + nsIDOMEditorAppCore::GetIID(), + "Editor AppCore", + cx, + argv[0])) { + return JS_FALSE; + } + + if (NS_OK != nativeThis->SetEditor(b0)) { + return JS_FALSE; + } + + *rval = JSVAL_VOID; + } + else { + JS_ReportError(cx, "Function SetEditor requires 1 parameters"); + return JS_FALSE; + } + + return JS_TRUE; +} + + // // Native method CompleteCallback // @@ -252,9 +296,11 @@ ComposeAppCoreReplyMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj); JSBool rBool = JS_FALSE; nsAutoString b0; - nsISupports * b1; + nsIDOMXULTreeElement * b1; + nsIDOMNodeList * b2; + nsIDOMMsgAppCore * b3; + long b4; const nsString typeName; - long b2; *rval = JSVAL_NULL; @@ -263,25 +309,35 @@ ComposeAppCoreReplyMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv return JS_TRUE; } - if (argc >= 3) { + if (argc >= 5) { nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsISupports::GetIID(), + rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsIDOMXULTreeElement::GetIID(), typeName, cx, argv[1]); - b2 = argv[2]; + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b2, nsIDOMNodeList::GetIID(), + typeName, + cx, + argv[2]); - if (!rBool && NS_OK != nativeThis->ReplyMessage(b0, b1, b2)) { + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b3, nsIDOMMsgAppCore::GetIID(), + typeName, + cx, + argv[3]); + + b4 = argv[4]; + + if (!rBool || NS_OK != nativeThis->ReplyMessage(b0, b1, b2, b3, b4)) { return JS_FALSE; } *rval = JSVAL_VOID; } else { - JS_ReportError(cx, "Function ReplyMessage requires 3 parameters"); + JS_ReportError(cx, "Function ReplyMessage requires 5 parameters"); return JS_FALSE; } @@ -298,9 +354,11 @@ ComposeAppCoreForwardMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *ar nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj); JSBool rBool = JS_FALSE; nsAutoString b0; - nsISupports * b1; + nsIDOMXULTreeElement * b1; + nsIDOMNodeList * b2; + nsIDOMMsgAppCore * b3; + long b4; const nsString typeName; - long b2; *rval = JSVAL_NULL; @@ -309,25 +367,35 @@ ComposeAppCoreForwardMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *ar return JS_TRUE; } - if (argc >= 3) { + if (argc >= 5) { nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsISupports::GetIID(), + rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsIDOMXULTreeElement::GetIID(), typeName, cx, argv[1]); - b2 = argv[2]; + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b2, nsIDOMNodeList::GetIID(), + typeName, + cx, + argv[2]); - if (!rBool && NS_OK != nativeThis->ForwardMessage(b0, b1, b2)) { + rBool &= nsJSUtils::nsConvertJSValToObject((nsISupports**)&b3, nsIDOMMsgAppCore::GetIID(), + typeName, + cx, + argv[3]); + + b4 = argv[4]; + + if (!rBool || NS_OK != nativeThis->ForwardMessage(b0, b1, b2, b3, b4)) { return JS_FALSE; } *rval = JSVAL_VOID; } else { - JS_ReportError(cx, "Function ForwardMessage requires 3 parameters"); + JS_ReportError(cx, "Function ForwardMessage requires 5 parameters"); return JS_FALSE; } @@ -446,10 +514,11 @@ static JSPropertySpec ComposeAppCoreProperties[] = static JSFunctionSpec ComposeAppCoreMethods[] = { {"SetWindow", ComposeAppCoreSetWindow, 1}, + {"SetEditor", ComposeAppCoreSetEditor, 1}, {"CompleteCallback", ComposeAppCoreCompleteCallback, 1}, {"NewMessage", ComposeAppCoreNewMessage, 1}, - {"ReplyMessage", ComposeAppCoreReplyMessage, 3}, - {"ForwardMessage", ComposeAppCoreForwardMessage, 3}, + {"ReplyMessage", ComposeAppCoreReplyMessage, 5}, + {"ForwardMessage", ComposeAppCoreForwardMessage, 5}, {"SendMessage", ComposeAppCoreSendMessage, 5}, {"SendMessage2", ComposeAppCoreSendMessage2, 0}, {0} diff --git a/mozilla/mailnews/ui/messenger/resources/commandglue.js b/mozilla/mailnews/ui/messenger/resources/commandglue.js index 6413b07a0b6..a963bf270ff 100644 --- a/mozilla/mailnews/ui/messenger/resources/commandglue.js +++ b/mozilla/mailnews/ui/messenger/resources/commandglue.js @@ -49,22 +49,22 @@ function ChangeFolder(folderNode) } -function ReplyMessage(messageHdr) +function ReplyMessage(tree, nodeList, msgAppCore) { var appCore = new ComposeAppCore(); if (appCore != null) { dump("Initializing ComposeAppCore and creating a new Message\n"); appCore.Init("ComposeAppCore"); - appCore.ReplyMessage("resource:/res/samples/compose.xul", messageHdr, 0); + appCore.ReplyMessage("resource:/res/samples/compose.xul", tree, nodeList, msgAppCore, 0); } } -function ForwardMessage(messageHdr) +function ForwardMessage(tree, nodeList, msgAppCore) { var appCore = new ComposeAppCore(); if (appCore != null) { dump("Initializing ComposeAppCore and creating a new Message\n"); appCore.Init("ComposeAppCore"); - appCore.ForwardMessage("resource:/res/samples/compose.xul", messageHdr, 0); + appCore.ForwardMessage("resource:/res/samples/compose.xul", tree, nodeList, msgAppCore, 0); } } diff --git a/mozilla/mailnews/ui/messenger/resources/widgetglue.js b/mozilla/mailnews/ui/messenger/resources/widgetglue.js index 7195673b4a5..b15433b2238 100644 --- a/mozilla/mailnews/ui/messenger/resources/widgetglue.js +++ b/mozilla/mailnews/ui/messenger/resources/widgetglue.js @@ -72,9 +72,9 @@ function MsgReplyMessage() appCore.Init("MsgAppCore"); appCore.SetWindow(window); dump("\nAppcore isn't null in MsgReplyMessage\n"); - var NodeList = tree.getElementsByAttribute("selected", "true"); - var messageHdr = appCore.GetMessageHeader(tree, NodeList); - ReplyMessage(messageHdr); + var nodeList = tree.getElementsByAttribute("selected", "true"); +// var messageHdr = appCore.GetMessageHeader(tree, NodeList); + ReplyMessage(tree, nodeList, appCore); } } @@ -90,9 +90,9 @@ function MsgForwardMessage() appCore.Init("MsgAppCore"); appCore.SetWindow(window); dump("\nAppcore isn't null in MsgForwardMessage\n"); - var NodeList = tree.getElementsByAttribute("selected", "true"); - var messageHdr = appCore.GetMessageHeader(tree, NodeList); - ForwardMessage(messageHdr); + var nodeList = tree.getElementsByAttribute("selected", "true"); +// var messageHdr = appCore.GetMessageHeader(tree, NodeList); + ForwardMessage(tree, nodeList, appCore); } }