Add ReplyMessage, ForwardMessage and SendMessage2 interface

git-svn-id: svn://10.0.0.236/trunk@23970 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ducarroz%netscape.com
1999-03-12 20:39:16 +00:00
parent 3901089d0a
commit 008becef89
4 changed files with 171 additions and 7 deletions

View File

@@ -38,9 +38,18 @@ class nsIDOMComposeAppCore : public nsIDOMBaseAppCore {
/* void NewMessage (in nsAutoString url); */
NS_IMETHOD NewMessage(nsAutoString& url) = 0;
/* void SendMessage (in nsAutoString addrTo, in nsAutoString addrCc, in nsAutoString addrBcc, in nsAutoString subject, in nsAutoString msg); */
/* void ReplyMessage (in nsString url, in nsISupports originalMessage, in long type); */
NS_IMETHOD ReplyMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type) = 0;
/* void ForwardMessage (in nsString url, in nsISupports originalMessage, in long type); */
NS_IMETHOD ForwardMessage(nsAutoString& url, nsISupports * originalMessage, const PRInt32 type) = 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;
/* void SendMessage2 (); */
NS_IMETHOD SendMessage2(PRInt32 *_retval) = 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIDOMComposeAppCore *priv);

View File

@@ -31,9 +31,12 @@ interface nsIDOMComposeAppCore : nsIDOMBaseAppCore {
void SetWindow(in nsIDOMWindow 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 SendMessage(in nsString addrTo, in nsString addrCc,
in nsString addrBcc,
in nsString subject, in nsString msg);
long SendMessage2();
};
/* hack to make MsgAppCore visible from AppCore */

View File

@@ -89,8 +89,11 @@ public:
NS_IMETHOD CompleteCallback(nsAutoString& aScript);
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
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 SendMessage(nsAutoString& aAddrTo, nsAutoString& aAddrCc,
nsAutoString& aAddrBcc, nsAutoString& aSubject, nsAutoString& aMsg);
NS_IMETHOD SendMessage2(PRInt32 * _retval);
protected:
@@ -323,6 +326,20 @@ done:
return NS_OK;
}
NS_IMETHODIMP nsComposeAppCore::ReplyMessage(nsAutoString& url, nsISupports * originalMessage,
const PRInt32 type)
{
NewMessage(url);
return NS_OK;
}
NS_IMETHODIMP nsComposeAppCore::ForwardMessage(nsAutoString& url, nsISupports * originalMessage,
const PRInt32 type)
{
NewMessage(url);
return NS_OK;
}
NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo, nsAutoString& aAddrCc,
nsAutoString& aAddrBcc, nsAutoString& aSubject, nsAutoString& aMsg)
{
@@ -391,7 +408,14 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo, nsAutoString&
return NS_OK;
}
NS_IMETHODIMP nsComposeAppCore::SendMessage2(PRInt32 * _retval)
{
// Need to retreive the fields here and then call the SendMessage()
// nsComposeAppCore::SendMessage(...)
return NS_OK;
}
extern "C"
nsresult
NS_NewComposeAppCore(nsIDOMComposeAppCore **aResult)

View File

@@ -243,6 +243,97 @@ ComposeAppCoreNewMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
return JS_TRUE;
}
//
// Native method ReplyMessage
//
PR_STATIC_CALLBACK(JSBool)
ComposeAppCoreReplyMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
nsISupports * b1;
const nsString typeName;
long b2;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 3) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsISupports::GetIID(),
typeName,
cx,
argv[1]);
b2 = argv[2];
if (!rBool && NS_OK != nativeThis->ReplyMessage(b0, b1, b2)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function ReplyMessage requires 3 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method ForwardMessage
//
PR_STATIC_CALLBACK(JSBool)
ComposeAppCoreForwardMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
nsISupports * b1;
const nsString typeName;
long b2;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 3) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
rBool = nsJSUtils::nsConvertJSValToObject((nsISupports**)&b1, nsISupports::GetIID(),
typeName,
cx,
argv[1]);
b2 = argv[2];
if (!rBool && NS_OK != nativeThis->ForwardMessage(b0, b1, b2)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function ForwardMessage requires 3 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method SendMessage
@@ -280,7 +371,41 @@ ComposeAppCoreSendMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function SendMessage requires 6 parameters");
JS_ReportError(cx, "Function SendMessage requires 5 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method SendMessage2
//
PR_STATIC_CALLBACK(JSBool)
ComposeAppCoreSendMessage2(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMComposeAppCore *nativeThis = (nsIDOMComposeAppCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
PRInt32 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 >= 0) {
if (NS_OK != nativeThis->SendMessage2(&b0)) {
return JS_FALSE;
}
*rval = (jsval) b0;
}
else {
JS_ReportError(cx, "Function SendMessage requires 1 parameters");
return JS_FALSE;
}
@@ -320,10 +445,13 @@ static JSPropertySpec ComposeAppCoreProperties[] =
//
static JSFunctionSpec ComposeAppCoreMethods[] =
{
{"SetWindow", ComposeAppCoreSetWindow, 1},
{"CompleteCallback", ComposeAppCoreCompleteCallback, 1},
{"NewMessage", ComposeAppCoreNewMessage, 1},
{"SendMessage", ComposeAppCoreSendMessage, 5},
{"SetWindow", ComposeAppCoreSetWindow, 1},
{"CompleteCallback", ComposeAppCoreCompleteCallback, 1},
{"NewMessage", ComposeAppCoreNewMessage, 1},
{"ReplyMessage", ComposeAppCoreReplyMessage, 3},
{"ForwardMessage", ComposeAppCoreForwardMessage, 3},
{"SendMessage", ComposeAppCoreSendMessage, 5},
{"SendMessage2", ComposeAppCoreSendMessage2, 0},
{0}
};