mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
first checkin for Messenger AppCore
This commit is contained in:
parent
9378190bba
commit
cb629963e7
1
mailnews/ui/messenger/.cvsignore
Normal file
1
mailnews/ui/messenger/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
30
mailnews/ui/messenger/Makefile.in
Normal file
30
mailnews/ui/messenger/Makefile.in
Normal file
@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src resources
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
1
mailnews/ui/messenger/public/.cvsignore
Normal file
1
mailnews/ui/messenger/public/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
33
mailnews/ui/messenger/public/Makefile.in
Normal file
33
mailnews/ui/messenger/public/Makefile.in
Normal file
@ -0,0 +1,33 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMMsgAppCore.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
31
mailnews/ui/messenger/public/nsIDOMMsgAppCore.h
Normal file
31
mailnews/ui/messenger/public/nsIDOMMsgAppCore.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* DO NOT EDIT. THIS FILE IS GENERATED FROM nsIDOMMsgAppCore.idl
|
||||
*/
|
||||
|
||||
#ifndef __gen_nsIDOMMsgAppCore_h__
|
||||
#define __gen_nsIDOMMsgAppCore_h__
|
||||
|
||||
#include "nsISupports.h" /* interface nsISupports */
|
||||
#include "nsIDOMBaseAppCore.h" /* interface nsIDOMBaseAppCore */
|
||||
|
||||
|
||||
/* starting interface nsIDOMMsgAppCore */
|
||||
|
||||
/* {4f7966d0-c14f-11d2-b7f2-00805f05ffa5} */
|
||||
#define NS_IDOMMSGAPPCORE_IID_STR "4f7966d0-c14f-11d2-b7f2-00805f05ffa5"
|
||||
#define NS_IDOMMSGAPPCORE_IID \
|
||||
{0x4f7966d0, 0xc14f, 0x11d2, \
|
||||
{ 0xb7, 0xf2, 0x00, 0x80, 0x5f, 0x05, 0xff, 0xa5 }}
|
||||
|
||||
class nsIDOMMsgAppCore : public nsIDOMBaseAppCore {
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_IDOMMSGAPPCORE_IID;
|
||||
return iid;
|
||||
}
|
||||
|
||||
/* void GetNewMail (); */
|
||||
NS_IMETHOD GetNewMail() = 0;
|
||||
};
|
||||
|
||||
#endif /* __gen_nsIDOMMsgAppCore_h__ */
|
48
mailnews/ui/messenger/public/nsIDOMMsgAppCore.idl
Normal file
48
mailnews/ui/messenger/public/nsIDOMMsgAppCore.idl
Normal file
@ -0,0 +1,48 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/* this should eventually derive from some sort of BaseAppCore */
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsIDOMBaseAppCore.idl"
|
||||
|
||||
[object, uuid(4f7966d0-c14f-11d2-b7f2-00805f05ffa5)]
|
||||
interface nsIDOMMsgAppCore : nsIDOMBaseAppCore {
|
||||
|
||||
void GetNewMail();
|
||||
|
||||
};
|
||||
|
1
mailnews/ui/messenger/resources/.cvsignore
Normal file
1
mailnews/ui/messenger/resources/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
28
mailnews/ui/messenger/resources/Makefile.in
Normal file
28
mailnews/ui/messenger/resources/Makefile.in
Normal file
@ -0,0 +1,28 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Mozilla Browser</title>
|
||||
|
@ -17,14 +17,36 @@
|
||||
<xul:menubar>
|
||||
<xul:menu name="File">
|
||||
<xul:menuitem name="New Message" cmd="nsCmd:NewMessage"/>
|
||||
<separator/>
|
||||
<xul:menuitem name="Get New Message" cmd="nsCmd:GetMessage"/>
|
||||
<xul:menuitem name="Subscribe" cmd="nsCmd:Subscribe"/>
|
||||
<separator/>
|
||||
<xul:menuitem name="Rename Folder.." cmd="nsCmd:RenameFolder"/>
|
||||
<xul:menuitem name="Empty Trash" cmd="nsCmd:EmptyTrash"/>
|
||||
<separator/>
|
||||
<xul:menuitem name="Print" cmd="nsCmd:Print"/>
|
||||
<separator/>
|
||||
<xul:menuitem name="Close" cmd="nsCmd:Close"/>
|
||||
<xul:menuitem name="Exit" cmd="nsCmd:Exit"/>
|
||||
</xul:menu>
|
||||
<xul:menu name="Edit">
|
||||
<xul:menuitem name="Delete Message" cmd="nsCmd:DeleteMessage"/>
|
||||
</xul:menu>
|
||||
<xul:menu name="View">
|
||||
<xul:menuitem name="View Attachments Inline" cmd="nsCmd:ViewAttachInline"/>
|
||||
<xul:menuitem name="Wrap Long Lines" cmd="nsCmd:WrapLongLines"/>
|
||||
<separator/>
|
||||
<xul:menuitem name="Page Source" cmd="nsCmd:ViewPageSource"/>
|
||||
<xul:menuitem name="Page Info" cmd="nsCmd:ViewPageInfo"/>
|
||||
</xul:menu>
|
||||
<xul:menu name="Go">
|
||||
<xul:menuitem name="Next Message" cmd="nsCmd:NextMessage"/>
|
||||
<xul:menuitem name="Next Unread Message" cmd="nsCmd:NextUnreadMessage"/>
|
||||
</xul:menu>
|
||||
<xul:menu name="Message">
|
||||
<xul:menuitem name="New Message" cmd="nsCmd:NewMessage">
|
||||
<xul:menuitem name="Reply" cmd="nsCmd:ReplyMessage"/>
|
||||
<xul:menuitem name="Forward" cmd="nsCmd:ForwardMessage" />
|
||||
<xul:menuitem name="Forward" cmd="nsCmd:ForwardMessage"/>
|
||||
</xul:menu>
|
||||
|
||||
</xul:menubar>
|
||||
|
1
mailnews/ui/messenger/src/.cvsignore
Normal file
1
mailnews/ui/messenger/src/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
29
mailnews/ui/messenger/src/Makefile.in
Normal file
29
mailnews/ui/messenger/src/Makefile.in
Normal file
@ -0,0 +1,29 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
443
mailnews/ui/messenger/src/nsJSMsgAppCore.cpp
Normal file
443
mailnews/ui/messenger/src/nsJSMsgAppCore.cpp
Normal file
@ -0,0 +1,443 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
/* Not quite - slightly modified by alecf
|
||||
* once the XPIDL compiler knows how to generate this stuff,
|
||||
* I'll generate it again
|
||||
*/
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMMsgAppCore.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsDOMCID.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID);
|
||||
static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID);
|
||||
|
||||
NS_DEF_PTR(nsIDOMMsgAppCore);
|
||||
NS_DEF_PTR(nsIDOMWindow);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// MsgAppCore Properties Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetMsgAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMMsgAppCore *a = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// MsgAppCore Properties Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetMsgAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMMsgAppCore *a = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeMsgAppCore(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateMsgAppCore(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveMsgAppCore(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SendMail
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
MsgAppCoreSendMail(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMMsgAppCore *nativeThis = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
nsAutoString 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]);
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b2, cx, argv[2]);
|
||||
|
||||
if (NS_OK != nativeThis->SendMail(b0, b1, b2)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function SendMail requires 3 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method MailCompleteCallback
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
MsgAppCoreMailCompleteCallback(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMMsgAppCore *nativeThis = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsAutoString 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) {
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->MailCompleteCallback(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function MailCompleteCallback requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method SetWindow
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
MsgAppCoreSetWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMMsgAppCore *nativeThis = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
nsIDOMWindowPtr 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,
|
||||
kIWindowIID,
|
||||
"Window",
|
||||
cx,
|
||||
argv[0])) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_OK != nativeThis->SetWindow(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function SetWindow requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for MsgAppCore
|
||||
//
|
||||
JSClass MsgAppCoreClass = {
|
||||
"MsgAppCore",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
GetMsgAppCoreProperty,
|
||||
SetMsgAppCoreProperty,
|
||||
EnumerateMsgAppCore,
|
||||
ResolveMsgAppCore,
|
||||
JS_ConvertStub,
|
||||
FinalizeMsgAppCore
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore class properties
|
||||
//
|
||||
static JSPropertySpec MsgAppCoreProperties[] =
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore class methods
|
||||
//
|
||||
static JSFunctionSpec MsgAppCoreMethods[] =
|
||||
{
|
||||
{"SendMail", MsgAppCoreSendMail, 3},
|
||||
{"MailCompleteCallback", MsgAppCoreMailCompleteCallback, 1},
|
||||
{"SetWindow", MsgAppCoreSetWindow, 1},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// MsgAppCore constructor
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
MsgAppCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsresult result;
|
||||
nsIID classID;
|
||||
nsIScriptContext* context = (nsIScriptContext*)JS_GetContextPrivate(cx);
|
||||
nsIScriptNameSpaceManager* manager;
|
||||
nsIDOMMsgAppCore *nativeThis;
|
||||
nsIScriptObjectOwner *owner = nsnull;
|
||||
|
||||
static NS_DEFINE_IID(kIDOMMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID);
|
||||
|
||||
result = context->GetNameSpaceManager(&manager);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
result = manager->LookupName("MsgAppCore", PR_TRUE, classID);
|
||||
NS_RELEASE(manager);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
result = nsRepository::CreateInstance(classID,
|
||||
nsnull,
|
||||
kIDOMMsgAppCoreIID,
|
||||
(void **)&nativeThis);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
// XXX We should be calling Init() on the instance
|
||||
|
||||
result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner);
|
||||
if (NS_OK != result) {
|
||||
NS_RELEASE(nativeThis);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
owner->SetScriptObject((void *)obj);
|
||||
JS_SetPrivate(cx, obj, nativeThis);
|
||||
|
||||
NS_RELEASE(owner);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// MsgAppCore class initialization
|
||||
//
|
||||
nsresult NS_InitMsgAppCoreClass(nsIScriptContext *aContext, void **aPrototype)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *proto = nsnull;
|
||||
JSObject *constructor = nsnull;
|
||||
JSObject *parent_proto = nsnull;
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
jsval vp;
|
||||
|
||||
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "MsgAppCore", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp) ||
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
|
||||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp)) {
|
||||
|
||||
if (NS_OK != NS_InitBaseAppCoreClass(aContext, (void **)&parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
proto = JS_InitClass(jscontext, // context
|
||||
global, // global object
|
||||
parent_proto, // parent proto
|
||||
&MsgAppCoreClass, // JSClass
|
||||
MsgAppCore, // JSNative ctor
|
||||
0, // ctor args
|
||||
MsgAppCoreProperties, // proto props
|
||||
MsgAppCoreMethods, // proto funcs
|
||||
nsnull, // ctor props (static)
|
||||
nsnull); // ctor funcs (static)
|
||||
if (nsnull == proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrototype) {
|
||||
*aPrototype = proto;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Method for creating a new MsgAppCore JavaScript object
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_NewScriptMsgAppCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptMsgAppCore");
|
||||
JSObject *proto;
|
||||
JSObject *parent;
|
||||
nsIScriptObjectOwner *owner;
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMMsgAppCore *aMsgAppCore;
|
||||
|
||||
if (nsnull == aParent) {
|
||||
parent = nsnull;
|
||||
}
|
||||
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
|
||||
NS_RELEASE(owner);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_OK != NS_InitMsgAppCoreClass(aContext, (void **)&proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = aSupports->QueryInterface(kIMsgAppCoreIID, (void **)&aMsgAppCore);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// create a js object for this class
|
||||
*aReturn = JS_NewObject(jscontext, &MsgAppCoreClass, proto, parent);
|
||||
if (nsnull != *aReturn) {
|
||||
// connect the native object to the js object
|
||||
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aMsgAppCore);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(aMsgAppCore);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
111
mailnews/ui/messenger/src/nsMsgAppCore.cpp
Normal file
111
mailnews/ui/messenger/src/nsMsgAppCore.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
static NS_DEFINE_IID(kIMsgAppCoreIID, NS_IMSGAPPCORE_IID);
|
||||
|
||||
class nsMsgAppCore : public nsIMsgAppCore,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
|
||||
public:
|
||||
nsMsgAppCore();
|
||||
virtual ~nsMsgAppCore();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IDOMBASEAPPCORE
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
// nsIMsgAppCore
|
||||
NS_IMETHOD GetNewMail();
|
||||
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsMsgAppCore);
|
||||
NS_IMPL_RELEASE(nsMsgAppCore);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgAppCore::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (aInstancePtr == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if ( aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
*aInstancePtr = (void*) ((nsIScriptObjectOwner*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if ( aIID.Equals(kIDOMBaseAppCoreIID)) {
|
||||
*aInstancePtr = (void*) ((nsIDOMBaseAppCore*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if ( aIID.Equals(kIMsgAppCoreIID) ) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIScriptObjectOwner*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if ( aIID.Equals(kISupportsIID) ) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIScriptObjectOwner*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsMsgAppCore::nsMsgAppCore()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
}
|
||||
|
||||
nsMsgAppCore::~nsMsgAppCore()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAppCore::GetScriptObject(nsIScriptContext *aContext, void **aScriptObject)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAppCore::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsMsgAppCore::GetNewMail()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
30
mailnews/ui/messenger/src/nsMsgAppCore.h
Normal file
30
mailnews/ui/messenger/src/nsMsgAppCore.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsMsgAppCore_h
|
||||
#define __nsMsgAppCore_h
|
||||
|
||||
#include "nsCom.h"
|
||||
|
||||
NS_BEGIN_EXTERN_C
|
||||
|
||||
nsresult
|
||||
NS_NewMsgAppCore(nsIMsgAppCore **);
|
||||
|
||||
NS_END_EXTERN_C
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user