This commit is contained in:
morse%netscape.com 1999-03-10 21:35:41 +00:00
Родитель 94a2c7265e
Коммит 8c8d3c7f91
16 изменённых файлов: 5892 добавлений и 0 удалений

5
wallet/module/MANIFEST Normal file
Просмотреть файл

@ -0,0 +1,5 @@
#
# This is a list of local files which get copied to the mozilla:dist:privacy:module directory
#
nsIWallet.h

111
wallet/module/makefile.win Normal file
Просмотреть файл

@ -0,0 +1,111 @@
# 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 = walletlib
EXPORTS = nsIWalletService.h \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..\
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=walletlib.dll
PDBFILE=walletlib.pdb
MAPFILE=walletlib.map
DEFFILE=wallet.def
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
OBJS= \
.\$(OBJDIR)\nsWalletService.obj \
.\$(OBJDIR)\nsWalletFactory.obj \
$(NULL)
#//------------------------------------------------------------------------
#//
#// 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 -D_IMPL_NS_NET -DNO_NETWORK_POLLING
WALLETLIBS=\
$(DIST)\lib\wallet.lib \
$(NULL)
LLIBS=$(LLIBS) $(LIBNSPR) \
$(WALLETLIBS) \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\secfreenav32.lib \
$(DIST)\lib\libplc21.lib \
$(DIST)\lib\xppref32.lib \
$(DIST)\lib\xpcom32.lib \
$(DIST)\lib\xplib.lib \
$(DIST)\lib\netlib.lib \
$(NULL)
LINCS=$(LINCS) -I. \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\wallet \
-I$(PUBLIC)\raptor \
-I$(PUBLIC)\netlib \
$(NULL)
# clobber and clobber_all will remove the following garbage:
GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
$(DLL): $(WALLETLIBS)
libs:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME) $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\walletlib.lib $(DIST)\lib

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

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 4; 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 nsIWalletService_h___
#define nsIWalletService_h___
//#include "nscore.h"
#include "nsISupports.h"
#include "nsString.h"
#include "nsIPresShell.h"
#include "lo_ele.h"
#include "nsIURL.h"
// {738CFD51-ABCF-11d2-AB4B-0080C787AD96}
#define NS_IWALLETSERVICE_IID \
{ 0x738cfd51, 0xabcf, 0x11d2, { 0xab, 0x4b, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96 } };
// {738CFD52-ABCF-11d2-AB4B-0080C787AD96}
#define NS_WALLETSERVICE_CID \
{ 0x738cfd52, 0xabcf, 0x11d2, { 0xab, 0x4b, 0x0, 0x80, 0xc7, 0x87, 0xad, 0x96 } };
/**
* The nsIWalletService interface provides an API to the wallet service.
* This is a preliminary interface which <B>will</B> change over time!
*
*/
struct nsIWalletService : public nsISupports
{
NS_IMETHOD WALLET_PreEdit(nsIURL* url) = 0;
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, PRBool quick) = 0;
NS_IMETHOD WALLET_Capture(nsIDocument* doc, nsString name, nsString value) = 0;
NS_IMETHOD WALLET_OKToCapture(PRBool* result, PRInt32 count, char* URLName) = 0;
#ifdef junk
NS_IMETHOD SI_DisplaySignonInfoAsHTML()=0;
NS_IMETHOD SI_RememberSignonData
(char* URLName, LO_FormSubmitData *submit)=0;
NS_IMETHOD SI_RestoreSignonData
(char* URLNAME, char* name, char** value)=0;
#endif
};
#endif /* nsIWalletService_h___ */

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

@ -0,0 +1,34 @@
/* -*- 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.
*/
// This header file just contains prototypes for the factory methods
// for "builtin" data sources that are included in walletlib.dll. Each of
// these data sources is exposed to the external world via its CID in
// ../include/nsIWalletService.h.
#ifndef nsBuiltinDataSources_h__
#define nsBuiltinDataSources_h__
//#include "nsError.h"
//class nsIWalletDataSource;
//class nsIWalletDataBase;
nsresult NS_NewWalletService(nsIWalletServiceDataSource** result);
#endif // nsBuiltinDataSources_h__

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

