This commit is contained in:
mscott%netscape.com 1998-12-21 21:13:57 +00:00
Родитель 0734503a3a
Коммит b7502edcce
9 изменённых файлов: 636 добавлений и 0 удалений

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

@ -0,0 +1,121 @@
# 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.
NODEPEND=1
IGNORE_MANIFEST = 1
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH=..\..\..
#//------------------------------------------------------------------------
#//
# New build system where zip dll is build indepenant of java stubs.
#//
#//------------------------------------------------------------------------
MODULE =mailnews
REQUIRES=xpcom js
EXPORTS = \
nsMsgBaseCID.h \
$(NULL)
DEFINES=-D_IMPL_NS_HTML
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
CPPSRCS= \
nsMsgFactory.cpp \
$(NULL)
OBJS= \
.\$(OBJDIR)\nsMsgFactory.obj \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=mailnews.dll
PDBFILE=mailnews.pdb
MAPFILE=mailnews.map
# DEFFILE=msg.def
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME)
#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LCFLAGS=-DNETSCAPE
MSGLIBS= \
$(NULL)
# These are the libraries we need to link with to create the dll
LLIBS= \
$(LLIBS) \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\xplib.lib \
# $(DIST)\lib\netlib.lib \
$(DIST)\lib\libplc21.lib \
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
$(DIST)\lib\msgcore_s.lib \
$(LIBNSPR) \
$(NULL)
LINCS=$(LINCS) -I, \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\js \
-I$(PUBLIC)\mailnews \
-I$(PUBLIC)\pref \
-I$(PUBLIC)\raptor \
-I$(XPDIST)\msg \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME) $(DIST)\bin
# $(MAKE_INSTALL) .\$(OBJDIR)\$(LIBNAME) $(DIST)\lib
clobber::
rm -f $(DIST)\bin\$(DLLNAME)
# rm -f $(DIST)\lib\$(LIBNAME)

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

@ -0,0 +1,31 @@
/* -*- 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.
*/
#ifndef nsMessageBaseCID_h__
#define nsMessageBaseCID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsRepository.h"
#define NS_MSGRFC822PARSER_CID \
{ /* 26D71620-7421-11d2-804A-006008128C4E */ \
0x26d71620, 0x7421, 0x11d2, \
{0x80, 0x4a, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e}}
#endif // nsMessageBaseCID_h__

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

@ -0,0 +1,151 @@
/* -*- 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.
*/
#include "nsIFactory.h"
#include "nsISupports.h"
#include "msgCore.h"
#include "nsMsgBaseCID.h"
/* Include all of the interfaces our factory can generate components for */
#include "nsIMsgRFC822Parser.h"
#include "nsMsgRFC822Parser.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kCMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID);
////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////
class nsMsgFactory : public nsIFactory
{
public:
// nsISupports methods
NS_DECL_ISUPPORTS
nsMsgFactory(const nsCID &aClass);
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
protected:
virtual ~nsMsgFactory();
private:
nsCID mClassID;
};
nsMsgFactory::nsMsgFactory(const nsCID &aClass)
{
NS_INIT_REFCNT();
mClassID = aClass;
}
nsMsgFactory::~nsMsgFactory()
{
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
}
nsresult nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult)
{
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
// Always NULL result, in case of failure
*aResult = NULL;
// we support two interfaces....nsISupports and nsFactory.....
if (aIID.Equals(kISupportsIID))
*aResult = (void *)(nsISupports*)this;
else if (aIID.Equals(kIFactoryIID))
*aResult = (void *)(nsIFactory*)this;
if (*aResult == NULL)
return NS_NOINTERFACE;
AddRef(); // Increase reference count for caller
return NS_OK;
}
NS_IMPL_ADDREF(nsMsgFactory)
NS_IMPL_RELEASE(nsMsgFactory)
nsresult nsMsgFactory::CreateInstance(nsISupports *aOuter, const nsIID &aIID, void **aResult)
{
nsresult res = NS_OK;
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
*aResult = NULL;
nsISupports *inst = nsnull;
// ClassID check happens here
// Whenever you add a new class that supports an interface, plug it in here!!!
// do they want an RFC822 Parser interface ?
if (mClassID.Equals(kCMsgRFC822ParserCID))
{
res = NS_NewRFC822Parser((nsIMsgRFC822Parser **) &inst);
if (res != NS_OK) // was there a problem creating the object ?
return res;
}
// End of checking the interface ID code....
if (inst)
{
// so we now have the class that supports the desired interface...we need to turn around and
// query for our desired interface.....
res = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
if (res != NS_OK) // if the query interface failed for some reason, then the object did not get ref counted...delete it.
delete inst;
}
else
res = NS_ERROR_OUT_OF_MEMORY;
return res;
}
nsresult nsMsgFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
// return the proper factory to the caller.
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
{
if (nsnull == aFactory)
return NS_ERROR_NULL_POINTER;
// If we decide to implement multiple factories in the msg.dll, then we need to check the class
// type here and create the appropriate factory instead of always creating a nsMsgFactory...
*aFactory = new nsMsgFactory(aClass);
if (aFactory)
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); // they want a Factory Interface so give it to them
else
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -0,0 +1,94 @@
# 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.
NODEPEND=1
IGNORE_MANIFEST = 1
#//------------------------------------------------------------------------
#//
# New build system where zip dll is build indepenant of java stubs.
#//
#//------------------------------------------------------------------------
MODULE =testmsgfactory
#EXPORTS = \
# $(NULL)
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..\..
MAKE_OBJ_TYPE=EXE
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
EXENAME=TestMSGFactory
PDBFILE=TestMSGFactory.pdb
MAPFILE=TestMSGFactory.map
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
OBJS= \
.\$(OBJDIR)\test.obj \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
PROGRAM=.\$(OBJDIR)\$(EXENAME).EXE
#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LCFLAGS=-DNETSCAPE
LLIBS= $(LLIBS) ole32.lib \
$(DIST)\lib\xpcom32.lib
LINCS=$(LINCS) -I. \
-I$(PUBLIC)\mailnews \
-I$(PUBLIC)\xpcom
# clobber and clobber_all will remove the following garbage:
GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
install:: $(PROGRAM)
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin\
clobber::
rm -f $(EXENAME).exe

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

@ -0,0 +1,50 @@
#include <stdio.h>
#include "nsRepository.h"
#include "nsMsgCID.h"
#include "nsIMsgRFC822Parser.h"
static NS_DEFINE_IID(kIMsgRFC822ParserIID, NS_IMSGRFC822PARSER_IID);
static NS_DEFINE_CID(kMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID);
/* This is just a testing stub added by mscott. All I'm doing is loading a component,
and querying it for a particular interface.
It is its only purpose / use....
*/
int main(int argc, char *argv[])
{
nsIMsgRFC822Parser *sample;
// register our dll
nsRepository::RegisterFactory(kMsgRFC822ParserCID, "msg.dll", PR_FALSE, PR_FALSE);
nsresult res = nsRepository::CreateInstance(kMsgRFC822ParserCID,
NULL,
kIMsgRFC822ParserIID,
(void **) &sample);
if (res == NS_OK && sample) {
printf("We succesfully obtained a nsIMsgRFC822Parser interface....\n");
char * names = NULL;
char * addresses = NULL;
sample->ParseRFC822Addresses("Scott MacGregor <mscott@netscape.com>", &names, &addresses);
if (names)
{
printf(names);
printf("\n");
}
if (addresses)
{
printf(addresses);
printf("\n");
}
printf("Releasing the interface now...\n");
sample->Release();
}
return 0;
}

22
mailnews/makefile.win Normal file
Просмотреть файл

@ -0,0 +1,22 @@
#!nmake
#
# 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=..
DIRS=base news
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,22 @@
#!nmake
#
# 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=..\..
DIRS=public src tests
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,52 @@
#!nmake
#
# 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=..\..\..
IGNORE_MANIFEST=1
include <$(DEPTH)\config\config.mak>
LIBRARY_NAME=msgnews_s
MODULE= mailnews
REQUIRES=xpcom js nspr
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
$(NULL)
CPP_OBJS= \
$(NULL)
EXPORTS= \
$(NULL)
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\config\rules.mak>
libs:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

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

@ -0,0 +1,93 @@
# 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.
NODEPEND=1
IGNORE_MANIFEST = 1
#//------------------------------------------------------------------------
#//
# New build system where zip dll is build indepenant of java stubs.
#//
#//------------------------------------------------------------------------
MODULE =testNews \
#EXPORTS = \
# $(NULL)
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..\..
MAKE_OBJ_TYPE=EXE
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
EXENAME=TestNews
PDBFILE=TestNews.pdb
MAPFILE=TestNews.map
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
OBJS= \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
PROGRAM=.\$(OBJDIR)\$(EXENAME).EXE
#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LCFLAGS=-DNETSCAPE
LLIBS= $(LLIBS) ole32.lib \
$(DIST)\lib\xpcom32.lib
LINCS=$(LINCS) -I. \
-I$(PUBLIC)\mailnews \
-I$(PUBLIC)\xpcom
# clobber and clobber_all will remove the following garbage:
GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
install:: $(PROGRAM)
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin\
clobber::
rm -f $(EXENAME).exe