@ -0,0 +1,163 @@
/* -*- 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.
*/
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIWalletService.h"
//#include "nsIServiceManager.h"
//#include "nsRepository.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
//#if defined(HAS_C_PLUS_PLUS_CASTS)
//#define NS_STATIC_CAST(__type, __ptr) static_cast<__type>(__ptr)
//#else
//#define NS_STATIC_CAST(__type, __ptr) ((__type)(__ptr))
//#endif
// factory functions
nsresult NS_NewWalletService(nsIWalletService** result);
class WalletFactoryImpl : public nsIFactory
{
public:
WalletFactoryImpl(const nsCID &aClass);
// nsISupports methods
NS_DECL_ISUPPORTS
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
protected:
virtual ~WalletFactoryImpl();
private:
nsCID mClassID;
};
////////////////////////////////////////////////////////////////////////
WalletFactoryImpl::WalletFactoryImpl(const nsCID &aClass)
{
NS_INIT_REFCNT();
mClassID = aClass;
}
WalletFactoryImpl::~WalletFactoryImpl()
{
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
}
NS_IMETHODIMP
WalletFactoryImpl::QueryInterface(const nsIID &aIID,
void **aResult)
{
if (! aResult)
return NS_ERROR_NULL_POINTER;
// Always NULL result, in case of failure
*aResult = nsnull;
if (aIID.Equals(kISupportsIID)) {
*aResult = NS_STATIC_CAST(nsISupports*, this);
AddRef();
return NS_OK;
} else if (aIID.Equals(kIFactoryIID)) {
*aResult = NS_STATIC_CAST(nsIFactory*, this);
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(WalletFactoryImpl);
NS_IMPL_RELEASE(WalletFactoryImpl);
NS_IMETHODIMP
WalletFactoryImpl::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
*aResult = nsnull;
nsresult rv;
PRBool wasRefCounted = PR_TRUE;
nsISupports *inst = nsnull;
if (mClassID.Equals(kWalletServiceCID)) {
if (NS_FAILED(rv = NS_NewWalletService((nsIWalletService**) &inst)))
return rv;
}
else {
return NS_ERROR_NO_INTERFACE;
}
if (! inst)
return NS_ERROR_OUT_OF_MEMORY;
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
// We didn't get the right interface, so clean up
delete inst;
if (wasRefCounted)
NS_IF_RELEASE(inst);
return rv;
}
nsresult WalletFactoryImpl::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// return the proper factory to the caller
extern "C" PR_IMPLEMENT(nsresult)
NSGetFactory(nsISupports* serviceMgr,
const nsCID &aClass,
const char *aClassName,
const char *aProgID,
nsIFactory **aFactory)
{
if (! aFactory)
return NS_ERROR_NULL_POINTER;
WalletFactoryImpl* factory = new WalletFactoryImpl(aClass);
if (factory == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(factory);
*aFactory = factory;
return NS_OK;
}

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

@ -0,0 +1,128 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
//#include "nsRepository.h"
#include "nsWalletService.h"
//#include "nsINetService.h"
#include "nsIServiceManager.h"
//static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
//static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
//#include "nsIWebShell.h"
//static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
//static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
#include "wallet.h"
//#if defined(HAS_C_PLUS_PLUS_CASTS)
//#define NS_STATIC_CAST(__type, __ptr) static_cast<__type>(__ptr)
//#else
//#define NS_STATIC_CAST(__type, __ptr) ((__type)(__ptr))
//#endif
nsWalletlibService::nsWalletlibService()
{
NS_INIT_REFCNT();
}
nsWalletlibService::~nsWalletlibService()
{
}
/* calls into the wallet module */
NS_IMETHODIMP
nsWalletlibService::QueryInterface(REFNSIID iid, void** result)
{
if (! result)
return NS_ERROR_NULL_POINTER;
*result = nsnull;
if (iid.Equals(kIWalletServiceIID)) {
*result = NS_STATIC_CAST(nsIWalletService*, this);
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(nsWalletlibService);
NS_IMPL_RELEASE(nsWalletlibService);
NS_IMETHODIMP nsWalletlibService::WALLET_PreEdit(nsIURL* url) {
::WLLT_PreEdit(url);
return NS_OK;
}
NS_IMETHODIMP nsWalletlibService::WALLET_Prefill(nsIPresShell* shell, PRBool quick) {
::WLLT_Prefill(shell, quick);
return NS_OK;
}
NS_IMETHODIMP nsWalletlibService::WALLET_OKToCapture
(PRBool* result, PRInt32 count, char* URLName) {
::WLLT_OKToCapture(result, count, URLName);
return NS_OK;
}
NS_IMETHODIMP nsWalletlibService::WALLET_Capture(
nsIDocument* doc,
nsString name,
nsString value) {
::WLLT_Capture(doc, name, value);
return NS_OK;
}
#ifdef junk
NS_IMETHODIMP
nsWalletlibService::SI_DisplaySignonInfoAsHTML(){
::SI_DisplaySignonInfoAsHTML();
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::SI_RememberSignonData
(char* URLName, LO_FormSubmitData *submit) {
::SI_RememberSignonData(URLName, submit);
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::SI_RestoreSignonData
(char* URLName, char* name, char** value) {
::SI_RestoreSignonData(URLName, name, value);
return NS_OK;
}
#endif
/* call to create the wallet object */
nsresult
NS_NewWalletService(nsIWalletService** result)
{
nsIWalletService* wallet = new nsWalletlibService();
if (! wallet)
return NS_ERROR_NULL_POINTER;
*result = wallet;
NS_ADDREF(*result);
return NS_OK;
}

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

@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsWalletService_h___
#define nsWalletService_h___
#include "nsIWalletService.h"
class nsWalletlibService : public nsIWalletService {
public:
NS_DECL_ISUPPORTS
nsWalletlibService();
/* Implementation of the nsIWalletService interface */
NS_IMETHOD WALLET_PreEdit(nsIURL* url);
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, PRBool quick);
NS_IMETHOD WALLET_Capture(nsIDocument* doc, nsString name, nsString value);
NS_IMETHOD WALLET_OKToCapture(PRBool* result, PRInt32 count, char* URLName);
#ifdef junk
NS_IMETHOD SI_DisplaySignonInfoAsHTML();
NS_IMETHOD SI_RememberSignonData
(char* URLName, LO_FormSubmitData *submit);
NS_IMETHOD SI_RestoreSignonData
(char* URLNAME, char* name, char** value);
#endif
protected:
virtual ~nsWalletlibService();
private:
};
#endif /* nsWalletService_h___ */

19
wallet/module/wallet.def Normal file
Просмотреть файл

@ -0,0 +1,19 @@
; 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.
LIBRARY walletlib.dll
EXPORTS
WALLET_Prefill

5
wallet/public/MANIFEST Normal file
Просмотреть файл

@ -0,0 +1,5 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#
wallet.h

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

@ -0,0 +1,26 @@
#!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=..\..
EXPORTS = \
wallet.h \
$(NULL)
MODULE=wallet
include <$(DEPTH)\config\rules.mak>

44
wallet/public/singsign.h Normal file
Просмотреть файл

@ -0,0 +1,44 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
/*
singsign.h --- prototypes for wallet functions.
*/
#ifndef _SINGSIGN_H
#define _SINGSIGNT_H
#include "ntypes.h"
XP_BEGIN_PROTOS
extern void
SI_DisplaySignonInfoAsHTML();
extern void
SI_RememberSignonData(char* URLName, LO_FormSubmitData *submit);
extern void
SI_RestoreSignonData(char* URLName, char* name, char** value);
XP_END_PROTOS
#endif /* !_SINGSIGN_H */

50
wallet/public/wallet.h Normal file
Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
/*
wallet.h --- prototypes for wallet functions.
*/
#ifndef _WALLET_H
#define _WALLET_H
#include "ntypes.h"
#include "nsIPresShell.h"
#include "nsString.h"
#include "nsIURL.h"
XP_BEGIN_PROTOS
extern void
WLLT_PreEdit(nsIURL* url);
extern void
WLLT_Prefill(nsIPresShell* shell, PRBool quick);
extern void
WLLT_OKToCapture(PRBool * result, PRInt32 count, char* URLName);
extern void
WLLT_Capture(nsIDocument* doc, nsString name, nsString value);
XP_END_PROTOS
#endif /* !_WALLET_H */

321
wallet/src/htmldlgs.h Normal file
Просмотреть файл

@ -0,0 +1,321 @@
#include "xp_mcom.h"
#include "xp_file.h"
#include "plarenas.h"
#include "jsotypes.h"
#include "plstr.h"
#include "seccomon.h"
#include "xpgetstr.h"
#define HTML_DLGS_URL "file:///y|/htmldlgs.html"
#define XP_DIALOG_CANCEL_BUTTON (1<<0)
#define XP_DIALOG_OK_BUTTON (1<<2)
#define XP_STRINGS_CHUNKSIZE 512
typedef struct _XPDialogState XPDialogState;
typedef struct _XPDialogInfo XPDialogInfo;
typedef struct _XPDialogStrings XPDialogStrings;
typedef PRBool (* XP_HTMLDialogHandler)
(XPDialogState *state, char **argv, int argc, unsigned int button);
/* SACopy and SACat should really be defined elsewhere */
#include "plstr.h"
#include "prmem.h"
#define LocalStrAllocCopy(dest, src) Local_SACopy (&(dest), src)
#define LocalStrAllocCat(dest, src) Local_SACat (&(dest), src)
char *
Local_SACopy(char **destination, const char *source)
{
if(*destination) {
PL_strfree(*destination);
*destination = 0;
}
*destination = PL_strdup(source);
return *destination;
}
char *
Local_SACat(char **destination, const char *source)
{
if (source && *source) {
if (*destination) {
int length = PL_strlen (*destination);
*destination = (char *) PR_Realloc(*destination, length + PL_strlen(source) + 1);
if (*destination == NULL) {
return(NULL);
}
PL_strcpy (*destination + length, source);
} else {
*destination = PL_strdup(source);
}
}
return *destination;
}
struct _XPDialogState {
PRArenaPool *arena;
void *window;
void *proto_win;
XPDialogInfo *dialogInfo;
void *arg;
void (* deleteCallback)(void *arg);
void *cbarg;
PRBool deleted;
};
struct _XPDialogInfo {
unsigned int buttonFlags;
XP_HTMLDialogHandler handler;
int width;
int height;
};
struct _XPDialogStrings
{
PRArenaPool *arena;
int basestringnum;
int nargs;
char **args;
char *contents;
};
XPDialogState *
XP_MakeHTMLDialog(
void *proto_win,
XPDialogInfo *dialogInfo,
int titlenum,
XPDialogStrings *strings,
void *arg,
PRBool utf8CharSet)
{
/* write out html dialog to /htmldlgs.htm */
XP_File f = fopen("/htmldlgs.htm","w");
for (int i=0; i<strings->nargs; i++) {
if (strings->args[i]) {
fprintf(f, "%s", (char *)(strings->args[i]));
}
}
fclose(f);
fflush(f);
/* write out dialog info to /index.htm */
f = fopen("/index.htm","w");
fprintf(f, "<HTML> \n");
fprintf(f, " <BODY \n");
fprintf(f, " onload=\"msgWindow=window.open(\n");
fprintf(f, " 'htmldlgs.htm', \n");
fprintf(f, " 'window2', \n");
fprintf(f, " 'resizable=no, titlebar=no, width=%d, height=%d')\">\n",
dialogInfo->width, dialogInfo->height);
fprintf(f, " </BODY> \n");
fprintf(f, "</HTML> \n");
fclose(f);
fflush(f);
return NULL;
}
void
XP_MakeHTMLDialog2(XPDialogInfo *dialogInfo) {
char* argv[] = {NULL, NULL, NULL, NULL, NULL, NULL};
int argc = 0;
char* button = NULL;
nsAutoString * nsCookie = new nsAutoString("");
nsIURL* url;
char* separator;
nsINetService *netservice;
nsresult res;
res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&netservice);
if ((NS_OK == res) && (nsnull != netservice)) {
const nsAutoString html_dlgs = nsAutoString(HTML_DLGS_URL);
if (!NS_FAILED(NS_NewURL(&url, html_dlgs))) {
res = netservice->GetCookieString(url, *nsCookie);
}
/* convert cookie to a C string */
char *cookies = nsCookie->ToNewCString();
char *cookie = PL_strstr(cookies, "htmldlgs=|"); /* get to htmldlgs=| */
cookie = cookie + PL_strlen("htmldlgs=|"); /* get passed htmldlgs=| */
/* button name is first item in cookie (up to next verical bar) */
separator = strchr(cookie, '|');
*separator = '\0';
LocalStrAllocCopy(button, cookie);
cookie = separator+1;
*separator = '|';
/* remainder of cookie string are the args, separated by vertical bars */
for (int i=0; ((*cookie != '\0') && (*cookie != ';')); i++) {
separator = strchr(cookie, '|');
*separator = '\0';
LocalStrAllocCopy(argv[i], cookie);
cookie = separator+1;
*separator = '|';
argc++;
}
/* call the callback routine */
if (!PORT_Strcmp(button,"OK")) {
(dialogInfo->handler)(NULL, argv, argc, XP_DIALOG_OK_BUTTON);
} else {
(dialogInfo->handler)(NULL, argv, argc, XP_DIALOG_CANCEL_BUTTON);
}
/* free up the allocated strings */
XP_FREE(button);
for (int j=0; j<argc; j++) {
XP_FREE(argv[j]);
}
delete cookies;
NS_RELEASE(netservice);
}
}
XPDialogStrings *
XP_GetDialogStrings(int stringnum)
{
XPDialogStrings *header = NULL;
PRArenaPool *arena = NULL;
char *dst, *src;
int n, size, len, done = 0;
/* get a new arena */
arena = PORT_NewArena(XP_STRINGS_CHUNKSIZE);
if ( arena == NULL ) {
return(NULL);
}
/* allocate the header structure */
header = (XPDialogStrings *)PORT_ArenaAlloc(arena, sizeof(XPDialogStrings));
if ( header == NULL ) {
goto loser;
}
/* init the header */
header->arena = arena;
header->basestringnum = stringnum;
src = XP_GetString(stringnum);
len = PORT_Strlen(src);
size = len + 1;
dst = header->contents =
(char *)PORT_ArenaAlloc(arena, sizeof(char) * size);
if (dst == NULL) {
goto loser;
}
while (!done) { /* Concatenate pieces to form message */
PORT_Memcpy(dst, src, len+1);
done = 1;
if (XP_STRSTR(src, "%-cont-%")) { /* Continuation */
src = XP_GetString(++stringnum);
len = PORT_Strlen(src);
header->contents =
(char *)PORT_ArenaGrow(arena,
header->contents, size, size + len);
if (header->contents == NULL) {
goto loser;
}
dst = header->contents + size - 1;
size += len;
done = 0;
}
}
/* At this point we should have the complete message in
header->contents, including like %-cont-%, which will be
ignored later. */
/* Count the arguments in the message */
header->nargs = -1; /* Support %0% as lowest token */
src = header->contents;
while ((src = PORT_Strchr(src, '%'))) {
src++;
n = (int)XP_STRTOUL(src, &dst, 10);
if (dst == src) { /* Integer not found... */
src = PORT_Strchr(src, '%') + 1; /* so skip this %..% */
PORT_Assert(NULL != src-1); /* Unclosed %..% ? */
continue;
}
if (header->nargs < n) {
header->nargs = n;
}
src = dst + 1;
}
if (++(header->nargs) > 0) { /* Allocate space for arguments */
header->args =
(char **)PORT_ArenaZAlloc(arena, sizeof(char *) * header->nargs);
}
return(header);
loser:
PORT_FreeArena(arena, PR_FALSE);
return(NULL);
}
void
XP_SetDialogString(XPDialogStrings *strings, int argNum, char *string)
{
/* make sure we are doing it right */
PORT_Assert(argNum < strings->nargs);
PORT_Assert(argNum >= 0);
PORT_Assert(strings->args[argNum] == NULL);
/* set the string */
strings->args[argNum] = string;
return;
}
void
XP_CopyDialogString(XPDialogStrings *strings, int argNum, const char *string)
{
int len;
/* make sure we are doing it right */
PORT_Assert(argNum < strings->nargs);
PORT_Assert(argNum >= 0);
PORT_Assert(strings->args[argNum] == NULL);
/* copy the string */
len = PORT_Strlen(string) + 1;
strings->args[argNum] = (char *)PORT_ArenaAlloc(strings->arena, len);
if ( strings->args[argNum] != NULL ) {
PORT_Memcpy(strings->args[argNum], string, len);
}
return;
}
char *
XP_FindValueInArgs(const char *name, char **av, int ac)
{
for( ;ac > 0; ac -= 2, av += 2 ) {
if ( PORT_Strcmp(name, av[0]) == 0 ) {
return(av[1]);
}
}
return(0);
}
#define BUFLEN 5000
#define FLUSH_BUFFER \
if (buffer) { \
LocalStrAllocCat(buffer2, buffer); \
buffer[0] = '\0'; \
g = 0; \
}
extern int XP_EMPTY_STRINGS;

53
wallet/src/makefile.win Normal file
Просмотреть файл

@ -0,0 +1,53 @@
#!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=..\..
LIBRARY_NAME=wallet
CPP_OBJS= .\$(OBJDIR)\wallet.obj
CSRCS = wallet.cpp
CPPSRCS = \
$(NULL)
MODULE=wallet
REQUIRES=wallet
EXPORTS= $(NULL)
LINCS= \
-I$(PUBLIC)\raptor \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\dom \
-I$(PUBLIC)\js \
-I$(PUBLIC)\netlib \
-I$(PUBLIC)\security \
-I$(PUBLIC)\pref \
-I$(PUBLIC)\wallet
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
include <$(DEPTH)\config\rules.mak>
libs:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
rm -f $(PDBFILE).pdb

3193
wallet/src/singsign.cpp Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1631
wallet/src/wallet.cpp Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу